summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2014-09-23 21:28:04 (GMT)
committerTimothy Gu <timothygu99@gmail.com>2014-09-23 21:28:47 (GMT)
commitebf104acbdf22a785937d9a55ce722b7f11dc984 (patch)
tree582555aaeff2737bd062787300507d1237ba9651 /tools
parentfe6a2db4e94f22649b7cb48058c5217ec31e1012 (diff)
downloadmxe-ebf104acbdf22a785937d9a55ce722b7f11dc984.zip
mxe-ebf104acbdf22a785937d9a55ce722b7f11dc984.tar.gz
mxe-ebf104acbdf22a785937d9a55ce722b7f11dc984.tar.bz2
tools: use a "compat-init.sh" for all compatibility variables
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/compat-init.sh20
-rwxr-xr-xtools/make-shared-from-static15
-rw-r--r--tools/mxe-activate4
-rwxr-xr-xtools/update-config-guess13
-rwxr-xr-xtools/update-gmsl13
5 files changed, 32 insertions, 33 deletions
diff --git a/tools/compat-init.sh b/tools/compat-init.sh
new file mode 100755
index 0000000..e8f825a
--- /dev/null
+++ b/tools/compat-init.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Ported from main Makefile
+MAKE='make'
+SED='sed'
+SORT='sort'
+
+if [ gmake --help >/dev/null 2>&1 ]; then
+ MAKE='gmake'
+fi
+if [ gsed --help >/dev/null 2>&1 ]; then
+ SED='gsed'
+fi
+if [ gsort --help >/dev/null 2>&1 ]; then
+ SORT='gsort'
+fi
+
+WGET="wget --no-check-certificate
+ --user-agent=$(wget --version |
+ $SED -n 's,GNU \(Wget\) \([0-9.]*\).*,\1/\2,p')"
diff --git a/tools/make-shared-from-static b/tools/make-shared-from-static
index cd720b2..6b4100c 100755
--- a/tools/make-shared-from-static
+++ b/tools/make-shared-from-static
@@ -2,6 +2,8 @@
set -e
+. tools/compat-init.sh
+
LD=
AR=
INSTALL=
@@ -131,14 +133,14 @@ if [ -n "$infile" ]; then
base_infile=$(basename $infile)
if $windowsdll; then
if $msvc; then
- base_name=`echo $base_infile | sed -n -e 's/^lib\(.*\)\.a$/\1/p'`
+ base_name=`echo $base_infile | $SED -n -e 's/^lib\(.*\)\.a$/\1/p'`
outfile="${libprefix}${base_name}${libsuffix}.dll"
implibfile="$base_name.lib"
# Modern libtool won't create .a files, but will create directly .lib files.
# If the .a file does not exist, check for an existing .lib file.
if [ ! -f "$infile" ]; then
- msvc_infiles="`echo $infile | sed -e 's/\.a$/.lib/'` \
-`dirname \"$infile\"`/`echo $base_infile | sed -e 's/\.a$/.lib/' -e 's/^lib//'`"
+ msvc_infiles="`echo $infile | $SED -e 's/\.a$/.lib/'` \
+`dirname \"$infile\"`/`echo $base_infile | $SED -e 's/\.a$/.lib/' -e 's/^lib//'`"
for msvc_infile in $msvc_infiles; do
if [ -f "$msvc_infile" ]; then
infile="$msvc_infile"
@@ -148,11 +150,11 @@ if [ -n "$infile" ]; then
done
fi
else
- outfile=$(echo $base_infile | sed 's/\.a$/.dll/')
+ outfile=$(echo $base_infile | $SED 's/\.a$/.dll/')
implibfile="$outfile.a"
fi
else
- outfile=$(echo $base_infile | sed 's/\.a$/.so/')
+ outfile=$(echo $base_infile | $SED 's/\.a$/.so/')
fi
else
echo "make-shared-from-static: no input file specified" 1>&2
@@ -160,8 +162,7 @@ else
fi
NM=nm
-SED=sed
-global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*_\\([_A-Za-z][_A-iZa-z0-9]*\\)\\{0,1\\}\$/\\1 _\\2 \\2/p' | sed '/ __gnu_lto/d'"
+global_symbol_pipe="$SED -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*_\\([_A-Za-z][_A-iZa-z0-9]*\\)\\{0,1\\}\$/\\1 _\\2 \\2/p' | $SED '/ __gnu_lto/d'"
# Ignore DATA symbols for now. They should be be properly exported from
# the source code using dllexport. They can't be re-exported manually like
# this using MSVC.
diff --git a/tools/mxe-activate b/tools/mxe-activate
index 30fb61f..14eae68 100644
--- a/tools/mxe-activate
+++ b/tools/mxe-activate
@@ -1,8 +1,8 @@
+. tools/compat-init.sh
+
export MXE_DIR=`pwd`
export BUILD=`$MXE_DIR/ext/config.guess`
export PATH=$MXE_DIR/usr/$BUILD/bin:$MXE_DIR/usr/bin:$PATH
-MAKE=`gmake --help >/dev/null 2>&1 && echo g`make
-SED=`gsed --help >/dev/null 2>&1 && echo g`sed
MXE_TRIPLETS=`grep ^MXE_TRIPLETS Makefile | cut -d '=' -f2 | cut -d ' ' -f2- | tr ' ' ','`
MXE_LIB_TYPES=`grep ^MXE_LIB_TYPES Makefile | cut -d '=' -f2 | cut -d ' ' -f2- | tr ' ' ','`
diff --git a/tools/update-config-guess b/tools/update-config-guess
index 605d57d..a56f09a 100755
--- a/tools/update-config-guess
+++ b/tools/update-config-guess
@@ -9,18 +9,7 @@ clean(){
rm -rf tmp-config-guess
}
-# Ported from main Makefile
-SED='sed'
-SORT='sort'
-if [ gsed --help >/dev/null 2>&1 ]; then
- SED='gsed'
-fi
-if [ gsort --help >/dev/null 2>&1 ]; then
- SED='gsort'
-fi
-WGET="wget --no-check-certificate
- --user-agent=$(wget --version |
- $SED -n 's,GNU \(Wget\) \([0-9.]*\).*,\1/\2,p')"
+. tools/compat-init.sh
# Current config.guess timestamp.
current_version=$(grep 'timestamp.*=' 'ext/config.guess' 2>/dev/null | \
diff --git a/tools/update-gmsl b/tools/update-gmsl
index d015197..29cf592 100755
--- a/tools/update-gmsl
+++ b/tools/update-gmsl
@@ -9,18 +9,7 @@ clean(){
rm -rf tmp-gmsl.tar.gz gmsl-*
}
-# Ported from main Makefile
-SED='sed'
-SORT='sort'
-if [ gsed --help >/dev/null 2>&1 ]; then
- SED='gsed'
-fi
-if [ gsort --help >/dev/null 2>&1 ]; then
- SED='gsort'
-fi
-WGET="wget --no-check-certificate
- --user-agent=$(wget --version |
- $SED -n 's,GNU \(Wget\) \([0-9.]*\).*,\1/\2,p')"
+. tools/compat-init.sh
# Current GMSL version. E.g. '1.1.5'
current_version=$(grep 'gmsl_version.*=' 'ext/__gmsl' | \