slackbuilds_ponce/games/mupen64plus-nightly/mupen64plus-nightly.SlackBuild
Steven Voges 53011247fb games/mupen64plus-nightly: Added (N64 emulator).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2023-09-02 17:48:18 +07:00

162 lines
5.6 KiB
Bash

#!/bin/bash
# Slackware build script for mupen64plus-nightly
# Copyright 2023 Steven Voges <Oregon, US>
# Copyright 2021 Matt Dinslage, Springfield MO
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=mupen64plus-nightly
SRCNAM=mupen64plus
VERSION=${VERSION:-20230820_7d02ab9}
AUDIOSDL=${AUDIOSDL:-cec70e42b4535ce5bd1be24e7d816c54b3e75673}
CORE=${CORE:-7d02ab97bd13be9b1b58ee11a1d3df6919d89f17}
INPUTSDL=${INPUTSDL:-b175a41675ba39ac3ce6f152355dca92d9d32207}
ROM=${ROM:-abd5b15498eb86101c2a56eb49460a264365b3ba}
RSPHLE=${RSPHLE:-f22dc143771f1a0784c7d62977722a68fa0bdf85}
UICONSOLE=${UICONSOLE:-335e826aead146bd6a47d557d78b746e77f337c8}
VIDEOGLIDE64MK2=${VIDEOGLIDE64MK2:-d900f2191575e01eb846a1009be71cbc1b413dba}
VIDEORICE=${VIDEORICE:-470865c6c64bdb44645faa88eae59cd87ce561b6}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
M64PCOMPONENTS="core rom ui-console audio-sdl input-sdl rsp-hle video-glide64mk2 video-rice"
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf ${SRCNAM}-$VERSION
mkdir -p ${SRCNAM}-$VERSION
cd ${SRCNAM}-$VERSION
for COMPONENT in $M64PCOMPONENTS; do
mkdir -p ${SRCNAM}-$COMPONENT
done
tar xvf $CWD/${SRCNAM}-audio-sdl-$AUDIOSDL.tar.gz -C \
${SRCNAM}-audio-sdl --strip-components 1
tar xvf $CWD/${SRCNAM}-core-$CORE.tar.gz -C \
${SRCNAM}-core --strip-components 1
tar xvf $CWD/${SRCNAM}-input-sdl-$INPUTSDL.tar.gz -C \
${SRCNAM}-input-sdl --strip-components 1
tar xvf $CWD/${SRCNAM}-rom-$ROM.tar.gz -C \
${SRCNAM}-rom --strip-components 1
tar xvf $CWD/${SRCNAM}-rsp-hle-$RSPHLE.tar.gz -C \
${SRCNAM}-rsp-hle --strip-components 1
tar xvf $CWD/${SRCNAM}-ui-console-$UICONSOLE.tar.gz -C \
${SRCNAM}-ui-console --strip-components 1
tar xvf $CWD/${SRCNAM}-video-glide64mk2-$VIDEOGLIDE64MK2.tar.gz -C \
${SRCNAM}-video-glide64mk2 --strip-components 1
tar xvf $CWD/${SRCNAM}-video-rice-$VIDEORICE.tar.gz -C \
${SRCNAM}-video-rice --strip-components 1
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
for COMPONENT in $M64PCOMPONENTS; do
if [ $COMPONENT = "core" ]; then
COMPONENTTYPE="library"
elif [ $COMPONENT = "rom" ]; then
echo "-------- Building test ROM --------"
mkdir -p $PKG/usr/share/$SRCNAM
cp mupen64plus-rom/m64p_test_rom.v64 $PKG/usr/share/$SRCNAM
continue
elif [ $COMPONENT = "ui-console" ]; then
COMPONENTTYPE="front-end"
else
COMPONENTTYPE="plugin"
fi
echo "-------- Building $COMPONENT $COMPONENTTYPE --------"
make -C ${SRCNAM}-$COMPONENT/projects/unix clean $@
make -C ${SRCNAM}-$COMPONENT/projects/unix all $@
echo "-------- Installing $COMPONENT $COMPONENTTYPE --------"
make -C ${SRCNAM}-$COMPONENT/projects/unix install $@ \
PLUGINDIR=lib$LIBDIRSUFFIX/$SRCNAM \
SHAREDIR=share/$SRCNAM \
BINDIR=bin \
MANDIR=man \
LIBDIR=lib$LIBDIRSUFFIX \
APPSDIR=share/applications \
ICONSDIR=share/icons/hicolor \
INCDIR=include/$SRCNAM \
LDCONFIG=true \
DESTDIR=$PKG/usr/
done
chmod +x $PKG/usr/lib$LIBDIRSUFFIX/lib${SRCNAM}.so.*
chmod +x $PKG/usr/lib$LIBDIRSUFFIX/$SRCNAM/${SRCNAM}-*.so
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
for COMPONENT in $M64PCOMPONENTS; do
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/$SRCNAM-$COMPONENT
cp -a $SRCNAM-$COMPONENT/{AUTHORS,COPYING,CREDITS,LICENSES,README,README.md,RELEASE,doc,gpl-license,todo!.txt} \
$PKG/usr/doc/$PRGNAM-$VERSION/$SRCNAM-$COMPONENT 2>/dev/null || :
done
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