xref: /OK3568_Linux_fs/buildroot/package/icu/0001-dont-build-static-dynamic-twice.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1Don't build object files twice
2
3When passed --enable-static and --enable-shared, icu will generate
4both a shared and a static version of its libraries.
5
6However, in order to do so, it builds each and every object file
7twice: once with -fPIC (for the shared library), and once without
8-fPIC (for the static library). While admittedly building -fPIC for a
9static library generates a slightly suboptimal code, this is what all
10the autotools-based project are doing. They build each object file
11once, and they use it for both the static and shared libraries.
12
13icu builds the object files for the shared library as .o files, and
14the object files for static library as .ao files. By simply changing
15the suffix of object files used for static libraries to ".o", we tell
16icu to use the ones built for the shared library (i.e, with -fPIC),
17and avoid the double build of icu.
18
19On a fast build server, this brings the target icu build from
203m41.302s down to 1m43.926s (approximate numbers: some other builds
21are running on the system at the same time).
22
23Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
24
25Index: b/source/config/mh-linux
26===================================================================
27--- a/source/config/mh-linux
28+++ b/source/config/mh-linux
29@@ -35,7 +35,7 @@
30 ## Shared object suffix
31 SO = so
32 ## Non-shared intermediate object suffix
33-STATIC_O = ao
34+STATIC_O = o
35
36 ## Compilation rules
37 %.$(STATIC_O): $(srcdir)/%.c
38