diff mbox series

[bug#66035] gnu: Add renderdoc.

Message ID 20230916160108.31783-1-i@dan.games
State New
Headers show
Series [bug#66035] gnu: Add renderdoc. | expand

Commit Message

dan Sept. 16, 2023, 4:01 p.m. UTC
* gnu/packages/graphics.scm (renderdoc): New variable.
---
 gnu/packages/graphics.scm | 90 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 89 insertions(+), 1 deletion(-)


base-commit: 04fad62acdcffa50c18528ce71f015907b9eb558
diff mbox series

Patch

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 9362666274..002d93f75b 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -32,7 +32,7 @@ 
 ;;; Copyright © 2022 Zheng Junjie <873216071@qq.com>
 ;;; Copyright © 2022 Tobias Kortkamp <tobias.kortkamp@gmail.com>
 ;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
-;;; Copyright © 2022 dan <i@dan.games>
+;;; Copyright © 2022, 2023 dan <i@dan.games>
 ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
 ;;; Copyright © 2023 David Thompson <dthompson2@worcester.edu>
 ;;; Copyright © 2023 Eric Bavier <bavier@posteo.net>
@@ -101,6 +101,7 @@  (define-module (gnu packages graphics)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ninja)
   #:use-module (gnu packages pciutils)
+  #:use-module (gnu packages pcre)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages photo)
@@ -2851,3 +2852,90 @@  (define-public gpaint
 It features cut-and-paste for irregular regions or polygons.")
     (home-page "https://www.gnu.org/software/gpaint/")
     (license license:gpl3+)))
+
+(define %swig-for-renderdoc-version
+  "renderdoc-modified-7")
+
+(define swig-for-renderdoc
+  (origin
+    (method url-fetch)
+    (uri (string-append "https://github.com/baldurk/swig/archive/refs/tags/"
+                        %swig-for-renderdoc-version ".tar.gz"))
+    (sha256 (base32
+             "19sb4vik8kgy9pxjfam8qc8i52iraj2971p1hrzh850fvl0nibg7"))))
+
+(define-public renderdoc
+  (package
+    (name "renderdoc")
+    (version "1.28")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/baldurk/renderdoc.git")
+                    (commit (string-append "v" version))))
+              (sha256
+               (base32
+                "1rny39s1b48bgv8x2871ylkzk1f9llvrskb809c6gcawnfazzivb"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:tests? #f
+           #:configure-flags #~(list (string-append "-DVULKAN_LAYER_FOLDER="
+                                      #$output
+                                      "/share/vulkan/implicit_layer.d"))
+           #:phases #~(modify-phases %standard-phases
+                        (add-after 'unpack 'unpack-additional-sources
+                          (lambda* (#:key inputs #:allow-other-keys)
+                            (let ((sh (search-input-file inputs "/bin/sh")))
+                              (invoke "tar" "xvf"
+                                      #$swig-for-renderdoc)
+                              (rename-file (string-append "swig-"
+                                            #$%swig-for-renderdoc-version)
+                                           "swig")
+                              (substitute* "qrenderdoc/CMakeLists.txt"
+                                (("URL \\$\\{RENDERDOC_SWIG_PACKAGE\\}")
+                                 "SOURCE_DIR ${CMAKE_SOURCE_DIR}/swig")
+                                (("CONFIGURE_COMMAND\\s.*")
+                                 "CONFIGURE_COMMAND \"\"\n")
+                                (("^\\s+COMMAND CC.*")
+                                 ""))
+                              (substitute* "swig/Makefile.in"
+                                (("/bin/sh")
+                                 sh))
+                              (chdir "swig")
+                              (invoke sh "autogen.sh")
+                              (chdir ".."))))
+                        (add-after 'configure 'configure-swig
+                          (lambda* (#:key inputs #:allow-other-keys)
+                            (let ((build-dir (getcwd))
+                                  (sh (search-input-file inputs "/bin/sh")))
+                              (chdir "../source/swig")
+                              (apply invoke sh "./configure"
+                                     (list "CC=gcc"
+                                           "CXX=g++"
+                                           "CFLAGS=-fPIC"
+                                           "CXXFLAGS=-fPIC"
+                                           (string-append "SHELL=" sh)
+                                           "--with-pcre=yes"
+                                           (string-append "--prefix="
+                                                          build-dir)))
+                              (chdir "../../build")))))))
+    (inputs (list libx11
+                  libxcb
+                  xcb-util-keysyms
+                  mesa
+                  qtbase-5
+                  qtsvg-5
+                  qtx11extras))
+    (native-inputs (list autoconf
+                         automake
+                         bison
+                         (list pcre "bin")
+                         pkg-config
+                         python))
+    (home-page "https://renderdoc.org")
+    (synopsis "Graphics debugging tool")
+    (description
+     "RenderDoc is a frame-capture based graphics debugger, currently
+available for Vulkan, D3D11, D3D12, OpenGL, and OpenGL ES development on
+Windows, Linux, Android, and Nintendo Switch™.")
+    (license license:expat)))