slackbuilds_ponce/system/sash/sash.SlackBuild

96 lines
2.5 KiB
Text
Raw Normal View History

2010-05-11 20:02:07 +02:00
#!/bin/sh
# Slackware build script for the stand alone shell (sash)
2010-05-13 00:41:45 +02:00
# Written by Menno Duursma <druiloor@zonnet.nl>
2010-05-11 20:02:07 +02:00
# Modified by Robby Workman of the SlackBuilds.org project
2010-05-13 00:41:45 +02:00
# This program is free software. It comes without any warranty.
# Granted WTFPL, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
2010-05-11 20:02:07 +02:00
PRGNAM=sash
2010-05-13 00:41:45 +02:00
VERSION=${VERSION:-3.7}
2010-05-11 20:02:07 +02:00
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
2010-05-13 00:41:45 +02:00
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi
2010-05-11 20:02:07 +02:00
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
2010-05-13 00:41:45 +02:00
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
2010-05-13 00:41:45 +02:00
fi
set -e # Exit on most errors
2010-05-11 20:02:07 +02:00
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
2010-05-13 00:41:45 +02:00
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
2010-05-11 20:02:07 +02:00
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
2010-05-13 00:41:45 +02:00
# The 'sash-plus-patches' patch adds support for _very_ useful features
# like env var expansion and the 'chroot' command:
2010-05-11 20:02:07 +02:00
# http://www.baiti.net/sash/
2010-05-13 00:41:45 +02:00
patch -p1 --verbose < $CWD/patches/sash-plus-patches-3.7
2010-05-11 20:02:07 +02:00
# Apply the appropriate CFLAGS to the Makefile
2010-05-13 00:41:45 +02:00
sed -i "s/^CFLAGS = -O3/CFLAGS = $SLKCFLAGS/" Makefile
2010-05-11 20:02:07 +02:00
# Let's make this thing support DESTDIR
2010-05-13 00:41:45 +02:00
patch -p1 --verbose < $CWD/patches/sash-3.7-DESTDIR.patch
2010-05-11 20:02:07 +02:00
# Fix an include line in cmd_chattr.c
2010-05-13 00:41:45 +02:00
patch -p1 --verbose < $CWD/patches/sash-3.7-cmd_chattr.c.patch
2010-05-11 20:02:07 +02:00
# Create target dirs
2010-05-13 00:41:45 +02:00
mkdir -p $PKG/bin $PKG/usr/man/man1
2010-05-11 20:02:07 +02:00
make
make install DESTDIR=$PKG
2010-05-19 08:50:26 +02:00
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
2010-05-11 20:02:07 +02:00
( cd $PKG/usr/man
find . -type f -exec gzip -9 {} \;
2010-05-13 00:41:45 +02:00
for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
2010-05-11 20:02:07 +02:00
)
2010-05-13 00:41:45 +02:00
2010-05-11 20:02:07 +02:00
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a CHANGES README $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
2010-05-13 00:41:45 +02:00
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}