diff mbox series

[bug#70313] gnu: Add glvis.

Message ID 26c2c0ab2274cc68b1fae1e257dca4b14036c8a3.1712681651.git.paul@apatience.com
State New
Headers show
Series [bug#70313] gnu: Add glvis. | expand

Commit Message

Paul A. Patience April 9, 2024, 4:57 p.m. UTC
* gnu/packages/graphics.scm (glvis): New variable.
* gnu/packages/patches/glvis-fix-cmake-install.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: Idc7d4733ba81b63d95996cfb93f288c44d35db79
---
This patch requires MFEM, added in bug#70056 [1].
The update to the copyright header takes into account some changes I made in
2023.

Best regards,
Paul

[1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70056

 gnu/local.mk                                  |  1 +
 gnu/packages/graphics.scm                     | 44 ++++++++++++++++++-
 .../patches/glvis-fix-cmake-install.patch     | 32 ++++++++++++++
 3 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/glvis-fix-cmake-install.patch


base-commit: a9111c38f3124d6b4c7fb4da8bf8dbfad318f1af
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index dcedef5f99..5d6b1ba744 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1356,6 +1356,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/glibc-2.29-supported-locales.patch     	\
   %D%/packages/patches/glibc-supported-locales.patch     	\
   %D%/packages/patches/glslang-install-static-libs.patch     	\
+  %D%/packages/patches/glvis-fix-cmake-install.patch     	\
   %D%/packages/patches/gmp-arm-asm-nothumb.patch		\
   %D%/packages/patches/gmp-faulty-test.patch			\
   %D%/packages/patches/gnash-fix-giflib-version.patch	        \
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 9bc81a3a81..79dfc5f4c6 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -31,7 +31,7 @@ 
 ;;; Copyright © 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
 ;;; 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-2024 Paul A. Patience <paul@apatience.com>
 ;;; Copyright © 2022 dan <i@dan.games>
 ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
 ;;; Copyright © 2023 David Thompson <dthompson2@worcester.edu>
@@ -111,6 +111,7 @@  (define-module (gnu packages graphics)
   #:use-module (gnu packages pulseaudio)  ; libsndfile, libsamplerate
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-build)
+  #:use-module (gnu packages python-science)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
@@ -123,6 +124,7 @@  (define-module (gnu packages graphics)
   #:use-module (gnu packages upnp)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
+  #:use-module (gnu packages vim)
   #:use-module (gnu packages vulkan)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
@@ -2859,6 +2861,46 @@  (define-public f3d
 options.")
     (license license:bsd-3)))
 
+(define-public glvis
+  (package
+    (name "glvis")
+    (version "4.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/GLVis/glvis")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1fb50vfw5dm12lhw8dw6jnwlyk8gh5281y5xbb92w7m92309f8iy"))
+       (patches (search-patches "glvis-fix-cmake-install.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     ;; Tests require data from https://github.com/GLVis/data.
+     (list #:tests? #f
+           #:phases
+           #~(modify-phases %standard-phases
+               ;; The glvis-keygen script itself is already executable, and
+               ;; the .sh extension leaks implementation details.
+               (add-after 'unpack 'fix-script-reference
+                 (lambda _
+                   (substitute* "glvis.cpp"
+                     ((" bash glvis-keygen\\.sh ") " glvis-keygen "))))
+               (add-after 'install 'fix-script-name
+                 (lambda _
+                   (with-directory-excursion (string-append #$output "/bin")
+                     (rename-file "glvis-keygen.sh" "glvis-keygen")))))))
+    (native-inputs
+     (list xxd))
+    (inputs
+     (list fontconfig freetype glew glm libpng mfem sdl2))
+    (home-page "https://glvis.org/")
+    (synopsis "Finite element visualizer")
+    (description "GLVis is an OpenGL tool for visualizing finite element meshes
+and functions.")
+    (license license:bsd-3)))
+
 (define-public gpaint
   (package
     (name "gpaint")
diff --git a/gnu/packages/patches/glvis-fix-cmake-install.patch b/gnu/packages/patches/glvis-fix-cmake-install.patch
new file mode 100644
index 0000000000..06f3d9acb1
--- /dev/null
+++ b/gnu/packages/patches/glvis-fix-cmake-install.patch
@@ -0,0 +1,32 @@ 
+From 3983c1988d586f79c421f657f06f4f22dd7a9eb2 Mon Sep 17 00:00:00 2001
+From: "Paul A. Patience" <paul@apatience.com>
+Date: Tue, 9 Apr 2024 11:18:14 -0400
+Subject: [PATCH] Don't install app and code in full installation
+
+---
+ CMakeLists.txt | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b940ec0..387cdb9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -331,12 +331,14 @@ if(NOT EMSCRIPTEN)
+       MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/share/Info.cmake.plist.in)
+   target_link_libraries(app PRIVATE glvis glvis_logo)
+   install(TARGETS app
++    EXCLUDE_FROM_ALL
+     RUNTIME DESTINATION .
+     BUNDLE DESTINATION .)
+   install(CODE [[
+     include (BundleUtilities)
+     fixup_bundle("${CMAKE_INSTALL_PREFIX}/GLVis.app" "" "")
+-  ]] COMPONENT RUNTIME)
++  ]] COMPONENT RUNTIME
++    EXCLUDE_FROM_ALL)
+ 
+ endif(NOT EMSCRIPTEN)
+ 
+-- 
+2.41.0
+