A few build system questions

Brooks Davis brooks at freebsd.org
Thu Aug 2 15:33:59 UTC 2018


On Thu, Aug 02, 2018 at 11:17:06AM -0400, Eric McCorkle wrote:
> Hi,
> 
> I have a few questions about how to accomplish some things with the
> build system.
> 
> First, I want to create some libraries that exist only as static
> archives, meaning no shared object (ex. libsomething.a, but no
> libsomething.so)

If it's something for use by only the base system PRIVATELIB= will
do it (and change the name to libprivatesomethi.a).  If you want to be
broadly available outside the base system, NO_SHARED= should do it IIRC.

> Second, how do I arrange to have sources be generated prior to the
> build?  I can probably get away with having a shell script that does it,
> but I may require a tool to be built.

If it's a shell script add a target for the sources.  If there's a
compiled tool then you need a build-tools target to build the tool in
the right stage of the bootstrap process.

> Third, how would I go about creating a kind of derived library- that is,
> one created by invoking a whole bunch of linker/objcopy/etc commands on
> some other library?  That is to say, "I want to get libsomething.a by
> running this script that processes libsomethingelse.a".

You'll probably want to add a libsomething.a target that depends on
libsomethingelse.a and the script and add libsomething.a to _LIBS in the
libsomethingelse Makefile.  You will also need to make certain the
script has the right failure modes (e.g. doesn't create libsomething.a
unless it succeeds even if it or it's children are killed with kill -9)
or life will get very confusing.  You'll want to get review from at
least bdrewery@ and brd@ for anything non-standard.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20180802/ee6eb24d/attachment.sig>


More information about the freebsd-hackers mailing list