-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-cmd.sh
123 lines (105 loc) · 3.84 KB
/
build-cmd.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
#!/bin/bash
top="$(dirname "$0")"
stage=$(pwd)
cd "$top"
# turn on verbose debugging output for parabuild logs.
set -x
# make errors fatal
set -e
LIB_NAME="libpng"
LIB_VERSION="1.5.10"
LIB_SOURCE_DIR="$LIB_NAME-$LIB_VERSION"
if [ -z "$AUTOBUILD" ] ; then
fail
fi
if [ "$OSTYPE" = "cygwin" ] ; then
export AUTOBUILD="$(cygpath -u $AUTOBUILD)"
fi
# load autbuild provided shell functions and variables
set +x
# load autbuild provided shell functions and variables
eval "$("$AUTOBUILD" source_environment)"
#install prebuilt packages
eval "$AUTOBUILD install"
set -x
pushd "$LIB_SOURCE_DIR"
case "$AUTOBUILD_PLATFORM" in
windows*)
if [ "$AUTOBUILD_PLATFORM" == "windows64" ]; then
build_target="x64"
else
build_target="Win32"
fi
build_sln "projects/vstudio/vstudio.sln" "Debug Library|$build_target"
build_sln "projects/vstudio/vstudio.sln" "Release Library|$build_target"
mkdir -p "$stage/lib/debug"
mkdir -p "$stage/lib/release"
cp projects/vstudio/Release\ Library/libpng15.lib "$stage/lib/release/libpng15.lib"
cp projects/vstudio/Debug\ Library/libpng15.lib "$stage/lib/debug/libpng15.lib"
mkdir -p "$stage/include/libpng15"
cp {png.h,pngconf.h,pnglibconf.h} "$stage/include/libpng15"
;;
"darwin")
./configure --prefix="$stage" --with-zlib-prefix="$stage/packages"
make
make install
mkdir -p "$stage/lib/release"
cp "$stage/lib/libpng15.a" "$stage/lib/release/"
;;
"linux")
export CFLAGS="-m32 -O3 -I$stage/packages/include"
export CXXFLAGS=$CFLAGS
export LDFLAGS="-m32 -L$stage/packages/lib/release"
if [ -f Makefile ]; then
make distclean
fi
./configure --prefix="\${PREBUILD_DIR}" \
--bindir="\${prefix}/bin" \
--libdir="\${prefix}/lib/release" \
--includedir="\${prefix}/include"
make
make install DESTDIR="$stage"
# build the debug version and link against the debug zlib
make distclean
export CFLAGS="-m32 -O0 -gstabs+ -I$stage/packages/include"
export CXXFLAGS=$CFLAGS
export LDFLAGS="-m32 -L$stage/packages/lib/debug"
./configure --prefix="\${PREBUILD_DIR}" \
--bindir="\${prefix}/bin" \
--libdir="\${prefix}/lib/debug" \
--includedir="\${prefix}/include"
make
make install DESTDIR="$stage"
;;
"linux64")
export CFLAGS="-m64 -O3 -fPIC -I$stage/packages/include"
export CXXFLAGS=$CFLAGS
export LDFLAGS="-L$stage/packages/lib/release"
if [ -f Makefile ]; then
make distclean
fi
./configure --prefix="\${PREBUILD_DIR}" \
--bindir="\${prefix}/bin" \
--libdir="\${prefix}/lib/release" \
--includedir="\${prefix}/include" \
--with-pic
make
make install DESTDIR="$stage"
# build the debug version and link against the debug zlib
make distclean
export CFLAGS="-m64 -O0 -fPIC -gstabs+ -I$stage/packages/include"
export CXXFLAGS=$CFLAGS
export LDFLAGS="-L$stage/packages/lib/debug"
./configure --prefix="\${PREBUILD_DIR}" \
--bindir="\${prefix}/bin" \
--libdir="\${prefix}/lib/debug" \
--includedir="\${prefix}/include" \
--with-pic
make
make install DESTDIR="$stage"
;;
esac
mkdir -p "$stage/LICENSES"
cp LICENSE "$stage/LICENSES/libpng.txt"
popd
pass