slackbuilds/y/REminiscence_FlashBack/SlackBuild
2022-01-22 19:52:02 +01:00

141 lines
3.7 KiB
Bash
Executable file

#!/bin/bash
# --- INIT ---
# Set initial variables:
CWD=`pwd`
if [ "$TMP" = "" ]; then
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
fi
PRGNAM=REminiscence
VERSION=0.3.7
ARCH=${ARCH:-$(uname -m)}
BUILD=1
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/_repositories/$PRGNAM}
mkdir -p $REPOSITORY
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 ---
[ ! -e $REPOSITORY/${PRGNAM}-${VERSION}.tar.bz2 ] && wget -c -O $REPOSITORY/${PRGNAM}-${VERSION}.tar.bz2 http://cyxdown.free.fr/reminiscence/REminiscence-${VERSION}.tar.bz2
[ ! -e $REPOSITORY/flashback-x86_64.tar.gz ] & wget -c -O $REPOSITORY/flashback-x86_64.tar.gz https://lutris.net/files/games/flashback/flashback-x86_64.tar.gz
echo "Extracting the program tarball for $PRGNAM..."
tar xf $REPOSITORY/${PRGNAM}-${VERSION}.tar.bz2
cd ${PRGNAM}-${VERSION}
chown -R root.root *
find . -perm 777 -exec chmod 755 {} \;
zcat $REPOSITORY/nices_path.patch.gz | patch -p1
#zcat $REPOSITORY/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/$PRGNAM
mv rs $PKG/usr/games/
cd $PKG/usr/games/
ln -s rs REminiscence
ln -s rs flashback
cd $PKG/usr/share/games/
tar xf $REPOSITORY/flashback-x86_64.tar.gz # jeu lui-même
mv flashback $PRGNAM
mkdir -p $PKG/usr/share/pixmaps
cp $REPOSITORY/flashback.png $PKG/usr/share/pixmaps
# --- DOCUMENTATION ---
cd $TMP/${PRGNAM}-${VERSION}
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README.txt $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
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
# --- 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}: http://cyxdown.free.fr/reminiscence/
EOF
# --- BUILDING ---
# Build the package:
cd $PKG
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/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