-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.sh
executable file
·166 lines (161 loc) · 5.21 KB
/
build.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/bin/bash
if test -d zlib; then
:
else
echo "Cloning Git repo for zlib"
git clone [email protected]:madler/zlib.git
( cd zlib && git checkout v1.2.13 )
fi
UNAME=`uname`
PREFIXDIR=${PREFIXDIR-"$(dirname ${0})/./"}
if test -d ${PREFIXDIR}; then
:
else
mkdir -p $PREFIXDIR
fi
# bourne shell's version of abspath
PREFIXDIR=`cd $PREFIXDIR && pwd`
if test "X$UNAME" == "XMSYS_NT-10.0"; then
# under windows, use zilb-dl\zlib\contrib\vstudio\vc12\zlibvc.sln
# build project zlibstat with configuraitons "Debug|x64" "ReleaseWithoutAsm|x64"
# "Debug|Win32" "ReleaseWithoutAsm|Win32"
./build.bat
exit 0
elif test "X$UNAME" == "XDarwin"; then
for STAGE in 'Debug' 'Release'
do
mkdir -p "Mac${STAGE}"
if test $STAGE == 'Debug'; then
OPTFLAG="-gdwarf-2"
else
OPTFLAG="-O3"
fi
( cd "Mac${STAGE}" && \
CC=clang \
CFLAGS="-fpascal-strings -fvisibility=hidden -fexceptions $OPTFLAG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MACOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.7 -fPIC" \
../zlib/configure --prefix=$PREFIXDIR/$STAGE/Mac --static --archs="-arch i386 -arch x86_64" && gnumake && gnumake install && gnumake distclean )
done
exit 0
fi
# UNIX stuff
MAKE="gmake"
OS="$(echo $OS | tr A-Z a-z)"
case $OS in
hppahpux)
COMP=/opt/ansic/bin/cc
PATH=/opt/ansic/bin:$PATH
DEBFLAGS="-g"
RELFLAGS="-fast"
CFLAGS64="+DD64 +DA2.0W"
CFLAGS32="+DD32"
CFLAGSALL="+Z -AC99"
OS="hppahpux"
OS64="${OS}_64"
;;
itanium2hpux)
PATH=/opt/aCC.6.28/bin:$PATH
COMP=/opt/aCC.6.28/bin/aCC
DEBFLAGS="-g"
RELFLAGS="-fast"
CFLAGS64="+DD64"
CFLAGS32="+DD32"
CFLAGSALL="+std=c99 +Z +DSitanium2"
OS="itanium2hpux"
OS64="${OS}_64"
;;
rs6000aix)
##############################################################
# Note: zlib does something strainge with out-of-tree builds
# that breaks with IBM's xlc, so we'll build in-tree on AIX.
##############################################################
BUILD_IN_TREE=true
PATH=/opt/IBM/xlC/13.1.3/bin:$PATH
COMP=/opt/IBM/xlC/13.1.3/bin/xlc_r
DEBFLAGS="-g -qfullpath"
RELFLAGS="-O3 -qstrict=all"
CFLAGS64="-q64"
CFLAGS32="-q32"
CFLAGSALL="-qpic=small -qthreaded"
OS="rs6000aix"
OS64="${OS}_64"
AR32="ar -X 32"
AR64="ar -X 64"
;;
i80386linux)
# configuration for rhel5
PATH=/opt/gcc-4.1.2/bin:$PATH
COMP=/opt/gcc-4.1.2/bin/gcc
DEBFLAGS="-g"
RELFLAGS="-O3 -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2"
CFLAGS64="-m64"
CFLAGS32="-m32 -mtune=i686 -march=pentium4"
CFLAGSALL="-fPIC"
OS="i80386linux"
OS64="${OS}_64"
;;
sparcsolaris)
# configuration for 64-bit tibet - solaris10 -- for 32-bit, solaris9
PATH=/opt/gcc-4.1.2/bin:/opt/developerstudio12.5/bin:$PATH
COMP64=/opt/developerstudio12.5/bin/cc
CFLAGS64="-m64 -xcode=pic32 -std=c99 -xarch=sparcvis"
COMP32=/opt/gcc-4.1.2/bin/gcc
CFLAGS32="-m32 -fPIC -fexceptions"
DEBFLAGS="-g"
RELFLAGS32="-O3"
RELFLAGS64="-fast"
CFLAGSALL=""
OS="sparcsolaris"
OS64="${OS}_64"
;;
intelsolaris)
# configuration for sol - solaris10
MAKE=make
COMP=/usr/bin/gcc
DEBFLAGS="-g"
RELFLAGS="-O3"
CFLAGS64="-m64"
CFLAGS32="-m32"
CFLAGSALL="-fPIC -std=c99"
OS="intelsolaris"
OS64="${OS}_64"
;;
esac
for STAGE in Debug Release
do
if test "X$STAGE" == "XDebug"; then
OPTFLAG=${DEBFLAGS-${DEBFLAGS32}}
else
OPTFLAG=${RELFLAGS-${RELFLAGS32}}
fi
mkdir -p ./$STAGE/$OS
PREFIXDIR=$(cd ./$STAGE/$OS && pwd)
if test "X$BUILD_IN_TREE" == "Xtrue"; then
( cd ./zlib/ && \
AR=${AR32} CC=${COMP-${COMP32}} CFLAGS="$CFLAGS32 $OPTFLAG $CFLAGSALL" ./configure --prefix=${PREFIXDIR} --static && \
$MAKE && $MAKE install && $MAKE distclean)
else
BUILDDIR="build/${STAGE}/$OS"
mkdir -p $BUILDDIR
( cd ${BUILDDIR} && \
CC=${COMP-${COMP32}} CFLAGS="$CFLAGS32 $OPTFLAG $CFLAGSALL" ../../../zlib/configure --prefix=${PREFIXDIR} --static && \
$MAKE && $MAKE install && $MAKE distclean )
fi
if test "X$STAGE" == "XDebug"; then
OPTFLAG=${DEBFLAGS-${DEBFLAGS64}}
else
OPTFLAG=${RELFLAGS-${RELFLAGS64}}
fi
mkdir -p ./$STAGE/$OS64
PREFIXDIR=$(cd ./$STAGE/$OS64 && pwd)
if test "X$BUILD_IN_TREE" == "Xtrue"; then
( cd ./zlib/ && \
AR=${AR64} CC=${COMP-${COMP64}} CFLAGS="$CFLAGS64 $OPTFLAG $CFLAGSALL" ./configure --prefix=${PREFIXDIR} --64 --static && \
$MAKE && $MAKE install && $MAKE distclean)
else
BUILDDIR="build/${STAGE}/$OS64"
mkdir -p $BUILDDIR
( cd ${BUILDDIR} &&
CC=${COMP-${COMP64}} CFLAGS="$CFLAGS64 $OPTFLAG $CFLAGSALL" ../../../zlib/configure --prefix=${PREFIXDIR} --64 --static && \
$MAKE && $MAKE install && $MAKE distclean )
fi
done