#!/bin/bash # Slackware build script for openyahtzee # Written by B. Watson (urchlay@slackware.uk) # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. # 20260731 bkw: update for v1.10. # 20211021 bkw: BUILD=2 # - actually use the WXCONFIG variable. # - new-style icons. # 20140909 bkw: if wx(Widgets|Python) 2.x and wxGTK 3.x are installed, in that # order, the symlink at /usr/bin/wx-config will point to the 3.x config script. # openyahtzee won't build against wx 3, so this script now uses the 2.x script # explicitly. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=openyahtzee VERSION=${VERSION:-1.10} 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" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" fi SLKCFLAGS+=" -DNDEBUG" set -e ULIB=/usr/lib$LIBDIRSUFFIX rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION mkdir -p $PRGNAM-$VERSION cd $PRGNAM-$VERSION # 20260731 bkw: this is extra-stupid: we have a .tar.gz file that's been # compressed again with xz. The .xz file is actually *larger than* the # "compressed" .gz it contains. xzcat $CWD/$PRGNAM-$VERSION.tar.xz > $PRGNAM-$VERSION.tar.gz tar xvf $PRGNAM-$VERSION.tar.gz --strip-components=1 chown -R root:root . find . ! -type l -a \ \( -perm /111 -a ! -perm 755 -a -exec chmod -f 755 {} + \) -o \ \( ! -perm /111 -a ! -perm 644 -a -exec chmod -f 644 {} + \) sed -i 's,Exec=,&/usr/games/,' $PRGNAM.desktop # 20260731 bkw: cmake "helpfully" finds /usr/bin/wx-config, which we # can't trust (it points at whichever of wxWidgets, wxPython, wxGTK # was installed most recently). Fake up a wx-config and put it first # in $PATH. mkdir -p build cd build mkdir wxconf ln -s $ULIB/wx/config/gtk3-unicode-3.2 wxconf/wx-config export PATH="$(pwd)/wxconf:$PATH" cmake \ -DCMAKE_CXX_FLAGS_RELEASE="$SLKCFLAGS" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_MANDIR=man \ -DCMAKE_INSTALL_BINDIR=games \ -DCMAKE_BUILD_TYPE=Release .. make VERBOSE=1 make install/strip DESTDIR=$PKG cd .. gzip $PKG/usr/man/man?/* for px in 16 32 48 64 128; do size=${px}x${px} dir=$PKG/usr/share/icons/hicolor/$size/apps mkdir -p $dir convert -resize $size \ icons/$PRGNAM.png \ $PKG/usr/share/icons/hicolor/$size/apps/$PRGNAM.png done PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION mkdir -p $PKGDOC cp -a AUTHORS COPYING CHANGELOG.md README.md $PKGDOC cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$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