diff mbox series

[bug#56638] gnu: Add asli.

Message ID 20220719075934.67481-1-paul@apatience.com
State New
Headers show
Series [bug#56638] gnu: Add asli. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Paul A. Patience July 19, 2022, 7:59 a.m. UTC
* gnu/packages/graphics.scm (asli): New variable.
---
 gnu/packages/graphics.scm | 67 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

--
2.37.0

Comments

Paul A. Patience July 19, 2022, 8:10 a.m. UTC | #1
Hi Ludovic,

ASLI optionally depends on mmg, which I discovered a Guix package for in
the Guix HPC project [1], and for which you seem to be the point of
contact.
I'd like to add mmg to Guix, first to eventually be able to drop ASLI's
bundled version (although I can't get ASLI to build with mmg yet) and
second because I have looked into mmg recently and may want to use it
myself.

Is it just a question of moving the package over to Guix verbatim?
I tried that and it compiled correctly.

Thanks,
Paul

[1]: https://gitlab.inria.fr/guix-hpc/guix-hpc/-/blob/master/inria/mmg.scm
Ludovic Courtès July 19, 2022, 2:21 p.m. UTC | #2
Hello,

"Paul A. Patience" <paul@apatience.com> skribis:

> ASLI optionally depends on mmg, which I discovered a Guix package for in
> the Guix HPC project [1], and for which you seem to be the point of
> contact.

Right!

> I'd like to add mmg to Guix, first to eventually be able to drop ASLI's
> bundled version (although I can't get ASLI to build with mmg yet) and
> second because I have looked into mmg recently and may want to use it
> myself.

Makes sense to me.

> Is it just a question of moving the package over to Guix verbatim?
> I tried that and it compiled correctly.

Sure, I guess you can copy it verbatim, tweaking the description
(removing “open source”, fixing the first sentence.)

TIA!

Ludo’.
M July 19, 2022, 2:32 p.m. UTC | #3
Paul A. Patience schreef op di 19-07-2022 om 07:59 [+0000]:
> +    (native-inputs
> +     ;; Header-only library
> +     (list cgal))

Being header-only makes no difference w.r.t. cross-compilation (and
hence, inputs/native-inputs).  For examples, headers can potentially
contain architecture-specific code (generated at the compile time of
the cgal library).  As such, this may need to be in 'inputs' instead of
'native-inputs'.

Another reason: this should be in 'inputs', otherwise when cross-
compiling it will end in in (IIUC) C_INCLUDE_PATH instead of
CROSS_C_INLUDE_PATH, whereas the cross-compiler will look in
CROSS_C_INCLUDE_PATH and not C_INCLUDE_PATH.

Greetings,
Maxime.
M July 19, 2022, 2:34 p.m. UTC | #4
Paul A. Patience schreef op di 19-07-2022 om 07:59 [+0000]:
> +        ;; Remove bundled libraries except ALGLIB, TetGen and yaml-
> cpp, which
> +        ;; are statically linked,

What does it matter that they are statically linked w.r.t. bundling?
Those seem orthogonal concerns to me.  We can easily define a static
variant of alglib etc, or alternatively (probably more difficult but
feasible) tweak the build process of asli to look for shared libraries
instead of static libraries.

Greetings,
Maxime.
Ludovic Courtès Sept. 8, 2023, 5:16 p.m. UTC | #5
Hi Paul,

"Paul A. Patience" <paul@apatience.com> skribis:

> Thanks for the shasum; it allowed me to discover the problem.
> There are trailing spaces in the original CMakeLists.txt, which also
> appear in the patch.
> When sending the patch inline, these spaces are trimmed.
> (The spaces are highlighted in Magit, so I was aware of them, but I
> didn't realize they would be trimmed somewhere in the email pipeline.)
>
> I will attach the patch file separately, and also a tarred version just
> in case.
> So you can verify that you have the right one, here's my shasum:
>
> $ sha256sum gnu/packages/patches/asli-use-system-libs.patch
> fb1531a4f71e95354af6927175f67b90f39250604aa6859d9def4778027f1810  gnu/packages/patches/asli-use-system-libs.patch

Perfect; pushed as 05f44bbeb40686599827cbe0df7fcc80122fe152.

Thank you and apologies for taking so much time!

Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index c193be1efb..bae1ba1f99 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -31,6 +31,7 @@ 
 ;;; Copyright © 2022 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>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2120,3 +2121,69 @@  (define-public azpainter
 @end itemize
 ")
     (license license:gpl3+)))
+
+(define-public asli
+  (package
+    (name "asli")
+    (version "0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/tpms-lattice/ASLI")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "02hwdavpsy3vmivd6prp03jn004ykrl11lbkvksy5i2zm38zbknr"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; Remove bundled libraries except ALGLIB, TetGen and yaml-cpp, which
+        ;; are statically linked, and KU Leuven's mTT, which is an obscure
+        ;; (i.e., unfindable by searching online for “mTT KU Leuven”), BSD-3
+        ;; licensed, header-only library.
+        ;;
+        ;; AdaptTools and mmg are missing from Guix, but anyway they are
+        ;; unused because mmg support is disabled (-DMMG_MESH=OFF).
+        #~(begin
+            (delete-file-recursively "libs/AdaptTools")
+            (delete-file-recursively "libs/CGAL")
+            (delete-file-recursively "libs/eigen")
+            (delete-file-recursively "libs/mmg")))))
+    (build-system cmake-build-system)
+    (native-inputs
+     ;; Header-only library
+     (list cgal))
+    (inputs
+     (list boost
+           eigen
+           gmp
+           mpfr
+           tbb-2020))
+    (arguments
+     (list #:tests? #f                  ; No tests
+           #:configure-flags
+           #~(list "-DCGAL_ACTIVATE_CONCURRENT_MESH_3=ON"
+                   "-DMMG_MESH=OFF"     ; Build fails when enabled (the default)
+                   (string-append "-DEIGEN3_INCLUDE_DIR="
+                                  #$(this-package-input "eigen")
+                                  "/include/eigen3"))
+           #:phases
+           #~(modify-phases %standard-phases
+               (replace 'install        ; No install phase
+                 (lambda _
+                   (with-directory-excursion "../source/bin"
+                     (install-file "ASLI" (string-append #$output "/bin"))
+                     ;; The manual is included in the repository.
+                     ;; Building it requires -DASLI_DOC=ON, but this is marked
+                     ;; as unsupported (presumably for users).
+                     (install-file "docs/ASLI [User Manual].pdf"
+                                   (string-append #$output "/share/doc/"
+                                                  #$name "-" #$version))))))))
+    (home-page "http://www.biomech.ulg.ac.be/ASLI/")
+    (synopsis "Create lattice infills with varying unit cell type, size and feature")
+    (description "ASLI (A Simple Lattice Infiller) is a command-line tool that
+allows users to fill any 3D geometry with a functionally graded lattice.  The
+lattice infill is constructed out of unit cells, described by implicit
+functions, whose type, size and feature can be varied locally to obtain the
+desired local properties.")
+    (license license:agpl3+)))