diff mbox series

[bug#62178,1/5] gnu: Add fgeal.

Message ID 21349edf-d7fa-ec74-e40f-7fc155658449@disroot.org
State New
Headers show
Series Add terrarium. | expand

Commit Message

Adam Faiz March 14, 2023, 6:57 a.m. UTC
From f2dc6209535b2ad8aed999845c0992264cc7aff6 Mon Sep 17 00:00:00 2001
Message-Id: <f2dc6209535b2ad8aed999845c0992264cc7aff6.1678775193.git.adam.faiz@disroot.org>
In-Reply-To: <cover.1678775193.git.adam.faiz@disroot.org>
References: <cover.1678775193.git.adam.faiz@disroot.org>
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Tue, 14 Mar 2023 13:38:36 +0800
Subject: [PATCH 1/5] gnu: Add fgeal.

* gnu/packages/game-development.scm (fgeal): New variable.
---
  gnu/packages/game-development.scm | 106 ++++++++++++++++++++++++++++++
  1 file changed, 106 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index a384572a9d..f86793fda0 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -2359,6 +2359,112 @@  (define-public flatzebra
  double-buffering.")
      (license license:gpl2+)))
  
+(define-public fgeal
+  (let ((commit "0ae72fbf31eb2e133fe83520391e7a82c0b59e67")
+        (revision "0"))
+  (package
+    (name "fgeal")
+    (version (git-version "0.8.4" revision commit))
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/hydren/fgeal")
+             (commit commit)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0lck86n8nkhb088bd0jg4imi9j5l1lwfr2pddqqr880rjrnnm8fw"))
+       (modules '((guix build utils)))
+       (snippet
+        #~(begin
+            (with-directory-excursion "project/build/linux-gcc-sdl2-release"
+              (rename-file "configure.sh" "configure")
+              (substitute* "configure"
+                (("-exec sed -i")
+                 (string-append
+                 "-exec sed -i"
+                 " \"s,SDL2_CFLAGS,`pkg-config --cflags sdl2`,g\" {} \\;"
+                 " -exec sed -i"))
+                (("which") "type -p"))
+              (substitute* "makefile"
+                (("RM := rm -rf")
+                 (string-append "RM := rm -rf\n"
+                                "PREFIX ?= /usr/local"))
+                (("clean:")
+                 (string-append
+                  "install:\n\t"
+                  "install -d $(DESTDIR)$(PREFIX)/include\n\t"
+                  "cp -r ../fgeal $(DESTDIR)$(PREFIX)/include\n\t"
+                  "install -d $(DESTDIR)$(PREFIX)/lib\n\t"
+                  "install -m 644 libfgeal.so $(DESTDIR)$(PREFIX)/lib\n\n"
+                  "clean:")))
+              (substitute* "extra/subdir.mk"
+                (("../extra/input_manager.cpp \\\\")
+                 (string-append "../extra/input_manager.cpp \\\n"
+                                "../extra/primitives.cpp \\"))
+                (("./extra/input_manager.o \\\\")
+                 (string-append "./extra/input_manager.o \\\n"
+                                "./extra/primitives.o \\"))
+                (("./extra/input_manager.d \\\\")
+                 (string-append "./extra/input_manager.d \\\n"
+                                "./extra/primitives.d \\"))))
+            (copy-recursively "project/build/linux-gcc-sdl2-release"
+                              "linux-gcc-sdl2-release")
+            (substitute* (find-files "." "\\.mk")
+              (("-I\"BUILD_PATH\"") "-I\"BUILD_PATH\" SDL2_CFLAGS"))
+            (for-each
+             (lambda (file)
+               (install-file file "fgeal"))
+             '("agnostic_cached_drawable_text.hxx"
+               "agnostic_filesystem.hxx"
+               "agnostic_sound_stream.hxx"
+               "colors.hpp"
+               "core.hpp"
+               "display.hpp"
+               "event.hpp"
+               "exceptions.hpp"
+               "fgeal.hpp"
+               "filesystem.hpp"
+               "font.hpp"
+               "friend_classes.hxx"
+               "generic_graphics.hxx"
+               "geometry.hpp"
+               "graphics.hpp"
+               "image.hpp"
+               "input.hpp"
+               "sound.hpp"
+               "version.h"))
+            (for-each
+             (lambda (file)
+               (install-file file "fgeal/extra"))
+             (find-files "extra" "\\.hpp"))))))
+    (build-system gnu-build-system)
+    (native-inputs
+     (list pkg-config))
+    (inputs
+     (list sdl2
+           sdl2-gfx
+           sdl2-image
+           sdl2-mixer
+           sdl2-ttf))
+    (arguments
+     (list #:tests? #f ; no tests
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-before 'configure 'chdir
+                 (lambda _
+                   (chdir "linux-gcc-sdl2-release"))))
+           #:make-flags
+           #~(list (string-append "DESTDIR=" #$output)
+                   "PREFIX=")))
+    (home-page "https://gitlab.com/hydren/fgeal")
+    (synopsis "Simple C++ game library wrapper")
+    (description "fgeal is a simple C++ wrapper library meant to provide
+common functionalities between some game libraries through a single API.
+  It serves as a cross-platform abstraction layer to other low-level game
+libraries, such as SDL.")
+    (license license:lgpl2.1+))))
+
  (define-public libccd
    (package
      (name "libccd")