summaryrefslogtreecommitdiffstats
path: root/truecrypt/build/truecrypt.SlackBuild
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2006-10-03 21:01:48 +0000
committer Eric Hameleers <alien@slackware.com>2006-10-03 21:01:48 +0000
commitf7842606de86445b03be479672aba358fcd33b50 (patch)
tree48c041d8c094b9146423288a5f18694575d748a3 /truecrypt/build/truecrypt.SlackBuild
parent8fe39e7dfbecd2d0cbba9fb92de313a8c3fbfeee (diff)
downloadasb-f7842606de86445b03be479672aba358fcd33b50.tar.gz
asb-f7842606de86445b03be479672aba358fcd33b50.tar.xz
New release, updated SlackBuild script.
Diffstat (limited to 'truecrypt/build/truecrypt.SlackBuild')
-rwxr-xr-xtruecrypt/build/truecrypt.SlackBuild160
1 files changed, 99 insertions, 61 deletions
diff --git a/truecrypt/build/truecrypt.SlackBuild b/truecrypt/build/truecrypt.SlackBuild
index 5f4e676f..c55ce0ea 100755
--- a/truecrypt/build/truecrypt.SlackBuild
+++ b/truecrypt/build/truecrypt.SlackBuild
@@ -16,6 +16,8 @@
# 4.2-1: 18/apr/2006 by Eric Hameleers <alien@slackware.com>
# * This release makes the Linux build independent of MS Windows.
# (so far, crypted containers could only be created in Windows).
+# 4.2a-1: 03/oct/2006 by Eric Hameleers <alien@slackware.com>
+# * Bugfix update. Reworked the SlackBuild too.
#
# Run 'sh SlackBuild --cleanup' to build a Slackware package.
# The package (.tgz) plus descriptive .txt file are created in /tmp .
@@ -24,14 +26,9 @@
# -----------------------------------------------------------------------------
# --- INIT ---
-# Set initial variables:
-CWD=`pwd`
-if [ "$TMP" = "" ]; then
- TMP=/tmp
-fi
PRGNAM=truecrypt
-VERSION=4.2
+VERSION=${VERSION:-4.2a}
ARCH=${ARCH:-i486}
BUILD=1
@@ -39,8 +36,19 @@ DOCS="README.1st Readme.txt License.txt userguide.pdf"
KVER=${KVER:-$(uname -r)}
-SOURCE[0]="${PRGNAM}-${VERSION}-source-code.tar.gz"
-PATCH[0]="${PRGNAM}_ksrc.patch"
+SOURCE="${PRGNAM}-${VERSION}-source-code.tar.gz"
+PATCH="${PRGNAM}_ksrc.patch"
+
+# Where do we look for sources?
+CWD=`pwd`
+SRCDIR=`dirname $0`
+[ "${SRCDIR:0:1}" == "." ] && SRCDIR=${CWD}/${SRCDIR}
+
+# Place to build (TMP) package (PKG) and output (OUTPUT) the program:
+TMP=${TMP:-/tmp/build}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
# ---------------------------------------------------------------------
# If you do *not* want non-admin users to be able to use truecrypt, set
@@ -52,56 +60,78 @@ BINPERM=4755
## --- with a little luck, you won't have to edit below this point --- ##
##
-if [ "$ARCH" = "i386" ]; then
- SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
-elif [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
-elif [ "$ARCH" = "s390" ]; then
- SLKCFLAGS="-O2"
-elif [ "$ARCH" = "x86_64" ]; then
- SLKCFLAGS="-O2"
-elif [ "$ARCH" = "athlon-xp" ]; then
- SLKCFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"
+# Exit the script on errors:
+set -e
+trap 'echo "$0 FAILED!" | tee $OUTPUT/error-${PRGNAM}.log' ERR
+# Catch unitialized variables:
+set -u
+P1=${1:-1}
+
+# Slackware 11 and up need other option (gcc > 3.3.x)
+if [ `gcc -dumpversion | tr -d '.' |cut -c 1-2` -gt 33 ]; then
+ MOPT=tune
+else
+ MOPT=cpu
fi
-PKG=$TMP/package-$PRGNAM
+case "$ARCH" in
+ i386) SLKCFLAGS="-O2 -march=i386 -m${MOPT}=i686"
+ SLKLDFLAGS=""; LIBDIRSUFFIX=""
+ ;;
+ i486) SLKCFLAGS="-O2 -march=i486 -m${MOPT}=i686"
+ SLKLDFLAGS=""; LIBDIRSUFFIX=""
+ ;;
+ s390) SLKCFLAGS="-O2"
+ SLKLDFLAGS=""; LIBDIRSUFFIX=""
+ ;;
+ powerpc) SLKCFLAGS="-O2"
+ SLKLDFLAGS=""; LIBDIRSUFFIX=""
+ ;;
+ x86_64) SLKCFLAGS="-O2 -fPIC"
+ SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64"
+ ;;
+ athlon-xp) SLKCFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"
+ SLKLDFLAGS=""; LIBDIRSUFFIX=""
+ ;;
+esac
if [ ! -d $TMP/tmp-$PRGNAM ]; then
mkdir -p $TMP/tmp-$PRGNAM # location to build the source
-elif [ "$1" != "--oldbuild" ]; then
+elif [ "$P1" != "--oldbuild" ]; then
# If the "--oldbuild" parameter is present, we keep
# the old build files and continue;
# By default we remove the remnants of previous build and continue:
rm -rf $TMP/tmp-$PRGNAM/*
fi
-if [ ! -d $PKG ]; then
- mkdir -p $PKG # place for the package to be built
+if [ "$PKG" = "" -o "$PKG" = "/" ] ; then
+ echo "Please provide a sane value for the variable 'PKG'."
+ exit 1
+elif [ ! -d $PKG ]; then
+ mkdir -p $PKG # place for the package to be built
+else
+ rm -rf $PKG/* # We always erase old package's contents:
+fi
+
+if [ ! -d $OUTPUT ]; then
+ mkdir -p $OUTPUT # place for the package to be saved
fi
+if ! [ -f ${SRCDIR}/${SOURCE} ]; then
+ echo "File '${SOURCE}' not available... aborting the build."
+ exit 1
+fi
+
+
# --- PACKAGE BUILDING ---
echo "++"
echo "|| $PRGNAM-$VERSION"
echo "++"
-# Safety net 8-)
-if [ "$PKG" = "" -o "$PKG" = "/" ] ; then
- cat <<-EOT
- Your script sucks!!!
- You were about to delete the contents of your computer's hard disk!
- Please provide a value for the variable 'PKG'.
- EOT
- exit 1
-fi
-# We always erase old package's contents:
-rm -rf $PKG/*
-
-cd $PKG
-
# Explode the package framework:
-if [ -f $CWD/_$PRGNAM.tar.gz ]; then
- explodepkg $CWD/_$PRGNAM.tar.gz
+if [ -f $SRCDIR/_$PRGNAM.tar.gz ]; then
+ explodepkg $SRCDIR/_$PRGNAM.tar.gz
fi
cd $TMP/tmp-$PRGNAM
@@ -110,7 +140,7 @@ cd $TMP/tmp-$PRGNAM
# --- TARBALL EXTRACTION,PATCH,MODIFY ---
echo "Extracting the program tarball(s) for $PRGNAM..."
-tar -xzvf $CWD/${SOURCE[0]}
+tar -xzvf $SRCDIR/${SOURCE} || true
cd ${PRGNAM}-${VERSION}
chown -R root.root *
@@ -123,12 +153,12 @@ find . -exec chmod +r {} \;
echo Building ...
cd Linux
-patch -p0 < $CWD/${PATCH[0]}
+patch -p0 < $SRCDIR/${PATCH}
CFLAGS="$SLKCFLAGS" \
-./build.sh 2>&1 | tee $CWD/build-${PRGNAM}.log
+./build.sh 2>&1 | tee $OUTPUT/build-${PRGNAM}.log
# Run a test
-./Cli/truecrypt --test 2>&1 | tee -a $CWD/build-${PRGNAM}.log
+./Cli/truecrypt --test 2>&1 | tee -a $OUTPUT/build-${PRGNAM}.log
#
# Install all the needed stuff to the package dir
@@ -149,7 +179,16 @@ cd ..
mkdir -p $PKG/install
cat <<-EEOOTT > $PKG/install/doinst.sh
# TrueCrypt install script
- if [ ! -x usr/sbin/dmsetup ] ; then
+ # Determine the rc.modules to use:
+ if [ -f etc/rc.d/rc.modules.local ]; then
+ RCMODULES="etc/rc.d/rc.modules.local"
+ elif [ -f etc/rc.d/rc.modules-$(uname -r) ]; then
+ RCMODULES="etc/rc.d/rc.modules-$(uname -r)"
+ else
+ RCMODULES="etc/rc.d/rc.modules"
+ fi
+
+ if [ ! -x usr/sbin/dmsetup -a ! -x sbin/dmsetup ] ; then
echo "TrueCrypt requires device mapper tools (dmsetup) 1.00.08 or later."
echo "Please install the 'device-mapper' package before trying to use truecrypt."
fi
@@ -158,15 +197,15 @@ cat <<-EEOOTT > $PKG/install/doinst.sh
chmod $BINPERM usr/bin/truecrypt
# Make the device mapper module load on boot:
- if ! grep -e "^[^#]* dm-mod" etc/rc.d/rc.modules >/dev/null ; then
- echo "# Loading device mapper module (for truecrypt amongst others)" >> etc/rc.d/rc.modules
- echo "/sbin/modprobe dm-mod" >> etc/rc.d/rc.modules
+ if ! grep -e "^[^#]* dm-mod" \${RCMODULES} >/dev/null ; then
+ echo "# Loading device mapper module (for truecrypt amongst others)" >> \${RCMODULES}
+ echo "/sbin/modprobe dm-mod" >> \${RCMODULES}
fi
# Make truecrypt module load on boot:
- if ! grep -e "^[^#]* truecrypt" etc/rc.d/rc.modules >/dev/null ; then
- echo "# TrueCrypt OTFE (On The Fly Encryption)" >> etc/rc.d/rc.modules
- echo "/sbin/modprobe truecrypt" >> etc/rc.d/rc.modules
+ if ! grep -e "^[^#]* truecrypt" \${RCMODULES} >/dev/null ; then
+ echo "# TrueCrypt OTFE (On The Fly Encryption)" >> \${RCMODULES}
+ echo "/sbin/modprobe truecrypt" >> \${RCMODULES}
fi
# Only run depmod on matching running kernel
@@ -197,7 +236,7 @@ cp -a $DOCS \
chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/*
# Compress the man page(s)
-find $PKG/usr/man -name "*.?" -type f -exec gzip -9f {} \;
+[ -d $PKG/usr/man ] && find $PKG/usr/man -name "*.?" -type f -exec gzip -9f {} \;
# Strip binaries
( cd $PKG
@@ -214,12 +253,11 @@ chmod -R o-w $PKG
# --- PACKAGE DESCRIPTION ---
mkdir -p $PKG/install
-cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $SRCDIR/slack-desc > $PKG/install/slack-desc
# Substitute correct versions
sed -i -e "s#\@\@KERNELVERS\@\@#${KVER}#g" $PKG/install/slack-desc
-# I give in :-/
-if [ -f $CWD/slack-requires ]; then
- cat $CWD/slack-requires > $PKG/install/slack-requires
+if [ -f $SRCDIR/slack-required ]; then
+ cat $SRCDIR/slack-required > $PKG/install/slack-required
fi
@@ -227,19 +265,19 @@ fi
# Build the package:
cd $PKG
-makepkg --linkadd y --chown n $TMP/${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.tgz \
- 2>&1 | tee $CWD/makepkg-${PRGNAM}.log
-(cd $TMP && md5sum ${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.tgz > ${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.tgz.md5)
-cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $TMP/${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.txt
-if [ -f $PKG/install/slack-requires ]; then
- cat $PKG/install/slack-requires > $TMP/${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.dep
+makepkg --linkadd y --chown n $OUTPUT/${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.tgz \
+ 2>&1 | tee $OUTPUT/makepkg-${PRGNAM}.log
+(cd $OUTPUT && md5sum ${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.tgz > ${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.tgz.md5)
+cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.txt
+if [ -f $PKG/install/slack-required ]; then
+ cat $PKG/install/slack-required > $OUTPUT/${PRGNAM}-${VERSION}_${KVER}-${ARCH}-${BUILD}.dep
fi
# --- CLEANUP ---
# Clean up the extra stuff:
-if [ "$1" = "--cleanup" ]; then
+if [ "$P1" = "--cleanup" ]; then
rm -rf $TMP/tmp-$PRGNAM
rm -rf $PKG
fi