mesa: build xmlconfig to a separate static library
authorErik Faye-Lund <kusmabite@gmail.com>
Wed, 10 Jun 2015 22:35:04 +0000 (23:35 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 12 Jun 2015 14:32:18 +0000 (15:32 +0100)
As we use the file from both the dri modules and loader, we end up with
multiple definition of the symbols provided in our gallium dri  modules.
Additionally we compile the file twice.

Resolve both issues, effectively enabling the build on toolchains which
don't support -Wl,--allow-multiple-definition.

v2: [Emil Velikov]
 - Fix the Scons/Android build.
 - Resolve libgbm build issues (bring back the missing -lm)

Cc: Julien Isorce <j.isorce@samsung.com>
Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90310
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90905
Acked-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
src/gallium/targets/dri/Makefile.am
src/loader/Makefile.am
src/mesa/drivers/dri/Makefile.am
src/mesa/drivers/dri/common/Android.mk
src/mesa/drivers/dri/common/Makefile.am
src/mesa/drivers/dri/common/Makefile.sources
src/mesa/drivers/dri/common/SConscript
src/mesa/drivers/dri/i965/Makefile.am

index f9e4ada9338a01c22d83b4d9b79d48a57eb70965..96483964589f49d64bbc11c78f3f918e2efab2f0 100644 (file)
@@ -53,12 +53,6 @@ gallium_dri_la_LIBADD = \
        $(LIBDRM_LIBS) \
        $(GALLIUM_COMMON_LIB_DEPS)
 
-# XXX: Temporary allow duplicated symbols, as the loader pulls in xmlconfig.c
-# which already provides driParse* and driQuery* amongst others.
-# Remove this hack as we come up with a cleaner solution.
-gallium_dri_la_LDFLAGS += \
-       -Wl,--allow-multiple-definition
-
 EXTRA_gallium_dri_la_DEPENDENCIES = \
        dri.sym \
        $(top_srcdir)/src/gallium/targets/dri-vdpau.dyn
index 36ddba82bd39daf57312ce86779615d8e8ae34cc..aef1bd61beab78bbddf6f5a02129cd8d98650bdb 100644 (file)
@@ -41,15 +41,11 @@ libloader_la_CPPFLAGS += \
        -I$(top_builddir)/src/mesa/drivers/dri/common/ \
        -I$(top_srcdir)/src/mesa/ \
        -I$(top_srcdir)/src/mapi/ \
-       -DUSE_DRICONF \
-       $(EXPAT_CFLAGS)
+       -DUSE_DRICONF
 
-libloader_la_SOURCES += \
-       $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
+ libloader_la_LIBADD += \
+       $(top_builddir)/src/mesa/drivers/dri/common/libxmlconfig.la
 
-libloader_la_LIBADD += \
-       -lm \
-       $(EXPAT_LIBS)
 endif
 
 if !HAVE_LIBDRM
index fa1de103b56fe213ce2ea65d3436febb73f3d883..08a8e6455219da5b9cf53557d83fc4143aed9331 100644 (file)
@@ -60,6 +60,7 @@ mesa_dri_drivers_la_LIBADD = \
         ../../libmesa.la \
         common/libmegadriver_stub.la \
         common/libdricommon.la \
+        common/libxmlconfig.la \
         $(MEGADRIVERS_DEPS) \
         $(DRI_LIB_DEPS) \
         $()
index c003c942fcabf7225d59d16ffb6b64fba48fe74c..6986f5e8cb4577f10942382d69c32032dbb8e476 100644 (file)
@@ -50,7 +50,9 @@ else
 LOCAL_SHARED_LIBRARIES := libdrm
 endif
 
-LOCAL_SRC_FILES := $(DRI_COMMON_FILES)
+LOCAL_SRC_FILES := \
+       $(DRI_COMMON_FILES) \
+       $(XMLCONFIG_FILES)
 
 MESA_DRI_OPTIONS_H := $(intermediates)/xmlpool/options.h
 LOCAL_GENERATED_SOURCES := $(MESA_DRI_OPTIONS_H)
index da8f97a980e21a9dddca8f2d596b35ee0ec2f37d..ae19fcb356593861ca2614ca4036c6602430d32a 100644 (file)
@@ -33,16 +33,20 @@ AM_CFLAGS = \
        -I$(top_srcdir)/src/gallium/include \
        -I$(top_srcdir)/src/gallium/auxiliary \
        $(DEFINES) \
-       $(EXPAT_CFLAGS) \
        $(VISIBILITY_CFLAGS)
 
 noinst_LTLIBRARIES = \
        libdricommon.la \
+       libxmlconfig.la \
        libmegadriver_stub.la \
        libdri_test_stubs.la
 
 libdricommon_la_SOURCES = $(DRI_COMMON_FILES)
 
+libxmlconfig_la_SOURCES = $(XMLCONFIG_FILES)
+libxmlconfig_la_CFLAGS = $(AM_CFLAGS) $(EXPAT_CFLAGS)
+libxmlconfig_la_LIBADD = $(EXPAT_LIBS) -lm
+
 libdri_test_stubs_la_SOURCES = $(test_stubs_FILES)
 libdri_test_stubs_la_CFLAGS = $(AM_CFLAGS) -DNO_MAIN
 
index d00ec5f7334aa5115e8afafa84916c9c00f626bd..d5d8da8fceed2021d07bf909d9d78ff68475018c 100644 (file)
@@ -2,7 +2,9 @@ DRI_COMMON_FILES := \
        utils.c \
        utils.h \
        dri_util.c \
-       dri_util.h \
+       dri_util.h
+
+XMLCONFIG_FILES := \
        xmlconfig.c \
        xmlconfig.h
 
index 0bee1b41fc6f86f87e847e4838d413efd8d3e039..b402736db691dbb5e42c23ddc9cacc5e78a270ed 100644 (file)
@@ -37,7 +37,7 @@ drienv.PkgUseModules('DRM')
 # else
 #env.Append(CPPDEFINES = ['__NOT_HAVE_DRM_H'])
 
-sources = drienv.ParseSourceList('Makefile.sources', 'DRI_COMMON_FILES')
+sources = drienv.ParseSourceList('Makefile.sources', ['DRI_COMMON_FILES', 'XMLCONFIG_FILES' ])
 
 dri_common = drienv.ConvenienceLibrary(
        target = 'dri_common',
index 235bcfeae025316c918971d203908225fda0b8e8..566f2ddd98ffdcf164c22491899b6dcc66bb7626 100644 (file)
@@ -48,6 +48,7 @@ libi965_dri_la_LIBADD = $(INTEL_LIBS)
 TEST_LIBS = \
        libi965_dri.la \
        ../common/libdricommon.la \
+       ../common/libxmlconfig.la \
        ../common/libmegadriver_stub.la \
         ../../../libmesa.la \
        $(DRI_LIB_DEPS) \