summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeverin Glöckner2021-09-14 01:29:41 +0200
committerSeverin Glöckner2021-09-14 01:29:41 +0200
commitd725fe036dad9387014950ba2bb86df21ca3927e (patch)
tree45a183a9ce7251581d7f915bb7d2766e6616068c
parent68995dda47d0e2d8de7aaa9f24bd797fcfdad358 (diff)
downloadaur-d725fe036dad9387014950ba2bb86df21ca3927e.tar.gz
revive freedink package
-rw-r--r--PKGBUILD197
-rw-r--r--sound.patch17
2 files changed, 163 insertions, 51 deletions
diff --git a/PKGBUILD b/PKGBUILD
index e9fa1e6e5dcd..0675b73341e8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,67 +1,162 @@
-# Maintainer: David A. Redick <david.a.redick@gmail.com>
+# Maintainer: Severin Glöckner <severin.gloeckner@stud.htwk-leipzig.de>
+# Contributor: David A. Redick <david.a.redick@gmail.com>
# Contributor: Petteri Tolonen <petteri dot tolonen at gmail dot com>
-# Most of this is ripped from the project's own .spec file.
-# See http://git.savannah.gnu.org/cgit/freedink.git/tree/freedink.spec
+# FreeDink consists of multiple parts:
+# * The engine – this is an open source reimplementation of the game Dink Smallwood.
+# * The editor – it is part of the enigne.
+# * The game data – telling the same story like the original game.
+# If you have a copy of the original game, you can also use the original files instead.
+# * The modding tool DFArc – optional.
pkgname=freedink
-pkgver=108.4
-pkgrel=3
-pkgdesc='Humorous top-down adventure and role-playing game.'
-arch=('i686' 'x86_64' 'mips64el')
-url='https://www.gnu.org/software/freedink/'
+_engine=109.6
+_data=1.08.20190120
+_dfarc=3.14
+pkgver=$_engine
+pkgrel=1
+pkgdesc='Humorous top-down adventure and role-playing game'
+arch=('i486' 'i686' 'pentium4' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
+url='https://www.gnu.org/software/freedink'
license=('GPL3')
+depends=('sdl2_image' 'sdl2_mixer' 'sdl2_ttf' 'sdl2_gfx' 'fontconfig' # For the game.
+ 'wxgtk3' # For DFArc.
+ 'fluidsynth' # Current solution to play midi files.
+ 'soundfont-fluid' # Arbitrary choosen, but hardcoded, soundfont to play midi files.
+ #'timidity++'
+ )
+makedepends=('help2man' 'rsync' 'cxxtest' 'glm')
-depends=(
- 'freedink-data'
- 'libzip'
- 'bzip2'
- 'zlib'
- 'fontconfig'
- 'freetype2'
- 'sdl_image'
- 'sdl_mixer'
- 'sdl_ttf'
- 'sdl_gfx'
- 'sdl'
- 'expat'
- 'libutil-linux'
- 'libpng'
- 'harfbuzz'
- 'glib2'
- 'graphite'
- 'pcre'
-)
-
-makedepends=('automake' 'autoconf' 'check' 'help2man' 'make')
-
-# Although listed in documents; I don't see a way to enable this.
-#optdepends=('timidity++: MIDI-music support')
-optdepends=()
-
-source=("ftp://ftp.gnu.org/gnu/freedink/${pkgname}-${pkgver}.tar.gz")
-md5sums=('4caccc9235ef68b66bdf4b9174f0af81')
-sha256sums=('82cfb2e019e78b6849395dc4750662b67087d14f406d004f6d9e39e96a0c8521')
-sha512sums=('1496b6a7826bf694a2919add22a8b4b08a4967d8a7fdebf2d599bd99c7a7ce67de6c2b11124423c7aa1f0feb2e7c03ce1cf00252070182936e7481791dafee61')
+# For the game to play midi files, one needs to install either timidity++ or fluidsynth and a soundfont.
+
+# In case of timidity
+# - install timidity++
+# - install a soundfont
+# - configure /etc/timidity/timidity.cfg
+
+# Using fluidsynth (current solution):
+# - install fluidsynth
+# - install a soundfont
+# - set environment variable SDL_SOUNDFONTS
+# Examples:
+# SDL_SOUNDFONTS=/usr/share/soundfonts/FluidR3_GM.sf2
+# SDL_SOUNDFONTS=/usr/share/soundfonts/FluidR3_GM.sf2:/usr/share/soundfonts/FluidR3_GS.sf2
+# (This is done by the sound.patch)
+
+# Using timidity is a better solution, because
+# - one of the files cannot be played with fluidsynth.
+# - sound is played quieter with fluidsynth.
+#
+# Debian Buster uses timidity, but the configuration differs a lot.
+# The way it's explained in the Arch wiki and example config works for
+# using timidity standalone, but not for freedink.
+
+# To build the latest git version of the freedink engine, use this as source:
+# "git://git.sv.gnu.org/freedink"
+source=(https://ftp.gnu.org/gnu/freedink/freedink-${_engine}.tar.gz
+ https://sources.debian.org/data/main/f/freedink/109.6-3/debian/patches/sdl2-2.0.10.patch
+ sound.patch
+ https://ftp.gnu.org/gnu/freedink/freedink-data-${_data}.tar.gz
+ https://ftp.gnu.org/gnu/freedink/dfarc-${_dfarc}.tar.gz
+ )
+
+sha256sums=('5e0b35ac8f46d7bb87e656efd5f9c7c2ac1a6c519a908fc5b581e52657981002'
+ '9e26cd4179fd4cb3dd5ea347e6a66f5f8b3a7a5fb574dd728592c0b52bdf5442'
+ '59cdf6e96b5ee3e8d6a44750222590be6cb013c436682dfb223367c895540ba4'
+ '715f44773b05b73a9ec9b62b0e152f3f281be1a1512fbaaa386176da94cffb9d'
+ 'a51124ecd11eeca0f1d16732ef58ee690e2fa2db06cc0ec2a5b61b41f8b0e8fa')
+
+prepare () {
+ cd "${srcdir}/freedink-${_engine}"
+
+ # Fix an otherwise breaking check
+ sed "s/AC_PREREQ(2.61)/AC_PREREQ(2.64)/" -i configure.ac
+
+ patch -p1 < ../sdl2-2.0.10.patch
+
+ # Hacking in here the sound changes.
+ patch -p0 < ../sound.patch
+
+ # Autodetect the freedink binary in the mod manager without needing symlinks.
+ # This changes the default configuration to look for a binary called freedink instead of dink.
+ sed '/^ mDinkExe/ s/"dink"/"freedink"/' -i "${srcdir}/dfarc-${_dfarc}/src/Config.cpp"
+ sed '/^ mEditorExe/ s/"dinkedit"/"freedinkedit"/' -i "${srcdir}/dfarc-${_dfarc}/src/Config.cpp"
+
+ # Creates configure script, downloads gnutool and translations.
+ ./bootstrap
+}
build () {
- cd "${srcdir}/${pkgname}-${pkgver}"
- ./configure --prefix=/usr --disable-embedded-resources
- make
+ # Build the FreeDinc game engine.
+ cd "${srcdir}/freedink-${_engine}"
+
+ ./configure --prefix=/usr
+
+ # Sometimes linking errors occur when building in parallel. Allow only 1 job.
+ make -j1
+
+ # Build the mod manager (optional).
+ cd "${srcdir}/dfarc-${_dfarc}"
+ ./configure --prefix=/usr --disable-desktopfiles --with-wx-config=/usr/bin/wx-config-gtk3
+ make
}
check () {
- cd "${srcdir}/${pkgname}-${pkgver}"
-
- # This is just a trivial check.
- make check
+ # cd "${srcdir}/freedink-${_engine}"
+ # make check
- # This for the packaging of the source code in a snap shot package
- # NOT the installed build artifacts.
- #make distcheck
+ cd "${srcdir}/dfarc-${_dfarc}"
+ make check
}
package () {
- cd "${srcdir}/${pkgname}-${pkgver}"
- make DESTDIR="${pkgdir}" install
+ # Game Engine
+ cd "${srcdir}/freedink-${_engine}"
+ make DESTDIR="${pkgdir}" install
+
+ # Game Data
+ cd "${srcdir}/freedink-data-${_data}"
+ make DESTDIR="${pkgdir}" PREFIX="/usr" install
+
+ # Mod Manager
+ cd "${srcdir}/dfarc-${_dfarc}"
+ make DESTDIR="${pkgdir}" install
+
+ # Packaging Files - use for all the same quality icons.
+ rm -r "${pkgdir}"/usr/share/pixmaps
+ rm "${pkgdir}"/usr/share/icons/hicolor/32x32/mimetypes/application-x-dmod.png
+
+ # Get the images for the launcher.
+ install -Dm644 "${srcdir}/freedink-${_engine}"/android/res/drawable-xxhdpi/ic_launcher.png \
+ "${pkgdir}"/usr/share/icons/hicolor/256x256/apps/freedink.png
+ install -Dm644 "${srcdir}/dfarc-${_dfarc}"/share/pixmaps/dfarc.png \
+ "${pkgdir}"/usr/share/icons/hicolor/32x32/apps/freedink.png
+
+ # Use symlinks for the mimetype's image.
+ mkdir -p "${pkgdir}"/usr/share/icons/hicolor/{32x32,256x256,scalable}/mimetypes/
+ ln -s ../apps/freedink.png "${pkgdir}"/usr/share/icons/hicolor/32x32/mimetypes/application-x-dmod.png
+ ln -s ../apps/freedink.png "${pkgdir}"/usr/share/icons/hicolor/256x256/mimetypes/application-x-dmod.png
+ ln -s ../apps/freedink.svg "${pkgdir}"/usr/share/icons/hicolor/scalable/mimetypes/application-x-dmod.svg
+
+ # Packaging Files - as there is just one icon, show only one launcher for all.
+ rm "${pkgdir}"/usr/share/applications/freedinkedit.desktop
+ # This desktop file is left only for the mimetype.
+ echo "NoDisplay=true" >> "${pkgdir}"/usr/share/applications/freedink-dfarc.desktop
+ sed 's/Exec=dfarc/Exec=freedink-dfarc/' -i "${pkgdir}"/usr/share/applications/freedink-dfarc.desktop
+ # The editor and mod manager can now be started by right-clicking.
+ cat >> "${pkgdir}"/usr/share/applications/freedink.desktop << EOF
+Actions=Editor;DFArc;
+
+[Desktop Action Editor]
+Name=FreeDink Editor
+Exec=freedinkedit
+
+[Desktop Action DFArc]
+Name=DFArc Mod Manager
+Exec=freedink-dfarc
+EOF
+
+ # Do not keep 2 names for the binaries, remove the symlinks.
+ rm "${pkgdir}"/usr/bin/{freedink-dfarc,dink{,edit}}
+ mv "${pkgdir}"/usr/bin/dfarc "${pkgdir}"/usr/bin/freedink-dfarc
}
diff --git a/sound.patch b/sound.patch
new file mode 100644
index 000000000000..3f8f71a8ff96
--- /dev/null
+++ b/sound.patch
@@ -0,0 +1,17 @@
+--- src/sfx.cpp
++++ src/sfx.cpp
+@@ -747,12 +747,12 @@
+
+ /* Work-around to disable fluidsynth and fallback to TiMidity++: */
+ /* TODO: allow user to set it at run-time */
+- /* SDL_setenv("SDL_SOUNDFONTS="); */
++ SDL_setenv("SDL_SOUNDFONTS", "/usr/share/soundfonts/FluidR3_GM.sf2", 0);
+ /* SDL_setenv("SDL_FORCE_SOUNDFONTS=1"); */
+
+ /* To specify an alternate timidity.cfg */
+ /* Cf. SDL2_mixer/timidity/config.h for defaults */
+- /* SDL_setenv("TIMIDITY_CFG", "somewhere/timidity.cfg", 0); */
++ SDL_setenv("TIMIDITY_CFG", "/etc/timidity/timidity.cfg", 1);
+
+ /* MIX_DEFAULT_FREQUENCY is ~22kHz are considered a good default,
+ 44kHz is considered too CPU-intensive on older computers */