[Mesa-dev] [PATCH 1/2] build libgallium shared by default.

Maarten Lankhorst maarten.lankhorst at canonical.com
Mon Mar 18 07:38:31 PDT 2013


This is one of the 2 patches used in ubuntu for decreasing size of mesa build.

The other one is more hacky, and links libmesagallium into libgallium,
and then links libgallium against libdricore too for minimal duplication.

This might mess up with static llvm, iirc static llvm is built wrong and
linking libgallium against it will cause it to export all llvm symbols too.
I believe that this is a bug in llvm though, not in mesa. The static libraries
should not export all llvm symbols.

I should probably change the default to not building shared gallium for the
same reason. :-)

Meant mostly for discussion purposes, although if there is no objection I'll
change the default to disabling shared gallium, and just let every distro enable
shared llvm and libgallium for themselves.

>8---
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>

--- a/configure.ac
+++ b/configure.ac
@@ -733,6 +733,19 @@
 fi
 AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
 
+AC_ARG_ENABLE([shared-gallium],
+    [AS_HELP_STRING([--enable-shared-gallium],
+        [Enable shared gallium core @<:@default=yes@:>@])],
+    [enable_shared_gallium="$enableval"],
+    [enable_shared_gallium=yes])
+
+SHARED_GALLIUM="0"
+if test "x$enable_shared_gallium" = xyes; then
+    SHARED_GALLIUM="1"
+fi
+AC_SUBST([SHARED_GALLIUM])
+AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test $SHARED_GALLIUM = 1)
+
 dnl
 dnl Driver specific build directories
 dnl
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -3,13 +3,19 @@
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libgallium.la
-
 AM_CFLAGS = \
 	-I$(top_srcdir)/src/gallium/auxiliary/util \
-	$(GALLIUM_CFLAGS) $(VISIBILITY_CFLAGS)
+	$(GALLIUM_CFLAGS)
+
+AM_CXXFLAGS =
 
-AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
+if HAVE_SHARED_GALLIUM
+lib_LTLIBRARIES = libgallium.la
+else
+noinst_LTLIBRARIES = libgallium.la
+AM_CFLAGS += $(VISIBILITY_CFLAGS)
+AM_CXXFLAGS += $(VISIBILITY_CXXFLAGS)
+endif
 
 libgallium_la_SOURCES = \
 	$(C_SOURCES) \
@@ -28,6 +34,8 @@
 
 AM_CXXFLAGS += -fno-rtti
 
+libgallium_la_LIBADD = $(LLVM_LIBS)
+
 endif
 
 libgallium_la_SOURCES += \



More information about the mesa-dev mailing list