[Mesa-dev] [PATCH] build: Share the all-local rule for linking libraries into the build dir

Kristian Høgsberg krh at bitplanet.net
Wed Jan 29 11:50:40 PST 2014


This consolidates how we link the libraries.  It only works for
lib_LTLIBRARIES, ie not for custom shared libraries like DRI drivers or
gallium state trackers.

Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
---

We could do something like this to avoid the problem in the future.

Kristian

 install-lib-links.mk              | 14 ++++++++++++++
 src/egl/main/Makefile.am          |  7 +------
 src/gbm/Makefile.am               |  5 +----
 src/glx/Makefile.am               |  7 +------
 src/mapi/es1api/Makefile.am       |  8 +-------
 src/mapi/es2api/Makefile.am       |  8 +-------
 src/mapi/shared-glapi/Makefile.am |  6 +-----
 src/mapi/vgapi/Makefile.am        |  8 +-------
 8 files changed, 21 insertions(+), 42 deletions(-)
 create mode 100644 install-lib-links.mk

diff --git a/install-lib-links.mk b/install-lib-links.mk
new file mode 100644
index 0000000..73d9e14
--- /dev/null
+++ b/install-lib-links.mk
@@ -0,0 +1,14 @@
+# 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.
+
+all-local : .libs/install-mesa-links
+
+.libs/install-mesa-links : $(lib_LTLIBRARIES)
+	$(MKDIR_P) $(top_builddir)/$(LIB_DIR)
+	for f in $(lib_LTLIBRARIES:%.la=.libs/%.so*); do	\
+		if test -h .libs/$$f; then			\
+			cp -d $$f $(top_builddir)/$(LIB_DIR);	\
+		else						\
+			ln -f $$f $(top_builddir)/$(LIB_DIR);	\
+		fi;						\
+	done && touch $@
diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
index e12aeae..4c20d12 100644
--- a/src/egl/main/Makefile.am
+++ b/src/egl/main/Makefile.am
@@ -115,12 +115,7 @@ libEGL_la_LIBADD += ../drivers/dri2/libegl_dri2.la
 libEGL_la_LIBADD += $(DLOPEN_LIBS) $(LIBDRM_LIBS)
 endif
 
-# 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.
-all-local: libEGL.la
-	$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
-	ln -f .libs/libEGL.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libEGL.so.1
-	ln -sf libEGL.so.1 $(top_builddir)/$(LIB_DIR)/libEGL.so
+include $(top_srcdir)/install-lib-links.mk
 
 pkgconfigdir = $(libdir)/pkgconfig
 
diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
index de5126c..eacb96a 100644
--- a/src/gbm/Makefile.am
+++ b/src/gbm/Makefile.am
@@ -47,7 +47,4 @@ libgbm_la_LIBADD += \
 	libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la $(LIBDRM_LIBS)
 endif
 
-all-local: libgbm.la
-	$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
-	ln -f .libs/libgbm.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libgbm.so
-	ln -f .libs/libgbm.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libgbm.so.1
+include $(top_srcdir)/install-lib-links.mk
diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 54a0cc0..c8dfb86 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -118,9 +118,4 @@ lib at GL_LIB@_la_SOURCES =
 lib at GL_LIB@_la_LIBADD = $(GL_LIBS)
 lib at GL_LIB@_la_LDFLAGS = $(GL_LDFLAGS)
 
-# 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.
-all-local: lib at GL_LIB@.la
-	$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
-	ln -f .libs/lib at GL_LIB@.so.1.2.0 $(top_builddir)/$(LIB_DIR)/lib at GL_LIB@.so.1
-	ln -sf lib at GL_LIB@.so.1 $(top_builddir)/$(LIB_DIR)/lib at GL_LIB@.so
+include $(top_srcdir)/install-lib-links.mk
diff --git a/src/mapi/es1api/Makefile.am b/src/mapi/es1api/Makefile.am
index eb98f16..b61f9cb 100644
--- a/src/mapi/es1api/Makefile.am
+++ b/src/mapi/es1api/Makefile.am
@@ -57,10 +57,4 @@ glapi_mapi_tmp.h: ../glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
 BUILT_SOURCES = glapi_mapi_tmp.h
 CLEANFILES = $(BUILT_SOURCES)
 
