support/libtool: make -static behave like -all-static
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 30 Jul 2014 20:36:34 +0000 (22:36 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 30 Jul 2014 21:27:19 +0000 (23:27 +0200)
commit97703978ac870ce2b14ad144f8e082de82aa2c64
tree17c0d2fa9d31fddf27c1e18520ed730c02f6e6cf
parent5d66a9b1fb67cf009fe4f15028c02a8386109dc5
support/libtool: make -static behave like -all-static

After switching TARGET_LDFLAGS from --static to -static, one issue
appears: from the point of view of libtool, -static only means to link
statically against the 'uninstalled libtool libraries' (i.e the
libraries that libtool has built in the current package), but
otherwise links dynamically with the other libraries. To really get a
completely static build, you need to pass -all-static to
libtool. Unfortunately, -all-static is only a valid option for
libtool, not as a general LDFLAGS, so we cannot to TARGET_LDFLAGS =
-all-static without breaking virtually all packages.

As pointed out 10 years ago on the libtool mailing list, the current
naming of the options is very confusing and the source of issues, and
there was a proposal to change -static to have the behavior of
-all-static, and instead introduce a separate -lt-static to have the
current behavior of -static. But that never got merged, because it was
breaking the current behavior. See:

  http://lists.gnu.org/archive/html/libtool/2004-11/msg00017.html

However, in Buildroot, when we pass -static, we really mean it, and we
want a completely static build. Therefore, this patch adapts our
ltmain.sh patches so that they alter the behavior of -static to make
it work like -all-static. The changes are small and quite easy to
understand, and have been tested to work fine with a small selection
of packages.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
support/libtool/buildroot-libtool-v1.5.patch
support/libtool/buildroot-libtool-v2.2.patch
support/libtool/buildroot-libtool-v2.4.patch