slackbuilds/UNUSED/ap/plan9port/SlackBuild

108 lines
2.4 KiB
Text
Raw Normal View History

2011-04-11 03:59:15 +02:00
#!/bin/sh
set -x
CWD=$(pwd)
PRGNAM=$(basename $CWD)
VERSION=$(date +%Y.%m.%d_%H.%M)
BUILD=1
ARCH=$(uname -m)
LIBSUFFIX=$(echo $ARCH | grep -o "\(64\)")
2020-06-25 11:23:11 +02:00
TAG=gwh
2011-04-11 03:59:15 +02:00
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
OUTPUT=/tmp
2011-07-22 08:41:46 +02:00
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
2011-04-11 03:59:15 +02:00
PREFIX=/usr
# Cleaning
rm -fr $TMP/$PRGNAM-$VERSION
rm -fr $PKG
mkdir -p $TMP
if [ ! -e $REPOSITORY ] ; then
mkdir -p $(dirname $REPOSITORY)
hg clone "https://bitbucket.org/rsc/plan9port" $REPOSITORY
else
( cd $REPOSITORY
hg pull -u
)
fi
# Preparation
mkdir -p $PKG/opt
cp -R $REPOSITORY $PKG/opt/$PRGNAM
cd $PKG/opt/$PRGNAM
rm -fr .hg*
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Building
./INSTALL -b
# Installation
cd dist
../bin/mk man
cd ..
cp lib/moveplan9.sh lib/moveplan9.sh.slackinstall_$VERSION
sed -i 's|new=`cleanname $PLAN9`|new=/opt/plan9port|g' lib/moveplan9.sh.slackinstall_$VERSION
sh ./lib/moveplan9.sh.slackinstall_$VERSION
rm lib/moveplan9.sh.slackinstall_$VERSION
mkdir -p $PKG/etc/profile.d
cat <<EOF > $PKG/etc/profile.d/$PRGNAM.sh
#!/bin/sh
PLAN9=/opt/plan9port
PATH=\$PATH:\${PLAN9}
MANPATH=\$MANPATH:\${PLAN9}/man
2011-04-11 03:59:15 +02:00
export PLAN9 PATH MANPATH
EOF
chmod +x $PKG/etc/profile.d/$PRGNAM.sh
cat <<EOF > $PKG/etc/profile.d/$PRGNAM.csh
#!/bin/csh
setenv PLAN9 /opt/plan9port
setenv PATH \${PATH}:\${PLAN9}/bin
setenv MANPATH \${MANPATH}:\${PLAN9}/man
2011-04-11 03:59:15 +02:00
EOF
chmod +x $PKG/etc/profile.d/$PRGNAM.csh
# Cleaning
find $PKG | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find $PKG | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find $PKG$PREFIX/man/man? -type f -name "*.?" -exec gzip -9 {} \;
chown -R root:root $PKG
# Packaging
cd $PKG
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (Plan 9 from User Space)
$PRGNAM:
$PRGNAM: Plan 9 from User Space (aka plan9port) is a port of many Plan 9 programs
$PRGNAM: from their native Plan 9 environment to Unix-like operating systems.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: http://swtch.com/plan9port/
$PRGNAM:
EOF
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
2011-04-11 03:59:15 +02:00
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz