Mesa (master): gallium/targets: don't leave an empty target directory(ies)

Emil Velikov evelikov at kemper.freedesktop.org
Sat Mar 4 15:30:39 UTC 2017


Module: Mesa
Branch: master
Commit: 1cd4fde053ce5252ae1cb7e74899a9af39544d79
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1cd4fde053ce5252ae1cb7e74899a9af39544d79

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Fri Mar  3 19:25:40 2017 +0000

gallium/targets: don't leave an empty target directory(ies)

Some drivers do not support certain targets - for example nouveau
doesn't do VAAPI, while freedreno doesn't do of the video backends.

As such if we enter vdpau when building freedreno/ilo/etc, a vdpau/
folder will be created, empty library will be build and almost
immediately removed. Thus keeping an empty vdpau/ folder around.

There are two ways to fix this.

 * add substantial tracking in configure/makefiles so that we never end
up in targets/vdpau
 Downsides:
Error prone, as the configure checks and the 'include
gallium/drivers/foo/Automake.inc' can easily get out of sync.

 * remove the folder, if empty, alongside the empty library.
 Downsides:
In the latter case vdpau/ might be empty before the mesa build has
started, yet we'll remove it either way.

This patch implements the latter option, as the downside isn't that
significant, plus the patch is way shorter ;-)

v2: use has_drivers to track since TARGET_DRIVERS can contain space,
hence neither string comparison nor -n/-z works correctly.

Gentoo Bugzilla: https://bugs.gentoo.org/545230
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/gallium/targets/dri/Makefile.am   | 4 +++-
 src/gallium/targets/vdpau/Makefile.am | 4 +++-
 src/gallium/targets/xvmc/Makefile.am  | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am
index 50c2733..4d92f45 100644
--- a/src/gallium/targets/dri/Makefile.am
+++ b/src/gallium/targets/dri/Makefile.am
@@ -139,10 +139,12 @@ endif
 # gallium_dri.so in the set of final installed files.
 install-data-hook:
 	for i in $(TARGET_DRIVERS); do                                  \
+		has_drivers=1;                                          \
 		ln -f $(DESTDIR)$(dridir)/gallium_dri.so                \
 		      $(DESTDIR)$(dridir)/$${i}_dri.so;                 \
 	done;                                                           \
-	$(RM) $(DESTDIR)$(dridir)/gallium_dri.*
+	$(RM) $(DESTDIR)$(dridir)/gallium_dri.*;                        \
+	test $${has_drivers} -eq 1 || $(RM) -d $(DESTDIR)$(dridir)
 
 uninstall-hook:
 	for i in $(TARGET_DRIVERS); do                                  \
diff --git a/src/gallium/targets/vdpau/Makefile.am b/src/gallium/targets/vdpau/Makefile.am
index 97c0ab2..a0f310b 100644
--- a/src/gallium/targets/vdpau/Makefile.am
+++ b/src/gallium/targets/vdpau/Makefile.am
@@ -108,6 +108,7 @@ endif
 install-data-hook:
 	$(AM_V_GEN)dest_dir=$(DESTDIR)/$(vdpaudir);			\
 	for i in $(TARGET_DRIVERS); do					\
+		has_drivers=1;						\
 		j=libvdpau_gallium.$(LIB_EXT);				\
 		k=libvdpau_$${i}.$(LIB_EXT);				\
 		l=$${k}.$(VDPAU_MAJOR).$(VDPAU_MINOR).0;		\
@@ -120,7 +121,8 @@ install-data-hook:
 		ln -sf $${l}						\
 		       $${dest_dir}/$${k};				\
 	done;								\
-	$(RM) $${dest_dir}/libvdpau_gallium.*
+	$(RM) $${dest_dir}/libvdpau_gallium.*;				\
+	test $${has_drivers} -eq 1 || $(RM) -d $${dest_dir}
 
 uninstall-hook:
 	for i in $(TARGET_DRIVERS); do					\
diff --git a/src/gallium/targets/xvmc/Makefile.am b/src/gallium/targets/xvmc/Makefile.am
index c8bac58..b65a191 100644
--- a/src/gallium/targets/xvmc/Makefile.am
+++ b/src/gallium/targets/xvmc/Makefile.am
@@ -70,6 +70,7 @@ endif
 install-data-hook:
 	$(AM_V_GEN)dest_dir=$(DESTDIR)/$(xvmcdir);			\
 	for i in $(TARGET_DRIVERS); do					\
+		has_drivers=1;						\
 		j=libXvMCgallium.$(LIB_EXT);				\
 		k=libXvMC$${i}.$(LIB_EXT);				\
 		l=$${k}.$(XVMC_MAJOR).$(XVMC_MINOR).0;			\
@@ -82,7 +83,8 @@ install-data-hook:
 		ln -sf $${l}						\
 		       $${dest_dir}/$${k};				\
 	done;								\
-	$(RM) $${dest_dir}/libXvMCgallium.*
+	$(RM) $${dest_dir}/libXvMCgallium.*;				\
+	test $${has_drivers} -eq 1 || $(RM) -d $${dest_dir}
 
 uninstall-hook:
 	for i in $(TARGET_DRIVERS); do					\




More information about the mesa-commit mailing list