slackbuilds_ponce/games/stepmania/stepmania.SlackBuild

162 lines
5.9 KiB
Text
Raw Normal View History

#!/bin/bash
# Slackware build script for stepmania
# Copyright 2023 Steven Voges <Oregon, USA>
# 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=stepmania
VERSION=${VERSION:-20221114_d55acb1}
SRCVER=${SRCVER:-d55acb1ba26f1c5b5e3048d6d6c0bd116625216f}
JACK=${JACK:-OFF}
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}
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"
elif [ "$ARCH" = "aarch64" ]; 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 $PRGNAM-$SRCVER
tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz
cd $PRGNAM-$SRCVER
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 {} \;
# Fixes for ffmpeg5
sed -i "446s/NOT YASM_FOUND/NOT WITH_SYSTEM_FFMPEG AND NOT YASM_FOUND/" StepmaniaCore.cmake
sed -i "480s/avcodec::CODEC_ID_NONE/avcodec::AV_CODEC_ID_NONE/" src/arch/MovieTexture/MovieTexture_FFMpeg.cpp
sed -i "519d;520d;521d;522d;523d;" src/arch/MovieTexture/MovieTexture_FFMpeg.cpp
sed -i "82s/avcodec::PixelFormat/avcodec::AVPixelFormat/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "109s/avcodec::PixelFormat/avcodec::AVPixelFormat/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "120s/avcodec::PIX_FMT_YUYV422,/avcodec::AV_PIX_FMT_YUYV422,/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "131s/avcodec::PIX_FMT_BGRA,/avcodec::AV_PIX_FMT_BGRA,/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "142s/avcodec::PIX_FMT_ARGB,/avcodec::AV_PIX_FMT_ARGB,/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "154s/avcodec::PIX_FMT_ABGR,/avcodec::AV_PIX_FMT_ABGR,/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "165s/avcodec::PIX_FMT_RGBA,/avcodec::AV_PIX_FMT_RGBA,/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "176s/avcodec::PIX_FMT_RGB24,/avcodec::AV_PIX_FMT_RGB24,/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "187s/avcodec::PIX_FMT_BGR24,/avcodec::AV_PIX_FMT_BGR24,/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "198s/avcodec::PIX_FMT_RGB555,/avcodec::AV_PIX_FMT_RGB555,/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "203s/avcodec::PIX_FMT_NB,/avcodec::AV_PIX_FMT_NB,/" src/arch/MovieTexture/MovieTexture_FFMpeg.h
sed -i "108i add_compile_definitions(FF_API_NEXT)" src/CMakeData-arch.cmake
sed -i "511s/avcodec::AVCodec/const avcodec::AVCodec/" src/arch/MovieTexture/MovieTexture_FFMpeg.cpp
sed -i "16i #include <libavcodec/avcodec.h>" src/arch/MovieTexture/MovieTexture_FFMpeg.h
# Fix desktop entry
sed -i "11s/Application;Game;ArcadeGame/Game;ArcadeGame/" $PRGNAM.desktop
sed -i "3d" $PRGNAM.desktop
mkdir -p build
cd build
cmake \
-Wno-dev \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_INSTALL_PREFIX=/usr/share \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DWITH_JACK=$JACK \
-DWITH_SDL=ON \
-DWITH_SYSTEM_FFMPEG=ON \
-DWITH_SYSTEM_GLEW=ON \
-DWITH_SYSTEM_JPEG=ON \
-DWITH_SYSTEM_JSONCPP=ON \
-DWITH_SYSTEM_MAD=ON \
-DWITH_SYSTEM_OGG=ON \
-DWITH_SYSTEM_PCRE=ON \
-DWITH_SYSTEM_PNG=ON \
-DWITH_SYSTEM_TOMCRYPT=ON \
-DWITH_SYSTEM_TOMMATH=ON \
-DWITH_SYSTEM_ZLIB=ON \
-DWITH_TTY=OFF \
-DCMAKE_BUILD_TYPE=Release ..
make
make install/strip DESTDIR=$PKG
cd ..
mkdir -p $PKG/usr/bin
chmod 0755 $PKG/usr/share/${PRGNAM}-5.1/GtkModule.so
for SIZE in 16 22 24 32 36 48 64 72 96 128 192 256 ; do
install -vDm0644 icons/hicolor/${SIZE}x${SIZE}/apps/${PRGNAM}-ssc.png \
$PKG/usr/share/icons/hicolor/${SIZE}x${SIZE}/apps/${PRGNAM}-ssc.png
done
install -vDm0644 icons/hicolor/scalable/apps/${PRGNAM}-ssc.svg \
$PKG/usr/share/icons/hicolor/scalable/apps/${PRGNAM}-ssc.svg
install -vDm0644 $PRGNAM.desktop $PKG/usr/share/applications/$PRGNAM.desktop
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
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
README.md Docs \
$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