Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH RFC] uclibc: Don't build shared library if !HAVE_SHARED
@ 2013-09-06 13:02 Axel Lin
  0 siblings, 0 replies; only message in thread
From: Axel Lin @ 2013-09-06 13:02 UTC (permalink / raw)
  To: buildroot

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-06 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06 13:02 [Buildroot] [PATCH RFC] uclibc: Don't build shared library if !HAVE_SHARED Axel Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox