Re: SPEC file for pkgconfig



On Sat, 2002-01-19 at 11:12, Chipzz wrote:
> On 18 Jan 2002, Gregory Leblanc wrote:
> 
> > From: Gregory Leblanc <gleblanc linuxweasel com>
> > Subject: Re: SPEC file for pkgconfig
> >
> > On Fri, 2002-01-18 at 03:38, Sebastian Voecking wrote:
[snip]
> > >
> > > %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?
> 
> Personally, I think it's overkill mentioning _all_ those dirs, especially
> given the fact that if you specify prefix, most of them are allready
> defined.
> Also, it makes it a lot less readable, and "obfuscates" the parts that
> really matter.

This isn't actually correct.  At the bare minimum, you should specify
prefix and sysconfdir on Red Hat systems, because if only specify
prefix, then sysconfdir == /usr/etc, and not /etc.  Furthermore, on Red
Hat, and other FHS compliant system, includedir is $prefix/include, but
this isn't always going to be the case.  Also, not specifying any
options that you actually use makes relocating parts of a package quite
risky.  For GNOME stuff, this doesn't matter because it's not actually
relocatable.  :-(

> > > 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
> 
> Same thoughts as above. You have these vars from the configure stage. Also,
> you forgot two: localedir and gnulocaledir.
> I just wonder why make it so complex? For alot of packages this will do just
> fine:
> 
> make install DESTDIR=$RPM_BUILD_ROOT

This does -not- work properly unless you have gettext 0.10.40.  I try to
use the things that will be most portable, and this isn't.  

> And if that doesn't work (for example, doesn't install .po files):
> 
> make install DESTDIR=$RPM_BUILD_ROOT gnulocaledir=$RPM_BUILD_ROOT/%{_gnulocaledir}
> 
> (this is from memory, not sure. you may need to do s/gnu//)
> 
> > 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
> 
> test $RPM_BUILD_ROOT != / && rm -rf $RPM_BUILD_ROOT

Erm, yeah, good idea.  I mostly don't because my portable bourne shell
scripting sucks.  :-)

> !!!!!!
> 
> > > %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
> 
> Greg, you forgot your usual rant about findlang ;;;;)

<gasp/>  You're right, I did!  However, this package doesn't have any
translated strings... 

Anyway, find_lang is a really cool rpm macro.  At the end of the
%install section, after you run make install, you put 

%find_lang %name

Then you change your %files line to read

%files -f %name.lang

and it automatically finds all of the translation files, and includes
them.  No need to include %{_datadir}/locale/*/*/*.  Cool stuff.

> PPPPS: Anyone know of a good packaging tutorial for debian? ;)

I understand that there's a debian packaging document, but I don't have
a URL, sorry.
	Greg

-- 
Portland, Oregon, USA.




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