Fix zlib 1.2.6 not available from serve anymore
[msysgit.git] / src / mingw-w64 / release-zlib.sh
blob3ff9a0995debd73d84b88ea43e3e4c61322b02ac
1 #!/bin/sh
3 cd "$(dirname "$0")"
4 srcdir=$(pwd)
6 mirror=http://zlib.net/
7 file=zlib-1.2.7.tar.gz
8 dir=${file%.tar.gz}
10 # download it
11 if ! (test -f $file || curl $mirror$file -o $file)
12 then
13 echo "Could not download $file"
14 echo "If you do not have a direct network connection please download"
15 echo "$mirror$file"
16 echo "place it in $srcdir and restart this script"
17 exit 1
20 # unpack it
21 test -d $dir || tar xzf $file || exit
23 # initialize Git repository
24 test -d $dir/.git ||
25 (cd $dir && git init && git add . && git commit -m initial) || exit
27 # patch it
28 if ! grep DISABLED_MINGW $dir/configure > /dev/null 2>&1
29 then
30 (cd $dir && git apply --verbose ../patch/zlib-config.patch) || exit
33 # compile it
34 sysroot="$(pwd)/sysroot/x86_64-w64-mingw32"
35 cross="$(pwd)/sysroot/bin/x86_64-w64-mingw32"
36 test -f $dir/example.exe || {
37 (cd $dir &&
38 CC="$cross-gcc.exe" AR="$cross-ar.exe" RANLIB="$cross-ranlib.exe" \
39 ./configure --static --prefix=$sysroot &&
40 make) || exit
43 # install it
44 test -f $sysroot/lib/libz.a ||
45 (cd $dir &&
46 make install)
48 for header in zlib.h zconf.h
50 test -f $sysroot/include/$header ||
51 cp $dir/$header $sysroot/include/
52 done