unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: John Kehayias via Guix-patches via <guix-patches@gnu.org>
To: "53015@debbugs.gnu.org" <53015@debbugs.gnu.org>
Subject: [bug#53015] [PATCH 3/4] gnu: dear-imgui: Update to 1.81, hide version 1.79.
Date: Tue, 04 Jan 2022 22:25:07 +0000	[thread overview]
Message-ID: <SmkWDygJ2Yg5ggG3XNIW4atQSp1z6dxOYweJvhM57fLpj4n5jID08xXP7oin93SCP71A945SL5TMXJKB9KH8MpmxQ_s36WXagSM-_zWce60=@protonmail.com> (raw)
In-Reply-To: <Q7tnT9BK6ONvH70UZEXzlqJR968TW3cdJCw99_OCDwa0EHxp7k0YTRLa0XHOHsCsR6bMjuJdzqWOfuuilwIRolVj5mNo148mDaUwJtZ1hE8=@protonmail.com>

[-- Attachment #1: Type: text/plain, Size: 13 bytes --]

Empty Message

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-gnu-dear-imgui-Update-to-1.81-hide-version-1.79.patch --]
[-- Type: text/x-patch; name=0003-gnu-dear-imgui-Update-to-1.81-hide-version-1.79.patch, Size: 9095 bytes --]

From d4eeb30544c9681899b12fe27baf2ad5d20a4330 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Tue, 4 Jan 2022 16:48:39 -0500
Subject: [PATCH 3/4] gnu: dear-imgui: Update to 1.81, hide version 1.79.

* gnu/packages/graphics.scm: Import (gnu packages game-development).
(dear-imgui): Update to 1.81.
[outputs]: Add static output.
[phases]{unpack-debian-files}: Build the static library, remove references to
non-existent stb library.
{move-static-libraries}: New phase to install static libraries.
[inputs]: Add allegro, freeglut, glew, glfw, mesa, sdl2, and vulkan-headers.
(dear-imgui-1.79): New variable. Hidden package of the previous version of
dear-imgui.
(ogre)[native-inputs]: Use it.
---
 gnu/packages/graphics.scm | 122 ++++++++++++++++++++++++++++++++++----
 1 file changed, 110 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index fe35aaad2d..438a01ba72 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -27,6 +27,7 @@
 ;;; Copyright © 2021 Andy Tai <atai@atai.org>
 ;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,6 +63,7 @@ (define-module (gnu packages graphics)
   #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages game-development)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
@@ -867,10 +869,81 @@ (define-public pstoedit
 @end itemize")
     (license license:gpl2+)))
 
+(define-public dear-imgui-1.79
+  (hidden-package
+   (package
+     (name "dear-imgui-1.79")
+     (version "1.79")
+     (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/ocornut/imgui")
+              (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32 "0x26igynxp6rlpp2wfc5dr7x6yh583ajb7p23pgycn9vqikn318q"))))
+     (build-system gnu-build-system)
+     (arguments
+      `(#:make-flags
+        (list (string-append "CC=" ,(cc-for-target))
+              (string-append "PREFIX=" (assoc-ref %outputs "out"))
+              (string-append "VERSION=" ,version))
+        #:tests? #f                      ; no test suite
+        #:phases
+        (modify-phases %standard-phases
+          (add-after 'unpack 'unpack-debian-files
+            (lambda* (#:key inputs #:allow-other-keys)
+              (invoke "tar" "xvf" (assoc-ref inputs "debian-files"))
+              (apply invoke "patch" "-Np1" "-i"
+                     (find-files "debian/patches" "\\.patch$"))
+              (substitute* "Makefile"
+                (("<stb/") "<")          ; Guix doesn't use this subdirectory
+                ;; Don't build or install the static library.
+                (("^all: .*") "all: $(SHLIB) $(PCFILE)"))
+              (substitute* (list "imgui.pc.in"
+                                 "Makefile")
+                ;; Don't link against a non-existent library.
+                (("-lstb") ""))
+              #t))
+          (delete 'configure)            ; no configure script
+          (replace 'install
+            ;; The default ‘install’ target installs the static library.  Don't.
+            (lambda* (#:key make-flags #:allow-other-keys)
+              (apply invoke "make" "install-shared" "install-header"
+                     make-flags))))))
+     (native-inputs
+      `(("debian-files"
+         ;; Upstream doesn't provide a build system.  Use Debian's.
+         ,(origin
+            (method url-fetch)
+            (uri (string-append "mirror://debian/pool/main/i/imgui/imgui_"
+                                version "+ds-1.debian.tar.xz"))
+            (sha256
+             (base32 "1xhk34pzpha6k5l2j150capq66y8czhmsi04ib09wvb34ahqxpby"))))
+        ("pkg-config" ,pkg-config)))
+     (inputs
+      (list freetype stb-rect-pack stb-truetype))
+     (home-page "https://github.com/ocornut/imgui")
+     (synopsis "Immediate-mode C++ GUI library with minimal dependencies")
+     (description
+      "Dear ImGui is a @acronym{GUI, graphical user interface} library for C++.
+It creates optimized vertex buffers that you can render anytime in your
+3D-pipeline-enabled application.  It's portable, renderer-agnostic, and
+self-contained, without external dependencies.
+
+Dear ImGui is aimed at content creation, visualization, and debugging tools as
+opposed to average end-user interfaces.  Hence it favors simplicity and
+productivity but lacks certain features often found in higher-level libraries.
+It is particularly suited to integration in game engine tooling, real-time 3D
+applications, full-screen applications, and embedded platforms without standard
+operating system features.")
+     (license license:expat))))           ; some examples/ use the zlib licence
+
 (define-public dear-imgui
   (package
     (name "dear-imgui")
-    (version "1.79")
+    (version "1.81")
     (source
      (origin
        (method git-fetch)
@@ -879,8 +952,10 @@ (define-public dear-imgui
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0x26igynxp6rlpp2wfc5dr7x6yh583ajb7p23pgycn9vqikn318q"))))
+        (base32 "0pr740fhrqbqvqfw6iwd5sx5zvjjkb299bzyybwkxirpg74il6dd"))))
     (build-system gnu-build-system)
+    (outputs '("out"
+               "static"))
     (arguments
      `(#:make-flags
        (list (string-append "CC=" ,(cc-for-target))
@@ -896,19 +971,32 @@ (define-public dear-imgui
                     (find-files "debian/patches" "\\.patch$"))
              (substitute* "Makefile"
                (("<stb/") "<")          ; Guix doesn't use this subdirectory
-               ;; Don't build or install the static library.
-               (("^all: .*") "all: $(SHLIB) $(PCFILE)"))
+               ;; Install the static library as well.
+               (("^install: .*") "install: install-shared install-static install-header")
+               ;; Don't build with a non-existent library.
+               (("-DIMGUI") "# -DIMGUI"))
              (substitute* (list "imgui.pc.in"
                                 "Makefile")
                ;; Don't link against a non-existent library.
                (("-lstb") ""))
+             ;; Don't require a non-existent library.
+             (substitute* "imgui.pc.in"
+               (("Requires: stb") ""))
              #t))
          (delete 'configure)            ; no configure script
-         (replace 'install
-           ;; The default ‘install’ target installs the static library.  Don't.
-           (lambda* (#:key make-flags #:allow-other-keys)
-             (apply invoke "make" "install-shared" "install-header"
-                    make-flags))))))
+         (add-after 'install 'move-static-libraries
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Move static libraries to the "static" output.
+             (let* ((out    (assoc-ref outputs "out"))
+                    (lib    (string-append out "/lib"))
+                    (static (assoc-ref outputs "static"))
+                    (slib   (string-append static "/lib")))
+               (mkdir-p slib)
+               (for-each (lambda (file)
+                           (install-file file slib)
+                           (delete-file file))
+                         (find-files lib "\\.a$"))
+               #t))))))
     (native-inputs
      `(("debian-files"
         ;; Upstream doesn't provide a build system.  Use Debian's.
@@ -917,10 +1005,20 @@ (define-public dear-imgui
            (uri (string-append "mirror://debian/pool/main/i/imgui/imgui_"
                                version "+ds-1.debian.tar.xz"))
            (sha256
-            (base32 "1xhk34pzpha6k5l2j150capq66y8czhmsi04ib09wvb34ahqxpby"))))
+            (base32 "02ld250dlqmz8zwy14hnlr49lizvbigvdva9c2rx4f5ily1dajw4"))))
        ("pkg-config" ,pkg-config)))
     (inputs
-     (list freetype stb-rect-pack stb-truetype))
+     ;; Most of these are optional for the different graphics backends.
+     (list allegro
+           freeglut
+           freetype
+           glew
+           glfw
+           mesa
+           sdl2
+           stb-rect-pack
+           stb-truetype
+           vulkan-headers))
     (home-page "https://github.com/ocornut/imgui")
     (synopsis "Immediate-mode C++ GUI library with minimal dependencies")
     (description
@@ -1006,7 +1104,7 @@ (define-public ogre
                "-DOGRE_INSTALL_SAMPLES_SOURCE=TRUE"))))
     (native-inputs
      `(("boost" ,boost)
-       ("dear-imgui-source" ,(package-source dear-imgui))
+       ("dear-imgui-source" ,(package-source dear-imgui-1.79))
        ("doxygen" ,doxygen)
        ("googletest" ,googletest-1.8)
        ("pkg-config" ,pkg-config)))
-- 
2.34.0


  parent reply	other threads:[~2022-01-04 22:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 22:20 [bug#53015] [PATCH 0/4] Add mangohud (update dear-imgui) John Kehayias via Guix-patches via
2022-01-04 22:23 ` [bug#53015] [PATCH 1/4] gnu: Add pciutils-no-zlib John Kehayias via Guix-patches via
2022-01-04 22:24 ` [bug#53015] [PATCH 2/4] gnu: spdlog: Build with '-fpic' John Kehayias via Guix-patches via
2022-01-22  5:06   ` John Kehayias via Guix-patches via
2022-02-21  4:11     ` [bug#53015] [PATCH 0/4] Add mangohud (update dear-imgui) Maxim Cournoyer
2022-02-21 16:36       ` John Kehayias via Guix-patches via
2022-02-21 17:31         ` Maxim Cournoyer
2022-01-04 22:25 ` John Kehayias via Guix-patches via [this message]
2022-01-04 22:34 ` [bug#53015] [PATCH 4/4] gnu: Add mangohud John Kehayias via Guix-patches via
2022-02-16  1:48 ` [bug#53015] [PATCH 0/4] Add mangohud (update dear-imgui) John Kehayias via Guix-patches via
2022-02-23 22:35 ` [bug#53015] [PATCH v2] Add mangohud John Kehayias via Guix-patches via
2022-02-27  1:14   ` [bug#53015] [PATCH v3] " John Kehayias via Guix-patches via
2022-02-27  2:31     ` Maxim Cournoyer
2022-02-27  4:31       ` John Kehayias via Guix-patches via
2022-03-02  1:37 ` [bug#53015] [PATCH 0/4] Add mangohud (update dear-imgui) Brendan Tildesley
2022-03-02  4:54   ` John Kehayias via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='SmkWDygJ2Yg5ggG3XNIW4atQSp1z6dxOYweJvhM57fLpj4n5jID08xXP7oin93SCP71A945SL5TMXJKB9KH8MpmxQ_s36WXagSM-_zWce60=@protonmail.com' \
    --to=guix-patches@gnu.org \
    --cc=53015@debbugs.gnu.org \
    --cc=john.kehayias@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).