Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH RFC] uclibc: Don't build shared library if !HAVE_SHARED
Date: Fri, 06 Sep 2013 21:02:37 +0800	[thread overview]
Message-ID: <1378472557.19947.1.camel@phoenix> (raw)

Current setting unconditionally build shared library.
This result in build error when HAVE_SHARED is not set.
Fix it to build shared library only when HAVE_SHARED=y.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
I was thinking to unset HAVE_SHARED if BR2_PREFER_STATIC_LIB=y.
So I can avoid the "grep" in UCLIBC_BUILD_SHARED_LIBS.

However, I feel that when BR2_PREFER_STATIC_LIB is not set, it does not means
HAVE_SHARED is always true.
Comments?

 package/uclibc/uclibc.mk | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
index a25bfee..85bf10c 100644
--- a/package/uclibc/uclibc.mk
+++ b/package/uclibc/uclibc.mk
@@ -458,6 +458,15 @@ endef
 
 UCLIBC_POST_PATCH_HOOKS += UCLIBC_SETUP_DOT_CONFIG
 
+define UCLIBC_BUILD_SHARED_LIBS
+	if grep -q HAVE_SHARED=y $(@D)/.config; then \
+		$(TARGET_CROSS)gcc -nostdlib -nostartfiles -shared \
+			-x c /dev/null -o $(STAGING_DIR)/usr/lib/libc.so; \
+		$(TARGET_CROSS)gcc -nostdlib -nostartfiles -shared \
+			-x c /dev/null -o $(STAGING_DIR)/usr/lib/libm.so; \
+	fi
+endef
+
 define UCLIBC_CONFIGURE_CMDS
 	$(MAKE1) -C $(UCLIBC_DIR) \
 		$(UCLIBC_MAKE_FLAGS) \
@@ -466,10 +475,7 @@ define UCLIBC_CONFIGURE_CMDS
 		RUNTIME_PREFIX=$(STAGING_DIR) \
 		headers startfiles \
 		install_headers install_startfiles
-	$(TARGET_CROSS)gcc -nostdlib \
-		-nostartfiles -shared -x c /dev/null -o $(STAGING_DIR)/usr/lib/libc.so
-	$(TARGET_CROSS)gcc -nostdlib \
-		-nostartfiles -shared -x c /dev/null -o $(STAGING_DIR)/usr/lib/libm.so
+	$(UCLIBC_BUILD_SHARED_LIBS)
 endef
 
 ifeq ($(BR2_UCLIBC_INSTALL_TEST_SUITE),y)
-- 
1.8.1.2

                 reply	other threads:[~2013-09-06 13:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1378472557.19947.1.camel@phoenix \
    --to=axel.lin@ingics.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox