# Maintainer: Maddie Mewmews # Contributor: hype-vhs <4498312-hypevhs@users.noreply.gitlab.com> # Contributor: Joan Bruguera Micó pkgname=cherry-doom-ris pkgname_orig=cherry-doom _pkgname_orig=cherry-doom _tardir="Cherry-Doom-$_pkgname_orig" pkgver=2.0.0 pkgrel=1 conflicts=('cherry-doom') pkgdesc="Fork of Nugget Doom with more additional features" arch=('x86_64') url="https://github.com/fabiangreffrath/woof" license=('GPL2') depends=(sdl2 sdl2_net openal libsndfile hicolor-icon-theme glibc) # FluidSynth is optional, but can not be an optdepends since it gets linked to the built executable # Required for high-quality MIDI music, you probably want it. depends+=(fluidsynth) # Ditto for libxmp with respect to optdepends. Required for tracker music, you may not want it depends+=(libxmp) optdepends=("soundfont-fluid: soundfont for MIDI playback") install=cherry-doom-ris.install makedepends=(cmake python3) url="https://github.com/xemonix0/Cherry-Doom/" #source=("$_pkgname_orig-$pkgver.tar.gz::${url}/archive/refs/tags/$pkgname_orig-$pkgver.tar.gz") source=("cherry-doom-2.0.0.tar.gz::https://github.com/xemonix0/Cherry-Doom/archive/refs/tags/cherry-doom-2.0.0.tar.gz") b2sums=('b3ba2e6b558ca3cdd9f5cf73c22bbbc438be984c580c542a7b4202969ecae321bf3be07b0393a3cc9c0a44225b8c80d3d8b80717f6831c0d774b284212764e42') _install_path="/home/ris/Games/CherryDoom" prepare() { cat << EOF > "$srcdir/cherry-doom-doom.desktop" [Desktop Entry] Type=Application Name=Charry Doom Exec=sh -c 'cd "\$(dirname "%k")" && ./cherry-doom -iwad doom/doom.wad' Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-doom2.desktop" [Desktop Entry] Type=Application Name=Charry Doom 2 Exec=sh -c 'cd "\$(dirname "%k")" && ./cherry-doom -iwad doom/doom2.wad' Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-eviternity.desktop" [Desktop Entry] Type=Application Name=Charry Doom Eviternity Exec=sh -c 'cd "\$(dirname "%k")" && ./cherry-doom -iwad doom/doom2.wad -file doom/eviternity.wad' Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-eviternity2.desktop" [Desktop Entry] Type=Application Name=Charry Doom Eviternity II Exec=sh -c 'cd "\$(dirname "%k")" && ./cherry-doom -iwad doom/doom2.wad -file doom/eviternityii.wad' Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-plutonia.desktop" [Desktop Entry] Type=Application Name=Charry Doom Plutonia Exec=sh -c 'cd "\$(dirname "%k")" && ./cherry-doom -iwad doom/doom2.wad -file doom/plutonia.wad' Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-sigil.desktop" [Desktop Entry] Type=Application Name=Charry Doom Sigil Exec=sh -c 'cd "\$(dirname "%k")" && ./cherry-doom -iwad doom/doom.wad -file doom/sigil.wad' Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-sigil2.desktop" [Desktop Entry] Type=Application Name=Charry Doom Sigil 2 Exec=sh -c 'cd "\$(dirname "%k")" && ./cherry-doom -iwad doom/doom.wad -file doom/sigil_ii.wad' Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-tnt.desktop" [Desktop Entry] Type=Application Name=Charry Doom TNT: Evilution Exec=sh -c 'cd "\$(dirname "%k")" && ./cherry-doom -iwad doom/doom2.wad -file doom/tnt.wad' Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-doom-menu.desktop" [Desktop Entry] Type=Application Name=Charry Doom Exec=${_install_path}/cherry-doom -iwad doom/doom.wad Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-doom2-menu.desktop" [Desktop Entry] Type=Application Name=Charry Doom 2 Exec=${_install_path}/cherry-doom -iwad doom/doom2.wad Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-eviternity-menu.desktop" [Desktop Entry] Type=Application Name=Charry Doom Eviternity Exec=${_install_path}/cherry-doom -iwad doom/doom2.wad -file doom/eviternity.wad Icon=cherry-doom Categories=Game; EOF cat << EOF > "$srcdir/cherry-doom-eviternity2-menu.desktop" [Desktop Entry] Type=Application Name=Charry Doom Eviternity II Exec=${_install_path}/cherry-doom -iwad doom/doom2.wad -file doom/eviternityii.wad Icon=cherry-doom Categories=Game; EOF cd "$srcdir/Cherry-Doom-cherry-doom-2.0.0" sed -i '/add_subdirectory(man)/d' CMakeLists.txt sed -i '/add_subdirectory(docs)/d' CMakeLists.txt # portable konfigurace sed -i '/char \*D_DoomPrefDir(void)/,/^}/c\ char *D_DoomPrefDir(void)\ {\ static char *dir;\ \ if (dir == NULL)\ {\ dir = D_DoomExeDir();\ M_MakeDirectory(dir);\ }\ \ return dir;\ }' src/d_main.c sed -i '/"mouse_sensitivity"/,/}/s/{5}/{42}/' src/m_config.c sed -i '/"mouse_sensitivity_y"/,/}/s/{5}/{42}/' src/m_config.c sed -i '/"mouse_sensitivity_strafe"/,/}/s/{5}/{42}/' src/m_config.c sed -i '/"mouse_sensitivity_y_look"/,/}/s/{5}/{42}/' src/m_config.c sed -i '/"input_use"/,/"input_strafe"/s/INPUT_KEY,'\'' '\''/INPUT_KEY,'\''e'\''/' src/m_config.c sed -i '/"uncapped"/,/},/s/{1}/{0}/' src/m_config.c sed -i "/static void AddIWADDir/!b;n;a \ if (num_iwad_dirs == 0) {\n iwad_dirs[num_iwad_dirs++] = M_StringJoin(D_DoomExeDir(), DIR_SEPARATOR_S, \"doom\", NULL);\n iwad_dirs[num_iwad_dirs++] = D_DoomExeDir();\n }" src/d_iwad.c sed -i '/io.github.xemonix0.Cherry-Doom.desktop/d' src/CMakeLists.txt } build() { # Use `-ffile-prefix-map` to avoid 'WARNING: Package contains reference to $srcdir' due to assert(...) cmake -B build -S "Cherry-Doom-cherry-doom-2.0.0" \ -DCMAKE_BUILD_TYPE='None' \ -DCMAKE_INSTALL_PREFIX="$_install_path" \ -DCMAKE_INSTALL_BINDIR="." \ -DCMAKE_C_FLAGS="$CFLAGS -ffile-prefix-map=$PWD=" \ -Wno-dev cmake --build build } check() { cd build ctest --output-on-failure } package() { local cil="$pkgdir${_install_path}" local icondir="$pkgdir/home/ris/.local/share/icons/hicolor" mkdir -p "$cil" mkdir -p "$icondir"/{16x16,24x24,32x32}/apps chmod 755 "$pkgdir/home" chmod 700 "$pkgdir/home/ris" DESTDIR="$pkgdir" cmake --install build cp "$srcdir/Cherry-Doom-cherry-doom-2.0.0/data/cherry-doom.png" "$pkgdir$_install_path/" magick "$pkgdir$_install_path/cherry-doom.png" -resize 16x16 "$icondir/16x16/apps/cherry-doom.png" magick "$pkgdir$_install_path/cherry-doom.png" -resize 24x24 "$icondir/24x24/apps/cherry-doom.png" cp -a "$srcdir/build/src/cherry-doom" "$pkgdir$_install_path/" cp -a "$srcdir/cherry-doom-doom.desktop" \ "$srcdir/cherry-doom-doom2.desktop" \ "$srcdir/cherry-doom-eviternity.desktop" \ "$srcdir/cherry-doom-eviternity2.desktop" \ "$srcdir/cherry-doom-plutonia.desktop" \ "$srcdir/cherry-doom-tnt.desktop" \ "$srcdir/cherry-doom-sigil.desktop" \ "$srcdir/cherry-doom-sigil2.desktop" \ "$pkgdir$_install_path/" mkdir -p "$pkgdir/home/ris/.local/share/applications" cp -a "$srcdir/"*-menu.desktop "$pkgdir/home/ris/.local/share/applications/" chown -R ris:ris "$pkgdir/home/ris/.local/share/applications" rm -rf "$pkgdir$_install_path/share/man" rm -rf "$pkgdir$_install_path/share/applications" rm -rf "$pkgdir$_install_path/share/metainfo" mkdir -p "$pkgdir/home/ris/Games/CherryDoom/doom" cp -a "$startdir/wad/doom.wad" "$pkgdir${_install_path}/doom/" cp -a "$startdir/wad/doom2.wad" "$pkgdir${_install_path}/doom/" cp -a "$startdir/wad/plutonia.wad" "$pkgdir${_install_path}/doom/" cp -a "$startdir/wad/tnt.wad" "$pkgdir${_install_path}/doom/" cp -a "$startdir/wad/sigil.wad" "$pkgdir${_install_path}/doom/" cp -a "$startdir/wad/sigil_ii.wad" "$pkgdir${_install_path}/doom/" cp -a "$startdir/wad/eviternity.wad" "$pkgdir${_install_path}/doom/" cp -a "$startdir/wad/eviternityii.wad" "$pkgdir${_install_path}/doom/" cp -a "$startdir/wad/"*.sh "$pkgdir$_install_path/" chown -R ris:ris "$pkgdir${_install_path}" install -Dm644 "$startdir/PKGBUILD" -t "$pkgdir/usr/share/doc/$pkgname/" install -Dm644 "$startdir/install.sh" -t "$pkgdir/usr/share/doc/$pkgname/" }