From c98c122c9a0c2915326c1843f488b20ef77a2ab3 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Sun, 24 Apr 2016 23:34:13 +0200 Subject: [PATCH] Fix and improve configuring code in makefile and script. --- Makefile | 2 +- scripts/find_platform | 39 ++++++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 2021829..ceee01f 100644 --- a/Makefile +++ b/Makefile @@ -152,7 +152,7 @@ install: docs vimpager.configured vimcat.configured sed -e '1{ s|.*|#!'"$$POSIX_SHELL"'|; }' \ -e 's|\$${POSIX_SHELL}|'"$$POSIX_SHELL|" \ -e '/^[ ]*\.[ ]*.*inc\/prologue.sh.*$$/d' \ - -e 's/^[ ]*\.[ ]*.*inc\/platform.sh.*$$/'"`scripts/find_platform`"/ \ + -e 's|^[ ]*\.[ ]*.*inc/platform.sh.*$$|'"`scripts/find_platform`|" \ -e 's|^version=.*|version="'"`git describe`"' (configured, shell='"$$POSIX_SHELL"')"|' \ -e 's|^runtime=.*$$|runtime="${PREFIX}/share/vimpager"|' \ -e 's|^vimcat=.*$$|vimcat="${PREFIX}/bin/vimcat"|' \ diff --git a/scripts/find_platform b/scripts/find_platform index d2c889d..3bfe10f 100755 --- a/scripts/find_platform +++ b/scripts/find_platform @@ -2,20 +2,29 @@ . inc/platform.sh +# The backslash has to be put here 8 times: foctor two to get past the initial +# shell quoting, another factor two because it is used in the replacement +# string for sed, another factor two because the output of belows echo will be +# used in the replacement text in the sed call in the makefile. This yields +# one backslash that can escape the single quote in the configured vimpager +# script. +AWK=$(echo "$AWK" | sed "s/'/'\\\\\\\\''/g") +SED=$(echo "$SED" | sed "s/'/'\\\\\\\\''/g") + echo \ - bsd=$bsd \ - cygwin=$cygwin \ - freebsd=$freebsd \ - linux=$linux \ - msys=$msys \ - netbsd=$netbsd \ - openbsd=$openbsd \ - osx=$osx \ - solaris=$solaris \ - win32=$win32 \ - AWK=$AWK \ - SED=$SED \ - HEAD_SYNTAX=$HEAD_SYNTAX \ - TAIL_SYNTAX=$TAIL_SYNTAX \ - TAIL_NO_DOUBLE_DASH=$TAIL_NO_DOUBLE_DASH \ + ${bsd:+bsd=$bsd} \ + ${cygwin:+cygwin=$cygwin} \ + ${freebsd:+freebsd=$freebsd} \ + ${linux:+linux=$linux} \ + ${msys:+msys=$msys} \ + ${netbsd:+netbsd=$netbsd} \ + ${openbsd:+openbsd=$openbsd} \ + ${osx:+osx=$osx} \ + ${solaris:+solaris=$solaris} \ + ${win32:+win32=$win32} \ + "AWK='$AWK'" \ + "SED='$SED'" \ + ${HEAD_SYNTAX:+HEAD_SYNTAX=$HEAD_SYNTAX} \ + ${TAIL_SYNTAX:+TAIL_SYNTAX=$TAIL_SYNTAX} \ + ${TAIL_NO_DOUBLE_DASH:+TAIL_NO_DOUBLE_DASH=$TAIL_NO_DOUBLE_DASH} \