From c19cd9f9470a8d60f8c1f8e0ff26b9cdb0e083ad Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 2 Feb 2023 17:50:03 -0500 Subject: gnu: Add wasm4. * gnu/packages/emulators.scm (wasm4): New variable. --- gnu/packages/emulators.scm | 54 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm index 7c04465526..47cb175d81 100644 --- a/gnu/packages/emulators.scm +++ b/gnu/packages/emulators.scm @@ -3,7 +3,7 @@ ;;; Copyright © 2015 Paul van der Walt ;;; Copyright © 2015, 2016, 2021 Sou Bunnbu ;;; Copyright © 2015, 2016 Taylan Ulrich Bayırlı/Kammer -;;; Copyright © 2015, 2018 David Thompson +;;; Copyright © 2015, 2018, 2023 David Thompson ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis ;;; Copyright © 2016, 2017, 2018, 2020 Efraim Flashner ;;; Copyright © 2017-2023 Nicolas Goaziou @@ -74,6 +74,7 @@ #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) + #:use-module (gnu packages graphics) #:use-module (gnu packages gtk) #:use-module (gnu packages image) #:use-module (gnu packages libedit) @@ -1506,6 +1507,57 @@ reference frontend for the libretro API, currently used by most as a modular multi-system game/emulator system.") (license license:gpl3+))) +(define-public wasm4 + (package + (name "wasm4") + (version "2.5.4") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/aduros/wasm4") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0ycnznwy4i4fw6l507y5xm986rxqvnpl971725q8xinsnq2swpnl")))) + (build-system cmake-build-system) + (arguments + (list + #:tests? #f ; no check target + #:configure-flags + #~(list (string-append "-DCMAKE_C_FLAGS=" + "-I" #$minifb "/include " + "-I" #$wasm3 "/include")) + #:phases + '(modify-phases %standard-phases + ;; WASM4's source is a combination of multiple runtimes. We want to + ;; build the native one. + (add-after 'unpack 'chdir-to-native-runtime + (lambda _ + (chdir "runtimes/native"))) + ;; WASM4 uses git submodules to bundle several dependencies, which we + ;; have instead made dedicated packages for. This phase hacks the + ;; build system to use our own stuff. + (add-after 'chdir-to-native-runtime 'unbundle + (lambda _ + (substitute* "CMakeLists.txt" + ;; These directories do not exist because we aren't pulling in + ;; submodules. + (("add_subdirectory\\(vendor/minifb\\)") "") + (("add_subdirectory\\(vendor/cubeb\\)") "") + ;; Add additional libraries needed to successfully link the + ;; wasm4 executable using the unbundled dependencies. + (("target_link_libraries\\(wasm4 minifb cubeb\\)") + "target_link_libraries(wasm4 m GL X11 xkbcommon minifb cubeb m3)"))))))) + (inputs (list cubeb minifb wasm3)) + (synopsis "WebAssembly fantasy console") + (description "WASM-4 is a low-level fantasy game console for building +small games with WebAssembly. Game cartridges (ROMs) are small, +self-contained .wasm files that can be built with any programming language +that compiles to WebAssembly.") + (home-page "https://wasm4.org") + (license license:isc))) + (define-public scummvm (package (name "scummvm") -- cgit 1.4.1