#!/bin/sh # # Slackware build script for adplay - AdLib music player for the command line. # # Heavily based on the Slackware 13.0 SlackBuild # Written by Luigi "Reilly" Cozzolino # URL: http://adplug.sourceforge.net # Packager: Luigi "Reilly" Cozzolino # # BuildRequires: adplug # Exit on most errors: set -e ######## SOURCE PACKAGE SECTION ########### SRCNAME="adplay" SRCVER="1.6" SRCTYPE="tar.bz2" SRCPKG="${SRCNAME}-${SRCVER}.${SRCTYPE}" SOURCEDIR="${SRCNAME}-${SRCVER}" ######## END SOURCE PACKAGE SECTION ####### ######## SLACKWARE PACKAGE SECTION ######## SLKNAM="${SRCNAME}" SLKVER="${SRCVER}" ARCH="${ARCH:-i486}" BUILD="1lc" PKGTYPE="${PKGTYPE:-txz}" ######## END SLACKWARE PACKAGE SECTION #### CWD=$(pwd) TMP=${TMP:-$HOME/PKGS/${SLKNAM}} if [ "${ARCH}" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "${ARCH}" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" fi # Number of jobs to compile at once: if [ -z "$NUMJOBS" ]; then NUMJOBS=-j4 fi PKG=$TMP/package-${SLKNAM} rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf ${SOURCEDIR} clear sleep 1 echo ; echo ; echo echo "+===========================================================" echo -e "|\033[01;32m Building\033[00m \033[01;31m${SRCPKG}\033[00m" echo "+===========================================================" sleep 5 # Checking source package type... [ "${SRCTYPE}" = "tar.gz" -o "${SRCTYPE}" = "tgz" ] && EXTRACT_SRCPKG="tar -xvzf" [ "${SRCTYPE}" = "tar.bz2" -o "${SRCTYPE}" = "tbz" ] && EXTRACT_SRCPKG="tar -xvjf" [ "${SRCTYPE}" = "zip" -o "${SRCTYPE}" = "ZIP" ] && EXTRACT_SRCPKG="unzip" [ "${SRCTYPE}" = "rar" -o "${SRCTYPE}" = "RAR" ] && EXTRACT_SRCPKG="rar x" [ "${SRCTYPE}" = "7z" -o "${SRCTYPE}" = "7Z" ] && EXTRACT_SRCPKG="7z x" # and finally extract it: ${EXTRACT_SRCPKG} $CWD/${SRCPKG} || exit 1 cd ${SOURCEDIR} # Make sure ownerships and permissions are sane: chown -R root:root . find . -perm 666 -exec chmod 644 {} \; find . -perm 664 -exec chmod 644 {} \; find . -perm 600 -exec chmod 644 {} \; find . -perm 444 -exec chmod 644 {} \; find . -perm 400 -exec chmod 644 {} \; find . -perm 440 -exec chmod 644 {} \; find . -perm 777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 511 -exec chmod 755 {} \; find . -perm 711 -exec chmod 755 {} \; find . -perm 555 -exec chmod 755 {} \; # Configure: CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --mandir=/usr/man \ --build=${ARCH}-slackware-linux || exit 1 # Build and install: make $NUMJOBS || exit 1 make install DESTDIR=$PKG || exit 1 # Strip binaries and libraries: ( 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 ) # Add some stuff that come from `http://adplug.sourceforge.net': mkdir -p $PKG/usr/share/${SLKNAM}/examples unzip $CWD/examples.zip -d $PKG/usr/share/${SLKNAM}/examples # Remove spaces and change perms to files: ( cd $PKG/usr/share/${SLKNAM}/examples mv -v "LAME intro tune for Xerox of INC.raw" "LAME_intro_tune_for_Xerox_of_INC.raw" mv -v "Monkey Island 2.laa" "Monkey_Island2.laa" chmod -v 0644 * ) || exit # Compress and link manpages, if any: if [ -d $PKG/usr/man ]; then ( cd $PKG/usr/man for manpagedir in $(find . -type d -name "man*") ; do ( cd $manpagedir for eachpage in $( find . -type l -maxdepth 1) ; do ln -s $( readlink $eachpage ).gz $eachpage.gz rm $eachpage done gzip -9 *.* ) done ) fi # Add a documentation directory: mkdir -p $PKG/usr/doc/${SLKNAM}-${SLKVER} cp -a \ AUTHORS* ChangeLog* COPYING* INSTALL* NEWS* README* TODO* \ $PKG/usr/doc/${SLKNAM}-${SLKVER} cat $CWD/${SLKNAM}.SlackBuild > $PKG/usr/doc/${SLKNAM}-${SLKVER}/${SLKNAM}.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc #cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG requiredbuilder -v -y -s $CWD $PKG /sbin/makepkg -l y -c n $TMP/${SLKNAM}-${SLKVER}-${ARCH}-${BUILD}.${PKGTYPE} # Checksum `md5' file creation: ( cd $TMP ; md5sum ${SLKNAM}-${SLKVER}-${ARCH}-$BUILD.${PKGTYPE} > ${SLKNAM}-${SLKVER}-${ARCH}-${BUILD}.${PKGTYPE}.md5 ) # Final touches: ( cd $TMP ; cat $PKG/install/slack-desc | grep "^${SLKNAM}:" > ${SLKNAM}-${SLKVER}-${ARCH}-${BUILD}.txt ) # Clean up the extra stuff: if [ "$1" = "--cleanup" -o "$1" = "-c" ]; then rm -rf $TMP/${SOURCEDIR} rm -rf $PKG fi