Re: SPEC file for pkgconfig



On Fri, 2002-01-18 at 03:38, Sebastian Voecking wrote:
> I'm back again!
> 
> Here is my first spec file. pkgconfig isn't really a GNOME2 package but
> it's often the first package to install when you try to build GNOME2.
> And it had no spec file. So I used it for my first example. It works
> pretty well on my system but I believe there are many points to improve.
> It also should be a kind of template for more complicated specs. So
> style if I forgot something (%post, %postun... are not forgotton but not
> needes I believe).

Woo, cool.  I'll make some comments below!
	Greg

> ----
> 

> Name:		pkgconfig
> Summary:	pkg-config
> Version:	0.8.0
> Release:	1
> License:	GPL
> Group:		Development/Tools
> Source:		%{name}-%{version}.tar.gz
> BuildRoot:	/var/tmp/%{name}-%{version}-root
> Packager:	Sebastian Voecking <voeck web de>

Very nice and tidy, though I try to avoid tabs, because some programs
(like my mailreader) screw them up.  :-/  
As somebody mentioned, using %{_tmppath}/%{name}-%{version}-root is a
better BuildRoot, as it's easier for people building packages to
override.

I don't usually set the Packager field in my spec files, I just make
sure to put my name in the %ChangeLog.  Instead, I define Packager,
Vendor, and Distribution in my ~/.rpmmacros


%packager GNOME Packaging Project <http://bugzilla.gnome.org/>
%vendor GNOME Packaging Project
%distribution Plain-GNOME


> 
> %description
> pkg-config is a script to make putting together all the build
> flags when compiling/linking a lot easier.

I might have stolen the description from the freedesktop.org/software/
webpage.

> 
> %prep
> %setup

If you add -q to the %setup macro, you don't have to watch the whole
output of tar, which makes logs from builds much smaller, and easier to
read.

> 
> %build
> ./configure --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --mandir=%{_mandir} --infodir=%{_infodir}

I much prefer this method to using %configure, as %configure almost
always requires you to put "%define __libtoolize /bin/true" somewhere in
your spec file to avoid having things break.  If you're passing
arguments to configure that don't have to do with file paths, such as
--disable-gtk-doc for example, I place them first on the line.  It's
also nice to break things up onto multiple lines.  Here's a snip from
the gail.spec file I just wrote:

./configure --disable-gtk-doc --prefix=%{_prefix} \
    --bindir=%{_bindir} --mandir=%{_mandir} \
    --localstatedir=%{_localstatedir} --libdir=%{_libdir} \
    --datadir=%{_datadir} --includedir=%{_includedir} \
    --sysconfdir=%{_sysconfdir} --sbindir=%{_sbindir} 

I'm still undecided if it's "cleaner" looking to do the above, or to put
just one argument on each line, like this:

./configure --disable-gtk-doc			\
    --prefix=%{_prefix}				\
    --bindir=%{_bindir}				\
    --mandir=%{_mandir}				\
    --localstatedir=%{_localstatedir}		\
    --libdir=%{_libdir}				\
    --datadir=%{_datadir}			\
    --includedir=%{_includedir}			\
    --sysconfdir=%{_sysconfdir}			\
    --sbindir=%{_sbindir}

Anybody have strong opinions either way?

> 
> make
> 
> %install
> rm -rf $RPM_BUILD_ROOT
> make prefix=$RPM_BUILD_ROOT%{_prefix} bindir=$RPM_BUILD_ROOT%{_bindir} sbindir=$RPM_BUILD_ROOT%{_sbindir} sysconfdir=$RPM_BUILD_ROOT%{_sysconfdir} datadir=$RPM_BUILD_ROOT%{_datadir} includedir=$RPM_BUILD_ROOT%{_includedir} libdir=$RPM_BUILD_ROOT%{_libdir} mandir=$RPM_BUILD_ROOT%{_mandir} infodir=$RPM_BUILD_ROOT%{_infodir} install

Cool, although according to some gurus on IRC, you should place things
like prefix and/or DESTDIR -after- the target (install) on the command
line.  Things before the target are interpreted as shell variables,
while things after the target are makefile variables.  I've only found
one place where doing things the "wrong" way has broken stuff, but it
was tough to debug that one.  Also, you might wrap that onto multiple
lines, to make it easier to read.  There's rarely enough room wrapping
at 80 characters for more than 1 path per line.

> 
> %clean
> rm -rf $RPM_BUILD_ROOT
> 
> %files
> %defattr(-, root, root)
> 
> %{_bindir}/*
> %{_datadir}/aclocal/*
> %{_mandir}/man1/*

Hmm, no %ChangeLog...  Put one in, and fill it out with pretty
nitty-gritty details of everything you change.  That way other packagers
can figure out if you've found something that they missed, or see what
they need to update.  Although, for new spec files, my changelog looks
like this:

%changelog
* Tue Jul 16 2002 Gregory Leblanc <gleblanc linuxweasel com>
- created new spec file

All in all, nice job! 
	Greg

-- 
Portland, Oregon, USA.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]