This is a hack ubuntu uses to reduce the size of mesa, it links libgallium against libmesagallium and libdricore.
I think it's too ugly to commit in its current form, but it works with the flags ubuntu passes to configure. On 9.0 branch I had a similar patch, without shared libgallium and without this hack, the stripped build was 36 mb. With just shared gallium it was 25 mb, and with both applied it was 12 mb. libmesagallium had to be moved to a subdir, to force the correct build order. >8--- Not-signed-off-by: Maarten Lankhorst <maarten.lankho...@canonical.com> --- a/src/mesa/libdricore/Makefile.am +++ b/src/mesa/libdricore/Makefile.am @@ -42,6 +42,7 @@ libdricore@VERSION@_la_LDFLAGS = -version-number 1:0 libdricore@VERSION@_la_LIBADD = \ ../program/libdricore_program.la \ + $(top_builddir)/src/mapi/shared-glapi/libglapi.la $() if HAVE_X86_ASM @@ -65,8 +66,10 @@ -I$(top_srcdir)/src/mesa/sparc endif +lib_LTLIBRARIES = + if HAVE_DRI -lib_LTLIBRARIES = libdricore@VERSION@.la +lib_LTLIBRARIES += libdricore@VERSION@.la # Provide compatibility with scripts for the old Mesa build system for # a while by putting a link to the driver into /lib of the build tree. @@ -76,6 +79,17 @@ ln -sf libdricore@VERSION@.so.1 $(top_builddir)/$(LIB_DIR)/libdricore@VERSION@.so endif +libmesagallium_la_SOURCES = \ + $(STATETRACKER_FILES) +libmesagallium_la_CFLAGS = @LLVM_CFLAGS@ +libmesagallium_la_CXXFLAGS = @LLVM_CXXFLAGS@ +libmesagallium_la_LIBADD = libdricore@VERSION@.la $(LLVM_LIBS) + +if HAVE_GALLIUM +noinst_LTLIBRARIES = libmesagallium.la +endif + + CLEANFILES = \ $(top_builddir)/$(LIB_DIR)/libdricore@VERSION@.so.1 \ $(top_builddir)/$(LIB_DIR)/libdricore@VERSION@.so --- a/configure.ac +++ b/configure.ac @@ -928,6 +928,8 @@ AC_SUBST([GLESv2_PC_LIB_PRIV]) DRI_LIB_DEPS="\$(top_builddir)/src/mesa/libdricore/libdricore${VERSION}.la" +MESAGALLIUM_LIBS="${DRI_LIB_DEPS}" +AC_SUBST([MESAGALLIUM_LIBS], ${MESAGALLIUM_LIBS}) AC_SUBST([HAVE_XF86VIDMODE]) --- a/src/gallium/targets/dri-i915/Makefile.am +++ b/src/gallium/targets/dri-i915/Makefile.am @@ -49,7 +49,7 @@ i915_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined i915_dri_la_LIBADD = \ - $(top_builddir)/src/mesa/libmesagallium.la \ + @MESAGALLIUM_LIBS@ \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \ $(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \ --- a/src/gallium/targets/dri-nouveau/Makefile.am +++ b/src/gallium/targets/dri-nouveau/Makefile.am @@ -48,7 +48,7 @@ nouveau_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined nouveau_dri_la_LIBADD = \ - $(top_builddir)/src/mesa/libmesagallium.la \ + @MESAGALLIUM_LIBS@ \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \ $(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \ --- a/src/gallium/targets/dri-r300/Makefile.am +++ b/src/gallium/targets/dri-r300/Makefile.am @@ -49,7 +49,7 @@ r300_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined r300_dri_la_LIBADD = \ - $(top_builddir)/src/mesa/libmesagallium.la \ + @MESAGALLIUM_LIBS@ \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \ $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \ --- a/src/gallium/targets/dri-r600/Makefile.am +++ b/src/gallium/targets/dri-r600/Makefile.am @@ -48,7 +48,7 @@ r600_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined r600_dri_la_LIBADD = \ - $(top_builddir)/src/mesa/libmesagallium.la \ + @MESAGALLIUM_LIBS@ \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/drivers/r600/libr600.la \ $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \ --- a/src/gallium/targets/dri-radeonsi/Makefile.am +++ b/src/gallium/targets/dri-radeonsi/Makefile.am @@ -49,7 +49,7 @@ radeonsi_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined radeonsi_dri_la_LIBADD = \ - $(top_builddir)/src/mesa/libmesagallium.la \ + @MESAGALLIUM_LIBS@ \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \ $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \ --- a/src/gallium/targets/dri-swrast/Makefile.am +++ b/src/gallium/targets/dri-swrast/Makefile.am @@ -49,7 +49,7 @@ swrast_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined swrast_dri_la_LIBADD = \ - $(top_builddir)/src/mesa/libmesagallium.la \ + @MESAGALLIUM_LIBS@ \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/state_trackers/dri/sw/libdrisw.la \ $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la \ --- a/src/gallium/targets/dri-vmwgfx/Makefile.am +++ b/src/gallium/targets/dri-vmwgfx/Makefile.am @@ -48,7 +48,7 @@ vmwgfx_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined vmwgfx_dri_la_LIBADD = \ - $(top_builddir)/src/mesa/libmesagallium.la \ + @MESAGALLIUM_LIBS@ \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \ $(top_builddir)/src/gallium/winsys/svga/drm/libsvgadrm.la \ --- a/src/gallium/targets/egl-static/Makefile.am +++ b/src/gallium/targets/egl-static/Makefile.am @@ -104,7 +104,7 @@ $(API_DEFINES) egl_gallium_la_LIBADD += \ - $(top_builddir)/src/mesa/libmesagallium.la + @MESAGALLIUM_LIBS@ # make st/mesa built-in when there is a single glapi provider if HAVE_SHARED_GLAPI egl_gallium_la_LIBADD += \ --- a/src/mesa/Makefile.am +++ b/src/mesa/Makefile.am @@ -75,9 +75,6 @@ else check_LTLIBRARIES = libmesa.la endif -if HAVE_GALLIUM -noinst_LTLIBRARIES += libmesagallium.la -endif SRCDIR = $(top_srcdir)/src/mesa/ BUILDDIR = $(top_builddir)/src/mesa/ @@ -119,15 +116,6 @@ $() libmesa_la_LDFLAGS = -libmesagallium_la_SOURCES = \ - $(MESA_GALLIUM_FILES) \ - $(MESA_ASM_FILES_FOR_ARCH) - -libmesagallium_la_LIBADD = \ - $(top_builddir)/src/glsl/libglsl.la \ - $(top_builddir)/src/mesa/program/libprogram.la \ - $() - pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gl.pc --- a/src/gallium/auxiliary/Makefile.am +++ b/src/gallium/auxiliary/Makefile.am @@ -34,14 +34,14 @@ AM_CXXFLAGS += -fno-rtti -libgallium_la_LIBADD = $(LLVM_LIBS) - endif libgallium_la_SOURCES += \ $(GALLIVM_SOURCES) \ $(GALLIVM_CPP_SOURCES) +libgallium_la_LIBADD = ../../mesa/libdricore/libmesagallium.la $(LLVM_LIBS) $(GALLIUM_DRI_LIB_DEPS) + endif indices/u_indices_gen.c: $(srcdir)/indices/u_indices_gen.py _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev