18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
-
-
-
-
+
+
+
+
|
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHSCRIPTDIR="$(pwd)/patchscripts"
PATCHDIR="$(pwd)/patches"
export ZLIBVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR
# Set configure options for this sub-project
LDFLAGS="${KC_ZLIB_LDFLAGS}"
CFLAGS="${KC_ZLIB_CFLAGS}"
CPPFLAGS="${KC_ZLIB_CPPFLAGS}"
LIBS="${KC_ZLIB_LIBS}"
LDFLAGS="${LDFLAGS} ${KC_ZLIB_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_ZLIB_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_ZLIB_CPPFLAGS}"
LIBS="${LIBS} ${KC_ZLIB_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS
rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1
if [ ! -f "${SRC}" ]; then
mkdir 'src' >/dev/null 2>/dev/null
|
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
|
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
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
|
gzip -dc "../${SRC}" | tar -xf -
else
cp -rp ../buildsrc/* './'
fi
cd "${BUILDDIR}" || exit 1
# Apply patches if needed
for patch in "${PATCHDIR}/all"/zlib-${ZLIBVERS}-*.diff "${PATCHDIR}/all"/zlib-all-*.diff "${PATCHDIR}/${ZLIBVERS}"/zlib-${ZLIBVERS}-*.diff; do
if [ ! -f "${patch}" ]; then
continue
fi
echo "Applying: ${patch}"
${PATCH:-patch} -p1 < "${patch}"
done
# Apply patch scripts if needed
for patchscript in "${PATCHSCRIPTDIR}"/*.sh; do
if [ -f "${patchscript}" ]; then
echo "Running patch script: ${patchscript}"
(
. "${patchscript}"
)
fi
done
# If we are building for KitDLL, compile with '-fPIC'
if [ "${KITTARGET}" = "kitdll" ]; then
CFLAGS="${CFLAGS} -fPIC"
export CFLAGS
fi
# We don't pass CONFIGUREEXTRA here, since this isn't a GNU autoconf
# script and will puke
echo "Running: ./configure --prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\""
./configure --prefix="${INSTDIR}" --libdir="${INSTDIR}/lib"
echo "Running: ./configure --prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --static"
./configure --prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --static
echo "Running: ${MAKE:-make}"
${MAKE:-make} || exit 1
echo "Running: ${MAKE:-make} install"
${MAKE:-make} install
# We don't really care too much about failure in zlib
exit 0
) || exit 1
exit 0
|