tools: use a "compat-init.sh" for all compatibility variables

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
This commit is contained in:
Timothy Gu 2014-09-23 14:28:04 -07:00
parent fe6a2db4e9
commit ebf104acbd
5 changed files with 32 additions and 33 deletions

20
tools/compat-init.sh Executable file
View File

@ -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')"

View File

@ -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.

View File

@ -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 ' ' ','`

View File

@ -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 | \

View File

@ -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' | \