mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-26 22:06:35 +01:00
9841a26573
Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
220 lines
6.7 KiB
Bash
220 lines
6.7 KiB
Bash
#!/bin/bash
|
|
# Slackware build script for blupimania
|
|
#
|
|
# Yth | Pont-en-Royans, France | yth@ythogtha.org
|
|
#
|
|
# 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=blupimania
|
|
VERSION=${VERSION:-1.6.2}
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-_SBo}
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
|
BINDIR=/usr/games
|
|
SDL2_IMAGE_VERSION=2.6.3
|
|
SDL2_MIXER_VERSION=2.6.3
|
|
|
|
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}
|
|
|
|
DOCS="README.md LICENSE"
|
|
|
|
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-$VERSION
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
|
cd $PRGNAM-$VERSION
|
|
tar xvf $CWD/SDL_image-release-${SDL2_IMAGE_VERSION}.tar.gz
|
|
tar xvf $CWD/SDL_mixer-release-${SDL2_MIXER_VERSION}.tar.gz
|
|
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 {} \;
|
|
sed -i 's#/lib/#/lib64/#g;s#NO_DEFAULT_PATH##g' CMakeLists.txt
|
|
sed -i 's#<SDL2/SDL_image.h>#"SDL_image.h"#' src/blupimania.h
|
|
sed -i 's#<SDL2/SDL_image.h>#"SDL_image.h"#' src/sdl/SDL3_IMG_webp.c src/sdl/SDL3_IMG.h src/blupimania.h
|
|
sed -i 's#<SDL2/SDL_mixer.h>#"SDL_mixer.h"#' src/smaky.c src/play.c
|
|
WORKDIR=$(pwd)
|
|
|
|
## slackware's SDL2_image and SDL2_mixer are outdated, using more recent ones
|
|
mkdir -p build $PKG/usr/share/blupimania \
|
|
SDL_image-release-${SDL2_IMAGE_VERSION}/build \
|
|
SDL_mixer-release-${SDL2_MIXER_VERSION}/build
|
|
# SDL2_image
|
|
pushd SDL_image-release-${SDL2_IMAGE_VERSION}
|
|
./configure \
|
|
--prefix=/install \
|
|
--libdir=/install/lib$LIBDIRSUFFIX \
|
|
--enable-shared \
|
|
--disable-static \
|
|
--disable-sdltest \
|
|
--disable-bmp \
|
|
--disable-gif \
|
|
--disable-jpg \
|
|
--disable-jpg-shared \
|
|
--disable-lbm \
|
|
--disable-pcx \
|
|
--enable-png \
|
|
--disable-png-shared \
|
|
--disable-pnm \
|
|
--disable-tga \
|
|
--disable-tif \
|
|
--disable-tif-shared \
|
|
--disable-xcf \
|
|
--disable-xpm \
|
|
--disable-xv \
|
|
--enable-webp \
|
|
--enable-webp-shared
|
|
# ./configure --enable-webp --disable-webp-shared
|
|
# cd build
|
|
# cmake \
|
|
# -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
|
# -DCMAKE_INSTALL_PREFIX=/install \
|
|
# -DCMAKE_INSTALL_LIBDIR=lib$LIBDIRSUFFIX \
|
|
# -DCMAKE_BUILD_TYPE=Release ..
|
|
make
|
|
make install DESTDIR=$WORKDIR
|
|
popd
|
|
# SDL2_mixer
|
|
pushd SDL_mixer-release-${SDL2_MIXER_VERSION}
|
|
./configure \
|
|
--prefix=/install \
|
|
--libdir=/install/lib$LIBDIRSUFFIX \
|
|
--enable-shared \
|
|
--disable-static \
|
|
--disable-sdltest \
|
|
--disable-music-cmd \
|
|
--enable-music-wave \
|
|
--disable-music-mod \
|
|
--disable-music-mod-modplug \
|
|
--disable-music-mod-modplug-shared \
|
|
--disable-music-mod-mikmod \
|
|
--disable-music-mod-mikmod-shared \
|
|
--enable-music-midi \
|
|
--enable-music-midi-timidity \
|
|
--enable-music-midi-native \
|
|
--disable-music-midi-fluidsynth \
|
|
--disable-music-midi-fluidsynth-shared \
|
|
--enable-music-ogg \
|
|
--disable-music-ogg-tremor \
|
|
--disable-music-ogg-shared \
|
|
--disable-music-flac \
|
|
--disable-music-flac-shared \
|
|
--disable-music-mp3 \
|
|
--disable-music-mp3-smpeg \
|
|
--disable-music-mp3-smpeg-shared \
|
|
--disable-smpegtest \
|
|
--disable-music-mp3-mad-gpl
|
|
# cmake \
|
|
# -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
|
# -DCMAKE_INSTALL_PREFIX=/install \
|
|
# -DCMAKE_INSTALL_LIBDIR=lib$LIBDIRSUFFIX \
|
|
# -DCMAKE_BUILD_TYPE=Release ..
|
|
make
|
|
make install DESTDIR=$WORKDIR
|
|
popd
|
|
## End of SDL2 block
|
|
|
|
BMDIR=$PKG/usr/share/blupimania
|
|
cp $WORKDIR/install/lib$LIBDIRSUFFIX/*.so* $BMDIR
|
|
# blupimania expects to find its files in (binary path)/../share/blupimania
|
|
# Hence we are installing blupimania binary in /usr/libexec
|
|
# and a shell wrapper in /usr/games.
|
|
BINDIR=/usr/libexec
|
|
mkdir -p $PKG/usr/games
|
|
cat <<EOF > $PKG/usr/games/blupimania
|
|
#!/bin/bash
|
|
export LD_LIBRARY_PATH=/usr/share/blupimania:\$LD_LIBRARY_PATH
|
|
exec "$BINDIR/blupimania" "\$@"
|
|
EOF
|
|
chmod 755 $PKG/usr/games/blupimania
|
|
|
|
export SDL2_image_DIR=$WORKDIR/install/lib$LIBDIRSUFFIX/cmake/SDL2_image
|
|
export SDL2_mixer_DIR=$WORKDIR/install/lib$LIBDIRSUFFIX/cmake/SDL2_mixer
|
|
SLKCFLAGS="${SLKCFLAGS} -L$BMDIR -iquote${WORKDIR}/install/include/SDL2"
|
|
export CMAKE_INSTALL_PREFIX=${WORKDIR}/install
|
|
mkdir -p build
|
|
cd build
|
|
cmake \
|
|
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
|
|
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DCMAKE_INSTALL_LIBDIR=lib$LIBDIRSUFFIX \
|
|
-DCMAKE_INSTALL_BINDIR:PATH=$BINDIR \
|
|
-DSTATIC_BUILD=OFF \
|
|
-DBUILD_LINUX=ON \
|
|
-Wno-dev \
|
|
-DCMAKE_BUILD_TYPE=Release ..
|
|
sed -i 's#-L/usr/lib#-L'$BMDIR'#g;s#-Wl,-rpath,/usr/lib#-Wl,-rpath,'$BMDIR'#g;s#-lSDL2#-lSDL2 -lSDL2_image -lSDL2_mixer -lwebp -lwebpdemux -lmodplug#g' CMakeFiles/blupimania.dir/link.txt
|
|
make
|
|
make install DESTDIR=$PKG
|
|
cd ..
|
|
|
|
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
|
|
mv $PKG/usr/share/doc/$PRGNAM/* $PKG/usr/doc/$PRGNAM-$VERSION
|
|
rm -rf $PKG/usr/share/doc
|
|
cp -a $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
|