summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Elsing <david.elsing@posteo.net>2022-10-13 21:04:23 +0000
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2022-10-15 12:05:15 +0200
commit175d1a0151e039a2124e9b3520c7922322659f56 (patch)
tree56419f1f20276c466629d2f5bf5bebbe5b159738
parenta3844f8a18c6ab28f000479a0ff0b372ceb3f33c (diff)
downloadguix-175d1a0151e039a2124e9b3520c7922322659f56.tar.gz
gnu: Add ringdecomposerlib.
* gnu/packages/chemistry.scm (ringdecomposerlib): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
-rw-r--r--gnu/packages/chemistry.scm80
1 files changed, 80 insertions, 0 deletions
diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index c13890001f..da65c90152 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -999,3 +999,83 @@ calculations and analyzing the results.")
 canonicalization of SMILES and MOL files, molecular structure fingerprinting
 and rendering molecules.")
     (license license:bsd-3)))
+
+(define-public ringdecomposerlib
+  (package
+    (name "ringdecomposerlib")
+    (version "1.1.3")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/rareylab/RingDecomposerLib")
+                    (commit (string-append "v" version "_rdkit"))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1rxzs2wpkkdi40wdzxc4sn0brk7dm7ivgqyfh38gf2f5c7pbg0wi"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "-DBUILD_PYTHON_WRAPPER=ON"
+              "-DPYTHON_EXECUTABLE=python3"
+              (string-append "-DPYTHON_FLAGS=;--prefix=" #$output ";--root=/"))
+      #:imported-modules (append %cmake-build-system-modules
+                                 '((guix build python-build-system)))
+      #:modules '((guix build cmake-build-system)
+                  (guix build utils)
+                  ((guix build python-build-system)
+                   #:select (add-installed-pythonpath)))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'configure 'patch-cmake
+            (lambda _
+              (substitute* (list "src/Test/CMakeLists.txt"
+                                 "src/RingDecomposerLib/CMakeLists.txt")
+                (("build_.*STATIC") "#"))
+              (substitute* "test/CMakeLists.txt"
+                (("STATIC_TEST") "SHARED_TEST"))
+              ;; Link Python library against shared library
+              (substitute* "src/python/CMakeLists.txt"
+                (("RingDecomposerLibStatic") "RingDecomposerLib"))
+              (substitute* "src/python/setup.py.in"
+                (("static_libs =.*") "static_libs = []\n")
+                (("shared_libs\\s*=.*")
+                 (string-append
+                  "shared_libs = ['RingDecomposerLib']"))
+                (("library_dirs\\s*=\\s*\\[\\]")
+                 "library_dirs = ['${CMAKE_BINARY_DIR}/src/RingDecomposerLib']")
+                (("extra_objects=.*")
+                 (string-append
+                  "extra_link_args=['-Wl,-rpath=" #$output "/lib'],\n")))))
+          (add-after 'build 'build-doc
+            (lambda _
+              ;; Disable redundant LaTeX documentation
+              (substitute* "../source/documentation/sphinx/conf.py"
+                (("^(subprocess.*latex|shutil).*") ""))
+              (substitute* "../source/documentation/doxygen.cfg"
+                (("GENERATE_LATEX.*YES") "GENERATE_LATEX = NO"))
+              ;; Build HTML documentation
+              (invoke "sphinx-build" "-b" "html"
+                      "../source/documentation/sphinx" "html")))
+          (add-after 'install 'install-doc
+            (lambda _
+              ;; Not reproducible
+              (delete-file-recursively "html/.doctrees")
+              (copy-recursively "html"
+                                (string-append #$output "/share/doc/"
+                                               #$name "-" #$version "/html"))))
+          (delete 'check)
+          (add-after 'install 'check
+            (assoc-ref %standard-phases 'check))
+          (add-before 'check 'set-pythonpath
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (add-installed-pythonpath inputs outputs))))))
+    (inputs (list python))
+    (native-inputs (list doxygen python python-cython python-sphinx))
+    (home-page "https://github.com/rareylab/RingDecomposerLib")
+    (synopsis "Calculate ring topology descriptions")
+    (description "RingDecomposerLib is a library for the calculation of
+unique ring families, relevant cycles, the smallest set of smallest rings and
+other ring topology descriptions.")
+    (license license:bsd-3)))