From a69e1319289a6e7640e14499beb7e8b11b783276 Mon Sep 17 00:00:00 2001 From: Jacob Sowder Date: Fri, 29 Nov 2024 13:39:13 -0500 Subject: [PATCH] Added a new package for barony to get it updated to a version compatible with humble bundle release. --- my-packages/{my-gzdoom.scm => my-games.scm} | 60 ++++++++++++++++++- .../barony-fix-default-sound-card-alsa.patch | 16 +++++ .../barony-fix-make-install-script.patch | 51 ++++++++++++++++ .../barony-fix-openal-compilation.patch | 54 +++++++++++++++++ 4 files changed, 180 insertions(+), 1 deletion(-) rename my-packages/{my-gzdoom.scm => my-games.scm} (77%) create mode 100644 my-packages/patches/barony-fix-default-sound-card-alsa.patch create mode 100644 my-packages/patches/barony-fix-make-install-script.patch create mode 100644 my-packages/patches/barony-fix-openal-compilation.patch diff --git a/my-packages/my-gzdoom.scm b/my-packages/my-games.scm similarity index 77% rename from my-packages/my-gzdoom.scm rename to my-packages/my-games.scm index 471ecfd..6f15c18 100644 --- a/my-packages/my-gzdoom.scm +++ b/my-packages/my-games.scm @@ -1,4 +1,4 @@ -(define-module (my-packages my-gzdoom) +(define-module (my-packages my-games) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix git-download) @@ -16,6 +16,9 @@ #:use-module (gnu packages pkg-config) #:use-module (gnu packages glib) #:use-module (gnu packages linux) + #:use-module (gnu packages xiph) + #:use-module (gnu packages game-development) + #:use-module (gnu packages web) #:use-module (gnu packages video)) (define-public zmusic @@ -186,3 +189,58 @@ strife, chex quest, and fan-created games like harmony, hacx and freedoom.") (license:non-copyleft ; modified dumb "file://dumb/licence.txt" "dumb license, explicitly gpl compatible."))))) + +(define-public my-barony + (package + (name "barony") + (version "open-al-refresh") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/damiencarol/Barony.git") + (commit "feb4ef9a969a3e788b0805841e4014945760bd93"))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0arfx7f2rfgc68ph4sq99hjrjjqsxiq6s4ppv0swyaqhqm0g2hrz")) + ;; Fix textures for SDL 2.0.14. + ;; See . + (patches (search-patches "barony-fix-make-install-script.patch")))) + (build-system cmake-build-system) + (arguments + '(#:configure-flags + (list "-DOPENAL_ENABLED=1" + "-DFMOD_ENABLED=OFF" ; enable sound + "-DEDITOR_EXE_NAME=barony-editor") ; instead of generic "editor" + #:tests? #f ; there are no tests + #:phases + (modify-phases %standard-phases + (add-before 'configure 'fix-installation + (lambda _ + (substitute* "CMakeLists.txt" + (("\\$\\{CMAKE_SOURCE_DIR\\}/books") + "${CMAKE_CURRENT_BINARY_DIR}/books"))))))) + (inputs + (list glu + libpng + libvorbis + openal + physfs + rapidjson + sdl2 + sdl2-image + sdl2-net + sdl2-ttf + zlib)) + (native-inputs + (list pkg-config)) + (home-page "https://baronygame.com") + (synopsis "3D first-person roguelike game") + (description + "Barony is a first-person roguelike role-playing game with cooperative +play. The player must descend a dark dungeon and destroy an undead lich while +avoiding traps and fighting monsters. The game features randomly generated +dungeons, 13 character classes, hundreds of items and artifacts, and +cooperative multiplayer for up to four players. This package does @emph{not} +provide the game assets.") + (license license:bsd-2))) diff --git a/my-packages/patches/barony-fix-default-sound-card-alsa.patch b/my-packages/patches/barony-fix-default-sound-card-alsa.patch new file mode 100644 index 0000000..4ba97c7 --- /dev/null +++ b/my-packages/patches/barony-fix-default-sound-card-alsa.patch @@ -0,0 +1,16 @@ +diff --git a/src/engine/audio/sound.cpp b/src/engine/audio/sound.cpp +index 08940669..cd2d73ef 100644 +--- a/src/engine/audio/sound.cpp ++++ b/src/engine/audio/sound.cpp +@@ -573,7 +573,10 @@ int initOPENAL() + + printlog("[OpenAL]: initializing...\n"); + printlog("[OpenAL]: opening device...\n"); +- openal_device = alcOpenDevice(NULL); // preferred device ++ const char * defname = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); ++ ++ openal_device = alcOpenDevice(defname); ++ + if(!openal_device) + return 0; + diff --git a/my-packages/patches/barony-fix-make-install-script.patch b/my-packages/patches/barony-fix-make-install-script.patch new file mode 100644 index 0000000..c5f6ae9 --- /dev/null +++ b/my-packages/patches/barony-fix-make-install-script.patch @@ -0,0 +1,51 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0d42d04a..241d7f6f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -750,28 +750,41 @@ if (NOT APPLE AND UNIX) + ) + endif() + +- install(DIRECTORY ++ ++ if (EXISTS books) ++ ++ install(DIRECTORY + ${CMAKE_SOURCE_DIR}/books + ${CMAKE_SOURCE_DIR}/data + ${CMAKE_SOURCE_DIR}/fonts + ${CMAKE_SOURCE_DIR}/images + ${CMAKE_SOURCE_DIR}/items +- ${CMAKE_SOURCE_DIR}/lang + ${CMAKE_SOURCE_DIR}/maps + ${CMAKE_SOURCE_DIR}/models + ${CMAKE_SOURCE_DIR}/music + ${CMAKE_SOURCE_DIR}/sound + DESTINATION "${CMAKE_INSTALL_PREFIX}" +- ) ++ ) + +- install(FILES ++ install(FILES + ${CMAKE_SOURCE_DIR}/steam_appid.txt ++ DESTINATION "${CMAKE_INSTALL_PREFIX}" ++ ) ++ endif() ++ ++ install(DIRECTORY ++ ${CMAKE_SOURCE_DIR}/lang ++ DESTINATION "${CMAKE_INSTALL_PREFIX}" ++ ) ++ ++ install(FILES + ${CMAKE_SOURCE_DIR}/gamecontrollerdb.txt + ${CMAKE_SOURCE_DIR}/playernames-female.txt + ${CMAKE_SOURCE_DIR}/playernames-male.txt + #TYPE INCLUDE # If your CMAKE is stupid like mine and it complains about "install FILES given no DESTINATION!", you can tell it to shove it by uncommenting this line. + DESTINATION "${CMAKE_INSTALL_PREFIX}" +- ) ++ ) ++ + endif() + # 2) Windows install targets + if (WIN32) diff --git a/my-packages/patches/barony-fix-openal-compilation.patch b/my-packages/patches/barony-fix-openal-compilation.patch new file mode 100644 index 0000000..43f6739 --- /dev/null +++ b/my-packages/patches/barony-fix-openal-compilation.patch @@ -0,0 +1,54 @@ +From 08db4d976439fa66b1ac059359aa9424243a25bc Mon Sep 17 00:00:00 2001 +From: guilhermeivo +Date: Wed, 20 Nov 2024 01:31:17 -0300 +Subject: [PATCH] Fix incorrect uses of `ifdef` for `USE_FMOD` [#691] + +--- + src/ui/MainMenu.cpp | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/ui/MainMenu.cpp b/src/ui/MainMenu.cpp +index 54e19cd6..d6ffed3d 100644 +--- a/src/ui/MainMenu.cpp ++++ b/src/ui/MainMenu.cpp +@@ -2869,6 +2869,7 @@ namespace MainMenu { + } else { + fpsLimit = std::min(std::max(MIN_FPS, *cvar_desiredFps), MAX_FPS); + } ++ #if defined(USE_FMOD) + current_audio_device = audio_device; + if (fmod_speakermode != speaker_mode) { + fmod_speakermode = (FMOD_SPEAKERMODE)speaker_mode; +@@ -2876,6 +2877,7 @@ namespace MainMenu { + restartPromptRequired = true; + } + } ++ #endif + MainMenu::master_volume = std::min(std::max(0.f, master_volume / 100.f), 1.f); + sfxvolume = std::min(std::max(0.f, gameplay_volume / 100.f), 1.f); + sfxAmbientVolume = std::min(std::max(0.f, ambient_volume / 100.f), 1.f); +@@ -2974,7 +2976,9 @@ namespace MainMenu { + settings.fov = ::fov; + settings.fps = *cvar_desiredFps; + settings.audio_device = current_audio_device; ++ #if defined(USE_FMOD) + settings.speaker_mode = (int)fmod_speakermode; ++ #endif + settings.master_volume = MainMenu::master_volume * 100.f; + settings.gameplay_volume = (float)sfxvolume * 100.f; + settings.ambient_volume = (float)sfxAmbientVolume * 100.f; +@@ -6357,9 +6361,10 @@ bind_failed: + } + int y = 0; + ++int num_drivers = 0; + #if !defined(NINTENDO) && defined(USE_FMOD) + int selected_device = 0; +- int num_drivers = 0; ++ num_drivers = 0; + (void)fmod_system->getNumDrivers(&num_drivers); + audio_drivers.clear(); + audio_drivers.reserve(num_drivers); +-- +2.46.0 +