[ldb] Re: Moving basic libs to a new repo and release them as a separate package

Michael B Allen mba2000 at ioplex.com
Mon Feb 27 07:27:41 GMT 2006


On Mon, 27 Feb 2006 13:19:56 +1100
tridge at samba.org wrote:

> PS: waiting for the dreaded 'libtool' to be suggested ...

My sentiments exactly. That's why I created the attached mktool.c.

Basically you compile it on the target platform and get the "./mktool"
program that normalizes compiler flags and has a few options for
installing versioned libraries, deleting files, etc. The idea is that you
compile it with the compiler that you want to build your library with.
Then you run it like you would the compiler but now all the input options
are the same so you have one simple Makefile.

For example if you do:

  $ ./mktool -c -g -W1 -rpath ../lib -DFOO ...etc

on Linux this might translate to:

  $ gcc -g -Wall -W -Wl,-rpath,../lib -DFOO ...etc

whereas on HPUX if you compiled it with aCC it does:

  $ cc -g -Wl,+b,../lib -DFOO ...etc

It handles all the library version numbering and so on. Any options that
it doesn't substitute for, it just passes through.

It doesn't do autoconf type checks or anyting like that though. And of
course it's not perfect. It would need to be expanded as you encountered
different architectures or need some obscure linker options.

I've used it to build the same lib on Linux, OSX, NetBSD, Alpha, and HPUX
with a single simple old-school Makefile. No psycho Makefile.am debugging!

Anyway, that's how I build cross platform libraries.

Mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mktool.c
Type: application/octet-stream
Size: 13548 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20060227/11f80126/mktool.obj


More information about the samba-technical mailing list