126 lines
3.8 KiB
Bash
Executable file
126 lines
3.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# --- INIT ---
|
|
# Set initial variables:
|
|
CWD=`pwd`
|
|
|
|
PRGNAM=$(basename $CWD)
|
|
TAG=${TAG:-gwh}
|
|
OUTPUT=/tmp
|
|
TMP=${TMP:-/tmp/$TAG}
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
VERSION=${VERSION:-$(curl -s http://cyxdown.free.fr/reminiscence/CHANGES.txt | grep release | head -n1 | grep -o "[0-9.]*")}
|
|
ARCH=${ARCH:-$(uname -m)}
|
|
BUILD=1
|
|
|
|
REPOSITORY=${REPOSITORY:-/var/cache/SlackBuilds.gwh/$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
|
|
|
|
# --- PACKAGE BUILDING ---
|
|
[ ! -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/CHANGES-${VERSION}.txt ] && wget -c -O $REPOSITORY/CHANGES-${VERSION}.txt http://cyxdown.free.fr/reminiscence/CHANGES.txt
|
|
[ ! -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
|
|
[ ! -e $REPOSITORY/stb_vorbis.c ] & wget -c -O $REPOSITORY/stb_vorbis.c https://raw.githubusercontent.com/nothings/stb/master/stb_vorbis.c
|
|
|
|
rm -rf $PKG $TMP/${PRGNAM}-${VERSION}
|
|
mkdir -p $TMP
|
|
|
|
echo "Extracting the program tarball for $PRGNAM..."
|
|
[ -e $TMP/${PRGNAM}-${VERSION} ] && rm -r $TMP/${PRGNAM}-${VERSION}
|
|
cd $TMP
|
|
tar xf $REPOSITORY/${PRGNAM}-${VERSION}.tar.bz2
|
|
|
|
cd ${PRGNAM}-${VERSION}
|
|
|
|
chown -R root.root *
|
|
find . -perm 777 -exec chmod 755 {} \;
|
|
|
|
zcat $CWD/nices_path.patch.gz | patch -p1
|
|
cp $REPOSITORY/stb_vorbis.c .
|
|
|
|
# --- 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 $CWD/flashback.png $PKG/usr/share/pixmaps
|
|
|
|
# --- DOCUMENTATION ---
|
|
cd $TMP/${PRGNAM}-${VERSION}
|
|
mkdir -p $PKG/usr/doc/$PRGNAM
|
|
cp -a $REPOSITORY/CHANGES-${VERSION}.txt README.txt $PKG/usr/doc/$PRGNAM
|
|
chmod -R a-w $PKG/usr/doc/$PRGNAM/*
|
|
|
|
# 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}:
|
|
${PRGNAM}:
|
|
${PRGNAM}: Original files included.
|
|
${PRGNAM}:
|
|
${PRGNAM}: see /usr/doc/${PRGNAM} 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
|