From 7f981c53df790bf1b5a33da77c0b926f64732576 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Mon, 21 Mar 2022 15:10:54 -0400 Subject: gnu: imgui: Add support for fontconfig and the C++ standard library. * gnu/packages/toolkits.scm (imgui)[source]: Streamline snippet. [arguments]: Use gexps. [phases]{build}: Add include directive to fonconfig headers. Also build the C++ sources found under the "misc" directory. {install}: Install headers found under the "misc" directory. [inputs]: Add fontconfig. --- gnu/packages/toolkits.scm | 93 ++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 41 deletions(-) (limited to 'gnu/packages/toolkits.scm') diff --git a/gnu/packages/toolkits.scm b/gnu/packages/toolkits.scm index ba860014a4..fd3385122e 100644 --- a/gnu/packages/toolkits.scm +++ b/gnu/packages/toolkits.scm @@ -19,8 +19,10 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages toolkits) + #:use-module (gnu packages fontutils) #:use-module (gnu packages gl) #:use-module (gnu packages sdl) + #:use-module (guix gexp) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix utils) @@ -42,29 +44,30 @@ (define-public imgui "10qil22s5qak3as41787iz273sibpq1bq66bakgn7yvhj5fym6hz")) (modules '((guix build utils))) (snippet - '(begin - ;; Remove bundled fonts. - (delete-file-recursively "misc/fonts"))))) + ;; Remove bundled fonts. + '(delete-file-recursively "misc/fonts")))) (outputs '("out" "doc")) (build-system gnu-build-system) (arguments - `(#:tests? #f ;no test suite - #:modules ((guix build gnu-build-system) + (list + #:tests? #f ;no test suite + #:modules '((guix build gnu-build-system) (guix build utils) (ice-9 ftw) (srfi srfi-26)) - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'adjust-includes - (lambda _ - (substitute* (find-files "." "(\\.cpp|\\.mm)$") - (("#include )) - (imgui-headers (scandir "." header?)) - (backend-headers (find-files - "backends" - "(glfw|opengl|sdl|vulkan).*\\.h$"))) - (install-file "libimgui.so" (string-append out "/lib")) - ;; Install headers. - (for-each (lambda (f) - (install-file f (string-append out "/include/imgui"))) - imgui-headers) - (for-each (lambda (f) - (install-file f (string-append - out "/include/imgui/backends"))) - backend-headers) - ;; Install examples. - (copy-recursively - "examples" (string-append - doc "/share/imgui/examples")))))))) - (inputs (list glfw mesa sdl2)) + "backends/imgui_impl_opengl3.cpp" + ;; Include wrappers for C++ standard library (STL) and + ;; fontconfig. + (find-files "misc" "\\.cpp$")))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (doc (assoc-ref outputs "doc")) + (header? (cut string-suffix? ".h" <>)) + (imgui-headers (scandir "." header?)) + (backend-headers (find-files + "backends" + "(glfw|opengl|sdl|vulkan).*\\.h$")) + (misc-headers (find-files "misc" "\\.h$"))) + (install-file "libimgui.so" (string-append out "/lib")) + ;; Install headers. + (for-each (lambda (f) + (install-file f (string-append out "/include/imgui"))) + imgui-headers) + (for-each (lambda (f) + (install-file f (string-append + out "/include/imgui/backends"))) + backend-headers) + (for-each (lambda (f) + (install-file f (string-append + out "/include/imgui/" (dirname f)))) + misc-headers) + ;; Install examples. + (copy-recursively + "examples" (string-append + doc "/share/imgui/examples")))))))) + (inputs (list fontconfig glfw mesa sdl2)) (home-page "https://github.com/ocornut/imgui") (synopsis "Immediate-mode C++ GUI library with minimal dependencies") (description "@code{dear imgui} (also know as ImGui) is a graphical user -- cgit v1.2.3