#!/bin/sh # Set initial variables: CWD=`pwd` if [ "$TMP" = "" ]; then TMP=/tmp fi PKG=$TMP/package-devel32 VERSION=1.0.4 ARCH=${ARCH:-x86_64} BUILD=${BUILD:-1} DISTRO=${DISTRO:-slamd64} MAKEFLAGS=${MAKEFLAGS:-} # Eg 'CC="gcc -m32"' if [ $DISTRO = slackware ]; then PKGARCH=$ARCH else PKGARCH=${ARCH}_${DISTRO} fi if [ $DISTRO = slamd64 ]; then LIBSUFFIX=${LIBSUFFIX:-64} else LIBSUFFIX=${LIBSUFFIX:-} fi if [ ! -d $TMP ]; then mkdir -p $TMP # location to build the source fi # place for the package to be built #rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf bzip2-$VERSION tar xzvf $CWD/bzip2-$VERSION.tar.gz cd bzip2-$VERSION chown -R root:root . # This should be ok, since libbz2.so.1.0 will still exist. zcat $CWD/bzip2-1.0.4.saneso.diff.gz | patch -p1 || exit zcat $CWD/bzip2-m32.diff.gz | patch -p1 --verbose || exit 1 make $MAKEFLAGS -f Makefile-libbz2_so || exit 1 make $MAKEFLAGS || exit 1 mkdir -p $PKG/usr/include cp -a bzlib.h $PKG/usr/include chown root:root $PKG/usr/include/bzlib.h chmod 644 $PKG/usr/include/bzlib.h mkdir -p $PKG/usr/lib$LIBSUFFIX cp -a libbz2.a $PKG/usr/lib$LIBSUFFIX/libbz2.a mkdir -p $PKG/lib$LIBSUFFIX cp -a libbz2.so.$VERSION $PKG/lib$LIBSUFFIX/libbz2.so.$VERSION chmod 644 $PKG/usr/lib$LIBSUFFIX/libbz2.a chmod 755 $PKG/lib$LIBSUFFIX/libbz2.so.$VERSION # Link up them links ( cd $PKG ( cd lib$LIBSUFFIX rm -f libbz2.so.1.0 libbz2.so.1 ln -sf libbz2.so.1.0.4 libbz2.so.1.0 ln -sf libbz2.so.1.0 libbz2.so.1 ) ( cd usr/lib$LIBSUFFIX ; ln -sf ../../lib$LIBSUFFIX/libbz2.so.1 libbz2.so ) ) ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/bzip2-$VERSION rm -rf $PKG fi