-
Notifications
You must be signed in to change notification settings - Fork 7
/
common.sh
74 lines (62 loc) · 1.23 KB
/
common.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# $1 : arch
# $2 : tarname
# $3 : prefix
# $4 : host
# $5 : jobopt
# $6 : verbose
# $7 : winver
jobopt=$5
verbose=$6
set -e
unset PKG_CONFIG_PATH
EWPI_OS=`uname`
case ${EWPI_OS} in
MSYS*|MINGW*)
prefix_unix=`cygpath -u $3`
;;
*)
prefix_unix=$3
;;
esac
if test "x$7" = "xwin7" ; then
winver="0x0601"
else
winver="0x0A00"
fi
export PATH=$prefix_unix/bin:$PATH
export PKG_CONFIG_DIR=
export PKG_CONFIG_LIBDIR=$3/lib/pkgconfig
export PKG_CONFIG_SYSROOOT_DIR=$3
export CPPFLAGS="-D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=$winver -I$3/include"
export CFLAGS="-O2 -pipe -march=$1"
export CXXFLAGS="-O2 -pipe -march=$1"
export LDFLAGS="-L$3/lib -s"
if test "x${jobopt}" = "xno" ; then
jobopt=""
fi
if test "x${verbose}" = "xyes" ; then
verbmake="V=1"
verbcmake="ON"
verbninja="-v"
verbff="V=1"
else
verbmake="V=0"
verbcmake="OFF"
fi
case $2 in
*.git)
bn=`basename $2`
dir_name=${bn%.*}
;;
*.xz|*.lzma|*.lz)
dir_name=`tar tJfh $2 | head -1 | cut -f1 -d"/"`
;;
*.bz2)
dir_name=`tar tjf $2 | head -1 | cut -f1 -d"/"`
;;
*.gz|*.tgz)
dir_name=`tar tzf $2 | head -1 | cut -f1 -d"/"`
;;
esac
cd $dir_name
EWPI_PWD=`pwd`