[bug#56638,v2,2/2] gnu: Add asli.
Commit Message
* gnu/packages/graphics.scm (asli): New variable.
* gnu/packages/patches/asli-use-system-libs.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register patch.
---
gnu/local.mk | 1 +
gnu/packages/graphics.scm | 74 +++++++++++++++++++
.../patches/asli-use-system-libs.patch | 70 ++++++++++++++++++
3 files changed, 145 insertions(+)
create mode 100644 gnu/packages/patches/asli-use-system-libs.patch
--
2.37.0
Comments
Hi Paul,
"Paul A. Patience" <paul@apatience.com> skribis:
> * gnu/packages/graphics.scm (asli): New variable.
> * gnu/packages/patches/asli-use-system-libs.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register patch.
The source derivation fails to build for me:
--8<---------------cut here---------------start------------->8---
File CMakeLists.txt is read-only; trying to patch anyway
patching file CMakeLists.txt
Hunk #2 FAILED at 172.
Hunk #3 succeeded at 240 (offset 1 line).
Hunk #4 succeeded at 253 (offset 1 line).
1 out of 4 hunks FAILED -- saving rejects to file CMakeLists.txt.rej
--8<---------------cut here---------------end--------------->8---
> diff --git a/gnu/packages/patches/asli-use-system-libs.patch b/gnu/packages/patches/asli-use-system-libs.patch
> new file mode 100644
> index 0000000000..d8234fd608
> --- /dev/null
> +++ b/gnu/packages/patches/asli-use-system-libs.patch
> @@ -0,0 +1,70 @@
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index b11c5ba..702423e 100755
Also, as suggested by ‘guix lint’, please add a comment at the top
stating what this does and what the upstream status is (if it’s been
submitted), at least something like:
Tweak build system to use system dependencies instead of those that
are bundled.
Could you please send an updated patch?
Thanks!
Ludo’.
Hi Paul,
Did you have a chance to look into this?
Thanks in advance,
Ludo’.
Ludovic Courtès <ludo@gnu.org> skribis:
> Hi Paul,
>
> "Paul A. Patience" <paul@apatience.com> skribis:
>
>> * gnu/packages/graphics.scm (asli): New variable.
>> * gnu/packages/patches/asli-use-system-libs.patch: New file.
>> * gnu/local.mk (dist_patch_DATA): Register patch.
>
> The source derivation fails to build for me:
>
> File CMakeLists.txt is read-only; trying to patch anyway
> patching file CMakeLists.txt
> Hunk #2 FAILED at 172.
> Hunk #3 succeeded at 240 (offset 1 line).
> Hunk #4 succeeded at 253 (offset 1 line).
> 1 out of 4 hunks FAILED -- saving rejects to file CMakeLists.txt.rej
>
>> diff --git a/gnu/packages/patches/asli-use-system-libs.patch b/gnu/packages/patches/asli-use-system-libs.patch
>> new file mode 100644
>> index 0000000000..d8234fd608
>> --- /dev/null
>> +++ b/gnu/packages/patches/asli-use-system-libs.patch
>> @@ -0,0 +1,70 @@
>> +diff --git a/CMakeLists.txt b/CMakeLists.txt
>> +index b11c5ba..702423e 100755
>
> Also, as suggested by ‘guix lint’, please add a comment at the top
> stating what this does and what the upstream status is (if it’s been
> submitted), at least something like:
>
> Tweak build system to use system dependencies instead of those that
> are bundled.
>
> Could you please send an updated patch?
>
> Thanks!
>
> Ludo’.
On 2022-08-29 17:21:43-04:00, Ludovic Courtès wrote:
> Hi Paul,
>
> Did you have a chance to look into this?
>
> Thanks in advance,
> Ludo’.
I've been busy with other things, but I should be able to take a look
this week.
Best regards,
Paul
@@ -858,6 +858,7 @@ dist_patch_DATA = \
%D%/packages/patches/antlr3-3_3-fix-java8-compilation.patch \
%D%/packages/patches/apr-skip-getservbyname-test.patch \
%D%/packages/patches/ark-skip-xar-test.patch \
+ %D%/packages/patches/asli-use-system-libs.patch \
%D%/packages/patches/aspell-default-dict-dir.patch \
%D%/packages/patches/ath9k-htc-firmware-binutils.patch \
%D%/packages/patches/ath9k-htc-firmware-gcc.patch \
@@ -2224,3 +2224,77 @@ (define-public mmg
@code{mmg3d} libraries.
@end itemize")
(license license:lgpl3+)))
+
+(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"))
+ (patches (search-patches "asli-use-system-libs.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ ;; Remove bundled libraries except (the ones missing from Guix 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.
+ #~(begin
+ ;;(delete-file-recursively "libs/AdaptTools") ; Missing from Guix
+ (delete-file-recursively "libs/CGAL")
+ ;;(delete-file-recursively "libs/alglib") ; Missing from Guix
+ (delete-file-recursively "libs/eigen")
+ (delete-file-recursively "libs/mmg")
+ ;;(delete-file-recursively "libs/tetgen") ; Missing from Guix
+ (delete-file-recursively "libs/yaml")))))
+ (build-system cmake-build-system)
+ (inputs
+ (list boost
+ cgal
+ eigen
+ gmp
+ `(,mmg "lib")
+ mpfr
+ tbb-2020
+ yaml-cpp))
+ (arguments
+ (list #:tests? #f ; No tests
+ #:configure-flags
+ #~(list "-DCGAL_ACTIVATE_CONCURRENT_MESH_3=ON"
+ (string-append "-DEIGEN3_INCLUDE_DIR="
+ #$(this-package-input "eigen")
+ "/include/eigen3")
+ (string-append "-DMMG_INCLUDE_DIR="
+ (ungexp (this-package-input "mmg") "lib")
+ "/include")
+ (string-append "-DMMG_LIBRARY_DIR="
+ (ungexp (this-package-input "mmg") "lib")
+ "/lib"))
+ #: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).
+ ;; Besides, some of the LaTeX packages it uses are
+ ;; missing from Guix, for example emptypage, fvextra and
+ ;; menukeys.
+ (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+)))
new file mode 100644
@@ -0,0 +1,70 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b11c5ba..702423e 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -122,28 +122,8 @@ if(MMG_MESH)
+ add_definitions(-DMMG_MESH)
+
+ # MMG
+- set(MMG_PREFIX mmg3d)
+- set(MMG_PREFIX_DIR ${CMAKE_CURRENT_BINARY_DIR}/${MMG_PREFIX})
+- set(MMG_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${MMG_PREFIX})
+- ExternalProject_Add(${MMG_PREFIX}
+- PREFIX ${MMG_PREFIX_DIR}
+- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/mmg
+-
+- BUILD_ALWAYS OFF
+- INSTALL_DIR ${MMG_INSTALL_DIR}
+-
+- CMAKE_ARGS(-DCMAKE_BUILD_TYPE=Release -DBUILD=MMG3D -DLIBMMG3D_STATIC=ON
+- -DLIBMMG3D_SHARED=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>)
+-
+- BUILD_COMMAND make
+- INSTALL_COMMAND make install
+- )
+- set(MMG3D_INCLUDE_DIRS "${MMG_INSTALL_DIR}/include")
+- set(MMG3D_LIBRARIES "${MMG_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${MMG_PREFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
+-
+- include_directories(${MMG3D_INCLUDE_DIRS})
+- #add_library(MMG3D STATIC IMPORTED)
+- #set_target_properties(MMG3D PROPERTIES IMPORTED_LOCATION "${MMG3D_LIBRARIES}")
++ include_directories(${MMG_INCLUDE_DIR})
++ set(MMG3D_LIBRARIES ${MMG_LIBRARY_DIR}/libmmg3d.so)
+
+ # MshMet
+ set(MSHMET_PREFIX mshmet)
+@@ -192,14 +172,8 @@ target_include_directories(tet PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/tetgen)
+ target_compile_definitions(tet PUBLIC TETLIBRARY) # -DTETLIBRARY: flag to compile tetgen as a library
+
+ # yaml
+-file(GLOB yaml_SRC CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/src/*.cpp) # Using file GLOB is not recomended!
+-add_library(yaml STATIC)
+-target_include_directories(yaml
+- PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/include
+- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/src
+-)
+-target_sources(yaml PRIVATE ${yaml_SRC})
+-set_target_properties(yaml PROPERTIES CXX_STANDARD 11)
++find_package(yaml-cpp REQUIRED)
++include_directories(${YAML_CPP_INCLUDE_DIRS})
+
+ # Compile options for debuging
+ if(CMAKE_BUILD_TYPE MATCHES Debug)
+@@ -259,7 +233,7 @@ if(MARCH_NATIVE)
+ endif()
+
+ # Create entries for C++ files in "ASLI" routine
+-target_link_libraries(ASLI PUBLIC alg tet yaml)
++target_link_libraries(ASLI PUBLIC alg tet ${YAML_CPP_LIBRARIES})
+ if(NOT MSVC)
+ target_link_libraries(ASLI PUBLIC stdc++fs)
+ endif()
+@@ -272,7 +246,7 @@ if(CGAL_MESH)
+ endif()
+
+ if(MMG_MESH)
+- add_dependencies(ASLI ${MMG_PREFIX} ${MSHMET_PREFIX})
++ add_dependencies(ASLI ${MSHMET_PREFIX})
+ target_link_libraries(ASLI PUBLIC ${MMG3D_LIBRARIES} ${MSHMET_LIBRARIES})
+ if(SCOTCH_FOUND)
+ target_link_libraries(ASLI PUBLIC ${SCOTCH_LIBRARIES} scotch)