On Sun, 2009-12-13 at 20:18 +0100, Renat Golubchyk wrote:
> Hi everyone!
> 
> I need to build a static binary of a program I wrote. The problem is
> that most packages only install dynamic version of the libraries.
> There
> are the "static" and "static-libs" USE flags, but only a tiny fraction
> of packages support them. Modifying every relevant ebuild is not
> really
> a viable solution since the list of packages is quite long and could
> change later.
> 
> So what can I do if I'd like to avoid compiling every package
> manually?

There is no easy answer to your question. I think because, with a lot of
programs it "just depends". Some packages already include static
libraries (e.g. python and it doesn't make sense to compile the python
package statically because it will break a great many things).  Some
programs just weren't designed to be static (e.g. imagemagick or
apache).  GTK+, i believe, can't be built statically as it uses dynload
for themes, input methods, etc etc.  Even most proprietary gtk-based
software that I know of (e.g. Adobe Flash and VMWare) either are
distributed with GTK+ linked dynamically or they provide their own GTK
libs).  

You can apply "-static" to CFLAGS, but make sure you have a binpkg built
first, as there is a chance you may break something.  You can also try
passing "--enable-static" to EXTRA_ECONF.  That's probably safer than
the former, but the same caveat applies.

Most of the things where static is "useful" and safe already have a
static flag though or provide static libs by default.  I think the only
exception I've encountered was e2fsprogs.  For that I usually compile my
own static executables.

HTH,
-a



Reply via email to