[617118d] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # cross-lfs target bzip2 build
|
---|
| 4 | # ----------------------------
|
---|
| 5 | # $LastChangedBy$
|
---|
| 6 | # $LastChangedDate$
|
---|
| 7 | # $LastChangedRevision$
|
---|
| 8 | # $HeadURL$
|
---|
| 9 | #
|
---|
| 10 |
|
---|
| 11 | cd ${SRC}
|
---|
| 12 |
|
---|
| 13 | LOG="bzip2-target.log"
|
---|
| 14 | libdirname="lib"
|
---|
| 15 |
|
---|
| 16 | SELF=`basename ${0}`
|
---|
| 17 | set_buildenv
|
---|
| 18 | set_libdirname
|
---|
| 19 | setup_multiarch
|
---|
| 20 |
|
---|
| 21 | if [ "${USE_SYSROOT}" = "Y" ]; then
|
---|
| 22 | BUILD_PREFIX=/usr
|
---|
| 23 | INSTALL_PREFIX="${LFS}${BUILD_PREFIX}"
|
---|
| 24 | else
|
---|
| 25 | BUILD_PREFIX=${TGT_TOOLS}
|
---|
| 26 | INSTALL_PREFIX="${TGT_TOOLS}"
|
---|
| 27 | fi
|
---|
| 28 |
|
---|
| 29 | export CC="${TARGET}-gcc ${ARCH_CFLAGS}"
|
---|
| 30 | export CXX="${TARGET}-g++ ${ARCH_CFLAGS}"
|
---|
| 31 |
|
---|
| 32 | unpack_tarball bzip2-${BZIP2_VER} &&
|
---|
| 33 | cd ${PKGDIR}
|
---|
| 34 |
|
---|
| 35 | # Edit Makefiles
|
---|
| 36 | for file in Makefile-libbz2_so Makefile ; do
|
---|
| 37 | test -f ${file}-ORIG ||
|
---|
| 38 | mv ${file} ${file}-ORIG
|
---|
| 39 |
|
---|
| 40 | sed -e "s@^\(CC=\).*@\1${CC}@g" \
|
---|
| 41 | -e "s@^\(AR=\).*@\1${TARGET}-ar@g" \
|
---|
| 42 | -e "s@^\(RANLIB=\).*@\1${TARGET}-ranlib@g" \
|
---|
| 43 | -e 's@^\(all:.*\) test@\1@g' \
|
---|
| 44 | -e "s@/lib\(/\| \|$\)@/${libdirname}\1@g" \
|
---|
| 45 | ${file}-ORIG > ${file}
|
---|
| 46 | done
|
---|
| 47 |
|
---|
| 48 | max_log_init Bzip2 ${BZIP2_VER} "target (shared)" ${BUILDLOGS} ${LOG}
|
---|
| 49 | make -f Makefile-libbz2_so \
|
---|
| 50 | >> ${LOGFILE} 2>&1 &&
|
---|
| 51 | echo -e "\n${BRKLN}" >> ${LOGFILE} &&
|
---|
| 52 | make ${PMFLAGS} LDFLAGS="-s" \
|
---|
| 53 | >> ${LOGFILE} 2>&1 &&
|
---|
| 54 | echo " o Build OK" || barf
|
---|
| 55 |
|
---|
| 56 | # Remove existing bz* files in ${TGT_TOOLS}/bin
|
---|
| 57 | rm -f ${INSTALL_PREFIX}/bin/bz*
|
---|
| 58 |
|
---|
| 59 | min_log_init ${INSTLOGS} &&
|
---|
| 60 | CC="${CC}" CXX="${CXX}" make PREFIX=${INSTALL_PREFIX} install \
|
---|
| 61 | >> ${LOGFILE} 2>&1 &&
|
---|
| 62 | echo " o ALL OK" || barf
|
---|
| 63 |
|
---|
| 64 | yes | cp bzip2-shared ${INSTALL_PREFIX}/bin/bzip2
|
---|
| 65 | ln -s libbz2.so.1.0 libbz2.so
|
---|
| 66 |
|
---|
| 67 | # There is no cp -a under solaris... thats why we build coreutlis cp
|
---|
| 68 | cp -a libbz2.so* ${INSTALL_PREFIX}/${libdirname}
|
---|
| 69 |
|
---|
| 70 | rm -f ${INSTALL_PREFIX}/bin/{bunzip2,bzcat}
|
---|
| 71 | ln -s bzip2 ${INSTALL_PREFIX}/bin/bunzip2
|
---|
| 72 | ln -s bzip2 ${INSTALL_PREFIX}/bin/bzcat
|
---|
| 73 | #ldconfig
|
---|