From 8f151d797b015b7d1070151e75d56587a7f3652f Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 22 Mar 2013 22:33:40 +0100 Subject: Work-in patch from Jan Engehardt for working around different improper bash implementations of string-in-string replacing. (Fixes: #145). --- debian/Makefile.nx-libs | 12 ++++++------ debian/Makefile.replace.sh | 27 +++++++++++++++++++++++++++ debian/changelog | 3 +++ debian/roll-tarballs.sh | 1 + 4 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 debian/Makefile.replace.sh diff --git a/debian/Makefile.nx-libs b/debian/Makefile.nx-libs index 74f0d3a38..beb522c5b 100644 --- a/debian/Makefile.nx-libs +++ b/debian/Makefile.nx-libs @@ -93,23 +93,23 @@ install-full: cp -aL nx-X11/exports/include/* nx-X11/.build-exports/include # copy libs (for libnx-x11), we want the targets of the links - find nx-X11/exports/lib/ | grep -F ".so" | while read libpath; do \ + . replace.sh; set -x; find nx-X11/exports/lib/ | grep -F ".so" | while read libpath; do \ libfile=$$(basename $$libpath); \ libdir=$$(dirname $$libpath); \ link=$$(readlink $$libpath); \ \ - mkdir -p $${libdir//exports/.build-exports}; \ - cp -a $${libpath/$$libfile/$$link} $${libdir//exports/.build-exports}; \ + mkdir -p "$$(string_rep "$$libdir" exports .build-exports)"; \ + cp -a "$$(string_rep "$$libpath" "$$libfile" "$$link")" "$$(string_rep "$$libdir" exports .build-exports)"; \ done; $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/X11 $(COPY_SYMLINK) nx-X11/.build-exports/lib/*.so* $(DESTDIR)$(NXLIBDIR)/X11/ - find nx-X11/.build-exports/include/ -type d | grep -v "include/X11/bitmaps" | \ + . replace.sh; set -x; find nx-X11/.build-exports/include/ -type d | grep -v "include/X11/bitmaps" | \ while read dirname; do \ - $(INSTALL_DIR) $${dirname//"nx-X11/.build-exports/include"/"$(DESTDIR)$(PREFIX)/include/nx"}; \ + $(INSTALL_DIR) "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(PREFIX)/include/nx")"; \ $(INSTALL_FILE) $${dirname}/*.h \ - $${dirname//"nx-X11/.build-exports/include"/"$(DESTDIR)$(PREFIX)/include/nx"}/ || true; \ + "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(PREFIX)/include/nx")"/ || true; \ done; \ $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/include/nx/X11/bitmaps diff --git a/debian/Makefile.replace.sh b/debian/Makefile.replace.sh new file mode 100644 index 000000000..d47d92bf4 --- /dev/null +++ b/debian/Makefile.replace.sh @@ -0,0 +1,27 @@ +# from http://mywiki.wooledge.org/BashFAQ/021 + +string_rep() +{ + # initialize vars + in=$1 + unset out + + # SEARCH must not be empty + test -n "$2" || return + + while true; do + # break loop if SEARCH is no longer in "$in" + case "$in" in + *"$2"*) : ;; + *) break;; + esac + + # append everything in "$in", up to the first instance of SEARCH, and REP, to "$out" + out=$out${in%%"$2"*}$3 + # remove everything up to and including the first instance of SEARCH from "$in" + in=${in#*"$2"} + done + + # append whatever is left in "$in" after the last instance of SEARCH to out, and print + printf '%s%s\n' "$out" "$in" +} diff --git a/debian/changelog b/debian/changelog index 72601647e..824d74608 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ nx-libs (2:3.5.0.18-0) UNRELEASED; urgency=low [ Mike Gabriel ] * Remove duplicate install of nxproxy from main Makefile. Spotted by Jan Engelhard. + * Work-in patch from Jan Engehardt for working around different + improper bash implementations of string-in-string replacing. (Fixes: + #145). [ Orion Poplawski ] * Fix wrong symlink direction of libNX_* files. (Fixes: #107). diff --git a/debian/roll-tarballs.sh b/debian/roll-tarballs.sh index b43de4b88..57b3aad49 100755 --- a/debian/roll-tarballs.sh +++ b/debian/roll-tarballs.sh @@ -120,6 +120,7 @@ mv -v debian/changelog doc/changelog # copy the top-level makefile if no quilt patch created it before test -f Makefile || test -f debian/Makefile.nx-libs && cp -v debian/Makefile.nx-libs Makefile +test -f replace.sh || test -f debian/Makefile.replace.sh && cp -v debian/Makefile.replace.sh replace.sh # remove folders that we do not want to roll into the tarball rm -Rf ".pc/" -- cgit v1.2.3