-# 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.
-all-local: libGLESv1_CM.la
-	$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
-	ln -f .libs/libGLESv1_CM.so $(top_builddir)/$(LIB_DIR)/libGLESv1_CM.so
-	ln -f .libs/libGLESv1_CM.so.1 $(top_builddir)/$(LIB_DIR)/libGLESv1_CM.so.1
-	ln -f .libs/libGLESv1_CM.so.1.1.0 $(top_builddir)/$(LIB_DIR)/libGLESv1_CM.so.1.1.0
+include $(top_srcdir)/install-lib-links.mk
diff --git a/src/mapi/es2api/Makefile.am b/src/mapi/es2api/Makefile.am
index c6b0ca4..a944493 100644
--- a/src/mapi/es2api/Makefile.am
+++ b/src/mapi/es2api/Makefile.am
@@ -61,10 +61,4 @@ glapi_mapi_tmp.h: ../glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
 BUILT_SOURCES = glapi_mapi_tmp.h
 CLEANFILES = $(BUILT_SOURCES)
 
-# 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.
-all-local: libGLESv2.la
-	$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
-	ln -f .libs/libGLESv2.so $(top_builddir)/$(LIB_DIR)/libGLESv2.so
-	ln -f .libs/libGLESv2.so.2 $(top_builddir)/$(LIB_DIR)/libGLESv2.so.2
-	ln -f .libs/libGLESv2.so.2.0.0 $(top_builddir)/$(LIB_DIR)/libGLESv2.so.2.0.0
+include $(top_srcdir)/install-lib-links.mk
diff --git a/src/mapi/shared-glapi/Makefile.am b/src/mapi/shared-glapi/Makefile.am
index e18c30a..b4703be 100644
--- a/src/mapi/shared-glapi/Makefile.am
+++ b/src/mapi/shared-glapi/Makefile.am
@@ -27,8 +27,4 @@ AM_CPPFLAGS =							\
 	-DMAPI_MODE_GLAPI					\
 	-DMAPI_ABI_HEADER=\"shared-glapi/glapi_mapi_tmp.h\"
 
-all-local: libglapi.la
-	$(MKDIR_P) $(top_builddir)/$(LIB_DIR)
-	ln -f .libs/libglapi.so.0.0.0 $(top_builddir)/$(LIB_DIR)/libglapi.so.0.0.0
-	ln -sf libglapi.so.0.0.0 $(top_builddir)/$(LIB_DIR)/libglapi.so.0
-	ln -sf libglapi.so.0 $(top_builddir)/$(LIB_DIR)/libglapi.so
+include $(top_srcdir)/install-lib-links.mk
diff --git a/src/mapi/vgapi/Makefile.am b/src/mapi/vgapi/Makefile.am
index 0af7115..8952df0 100644
--- a/src/mapi/vgapi/Makefile.am
+++ b/src/mapi/vgapi/Makefile.am
@@ -52,10 +52,4 @@ vgapi_tmp.h: $(srcdir)/vgapi.csv $(top_srcdir)/src/mapi/mapi_abi.py
 BUILT_SOURCES = vgapi_tmp.h
 CLEANFILES = $(BUILT_SOURCES)
 
-# 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.
-all-local: libOpenVG.la
-	$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
-	ln -f .libs/libOpenVG.so $(top_builddir)/$(LIB_DIR)/libOpenVG.so
-	ln -f .libs/libOpenVG.so.1 $(top_builddir)/$(LIB_DIR)/libOpenVG.so.1
-	ln -f .libs/libOpenVG.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libOpenVG.so.1.0.0
+include $(top_srcdir)/install-lib-links.mk
-- 
1.8.4.2



More information about the mesa-dev mailing list