summary refs log tree commit diff
path: root/gnu/packages/toolkits.scm
diff options
context:
space:
mode:
authorJohn Kehayias <john.kehayias@protonmail.com>2023-06-27 20:43:44 -0400
committerJohn Kehayias <john.kehayias@protonmail.com>2023-06-29 10:51:47 -0400
commit15056f47c217d87bf0914735fb52833a5457dc37 (patch)
tree861969bc2c5a4bd1c1b11178ffd34750bf1df93b /gnu/packages/toolkits.scm
parent10ff8ff4b5655b9f4dbb68535b949bd67c3b8028 (diff)
downloadguix-15056f47c217d87bf0914735fb52833a5457dc37.tar.gz
gnu: imgui: Use #:make-flags.
* gnu/packages/toolkits.scm (imgui)[arguments]: Add #:make-flags to replace
compiler arguments in the 'build phase.
Diffstat (limited to 'gnu/packages/toolkits.scm')
-rw-r--r--gnu/packages/toolkits.scm54
1 files changed, 29 insertions, 25 deletions
diff --git a/gnu/packages/toolkits.scm b/gnu/packages/toolkits.scm
index aee6c22e2d..1af10d83f4 100644
--- a/gnu/packages/toolkits.scm
+++ b/gnu/packages/toolkits.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2020, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -55,6 +55,18 @@
                   (guix build utils)
                   (ice-9 ftw)
                   (srfi srfi-26))
+      ;; The build phase does not use make but we will use make-flags in a
+      ;; similar fashion to make inheritance for older imgui versions easier.
+      #:make-flags
+      ;; This first option is necessary at least for OpenBoardView, otherwise
+      ;; it would fail with the "Too many vertices in ImDrawList using 16-bit
+      ;; indices".
+      #~(list "-DImDrawIdx=unsigned int"
+              "-I" (string-append (getcwd) "/source")
+              "-I" (search-input-directory %build-inputs "include/freetype2")
+              "-g" "-O2" "-fPIC" "-shared"
+              "-lGL" "-lSDL2" "-lglfw"
+              "-o" "libimgui.so")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'adjust-includes
@@ -64,32 +76,24 @@
                  "#include <SDL2/SDL"))))
           (delete 'configure)
           (replace 'build
-            (lambda* (#:key inputs #:allow-other-keys)
+            (lambda* (#:key make-flags #:allow-other-keys)
               ;; Build main library.
               (apply invoke #$(cc-for-target)
-                     ;; This option is necessary at least for OpenBoardView,
-                     ;; otherwise it would fail with the "Too many vertices in
-                     ;; ImDrawList using 16-bit indices".
-                     "-DImDrawIdx=unsigned int"
-                     "-I" (getcwd)
-                     "-I" (search-input-directory inputs "include/freetype2")
-                     "-g" "-O2" "-fPIC" "-shared"
-                     "-lGL" "-lSDL2" "-lglfw"
-                     "-o" "libimgui.so"
-                     "imgui.cpp"
-                     "imgui_draw.cpp"
-                     "imgui_tables.cpp"
-                     "imgui_widgets.cpp"
-                     ;; Include the supported backends.
-                     "backends/imgui_impl_glfw.cpp"
-                     (if (file-exists? "backends/imgui_impl_sdl2.cpp")
-                         "backends/imgui_impl_sdl2.cpp"
-                         "backends/imgui_impl_sdl.cpp")
-                     "backends/imgui_impl_opengl2.cpp"
-                     "backends/imgui_impl_opengl3.cpp"
-                     ;; Include wrappers for C++ standard library (STL) and
-                     ;; fontconfig.
-                     (find-files "misc" "\\.cpp$"))))
+                     (append make-flags
+                             `("imgui.cpp"
+                               "imgui_draw.cpp"
+                               "imgui_tables.cpp"
+                               "imgui_widgets.cpp"
+                               ;; Include the supported backends.
+                               "backends/imgui_impl_glfw.cpp"
+                               ,(if (file-exists? "backends/imgui_impl_sdl2.cpp")
+                                    "backends/imgui_impl_sdl2.cpp"
+                                    "backends/imgui_impl_sdl.cpp")
+                               "backends/imgui_impl_opengl2.cpp"
+                               "backends/imgui_impl_opengl3.cpp"
+                               ;; Include wrappers for C++ standard library (STL) and
+                               ;; fontconfig.
+                               ,@(find-files "misc" "\\.cpp$"))))))
           (replace 'install
             (lambda _
               (let* ((header? (cut string-suffix? ".h" <>))