summaryrefslogtreecommitdiffstats
path: root/system/plan9port/plan9port.SlackBuild
blob: b5b691697ac49dbf7e1e3b04eaf2c3a318b7858d (plain)
#!/bin/sh

# Slackware build script for plan9port 

# Written by core (eroc@linuxmail.org)

PRGNAM=plan9port
VERSION=20070917
ARCH=${ARCH:-i586} # There's no use of cflags.
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
tar xvf $CWD/$PRGNAM-$VERSION.tgz 2>/dev/null || true	# 4 harmless errors 
cd plan9
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

# All plan9 programs are going to be installed in "/opt/plan9"

# The default prefix for plan9 is "/usr/local/plan9" and some files (that are
# listed in /tmp/SBo/plan9/lib/moveplan9.files) are going to end up with that
# prefix hardcoded. There's a script that resolves this problem, and the 
# compilation runs it by default, but we'll have to edit it because it uses
# the current build directory as the path.  I've tried passing /opt/plan9
# as the value of PLAN9, hoping the script would pick it up and do the 
# right thing, but no dice, so we'll kludge it.  --rworkman
sed -i 's:^new=`cleanname $PLAN9`$:new=`cleanname /opt/plan9`:' \
  lib/moveplan9.sh

./INSTALL
cd ..

mkdir -p $PKG/opt
mv plan9 $PKG/opt

( 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
)

# All these "CVS" directories should not be needed.
# If I'm wrong, let me know.  --rworkman
# We'll do this in a subshell, because it will generate errors
( find $PKG -type d -name "CVS" -exec rm -rf {} \; 2>/dev/null )

# man(1) from plan9port dislikes man pages compressed :)

# To setup some environment variables:
mkdir -p $PKG/etc/profile.d/
install -D -m 0755 $CWD/$PRGNAM.sh $PKG/etc/profile.d/$PRGNAM.sh
install -m 0755 $CWD/$PRGNAM.csh $PKG/etc/profile.d/$PRGNAM.csh

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cd $PKG/opt/plan9
cp -a CHANGES install.txt LICENSE README TODO $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

# Add the window manager 'rio' to xwmconfig's list.
install -D -m 0755 $CWD/xinitrc.rio $PKG/etc/X11/xinit/xinitrc.rio

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz