[Nix-dev] libs and static libs?

Marc Weber marco-oweber at gmx.de
Mon Oct 26 08:28:27 CET 2009


Which is the best way to provide both shared and static libraries?

background:

roadsend is a PHP compiler. You can compile PHP to executables in
different modes:
- standalone mini webserver
- fast cgi executable which can be run by Apache for instance
..

Of course deployment is one of the goals. The compiler has a --static
flag. If you use it you know that your executable are much more likely
to run any system. However this requires building static libraries of
various packages such as
fcgi, mysql, zlib,..

For this particular case I can add another mysqlStatic and pcreStatic
(whateever is missing ..)ö

But I think this is quite ugly because there is so much duplication.

A much nicer way is this:

{fetchurl, stdenv, static ? true}:
stdenv.mkDerivation ((rec {
  name = "fcgi-2.4.0";

 [..]
}) // (if static then { dontDisableStatic=1; configureFlags="--enable-static"; } else {} ))

Then you can use mkOverride and .override { static = true; } to get
static libraries.

Can you think of a sane more general way implementing this?

Marc Weber



More information about the nix-dev mailing list