diff mbox

[MELT] Fix installation of MELT modules

Message ID 1314278806-25109-2-git-send-email-alissy@mandriva.com
State New
Headers show

Commit Message

Alexandre Lissy Aug. 25, 2011, 1:26 p.m. UTC
Path computation for installation in GCC's plugin/melt-modules/ path was
broken (in fact not updated to the latest changes). Present commit fixes
this by reading the link targets and installing them.
---
 contrib/ChangeLog.MELT       |    2 ++
 contrib/MELT-Plugin-Makefile |    8 +++-----
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Ralf Wildenhues Aug. 25, 2011, 1:45 p.m. UTC | #1
* Alexandre Lissy wrote on Thu, Aug 25, 2011 at 03:26:46PM CEST:
> Path computation for installation in GCC's plugin/melt-modules/ path was
> broken (in fact not updated to the latest changes). Present commit fixes
> this by reading the link targets and installing them.

> --- a/contrib/MELT-Plugin-Makefile
> +++ b/contrib/MELT-Plugin-Makefile
> @@ -288,13 +288,11 @@ install-melt-sources: melt-sources  melt-all-sources
>  ### phony makefile target from melt-build.mk
>  install-melt-modules: melt-modules melt-all-modules
>  	$(mkinstalldirs) $(DESTDIR)/$(melt_module_dir)
> -	for d in $(wildcard melt-modules/*); do \
> -	  $(mkinstalldirs) $(DESTDIR)/$(melt_module_dir)/`basename $$d` ; \
> -	  for f in $$d/*.so ; do \
> -	     $(INSTALL_PROGRAM) $$f $(DESTDIR)/$(melt_module_dir)/`basename $$d`/`basename $$f ` ; \
> -	  done; \
> +	for l in $(wildcard melt-modules/*); do \

If there are no matches for this wildcard, this will generate
a shell syntax error, unlike the old code.  Perusing the
MELT-Plugin-Makefile, it wasn't obvious whether this can ever
happen in practice or not, but it might be prudent to guard
against it nonetheless.  One common way is to add a ':' in the
for list, and test for != : inside.

> +	  $(INSTALL_PROGRAM) `readlink $$l` $(DESTDIR)/$(melt_module_dir)/$$(basename `readlink $$l`) ; \

No slash after $(DESTDIR), please.

>  	done
>  
> +
>  ## install the makefile for MELT modules
>  install-melt-mk: melt-module.mk
>  	$(mkinstalldirs) $(DESTDIR)/$(libexecsubdir)
Alexandre Lissy Aug. 25, 2011, 2:07 p.m. UTC | #2
Hello,

Thanks for your suggestions. I made the suggested changes, I hope it
matches your requirements :).
diff mbox

Patch

diff --git a/contrib/ChangeLog.MELT b/contrib/ChangeLog.MELT
index 9b8123c..42f2aca 100644
--- a/contrib/ChangeLog.MELT
+++ b/contrib/ChangeLog.MELT
@@ -1,3 +1,5 @@ 
+2011-08-25  Alexandre Lissy  <alissy@mandriva.com>
+	* MELT-Plugin-Makefile (install-melt-modules): Fix installation paths
 
 2011-07-18  Basile Starynkevitch  <basile@starynkevitch.net>
 	* MELT-Plugin-Makefile (melt_make_move): Use move-if-change.
diff --git a/contrib/MELT-Plugin-Makefile b/contrib/MELT-Plugin-Makefile
index 5e5baae..7ab032a 100644
--- a/contrib/MELT-Plugin-Makefile
+++ b/contrib/MELT-Plugin-Makefile
@@ -288,13 +288,11 @@  install-melt-sources: melt-sources  melt-all-sources
 ### phony makefile target from melt-build.mk
 install-melt-modules: melt-modules melt-all-modules
 	$(mkinstalldirs) $(DESTDIR)/$(melt_module_dir)
-	for d in $(wildcard melt-modules/*); do \
-	  $(mkinstalldirs) $(DESTDIR)/$(melt_module_dir)/`basename $$d` ; \
-	  for f in $$d/*.so ; do \
-	     $(INSTALL_PROGRAM) $$f $(DESTDIR)/$(melt_module_dir)/`basename $$d`/`basename $$f ` ; \
-	  done; \
+	for l in $(wildcard melt-modules/*); do \
+	  $(INSTALL_PROGRAM) `readlink $$l` $(DESTDIR)/$(melt_module_dir)/$$(basename `readlink $$l`) ; \
 	done
 
+
 ## install the makefile for MELT modules
 install-melt-mk: melt-module.mk
 	$(mkinstalldirs) $(DESTDIR)/$(libexecsubdir)