2010-05-13 00:58:07 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for bsnes
|
|
|
|
|
|
|
|
# Written by Larry Hajali <larryhaja[at]gmail[dot]com>
|
|
|
|
|
|
|
|
PRGNAM=bsnes
|
2012-09-24 15:24:03 +02:00
|
|
|
VERSION=${VERSION:-091}
|
2010-05-13 00:58:07 +02:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
2010-05-20 05:18:58 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2010-06-12 23:47:30 +02:00
|
|
|
i?86) export ARCH=i486 ;;
|
|
|
|
arm*) export ARCH=arm ;;
|
|
|
|
*) export ARCH=$( uname -m ) ;;
|
2010-05-20 05:18:58 +02:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2010-05-13 00:58:07 +02:00
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
2010-06-12 23:47:30 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-13 00:58:07 +02:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
2010-06-12 23:47:30 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-13 00:58:07 +02:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
2010-06-12 23:47:30 +02:00
|
|
|
LIBDIRSUFFIX="64"
|
2010-05-20 05:18:58 +02:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
2010-06-12 23:47:30 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-13 00:58:07 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
2012-09-24 15:24:03 +02:00
|
|
|
rm -rf ${PRGNAM}_v${VERSION}-source
|
|
|
|
tar xvf $CWD/${PRGNAM}_v${VERSION}-source.tar.xz
|
|
|
|
cd ${PRGNAM}_v${VERSION}-source
|
2010-08-26 02:47:23 +02:00
|
|
|
find . -type d -exec chmod -R 0755 {} \;
|
2010-05-13 00:58:07 +02:00
|
|
|
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 {} \;
|
|
|
|
|
2011-06-19 06:39:37 +02:00
|
|
|
cd $PRGNAM
|
2010-05-13 00:58:07 +02:00
|
|
|
|
2012-09-24 15:24:03 +02:00
|
|
|
sed -e 's|audio.pulseaudio ||' \
|
|
|
|
-e 's|audio.pulseaudiosimple ||' \
|
|
|
|
-i 'target-ethos/Makefile'
|
2011-06-19 06:39:37 +02:00
|
|
|
|
2012-09-24 15:24:03 +02:00
|
|
|
moc -i -Iphoenix/qt/ -o phoenix/qt/platform.moc phoenix/qt/platform.moc.hpp
|
|
|
|
sed -e 's/sudo install/install/' \
|
|
|
|
-i 'target-ethos/Makefile'
|
2011-06-19 06:39:37 +02:00
|
|
|
# Choose whether qt or gtk interface is used. Qt4 is default.
|
2011-09-06 04:53:33 +02:00
|
|
|
if [ "${INTERFACE:-QT4}" != 'QT4' ]; then
|
|
|
|
PHOENIX='gtk'
|
2011-06-19 06:39:37 +02:00
|
|
|
else
|
2011-09-06 04:53:33 +02:00
|
|
|
PHOENIX='qt'
|
2011-06-19 06:39:37 +02:00
|
|
|
fi
|
2010-05-13 00:58:07 +02:00
|
|
|
|
2011-06-19 06:39:37 +02:00
|
|
|
# Determine which mode to build bsnes.
|
2011-09-06 04:53:33 +02:00
|
|
|
# Possible values for PROFILE: accuracy, compatibility, and performance.
|
2011-08-04 12:15:27 +02:00
|
|
|
PROFILE=${PROFILE:-compatibility}
|
2010-06-12 23:47:30 +02:00
|
|
|
|
2011-06-19 06:39:37 +02:00
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
make \
|
|
|
|
platform=x \
|
|
|
|
compiler=gcc \
|
|
|
|
prefix=/usr \
|
2011-09-06 04:53:33 +02:00
|
|
|
phoenix="$PHOENIX" \
|
2011-06-19 06:39:37 +02:00
|
|
|
profile="$PROFILE"
|
|
|
|
|
2012-09-24 15:24:03 +02:00
|
|
|
make install profile=$PROFILE DESTDIR=$PKG prefix=/usr
|
2011-06-19 06:39:37 +02:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Compile snespurify. It helps clean up ROMS for use with bsnes.
|
2012-09-24 15:24:03 +02:00
|
|
|
cd purify
|
|
|
|
# Fix building with QT >= 4.8.0.
|
|
|
|
moc -i -Iphoenix/qt/ -o phoenix/qt/platform.moc phoenix/qt/platform.moc.hpp
|
|
|
|
|
2011-06-19 06:39:37 +02:00
|
|
|
# Fix snespurify scripts.
|
2012-09-24 15:24:03 +02:00
|
|
|
sed -e 's|link := -s|link := -s -lX11|' -i 'Makefile'
|
|
|
|
|
|
|
|
make \
|
|
|
|
compiler=gcc \
|
|
|
|
platform=x \
|
|
|
|
phoenix="$PHOENIX"
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/bin
|
|
|
|
install -m 0755 purify $PKG/usr/bin/$PRGNAM-purify
|
2011-06-19 06:39:37 +02:00
|
|
|
cd ..
|
2010-06-12 23:47:30 +02:00
|
|
|
|
2010-05-19 08:34:21 +02:00
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
2010-05-13 00:58:07 +02:00
|
|
|
|
2012-09-24 15:24:03 +02:00
|
|
|
mkdir -p $PKG/usr/share/$PRGNAM/profile
|
|
|
|
cp -R bsnes/profile/* $PKG/usr/share/$PRGNAM/profile
|
|
|
|
|
2010-05-13 00:58:07 +02:00
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|