diff options
-rwxr-xr-x | ddrescue/build/ddrescue.SlackBuild | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/ddrescue/build/ddrescue.SlackBuild b/ddrescue/build/ddrescue.SlackBuild index 57275cee..70744882 100755 --- a/ddrescue/build/ddrescue.SlackBuild +++ b/ddrescue/build/ddrescue.SlackBuild @@ -1,6 +1,6 @@ #!/bin/sh # $Id$ -# Copyright (c) 2007 Eric Hameleers <alien@slackware.com> +# Copyright 2007-2009 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Permission to use, copy, modify, and distribute this software for @@ -36,8 +36,10 @@ # * Revamped the SlackBuild # 1.5-1: 18/aug/2007 by Eric Hameleers <alien@slackware.com> # * Update. +# 1.9-1: 30/may/2009 by Eric Hameleers <alien@slackware.com> +# * Update. # -# Run 'sh ddrescue.SlackBuild --cleanup' to build a Slackware package. +# Run 'sh ddrescue.SlackBuild' to build a Slackware package. # The package (.tgz) plus descriptive .txt file are created in /tmp . # Install using 'installpkg'. # @@ -46,16 +48,14 @@ # Set initial variables: PRGNAM=ddrescue -VERSION=${VERSION:-1.5} +VERSION=${VERSION:-1.9} ARCH=${ARCH:-i486} BUILD=${BUILD:-1} DOCS="AUTHORS COPYING ChangeLog NEWS README TODO" # Where do we look for sources? -CWD=`pwd` -SRCDIR=`dirname $0` -[ "${SRCDIR:0:1}" == "." ] && SRCDIR=${CWD}/${SRCDIR} +SRCDIR=$(cd $(dirname $0); pwd) # Place to build (TMP) package (PKG) and output (OUTPUT) the program: TMP=${TMP:-/tmp/build} @@ -76,18 +76,8 @@ trap 'echo "$0 FAILED at line $LINENO!" | tee $OUTPUT/error-${PRGNAM}.log' ERR 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 - case "$ARCH" in - i386) SLKCFLAGS="-O2 -march=i386 -m${MOPT}=i686" - SLKLDFLAGS=""; LIBDIRSUFFIX="" - ;; - i486) SLKCFLAGS="-O2 -march=i486 -m${MOPT}=i686" + i486) SLKCFLAGS="-O2 -march=i486 -mtune=i686" SLKLDFLAGS=""; LIBDIRSUFFIX="" ;; s390) SLKCFLAGS="-O2" @@ -118,7 +108,7 @@ if ! [ -f ${SOURCE} ]; then [ -w "$SRCDIR" ] || SOURCE="$OUTPUT/`basename $SOURCE`" echo "Source '`basename ${SOURCE}`' not available yet..." echo "Will download file to `dirname $SOURCE`" - wget -nv --connect-timeout=30 -O "${SOURCE}" "${SRCURL}" || true + wget -nv -T 30 -O "${SOURCE}" "${SRCURL}" || true if [ $? -ne 0 -o ! -s "${SOURCE}" ]; then echo "Downloading '`basename ${SOURCE}`' failed... aborting the build." mv -f "${SOURCE}" "${SOURCE}".FAIL @@ -144,27 +134,21 @@ echo "++" cd $TMP/tmp-$PRGNAM echo "Extracting the source archive(s) for $PRGNAM..." -if `file ${SOURCE} | grep -q ": bzip2"`; then - tar -xjvf ${SOURCE} -elif `file ${SOURCE} | grep -q ": gzip"`; then - tar -xzvf ${SOURCE} -fi +tar -xvf ${SOURCE} cd ${PRGNAM}-${VERSION} chown -R root:root . chmod -R u+w,go+r-w,a-s . echo Building ... +LDFLAGS="$SLKLDFLAGS" \ +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ ./configure --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --localstatedir=/var \ --sysconfdir=/etc \ - --datadir=/usr/share \ --mandir=/usr/man \ - --infodir=/usr/info \ --build=$ARCH-slackware-linux \ - LDFLAGS="$SLKLDFLAGS" \ - CFLAGS="$SLKCFLAGS" \ - CXXFLAGS="$SLKCFLAGS" \ 2>&1 | tee $OUTPUT/configure-${PRGNAM}.log make 2>&1 | tee $OUTPUT/make-${PRGNAM}.log @@ -182,6 +166,11 @@ fi # Add documentation: mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true +cat $SRCDIR/$(basename $0) | sed \ + -e "/^VERSION=/s/:-.*}/:-$VERSION}/" \ + -e "/^ARCH=/s/:-.*}/:-$ARCH}/" \ + -e "/^BUILD=/s/:-.*}/:-$BUILD}/" \ + > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/* # Compress the man page(s): @@ -197,10 +186,8 @@ if [ -d $PKG/usr/info ]; then fi # Strip binaries: -cd $PKG -find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -cd - +find $PKG | xargs file | grep -e "executable" -e "shared object" \ + | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null # Add a package description: mkdir -p $PKG/install @@ -214,8 +201,3 @@ md5sum ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.tgz > ${PRGNAM}-${VERSION}-${ARCH}- cd - cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.txt -# Clean up the extra stuff: -if [ "$P1" = "--cleanup" ]; then - rm -rf $TMP/tmp-$PRGNAM - rm -rf $PKG -fi |