libjson: ensure shared lib is built with -fPIC
authorPeter Korsgaard <jacmet@sunsite.dk>
Fri, 3 May 2013 11:10:23 +0000 (13:10 +0200)
committerPeter Korsgaard <jacmet@sunsite.dk>
Fri, 3 May 2013 11:10:23 +0000 (13:10 +0200)
Fixes http://autobuild.buildroot.net/results/72e6c260c9028dd636965b8bf76bb7ba216aa1a4/build-end.log

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
package/libjson/libjson.mk

index deca0f845d8bc63eb2c868d7f81853491d82fa8f..9b1aca3bf7ac2606089c6c2735d038ca15964774 100644 (file)
@@ -11,8 +11,16 @@ LIBJSON_INSTALL_STAGING = YES
 LIBJSON_LICENSE = BSD-2c
 LIBJSON_LICENSE_FILES = License.txt
 
-LIBJSON_MAKE_OPT = BUILD_TYPE= SHARED=$(if $(BR2_PREFER_STATIC_LIB),0,1) \
-       CXXFLAGS="$(TARGET_CXXFLAGS) -DNDEBUG"
+LIBJSON_CXXFLAGS = $(TARGET_CFLAGS) -DNDEBUG
+
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+LIBJSON_MAKE_OPT += SHARED=0
+else
+LIBJSON_MAKE_OPT += SHARED=1
+LIBJSON_CXXFLAGS += -fPIC
+endif
+
+LIBJSON_MAKE_OPT += BUILD_TYPE= CXXFLAGS="$(LIBJSON_CXXFLAGS)"
 
 define LIBJSON_EXTRACT_CMDS
        unzip -d $(@D) $(DL_DIR)/$(LIBJSON_SOURCE)