[pacman-dev] Splitting packages with makepkg

Marc - A. Dahlhaus [ Administration | Westermann GmbH ] mad at wol.de
Fri Aug 15 05:24:07 EDT 2008


Am Freitag, den 15.08.2008, 12:57 +1000 schrieb Allan McRae:
> Henning Garus wrote:
> > Now my (maybe) more useful comments:
> >
> > This looks very much like the PKGBUILD I already had in my head after
> > reading the other threads and thinking about splitting packages. While
> > thinking I became unsure about two things:
> >
> > 1) Is one build function enough? In an older thread someone (Aaron I
> > think) talked about building packages with different configurations
> > from one packagebuild. I am not sure you can do this with one build
> > function. What you could do, is using the package functions to do this,
> > this would go against the "minimal fakeroot usage" thing, but is
> > probably sufficent for something rather uncommon. An alternative would
> > be, checking for build_pkgname functions and calling them if they are
> > defined.
> >
> >   
> Two build functions sounds like it would require two install functions 
> (as each package would probably have to add a conflict to the other) 
> which is really two PKGBUILDs.  I am not against adding this at the same 
> time but I would need to be convinced with a (useful) real world example 
> here.

How about this:

A "build_${pkgname}" function should be executed for every (including
the first) package (if exists for the first of course) after executing
the "build" function (if it exists) before the execution of any other
"build_${pkgname}" function without executing the packaging of contents
"build" may  have written to ${startdir}/pkg:

(0. -> build) if exist
1. -> build_pkg1
2. -> pack ${startdir}/pkg_pkg1
3. -> build_pkg2
4. -> pack ${startdir}/pkg_pkg2

If there is no build_pkg1 function:

1. -> build
2. -> pack ${startdir}/pkg
3. -> build_pkg2
4. -> pack ${startdir}/pkg_pkg2

That way it is up to the packager if a main build function should be
used to build everything and install things in separate functions to
override eg. depends or just use separated build functions for every

A real world example would be php5 which could be build for cli, cgi and
mod_php usage for apache2. Also many modules for php5 could be packed up
separately to minimize the depends for the main packages down to the
ones really needed for basic operation. I'll try to adapt my php
PKGBUILD to the proposed format over the weekend.

> > 2) This is a bit implementation specific, but I think it is important.
> > Is there any way, except parsing the PKGBUILD file, to get the contents
> > of all depends arrays, to check the depends before building the package?
> > If not, overriding depends could be problematic.
> >   
> As Xavier pointed out, I think that there would a big use of makedepends 
> and overriding of depends in the individual package functions.  In fact, 
> I am not sure what the depends array at the top of the PKGBUILD actually 
> means with split packages...

I would expect that the global array should represent all needed
dependencies to build every spilt-package (it would be the easiest way
to get a working "makepkg -s").


I found out that export have to be used to override vars inside of
functions that are already defined outside. It could be a bash
configuration problem here on my box but i hope someone can verify this


More information about the pacman-dev mailing list