All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/3] icu: don't build object files twice
Date: Sat,  9 Mar 2013 15:02:59 +0100	[thread overview]
Message-ID: <1362837781-27071-3-git-send-email-thomas.petazzoni@free-electrons.com> (raw)
In-Reply-To: <1362837781-27071-1-git-send-email-thomas.petazzoni@free-electrons.com>

When passed --enable-static and --enable-shared, icu will generate
both a shared and a static version of its libraries.

However, in order to do so, it builds each and every object file
twice: once with -fPIC (for the shared library), and once without
-fPIC (for the static library). While admittedly building -fPIC for a
static library generates a slightly suboptimal code, this is what all
the autotools-based project are doing. They build each object file
once, and they use it for both the static and shared libraries.

icu builds the object files for the shared library as .o files, and
the object files for static library as .ao files. By simply changing
the suffix of object files used for static libraries to ".o", we tell
icu to use the ones built for the shared library (i.e, with -fPIC),
and avoid the double build of icu.

On a fast build server, this brings the target icu build from
3m41.302s down to 1m43.926s (approximate numbers: some other builds
are running on the system at the same time).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 .../icu/icu-dont-build-static-dynamic-twice.patch  |   37 ++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 package/icu/icu-dont-build-static-dynamic-twice.patch

diff --git a/package/icu/icu-dont-build-static-dynamic-twice.patch b/package/icu/icu-dont-build-static-dynamic-twice.patch
new file mode 100644
index 0000000..ccbe534
--- /dev/null
+++ b/package/icu/icu-dont-build-static-dynamic-twice.patch
@@ -0,0 +1,37 @@
+Don't build object files twice
+
+When passed --enable-static and --enable-shared, icu will generate
+both a shared and a static version of its libraries.
+
+However, in order to do so, it builds each and every object file
+twice: once with -fPIC (for the shared library), and once without
+-fPIC (for the static library). While admittedly building -fPIC for a
+static library generates a slightly suboptimal code, this is what all
+the autotools-based project are doing. They build each object file
+once, and they use it for both the static and shared libraries.
+
+icu builds the object files for the shared library as .o files, and
+the object files for static library as .ao files. By simply changing
+the suffix of object files used for static libraries to ".o", we tell
+icu to use the ones built for the shared library (i.e, with -fPIC),
+and avoid the double build of icu.
+
+On a fast build server, this brings the target icu build from
+3m41.302s down to 1m43.926s (approximate numbers: some other builds
+are running on the system at the same time).
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/source/config/mh-linux
+===================================================================
+--- a/source/config/mh-linux
++++ b/source/config/mh-linux
+@@ -35,7 +35,7 @@
+ ## Shared object suffix
+ SO = so
+ ## Non-shared intermediate object suffix
+-STATIC_O = ao
++STATIC_O = o
+ 
+ ## Compilation rules
+ %.$(STATIC_O): $(srcdir)/%.c
-- 
1.7.9.5

  parent reply	other threads:[~2013-03-09 14:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-09 14:02 [Buildroot] [PATCH 0/3] Misc improvements and fixes to 'icu' package Thomas Petazzoni
2013-03-09 14:02 ` [Buildroot] [PATCH 1/3] icu: workaround toolchain bugs Thomas Petazzoni
2013-03-09 14:02 ` Thomas Petazzoni [this message]
2013-03-09 14:03 ` [Buildroot] [PATCH 3/3] icu: speed up host build Thomas Petazzoni
2013-03-10 22:34 ` [Buildroot] [PATCH 0/3] Misc improvements and fixes to 'icu' package Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362837781-27071-3-git-send-email-thomas.petazzoni@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.