Subject: Re: [bug#40492] [PATCH] gnu: Add meshlab

From: Ludovic Courtès <[email-masked]>
Date: Sun, 26 Apr 2020 22:49:27 +0200

Saluton!

Ekaitz Zarraga <[email-masked]> skribis:

> From 814e44cb90b1427a9af5d6a66392c5a39910e8fd Mon Sep 17 00:00:00 2001
> From: Ekaitz Zarraga <[email-masked]>
> Date: Tue, 7 Apr 2020 18:56:06 +0200
> Subject: [PATCH] gnu: Add meshlab.
>
>     * gnu/packages/engineering.scm (meshlab): New variable.

Great!  I added a copyright line for you, fixed up indentation (see the
bit in the manual for how to do that automatically), and added a
comment—patch attached.

It built for me, but then I realized I had missed something: the
external/ sub-directory contains lots of bundled copies of external
tools, and indeed, the ‘configure’ phase shows:

--8<---------------cut here---------------start------------->8---
-- Could NOT find Lib3ds (missing: LIB3DS_INCLUDE_DIR LIB3DS_LIBRARY) 
-- Could NOT find GMP (missing: GMP_INCLUDE_DIR GMP_LIBRARY) 
-- Could NOT find muparser (missing: MUPARSER_INCLUDE_DIR MUPARSER_LIBRARY) 
-- Could NOT find OpenCTM (missing: OPENCTM_INCLUDE_DIR OPENCTM_LIBRARY) 
-- Could NOT find Qhull (missing: QHULL_qhull_LIBRARY QHULL_qhull_INCLUDE_DIR qhull) 
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- - jhead - using bundled source
-- - glew - using bundled source
-- - Eigen - using bundled source
-- - newuoa - using bundled source
-- - levmar - using bundled source
-- - lib3ds - using bundled source
-- - muparser - using bundled source
-- - OpenCTM - using bundled source
-- - structure-synth - using bundled source
-- - qhull - using bundled source
--8<---------------cut here---------------end--------------->8---

Some of these are already packaged, so it should be a matter of adding
them to ‘inputs’.  For the remaining ones, it would be extra packaging
work to do.

The goal is to address all of these, but if we can address the majority
of these, perhaps we can commit a first version of the package with a
FIXME stating what remains to be done, if you prefer.

Thanks, and apologies for overlooking it before!

Ludo’.

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 2fc2ecdd88..ee90e3b429 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -16,6 +16,7 @@
 ;;; Copyright © 2019 John Soo <[email-masked]>
 ;;; Copyright © 2020 Brice Waegeneire <[email-masked]>
 ;;; Copyright © 2020 Vincent Legoll <[email-masked]>
+;;; Copyright © 2020 Ekaitz Zarraga <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2520,43 +2521,43 @@ official SDK.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                       (url "https://github.com/cnr-isti-vclab/meshlab")
-                       (commit (string-append "Meshlab-" version))
-                       (recursive? #t)))
+                      (url "https://github.com/cnr-isti-vclab/meshlab")
+                      (commit (string-append "Meshlab-" version))
+                      (recursive? #t)))
+                (file-name (git-file-name name version))
                 (sha256
-                  (base32 "1vx9jcsnnxvzi90pcxpp7p72cqg3cm6jiivdmrxkzhr2fiz3pfvr"))))
+                 (base32 "1vx9jcsnnxvzi90pcxpp7p72cqg3cm6jiivdmrxkzhr2fiz3pfvr"))))
       (build-system cmake-build-system)
       (native-inputs
-        `(("qtbase" ,qtbase)
-          ("qtscript" ,qtscript)
-          ("qtxmlpatterns" ,qtxmlpatterns)
-          ("mesa", mesa)
-          ("glu", glu)))
+       `(("qtbase" ,qtbase)
+         ("qtscript" ,qtscript)
+         ("qtxmlpatterns" ,qtxmlpatterns)
+         ("mesa", mesa)
+         ("glu", glu)))
       (arguments
-        `(#:tests? #f ; Has no tests
-          #:phases
-          (modify-phases
-            %standard-phases
-              (add-after
-                'unpack 'go-to-source-dir
-                (lambda _ (chdir "src") #t))
-              (add-after
-                'install 'move-files
-                (lambda* (#:key outputs #:allow-other-keys)
-                         (let ((lib (string-append (assoc-ref outputs "out")
-                                                   "/lib")))
-                           (rename-file
-                             (string-append lib "/meshlab/libmeshlab-common.so")
-                             (string-append lib "/libmeshlab-common.so"))
-                           #t))))))
+       `(#:tests? #f                              ;has no tests
+         #:phases
+         (modify-phases
+             %standard-phases
+           (add-after 'unpack 'go-to-source-dir
+             (lambda _ (chdir "src") #t))
+           (add-after 'install 'move-files
+             (lambda* (#:key outputs #:allow-other-keys)
+               ;; The RUNPATH on plugins is set to OUT/lib.  Move
+               ;; libmeshlab-common.so there so it can be found.
+               (let ((lib (string-append (assoc-ref outputs "out")
+                                         "/lib")))
+                 (rename-file
+                  (string-append lib "/meshlab/libmeshlab-common.so")
+                  (string-append lib "/libmeshlab-common.so"))
+                 #t))))))
       (synopsis "3D triangular mesh processing and editing software")
-                (home-page "http://www.meshlab.net/")
-                (description "MeshLab is a system for the processing and
-editing of unstructured large 3D triangular meshes.  It is aimed to help the
-processing of the typical not-so-small unstructured models arising in 3D
-scanning, providing a set of tools for editing, cleaning, healing, inspecting,
-rendering and converting this kind of meshes.  These tools include MeshLab
-proper, a versatile program with a graphical user interface, and meshlabserver,
-a program that can perform mesh processing tasks in batch mode, without a
-GUI.")
-                (license license:gpl3+))))
+      (home-page "http://www.meshlab.net/")
+      (description "MeshLab is a system for the processing and editing of
+unstructured large 3D triangular meshes.  It is aimed to help the processing
+of the typical not-so-small unstructured models arising in 3D scanning,
+providing a set of tools for editing, cleaning, healing, inspecting, rendering
+and converting this kind of meshes.  These tools include MeshLab proper, a
+versatile program with a graphical user interface, and meshlabserver, a
+program that can perform mesh processing tasks in batch mode, without a GUI.")
+      (license license:gpl3+))))