diff options
author | Eric Hameleers <alien@slackware.com> | 2010-01-31 14:14:50 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2010-01-31 14:14:50 +0000 |
commit | ee573436a2090984d01beb771843fb2621f4e771 (patch) | |
tree | 2bcc523db4448c7a9b9b5ce22d90b3f50a998403 /evolvotron | |
parent | 9aa1ee7868b7feefbc414f0cc85faddc914ad0c1 (diff) | |
download | asb-ee573436a2090984d01beb771843fb2621f4e771.tar.gz asb-ee573436a2090984d01beb771843fb2621f4e771.tar.xz |
Prepared for Slackware 13
Diffstat (limited to '')
-rwxr-xr-x | evolvotron/build/evolvotron.SlackBuild | 149 |
1 files changed, 87 insertions, 62 deletions
diff --git a/evolvotron/build/evolvotron.SlackBuild b/evolvotron/build/evolvotron.SlackBuild index d55ef752..993801d5 100755 --- a/evolvotron/build/evolvotron.SlackBuild +++ b/evolvotron/build/evolvotron.SlackBuild @@ -1,6 +1,6 @@ #!/bin/sh # $Id$ -# Copyright (c) 2006,2008 Eric Hameleers <alien@slackware.com> +# Copyright (c) 2006,2008,2010 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Permission to use, copy, modify, and distribute this software for @@ -34,8 +34,10 @@ # * Initial build. # 0.5.1-1: 02/Feb/2008 by Eric Hameleers <alien@slackware.com> # * New release. +# 0.6.1-1: 30/Jan/2010 by Eric Hameleers <alien@slackware.com> +# * New release. # -# Run 'sh evolvotron.SlackBuild --cleanup' to build a Slackware package. +# Run 'sh evolvotron.SlackBuild' to build a Slackware package. # The package (.tgz) plus descriptive .txt file are created in /tmp . # Install using 'installpkg'. # @@ -44,8 +46,8 @@ # Set initial variables: PRGNAM=evolvotron -VERSION=${VERSION:-0.5.1} -ARCH=${ARCH:-i486} +#VERSION=${VERSION:-0.6.1} +VERSION=${VERSION:-r647} BUILD=${BUILD:-1} DOCS="BUGS CHANGES LICENSE README TODO USAGE VERSION evolvotron.html extras" @@ -60,79 +62,112 @@ TMP=${TMP:-/tmp/build} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -# Input URL: http://downloads.sourceforge.net/evolvotron/evolvotron-0.5.1.tar.gz SOURCE="$SRCDIR/${PRGNAM}-${VERSION}.tar.gz" -SRCURL="http://downloads.sourceforge.net/${PRGNAM}/${PRGNAM}-${VERSION}.tar.gz" +#SRCURL="http://downloads.sourceforge.net/${PRGNAM}/${PRGNAM}-${VERSION}.tar.gz" +SRCURL="" ## ## --- with a little luck, you won't have to edit below this point --- ## ## -# Exit the script on errors: -set -e -trap 'echo "$0 FAILED at line ${LINENO}" | tee $OUTPUT/error-${PRGNAM}.log' ERR -# Catch unitialized variables: -set -u -P1=${1:-1} - # Save old umask and set to 0022: _UMASK_=$(umask) umask 0022 -# 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 +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac fi 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" + i486) SLKCFLAGS="-O2 -march=i486 -mtune=i686" SLKLDFLAGS=""; LIBDIRSUFFIX="" ;; x86_64) SLKCFLAGS="-O2 -fPIC" SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64" ;; - athlon-xp) SLKCFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" + *) SLKCFLAGS="-O2" SLKLDFLAGS=""; LIBDIRSUFFIX="" ;; esac +# Exit the script on errors: +set -e +trap 'echo "$0 FAILED at line ${LINENO}" | tee $OUTPUT/error-${PRGNAM}.log' ERR +# Catch unitialized variables: +set -u +P1=${1:-1} + # Create working directories: mkdir -p $OUTPUT # place for the package to be saved mkdir -p $TMP/tmp-$PRGNAM # location to build the source mkdir -p $PKG # place for the package to be built rm -rf $PKG/* # always erase old package's contents -if [ "$P1" != "--oldbuild" ]; then - # Use the "--oldbuild" parameter to keep old build files and continue; - # By default we remove the remnants of previous build and continue. - rm -rf $TMP/tmp-$PRGNAM/* -fi +rm -rf $TMP/tmp-$PRGNAM/* # remove the remnants of previous build +rm -rf $OUTPUT/{configure,make,install,error,makepkg}-$PRGNAM.log + # remove old log files + +# Use the src_checkout() function if no downloadable tarball exists. +# This function checks out sources from SVN/CVS and creates a tarball of them. +src_checkout() { + # Param #1 : index in the SOURCE[] array. + # Param #2 : full path to where SOURCE[$1] tarball should be created. + # Determine the tarball extension: + PEXT=$(echo "${2}" | sed -r -e 's/.*[^.].(tar.xz|tar.gz|tar.bz2|tgz).*/\1/') + case "$PEXT" in + "tar.xz") TARCOMP="J" ;; + "tar.gz") TARCOMP="z" ;; + "tgz") TARCOMP="z" ;; + "tar.bz2") TARCOMP="j" ;; + *) echo "Archive can only have extension 'tar.xz', '.tar.gz' '.tar.bz2' or ' +.tgz'" ; exit 1 ;; + esac + case ${1} in + 0) # This example assumes a SVN checkout: + if [ "$(echo ${VERSION}|cut -c1)" == 'r' ]; then # revision instead of date + REV=$(echo ${VERSION} | cut -c2-) + else + REV="{${VERSION}}" + fi + mkdir $PRGNAM-${VERSION} \ + && cd $PRGNAM-${VERSION} \ + && svn checkout --revision $REV http://evolvotron.svn.sourceforge.net/svnroot/evolvotron/trunk . \ + && find . -type d -name '.svn' -depth | xargs rm -rf \ + && chown -R root:root . \ + && cd .. \ + && tar -${TARCOMP}cf ${2} $PRGNAM-${VERSION} + rm -rf $PRGNAM-${VERSION} + ;; + *) # Do nothing + ;; + esac +} # Source file availability: if ! [ -f ${SOURCE} ]; then + echo "Source '$(basename ${SOURCE})' not available yet..." + # Check if the $SRCDIR is writable at all - if not, download to $OUTPUT + [ -w "$SRCDIR" ] || SOURCE="$OUTPUT/$(basename ${SOURCE})" if ! [ "x${SRCURL}" == "x" ]; then - # Check if the $SRCDIR is writable at all - if not, download to $OUTPUT - [ -w "$SRCDIR" ] || SOURCE="$OUTPUT/$(basename $SOURCE)" - echo "Source '$(basename ${SOURCE})' not available yet..." echo "Will download file to $(dirname $SOURCE)" wget -nv -T 20 -O "${SOURCE}" "${SRCURL}" || true if [ $? -ne 0 -o ! -s "${SOURCE}" ]; then - echo "Downloading '$(basename ${SOURCE})' failed... aborting the build." + echo "Fail to download '$(basename ${SOURCE})'. Aborting the build." mv -f "${SOURCE}" "${SOURCE}".FAIL exit 1 fi else - echo "File '$(basename ${SOURCE})' not available... aborting the build." + # Try if we have a SVN/CVS download routine for ${SOURCE} + echo "Will checkout sources to $(dirname $SOURCE)" + src_checkout 0 "${SOURCE}" 2>&1 > $OUTPUT/checkout-$(basename ${SOURCE}).log + fi + if [ ! -f "${SOURCE}" -o ! -s "${SOURCE}" ]; then + echo "File '$(basename ${SOURCE})' not available. Aborting the build." exit 1 fi fi @@ -150,17 +185,20 @@ 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 -mv ${PRGNAM} ${PRGNAM}-${VERSION} +tar -xvf ${SOURCE} +mv ${PRGNAM} ${PRGNAM}-${VERSION} 2>/dev/null || true cd ${PRGNAM}-${VERSION} + +# Qt4 fix: +sed -i -e 's/qmake-qt4/qmake/g' $(grep -lr -- -qt4 .) + chown -R root:root . chmod -R u+w,go+r-w,a-s . echo Building ... +# This avoids compiling a version number into .la files: +QTDIR=/usr/lib${LIBDIRSUFFIX}/qt ; export QTDIR + LDFLAGS="$SLKLDFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \ @@ -172,7 +210,6 @@ mkdir -p $PKG/usr/bin cp ./evolvotron/evolvotron $PKG/usr/bin cp ./evolvotron_render/evolvotron_render $PKG/usr/bin cp ./evolvotron_mutate/evolvotron_mutate $PKG/usr/bin -cp ./evolvotron_match/evolvotron_match $PKG/usr/bin mkdir -p $PKG/usr/man/man1 cp man/man1/*.1 $PKG/usr/man/man1 @@ -198,6 +235,8 @@ cat <<-EOT > $PKG/usr/share/applications/${PRGNAM}.desktop # Add documentation: mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true +cat $SRCDIR/$(basename $0) > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION find $PKG/usr/doc -type f -exec chmod 644 {} \; # Compress the man page(s): @@ -207,10 +246,8 @@ if [ -d $PKG/usr/man ]; 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 || true # Add a package description: mkdir -p $PKG/install @@ -218,9 +255,6 @@ cat $SRCDIR/slack-desc > $PKG/install/slack-desc if [ -f $SRCDIR/doinst.sh ]; then cat $SRCDIR/doinst.sh >> $PKG/install/doinst.sh fi -if [ -f $SRCDIR/slack-required ]; then - cat $SRCDIR/slack-required > $PKG/install/slack-required -fi # Build the package: cd $PKG @@ -229,14 +263,5 @@ cd $OUTPUT md5sum ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.tgz > ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.tgz.md5 cd - cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.txt -if [ -f $PKG/install/slack-required ]; then - cat $PKG/install/slack-required > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.dep -fi - -# Clean up the extra stuff: -if [ "$P1" = "--cleanup" ]; then - rm -rf $TMP/tmp-$PRGNAM - rm -rf $PKG -fi umask ${_UMASK_} |