diff mbox series

[bug#53704] Add Visualboyadvance-m

Message ID _jHX_rdAkHOB9IqHIQfXfggyuZwAL-8cC92ZuWnlLfjZtXdqUHY5XBLRjD32CGrxNx7uBzHJgAtN_YdHoifX1Y4Vhaayg_gWJX6wqPZDhx4=@protonmail.com
State New
Headers show
Series [bug#53704] Add Visualboyadvance-m | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Charles Feb. 1, 2022, 5:36 p.m. UTC
Please review the way that I did the patch files because I am not sure if they are linline with guix standards.

Comments

Charles Feb. 11, 2022, 6:51 a.m. UTC | #1
Is there any chance this can get merged? If there is something wrong with the package, I am happy to fix it.
Julien Lepiller Feb. 11, 2022, 7:05 a.m. UTC | #2
Your patch looks good, though I haven't tested yet. In your synopsis, it's "an emulator", not "a emulator". The patches should contain author information. Did you create them yourself? Did you get them from somewhere else?

The gcc patch could be replaced with a phase that substitutes cc for gcc.

You need to add the patches to gnu/local.mk.

Thanks!

On February 11, 2022 7:51:31 AM GMT+01:00, Charles via Guix-patches via <guix-patches@gnu.org> wrote:
>Is there any chance this can get merged? If there is something wrong with the package, I am happy to fix it.
>
>
>
>
diff mbox series

Patch

From a7c9af1f2e6f0b027c2d77e1163545732aeff8be Mon Sep 17 00:00:00 2001
From: Charles <charles.b.jackson@protonmail.com>
Date: Tue, 1 Feb 2022 10:36:06 -0600
Subject: [PATCH] gnu: emulators: Add visualboyadvance-m.

* gnu/packages/emulators.scm (visualboyadvance-m): New variable.
* gnu/packages/patches/visualboyadvance-m-fix-rpath.patch: New patch.
* gnu/packages/patches/visualboyadvance-m-use-gcc.patch: New patch.
---
 gnu/packages/emulators.scm                    | 50 +++++++++++++++++++
 .../visualboyadvance-m-fix-rpath.patch        | 20 ++++++++
 .../patches/visualboyadvance-m-use-gcc.patch  | 17 +++++++
 3 files changed, 87 insertions(+)
 create mode 100644 gnu/packages/patches/visualboyadvance-m-fix-rpath.patch
 create mode 100644 gnu/packages/patches/visualboyadvance-m-use-gcc.patch

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index b260ca38f7..7649cec662 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -17,6 +17,7 @@ 
 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2022 Charles Jackson <charles.b.jackson@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -814,6 +815,55 @@  (define-public sameboy
 from an emulator---from save states to scaling filters.")
     (license license:expat)))
 
+(define-public visualboyadvance-m
+  (package
+    (name "visualboyadvance-m")
+    (version "2.1.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/visualboyadvance-m/visualboyadvance-m/")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1kgpbvng3c12ws0dy92zc0azd94h0i3j4vm7b67zc8mi3pqsppdg"))
+       (patches (search-patches "visualboyadvance-m-use-gcc.patch"
+                                "visualboyadvance-m-fix-rpath.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     '(#:build-type "Release"
+       #:tests? #f
+       #:configure-flags
+       (list "-DENABLE_SSP=ON"
+             "-DENABLE_ONLINEUPDATES=OFF"
+             (string-append "-DCMAKE_PREFIX_PATH="
+                            (assoc-ref %build-inputs "wxwidgets")))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'set-home
+           (lambda _ (setenv "HOME" (getcwd)))))))
+    (native-inputs (list
+                    gettext-minimal
+                    nasm
+                    pkg-config
+                    zip))
+    (inputs (list
+             ffmpeg
+             gtk+
+             libpng
+             mesa
+             openal
+             sdl2
+             sfml
+             wxwidgets
+             zlib))
+    (home-page "https://vba-m.com/")
+    (synopsis "Performant Nintendo Gameboy emulator")
+    (description "Visual Boy Advance M is a emulator of the Game Boy, Game Boy
+Color, and Game Boy Advance handheld game consoles.")
+    (license license:gpl2+)))
+
 (define-public mupen64plus-core
   (package
     (name "mupen64plus-core")
diff --git a/gnu/packages/patches/visualboyadvance-m-fix-rpath.patch b/gnu/packages/patches/visualboyadvance-m-fix-rpath.patch
new file mode 100644
index 0000000000..c464f4b9d7
--- /dev/null
+++ b/gnu/packages/patches/visualboyadvance-m-fix-rpath.patch
@@ -0,0 +1,20 @@ 
+---
+ CMakeLists.txt | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 010c9b0e..3a959b59 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -610,9 +610,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+ 
+         set(MY_C_LINKER_FLAGS ${MY_C_LINKER_FLAGS} -Wl,-allow-multiple-definition)
+ 
+-        if(CMAKE_PREFIX_PATH)
+-            list(GET CMAKE_PREFIX_PATH 0 prefix_path_first)
+-            set(MY_C_LINKER_FLAGS ${MY_C_LINKER_FLAGS} "-Wl,-rpath-link=${prefix_path_first}/lib")
+-        endif()
++        set(MY_C_LINKER_FLAGS ${MY_C_LINKER_FLAGS} "-Wl,-rpath,$ENV{LIBRARY_PATH}")
+     endif()
+ 
+     # set linker flags
\ No newline at end of file
diff --git a/gnu/packages/patches/visualboyadvance-m-use-gcc.patch b/gnu/packages/patches/visualboyadvance-m-use-gcc.patch
new file mode 100644
index 0000000000..449ee75697
--- /dev/null
+++ b/gnu/packages/patches/visualboyadvance-m-use-gcc.patch
@@ -0,0 +1,17 @@ 
+---
+ cmake/HostCompile.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/HostCompile.cmake b/cmake/HostCompile.cmake
+index 8fea28be..23a1b0c2 100644
+--- a/cmake/HostCompile.cmake
++++ b/cmake/HostCompile.cmake
+@@ -15,7 +15,7 @@ function(host_compile src dst_cmd)
+ 
+     if(NOT MSVC)
+         # assume cc foo.c -o foo # will work on most hosts
+-        set(compile_command cc ${src} -o ${dst} ${link_flags})
++        set(compile_command gcc ${src} -o ${dst} ${link_flags})
+     else()
+         # special case for Visual Studio
+ 	set(compile_command ${CMAKE_C_COMPILER} ${src} /link "/out:${dst}")
\ No newline at end of file
-- 
2.34.0