Op 19-03-13 12:37, Andreas Boll schreef: > 2013/3/19 Maarten Lankhorst <maarten.lankho...@canonical.com>: >> Op 18-03-13 16:28, Andreas Boll schreef: >>> 2013/3/18 Maarten Lankhorst <maarten.lankho...@canonical.com>: >>>> 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.lankho...@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]) >>>> + >>> The following code could be simplified... >>> >>>> +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) >>>> + >>> ... to: >>> >>> AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test "x$enable_shared_gallium" = xyes) >>> >> Woops you're right, this was a leftover from when the patch was a lot more >> invasive, >> and had to touch configs/autoconf.in too. >> The AM_CONDITIONAL was added later during the transition to 9.0 :-) >> >> Any thoughts on making shared gallium default or not? I'm thinking not >> because >> of the llvm symbol bug I mentioned above, unless we change the default >> of llvm shared libs to enabled too. >> >> ~Maarten > I think you should disable it by default since I want to cherry-pick > this patch to mesa 9.1. > We could always enable it by default later. > Additionally you should check if someone wants to build > enabled-shared-gallium with static llvm. > Then configure should print an error like this "Please use shared-llvm > if you want to enable shared-gallium, > since the combination static-llvm and shared-gallium is not supported" > > Andreas.
How does this look? Not tested with all insane but possible build combinations of shared/static, if it was up to me those different forms wouldn't mix at all, and either everything would be built statically, or nothing would be.. I would gladly remove enable_shared_gallium, and let it depend on whether with_llvm_shared_libs was selected or not. >8----- Signed-off-by: Maarten Lankhorst <maarten.lankho...@canonical.com> diff --git a/configure.ac b/configure.ac index 4b5b045..e605281 100644 --- a/configure.ac +++ b/configure.ac @@ -1591,9 +1591,19 @@ AC_ARG_WITH([llvm-shared-libs], [link with LLVM shared libraries @<:@default=disabled@:>@])], [], [with_llvm_shared_libs=no]) -AS_IF([test x$enable_opencl = xyes], +AS_IF([test x$enable_opencl = xyes -a x$with_llvm_shared_libs != xyes], [ - AC_MSG_WARN([OpenCL required, forcing LLVM shared libraries]) + AC_MSG_WARN([OpenCL requested, forcing LLVM shared libraries]) + with_llvm_shared_libs=yes + ]) +AC_ARG_ENABLE([shared-gallium], + [AS_HELP_STRING([--enable-shared-gallium], + [Enable shared gallium core @<:@default=no@:>@])], + [enable_shared_gallium="$enableval"], + [enable_shared_gallium=no]) +AS_IF([test x$enable_shared_gallium = xyes -a x$with_llvm_shared_libs != xyes], + [ + AC_MSG_WARN([Shared libgallium requested, forcing LLVM shared libraries]) with_llvm_shared_libs=yes ]) @@ -1928,6 +1938,7 @@ AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes) +AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test "x$enable_shared_gallium" = xyes) if test "x$enable_gallium_loader" = xyes; then GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null" @@ -2263,6 +2274,7 @@ echo "" echo " Shared libs: $enable_shared" echo " Static libs: $enable_static" echo " Shared-glapi: $enable_shared_glapi" +echo " Shared gallium: $enable_shared_gallium" dnl Compiler options # cleanup the CFLAGS/CXXFLAGS/DEFINES vars diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am index f14279b..a4090d3 100644 --- a/src/gallium/auxiliary/Makefile.am +++ b/src/gallium/auxiliary/Makefile.am @@ -3,14 +3,24 @@ AUTOMAKE_OPTIONS = subdir-objects 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 = + +if HAVE_SHARED_GALLIUM +lib_LTLIBRARIES = libgallium.la -AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) +if HAVE_MESA_LLVM +libgallium_la_LIBADD = $(LLVM_LIBS) +endif + +else +noinst_LTLIBRARIES = libgallium.la +AM_CFLAGS += $(VISIBILITY_CFLAGS) +AM_CXXFLAGS += $(VISIBILITY_CXXFLAGS) +endif libgallium_la_SOURCES = \ $(C_SOURCES) \ _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev