From 792db79f27ad9ab1fb977e23be65c7761f545752 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sat, 27 Jun 2009 12:32:40 +0300 Subject: [PATCH] Create correct symlinks even when --program-{prefix,suffix,transform} is passed to configure. --- src/scripts/Makefile.am | 80 +++++++++++++++++++++++------------------ src/xz/Makefile.am | 21 ++++++----- src/xzdec/Makefile.am | 9 +++-- 3 files changed, 65 insertions(+), 45 deletions(-) diff --git a/src/scripts/Makefile.am b/src/scripts/Makefile.am index dbdca6fc..8ea5e2fa 100644 --- a/src/scripts/Makefile.am +++ b/src/scripts/Makefile.am @@ -10,44 +10,56 @@ dist_man_MANS = xzdiff.1 xzgrep.1 xzmore.1 install-exec-hook: cd $(DESTDIR)$(bindir) && \ - rm -f xzcmp xzegrep xzfgrep xzless \ - lzdiff lzgrep lzmore \ - lzcmp lzegrep lzfgrep lzless && \ - $(LN_S) xzdiff xzcmp && \ - $(LN_S) xzgrep xzegrep && \ - $(LN_S) xzgrep xzfgrep && \ - $(LN_S) xzmore xzless && \ - $(LN_S) xzdiff lzdiff && \ - $(LN_S) xzgrep lzgrep && \ - $(LN_S) xzmore lzmore && \ - $(LN_S) xzdiff lzcmp && \ - $(LN_S) xzgrep lzegrep && \ - $(LN_S) xzgrep lzfgrep && \ - $(LN_S) xzmore lzless + target=`echo xzdiff | $(SED) '$(transform)'` && \ + for name in xzcmp lzdiff lzcmp; do \ + link=`echo $$name | $(SED) '$(transform)'` && \ + rm -f $$link && \ + $(LN_S) $$target $$link; \ + done && \ + target=`echo xzgrep | $(SED) '$(transform)'` && \ + for name in xzegrep xzfgrep lzgrep lzegrep lzfgrep; do \ + link=`echo $$name | $(SED) '$(transform)'` && \ + rm -f $$link && \ + $(LN_S) $$target $$link; \ + done && \ + target=`echo xzmore | $(SED) '$(transform)'` && \ + for name in xzless lzmore lzless; do \ + link=`echo $$name | $(SED) '$(transform)'` && \ + rm -f $$link && \ + $(LN_S) $$target $$link; \ + done install-data-hook: cd $(DESTDIR)$(mandir)/man1 && \ - rm -f xzcmp.1 xzegrep.1 xzfgrep.1 xzless.1 \ - lzdiff.1 lzgrep.1 lzmore.1 \ - lzcmp.1 lzegrep.1 lzfgrep.1 lzless.1 && \ - $(LN_S) xzdiff.1 xzcmp.1 && \ - $(LN_S) xzgrep.1 xzegrep.1 && \ - $(LN_S) xzgrep.1 xzfgrep.1 && \ - $(LN_S) xzmore.1 xzless.1 && \ - $(LN_S) xzdiff.1 lzdiff.1 && \ - $(LN_S) xzgrep.1 lzgrep.1 && \ - $(LN_S) xzmore.1 lzmore.1 && \ - $(LN_S) xzdiff.1 lzcmp.1 && \ - $(LN_S) xzgrep.1 lzegrep.1 && \ - $(LN_S) xzgrep.1 lzfgrep.1 && \ - $(LN_S) xzmore.1 lzless.1 + target=`echo xzdiff | $(SED) '$(transform)'` && \ + for name in xzcmp lzdiff lzcmp; do \ + link=`echo $$name | $(SED) '$(transform)'` && \ + rm -f $$link.1 && \ + $(LN_S) $$target.1 $$link.1; \ + done && \ + target=`echo xzgrep | $(SED) '$(transform)'` && \ + for name in xzegrep xzfgrep lzgrep lzegrep lzfgrep; do \ + link=`echo $$name | $(SED) '$(transform)'` && \ + rm -f $$link.1 && \ + $(LN_S) $$target.1 $$link.1; \ + done && \ + target=`echo xzmore | $(SED) '$(transform)'` && \ + for name in xzless lzmore lzless; do \ + link=`echo $$name | $(SED) '$(transform)'` && \ + rm -f $$link.1 && \ + $(LN_S) $$target.1 $$link.1; \ + done uninstall-hook: cd $(DESTDIR)$(bindir) && \ - rm -f xzcmp xzegrep xzfgrep xzless \ - lzdiff lzgrep lzmore \ - lzcmp lzegrep lzfgrep lzless + for name in xzcmp lzdiff lzcmp xzgrep xzegrep xzfgrep \ + lzgrep lzegrep lzfgrep xzless lzmore lzless; do \ + link=`echo $$name | $(SED) '$(transform)'` && \ + rm -f $$link; \ + done cd $(DESTDIR)$(mandir)/man1 && \ - rm -f xzcmp.1 xzegrep.1 xzfgrep.1 xzless.1 \ - lzdiff.1 lzgrep.1 lzmore.1 \ - lzcmp.1 lzegrep.1 lzfgrep.1 lzless.1 + for name in xzcmp lzdiff lzcmp xzgrep xzegrep xzfgrep \ + lzgrep lzegrep lzfgrep xzless lzmore lzless; do \ + link=`echo $$name | $(SED) '$(transform)'` && \ + rm -f $$link.1; \ + done diff --git a/src/xz/Makefile.am b/src/xz/Makefile.am index 121a2d1c..c0bd05fd 100644 --- a/src/xz/Makefile.am +++ b/src/xz/Makefile.am @@ -49,17 +49,22 @@ endif xz_LDADD += $(LTLIBINTL) -## Create symlinks for unxz and xzcat for convenicen. Create symlinks also +## Create symlinks for unxz and xzcat for convenience. Create symlinks also ## for lzma, unlzma, and lzcat for compatibility with LZMA Utils 4.32.x. +xzlinks = unxz xzcat lzma unlzma lzcat + install-exec-hook: cd $(DESTDIR)$(bindir) && \ - rm -f unxz xzcat lzma unlzma lzcat && \ - $(LN_S) xz unxz && \ - $(LN_S) xz xzcat && \ - $(LN_S) xz lzma && \ - $(LN_S) xz unlzma && \ - $(LN_S) xz lzcat + target=`echo xz | $(SED) '$(transform)'` && \ + for name in $(xzlinks); do \ + link=`echo $$name | $(SED) '$(transform)'` && \ + rm -f $$link && \ + $(LN_S) $$target $$link; \ + done uninstall-hook: cd $(DESTDIR)$(bindir) && \ - rm -f unxz xzcat lzma unlzma lzcat + for name in $(xzlinks); do \ + link=`echo $$name | $(SED) '$(transform)'` && \ + rm -f $$link; \ + done diff --git a/src/xzdec/Makefile.am b/src/xzdec/Makefile.am index 1f13cd67..bdcc12bb 100644 --- a/src/xzdec/Makefile.am +++ b/src/xzdec/Makefile.am @@ -32,9 +32,12 @@ dist_man_MANS = xzdec.1 install-data-hook: cd $(DESTDIR)$(mandir)/man1 && \ - rm -f lzmadec.1 && \ - $(LN_S) xzdec.1 lzmadec.1 + target=`echo xzdec | $(SED) '$(transform)'` && \ + link=`echo lzmadec | $(SED) '$(transform)'` && \ + rm -f $$link.1 && \ + $(LN_S) $$target.1 $$link.1 uninstall-hook: cd $(DESTDIR)$(mandir)/man1 && \ - rm -f lzmadec.1 + link=`echo lzmadec | $(SED) '$(transform)'` && \ + rm -f $$link.1