On Wed, 31 May 2006, Damien Carbery wrote:
> I suppose we should publish a few templates e.g. a basic one, a meta one
> (with multiple sub modules e.g. SUNWgnome-base-libs.spec) and one with
> pre/post install or class action scripts.
>
> Here's a stab at a basic one, based on one that I happened to be using for
> testing the other day.
Cool, thanks.
I modified the template so the files section accounts for
files being installed into lib, and man in addition to bin.
So the files section now looks like this:
%files
%defattr (-, root, other)
%dir %attr (0755, root, bin) %{_bindir}
%{_bindir}/*
%dir %attr (0755, root, bin) %{_mandir}
%{_mandir}/*
%dir %attr (0755, root, bin) %{_libdir}
%{_libdir}/*
I also changed %setup from this:
%setup -q -n %name-%version
To this:
%setup -q -n <appname>-%version
(where a value for <appname> needs to be provided, and it
needs to be the top-level directory that the tarball unpacks
into.)
And that seems to result in a bare-bones, "base" template
that can be applied to a lot of regular, well-bahaved
packages -- where well-behaved = sources that are known to
build cleanly on Nevada with just ./configure ;gmake, and
where regular = packages that only install files in bin, man,
and lib.
By way of example, here's a working spec-files-extra spec
file for lynx using the template. I needed to enter the
%setup value (it's an non-standard one too BTW because the
lynx tarball unpacks into a directory with dashes where dots
should be), and the package's name, summary (one-line
description), version, and source (download url). The rest
came verbatim from the template.
#####
%include Solaris.inc
Name: SUNWlynx
Summary: lynx, a text web browser
Version: 2.8.5
Source: http://lynx.isc.org/release/lynx2.8.5.tar.bz2
SUNW_BaseDir: %{_basedir}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%include default-depend.inc
%prep
%setup -q -n lynx2-8-5
%build
CPUS=`/usr/sbin/psrinfo | grep on-line | wc -l | tr -d ' '`
if test "x$CPUS" = "x" -o $CPUS = 0; then
CPUS=1
fi
./configure --prefix=%{_prefix} --libdir=%{_libdir} --mandir=%{_mandir}
make -j$CPUS
%install
make install DESTDIR=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr (-, root, other)
%dir %attr (0755, root, bin) %{_bindir}
%{_bindir}/*
%dir %attr (0755, root, bin) %{_mandir}
%{_mandir}/*
%dir %attr (0755, root, bin) %{_libdir}
%{_libdir}/*
%changelog