#! /bin/sh # Joel J. Adamson 2007-8-25 # Set initial variables: DATE=`date +%m.%d.%y.%H%M` CWD=`pwd` if [[ -z "$TMP" ]]; then TMP=/tmp fi # The version which appears in the application's filename VERSION=${DATE} # If the version conflicts with the Slackware package standard # The dash character ("-") is not allowed in the VERSION string # You can set the PKG_VERSION to something else than VERSION PKG_VERSION=${VERSION} # the version which appears in the package name. ARCH=${ARCH:-i686} # the architecture on which you want to build your package # First digit is the build number, which specifies how many times it has been built. # Second string is the short form of the authors name, typical three initials:w BUILD=${BUILD:-1_jja} # The application's name APP=emacs-cvs # The installation directory of the package (where its actual directory # structure will be created) PKG=$TMP/package-$APP if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mtune=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" fi # Delete the leftover directories if they exist (due to a previous build) # and (re)create the packaging directory rm -rf $PKG mkdir -p $TMP $PKG if [[ -e $TMP/$APP/emacs ]] && [[ -d $TMP/$APP/emacs ]]; then cd $TMP/$APP/emacs cvs update else rm -rf $TMP/$APP mkdir $TMP/$APP # Change to the TMP directory cd $TMP/$APP # Extract the application source in TMP # Note: if your application comes as a tar.bz2, you need tar -jxvf # tar -zxvf $CWD/$APP-$VERSION.tar.gz cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs \ co emacs # Change to the application source directory cd emacs fi # Change ownership and permissions if necessary # This may not be needed in some source tarballs, but it never hurts chown -R root:root . chmod -R u+w,go+r-w,a-s . # Set configure options # If your app is written in C++, you'll also need to add a line for # CXXFLAGS CFLAGS="$SLKCFLAGS" ./configure \ --with-x-toolkit=gtk \ --enable-font-backend \ --with-xft \ --with-sound \ --prefix=/usr \ --enable-shared \ --sysconfdir=/etc \ --localstatedir=/var \ --enable-perl=/usr/bin/perl \ --build=$ARCH-slackware-linux \ --host=$ARCH-slackware-linux # compile the source, but exit if anything goes wrong make bootstrap || exit make || exit # Install everything into the package directory, but exit if anything goes wrong make install DESTDIR=$PKG || exit # Create a directory for documentation mkdir -p $PKG/usr/doc/$APP-$VERSION # Copy documentation to the docs directory and fix permissions cp -a doc/ BUGS COPYING ChangeLog INSTALL README $PKG/usr/doc/$APP-$VERSION find $PKG/usr/doc/$APP-$VERSION -type f -exec chmod 644 {} \; # copy Slackbuild to doc directory cat $CWD/$APP.SlackBuild > $PKG/usr/doc/$APP-$VERSION/$APP.SlackBuild # Create the ./install directory and copy the slack-desc into it mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc # Add doinst.sh to package (if it exists) if [ -e $CWD/doinst.sh.gz ]; then zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh fi # Strip some libraries and binaries ( 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 ) # Compress man pages if they exist if [ -d $PKG/usr/share/man ]; then ( cd $PKG/usr/share/man find . -type f -exec gzip -9 {} \; for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done ) fi # Compress info pages if they exist (and remove the dir file) if [ -d $PKG/usr/share/info ]; then rm -f $PKG/usr/share/info/dir gzip -9 $PKG/usr/share/info/* fi # Build the package cd $PKG /sbin/makepkg -l y -c n $TMP/$APP-$PKG_VERSION-$ARCH-$BUILD.tgz