slackbuilds/y/REminiscence_FlashBack/REminiscence.SlackBuild
Gwenhael Le Moine 51cc25a4b6 added
2011-02-17 12:25:23 +07:00

143 lines
3.2 KiB
Bash
Executable file

#!/bin/sh
# --- INIT ---
# Set initial variables:
CWD=`pwd`
if [ "$TMP" = "" ]; then
TAG=cyco
OUTPUT=/tmp
TMP=/tmp/$TAG
fi
PRGNAM=REminiscence
VERSION=0.1.9
ARCH=${ARCH:-$(uname -m)}
BUILD=1
if [ "$ARCH" = "i386" ]; then
SLKCFLAGS="-O2 -march=i386 -mtune=i686"
elif [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2"
fi
PKG=$TMP/pkg-$PRGNAM
# --- PACKAGE BUILDING ---
echo "++"
echo "|| $PRGNAM-$VERSION"
echo "++"
rm -rf $PKG $TMP/${PRGNAM}-${VERSION}
cd $TMP
# --- TARBALL EXTRACTION,PATCH,MODIFY ---
echo "Extracting the program tarball for $PRGNAM..."
tar xf $CWD/${PRGNAM}-${VERSION}.tar.bz2
cd ${PRGNAM}-${VERSION}
chown -R root.root *
find . -perm 777 -exec chmod 755 {} \;
zcat $CWD/nices_path-$VERSION.patch.gz | patch -p1
#zcat $CWD/bad_crc.diff.gz | patch -p1
# --- BUILDING ---
echo Building ...
CFLAGS="$SLKCFLAGS" \
make
#
# Install all the needed stuff to the package dir
#
mkdir -p $PKG/usr/games $PKG/usr/share/games/ $PKG/var/lib/REminiscence
mv rs $PKG/usr/games/
(
cd $PKG/usr/games/
ln -s rs REminiscence
ln -s rs flashback
)
(
cd $PKG/usr/share/games/
tar xf $CWD/../FlashBack/FlashBack.tar.bz2 # jeu lui-même
)
mkdir -p $PKG/usr/share/pixmaps
cp $CWD/flashback.png $PKG/usr/share/pixmaps
# --- DOCUMENTATION ---
cd $TMP/${PRGNAM}-${VERSION}
DOCS="README COPYING"
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/*
# Compress the man page(s)
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
# Strip 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
)
# --- OWNERSHIP, RIGHTS ---
chmod -R o-w $PKG
chown -R root:root $PKG/*
chmod a+rwx $PKG/var/lib/REminiscence
# --- PACKAGE DESCRIPTION ---
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
${PRGNAM}: ${PRGNAM} (Flashback game engine)
${PRGNAM}:
${PRGNAM}: ${PRGNAM} is a re-implementation of the engine used in the game
${PRGNAM}: Flashback made by Delphine Software and released in 1992.
${PRGNAM}:
${PRGNAM}: You will need the original files.
${PRGNAM}:
${PRGNAM}: Original files included.
${PRGNAM}:
${PRGNAM}: see /usr/doc/${PRGNAM}-${VERSION} for more.
${PRGNAM}:
EOF
# --- BUILDING ---
# Build the package:
cd $PKG
makepkg --linkadd y --chown n $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}$TAG.txz
# --- CLEANUP ---
# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
rm -rf $TMP/tmp-$PRGNAM
rm -rf $PKG
fi