Web lists-archives.com

Re: build 2 similar binary packages from one source tree

On Mon, Dec 25, 2017 at 01:43:13AM +0900, Osamu Aoki wrote:
> maildrop source tree can be build with different build option to produce
> maildrop program in 2 ways for each arch.
>  * set GID mail without restricted caller (maildrop)
>  * set UID root with restricted caller for courier-mta
>    (maildrop-courier) -- This is now missing in archive but we used to
>    have it.
> Of course we can build 2 source packages to do this.  But is there any
> easy clean way to do this without making 2 source packages with
> identical upstream tarball.
> Any pointer to a simple example which uses autotools as its build script
> is appreciated.  (Program example simpler than glibc or linux kernel is
> appreciated.)

While autotools in principle do support out-of-tree builds, a particular
program might still fail.  And, most non-autotools non-cmake build systems
don't support that at all.

In such cases, there's a heavy hammer of linking the whole build tree to
two temporary directories, and building from those.

For example, crawl does:

        mkdir build-console
        cp -ldpR docs settings source CREDITS.txt build-console/
        mkdir build-tiles
        cp -ldpR docs settings source CREDITS.txt build-tiles/
        touch tree-stamp

then for actual build:
        cd build-console/source && $(MAKE) $(ARGS_CONSOLE)
        cd build-tiles/source && $(MAKE) $(ARGS_TILES)

// If you believe in so-called "intellectual property", please immediately
// cease using counterfeit alphabets.  Instead, contact the nearest temple
// of Amon, whose priests will provide you with scribal services for all
// your writing needs, for Reasonable And Non-Discriminatory prices.