# vim: syn=sh ft=sh et sw=2 sts=2 ts=2 tw=0: #Packager: Cyrille Pontvieux pkgname=stepmania pkgver=5.beta2a pkgrel=1cp source=(https://github.com/$pkgname/$pkgname/archive/SM$(echo $pkgver|sed -r 's/^(.)\.(.*)/\1-\2/').tar.gz) sourcetemplate=http://people.salixos.org/jrd/salix/$pkgname/$pkgver-\$arch-$pkgrel/ docs=("README.Salix") url=http://stepmania.com slackdesc=\ ( #|-----handy-ruler------------------------------------------------------| "$pkgname (Danse and Rythm game)" "StepMania is a free dance and rhythm game." "It features 3D graphics, keyboard and dance pad support, and an editor" "for creating your own steps." ) build() { set -e cd $SRC/$pkgname-SM$(echo $pkgver|sed -r 's/^(.)\.(.*)/\1-\2/') # Patch ArchHooks_Unix.cpp to specify correct locations for data, config and cache files xdgdir=$pkgname-$(echo $pkgver|sed -r 's/^(.)\..*/\1/') sed -ri ' /^\tRString sUserDataPath/ { s@^\tRString sUserDataPath.*@\tRString sUserDataPath = ssprintf("%s/.local/share/'$xdgdir'", szHome?szHome:".");@; a \ \tRString sUserCachePath = ssprintf("%s/.cache/'$xdgdir'", szHome?szHome:"."); \ \tRString sUserConfigPath = ssprintf("%s/.config/'$xdgdir'", szHome?szHome:"."); }; \@"/Cache"@s@sUserDataPath \+ "/Cache"@sUserCachePath@; \@"/Save"@s@sUserDataPath \+ "/Save"@sUserConfigPath@; ' src/arch/ArchHooks/ArchHooks_Unix.cpp ./autogen.sh ./configure \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --localstatedir=/var \ --sysconfdir=/etc \ --enable-lua-binaries \ --with-fast-compile \ --with-sse2 \ --build=$arch-slackware-linux # lua build requires ncurses that 'configure' didn't put in the Makefile for m in Makefile src/Makefile; do sed -ri 's/^LIBS = (.*)/LIBS = \1 -lncurses/' $m done # DESTDIR not used in Makefile, so it should be added sed -i ' /^install-exec-hook/ { n; s,\$(prefix)/\$(productID),$(DESTDIR)/$(libexecdir)/stepmania,; n; s,\$(prefix)/\$(productID),$(DESTDIR)/$(libexecdir)/stepmania,; }; /^install-data-local/ { a \ \tmkdir -p $(DESTDIR)/$(datadir)/stepmania n; s,\$(prefix)/\$(productID),$(DESTDIR)/$(datadir)/stepmania,; n; s,\$(prefix)/\$(productID),$(DESTDIR)/$(datadir)/stepmania,; }; ' Makefile make -j $numjobs make install DESTDIR=$PKG mkdir -p $PKG/usr/bin cat <<'EOF' > $PKG/usr/bin/$pkgname #!/bin/sh cd /usr/libexec/stepmania && exec ./stepmania "$@" EOF cat < $PKG/usr/bin/smzip-installer #!/bin/sh if [ -z "\$1" ]; then echo "Install a smzip package for Stepmania." >&2 echo "Usage: smzip package.smzip" >&2 exit 1 fi if ! [ -r "\$1" ] || ! echo "\$1"|grep -q '\.smzip\$' || ! file "\$1"|grep -q 'Zip archive data'; then notify-send -i error "Stepmania Smzip installer" "\$1 is not a smzip readable file" exit 1 fi PKG=\$(readlink -f "\$1") NAME=\$(basename "\$PKG") mkdir -p ~/.local/share/$xdgdir/Packages cp "$PKG" ~/.local/share/$xdgdir/Packages/ \ && notify-send -i $pkgname-ssc "Stepmania Smzip installer" "\$NAME installed" \ || (notify-send -i error "Stepmania Smzip installer" "\$NAME failed"; exit 1) EOF chmod +x $PKG/usr/bin/* # documentation mkdir -p $PKG/usr/doc/$pkgname-$pkgver cat < $SRC/README.Salix You can install your custom songs in ~/.local/share/$xdgdir/Songs/ All others data files are in ~/.local/share/$xdgdir/ Your configuration can be found in ~/.config/$xdgdir/ Your cache files can be found in ~/.cache/$xdgdir/ A smzip-installer binary is provided to you to easy install .smzip files. Just pass it as argument or open your smzip with smzip-installer in your file manager. /!\ Don't try to associate .smzip file with smzip-installer, as there are just regular zip files, --- and so all your .zip file will further open with smzip-installer. I bet that's not what your want. EOF mv $PKG/usr/share/stepmania/Docs/* $PKG/usr/doc/$pkgname-$pkgver/ cp -r Manual $PKG/usr/doc/$pkgname-$pkgver/ # Delete windows stuff rm -rf $PKG/usr/share/stepmania/Themes/_Installer # NSIS stuff rm -rf $PKG/usr/doc/$pkgname-$pkgver/WindowsNotes.txt # XDG Desktop stuff mkdir -p $PKG/etc/xdg/menus/applications-merged $PKG/usr/share/desktop-directories $PKG/usr/share/applications for i in $(find icons -name 'stepmania-ssc.*'); do mv "$i" $(echo "$i"|sed 's/-ssc//') done cp -r icons $PKG/usr/share/ ( cd $PKG/usr/doc/$pkgname-$pkgver/Luadoc for s in 16 32 48 64 128; do mkdir -p $PKG/usr/share/icons/hicolor/${s}x${s}/apps n=$(identify favicon.ico|sed -rn "/${s}x${s}.*32-bit/s/.*\[(.)+\].*/\1/p"); convert favicon.ico[$n] $PKG/usr/share/icons/hicolor/${s}x${s}/apps/stepmania-lua.png done xsltproc Lua.xml > Lua.html ) cat <<'EOF' > $PKG/etc/xdg/menus/applications-merged/stepmania.menu Games Stepmania stepmania.directory X-Stepmania EOF cat <<'EOF' > $PKG/usr/share/desktop-directories/stepmania.directory [Desktop Entry] Version=1.0 Type=Directory Icon=stepmania Name=Stepmania EOF sed -r 's/-ssc//; s/^Categories=.*/Categories=Application;X-Stepmania/' $pkgname.desktop > $PKG/usr/share/applications/$pkgname.desktop cat < $PKG/usr/share/applications/$pkgname-firstuse.desktop [Desktop Entry] Version=1.0 Type=Application Encoding=UTF-8 Name=First Use Icon=text-x-readme Exec=xdg-open /usr/doc/$pkgname-$pkgver/Userdocs/sm5_beginner.txt Categories=Application;X-Stepmania EOF cat < $PKG/usr/share/applications/$pkgname-manual.desktop [Desktop Entry] Version=1.0 Type=Application Encoding=UTF-8 Name=Manual Icon=text-html Exec=xdg-open /usr/doc/$pkgname-$pkgver/Manual/index.html Categories=Application;X-Stepmania EOF cat < $PKG/usr/share/applications/$pkgname-developpers.desktop [Desktop Entry] Version=1.0 Type=Application Encoding=UTF-8 Name=Developper's documentation Icon=emblem-documents Exec=xdg-open /usr/doc/$pkgname-$pkgver/Devdocs Categories=Application;X-Stepmania EOF cat < $PKG/usr/share/applications/$pkgname-lua.desktop [Desktop Entry] Version=1.0 Type=Application Encoding=UTF-8 Name=Lua documentation Icon=stepmania-lua Exec=xdg-open /usr/doc/$pkgname-$pkgver/Luadoc/Lua.html Categories=Application;X-Stepmania EOF cat < $PKG/usr/share/applications/$pkgname-simfile-formats.desktop [Desktop Entry] Version=1.0 Type=Application Encoding=UTF-8 Name=File formats documentation Icon=emblem-documents Exec=xdg-open /usr/doc/$pkgname-$pkgver/SimfileFormats Categories=Application;X-Stepmania EOF cat < $PKG/usr/share/applications/$pkgname-themer.desktop [Desktop Entry] Version=1.0 Type=Application Encoding=UTF-8 Name=Theme documentation Icon=emblem-documents Exec=xdg-open /usr/doc/$pkgname-$pkgver/Themerdocs Categories=Application;X-Stepmania EOF # Correct permissions # 'games' group can modify the contents of /usr/share/stepmania/* # Users should still modify Stepmania using their own ~/.local/share/stepmania-5 directory chown -R root:games $PKG/usr/share/stepmania/* chmod -R ug=rwX,o=rX $PKG/usr/share/stepmania/* chown -R root: $PKG/usr/doc/$pkgname-$pkgver/* chmod -R u=rwX,go=rX $PKG/usr/doc/$pkgname-$pkgver/* chown -R root: $PKG/usr/share/icons chmod -R u=rwX,go=rX $PKG/usr/share/icons chown root: $PKG/usr/libexec/stepmania/* chmod u=rwx,go=rx $PKG/usr/libexec/stepmania/* ( cd $PKG/usr/libexec/stepmania ln -s ../../share/stepmania/* . ) set +e }