source: scripts/target-scripts/target-zlib.sh@ 8c8c5ab

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 8c8c5ab was 617118d, checked in by Jim Gifford <clfs@…>, 19 years ago

r561@server (orig r559): root | 2005-06-05 02:38:49 -0700
Fixed Directory Structure

  • Property mode set to 100755
File size: 2.4 KB
Line 
1#!/bin/bash
2
3# cross-lfs target zlib build
4# ---------------------------
5# $LastChangedBy$
6# $LastChangedDate$
7# $LastChangedRevision$
8# $HeadURL$
9#
10
11LOG=zlib-target.log
12
13SELF=`basename ${0}`
14set_buildenv
15set_libdirname
16setup_multiarch
17
18if [ "${USE_SYSROOT}" = "Y" ]; then
19 BUILD_PREFIX=/usr
20 INSTALL_PREFIX="${LFS}${BUILD_PREFIX}"
21 INSTALL_OPTIONS="DESTDIR=${LFS}"
22else
23 BUILD_PREFIX=${TGT_TOOLS}
24 INSTALL_PREFIX="${TGT_TOOLS}"
25 INSTALL_OPTIONS=""
26fi
27
28if [ ! "${libdirname}" = "lib" ]; then
29 extra_conf="--libdir=${BUILD_PREFIX}/${libdirname}"
30fi
31
32export CC="${TARGET}-gcc ${ARCH_CFLAGS}"
33export CXX="${TARGET}-g++ ${ARCH_CFLAGS}"
34
35cd ${SRC}
36unpack_tarball zlib-${ZLIB_VER}
37cd ${PKGDIR}
38
39# TODO: check to see how far back this applies...
40apply_patch zlib-1.2.2-add_DESTDIR-1
41
42#TODO - fix this for later zlibs
43test "1.1.4" = "${ZLIB_VER}" &&
44{
45 # Fix up zlibs Makefile so we can properly pass in LDFLAGS from
46 # the env without clobbering existing settings for zlib build
47 test -f Makefile.in-ORIG ||
48 cp Makefile.in Makefile.in-ORIG
49
50 # make LDFLAGS in Makefile.in empty and move existing LDFLAGS
51 # to ZLIB_LDFLAGS. Append $(ZLIB_LDFLAGS) wherever $(LDFLAGS) exists
52 sed -e 's@LDFLAGS=.*@ZLIB_&@' \
53 -e '/ZLIB_LDFLAGS=/i\
54LDFLAGS=' \
55 -e 's@$(LDFLAGS)@& $(ZLIB_LDFLAGS)@g' \
56 Makefile.in-ORIG > Makefile.in
57}
58
59max_log_init Zlib ${ZLIB_VER} "target (shared)" ${CONFLOGS} ${LOG}
60
61# Check to see if we are on alpha
62# Req's a fix as specified on Kelledins Alpha page
63# Pointed out by J.Schmelling
64case "${TGT_ARCH}" in
65 alpha | x86_64 ) extra_cflags="-fPIC" ;;
66esac
67# NOTE: It's probably not a bad idea in general to enable -fPIC...
68
69test "1.1.4" = "${ZLIB_VER}" &&
70{
71 # Apply Kelledin's vsnprintf patch
72 # see http://archive.linuxfromscratch.org/lfs-dev/2003/02/.....
73 apply_patch zlib-${ZLIB_VER}-vsnprintf
74 CFLAGS="-O2 -pipe ${extra_cflags} ${TGT_CFLAGS}" CPPFLAGS="-DHAS_vsnprintf" \
75 ./configure --prefix=${BUILD_PREFIX} --shared ${extra_conf} \
76 >> ${LOGFILE} 2>&1
77} || {
78 CFLAGS="-O2 -pipe ${extra_cflags} ${TGT_CFLAGS}" \
79 ./configure --prefix=${BUILD_PREFIX} \
80 --shared ${extra_conf} \
81 >> ${LOGFILE} 2>&1
82}
83echo " o Configure OK" &&
84
85min_log_init ${BUILDLOGS} &&
86#make LDFLAGS="-s" \
87make ${PMFLAGS} \
88 >> ${LOGFILE} 2>&1 &&
89echo " o Build OK" &&
90
91min_log_init ${INSTLOGS} &&
92make ${INSTALL_OPTIONS} install \
93 >> ${LOGFILE} 2>&1 &&
94echo " o ALL OK" || barf
95
Note: See TracBrowser for help on using the repository browser.