all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#58261] [PATCH 00/11] Add rdkit.
@ 2022-10-02 22:55 David Elsing
  2022-10-03  0:19 ` [bug#58261] [PATCH 01/11] gnu: Add fast-float David Elsing
                   ` (24 more replies)
  0 siblings, 25 replies; 87+ messages in thread
From: David Elsing @ 2022-10-02 22:55 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

Hello!

This patch series adds rdkit and its new dependencies.

Most optional components are enabled, except for the additional wrappers,
the "StructChecker" and the "compressed MolSuppliers".
All bundled software in External/ is unbundled and the included pickled data
(only used for a few tests) is removed.

freesasa is built as a shared library and the flex and bison files are generated.

For yaehmop-tightbind, I removed the transpiled Fortran->C files and built the
Fortran parts with GFortran instead.

gemmi included a patched version of sajson where numbers are kept as the
original strings, so I made a package variant and added a check for
sajson::TYPE_INTEGER in gemmi.
sajson also requires another small patch
(gnu/packages/patches/sajson-parse_flags-linking.patch) which I took from the
unmerged upstream pull request
https://github.com/chadaustin/sajson/pull/54/files, is that ok?

The packages were reproducible after two rounds (when setting the environment
variables as in python-build-system for rdkit), but I only built them on
x86_64 as emulation would take quite long.

David Elsing (11):
  gnu: Add fast-float.
  gnu: Add pocketfft.
  gnu: Add sajson.
  gnu: Add tinydir.
  gnu: Add optionparser.
  gnu: Add gemmi.
  gnu: Add freesasa.
  gnu: Add maeparser.
  gnu: Add coordgenlibs.
  gnu: Add yaehmop-tightbind.
  gnu: Add rdkit.

 gnu/packages/chemistry.scm                    | 531 ++++++++++++++++++
 gnu/packages/cpp.scm                          | 201 +++++++
 .../patches/gemmi-fix-sajson-types.patch      |  11 +
 .../rdkit-cmake-external-dependencies.patch   | 102 ++++
 .../sajson-for-gemmi-numbers-as-strings.patch | 195 +++++++
 .../patches/sajson-parse_flags-linking.patch  |  45 ++
 6 files changed, 1085 insertions(+)
 create mode 100644 gnu/packages/patches/gemmi-fix-sajson-types.patch
 create mode 100644 gnu/packages/patches/rdkit-cmake-external-dependencies.patch
 create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
 create mode 100644 gnu/packages/patches/sajson-parse_flags-linking.patch

-- 
2.37.0





^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 01/11] gnu: Add fast-float.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-04  6:57   ` Liliana Marie Prikler via Guix-patches via
  2022-10-03  0:19 ` [bug#58261] [PATCH 02/11] gnu: Add pocketfft David Elsing
                   ` (23 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (fast-float): New variable.
---
 gnu/packages/cpp.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index d03e0bc7e1..e597dba40c 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -29,6 +29,7 @@
 ;;; Copyright © 2022 muradm <mail@muradm.net>
 ;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
 ;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1907,3 +1908,26 @@ (define-public cpp-mustache
 templated string type for compatibility with any STL-like string (std::string,
 std::wstring, etc).")
     (license license:boost1.0)))
+
+(define-public fast-float
+  (package
+    (name "fast-float")
+    (version "3.5.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/fastfloat/fast_float")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0z3rxxd0pwvw70dbnv63rm67biw829vdqf50y16isxm6g3sbrz8g"))))
+    (build-system cmake-build-system)
+    (arguments
+     ;; Tests require downloading a lot of additional data
+     (list #:tests? #f))
+    (home-page "https://github.com/fastfloat/fast_float")
+    (synopsis "Fast and exact implementation of the C++ from_chars functions")
+    (description "@code{fast_float} is a header-only C++ library which provides fast
+implementations of the from_chars functions for float and double types.")
+    (license (list license:asl2.0 license:expat)))) ; dual licensed
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 02/11] gnu: Add pocketfft.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
  2022-10-03  0:19 ` [bug#58261] [PATCH 01/11] gnu: Add fast-float David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-04  7:09   ` Liliana Marie Prikler
  2022-10-03  0:19 ` [bug#58261] [PATCH 03/11] gnu: Add sajson David Elsing
                   ` (22 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (pocketfft): New variable.
---
 gnu/packages/cpp.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index e597dba40c..65df317100 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1931,3 +1931,29 @@ (define-public fast-float
     (description "@code{fast_float} is a header-only C++ library which provides fast
 implementations of the from_chars functions for float and double types.")
     (license (list license:asl2.0 license:expat)))) ; dual licensed
+
+(define-public pocketfft
+  (let ((commit "daa8bb18327bc5c7d22c69428c25cf5dc64167d3") (revision "0"))
+    (package
+      (name "pocketfft")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mreineck/pocketfft")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1dbkkqkmkxgmz1qjpsqzic5ig3qw1pqndbb3dvjc7xq5f2rdzyq1"))))
+      (build-system copy-build-system)
+      (arguments
+       (list
+        #:install-plan
+        #~'(("pocketfft_hdronly.h" "include/"))))
+      (home-page "https://github.com/mreineck/pocketfft")
+      (synopsis "Heavily modified implementation of FFTPack in C++")
+      (description "This package contains the single-header PocketFFT library,
+which is an reimplementation of FFTPack with several advantages, such as
+multidimensional algorithms, different datatypes and vector instructions.")
+      (license license:bsd-3))))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 03/11] gnu: Add sajson.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
  2022-10-03  0:19 ` [bug#58261] [PATCH 01/11] gnu: Add fast-float David Elsing
  2022-10-03  0:19 ` [bug#58261] [PATCH 02/11] gnu: Add pocketfft David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-04  7:22   ` Liliana Marie Prikler
  2022-10-03  0:19 ` [bug#58261] [PATCH 04/11] gnu: Add tinydir David Elsing
                   ` (21 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (sajson): New variable.
---
 gnu/packages/cpp.scm                          | 63 +++++++++++++++++++
 .../patches/sajson-parse_flags-linking.patch  | 45 +++++++++++++
 2 files changed, 108 insertions(+)
 create mode 100644 gnu/packages/patches/sajson-parse_flags-linking.patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 65df317100..7bfa3d6cdf 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -57,6 +57,7 @@ (define-module (gnu packages cpp)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system scons)
   #:use-module (guix modules)
   #:use-module (guix gexp)
   #:use-module (gnu packages)
@@ -1957,3 +1958,65 @@ (define-public pocketfft
 which is an reimplementation of FFTPack with several advantages, such as
 multidimensional algorithms, different datatypes and vector instructions.")
       (license license:bsd-3))))
+
+(define-public sajson
+  (let ((commit "ec644013e34f9984a3cc9ba568cab97a391db9cd") (revision "0"))
+    (package
+      (name "sajson")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/chadaustin/sajson")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (patches
+                 (search-patches "sajson-parse_flags-linking.patch"))
+                (sha256
+                 (base32
+                  "0fjag27w7gvkc5pdhq3ad7yc09rabpzahndw1sgsg04ipznidmmq"))
+                (modules '((guix build utils)))
+                (snippet '(delete-file-recursively "third-party"))))
+      (build-system scons-build-system)
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'disable-other-builds
+              (lambda _
+                (substitute* "SConstruct"
+                  (("for name, tools in builds:")
+                   "for name, tools in [('opt', [gcc, opt])]:"))
+                #t))
+            (add-after 'unpack 'use-external-unittest-cpp
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "SConscript"
+                  (("unittestpp_env\\.Library") "_dummy = ")
+                  (("test_env = env.Clone\\(tools=\\[unittestpp, sajson\\]\\)")
+                   (string-append
+                    "test_env = env.Clone(tools=[sajson])\n"
+                    "test_env.Append(CPPPATH='"
+                    (search-input-directory inputs "/include/UnitTest++")
+                    "', LIBPATH='"
+                    (string-append #$(this-package-native-input "unittest-cpp")
+                                   "/lib")
+                    "', LIBS=['UnitTest++'])")))
+                #t))
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (invoke "build/opt/test")
+                  (invoke "build/opt/test_unsorted"))
+                #t))
+            (replace 'install
+              (lambda _
+                (let ((out (string-append #$output "/include")))
+                  (install-file "include/sajson.h" out)
+                  (install-file "include/sajson_ostream.h" out))
+                #t)))))
+      (native-inputs (list unittest-cpp))
+      (home-page "https://github.com/chadaustin/sajson")
+      (synopsis "Lightweight, extremely high-performance JSON parser for C++11")
+      (description "sajson is a high-performance, in-place JSON parser
+header-only library.")
+      (license license:expat))))
diff --git a/gnu/packages/patches/sajson-parse_flags-linking.patch b/gnu/packages/patches/sajson-parse_flags-linking.patch
new file mode 100644
index 0000000000..878706dc79
--- /dev/null
+++ b/gnu/packages/patches/sajson-parse_flags-linking.patch
@@ -0,0 +1,45 @@
+This patch is from the upstream pull request
+https://github.com/chadaustin/sajson/pull/54.
+It fixes linking with GCC.
+
+diff --git a/include/sajson.h b/include/sajson.h
+index 8b4e05a..1bd045b 100644
+--- a/include/sajson.h
++++ b/include/sajson.h
+@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t, size_t value) {
+ // header. This trick courtesy of Rich Geldreich's Purple JSON parser.
+ template <typename unused = void>
+ struct globals_struct {
++    static const unsigned char parse_flags[256];
++};
++typedef globals_struct<> globals;
++
+ // clang-format off
+ 
+     // bit 0 (1) - set if: plain ASCII string character
+     // bit 1 (2) - set if: whitespace
+     // bit 4 (0x10) - set if: 0-9 e E .
+-    constexpr static const uint8_t parse_flags[256] = {
++    template <typename unused>
++    const unsigned char globals_struct<unused>::parse_flags[256] = {
+      // 0    1    2    3    4    5    6    7      8    9    A    B    C    D    E    F
+         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,   2,   0,   0,   2,   0,   0, // 0
+         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,   0,   0,   0,   0,   0,   0, // 1
+@@ -162,15 +167,13 @@ struct globals_struct {
+     };
+ 
+ // clang-format on
+-};
+-typedef globals_struct<> globals;
+ 
+-constexpr inline bool is_plain_string_character(char c) {
++inline bool is_plain_string_character(char c) {
+     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
+     return (globals::parse_flags[static_cast<unsigned char>(c)] & 1) != 0;
+ }
+ 
+-constexpr inline bool is_whitespace(char c) {
++inline bool is_whitespace(char c) {
+     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
+     return (globals::parse_flags[static_cast<unsigned char>(c)] & 2) != 0;
+ }
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 04/11] gnu: Add tinydir.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (2 preceding siblings ...)
  2022-10-03  0:19 ` [bug#58261] [PATCH 03/11] gnu: Add sajson David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-04  7:27   ` Liliana Marie Prikler
  2022-10-03  0:19 ` [bug#58261] [PATCH 05/11] gnu: Add optionparser David Elsing
                   ` (20 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (tinydir): New variable.
---
 gnu/packages/cpp.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 7bfa3d6cdf..4819f36052 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2020,3 +2020,41 @@ (define-public sajson
       (description "sajson is a high-performance, in-place JSON parser
 header-only library.")
       (license license:expat))))
+
+(define-public tinydir
+  (package
+    (name "tinydir")
+    (version "1.2.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/cxong/tinydir")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
+              (modules '((guix build utils)))
+              (snippet '(delete-file-recursively "tests/cbehave"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      ;; Tests require cbehave and rlutil
+      #:tests? #f
+      #:phases
+      ;; Build samples instead of tests
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _ (chdir "samples") #t))
+          (add-after 'build 'chdir-back
+            (lambda _ (chdir "..") #t))
+          (replace 'install
+            (lambda _
+              (install-file "tinydir.h" (string-append #$output "/include"))
+              #t)))))
+    (home-page "https://github.com/cxong/tinydir")
+    (synopsis "Lightweight, portable and easy to integrate C directory and
+file reader")
+    (description "tinydir is a header-only C library to portably read files
+and directories.")
+    (license license:bsd-2)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 05/11] gnu: Add optionparser.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (3 preceding siblings ...)
  2022-10-03  0:19 ` [bug#58261] [PATCH 04/11] gnu: Add tinydir David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-04  7:42   ` Liliana Marie Prikler
  2022-10-03  0:19 ` [bug#58261] [PATCH 06/11] gnu: Add gemmi David Elsing
                   ` (19 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (optionparser): New variable.
---
 gnu/packages/cpp.scm | 50 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 4819f36052..b30205109e 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2058,3 +2058,53 @@ (define-public tinydir
     (description "tinydir is a header-only C library to portably read files
 and directories.")
     (license license:bsd-2)))
+
+(define-public optionparser
+  (package
+    (name "optionparser")
+    (version "1.7")
+    (source (origin
+              (method url-fetch)
+              (uri
+               (string-append "mirror://sourceforge/optionparser/optionparser-"
+                              version ".tar.gz"))
+              (sha256
+               (base32
+                "04gfxrdzwacaynb8scsz6rr7nh64n6yk6w9dh2qdhrxw4caqr0dk"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure)
+          (add-before 'build 'chdir
+            (lambda _ (chdir "src") #t))
+          (replace 'build
+            (lambda _
+              (invoke "make" "-j" (number->string (parallel-job-count))
+                      "example_arg" "testparse" "testprintusage" "testodr"
+                      "example")
+              #t))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (if tests?
+                  (begin
+                    (invoke "./example_arg")
+                    (invoke "./testparse")
+                    (invoke "./testprintusage")
+                    (invoke "./testodr")
+                    (invoke "./example"))
+                  (format #t "test suite not run~%"))))
+          (replace 'install
+            (lambda _
+              (install-file "optionparser.h" (string-append #$output "/include"))
+              #t))
+          (add-after 'install 'chdir-back
+            (lambda _ (chdir "..") #t)))))
+    (home-page "https://optionparser.sourceforge.net/")
+    (synopsis "Header-only C++ library to parse command line options")
+    (description "The Lean Mean C++ Option Parser handles the program's
+command line arguments (argc, argv).  It supports the short and long option
+formats of getopt(), getopt_long() and getopt_long_only() but has a more
+convenient interface.")
+    (license license:expat)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 06/11] gnu: Add gemmi.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (4 preceding siblings ...)
  2022-10-03  0:19 ` [bug#58261] [PATCH 05/11] gnu: Add optionparser David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-04  7:49   ` Liliana Marie Prikler
  2022-10-03  0:19 ` [bug#58261] [PATCH 07/11] gnu: Add freesasa David Elsing
                   ` (18 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (gemmi): New variable.
---
 gnu/packages/chemistry.scm                    | 122 +++++++++++
 .../patches/gemmi-fix-sajson-types.patch      |  11 +
 .../sajson-for-gemmi-numbers-as-strings.patch | 195 ++++++++++++++++++
 3 files changed, 328 insertions(+)
 create mode 100644 gnu/packages/patches/gemmi-fix-sajson-types.patch
 create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index c517610fe8..f8fd85814f 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -23,6 +24,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages chemistry)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix utils)
   #:use-module ((guix licenses) #:prefix license:)
@@ -35,6 +37,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cpp)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gl)
@@ -50,8 +53,10 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages stb)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python))
 
@@ -566,3 +571,120 @@ (define-public python-pymol
 used to prepare publication-quality figures, to share interactive results with
 your colleagues, or to generate pre-rendered animations.")
     (license license:bsd-3)))
+
+(define sajson-for-gemmi
+  (package/inherit sajson
+    (name "sajson-for-gemmi")
+    (source (origin
+              (inherit (package-source sajson))
+              (patches (cons
+                        (search-patch
+                         "sajson-for-gemmi-numbers-as-strings.patch")
+                        (origin-patches (package-source sajson))))))
+    (build-system copy-build-system)
+    (arguments
+     (list
+      #:install-plan
+      #~'(("include/sajson.h" "include/")
+          ("include/sajson_ostream.h" "include/"))))))
+
+(define-public gemmi
+  (package
+    (name "gemmi")
+    (version "0.5.7")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/project-gemmi/gemmi")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "00km5q726bslrw7xbfwb3f3mrsk19qbimfnl3hvr4wi1y3z8i18a"))
+              (patches
+               (search-patches "gemmi-fix-sajson-types.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (delete-file-recursively "include/gemmi/third_party")
+                  (delete-file-recursively "third_party")
+                  #t))))
+    (build-system cmake-build-system)
+    (native-inputs (list optionparser pybind11))
+    (propagated-inputs
+     (list fast-float
+           pocketfft
+           sajson-for-gemmi
+           stb-sprintf
+           pegtl
+           tinydir))
+    (inputs (list zlib python))
+    (outputs '("out" "bin" "python"))
+    (arguments
+     (list
+      #:configure-flags
+      #~(let* ((python-lib
+                (string-append
+                 #$output:python "/lib/python"
+                 #$(version-major+minor (package-version python))
+                 "/site-packages")))
+          (list "-DUSE_PYTHON=ON"
+                (string-append "-DPYTHON_INSTALL_DIR=" python-lib)))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-includes
+            (lambda _
+              (substitute* "include/gemmi/sprintf.hpp"
+                (("<stb/stb_sprintf.h>") "<stb_sprintf.h>"))
+              (substitute* "include/gemmi/dirwalk.hpp"
+                (("\"third_party/tinydir.h\"") "<tinydir.h>"))
+              (substitute* "include/gemmi/cif.hpp"
+                (("\"third_party/tao/pegtl.hpp\"") "<tao/pegtl.hpp>"))
+              (substitute* "include/gemmi/json.hpp"
+                (("\"third_party/sajson.h\"") "<sajson.h>"))
+              (substitute* "python/gemmi.cpp"
+                (("\"gemmi/third_party/tao/pegtl/parse_error.hpp\"")
+                 "<tao/pegtl/parse_error.hpp>"))
+              (substitute* '("include/gemmi/atof.hpp"
+                             "include/gemmi/numb.hpp")
+                (("\"third_party/fast_float.h\"")
+                 "<fast_float/fast_float.h>"))
+              (substitute* "include/gemmi/fourier.hpp"
+                (("\"third_party/pocketfft_hdronly.h\"")
+                 "<pocketfft_hdronly.h>"))
+              #t))
+          (add-after 'patch-includes 'patch-cif
+            (lambda _
+              (substitute* "include/gemmi/cif.hpp"
+                (((string-append
+                   "^.*using analyze_t = pegtl::analysis::generic"
+                   "<pegtl::analysis::rule_type::ANY>;.*$")) "")
+                (("TAOCPP_PEGTL_") "TAO_PEGTL_"))
+              #t))
+          (add-after 'unpack 'change-bin-prefix
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("install\\(TARGETS program DESTINATION bin\\)")
+                 (string-append
+                  "install(TARGETS program DESTINATION "
+                  #$output:bin "/bin)")))
+              #t))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (with-directory-excursion "../source"
+                  (setenv "PYTHONPATH" "../build")
+                  (invoke "python3" "-m" "unittest" "discover" "-v"
+                          "-s" "tests"))))))))
+    (home-page "https://gemmi.readthedocs.io/en/latest/")
+    (synopsis "Macromolecular crystallography library and utilities")
+    (description "GEMMI is a C++ library for macromolecular crystallography.
+It can be used for working with
+@enumerate
+@item macromolecular models (content of PDB, PDBx/mmCIF and mmJSON files),
+@item refinement restraints (CIF files),
+@item reflection data (MTZ and mmCIF formats),
+@item data on a 3D grid (electron density maps, masks, MRC/CCP4 format)
+@item crystallographic symmetry.
+@end enumerate")
+    (license license:mpl2.0)))
diff --git a/gnu/packages/patches/gemmi-fix-sajson-types.patch b/gnu/packages/patches/gemmi-fix-sajson-types.patch
new file mode 100644
index 0000000000..9633ddac8b
--- /dev/null
+++ b/gnu/packages/patches/gemmi-fix-sajson-types.patch
@@ -0,0 +1,11 @@
+diff -ur a/include/gemmi/json.hpp b/include/gemmi/json.hpp
+--- a/include/gemmi/json.hpp
++++ b/include/gemmi/json.hpp
+@@ -38,6 +38,7 @@
+ 
+ inline std::string as_cif_value(const sajson::value& val) {
+   switch (val.get_type()) {
++    case sajson::TYPE_INTEGER:
+     case sajson::TYPE_DOUBLE:
+       return val.as_string();
+     case sajson::TYPE_NULL:
diff --git a/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
new file mode 100644
index 0000000000..6f476b8583
--- /dev/null
+++ b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
@@ -0,0 +1,195 @@
+Patch for gemmi: Keep numbers in JSON file as strings.
+
+Adapted from this commit of the bundled fork of sajson in gemmi:
+https://github.com/project-gemmi/gemmi/commit/fccbca4f6040364ba708613e1429c2251872240d
+
+diff -ur a/include/sajson.h b/include/sajson.h
+--- a/include/sajson.h
++++ b/include/sajson.h
+@@ -411,43 +411,6 @@
+ };
+ } // namespace internal
+ 
+-namespace integer_storage {
+-enum { word_length = 1 };
+-
+-inline int load(const size_t* location) {
+-    int value;
+-    memcpy(&value, location, sizeof(value));
+-    return value;
+-}
+-
+-inline void store(size_t* location, int value) {
+-    // NOTE: Most modern compilers optimize away this constant-size
+-    // memcpy into a single instruction. If any don't, and treat
+-    // punning through a union as legal, they can be special-cased.
+-    static_assert(
+-        sizeof(value) <= sizeof(*location),
+-        "size_t must not be smaller than int");
+-    memcpy(location, &value, sizeof(value));
+-}
+-} // namespace integer_storage
+-
+-namespace double_storage {
+-enum { word_length = sizeof(double) / sizeof(size_t) };
+-
+-inline double load(const size_t* location) {
+-    double value;
+-    memcpy(&value, location, sizeof(double));
+-    return value;
+-}
+-
+-inline void store(size_t* location, double value) {
+-    // NOTE: Most modern compilers optimize away this constant-size
+-    // memcpy into a single instruction. If any don't, and treat
+-    // punning through a union as legal, they can be special-cased.
+-    memcpy(location, &value, sizeof(double));
+-}
+-} // namespace double_storage
+-
+ /// Represents a JSON value.  First, call get_type() to check its type,
+ /// which determines which methods are available.
+ ///
+@@ -585,70 +548,10 @@
+         return length;
+     }
+ 
+-    /// If a numeric value was parsed as a 32-bit integer, returns it.
+-    /// Only legal if get_type() is TYPE_INTEGER.
+-    int get_integer_value() const {
+-        assert_tag(tag::integer);
+-        return integer_storage::load(payload);
+-    }
+-
+-    /// If a numeric value was parsed as a double, returns it.
+-    /// Only legal if get_type() is TYPE_DOUBLE.
+-    double get_double_value() const {
+-        assert_tag(tag::double_);
+-        return double_storage::load(payload);
+-    }
+-
+-    /// Returns a numeric value as a double-precision float.
+-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
+-    double get_number_value() const {
+-        assert_tag_2(tag::integer, tag::double_);
+-        if (value_tag == tag::integer) {
+-            return get_integer_value();
+-        } else {
+-            return get_double_value();
+-        }
+-    }
+-
+-    /// Returns true and writes to the output argument if the numeric value
+-    /// fits in a 53-bit integer.  This is useful for timestamps and other
+-    /// situations where integral values with greater than 32-bit precision
+-    /// are used, as 64-bit values are not understood by all JSON
+-    /// implementations or languages.
+-    /// Returns false if the value is not an integer or not in range.
+-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
+-    bool get_int53_value(int64_t* out) const {
+-        // Make sure the output variable is always defined to avoid any
+-        // possible situation like
+-        // https://gist.github.com/chadaustin/2c249cb850619ddec05b23ca42cf7a18
+-        *out = 0;
+-
+-        assert_tag_2(tag::integer, tag::double_);
+-        switch (value_tag) {
+-        case tag::integer:
+-            *out = get_integer_value();
+-            return true;
+-        case tag::double_: {
+-            double v = get_double_value();
+-            if (v < -(1LL << 53) || v > (1LL << 53)) {
+-                return false;
+-            }
+-            int64_t as_int = static_cast<int64_t>(v);
+-            if (as_int != v) {
+-                return false;
+-            }
+-            *out = as_int;
+-            return true;
+-        }
+-        default:
+-            return false;
+-        }
+-    }
+-
+     /// Returns the length of the string.
+     /// Only legal if get_type() is TYPE_STRING.
+     size_t get_string_length() const {
+-        assert_tag(tag::string);
++        assert_tag_3(tag::string, tag::integer, tag::double_);
+         return payload[1] - payload[0];
+     }
+ 
+@@ -659,7 +562,7 @@
+     /// embedded NULs.
+     /// Only legal if get_type() is TYPE_STRING.
+     const char* as_cstring() const {
+-        assert_tag(tag::string);
++        assert_tag_3(tag::string, tag::integer, tag::double_);
+         return text + payload[0];
+     }
+ 
+@@ -667,7 +570,7 @@
+     /// Returns a string's value as a std::string.
+     /// Only legal if get_type() is TYPE_STRING.
+     std::string as_string() const {
+-        assert_tag(tag::string);
++        assert_tag_3(tag::string, tag::integer, tag::double_);
+         return std::string(text + payload[0], text + payload[1]);
+     }
+ #endif
+@@ -690,6 +593,10 @@
+         assert(e1 == value_tag || e2 == value_tag);
+     }
+ 
++    void assert_tag_3(tag e1, tag e2, tag e3) const {
++        assert(e1 == value_tag || e2 == value_tag || e3 == value_tag);
++    }
++
+     void assert_in_bounds(size_t i) const { assert(i < get_length()); }
+ 
+     const tag value_tag;
+@@ -2059,6 +1966,8 @@
+     std::pair<char*, internal::tag> parse_number(char* p) {
+         using internal::tag;
+ 
++	size_t start = p - input.get_data();
++
+         // Assume 32-bit, two's complement integers.
+         static constexpr unsigned RISKY = INT_MAX / 10u;
+         unsigned max_digit_after_risky = INT_MAX % 10u;
+@@ -2235,23 +2144,18 @@
+                 u = 0u - u;
+             }
+         }
++
++        bool success;
++        size_t* out = allocator.reserve(2, &success);
++        if (SAJSON_UNLIKELY(!success)) {
++            return std::make_pair(oom(p, "number"), tag::null);
++        }
++        out[0] = start;
++        out[1] = p - input.get_data();
++
+         if (try_double) {
+-            bool success;
+-            size_t* out
+-                = allocator.reserve(double_storage::word_length, &success);
+-            if (SAJSON_UNLIKELY(!success)) {
+-                return std::make_pair(oom(p, "double"), tag::null);
+-            }
+-            double_storage::store(out, d);
+             return std::make_pair(p, tag::double_);
+         } else {
+-            bool success;
+-            size_t* out
+-                = allocator.reserve(integer_storage::word_length, &success);
+-            if (SAJSON_UNLIKELY(!success)) {
+-                return std::make_pair(oom(p, "integer"), tag::null);
+-            }
+-            integer_storage::store(out, static_cast<int>(u));
+             return std::make_pair(p, tag::integer);
+         }
+     }
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 07/11] gnu: Add freesasa.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (5 preceding siblings ...)
  2022-10-03  0:19 ` [bug#58261] [PATCH 06/11] gnu: Add gemmi David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-04  8:02   ` Liliana Marie Prikler
  2022-10-03  0:19 ` [bug#58261] [PATCH 08/11] gnu: Add maeparser David Elsing
                   ` (17 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (freesasa): New variable.
---
 gnu/packages/chemistry.scm | 81 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index f8fd85814f..223a27a20d 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -34,11 +34,13 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
+  #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages graphviz)
@@ -54,6 +56,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages stb)
+  #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
@@ -688,3 +691,81 @@ (define-public gemmi
 @item crystallographic symmetry.
 @end enumerate")
     (license license:mpl2.0)))
+
+(define-public freesasa
+  (package
+    (name "freesasa")
+    (version "2.1.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/mittinatten/freesasa")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "07wdnahf3g355ryaiqvfxd5f4rl54wv8jwxcbn0nia89fqysbv0f"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Remove C files generated by Flex and Bison
+                  (for-each delete-file
+                            '("src/parser.c" "src/parser.h"
+                              "src/lexer.c" "src/lexer.h"))
+                  #t))))
+    (build-system gnu-build-system)
+    (inputs
+     (list gemmi json-c libxml2))
+    (native-inputs
+     (list bison flex check autoconf automake pkg-config doxygen perl libtool))
+    (outputs '("out" "doc"))
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "--enable-check"
+              "--enable-parser-generator"
+              "CXXFLAGS=-std=c++17"
+              "--enable-doxygen")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'remove-libc++-linking
+            (lambda _
+              (substitute* "src/Makefile.am"
+                (("-lc\\+\\+") ""))
+              #t))
+          (add-after 'unpack 'build-shared-library
+            (lambda _
+              (substitute* "src/Makefile.am"
+                (("lib_LIBRARIES") "lib_LTLIBRARIES")
+                (("libfreesasa\\.a") "libfreesasa.la")
+                (("freesasa_LDADD \\+= libfreesasa\\.la" prev)
+                 (string-append prev "\nlibfreesasa_la_LIBADD"
+                                " = -ljson-c ${libxml2_LIBS}\n"))
+                (("_a_SOURCES") "_la_SOURCES"))
+              (substitute* "configure.ac"
+                (("AC_PROG_INSTALL" inst)
+                 (string-append "AM_PROG_LIBTOOL\n" inst)))
+              (substitute* "tests/Makefile.am"
+                (("libfreesasa\\.a") "libfreesasa.la"))
+              #t))
+          (add-before 'build 'build-lexer-and-parser
+            (lambda _
+              (with-directory-excursion "src"
+                (invoke "make" "lexer.h")
+                (invoke "make" "parser.h"))
+              #t))
+          (add-after 'install 'install-doc
+            (lambda _
+              (copy-recursively
+               "doc/html"
+               (string-append #$output:doc "/share/doc/" #$name "-" #$version))
+              #t)))))
+    (home-page "https://freesasa.github.io/")
+    (synopsis "Library for calculating the solvent accessible surface area
+(SASA) of molecules")
+    (description "FreeSASA is a command line tool and C-library for
+calculating solvent accessible surface areas (SASA).  By default Lee &
+Richards' algorithm is used, but Shrake & Rupley's is also available.  Both can
+be parameterized to arbitrary precision, and for high resolution versions of
+the algorithms, the calculations give identical results.")
+    (license license:expat)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 08/11] gnu: Add maeparser.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (6 preceding siblings ...)
  2022-10-03  0:19 ` [bug#58261] [PATCH 07/11] gnu: Add freesasa David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-03  0:19 ` [bug#58261] [PATCH 09/11] gnu: Add coordgenlibs David Elsing
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (maeparser): New variable.
---
 gnu/packages/chemistry.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 223a27a20d..4d8ce66230 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -769,3 +769,24 @@ (define-public freesasa
 be parameterized to arbitrary precision, and for high resolution versions of
 the algorithms, the calculations give identical results.")
     (license license:expat)))
+
+(define-public maeparser
+  (package
+    (name "maeparser")
+    (version "1.3.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/schrodinger/maeparser")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1yv4y5hn49fhylziigsg922bb244lb57p69r7vg9q899zd3l5b7l"))))
+    (build-system cmake-build-system)
+    (native-inputs (list boost))
+    (inputs (list zlib))
+    (home-page "https://github.com/schrodinger/maeparser")
+    (synopsis "Maestro file parser")
+    (description "maeparser is a parser for Schrodinger Maestro files.")
+    (license license:expat)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 09/11] gnu: Add coordgenlibs.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (7 preceding siblings ...)
  2022-10-03  0:19 ` [bug#58261] [PATCH 08/11] gnu: Add maeparser David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-03  0:19 ` [bug#58261] [PATCH 10/11] gnu: Add yaehmop-tightbind David Elsing
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (coordgenlibs): New variable.
---
 gnu/packages/chemistry.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 4d8ce66230..cc26aa329a 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -790,3 +790,30 @@ (define-public maeparser
     (synopsis "Maestro file parser")
     (description "maeparser is a parser for Schrodinger Maestro files.")
     (license license:expat)))
+
+(define-public coordgenlibs
+  (package
+    (name "coordgenlibs")
+    (version "3.0.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/schrodinger/coordgenlibs/")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0d09x3v38i9y184bml020bq7xizdrdwng38qmdxlplzfhqkjdidv"))))
+    (build-system cmake-build-system)
+    (native-inputs (list boost))
+    (inputs (list maeparser))
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "-DCOORDGEN_RIGOROUS_BUILD=OFF"
+              "-DCOORDGEN_USE_MAEPARSER=ON")))
+    (home-page "https://github.com/schrodinger/coordgenlibs/")
+    (synopsis "2D coordinate generation")
+    (description "@code{coordgenlibs} contains algorithms to generate 2D
+coordinates.  It has an emphasis on quality rather than speed.")
+    (license license:bsd-3)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 10/11] gnu: Add yaehmop-tightbind.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (8 preceding siblings ...)
  2022-10-03  0:19 ` [bug#58261] [PATCH 09/11] gnu: Add coordgenlibs David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-04  7:54   ` Liliana Marie Prikler
  2022-10-03  0:19 ` [bug#58261] [PATCH 11/11] gnu: Add rdkit David Elsing
                   ` (14 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
---
 gnu/packages/chemistry.scm | 82 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index cc26aa329a..a39deff4bf 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gv)
@@ -817,3 +818,84 @@ (define-public coordgenlibs
     (description "@code{coordgenlibs} contains algorithms to generate 2D
 coordinates.  It has an emphasis on quality rather than speed.")
     (license license:bsd-3)))
+
+(define-public yaehmop-tightbind
+  (package
+    (name "yaehmop-tightbind")
+    (version "2022.09.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/greglandrum/yaehmop")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (delete-file-recursively "docs")
+                  (delete-file-recursively "examples")
+                  (delete-file-recursively "viewkel")
+                  (delete-file-recursively "tightbind/f2c_files")
+                  (delete-file "tightbind/diag.c")
+                  (delete-file "tightbind/cboris.c")
+                  (delete-file "tightbind/abfns.c")
+                  (delete-file "tightbind/lovlap.c")
+                  #t))))
+    (build-system cmake-build-system)
+    (native-inputs (list gfortran))
+    (inputs (list openblas))
+    (arguments
+     (list
+      #:configure-flags
+      #~(list
+         "-DUSE_BLAS_LAPACK=ON"
+         (string-append "-DPARM_FILE_LOC=" #$output
+                        "/share/" #$name "-" #$version "/eht_parms.dat")
+         "-DBIND_EXE_NAME=yaehmop-bind")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _
+              (chdir "tightbind")
+              #t))
+          (add-after 'chdir 'patch-fortran-functions
+            (lambda _
+              (substitute* '("mov.c" "prototypes.h")
+                (("lovlap\\(") "lovlap_(")
+                (("abfns\\(") "abfns_("))
+              #t))
+          (add-after 'chdir 'patch-cmake
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("project\\(yaehmop C\\)") "project(yaehmop C Fortran)")
+                (("abfns.c") "fortran77/abfns.f")
+                (("lovlap.c") "fortran77/lovlap.f")
+                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
+                 (string-append init " CACHE STRING \"\")"))
+                (("add_library\\(yaehmop_eht" lib)
+                 (string-append lib " SHARED "))
+                (("target_link_libraries\\(test_eht \\$\\{LAPACK_LIBRARIES\\}.*"
+                  all)
+                 (string-append all "\ntarget_link_libraries(yaehmop_eht "
+                                "${LAPACK_LIBRARIES})\n")))
+              #t))
+          (add-after 'install 'install-eht-parms
+            (lambda _
+              (install-file "../tightbind/eht_parms.dat"
+                            (string-append #$output "/share/"
+                                           #$name "-" #$version))
+              #t))
+          (delete 'check)
+          (add-after 'install-eht-parms 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "./test_eht"))
+              #t)))))
+    (home-page "https://github.com/greglandrum/yaehmop")
+    (synopsis "Yet Another extended Hueckel Molecular Orbital Package")
+    (description "@code{YAeHMOP} contains a program and library for performing
+extended Hückel calculations.")
+    (license license:bsd-2)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 11/11] gnu: Add rdkit.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (9 preceding siblings ...)
  2022-10-03  0:19 ` [bug#58261] [PATCH 10/11] gnu: Add yaehmop-tightbind David Elsing
@ 2022-10-03  0:19 ` David Elsing
  2022-10-04  8:13   ` Liliana Marie Prikler
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                   ` (13 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-03  0:19 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (rdkit): New variable.
---
 gnu/packages/chemistry.scm                    | 198 ++++++++++++++++++
 .../rdkit-cmake-external-dependencies.patch   | 102 +++++++++
 2 files changed, 300 insertions(+)
 create mode 100644 gnu/packages/patches/rdkit-cmake-external-dependencies.patch

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index a39deff4bf..869cf264e3 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -34,6 +34,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
@@ -41,10 +42,12 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
+  #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages graphviz)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages image)
   #:use-module (gnu packages maths)
@@ -56,6 +59,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages sqlite)
   #:use-module (gnu packages stb)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
@@ -899,3 +903,197 @@ (define-public yaehmop-tightbind
     (description "@code{YAeHMOP} contains a program and library for performing
 extended Hückel calculations.")
     (license license:bsd-2)))
+
+(define-public rdkit
+  (package
+    (name "rdkit")
+    (version "2022.03.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/rdkit/rdkit")
+                    (commit
+                     (string-append
+                      "Release_" (string-replace-substring version "." "_")))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "19idgilabh04cbr1qj6zgrgsfjm248mmfz6fsr0smrd68d0xnml9"))
+              (patches
+               (search-patches "rdkit-cmake-external-dependencies.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               #~(begin
+                   ;; Remove pickle files (only used in tests),
+                   ;; as they are compiled programs
+                   (for-each
+                    (lambda (name)
+                      (display (string-append name "\n"))
+                      (delete-file name))
+                    (find-files "." "\\.pkl(\\.gz)?$"))
+                   ;; Remove SQLite data files (can be generated)
+                   (delete-file "Data/RDData.sqlt")
+                   (delete-file "Data/RDTests.sqlt")
+                   #t))))
+    (build-system cmake-build-system)
+    (native-inputs
+     `(("bison" ,bison)
+       ("boost" ,boost)
+       ("catch2" ,catch2)
+       ("eigen" ,eigen)
+       ("flex" ,flex)
+       ("freesasa" ,freesasa)
+       ("pkg-config" ,pkg-config)
+       ("rapidjson" ,rapidjson)
+       ("tar" ,tar)
+       ("avalontoolkit-src"
+        ,(let ((version "1.2.0"))
+           (origin
+             (method url-fetch)
+             (uri (string-append
+                   "http://sourceforge.net/projects/avalontoolkit/files/"
+                   "AvalonToolkit_" (substring version 0 3) "/AvalonToolkit_"
+                   version ".source.tar"))
+             (sha256
+              (base32
+               "0rnnyy6axs2da7aa4q6l30ldavbk49v6l22llj1adn74h1i67bpv"))
+             (modules '((guix build utils) (ice-9 ftw) (srfi srfi-26)))
+             (snippet
+              #~(begin
+                  (chdir "..")
+                  (delete-file-recursively "StandardFiles")
+                  (delete-file-recursively "SourceDistribution/java")
+                  #t)))))
+       ("ringdecomposerlib-src"
+        ,(let ((version "1.1.3"))
+           (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")))))))
+    (inputs
+     (list cairo
+           coordgenlibs
+           font-comic-neue
+           freetype
+           inchi
+           maeparser
+           python
+           sqlite
+           yaehmop-tightbind))
+    (propagated-inputs
+     (list python-numpy python-cairocffi python-pillow))
+    (arguments
+     (list
+      #: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)))
+      #:configure-flags
+      #~(list
+         "-DRDK_BUILD_AVALON_SUPPORT=ON"
+         "-DRDK_BUILD_CAIRO_SUPPORT=ON"
+         "-DRDK_BUILD_CPP_TESTS=ON"
+         "-DRDK_BUILD_FREESASA_SUPPORT=ON"
+         "-DRDK_BUILD_INCHI_SUPPORT=ON"
+         "-DRDK_BUILD_YAEHMOP_SUPPORT=ON"
+         (string-append "-DCATCH_DIR="
+                        #$(this-package-native-input "catch2")
+                        "/include/catch2")
+         "-DRDK_INSTALL_DEV_COMPONENT=ON"
+         "-DRDK_INSTALL_INTREE=OFF"
+         "-DRDK_INSTALL_STATIC_LIBS=OFF"
+         (string-append
+          "-DRDK_OPTIMIZE_POPCNT="
+          #$(let ((system (or (%current-target-system)
+                              (%current-system))))
+              (cond
+               ((string-prefix? "x86_64" system) "ON")
+               ((string-prefix? "i686" system) "ON")
+               (else "OFF"))))
+         "-DRDK_USE_BOOST_IOSTREAMS=ON"
+         "-DRDK_USE_FLEXBISON=ON")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'copy-external-dependencies
+            (lambda _
+              (symlink
+               (string-append
+                #$(this-package-input "font-comic-neue")
+                "/share/fonts/truetype/ComicNeue-Regular.ttf")
+               "Data/Fonts/ComicNeue-Regular.ttf")
+              (symlink #$(this-package-native-input "rapidjson")
+                       "External/rapidjson-1.1.0")
+              (invoke "tar" "xvf"
+                      #$(this-package-native-input "avalontoolkit-src")
+                      "-C" "External/AvalonTools")
+              (symlink #$(this-package-native-input "ringdecomposerlib-src")
+                       "External/RingFamilies/RingDecomposerLib")
+              #t))
+          (add-after 'copy-external-dependencies 'patch-source
+            (lambda _
+              (with-directory-excursion "External/AvalonTools"
+                (invoke "patch" "-p0" "-i"
+                        "AvalonToolkit_1.2_patch.txt"))
+              (substitute* "External/YAeHMOP/EHTTools.cpp"
+                (("<yaehmop/tightbind/bind.h>") "<yaehmop/bind.h>"))
+              #t))
+          (add-after 'unpack 'create-sqlite-data-files
+            (lambda _
+              (invoke "sqlite3" "Data/RDData.sqlt"
+                      ".read rdkit/Dbase/test_data/RDData.sqlite")
+              (invoke "sqlite3" "Data/RDTests.sqlt"
+                      ".read rdkit/Dbase/test_data/RDTests.sqlite")
+              #t))
+          (add-after 'unpack 'fix-inchi-include
+            (lambda _
+              (substitute* "Code/cmake/Modules/FindInchi.cmake"
+                (("inchi_api.h.*\\)") "inchi/inchi_api.h)")
+                (("INCHI_LIBRARY NAMES.*\\)")
+                 "INCHI_LIBRARY NAMES inchi PATH_SUFFIXES inchi)")
+                (("find_library" prev)
+                 (string-append
+                  "list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.1)\n"
+                  prev)))
+              (substitute* "External/INCHI-API/inchi.cpp"
+                (("<inchi_api.h>") "<inchi/inchi_api.h>"))
+              #t))
+          (add-before 'build 'enable-bytecode-determinism
+              (lambda _
+                (setenv "PYTHONHASHSEED" "0")
+                (setenv "PYTHONDONTWRITEBYTECODE" "1")
+                #t))
+          (delete 'check)
+          (add-after 'install 'check
+            (lambda* (#:key inputs outputs tests? parallel-tests?
+                      #:allow-other-keys)
+              (when tests?
+                (let
+                    ((job-count (number->string
+                                 (or (and parallel-tests?
+                                          (parallel-job-count))
+                                     1))))
+                  (setenv "RDBASE" (canonicalize-path "../source"))
+                  (add-installed-pythonpath inputs outputs)
+                  (invoke "ctest"
+                          "-j" job-count
+                          "-E" (string-append
+                                ;; need pickled data
+                                "(pyDiscreteValueVect" "|pySparseIntVect"
+                                "|graphmoltestPickler" "|pyPartialCharges"
+                                "|substructLibraryTest" "|pyFeatures"
+                                "|pythonTestDirML" "|pythonTestDirChem"
+                                ;; Catching Python exception fails
+                                "|pyRanker)"))))
+              #t)))))
+    (home-page "https://rdkit.org/")
+    (synopsis "Open-Source Cheminformatics Software")
+    (description "RDKit is a collection of cheminformatics and
+machine-learning software written in C++ and Python.")
+    (license license:bsd-3)))
diff --git a/gnu/packages/patches/rdkit-cmake-external-dependencies.patch b/gnu/packages/patches/rdkit-cmake-external-dependencies.patch
new file mode 100644
index 0000000000..5b73864f51
--- /dev/null
+++ b/gnu/packages/patches/rdkit-cmake-external-dependencies.patch
@@ -0,0 +1,102 @@
+diff -ur a/External/FreeSASA/CMakeLists.txt b/External/FreeSASA/CMakeLists.txt
+--- a/External/FreeSASA/CMakeLists.txt
++++ b/External/FreeSASA/CMakeLists.txt
+@@ -10,7 +10,7 @@
+   endif()
+ endif()
+ 
+-if(needDownload)
++if(FALSE)
+   # don't actually use the md5 here
+   set(FREESASA_VERSION "2.0.3")
+   set(FREESASA_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/freesasa-${FREESASA_VERSION}")
+@@ -66,24 +66,24 @@
+ endif()
+ 
+ set (freesasa_h ${FREESASA_SRC_DIR}/src/freesasa.h)
+-file(READ ${freesasa_h} freesasa_h_data)
++#file(READ ${freesasa_h} freesasa_h_data)
+ string(REGEX REPLACE "(#include <stdio.h>)" "\\1\n#include <RDGeneral/export.h>" freesasa_h_data "${freesasa_h_data}")
+ string(REGEX REPLACE "([^R][^D][^K][^I][^T][^_][^F][^R][^E][^E][^S][^A][^S][^A][^_][^C][^L][^I][^B][^_][^E][^X][^P][^O][^R][^T][^ ])(extern const)" "\\1RDKIT_FREESASA_CLIB_EXPORT \\2" freesasa_h_data "${freesasa_h_data}")
+-file(WRITE ${freesasa_h} "${freesasa_h_data}")
++#file(WRITE ${freesasa_h} "${freesasa_h_data}")
+ 
+ add_definitions(-DUSE_THREADS=0)
+ add_definitions(-DUSE_JSON=0)
+ add_definitions(-DUSE_XML=0)
+-rdkit_library(freesasa_clib ${freesasa_clib_srcs})
+-target_compile_definitions(freesasa_clib PRIVATE RDKIT_FREESASALIB_BUILD)
++#rdkit_library(freesasa_clib ${freesasa_clib_srcs})
++#target_compile_definitions(freesasa_clib PRIVATE RDKIT_FREESASALIB_BUILD)
+ 
+ if((MSVC AND RDK_INSTALL_DLLS_MSVC) OR ((NOT MSVC) AND WIN32))
+   set_target_properties(freesasa_clib PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
+ endif()
+-include_directories("${FREESASA_SRC_DIR}/src")
++#include_directories("${FREESASA_SRC_DIR}/src")
+ 
+ rdkit_library(FreeSASALib RDFreeSASA.cpp SHARED 
+-    LINK_LIBRARIES freesasa_clib GraphMol )
++    LINK_LIBRARIES -lfreesasa GraphMol )
+ target_compile_definitions(FreeSASALib PRIVATE RDKIT_FREESASALIB_BUILD)
+ 
+ rdkit_headers(RDFreeSASA.h DEST GraphMol)
+diff -ur a/External/YAeHMOP/CMakeLists.txt b/External/YAeHMOP/CMakeLists.txt
+--- a/External/YAeHMOP/CMakeLists.txt
++++ b/External/YAeHMOP/CMakeLists.txt
+@@ -18,32 +18,32 @@
+ 
+ include_directories( ${RDKit_ExternalDir}/YAeHMOP )
+ 
+-ExternalProject_Add(yaehmop_project
+-  GIT_REPOSITORY https://github.com/greglandrum/yaehmop.git
+-  GIT_TAG master
+-  UPDATE_COMMAND ""
+-  PATCH_COMMAND ""
+-  PREFIX ${CMAKE_CURRENT_SOURCE_DIR}
+-  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop"
+-  SOURCE_SUBDIR "tightbind"
+-  CMAKE_ARGS -DUSE_BLAS_LAPACK=OFF -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+-  TEST_COMMAND "")
+-
+-include_directories(${PROJECT_BINARY_DIR}/include)
+-link_directories(${PROJECT_BINARY_DIR}/lib)
+-link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build)
+-
+-set(EHT_PARAM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind/eht_parms.dat )
+-install(FILES ${EHT_PARAM_FILE}
+-        DESTINATION ${RDKit_ShareDir}/Data
+-        COMPONENT data)
++#ExternalProject_Add(yaehmop_project
++#  GIT_REPOSITORY https://github.com/greglandrum/yaehmop.git
++#  GIT_TAG master
++#  UPDATE_COMMAND ""
++#  PATCH_COMMAND ""
++#  PREFIX ${CMAKE_CURRENT_SOURCE_DIR}
++#  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop"
++#  SOURCE_SUBDIR "tightbind"
++#  CMAKE_ARGS -DUSE_BLAS_LAPACK=OFF -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
++#  TEST_COMMAND "")
++
++#include_directories(${PROJECT_BINARY_DIR}/include)
++#link_directories(${PROJECT_BINARY_DIR}/lib)
++#link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build)
++
++#set(EHT_PARAM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind/eht_parms.dat )
++#install(FILES ${EHT_PARAM_FILE}
++#        DESTINATION ${RDKit_ShareDir}/Data
++#        COMPONENT data)
+ 
+-message("YAeHMOP include_dirs: ${PROJECT_BINARY_DIR}/include")
+-message("YAeHMOP link_dirs: ${PROJECT_BINARY_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build")
++#message("YAeHMOP include_dirs: ${PROJECT_BINARY_DIR}/include")
++#message("YAeHMOP link_dirs: ${PROJECT_BINARY_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build")
+ 
+-rdkit_library(EHTLib EHTTools.cpp SHARED LINK_LIBRARIES yaehmop_eht GraphMol )
++rdkit_library(EHTLib EHTTools.cpp SHARED LINK_LIBRARIES -lyaehmop_eht GraphMol )
+ target_compile_definitions(EHTLib PRIVATE RDKIT_EHTLIB_BUILD)
+-add_dependencies(EHTLib yaehmop_project)
++#add_dependencies(EHTLib yaehmop_project)
+ rdkit_headers(EHTTools.h DEST GraphMol)
+ rdkit_catch_test(testEHTLib1 test1.cpp
+            LINK_LIBRARIES EHTLib FileParsers SmilesParse )
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 01/11] gnu: Add fast-float.
  2022-10-03  0:19 ` [bug#58261] [PATCH 01/11] gnu: Add fast-float David Elsing
@ 2022-10-04  6:57   ` Liliana Marie Prikler via Guix-patches via
  2022-10-07 15:08     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler via Guix-patches via @ 2022-10-04  6:57 UTC (permalink / raw)
  To: David Elsing, 58261

Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (fast-float): New variable.
> ---
>  gnu/packages/cpp.scm | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index d03e0bc7e1..e597dba40c 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -29,6 +29,7 @@
>  ;;; Copyright © 2022 muradm <mail@muradm.net>
>  ;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
>  ;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
> +;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -1907,3 +1908,26 @@ (define-public cpp-mustache
>  templated string type for compatibility with any STL-like string
> (std::string,
>  std::wstring, etc).")
>      (license license:boost1.0)))
> +
> +(define-public fast-float
> +  (package
> +    (name "fast-float")
> +    (version "3.5.1")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/fastfloat/fast_float")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "0z3rxxd0pwvw70dbnv63rm67biw829vdqf50y16isxm6g3sbrz8g"))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     ;; Tests require downloading a lot of additional data
> +     (list #:tests? #f))
I'm not quite sure how much you mean by "a lot" – it seems to be one
repo [1], but more importantly, you could try to disable the tests that
require external fetches.
> +    (home-page "https://github.com/fastfloat/fast_float")
> +    (synopsis "Fast and exact implementation of the C++ from_chars
> functions")
I'd call this a "Floating point number parser" or if you prefer the
verb form "Parse floating point numbers".
> +    (description "@code{fast_float} is a header-only C++ library
> which provides fast
> +implementations of the from_chars functions for float and double
> types.")
"@code{fast_float} is a header-only C++ library for parsing floating
point numbers from strings."  If you want to mention its speed, add
"Benchmarks show that it is several times faster than strtod."
> +    (license (list license:asl2.0 license:expat)))) ; dual licensed
Weird choice, but okay.

Cheers





^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 02/11] gnu: Add pocketfft.
  2022-10-03  0:19 ` [bug#58261] [PATCH 02/11] gnu: Add pocketfft David Elsing
@ 2022-10-04  7:09   ` Liliana Marie Prikler
  2022-10-07 15:10     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-04  7:09 UTC (permalink / raw)
  To: David Elsing, 58261

Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (pocketfft): New variable.
> ---
>  gnu/packages/cpp.scm | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index e597dba40c..65df317100 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -1931,3 +1931,29 @@ (define-public fast-float
>      (description "@code{fast_float} is a header-only C++ library
> which provides fast
>  implementations of the from_chars functions for float and double
> types.")
>      (license (list license:asl2.0 license:expat)))) ; dual licensed
> +
> +(define-public pocketfft
> +  (let ((commit "daa8bb18327bc5c7d22c69428c25cf5dc64167d3")
> (revision "0"))
Split into two lines
> +    (package
> +      (name "pocketfft")
> +      (version (git-version "0.0.0" revision commit))
I'd simply use "0", but YMMV.
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/mreineck/pocketfft")
Note that there's also https://gitlab.mpcdf.mpg.de/mtr/pocketfft which
is C99-compliant.  
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                 
> "1dbkkqkmkxgmz1qjpsqzic5ig3qw1pqndbb3dvjc7xq5f2rdzyq1"))))
> +      (build-system copy-build-system)
> +      (arguments
> +       (list
> +        #:install-plan
> +        #~'(("pocketfft_hdronly.h" "include/"))))
> +      (home-page "https://github.com/mreineck/pocketfft")
> +      (synopsis "Heavily modified implementation of FFTPack in C++")
I'd write out "Fast Fourier Transformation" and perhaps one or two
other properties, e.g. "Header-only Fast Fourier Transformation
library".
> +      (description "This package contains the single-header
> PocketFFT library,
> +which is an reimplementation of FFTPack with several advantages,
> such as
> +multidimensional algorithms, different datatypes and vector
> instructions.")
"This package provides a single-header C++11 library for computing Fast
Fourier transformations.  It supports multidimensional arrays,
different floating point sizes and complex transformations."  As for
the vector instructions, we should convert the #ifndef
POCKETFFT_NO_VECTORS checks to #if POCKETFFT_NO_VECTORS and insert a
check that defines it to 1 if unset (for reproducibility of other
packages).
> +      (license license:bsd-3))))

Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 03/11] gnu: Add sajson.
  2022-10-03  0:19 ` [bug#58261] [PATCH 03/11] gnu: Add sajson David Elsing
@ 2022-10-04  7:22   ` Liliana Marie Prikler
  2022-10-07 15:10     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-04  7:22 UTC (permalink / raw)
  To: David Elsing, 58261

Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (sajson): New variable.
> ---
>  gnu/packages/cpp.scm                          | 63
> +++++++++++++++++++
>  .../patches/sajson-parse_flags-linking.patch  | 45 +++++++++++++
>  2 files changed, 108 insertions(+)
>  create mode 100644 gnu/packages/patches/sajson-parse_flags-
> linking.patch
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index 65df317100..7bfa3d6cdf 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -57,6 +57,7 @@ (define-module (gnu packages cpp)
>    #:use-module (guix build-system gnu)
>    #:use-module (guix build-system meson)
>    #:use-module (guix build-system python)
> +  #:use-module (guix build-system scons)
>    #:use-module (guix modules)
>    #:use-module (guix gexp)
>    #:use-module (gnu packages)
> @@ -1957,3 +1958,65 @@ (define-public pocketfft
>  which is an reimplementation of FFTPack with several advantages,
> such as
>  multidimensional algorithms, different datatypes and vector
> instructions.")
>        (license license:bsd-3))))
> +
> +(define-public sajson
> +  (let ((commit "ec644013e34f9984a3cc9ba568cab97a391db9cd")
> (revision "0"))
> +    (package
> +      (name "sajson")
> +      (version (git-version "0.0.0" revision commit))
Note that the swift FFI is advertised as 1.0 and there has been a
blogpost claiming it to be 1.0 in 2013.
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/chadaustin/sajson")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (patches
> +                 (search-patches "sajson-parse_flags-
> linking.patch"))
> +                (sha256
> +                 (base32
> +                 
> "0fjag27w7gvkc5pdhq3ad7yc09rabpzahndw1sgsg04ipznidmmq"))
> +                (modules '((guix build utils)))
> +                (snippet '(delete-file-recursively "third-party"))))
> +      (build-system scons-build-system)
> +      (arguments
> +       (list
> +        #:phases
> +        #~(modify-phases %standard-phases
> +            (add-after 'unpack 'disable-other-builds
> +              (lambda _
> +                (substitute* "SConstruct"
> +                  (("for name, tools in builds:")
> +                   "for name, tools in [('opt', [gcc, opt])]:"))
> +                #t))
> +            (add-after 'unpack 'use-external-unittest-cpp
> +              (lambda* (#:key inputs #:allow-other-keys)
> +                (substitute* "SConscript"
> +                  (("unittestpp_env\\.Library") "_dummy = ")
> +                  (("test_env = env.Clone\\(tools=\\[unittestpp,
> sajson\\]\\)")
> +                   (string-append
> +                    "test_env = env.Clone(tools=[sajson])\n"
> +                    "test_env.Append(CPPPATH='"
> +                    (search-input-directory inputs
> "/include/UnitTest++")
> +                    "', LIBPATH='"
> +                    (string-append #$(this-package-native-input
> "unittest-cpp")
> +                                   "/lib")
> +                    "', LIBS=['UnitTest++'])")))
> +                #t))
> +            (replace 'check
> +              (lambda* (#:key tests? #:allow-other-keys)
> +                (when tests?
> +                  (invoke "build/opt/test")
> +                  (invoke "build/opt/test_unsorted"))
> +                #t))
> +            (replace 'install
> +              (lambda _
> +                (let ((out (string-append #$output "/include")))
> +                  (install-file "include/sajson.h" out)
> +                  (install-file "include/sajson_ostream.h" out))
> +                #t)))))
You don't need the trailing #ts
> +      (native-inputs (list unittest-cpp))
> +      (home-page "https://github.com/chadaustin/sajson")
> +      (synopsis "Lightweight, extremely high-performance JSON parser
> for C++11")
> +      (description "sajson is a high-performance, in-place JSON
> parser
> +header-only library.")
Cut down on the ads.
> +      (license license:expat))))
> diff --git a/gnu/packages/patches/sajson-parse_flags-linking.patch
> b/gnu/packages/patches/sajson-parse_flags-linking.patch
> new file mode 100644
> index 0000000000..878706dc79
> --- /dev/null
> +++ b/gnu/packages/patches/sajson-parse_flags-linking.patch
> @@ -0,0 +1,45 @@
> +This patch is from the upstream pull request
> +https://github.com/chadaustin/sajson/pull/54.
> +It fixes linking with GCC.
> +
> +diff --git a/include/sajson.h b/include/sajson.h
> +index 8b4e05a..1bd045b 100644
> +--- a/include/sajson.h
> ++++ b/include/sajson.h
> +@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t,
> size_t value) {
> + // header. This trick courtesy of Rich Geldreich's Purple JSON
> parser.
> + template <typename unused = void>
> + struct globals_struct {
> ++    static const unsigned char parse_flags[256];
> ++};
> ++typedef globals_struct<> globals;
> ++
> + // clang-format off
> + 
> +     // bit 0 (1) - set if: plain ASCII string character
> +     // bit 1 (2) - set if: whitespace
> +     // bit 4 (0x10) - set if: 0-9 e E .
> +-    constexpr static const uint8_t parse_flags[256] = {
> ++    template <typename unused>
> ++    const unsigned char globals_struct<unused>::parse_flags[256] =
> {
> +      // 0    1    2    3    4    5    6    7      8    9    A   
> B    C    D    E    F
> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,   2,  
> 0,   0,   2,   0,   0, // 0
> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,   0,  
> 0,   0,   0,   0,   0, // 1
> +@@ -162,15 +167,13 @@ struct globals_struct {
> +     };
> + 
> + // clang-format on
> +-};
> +-typedef globals_struct<> globals;
> + 
> +-constexpr inline bool is_plain_string_character(char c) {
> ++inline bool is_plain_string_character(char c) {
> +     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
> 1) != 0;
> + }
> + 
> +-constexpr inline bool is_whitespace(char c) {
> ++inline bool is_whitespace(char c) {
> +     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
> 2) != 0;
> + }
Since this fixes an error that occurs when building with GCC 10, the
patch name should reflect that, e.g. "sajson-build-with-gcc10" (whether
you include or do not include a dash between gcc and 10 doesn't seem to
matter).

Cheers


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 04/11] gnu: Add tinydir.
  2022-10-03  0:19 ` [bug#58261] [PATCH 04/11] gnu: Add tinydir David Elsing
@ 2022-10-04  7:27   ` Liliana Marie Prikler
  2022-10-07 15:11     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-04  7:27 UTC (permalink / raw)
  To: David Elsing, 58261

Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (tinydir): New variable.
> ---
>  gnu/packages/cpp.scm | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index 7bfa3d6cdf..4819f36052 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -2020,3 +2020,41 @@ (define-public sajson
>        (description "sajson is a high-performance, in-place JSON
> parser
>  header-only library.")
>        (license license:expat))))
> +
> +(define-public tinydir
> +  (package
> +    (name "tinydir")
> +    (version "1.2.5")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/cxong/tinydir")
> +                    (commit version)))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
> +              (modules '((guix build utils)))
> +              (snippet '(delete-file-recursively "tests/cbehave"))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list
> +      ;; Tests require cbehave and rlutil
> +      #:tests? #f
Then those should be packaged.
> +      #:phases
> +      ;; Build samples instead of tests
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'chdir
> +            (lambda _ (chdir "samples") #t))
> +          (add-after 'build 'chdir-back
> +            (lambda _ (chdir "..") #t))
We don't typically build samples.
> +          (replace 'install
> +            (lambda _
> +              (install-file "tinydir.h" (string-append #$output
> "/include"))
> +              #t)))))
> +    (home-page "https://github.com/cxong/tinydir")
> +    (synopsis "Lightweight, portable and easy to integrate C
> directory and
> +file reader")
> +    (description "tinydir is a header-only C library to portably
> read files
> +and directories.")
Cut down on the ads.
> +    (license license:bsd-2)))

Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 05/11] gnu: Add optionparser.
  2022-10-03  0:19 ` [bug#58261] [PATCH 05/11] gnu: Add optionparser David Elsing
@ 2022-10-04  7:42   ` Liliana Marie Prikler
  2022-10-07 15:11     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-04  7:42 UTC (permalink / raw)
  To: David Elsing, 58261

Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (optionparser): New variable.
> ---
>  gnu/packages/cpp.scm | 50
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index 4819f36052..b30205109e 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -2058,3 +2058,53 @@ (define-public tinydir
>      (description "tinydir is a header-only C library to portably
> read files
>  and directories.")
>      (license license:bsd-2)))
> +
> +(define-public optionparser
> +  (package
> +    (name "optionparser")
> +    (version "1.7")
> +    (source (origin
> +              (method url-fetch)
> +              (uri
> +               (string-append
> "mirror://sourceforge/optionparser/optionparser-"
> +                              version ".tar.gz"))
The formattter doesn't know this, but I think in this case it might be
wiser to pull the "optionparser-" down a line on the same one with
version ".tar.gz"
> +              (sha256
> +               (base32
> +               
> "04gfxrdzwacaynb8scsz6rr7nh64n6yk6w9dh2qdhrxw4caqr0dk"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     (list
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (delete 'configure)
> +          (add-before 'build 'chdir
> +            (lambda _ (chdir "src") #t))
> +          (replace 'build
> +            (lambda _
> +              (invoke "make" "-j" (number->string (parallel-job-
> count))
> +                      "example_arg" "testparse" "testprintusage"
> "testodr"
> +                      "example")
#:make-flags exist.  Also, this is a bad way to hide that you're
missing doxygen. 
> +              #t))
> +          (replace 'check
> +            (lambda* (#:key tests? #:allow-other-keys)
> +              (if tests?
> +                  (begin
> +                    (invoke "./example_arg")
> +                    (invoke "./testparse")
> +                    (invoke "./testprintusage")
> +                    (invoke "./testodr")
> +                    (invoke "./example"))
> +                  (format #t "test suite not run~%"))))
> +          (replace 'install
> +            (lambda _
> +              (install-file "optionparser.h" (string-append #$output
> "/include"))
> +              #t))
> +          (add-after 'install 'chdir-back
> +            (lambda _ (chdir "..") #t)))))
I'm pretty sure this shouldn't be needed.
> +    (home-page "https://optionparser.sourceforge.net/")
> +    (synopsis "Header-only C++ library to parse command line
> options")
> +    (description "The Lean Mean C++ Option Parser handles the
> program's
> +command line arguments (argc, argv).  It supports the short and long
> option
> +formats of getopt(), getopt_long() and getopt_long_only() but has a
> more
> +convenient interface.")
As always, cut down on the ads :)
> +    (license license:expat)))

Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 06/11] gnu: Add gemmi.
  2022-10-03  0:19 ` [bug#58261] [PATCH 06/11] gnu: Add gemmi David Elsing
@ 2022-10-04  7:49   ` Liliana Marie Prikler
  2022-10-07 15:11     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-04  7:49 UTC (permalink / raw)
  To: David Elsing, 58261

Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> * gnu/packages/chemistry.scm (gemmi): New variable.
> ---
>  gnu/packages/chemistry.scm                    | 122 +++++++++++
>  .../patches/gemmi-fix-sajson-types.patch      |  11 +
>  .../sajson-for-gemmi-numbers-as-strings.patch | 195
> ++++++++++++++++++
>  3 files changed, 328 insertions(+)
>  create mode 100644 gnu/packages/patches/gemmi-fix-sajson-types.patch
>  create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-
> strings.patch
> 
> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
> index c517610fe8..f8fd85814f 100644
> --- a/gnu/packages/chemistry.scm
> +++ b/gnu/packages/chemistry.scm
> @@ -6,6 +6,7 @@
>  ;;; Copyright © 2020 Björn Höfling
> <bjoern.hoefling@bjoernhoefling.de>
>  ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
>  ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
> +;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -23,6 +24,7 @@
>  ;;; along with GNU Guix.  If not, see
> <http://www.gnu.org/licenses/>.
>  
>  (define-module (gnu packages chemistry)
> +  #:use-module (guix gexp)
>    #:use-module (guix packages)
>    #:use-module (guix utils)
>    #:use-module ((guix licenses) #:prefix license:)
> @@ -35,6 +37,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages boost)
>    #:use-module (gnu packages check)
>    #:use-module (gnu packages compression)
> +  #:use-module (gnu packages cpp)
>    #:use-module (gnu packages documentation)
>    #:use-module (gnu packages fontutils)
>    #:use-module (gnu packages gl)
> @@ -50,8 +53,10 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages qt)
>    #:use-module (gnu packages serialization)
>    #:use-module (gnu packages sphinx)
> +  #:use-module (gnu packages stb)
>    #:use-module (gnu packages xml)
>    #:use-module (guix build-system cmake)
> +  #:use-module (guix build-system copy)
>    #:use-module (guix build-system gnu)
>    #:use-module (guix build-system python))
>  
> @@ -566,3 +571,120 @@ (define-public python-pymol
>  used to prepare publication-quality figures, to share interactive
> results with
>  your colleagues, or to generate pre-rendered animations.")
>      (license license:bsd-3)))
> +
> +(define sajson-for-gemmi
> +  (package/inherit sajson
> +    (name "sajson-for-gemmi")
> +    (source (origin
> +              (inherit (package-source sajson))
> +              (patches (cons
> +                        (search-patch
> +                         "sajson-for-gemmi-numbers-as-
> strings.patch")
> +                        (origin-patches (package-source sajson))))))
> +    (build-system copy-build-system)
> +    (arguments
> +     (list
> +      #:install-plan
> +      #~'(("include/sajson.h" "include/")
> +          ("include/sajson_ostream.h" "include/"))))))
These are technically two packages; therefore two patches.
You should reuse as much as you can from sajson.  Since this patch is
likely to break tests, you might use an appropriately annotated
#:tests? #f to convey this information.

> +(define-public gemmi
> +  (package
> +    (name "gemmi")
> +    (version "0.5.7")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/project-gemmi/gemmi")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "00km5q726bslrw7xbfwb3f3mrsk19qbimfnl3hvr4wi1y3z8i18a"))
> +              (patches
> +               (search-patches "gemmi-fix-sajson-types.patch"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               '(begin
> +                  (delete-file-recursively
> "include/gemmi/third_party")
> +                  (delete-file-recursively "third_party")
> +                  #t))))
> +    (build-system cmake-build-system)
> +    (native-inputs (list optionparser pybind11))
> +    (propagated-inputs
> +     (list fast-float
> +           pocketfft
> +           sajson-for-gemmi
> +           stb-sprintf
> +           pegtl
> +           tinydir))
Refrain from propagating inputs.
> +    (inputs (list zlib python))
> +    (outputs '("out" "bin" "python"))
> +    (arguments
The usual sequence is outputs, build-system, arguments, *inputs.
> +     (list
> +      #:configure-flags
> +      #~(let* ((python-lib
> +                (string-append
> +                 #$output:python "/lib/python"
> +                 #$(version-major+minor (package-version python))
> +                 "/site-packages")))
> +          (list "-DUSE_PYTHON=ON"
> +                (string-append "-DPYTHON_INSTALL_DIR=" python-lib)))
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'patch-includes
> +            (lambda _
> +              (substitute* "include/gemmi/sprintf.hpp"
> +                (("<stb/stb_sprintf.h>") "<stb_sprintf.h>"))
> +              (substitute* "include/gemmi/dirwalk.hpp"
> +                (("\"third_party/tinydir.h\"") "<tinydir.h>"))
> +              (substitute* "include/gemmi/cif.hpp"
> +                (("\"third_party/tao/pegtl.hpp\"")
> "<tao/pegtl.hpp>"))
> +              (substitute* "include/gemmi/json.hpp"
> +                (("\"third_party/sajson.h\"") "<sajson.h>"))
> +              (substitute* "python/gemmi.cpp"
> +                (("\"gemmi/third_party/tao/pegtl/parse_error.hpp\"")
> +                 "<tao/pegtl/parse_error.hpp>"))
> +              (substitute* '("include/gemmi/atof.hpp"
> +                             "include/gemmi/numb.hpp")
> +                (("\"third_party/fast_float.h\"")
> +                 "<fast_float/fast_float.h>"))
> +              (substitute* "include/gemmi/fourier.hpp"
> +                (("\"third_party/pocketfft_hdronly.h\"")
> +                 "<pocketfft_hdronly.h>"))
> +              #t))
> +          (add-after 'patch-includes 'patch-cif
> +            (lambda _
> +              (substitute* "include/gemmi/cif.hpp"
> +                (((string-append
> +                   "^.*using analyze_t = pegtl::analysis::generic"
> +                   "<pegtl::analysis::rule_type::ANY>;.*$")) "")
> +                (("TAOCPP_PEGTL_") "TAO_PEGTL_"))
> +              #t))
> +          (add-after 'unpack 'change-bin-prefix
> +            (lambda _
> +              (substitute* "CMakeLists.txt"
> +                (("install\\(TARGETS program DESTINATION bin\\)")
> +                 (string-append
> +                  "install(TARGETS program DESTINATION "
> +                  #$output:bin "/bin)")))
> +              #t))
> +          (replace 'check
> +            (lambda* (#:key tests? #:allow-other-keys)
> +              (when tests?
> +                (with-directory-excursion "../source"
> +                  (setenv "PYTHONPATH" "../build")
> +                  (invoke "python3" "-m" "unittest" "discover" "-v"
> +                          "-s" "tests"))))))))
> +    (home-page "https://gemmi.readthedocs.io/en/latest/")
> +    (synopsis "Macromolecular crystallography library and
> utilities")
> +    (description "GEMMI is a C++ library for macromolecular
> crystallography.
> +It can be used for working with
> +@enumerate
> +@item macromolecular models (content of PDB, PDBx/mmCIF and mmJSON
> files),
> +@item refinement restraints (CIF files),
> +@item reflection data (MTZ and mmCIF formats),
> +@item data on a 3D grid (electron density maps, masks, MRC/CCP4
> format)
> +@item crystallographic symmetry.
> +@end enumerate")
> +    (license license:mpl2.0)))
> diff --git a/gnu/packages/patches/gemmi-fix-sajson-types.patch
> b/gnu/packages/patches/gemmi-fix-sajson-types.patch
> new file mode 100644
> index 0000000000..9633ddac8b
> --- /dev/null
> +++ b/gnu/packages/patches/gemmi-fix-sajson-types.patch
> @@ -0,0 +1,11 @@
> +diff -ur a/include/gemmi/json.hpp b/include/gemmi/json.hpp
> +--- a/include/gemmi/json.hpp
> ++++ b/include/gemmi/json.hpp
> +@@ -38,6 +38,7 @@
> + 
> + inline std::string as_cif_value(const sajson::value& val) {
> +   switch (val.get_type()) {
> ++    case sajson::TYPE_INTEGER:
> +     case sajson::TYPE_DOUBLE:
> +       return val.as_string();
> +     case sajson::TYPE_NULL:
> diff --git a/gnu/packages/patches/sajson-for-gemmi-numbers-as-
> strings.patch b/gnu/packages/patches/sajson-for-gemmi-numbers-as-
> strings.patch
> new file mode 100644
> index 0000000000..6f476b8583
> --- /dev/null
> +++ b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
> @@ -0,0 +1,195 @@
> +Patch for gemmi: Keep numbers in JSON file as strings.
> +
> +Adapted from this commit of the bundled fork of sajson in gemmi:
> +
> https://github.com/project-gemmi/gemmi/commit/fccbca4f6040364ba708613e
> 1429c2251872240d
> +
> +diff -ur a/include/sajson.h b/include/sajson.h
> +--- a/include/sajson.h
> ++++ b/include/sajson.h
> +@@ -411,43 +411,6 @@
> + };
> + } // namespace internal
> + 
> +-namespace integer_storage {
> +-enum { word_length = 1 };
> +-
> +-inline int load(const size_t* location) {
> +-    int value;
> +-    memcpy(&value, location, sizeof(value));
> +-    return value;
> +-}
> +-
> +-inline void store(size_t* location, int value) {
> +-    // NOTE: Most modern compilers optimize away this constant-size
> +-    // memcpy into a single instruction. If any don't, and treat
> +-    // punning through a union as legal, they can be special-cased.
> +-    static_assert(
> +-        sizeof(value) <= sizeof(*location),
> +-        "size_t must not be smaller than int");
> +-    memcpy(location, &value, sizeof(value));
> +-}
> +-} // namespace integer_storage
> +-
> +-namespace double_storage {
> +-enum { word_length = sizeof(double) / sizeof(size_t) };
> +-
> +-inline double load(const size_t* location) {
> +-    double value;
> +-    memcpy(&value, location, sizeof(double));
> +-    return value;
> +-}
> +-
> +-inline void store(size_t* location, double value) {
> +-    // NOTE: Most modern compilers optimize away this constant-size
> +-    // memcpy into a single instruction. If any don't, and treat
> +-    // punning through a union as legal, they can be special-cased.
> +-    memcpy(location, &value, sizeof(double));
> +-}
> +-} // namespace double_storage
> +-
> + /// Represents a JSON value.  First, call get_type() to check its
> type,
> + /// which determines which methods are available.
> + ///
> +@@ -585,70 +548,10 @@
> +         return length;
> +     }
> + 
> +-    /// If a numeric value was parsed as a 32-bit integer, returns
> it.
> +-    /// Only legal if get_type() is TYPE_INTEGER.
> +-    int get_integer_value() const {
> +-        assert_tag(tag::integer);
> +-        return integer_storage::load(payload);
> +-    }
> +-
> +-    /// If a numeric value was parsed as a double, returns it.
> +-    /// Only legal if get_type() is TYPE_DOUBLE.
> +-    double get_double_value() const {
> +-        assert_tag(tag::double_);
> +-        return double_storage::load(payload);
> +-    }
> +-
> +-    /// Returns a numeric value as a double-precision float.
> +-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
> +-    double get_number_value() const {
> +-        assert_tag_2(tag::integer, tag::double_);
> +-        if (value_tag == tag::integer) {
> +-            return get_integer_value();
> +-        } else {
> +-            return get_double_value();
> +-        }
> +-    }
> +-
> +-    /// Returns true and writes to the output argument if the
> numeric value
> +-    /// fits in a 53-bit integer.  This is useful for timestamps
> and other
> +-    /// situations where integral values with greater than 32-bit
> precision
> +-    /// are used, as 64-bit values are not understood by all JSON
> +-    /// implementations or languages.
> +-    /// Returns false if the value is not an integer or not in
> range.
> +-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
> +-    bool get_int53_value(int64_t* out) const {
> +-        // Make sure the output variable is always defined to avoid
> any
> +-        // possible situation like
> +-        //
> https://gist.github.com/chadaustin/2c249cb850619ddec05b23ca42cf7a18
> +-        *out = 0;
> +-
> +-        assert_tag_2(tag::integer, tag::double_);
> +-        switch (value_tag) {
> +-        case tag::integer:
> +-            *out = get_integer_value();
> +-            return true;
> +-        case tag::double_: {
> +-            double v = get_double_value();
> +-            if (v < -(1LL << 53) || v > (1LL << 53)) {
> +-                return false;
> +-            }
> +-            int64_t as_int = static_cast<int64_t>(v);
> +-            if (as_int != v) {
> +-                return false;
> +-            }
> +-            *out = as_int;
> +-            return true;
> +-        }
> +-        default:
> +-            return false;
> +-        }
> +-    }
> +-
> +     /// Returns the length of the string.
> +     /// Only legal if get_type() is TYPE_STRING.
> +     size_t get_string_length() const {
> +-        assert_tag(tag::string);
> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
> +         return payload[1] - payload[0];
> +     }
> + 
> +@@ -659,7 +562,7 @@
> +     /// embedded NULs.
> +     /// Only legal if get_type() is TYPE_STRING.
> +     const char* as_cstring() const {
> +-        assert_tag(tag::string);
> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
> +         return text + payload[0];
> +     }
> + 
> +@@ -667,7 +570,7 @@
> +     /// Returns a string's value as a std::string.
> +     /// Only legal if get_type() is TYPE_STRING.
> +     std::string as_string() const {
> +-        assert_tag(tag::string);
> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
> +         return std::string(text + payload[0], text + payload[1]);
> +     }
> + #endif
> +@@ -690,6 +593,10 @@
> +         assert(e1 == value_tag || e2 == value_tag);
> +     }
> + 
> ++    void assert_tag_3(tag e1, tag e2, tag e3) const {
> ++        assert(e1 == value_tag || e2 == value_tag || e3 ==
> value_tag);
> ++    }
> ++
> +     void assert_in_bounds(size_t i) const { assert(i <
> get_length()); }
> + 
> +     const tag value_tag;
> +@@ -2059,6 +1966,8 @@
> +     std::pair<char*, internal::tag> parse_number(char* p) {
> +         using internal::tag;
> + 
> ++      size_t start = p - input.get_data();
> ++
> +         // Assume 32-bit, two's complement integers.
> +         static constexpr unsigned RISKY = INT_MAX / 10u;
> +         unsigned max_digit_after_risky = INT_MAX % 10u;
> +@@ -2235,23 +2144,18 @@
> +                 u = 0u - u;
> +             }
> +         }
> ++
> ++        bool success;
> ++        size_t* out = allocator.reserve(2, &success);
> ++        if (SAJSON_UNLIKELY(!success)) {
> ++            return std::make_pair(oom(p, "number"), tag::null);
> ++        }
> ++        out[0] = start;
> ++        out[1] = p - input.get_data();
> ++
> +         if (try_double) {
> +-            bool success;
> +-            size_t* out
> +-                = allocator.reserve(double_storage::word_length,
> &success);
> +-            if (SAJSON_UNLIKELY(!success)) {
> +-                return std::make_pair(oom(p, "double"), tag::null);
> +-            }
> +-            double_storage::store(out, d);
> +             return std::make_pair(p, tag::double_);
> +         } else {
> +-            bool success;
> +-            size_t* out
> +-                = allocator.reserve(integer_storage::word_length,
> &success);
> +-            if (SAJSON_UNLIKELY(!success)) {
> +-                return std::make_pair(oom(p, "integer"),
> tag::null);
> +-            }
> +-            integer_storage::store(out, static_cast<int>(u));
> +             return std::make_pair(p, tag::integer);
> +         }
> +     }
Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 10/11] gnu: Add yaehmop-tightbind.
  2022-10-03  0:19 ` [bug#58261] [PATCH 10/11] gnu: Add yaehmop-tightbind David Elsing
@ 2022-10-04  7:54   ` Liliana Marie Prikler
  2022-10-07 15:12     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-04  7:54 UTC (permalink / raw)
  To: David Elsing, 58261

Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> * gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
> ---
>  gnu/packages/chemistry.scm | 82
> ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 82 insertions(+)
> 
> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
> index cc26aa329a..a39deff4bf 100644
> --- a/gnu/packages/chemistry.scm
> +++ b/gnu/packages/chemistry.scm
> @@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages documentation)
>    #:use-module (gnu packages flex)
>    #:use-module (gnu packages fontutils)
> +  #:use-module (gnu packages gcc)
>    #:use-module (gnu packages gl)
>    #:use-module (gnu packages graphviz)
>    #:use-module (gnu packages gv)
> @@ -817,3 +818,84 @@ (define-public coordgenlibs
>      (description "@code{coordgenlibs} contains algorithms to
> generate 2D
>  coordinates.  It has an emphasis on quality rather than speed.")
>      (license license:bsd-3)))
> +
> +(define-public yaehmop-tightbind
> +  (package
> +    (name "yaehmop-tightbind")
> +    (version "2022.09.1")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/greglandrum/yaehmop")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               '(begin
> +                  (delete-file-recursively "docs")
This one looks suspicious.
> +                  (delete-file-recursively "examples")
As does this.
What gives?
> +                  (delete-file-recursively "viewkel")
> +                  (delete-file-recursively "tightbind/f2c_files")
> +                  (delete-file "tightbind/diag.c")
> +                  (delete-file "tightbind/cboris.c")
> +                  (delete-file "tightbind/abfns.c")
> +                  (delete-file "tightbind/lovlap.c")
> +                  #t))))
> +    (build-system cmake-build-system)
> +    (native-inputs (list gfortran))
> +    (inputs (list openblas))
> +    (arguments
> +     (list
> +      #:configure-flags
> +      #~(list
> +         "-DUSE_BLAS_LAPACK=ON"
> +         (string-append "-DPARM_FILE_LOC=" #$output
> +                        "/share/" #$name "-" #$version
> "/eht_parms.dat")
> +         "-DBIND_EXE_NAME=yaehmop-bind")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'chdir
> +            (lambda _
> +              (chdir "tightbind")
> +              #t))
> +          (add-after 'chdir 'patch-fortran-functions
> +            (lambda _
> +              (substitute* '("mov.c" "prototypes.h")
> +                (("lovlap\\(") "lovlap_(")
> +                (("abfns\\(") "abfns_("))
> +              #t))
> +          (add-after 'chdir 'patch-cmake
> +            (lambda _
> +              (substitute* "CMakeLists.txt"
> +                (("project\\(yaehmop C\\)") "project(yaehmop C
> Fortran)")
> +                (("abfns.c") "fortran77/abfns.f")
> +                (("lovlap.c") "fortran77/lovlap.f")
> +                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
> +                 (string-append init " CACHE STRING \"\")"))
> +                (("add_library\\(yaehmop_eht" lib)
> +                 (string-append lib " SHARED "))
> +                (("target_link_libraries\\(test_eht
> \\$\\{LAPACK_LIBRARIES\\}.*"
> +                  all)
> +                 (string-append all
> "\ntarget_link_libraries(yaehmop_eht "
> +                                "${LAPACK_LIBRARIES})\n")))
> +              #t))
> +          (add-after 'install 'install-eht-parms
> +            (lambda _
> +              (install-file "../tightbind/eht_parms.dat"
> +                            (string-append #$output "/share/"
> +                                           #$name "-" #$version))
> +              #t))
> +          (delete 'check)
> +          (add-after 'install-eht-parms 'check
> +            (lambda* (#:key tests? #:allow-other-keys)
> +              (when tests?
> +                (invoke "./test_eht"))
> +              #t)))))
> +    (home-page "https://github.com/greglandrum/yaehmop")
> +    (synopsis "Yet Another extended Hueckel Molecular Orbital
> Package")
> +    (description "@code{YAeHMOP} contains a program and library for
> performing
> +extended Hückel calculations.")
> +    (license license:bsd-2)))
Looking at this it seems unclear whether you are building yaehmop or
tightbind.  What's going on?

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 07/11] gnu: Add freesasa.
  2022-10-03  0:19 ` [bug#58261] [PATCH 07/11] gnu: Add freesasa David Elsing
@ 2022-10-04  8:02   ` Liliana Marie Prikler
  2022-10-07 15:12     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-04  8:02 UTC (permalink / raw)
  To: David Elsing, 58261

Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> * gnu/packages/chemistry.scm (freesasa): New variable.
> ---
>  gnu/packages/chemistry.scm | 81
> ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 81 insertions(+)
> 
> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
> index f8fd85814f..223a27a20d 100644
> --- a/gnu/packages/chemistry.scm
> +++ b/gnu/packages/chemistry.scm
> @@ -34,11 +34,13 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages algebra)
>    #:use-module (gnu packages autotools)
>    #:use-module (gnu packages backup)
> +  #:use-module (gnu packages bison)
>    #:use-module (gnu packages boost)
>    #:use-module (gnu packages check)
>    #:use-module (gnu packages compression)
>    #:use-module (gnu packages cpp)
>    #:use-module (gnu packages documentation)
> +  #:use-module (gnu packages flex)
>    #:use-module (gnu packages fontutils)
>    #:use-module (gnu packages gl)
>    #:use-module (gnu packages graphviz)
> @@ -54,6 +56,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages serialization)
>    #:use-module (gnu packages sphinx)
>    #:use-module (gnu packages stb)
> +  #:use-module (gnu packages web)
>    #:use-module (gnu packages xml)
>    #:use-module (guix build-system cmake)
>    #:use-module (guix build-system copy)
> @@ -688,3 +691,81 @@ (define-public gemmi
>  @item crystallographic symmetry.
>  @end enumerate")
>      (license license:mpl2.0)))
> +
> +(define-public freesasa
> +  (package
> +    (name "freesasa")
> +    (version "2.1.2")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/mittinatten/freesasa")
> +                    (commit version)))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "07wdnahf3g355ryaiqvfxd5f4rl54wv8jwxcbn0nia89fqysbv0f"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               '(begin
> +                  ;; Remove C files generated by Flex and Bison
> +                  (for-each delete-file
> +                            '("src/parser.c" "src/parser.h"
> +                              "src/lexer.c" "src/lexer.h"))
> +                  #t))))
> +    (build-system gnu-build-system)
> +    (inputs
> +     (list gemmi json-c libxml2))
> +    (native-inputs
> +     (list bison flex check autoconf automake pkg-config doxygen
> perl libtool))
> +    (outputs '("out" "doc"))
> +    (arguments
> +     (list
> +      #:configure-flags
> +      #~(list "--enable-check"
> +              "--enable-parser-generator"
> +              "CXXFLAGS=-std=c++17"
> +              "--enable-doxygen")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'remove-libc++-linking
> +            (lambda _
> +              (substitute* "src/Makefile.am"
> +                (("-lc\\+\\+") ""))
> +              #t))
Why?  If it's because you're building a shared library, do this in the
next phase.
> +          (add-after 'unpack 'build-shared-library
> +            (lambda _
> +              (substitute* "src/Makefile.am"
> +                (("lib_LIBRARIES") "lib_LTLIBRARIES")
> +                (("libfreesasa\\.a") "libfreesasa.la")
> +                (("freesasa_LDADD \\+= libfreesasa\\.la" prev)
> +                 (string-append prev "\nlibfreesasa_la_LIBADD"
> +                                " = -ljson-c ${libxml2_LIBS}\n"))
> +                (("_a_SOURCES") "_la_SOURCES"))
> +              (substitute* "configure.ac"
> +                (("AC_PROG_INSTALL" inst)
> +                 (string-append "AM_PROG_LIBTOOL\n" inst)))
> +              (substitute* "tests/Makefile.am"
> +                (("libfreesasa\\.a") "libfreesasa.la"))
> +              #t))
> +          (add-before 'build 'build-lexer-and-parser
> +            (lambda _
> +              (with-directory-excursion "src"
> +                (invoke "make" "lexer.h")
> +                (invoke "make" "parser.h"))
> +              #t))
You can do this in one make.
> +          (add-after 'install 'install-doc
> +            (lambda _
> +              (copy-recursively
> +               "doc/html"
> +               (string-append #$output:doc "/share/doc/" #$name "-"
> #$version))
> +              #t)))))
> +    (home-page "https://freesasa.github.io/")
> +    (synopsis "Library for calculating the solvent accessible
> surface area
> +(SASA) of molecules")
"Calculate the..."
> +    (description "FreeSASA is a command line tool and C-library for
> +calculating solvent accessible surface areas (SASA).  By default Lee
> &
Use @abbr.
> +Richards' algorithm is used, but Shrake & Rupley's is also
> available.  Both can
> +be parameterized to arbitrary precision, and for high resolution
> versions of
> +the algorithms, the calculations give identical results.")
> +    (license license:expat)))

Cheers


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 11/11] gnu: Add rdkit.
  2022-10-03  0:19 ` [bug#58261] [PATCH 11/11] gnu: Add rdkit David Elsing
@ 2022-10-04  8:13   ` Liliana Marie Prikler
  2022-10-07 15:12     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-04  8:13 UTC (permalink / raw)
  To: David Elsing, 58261

Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> * gnu/packages/chemistry.scm (rdkit): New variable.
> ---
>  gnu/packages/chemistry.scm                    | 198
> ++++++++++++++++++
>  .../rdkit-cmake-external-dependencies.patch   | 102 +++++++++
>  2 files changed, 300 insertions(+)
>  create mode 100644 gnu/packages/patches/rdkit-cmake-external-
> dependencies.patch
> 
> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
> index a39deff4bf..869cf264e3 100644
> --- a/gnu/packages/chemistry.scm
> +++ b/gnu/packages/chemistry.scm
> @@ -34,6 +34,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages algebra)
>    #:use-module (gnu packages autotools)
>    #:use-module (gnu packages backup)
> +  #:use-module (gnu packages base)
>    #:use-module (gnu packages bison)
>    #:use-module (gnu packages boost)
>    #:use-module (gnu packages check)
> @@ -41,10 +42,12 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages cpp)
>    #:use-module (gnu packages documentation)
>    #:use-module (gnu packages flex)
> +  #:use-module (gnu packages fonts)
>    #:use-module (gnu packages fontutils)
>    #:use-module (gnu packages gcc)
>    #:use-module (gnu packages gl)
>    #:use-module (gnu packages graphviz)
> +  #:use-module (gnu packages gtk)
>    #:use-module (gnu packages gv)
>    #:use-module (gnu packages image)
>    #:use-module (gnu packages maths)
> @@ -56,6 +59,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages qt)
>    #:use-module (gnu packages serialization)
>    #:use-module (gnu packages sphinx)
> +  #:use-module (gnu packages sqlite)
>    #:use-module (gnu packages stb)
>    #:use-module (gnu packages web)
>    #:use-module (gnu packages xml)
> @@ -899,3 +903,197 @@ (define-public yaehmop-tightbind
>      (description "@code{YAeHMOP} contains a program and library for
> performing
>  extended Hückel calculations.")
>      (license license:bsd-2)))
> +
> +(define-public rdkit
> +  (package
> +    (name "rdkit")
> +    (version "2022.03.5")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/rdkit/rdkit")
> +                    (commit
> +                     (string-append
> +                      "Release_" (string-replace-substring version
> "." "_")))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "19idgilabh04cbr1qj6zgrgsfjm248mmfz6fsr0smrd68d0xnml9"))
> +              (patches
> +               (search-patches "rdkit-cmake-external-
> dependencies.patch"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               #~(begin
> +                   ;; Remove pickle files (only used in tests),
> +                   ;; as they are compiled programs
> +                   (for-each
> +                    (lambda (name)
> +                      (display (string-append name "\n"))
> +                      (delete-file name))
> +                    (find-files "." "\\.pkl(\\.gz)?$"))
> +                   ;; Remove SQLite data files (can be generated)
> +                   (delete-file "Data/RDData.sqlt")
> +                   (delete-file "Data/RDTests.sqlt")
> +                   #t))))
> +    (build-system cmake-build-system)
> +    (native-inputs
> +     `(("bison" ,bison)
> +       ("boost" ,boost)
> +       ("catch2" ,catch2)
> +       ("eigen" ,eigen)
> +       ("flex" ,flex)
> +       ("freesasa" ,freesasa)
> +       ("pkg-config" ,pkg-config)
> +       ("rapidjson" ,rapidjson)
> +       ("tar" ,tar)
> +       ("avalontoolkit-src"
> +        ,(let ((version "1.2.0"))
> +           (origin
> +             (method url-fetch)
> +             (uri (string-append
> +                  
> "http://sourceforge.net/projects/avalontoolkit/files/"
> +                   "AvalonToolkit_" (substring version 0 3)
> "/AvalonToolkit_"
> +                   version ".source.tar"))
> +             (sha256
> +              (base32
> +              
> "0rnnyy6axs2da7aa4q6l30ldavbk49v6l22llj1adn74h1i67bpv"))
> +             (modules '((guix build utils) (ice-9 ftw) (srfi srfi-
> 26)))
> +             (snippet
> +              #~(begin
> +                  (chdir "..")
> +                  (delete-file-recursively "StandardFiles")
> +                  (delete-file-recursively
> "SourceDistribution/java")
> +                  #t)))))
> +       ("ringdecomposerlib-src"
> +        ,(let ((version "1.1.3"))
> +           (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")))))))
> +    (inputs
> +     (list cairo
> +           coordgenlibs
> +           font-comic-neue
> +           freetype
> +           inchi
> +           maeparser
> +           python
> +           sqlite
> +           yaehmop-tightbind))
> +    (propagated-inputs
> +     (list python-numpy python-cairocffi python-pillow))
> +    (arguments
> +     (list
> +      #: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)))
> +      #:configure-flags
> +      #~(list
> +         "-DRDK_BUILD_AVALON_SUPPORT=ON"
> +         "-DRDK_BUILD_CAIRO_SUPPORT=ON"
> +         "-DRDK_BUILD_CPP_TESTS=ON"
> +         "-DRDK_BUILD_FREESASA_SUPPORT=ON"
> +         "-DRDK_BUILD_INCHI_SUPPORT=ON"
> +         "-DRDK_BUILD_YAEHMOP_SUPPORT=ON"
> +         (string-append "-DCATCH_DIR="
> +                        #$(this-package-native-input "catch2")
> +                        "/include/catch2")
> +         "-DRDK_INSTALL_DEV_COMPONENT=ON"
> +         "-DRDK_INSTALL_INTREE=OFF"
> +         "-DRDK_INSTALL_STATIC_LIBS=OFF"
> +         (string-append
> +          "-DRDK_OPTIMIZE_POPCNT="
> +          #$(let ((system (or (%current-target-system)
> +                              (%current-system))))
> +              (cond
> +               ((string-prefix? "x86_64" system) "ON")
> +               ((string-prefix? "i686" system) "ON")
> +               (else "OFF"))))
> +         "-DRDK_USE_BOOST_IOSTREAMS=ON"
> +         "-DRDK_USE_FLEXBISON=ON")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'copy-external-dependencies
> +            (lambda _
> +              (symlink
> +               (string-append
> +                #$(this-package-input "font-comic-neue")
> +                "/share/fonts/truetype/ComicNeue-Regular.ttf")
> +               "Data/Fonts/ComicNeue-Regular.ttf")
> +              (symlink #$(this-package-native-input "rapidjson")
> +                       "External/rapidjson-1.1.0")
> +              (invoke "tar" "xvf"
> +                      #$(this-package-native-input "avalontoolkit-
> src")
> +                      "-C" "External/AvalonTools")
> +              (symlink #$(this-package-native-input
> "ringdecomposerlib-src")
> +                       "External/RingFamilies/RingDecomposerLib")
> +              #t))
You might want to try unbundling those.  Either way, you should find a
solution that doesn't depend on native-input labels.
> +          (add-after 'copy-external-dependencies 'patch-source
> +            (lambda _
> +              (with-directory-excursion "External/AvalonTools"
> +                (invoke "patch" "-p0" "-i"
> +                        "AvalonToolkit_1.2_patch.txt"))
> +              (substitute* "External/YAeHMOP/EHTTools.cpp"
> +                (("<yaehmop/tightbind/bind.h>") "<yaehmop/bind.h>"))
> +              #t))
See my comment on yaehmop.
> +          (add-after 'unpack 'create-sqlite-data-files
> +            (lambda _
> +              (invoke "sqlite3" "Data/RDData.sqlt"
> +                      ".read rdkit/Dbase/test_data/RDData.sqlite")
> +              (invoke "sqlite3" "Data/RDTests.sqlt"
> +                      ".read rdkit/Dbase/test_data/RDTests.sqlite")
> +              #t))
Do you only need this for tests?  If so, do this in a pre-check phase.
> +          (add-after 'unpack 'fix-inchi-include
> +            (lambda _
> +              (substitute* "Code/cmake/Modules/FindInchi.cmake"
> +                (("inchi_api.h.*\\)") "inchi/inchi_api.h)")
> +                (("INCHI_LIBRARY NAMES.*\\)")
> +                 "INCHI_LIBRARY NAMES inchi PATH_SUFFIXES inchi)")
> +                (("find_library" prev)
> +                 (string-append
> +                  "list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.1)\n"
> +                  prev)))
> +              (substitute* "External/INCHI-API/inchi.cpp"
> +                (("<inchi_api.h>") "<inchi/inchi_api.h>"))
> +              #t))
> +          (add-before 'build 'enable-bytecode-determinism
> +              (lambda _
> +                (setenv "PYTHONHASHSEED" "0")
> +                (setenv "PYTHONDONTWRITEBYTECODE" "1")
> +                #t))
> +          (delete 'check)
> +          (add-after 'install 'check
> +            (lambda* (#:key inputs outputs tests? parallel-tests?
> +                      #:allow-other-keys)
> +              (when tests?
> +                (let
> +                    ((job-count (number->string
> +                                 (or (and parallel-tests?
> +                                          (parallel-job-count))
> +                                     1))))
> +                  (setenv "RDBASE" (canonicalize-path "../source"))
> +                  (add-installed-pythonpath inputs outputs)
This line should also be pre-check, maybe even these two lines.
> +                  (invoke "ctest"
> +                          "-j" job-count
> +                          "-E" (string-append
> +                                ;; need pickled data
> +                                "(pyDiscreteValueVect"
> "|pySparseIntVect"
> +                                "|graphmoltestPickler"
> "|pyPartialCharges"
> +                                "|substructLibraryTest"
> "|pyFeatures"
> +                                "|pythonTestDirML"
> "|pythonTestDirChem"
> +                                ;; Catching Python exception fails
> +                                "|pyRanker)"))))
Use string-join instead.
> +              #t)))))
> +    (home-page "https://rdkit.org/")
> +    (synopsis "Open-Source Cheminformatics Software")
"Open-Source" is meaningless in Guix.
> +    (description "RDKit is a collection of cheminformatics and
> +machine-learning software written in C++ and Python.")
Not particularly descriptive, but then again, neither is rdkit itself.

Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 01/11] gnu: Add fast-float.
  2022-10-04  6:57   ` Liliana Marie Prikler via Guix-patches via
@ 2022-10-07 15:08     ` David Elsing
  0 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:08 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261


Liliana Marie Prikler <liliana.prikler@tugraz.at> writes:

> Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
>> * gnu/packages/cpp.scm (fast-float): New variable.
>> ---
>>  gnu/packages/cpp.scm | 24 ++++++++++++++++++++++++
>>  1 file changed, 24 insertions(+)
>> 
>> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
>> index d03e0bc7e1..e597dba40c 100644
>> --- a/gnu/packages/cpp.scm
>> +++ b/gnu/packages/cpp.scm
>> @@ -29,6 +29,7 @@
>>  ;;; Copyright © 2022 muradm <mail@muradm.net>
>>  ;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
>>  ;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
>> +;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
>>  ;;;
>>  ;;; This file is part of GNU Guix.
>>  ;;;
>> @@ -1907,3 +1908,26 @@ (define-public cpp-mustache
>>  templated string type for compatibility with any STL-like string
>> (std::string,
>>  std::wstring, etc).")
>>      (license license:boost1.0)))
>> +
>> +(define-public fast-float
>> +  (package
>> +    (name "fast-float")
>> +    (version "3.5.1")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/fastfloat/fast_float")
>> +                    (commit (string-append "v" version))))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "0z3rxxd0pwvw70dbnv63rm67biw829vdqf50y16isxm6g3sbrz8g"))))
>> +    (build-system cmake-build-system)
>> +    (arguments
>> +     ;; Tests require downloading a lot of additional data
>> +     (list #:tests? #f))
> I'm not quite sure how much you mean by "a lot" – it seems to be one
> repo [1], but more importantly, you could try to disable the tests that
> require external fetches.
It's 262 MiB, so not too much. Oh sorry, I didn't notice that it was
just one test, but now I included the test data anyway.
>> +    (home-page "https://github.com/fastfloat/fast_float")
>> +    (synopsis "Fast and exact implementation of the C++ from_chars
>> functions")
> I'd call this a "Floating point number parser" or if you prefer the
> verb form "Parse floating point numbers".
>> +    (description "@code{fast_float} is a header-only C++ library
>> which provides fast
>> +implementations of the from_chars functions for float and double
>> types.")
> "@code{fast_float} is a header-only C++ library for parsing floating
> point numbers from strings."  If you want to mention its speed, add
> "Benchmarks show that it is several times faster than strtod."
Is it better now? I don't think it's necessary to mention speed.
>> +    (license (list license:asl2.0 license:expat)))) ; dual licensed
> Weird choice, but okay.
>
> Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 02/11] gnu: Add pocketfft.
  2022-10-04  7:09   ` Liliana Marie Prikler
@ 2022-10-07 15:10     ` David Elsing
  0 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:10 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

> Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
>> * gnu/packages/cpp.scm (pocketfft): New variable.
>> ---
>>  gnu/packages/cpp.scm | 26 ++++++++++++++++++++++++++
>>  1 file changed, 26 insertions(+)
>> 
>> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
>> index e597dba40c..65df317100 100644
>> --- a/gnu/packages/cpp.scm
>> +++ b/gnu/packages/cpp.scm
>> @@ -1931,3 +1931,29 @@ (define-public fast-float
>>      (description "@code{fast_float} is a header-only C++ library
>> which provides fast
>>  implementations of the from_chars functions for float and double
>> types.")
>>      (license (list license:asl2.0 license:expat)))) ; dual licensed
>> +
>> +(define-public pocketfft
>> +  (let ((commit "daa8bb18327bc5c7d22c69428c25cf5dc64167d3")
>> (revision "0"))
> Split into two lines
>> +    (package
>> +      (name "pocketfft")
>> +      (version (git-version "0.0.0" revision commit))
> I'd simply use "0", but YMMV.
>> +      (source (origin
>> +                (method git-fetch)
>> +                (uri (git-reference
>> +                      (url "https://github.com/mreineck/pocketfft")
> Note that there's also https://gitlab.mpcdf.mpg.de/mtr/pocketfft which
> is C99-compliant.  
I renamed it to pocketfft-cpp, is that fine?
>> +                      (commit commit)))
>> +                (file-name (git-file-name name version))
>> +                (sha256
>> +                 (base32
>> +                 
>> "1dbkkqkmkxgmz1qjpsqzic5ig3qw1pqndbb3dvjc7xq5f2rdzyq1"))))
>> +      (build-system copy-build-system)
>> +      (arguments
>> +       (list
>> +        #:install-plan
>> +        #~'(("pocketfft_hdronly.h" "include/"))))
>> +      (home-page "https://github.com/mreineck/pocketfft")
>> +      (synopsis "Heavily modified implementation of FFTPack in C++")
> I'd write out "Fast Fourier Transformation" and perhaps one or two
> other properties, e.g. "Header-only Fast Fourier Transformation
> library".
>> +      (description "This package contains the single-header
>> PocketFFT library,
>> +which is an reimplementation of FFTPack with several advantages,
>> such as
>> +multidimensional algorithms, different datatypes and vector
>> instructions.")
> "This package provides a single-header C++11 library for computing Fast
> Fourier transformations.  It supports multidimensional arrays,
> different floating point sizes and complex transformations."  As for
> the vector instructions, we should convert the #ifndef
> POCKETFFT_NO_VECTORS checks to #if POCKETFFT_NO_VECTORS and insert a
> check that defines it to 1 if unset (for reproducibility of other
> packages).
Oh that's a good point! I assume you mean #if !(POCKETFFT_NO_VECTORS)?
>> +      (license license:bsd-3))))
>
> Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 03/11] gnu: Add sajson.
  2022-10-04  7:22   ` Liliana Marie Prikler
@ 2022-10-07 15:10     ` David Elsing
  0 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:10 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

> Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
>> * gnu/packages/cpp.scm (sajson): New variable.
>> ---
>>  gnu/packages/cpp.scm                          | 63
>> +++++++++++++++++++
>>  .../patches/sajson-parse_flags-linking.patch  | 45 +++++++++++++
>>  2 files changed, 108 insertions(+)
>>  create mode 100644 gnu/packages/patches/sajson-parse_flags-
>> linking.patch
>> 
>> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
>> index 65df317100..7bfa3d6cdf 100644
>> --- a/gnu/packages/cpp.scm
>> +++ b/gnu/packages/cpp.scm
>> @@ -57,6 +57,7 @@ (define-module (gnu packages cpp)
>>    #:use-module (guix build-system gnu)
>>    #:use-module (guix build-system meson)
>>    #:use-module (guix build-system python)
>> +  #:use-module (guix build-system scons)
>>    #:use-module (guix modules)
>>    #:use-module (guix gexp)
>>    #:use-module (gnu packages)
>> @@ -1957,3 +1958,65 @@ (define-public pocketfft
>>  which is an reimplementation of FFTPack with several advantages,
>> such as
>>  multidimensional algorithms, different datatypes and vector
>> instructions.")
>>        (license license:bsd-3))))
>> +
>> +(define-public sajson
>> +  (let ((commit "ec644013e34f9984a3cc9ba568cab97a391db9cd")
>> (revision "0"))
>> +    (package
>> +      (name "sajson")
>> +      (version (git-version "0.0.0" revision commit))
> Note that the swift FFI is advertised as 1.0 and there has been a
> blogpost claiming it to be 1.0 in 2013.
Ah ok, then I'll set it to 1.0.
>> +      (source (origin
>> +                (method git-fetch)
>> +                (uri (git-reference
>> +                      (url "https://github.com/chadaustin/sajson")
>> +                      (commit commit)))
>> +                (file-name (git-file-name name version))
>> +                (patches
>> +                 (search-patches "sajson-parse_flags-
>> linking.patch"))
>> +                (sha256
>> +                 (base32
>> +                 
>> "0fjag27w7gvkc5pdhq3ad7yc09rabpzahndw1sgsg04ipznidmmq"))
>> +                (modules '((guix build utils)))
>> +                (snippet '(delete-file-recursively "third-party"))))
>> +      (build-system scons-build-system)
>> +      (arguments
>> +       (list
>> +        #:phases
>> +        #~(modify-phases %standard-phases
>> +            (add-after 'unpack 'disable-other-builds
>> +              (lambda _
>> +                (substitute* "SConstruct"
>> +                  (("for name, tools in builds:")
>> +                   "for name, tools in [('opt', [gcc, opt])]:"))
>> +                #t))
>> +            (add-after 'unpack 'use-external-unittest-cpp
>> +              (lambda* (#:key inputs #:allow-other-keys)
>> +                (substitute* "SConscript"
>> +                  (("unittestpp_env\\.Library") "_dummy = ")
>> +                  (("test_env = env.Clone\\(tools=\\[unittestpp,
>> sajson\\]\\)")
>> +                   (string-append
>> +                    "test_env = env.Clone(tools=[sajson])\n"
>> +                    "test_env.Append(CPPPATH='"
>> +                    (search-input-directory inputs
>> "/include/UnitTest++")
>> +                    "', LIBPATH='"
>> +                    (string-append #$(this-package-native-input
>> "unittest-cpp")
>> +                                   "/lib")
>> +                    "', LIBS=['UnitTest++'])")))
>> +                #t))
>> +            (replace 'check
>> +              (lambda* (#:key tests? #:allow-other-keys)
>> +                (when tests?
>> +                  (invoke "build/opt/test")
>> +                  (invoke "build/opt/test_unsorted"))
>> +                #t))
>> +            (replace 'install
>> +              (lambda _
>> +                (let ((out (string-append #$output "/include")))
>> +                  (install-file "include/sajson.h" out)
>> +                  (install-file "include/sajson_ostream.h" out))
>> +                #t)))))
> You don't need the trailing #ts
Oh thanks, I think I read something outdated.
>> +      (native-inputs (list unittest-cpp))
>> +      (home-page "https://github.com/chadaustin/sajson")
>> +      (synopsis "Lightweight, extremely high-performance JSON parser
>> for C++11")
>> +      (description "sajson is a high-performance, in-place JSON
>> parser
>> +header-only library.")
> Cut down on the ads.
>> +      (license license:expat))))
>> diff --git a/gnu/packages/patches/sajson-parse_flags-linking.patch
>> b/gnu/packages/patches/sajson-parse_flags-linking.patch
>> new file mode 100644
>> index 0000000000..878706dc79
>> --- /dev/null
>> +++ b/gnu/packages/patches/sajson-parse_flags-linking.patch
>> @@ -0,0 +1,45 @@
>> +This patch is from the upstream pull request
>> +https://github.com/chadaustin/sajson/pull/54.
>> +It fixes linking with GCC.
>> +
>> +diff --git a/include/sajson.h b/include/sajson.h
>> +index 8b4e05a..1bd045b 100644
>> +--- a/include/sajson.h
>> ++++ b/include/sajson.h
>> +@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t,
>> size_t value) {
>> + // header. This trick courtesy of Rich Geldreich's Purple JSON
>> parser.
>> + template <typename unused = void>
>> + struct globals_struct {
>> ++    static const unsigned char parse_flags[256];
>> ++};
>> ++typedef globals_struct<> globals;
>> ++
>> + // clang-format off
>> + 
>> +     // bit 0 (1) - set if: plain ASCII string character
>> +     // bit 1 (2) - set if: whitespace
>> +     // bit 4 (0x10) - set if: 0-9 e E .
>> +-    constexpr static const uint8_t parse_flags[256] = {
>> ++    template <typename unused>
>> ++    const unsigned char globals_struct<unused>::parse_flags[256] =
>> {
>> +      // 0    1    2    3    4    5    6    7      8    9    A   
>> B    C    D    E    F
>> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,   2,  
>> 0,   0,   2,   0,   0, // 0
>> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,   0,  
>> 0,   0,   0,   0,   0, // 1
>> +@@ -162,15 +167,13 @@ struct globals_struct {
>> +     };
>> + 
>> + // clang-format on
>> +-};
>> +-typedef globals_struct<> globals;
>> + 
>> +-constexpr inline bool is_plain_string_character(char c) {
>> ++inline bool is_plain_string_character(char c) {
>> +     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
>> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
>> 1) != 0;
>> + }
>> + 
>> +-constexpr inline bool is_whitespace(char c) {
>> ++inline bool is_whitespace(char c) {
>> +     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
>> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
>> 2) != 0;
>> + }
> Since this fixes an error that occurs when building with GCC 10, the
> patch name should reflect that, e.g. "sajson-build-with-gcc10" (whether
> you include or do not include a dash between gcc and 10 doesn't seem to
> matter).
>
> Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 04/11] gnu: Add tinydir.
  2022-10-04  7:27   ` Liliana Marie Prikler
@ 2022-10-07 15:11     ` David Elsing
  2022-10-07 15:13       ` Liliana Marie Prikler
  0 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:11 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

> Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
>> * gnu/packages/cpp.scm (tinydir): New variable.
>> ---
>>  gnu/packages/cpp.scm | 38 ++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 38 insertions(+)
>> 
>> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
>> index 7bfa3d6cdf..4819f36052 100644
>> --- a/gnu/packages/cpp.scm
>> +++ b/gnu/packages/cpp.scm
>> @@ -2020,3 +2020,41 @@ (define-public sajson
>>        (description "sajson is a high-performance, in-place JSON
>> parser
>>  header-only library.")
>>        (license license:expat))))
>> +
>> +(define-public tinydir
>> +  (package
>> +    (name "tinydir")
>> +    (version "1.2.5")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/cxong/tinydir")
>> +                    (commit version)))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
>> +              (modules '((guix build utils)))
>> +              (snippet '(delete-file-recursively "tests/cbehave"))))
>> +    (build-system cmake-build-system)
>> +    (arguments
>> +     (list
>> +      ;; Tests require cbehave and rlutil
>> +      #:tests? #f
> Then those should be packaged.
The problem is that the tests include a non-trivially modified
fork of cbehave, which uses an older (bundled) copy of rlutil for color
output. How should I deal with that?
>> +      #:phases
>> +      ;; Build samples instead of tests
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'unpack 'chdir
>> +            (lambda _ (chdir "samples") #t))
>> +          (add-after 'build 'chdir-back
>> +            (lambda _ (chdir "..") #t))
> We don't typically build samples.
Ah ok :)
>> +          (replace 'install
>> +            (lambda _
>> +              (install-file "tinydir.h" (string-append #$output
>> "/include"))
>> +              #t)))))
>> +    (home-page "https://github.com/cxong/tinydir")
>> +    (synopsis "Lightweight, portable and easy to integrate C
>> directory and
>> +file reader")
>> +    (description "tinydir is a header-only C library to portably
>> read files
>> +and directories.")
> Cut down on the ads.
>> +    (license license:bsd-2)))
>
> Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 05/11] gnu: Add optionparser.
  2022-10-04  7:42   ` Liliana Marie Prikler
@ 2022-10-07 15:11     ` David Elsing
  0 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:11 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

> Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
>> * gnu/packages/cpp.scm (optionparser): New variable.
>> ---
>>  gnu/packages/cpp.scm | 50
>> ++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 50 insertions(+)
>> 
>> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
>> index 4819f36052..b30205109e 100644
>> --- a/gnu/packages/cpp.scm
>> +++ b/gnu/packages/cpp.scm
>> @@ -2058,3 +2058,53 @@ (define-public tinydir
>>      (description "tinydir is a header-only C library to portably
>> read files
>>  and directories.")
>>      (license license:bsd-2)))
>> +
>> +(define-public optionparser
>> +  (package
>> +    (name "optionparser")
>> +    (version "1.7")
>> +    (source (origin
>> +              (method url-fetch)
>> +              (uri
>> +               (string-append
>> "mirror://sourceforge/optionparser/optionparser-"
>> +                              version ".tar.gz"))
> The formattter doesn't know this, but I think in this case it might be
> wiser to pull the "optionparser-" down a line on the same one with
> version ".tar.gz"
Which formatter do you mean? Is it ok if I just use Emacs with the rules
in .dir-locals.el and guix lint? When I used guix style, lines sometimes
exceed 80 characters.
>> +              (sha256
>> +               (base32
>> +               
>> "04gfxrdzwacaynb8scsz6rr7nh64n6yk6w9dh2qdhrxw4caqr0dk"))))
>> +    (build-system gnu-build-system)
>> +    (arguments
>> +     (list
>> +      #:phases
>> +      #~(modify-phases %standard-phases
>> +          (delete 'configure)
>> +          (add-before 'build 'chdir
>> +            (lambda _ (chdir "src") #t))
>> +          (replace 'build
>> +            (lambda _
>> +              (invoke "make" "-j" (number->string (parallel-job-
>> count))
>> +                      "example_arg" "testparse" "testprintusage"
>> "testodr"
>> +                      "example")
> #:make-flags exist.  Also, this is a bad way to hide that you're
> missing doxygen.
Oops, I don't remember why I did that, it is easier to just build the
documentation...
>> +              #t))
>> +          (replace 'check
>> +            (lambda* (#:key tests? #:allow-other-keys)
>> +              (if tests?
>> +                  (begin
>> +                    (invoke "./example_arg")
>> +                    (invoke "./testparse")
>> +                    (invoke "./testprintusage")
>> +                    (invoke "./testodr")
>> +                    (invoke "./example"))
>> +                  (format #t "test suite not run~%"))))
>> +          (replace 'install
>> +            (lambda _
>> +              (install-file "optionparser.h" (string-append #$output
>> "/include"))
>> +              #t))
>> +          (add-after 'install 'chdir-back
>> +            (lambda _ (chdir "..") #t)))))
> I'm pretty sure this shouldn't be needed.
>> +    (home-page "https://optionparser.sourceforge.net/")
>> +    (synopsis "Header-only C++ library to parse command line
>> options")
>> +    (description "The Lean Mean C++ Option Parser handles the
>> program's
>> +command line arguments (argc, argv).  It supports the short and long
>> option
>> +formats of getopt(), getopt_long() and getopt_long_only() but has a
>> more
>> +convenient interface.")
> As always, cut down on the ads :)
>> +    (license license:expat)))
>
> Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 06/11] gnu: Add gemmi.
  2022-10-04  7:49   ` Liliana Marie Prikler
@ 2022-10-07 15:11     ` David Elsing
  2022-10-07 15:17       ` Liliana Marie Prikler
  0 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:11 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

> Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
>> * gnu/packages/chemistry.scm (gemmi): New variable.
>> ---
>>  gnu/packages/chemistry.scm                    | 122 +++++++++++
>>  .../patches/gemmi-fix-sajson-types.patch      |  11 +
>>  .../sajson-for-gemmi-numbers-as-strings.patch | 195
>> ++++++++++++++++++
>>  3 files changed, 328 insertions(+)
>>  create mode 100644 gnu/packages/patches/gemmi-fix-sajson-types.patch
>>  create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-
>> strings.patch
>> 
>> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
>> index c517610fe8..f8fd85814f 100644
>> --- a/gnu/packages/chemistry.scm
>> +++ b/gnu/packages/chemistry.scm
>> @@ -6,6 +6,7 @@
>>  ;;; Copyright © 2020 Björn Höfling
>> <bjoern.hoefling@bjoernhoefling.de>
>>  ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
>>  ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
>> +;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
>>  ;;;
>>  ;;; This file is part of GNU Guix.
>>  ;;;
>> @@ -23,6 +24,7 @@
>>  ;;; along with GNU Guix.  If not, see
>> <http://www.gnu.org/licenses/>.
>>  
>>  (define-module (gnu packages chemistry)
>> +  #:use-module (guix gexp)
>>    #:use-module (guix packages)
>>    #:use-module (guix utils)
>>    #:use-module ((guix licenses) #:prefix license:)
>> @@ -35,6 +37,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages boost)
>>    #:use-module (gnu packages check)
>>    #:use-module (gnu packages compression)
>> +  #:use-module (gnu packages cpp)
>>    #:use-module (gnu packages documentation)
>>    #:use-module (gnu packages fontutils)
>>    #:use-module (gnu packages gl)
>> @@ -50,8 +53,10 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages qt)
>>    #:use-module (gnu packages serialization)
>>    #:use-module (gnu packages sphinx)
>> +  #:use-module (gnu packages stb)
>>    #:use-module (gnu packages xml)
>>    #:use-module (guix build-system cmake)
>> +  #:use-module (guix build-system copy)
>>    #:use-module (guix build-system gnu)
>>    #:use-module (guix build-system python))
>>  
>> @@ -566,3 +571,120 @@ (define-public python-pymol
>>  used to prepare publication-quality figures, to share interactive
>> results with
>>  your colleagues, or to generate pre-rendered animations.")
>>      (license license:bsd-3)))
>> +
>> +(define sajson-for-gemmi
>> +  (package/inherit sajson
>> +    (name "sajson-for-gemmi")
>> +    (source (origin
>> +              (inherit (package-source sajson))
>> +              (patches (cons
>> +                        (search-patch
>> +                         "sajson-for-gemmi-numbers-as-
>> strings.patch")
>> +                        (origin-patches (package-source sajson))))))
>> +    (build-system copy-build-system)
>> +    (arguments
>> +     (list
>> +      #:install-plan
>> +      #~'(("include/sajson.h" "include/")
>> +          ("include/sajson_ostream.h" "include/"))))))
> These are technically two packages; therefore two patches.
> You should reuse as much as you can from sajson.  Since this patch is
> likely to break tests, you might use an appropriately annotated
> #:tests? #f to convey this information.
>
You mean to copy the GCC10 patch?
Building the tests also fails, but the rest works. :)
Should I put it in a separate commit?
>> +(define-public gemmi
>> +  (package
>> +    (name "gemmi")
>> +    (version "0.5.7")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/project-gemmi/gemmi")
>> +                    (commit (string-append "v" version))))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "00km5q726bslrw7xbfwb3f3mrsk19qbimfnl3hvr4wi1y3z8i18a"))
>> +              (patches
>> +               (search-patches "gemmi-fix-sajson-types.patch"))
>> +              (modules '((guix build utils)))
>> +              (snippet
>> +               '(begin
>> +                  (delete-file-recursively
>> "include/gemmi/third_party")
>> +                  (delete-file-recursively "third_party")
>> +                  #t))))
>> +    (build-system cmake-build-system)
>> +    (native-inputs (list optionparser pybind11))
>> +    (propagated-inputs
>> +     (list fast-float
>> +           pocketfft
>> +           sajson-for-gemmi
>> +           stb-sprintf
>> +           pegtl
>> +           tinydir))
> Refrain from propagating inputs.
Ah ok.
>> +    (inputs (list zlib python))
>> +    (outputs '("out" "bin" "python"))
>> +    (arguments
> The usual sequence is outputs, build-system, arguments, *inputs.
Is there also a usual sequence for the *inputs?
>> +     (list
>> +      #:configure-flags
>> +      #~(let* ((python-lib
>> +                (string-append
>> +                 #$output:python "/lib/python"
>> +                 #$(version-major+minor (package-version python))
>> +                 "/site-packages")))
>> +          (list "-DUSE_PYTHON=ON"
>> +                (string-append "-DPYTHON_INSTALL_DIR=" python-lib)))
>> +      #:phases
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'unpack 'patch-includes
>> +            (lambda _
>> +              (substitute* "include/gemmi/sprintf.hpp"
>> +                (("<stb/stb_sprintf.h>") "<stb_sprintf.h>"))
>> +              (substitute* "include/gemmi/dirwalk.hpp"
>> +                (("\"third_party/tinydir.h\"") "<tinydir.h>"))
>> +              (substitute* "include/gemmi/cif.hpp"
>> +                (("\"third_party/tao/pegtl.hpp\"")
>> "<tao/pegtl.hpp>"))
>> +              (substitute* "include/gemmi/json.hpp"
>> +                (("\"third_party/sajson.h\"") "<sajson.h>"))
>> +              (substitute* "python/gemmi.cpp"
>> +                (("\"gemmi/third_party/tao/pegtl/parse_error.hpp\"")
>> +                 "<tao/pegtl/parse_error.hpp>"))
>> +              (substitute* '("include/gemmi/atof.hpp"
>> +                             "include/gemmi/numb.hpp")
>> +                (("\"third_party/fast_float.h\"")
>> +                 "<fast_float/fast_float.h>"))
>> +              (substitute* "include/gemmi/fourier.hpp"
>> +                (("\"third_party/pocketfft_hdronly.h\"")
>> +                 "<pocketfft_hdronly.h>"))
>> +              #t))
>> +          (add-after 'patch-includes 'patch-cif
>> +            (lambda _
>> +              (substitute* "include/gemmi/cif.hpp"
>> +                (((string-append
>> +                   "^.*using analyze_t = pegtl::analysis::generic"
>> +                   "<pegtl::analysis::rule_type::ANY>;.*$")) "")
>> +                (("TAOCPP_PEGTL_") "TAO_PEGTL_"))
>> +              #t))
>> +          (add-after 'unpack 'change-bin-prefix
>> +            (lambda _
>> +              (substitute* "CMakeLists.txt"
>> +                (("install\\(TARGETS program DESTINATION bin\\)")
>> +                 (string-append
>> +                  "install(TARGETS program DESTINATION "
>> +                  #$output:bin "/bin)")))
>> +              #t))
>> +          (replace 'check
>> +            (lambda* (#:key tests? #:allow-other-keys)
>> +              (when tests?
>> +                (with-directory-excursion "../source"
>> +                  (setenv "PYTHONPATH" "../build")
>> +                  (invoke "python3" "-m" "unittest" "discover" "-v"
>> +                          "-s" "tests"))))))))
>> +    (home-page "https://gemmi.readthedocs.io/en/latest/")
>> +    (synopsis "Macromolecular crystallography library and
>> utilities")
>> +    (description "GEMMI is a C++ library for macromolecular
>> crystallography.
>> +It can be used for working with
>> +@enumerate
>> +@item macromolecular models (content of PDB, PDBx/mmCIF and mmJSON
>> files),
>> +@item refinement restraints (CIF files),
>> +@item reflection data (MTZ and mmCIF formats),
>> +@item data on a 3D grid (electron density maps, masks, MRC/CCP4
>> format)
>> +@item crystallographic symmetry.
>> +@end enumerate")
>> +    (license license:mpl2.0)))
>> diff --git a/gnu/packages/patches/gemmi-fix-sajson-types.patch
>> b/gnu/packages/patches/gemmi-fix-sajson-types.patch
>> new file mode 100644
>> index 0000000000..9633ddac8b
>> --- /dev/null
>> +++ b/gnu/packages/patches/gemmi-fix-sajson-types.patch
>> @@ -0,0 +1,11 @@
>> +diff -ur a/include/gemmi/json.hpp b/include/gemmi/json.hpp
>> +--- a/include/gemmi/json.hpp
>> ++++ b/include/gemmi/json.hpp
>> +@@ -38,6 +38,7 @@
>> + 
>> + inline std::string as_cif_value(const sajson::value& val) {
>> +   switch (val.get_type()) {
>> ++    case sajson::TYPE_INTEGER:
>> +     case sajson::TYPE_DOUBLE:
>> +       return val.as_string();
>> +     case sajson::TYPE_NULL:
>> diff --git a/gnu/packages/patches/sajson-for-gemmi-numbers-as-
>> strings.patch b/gnu/packages/patches/sajson-for-gemmi-numbers-as-
>> strings.patch
>> new file mode 100644
>> index 0000000000..6f476b8583
>> --- /dev/null
>> +++ b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
>> @@ -0,0 +1,195 @@
>> +Patch for gemmi: Keep numbers in JSON file as strings.
>> +
>> +Adapted from this commit of the bundled fork of sajson in gemmi:
>> +
>> https://github.com/project-gemmi/gemmi/commit/fccbca4f6040364ba708613e
>> 1429c2251872240d
>> +
>> +diff -ur a/include/sajson.h b/include/sajson.h
>> +--- a/include/sajson.h
>> ++++ b/include/sajson.h
>> +@@ -411,43 +411,6 @@
>> + };
>> + } // namespace internal
>> + 
>> +-namespace integer_storage {
>> +-enum { word_length = 1 };
>> +-
>> +-inline int load(const size_t* location) {
>> +-    int value;
>> +-    memcpy(&value, location, sizeof(value));
>> +-    return value;
>> +-}
>> +-
>> +-inline void store(size_t* location, int value) {
>> +-    // NOTE: Most modern compilers optimize away this constant-size
>> +-    // memcpy into a single instruction. If any don't, and treat
>> +-    // punning through a union as legal, they can be special-cased.
>> +-    static_assert(
>> +-        sizeof(value) <= sizeof(*location),
>> +-        "size_t must not be smaller than int");
>> +-    memcpy(location, &value, sizeof(value));
>> +-}
>> +-} // namespace integer_storage
>> +-
>> +-namespace double_storage {
>> +-enum { word_length = sizeof(double) / sizeof(size_t) };
>> +-
>> +-inline double load(const size_t* location) {
>> +-    double value;
>> +-    memcpy(&value, location, sizeof(double));
>> +-    return value;
>> +-}
>> +-
>> +-inline void store(size_t* location, double value) {
>> +-    // NOTE: Most modern compilers optimize away this constant-size
>> +-    // memcpy into a single instruction. If any don't, and treat
>> +-    // punning through a union as legal, they can be special-cased.
>> +-    memcpy(location, &value, sizeof(double));
>> +-}
>> +-} // namespace double_storage
>> +-
>> + /// Represents a JSON value.  First, call get_type() to check its
>> type,
>> + /// which determines which methods are available.
>> + ///
>> +@@ -585,70 +548,10 @@
>> +         return length;
>> +     }
>> + 
>> +-    /// If a numeric value was parsed as a 32-bit integer, returns
>> it.
>> +-    /// Only legal if get_type() is TYPE_INTEGER.
>> +-    int get_integer_value() const {
>> +-        assert_tag(tag::integer);
>> +-        return integer_storage::load(payload);
>> +-    }
>> +-
>> +-    /// If a numeric value was parsed as a double, returns it.
>> +-    /// Only legal if get_type() is TYPE_DOUBLE.
>> +-    double get_double_value() const {
>> +-        assert_tag(tag::double_);
>> +-        return double_storage::load(payload);
>> +-    }
>> +-
>> +-    /// Returns a numeric value as a double-precision float.
>> +-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
>> +-    double get_number_value() const {
>> +-        assert_tag_2(tag::integer, tag::double_);
>> +-        if (value_tag == tag::integer) {
>> +-            return get_integer_value();
>> +-        } else {
>> +-            return get_double_value();
>> +-        }
>> +-    }
>> +-
>> +-    /// Returns true and writes to the output argument if the
>> numeric value
>> +-    /// fits in a 53-bit integer.  This is useful for timestamps
>> and other
>> +-    /// situations where integral values with greater than 32-bit
>> precision
>> +-    /// are used, as 64-bit values are not understood by all JSON
>> +-    /// implementations or languages.
>> +-    /// Returns false if the value is not an integer or not in
>> range.
>> +-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
>> +-    bool get_int53_value(int64_t* out) const {
>> +-        // Make sure the output variable is always defined to avoid
>> any
>> +-        // possible situation like
>> +-        //
>> https://gist.github.com/chadaustin/2c249cb850619ddec05b23ca42cf7a18
>> +-        *out = 0;
>> +-
>> +-        assert_tag_2(tag::integer, tag::double_);
>> +-        switch (value_tag) {
>> +-        case tag::integer:
>> +-            *out = get_integer_value();
>> +-            return true;
>> +-        case tag::double_: {
>> +-            double v = get_double_value();
>> +-            if (v < -(1LL << 53) || v > (1LL << 53)) {
>> +-                return false;
>> +-            }
>> +-            int64_t as_int = static_cast<int64_t>(v);
>> +-            if (as_int != v) {
>> +-                return false;
>> +-            }
>> +-            *out = as_int;
>> +-            return true;
>> +-        }
>> +-        default:
>> +-            return false;
>> +-        }
>> +-    }
>> +-
>> +     /// Returns the length of the string.
>> +     /// Only legal if get_type() is TYPE_STRING.
>> +     size_t get_string_length() const {
>> +-        assert_tag(tag::string);
>> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
>> +         return payload[1] - payload[0];
>> +     }
>> + 
>> +@@ -659,7 +562,7 @@
>> +     /// embedded NULs.
>> +     /// Only legal if get_type() is TYPE_STRING.
>> +     const char* as_cstring() const {
>> +-        assert_tag(tag::string);
>> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
>> +         return text + payload[0];
>> +     }
>> + 
>> +@@ -667,7 +570,7 @@
>> +     /// Returns a string's value as a std::string.
>> +     /// Only legal if get_type() is TYPE_STRING.
>> +     std::string as_string() const {
>> +-        assert_tag(tag::string);
>> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
>> +         return std::string(text + payload[0], text + payload[1]);
>> +     }
>> + #endif
>> +@@ -690,6 +593,10 @@
>> +         assert(e1 == value_tag || e2 == value_tag);
>> +     }
>> + 
>> ++    void assert_tag_3(tag e1, tag e2, tag e3) const {
>> ++        assert(e1 == value_tag || e2 == value_tag || e3 ==
>> value_tag);
>> ++    }
>> ++
>> +     void assert_in_bounds(size_t i) const { assert(i <
>> get_length()); }
>> + 
>> +     const tag value_tag;
>> +@@ -2059,6 +1966,8 @@
>> +     std::pair<char*, internal::tag> parse_number(char* p) {
>> +         using internal::tag;
>> + 
>> ++      size_t start = p - input.get_data();
>> ++
>> +         // Assume 32-bit, two's complement integers.
>> +         static constexpr unsigned RISKY = INT_MAX / 10u;
>> +         unsigned max_digit_after_risky = INT_MAX % 10u;
>> +@@ -2235,23 +2144,18 @@
>> +                 u = 0u - u;
>> +             }
>> +         }
>> ++
>> ++        bool success;
>> ++        size_t* out = allocator.reserve(2, &success);
>> ++        if (SAJSON_UNLIKELY(!success)) {
>> ++            return std::make_pair(oom(p, "number"), tag::null);
>> ++        }
>> ++        out[0] = start;
>> ++        out[1] = p - input.get_data();
>> ++
>> +         if (try_double) {
>> +-            bool success;
>> +-            size_t* out
>> +-                = allocator.reserve(double_storage::word_length,
>> &success);
>> +-            if (SAJSON_UNLIKELY(!success)) {
>> +-                return std::make_pair(oom(p, "double"), tag::null);
>> +-            }
>> +-            double_storage::store(out, d);
>> +             return std::make_pair(p, tag::double_);
>> +         } else {
>> +-            bool success;
>> +-            size_t* out
>> +-                = allocator.reserve(integer_storage::word_length,
>> &success);
>> +-            if (SAJSON_UNLIKELY(!success)) {
>> +-                return std::make_pair(oom(p, "integer"),
>> tag::null);
>> +-            }
>> +-            integer_storage::store(out, static_cast<int>(u));
>> +             return std::make_pair(p, tag::integer);
>> +         }
>> +     }
> Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 07/11] gnu: Add freesasa.
  2022-10-04  8:02   ` Liliana Marie Prikler
@ 2022-10-07 15:12     ` David Elsing
  2022-10-07 15:19       ` Liliana Marie Prikler
  0 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:12 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

> Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
>> * gnu/packages/chemistry.scm (freesasa): New variable.
>> ---
>>  gnu/packages/chemistry.scm | 81
>> ++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 81 insertions(+)
>> 
>> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
>> index f8fd85814f..223a27a20d 100644
>> --- a/gnu/packages/chemistry.scm
>> +++ b/gnu/packages/chemistry.scm
>> @@ -34,11 +34,13 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages algebra)
>>    #:use-module (gnu packages autotools)
>>    #:use-module (gnu packages backup)
>> +  #:use-module (gnu packages bison)
>>    #:use-module (gnu packages boost)
>>    #:use-module (gnu packages check)
>>    #:use-module (gnu packages compression)
>>    #:use-module (gnu packages cpp)
>>    #:use-module (gnu packages documentation)
>> +  #:use-module (gnu packages flex)
>>    #:use-module (gnu packages fontutils)
>>    #:use-module (gnu packages gl)
>>    #:use-module (gnu packages graphviz)
>> @@ -54,6 +56,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages serialization)
>>    #:use-module (gnu packages sphinx)
>>    #:use-module (gnu packages stb)
>> +  #:use-module (gnu packages web)
>>    #:use-module (gnu packages xml)
>>    #:use-module (guix build-system cmake)
>>    #:use-module (guix build-system copy)
>> @@ -688,3 +691,81 @@ (define-public gemmi
>>  @item crystallographic symmetry.
>>  @end enumerate")
>>      (license license:mpl2.0)))
>> +
>> +(define-public freesasa
>> +  (package
>> +    (name "freesasa")
>> +    (version "2.1.2")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/mittinatten/freesasa")
>> +                    (commit version)))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "07wdnahf3g355ryaiqvfxd5f4rl54wv8jwxcbn0nia89fqysbv0f"))
>> +              (modules '((guix build utils)))
>> +              (snippet
>> +               '(begin
>> +                  ;; Remove C files generated by Flex and Bison
>> +                  (for-each delete-file
>> +                            '("src/parser.c" "src/parser.h"
>> +                              "src/lexer.c" "src/lexer.h"))
>> +                  #t))))
>> +    (build-system gnu-build-system)
>> +    (inputs
>> +     (list gemmi json-c libxml2))
>> +    (native-inputs
>> +     (list bison flex check autoconf automake pkg-config doxygen
>> perl libtool))
>> +    (outputs '("out" "doc"))
>> +    (arguments
>> +     (list
>> +      #:configure-flags
>> +      #~(list "--enable-check"
>> +              "--enable-parser-generator"
>> +              "CXXFLAGS=-std=c++17"
>> +              "--enable-doxygen")
>> +      #:phases
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'unpack 'remove-libc++-linking
>> +            (lambda _
>> +              (substitute* "src/Makefile.am"
>> +                (("-lc\\+\\+") ""))
>> +              #t))
> Why?  If it's because you're building a shared library, do this in the
> next phase.
This is libc++ from LLVM and the linking against the standard library is
automatic anyway, right?
>> +          (add-after 'unpack 'build-shared-library
>> +            (lambda _
>> +              (substitute* "src/Makefile.am"
>> +                (("lib_LIBRARIES") "lib_LTLIBRARIES")
>> +                (("libfreesasa\\.a") "libfreesasa.la")
>> +                (("freesasa_LDADD \\+= libfreesasa\\.la" prev)
>> +                 (string-append prev "\nlibfreesasa_la_LIBADD"
>> +                                " = -ljson-c ${libxml2_LIBS}\n"))
>> +                (("_a_SOURCES") "_la_SOURCES"))
>> +              (substitute* "configure.ac"
>> +                (("AC_PROG_INSTALL" inst)
>> +                 (string-append "AM_PROG_LIBTOOL\n" inst)))
>> +              (substitute* "tests/Makefile.am"
>> +                (("libfreesasa\\.a") "libfreesasa.la"))
>> +              #t))
>> +          (add-before 'build 'build-lexer-and-parser
>> +            (lambda _
>> +              (with-directory-excursion "src"
>> +                (invoke "make" "lexer.h")
>> +                (invoke "make" "parser.h"))
>> +              #t))
> You can do this in one make.
>> +          (add-after 'install 'install-doc
>> +            (lambda _
>> +              (copy-recursively
>> +               "doc/html"
>> +               (string-append #$output:doc "/share/doc/" #$name "-"
>> #$version))
>> +              #t)))))
>> +    (home-page "https://freesasa.github.io/")
>> +    (synopsis "Library for calculating the solvent accessible
>> surface area
>> +(SASA) of molecules")
> "Calculate the..."
>> +    (description "FreeSASA is a command line tool and C-library for
>> +calculating solvent accessible surface areas (SASA).  By default Lee
>> &
> Use @abbr.
I get the error "warning: invalid Texinfo markup", do you have an idea why?
>> +Richards' algorithm is used, but Shrake & Rupley's is also
>> available.  Both can
>> +be parameterized to arbitrary precision, and for high resolution
>> versions of
>> +the algorithms, the calculations give identical results.")
>> +    (license license:expat)))
>
> Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 10/11] gnu: Add yaehmop-tightbind.
  2022-10-04  7:54   ` Liliana Marie Prikler
@ 2022-10-07 15:12     ` David Elsing
  2022-10-07 15:25       ` Liliana Marie Prikler
  0 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:12 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

> Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
>> * gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
>> ---
>>  gnu/packages/chemistry.scm | 82
>> ++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 82 insertions(+)
>> 
>> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
>> index cc26aa329a..a39deff4bf 100644
>> --- a/gnu/packages/chemistry.scm
>> +++ b/gnu/packages/chemistry.scm
>> @@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages documentation)
>>    #:use-module (gnu packages flex)
>>    #:use-module (gnu packages fontutils)
>> +  #:use-module (gnu packages gcc)
>>    #:use-module (gnu packages gl)
>>    #:use-module (gnu packages graphviz)
>>    #:use-module (gnu packages gv)
>> @@ -817,3 +818,84 @@ (define-public coordgenlibs
>>      (description "@code{coordgenlibs} contains algorithms to
>> generate 2D
>>  coordinates.  It has an emphasis on quality rather than speed.")
>>      (license license:bsd-3)))
>> +
>> +(define-public yaehmop-tightbind
>> +  (package
>> +    (name "yaehmop-tightbind")
>> +    (version "2022.09.1")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/greglandrum/yaehmop")
>> +                    (commit (string-append "v" version))))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
>> +              (modules '((guix build utils)))
>> +              (snippet
>> +               '(begin
>> +                  (delete-file-recursively "docs")
> This one looks suspicious.
>> +                  (delete-file-recursively "examples")
> As does this.
> What gives?
I did not want to check the documentation in detail and the examples
contain some corrupted "compress" archives of program outputs. :)
But now I build the documentation instead and remove the archives.
There still is one problem: Even though I set FORCE_SOURCE_DATE=1, the
output of pdflatex is still not reproducible. Do you have an idea why
that could be? There are only 3 bytes different in the pdf.
Alternatively, I could just not build the documentation as it is
independent of the build scripts anyway.
>> +                  (delete-file-recursively "viewkel")
>> +                  (delete-file-recursively "tightbind/f2c_files")
>> +                  (delete-file "tightbind/diag.c")
>> +                  (delete-file "tightbind/cboris.c")
>> +                  (delete-file "tightbind/abfns.c")
>> +                  (delete-file "tightbind/lovlap.c")
>> +                  #t))))
>> +    (build-system cmake-build-system)
>> +    (native-inputs (list gfortran))
>> +    (inputs (list openblas))
>> +    (arguments
>> +     (list
>> +      #:configure-flags
>> +      #~(list
>> +         "-DUSE_BLAS_LAPACK=ON"
>> +         (string-append "-DPARM_FILE_LOC=" #$output
>> +                        "/share/" #$name "-" #$version
>> "/eht_parms.dat")
>> +         "-DBIND_EXE_NAME=yaehmop-bind")
>> +      #:phases
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'unpack 'chdir
>> +            (lambda _
>> +              (chdir "tightbind")
>> +              #t))
>> +          (add-after 'chdir 'patch-fortran-functions
>> +            (lambda _
>> +              (substitute* '("mov.c" "prototypes.h")
>> +                (("lovlap\\(") "lovlap_(")
>> +                (("abfns\\(") "abfns_("))
>> +              #t))
>> +          (add-after 'chdir 'patch-cmake
>> +            (lambda _
>> +              (substitute* "CMakeLists.txt"
>> +                (("project\\(yaehmop C\\)") "project(yaehmop C
>> Fortran)")
>> +                (("abfns.c") "fortran77/abfns.f")
>> +                (("lovlap.c") "fortran77/lovlap.f")
>> +                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
>> +                 (string-append init " CACHE STRING \"\")"))
>> +                (("add_library\\(yaehmop_eht" lib)
>> +                 (string-append lib " SHARED "))
>> +                (("target_link_libraries\\(test_eht
>> \\$\\{LAPACK_LIBRARIES\\}.*"
>> +                  all)
>> +                 (string-append all
>> "\ntarget_link_libraries(yaehmop_eht "
>> +                                "${LAPACK_LIBRARIES})\n")))
>> +              #t))
>> +          (add-after 'install 'install-eht-parms
>> +            (lambda _
>> +              (install-file "../tightbind/eht_parms.dat"
>> +                            (string-append #$output "/share/"
>> +                                           #$name "-" #$version))
>> +              #t))
>> +          (delete 'check)
>> +          (add-after 'install-eht-parms 'check
>> +            (lambda* (#:key tests? #:allow-other-keys)
>> +              (when tests?
>> +                (invoke "./test_eht"))
>> +              #t)))))
>> +    (home-page "https://github.com/greglandrum/yaehmop")
>> +    (synopsis "Yet Another extended Hueckel Molecular Orbital
>> Package")
>> +    (description "@code{YAeHMOP} contains a program and library for
>> performing
>> +extended Hückel calculations.")
>> +    (license license:bsd-2)))
> Looking at this it seems unclear whether you are building yaehmop or
> tightbind.  What's going on?
I'm building the yaehmop library (with the source code in tightbind/)
and the "bind" program (which I called yaehmop-bind) that uses the library.
Is it better to just call the package "yaehmop" (which I now did)?
The source also includes a separate visualization program "viewkel",
which does not use the library and would belong in another package in my
opinion.

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 11/11] gnu: Add rdkit.
  2022-10-04  8:13   ` Liliana Marie Prikler
@ 2022-10-07 15:12     ` David Elsing
  2022-10-07 15:29       ` Liliana Marie Prikler
  0 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:12 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

> Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
>> * gnu/packages/chemistry.scm (rdkit): New variable.
>> ---
>>  gnu/packages/chemistry.scm                    | 198
>> ++++++++++++++++++
>>  .../rdkit-cmake-external-dependencies.patch   | 102 +++++++++
>>  2 files changed, 300 insertions(+)
>>  create mode 100644 gnu/packages/patches/rdkit-cmake-external-
>> dependencies.patch
>> 
>> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
>> index a39deff4bf..869cf264e3 100644
>> --- a/gnu/packages/chemistry.scm
>> +++ b/gnu/packages/chemistry.scm
>> @@ -34,6 +34,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages algebra)
>>    #:use-module (gnu packages autotools)
>>    #:use-module (gnu packages backup)
>> +  #:use-module (gnu packages base)
>>    #:use-module (gnu packages bison)
>>    #:use-module (gnu packages boost)
>>    #:use-module (gnu packages check)
>> @@ -41,10 +42,12 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages cpp)
>>    #:use-module (gnu packages documentation)
>>    #:use-module (gnu packages flex)
>> +  #:use-module (gnu packages fonts)
>>    #:use-module (gnu packages fontutils)
>>    #:use-module (gnu packages gcc)
>>    #:use-module (gnu packages gl)
>>    #:use-module (gnu packages graphviz)
>> +  #:use-module (gnu packages gtk)
>>    #:use-module (gnu packages gv)
>>    #:use-module (gnu packages image)
>>    #:use-module (gnu packages maths)
>> @@ -56,6 +59,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages qt)
>>    #:use-module (gnu packages serialization)
>>    #:use-module (gnu packages sphinx)
>> +  #:use-module (gnu packages sqlite)
>>    #:use-module (gnu packages stb)
>>    #:use-module (gnu packages web)
>>    #:use-module (gnu packages xml)
>> @@ -899,3 +903,197 @@ (define-public yaehmop-tightbind
>>      (description "@code{YAeHMOP} contains a program and library for
>> performing
>>  extended Hückel calculations.")
>>      (license license:bsd-2)))
>> +
>> +(define-public rdkit
>> +  (package
>> +    (name "rdkit")
>> +    (version "2022.03.5")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/rdkit/rdkit")
>> +                    (commit
>> +                     (string-append
>> +                      "Release_" (string-replace-substring version
>> "." "_")))))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "19idgilabh04cbr1qj6zgrgsfjm248mmfz6fsr0smrd68d0xnml9"))
>> +              (patches
>> +               (search-patches "rdkit-cmake-external-
>> dependencies.patch"))
>> +              (modules '((guix build utils)))
>> +              (snippet
>> +               #~(begin
>> +                   ;; Remove pickle files (only used in tests),
>> +                   ;; as they are compiled programs
>> +                   (for-each
>> +                    (lambda (name)
>> +                      (display (string-append name "\n"))
>> +                      (delete-file name))
>> +                    (find-files "." "\\.pkl(\\.gz)?$"))
>> +                   ;; Remove SQLite data files (can be generated)
>> +                   (delete-file "Data/RDData.sqlt")
>> +                   (delete-file "Data/RDTests.sqlt")
>> +                   #t))))
>> +    (build-system cmake-build-system)
>> +    (native-inputs
>> +     `(("bison" ,bison)
>> +       ("boost" ,boost)
>> +       ("catch2" ,catch2)
>> +       ("eigen" ,eigen)
>> +       ("flex" ,flex)
>> +       ("freesasa" ,freesasa)
>> +       ("pkg-config" ,pkg-config)
>> +       ("rapidjson" ,rapidjson)
>> +       ("tar" ,tar)
>> +       ("avalontoolkit-src"
>> +        ,(let ((version "1.2.0"))
>> +           (origin
>> +             (method url-fetch)
>> +             (uri (string-append
>> +                  
>> "http://sourceforge.net/projects/avalontoolkit/files/"
>> +                   "AvalonToolkit_" (substring version 0 3)
>> "/AvalonToolkit_"
>> +                   version ".source.tar"))
>> +             (sha256
>> +              (base32
>> +              
>> "0rnnyy6axs2da7aa4q6l30ldavbk49v6l22llj1adn74h1i67bpv"))
>> +             (modules '((guix build utils) (ice-9 ftw) (srfi srfi-
>> 26)))
>> +             (snippet
>> +              #~(begin
>> +                  (chdir "..")
>> +                  (delete-file-recursively "StandardFiles")
>> +                  (delete-file-recursively
>> "SourceDistribution/java")
>> +                  #t)))))
>> +       ("ringdecomposerlib-src"
>> +        ,(let ((version "1.1.3"))
>> +           (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")))))))
>> +    (inputs
>> +     (list cairo
>> +           coordgenlibs
>> +           font-comic-neue
>> +           freetype
>> +           inchi
>> +           maeparser
>> +           python
>> +           sqlite
>> +           yaehmop-tightbind))
>> +    (propagated-inputs
>> +     (list python-numpy python-cairocffi python-pillow))
>> +    (arguments
>> +     (list
>> +      #: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)))
>> +      #:configure-flags
>> +      #~(list
>> +         "-DRDK_BUILD_AVALON_SUPPORT=ON"
>> +         "-DRDK_BUILD_CAIRO_SUPPORT=ON"
>> +         "-DRDK_BUILD_CPP_TESTS=ON"
>> +         "-DRDK_BUILD_FREESASA_SUPPORT=ON"
>> +         "-DRDK_BUILD_INCHI_SUPPORT=ON"
>> +         "-DRDK_BUILD_YAEHMOP_SUPPORT=ON"
>> +         (string-append "-DCATCH_DIR="
>> +                        #$(this-package-native-input "catch2")
>> +                        "/include/catch2")
>> +         "-DRDK_INSTALL_DEV_COMPONENT=ON"
>> +         "-DRDK_INSTALL_INTREE=OFF"
>> +         "-DRDK_INSTALL_STATIC_LIBS=OFF"
>> +         (string-append
>> +          "-DRDK_OPTIMIZE_POPCNT="
>> +          #$(let ((system (or (%current-target-system)
>> +                              (%current-system))))
>> +              (cond
>> +               ((string-prefix? "x86_64" system) "ON")
>> +               ((string-prefix? "i686" system) "ON")
>> +               (else "OFF"))))
>> +         "-DRDK_USE_BOOST_IOSTREAMS=ON"
>> +         "-DRDK_USE_FLEXBISON=ON")
>> +      #:phases
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'unpack 'copy-external-dependencies
>> +            (lambda _
>> +              (symlink
>> +               (string-append
>> +                #$(this-package-input "font-comic-neue")
>> +                "/share/fonts/truetype/ComicNeue-Regular.ttf")
>> +               "Data/Fonts/ComicNeue-Regular.ttf")
>> +              (symlink #$(this-package-native-input "rapidjson")
>> +                       "External/rapidjson-1.1.0")
>> +              (invoke "tar" "xvf"
>> +                      #$(this-package-native-input "avalontoolkit-
>> src")
>> +                      "-C" "External/AvalonTools")
>> +              (symlink #$(this-package-native-input
>> "ringdecomposerlib-src")
>> +                       "External/RingFamilies/RingDecomposerLib")
>> +              #t))
> You might want to try unbundling those.  Either way, you should find a
> solution that doesn't depend on native-input labels.
Ok, I unbundled them, but the package definitions became a bit long. :)
Do you think it is ok like that?
>> +          (add-after 'copy-external-dependencies 'patch-source
>> +            (lambda _
>> +              (with-directory-excursion "External/AvalonTools"
>> +                (invoke "patch" "-p0" "-i"
>> +                        "AvalonToolkit_1.2_patch.txt"))
>> +              (substitute* "External/YAeHMOP/EHTTools.cpp"
>> +                (("<yaehmop/tightbind/bind.h>") "<yaehmop/bind.h>"))
>> +              #t))
> See my comment on yaehmop.
>> +          (add-after 'unpack 'create-sqlite-data-files
>> +            (lambda _
>> +              (invoke "sqlite3" "Data/RDData.sqlt"
>> +                      ".read rdkit/Dbase/test_data/RDData.sqlite")
>> +              (invoke "sqlite3" "Data/RDTests.sqlt"
>> +                      ".read rdkit/Dbase/test_data/RDTests.sqlite")
>> +              #t))
> Do you only need this for tests?  If so, do this in a pre-check phase.
Ok.
>> +          (add-after 'unpack 'fix-inchi-include
>> +            (lambda _
>> +              (substitute* "Code/cmake/Modules/FindInchi.cmake"
>> +                (("inchi_api.h.*\\)") "inchi/inchi_api.h)")
>> +                (("INCHI_LIBRARY NAMES.*\\)")
>> +                 "INCHI_LIBRARY NAMES inchi PATH_SUFFIXES inchi)")
>> +                (("find_library" prev)
>> +                 (string-append
>> +                  "list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.1)\n"
>> +                  prev)))
>> +              (substitute* "External/INCHI-API/inchi.cpp"
>> +                (("<inchi_api.h>") "<inchi/inchi_api.h>"))
>> +              #t))
>> +          (add-before 'build 'enable-bytecode-determinism
>> +              (lambda _
>> +                (setenv "PYTHONHASHSEED" "0")
>> +                (setenv "PYTHONDONTWRITEBYTECODE" "1")
>> +                #t))
>> +          (delete 'check)
>> +          (add-after 'install 'check
>> +            (lambda* (#:key inputs outputs tests? parallel-tests?
>> +                      #:allow-other-keys)
>> +              (when tests?
>> +                (let
>> +                    ((job-count (number->string
>> +                                 (or (and parallel-tests?
>> +                                          (parallel-job-count))
>> +                                     1))))
>> +                  (setenv "RDBASE" (canonicalize-path "../source"))
>> +                  (add-installed-pythonpath inputs outputs)
> This line should also be pre-check, maybe even these two lines.
>> +                  (invoke "ctest"
>> +                          "-j" job-count
>> +                          "-E" (string-append
>> +                                ;; need pickled data
>> +                                "(pyDiscreteValueVect"
>> "|pySparseIntVect"
>> +                                "|graphmoltestPickler"
>> "|pyPartialCharges"
>> +                                "|substructLibraryTest"
>> "|pyFeatures"
>> +                                "|pythonTestDirML"
>> "|pythonTestDirChem"
>> +                                ;; Catching Python exception fails
>> +                                "|pyRanker)"))))
> Use string-join instead.
Thanks!
>> +              #t)))))
>> +    (home-page "https://rdkit.org/")
>> +    (synopsis "Open-Source Cheminformatics Software")
> "Open-Source" is meaningless in Guix.
>> +    (description "RDKit is a collection of cheminformatics and
>> +machine-learning software written in C++ and Python.")
> Not particularly descriptive, but then again, neither is rdkit itself.
>
> Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 04/11] gnu: Add tinydir.
  2022-10-07 15:11     ` David Elsing
@ 2022-10-07 15:13       ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-07 15:13 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:11 +0000 schrieb David Elsing:
> Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:
> 
> > Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> > > * gnu/packages/cpp.scm (tinydir): New variable.
> > > ---
> > >  gnu/packages/cpp.scm | 38 ++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 38 insertions(+)
> > > 
> > > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> > > index 7bfa3d6cdf..4819f36052 100644
> > > --- a/gnu/packages/cpp.scm
> > > +++ b/gnu/packages/cpp.scm
> > > @@ -2020,3 +2020,41 @@ (define-public sajson
> > >        (description "sajson is a high-performance, in-place JSON
> > > parser
> > >  header-only library.")
> > >        (license license:expat))))
> > > +
> > > +(define-public tinydir
> > > +  (package
> > > +    (name "tinydir")
> > > +    (version "1.2.5")
> > > +    (source (origin
> > > +              (method git-fetch)
> > > +              (uri (git-reference
> > > +                    (url "https://github.com/cxong/tinydir")
> > > +                    (commit version)))
> > > +              (file-name (git-file-name name version))
> > > +              (sha256
> > > +               (base32
> > > +               
> > > "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
> > > +              (modules '((guix build utils)))
> > > +              (snippet '(delete-file-recursively
> > > "tests/cbehave"))))
> > > +    (build-system cmake-build-system)
> > > +    (arguments
> > > +     (list
> > > +      ;; Tests require cbehave and rlutil
> > > +      #:tests? #f
> > Then those should be packaged.
> The problem is that the tests include a non-trivially modified
> fork of cbehave, which uses an older (bundled) copy of rlutil for
> color output. How should I deal with that?
> > 
You could try to make the tests run with the upstream version and
disable those that don't.  Alternatively, you could package "for-
tinydir" variants of those packages, which inherit as much from
upstream as possible.

Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 06/11] gnu: Add gemmi.
  2022-10-07 15:11     ` David Elsing
@ 2022-10-07 15:17       ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-07 15:17 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:11 +0000 schrieb David Elsing:
> Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:
> 
> > Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> > > * gnu/packages/chemistry.scm (gemmi): New variable.
> > > ---
> > >  gnu/packages/chemistry.scm                    | 122 +++++++++++
> > >  .../patches/gemmi-fix-sajson-types.patch      |  11 +
> > >  .../sajson-for-gemmi-numbers-as-strings.patch | 195
> > > ++++++++++++++++++
> > >  3 files changed, 328 insertions(+)
> > >  create mode 100644 gnu/packages/patches/gemmi-fix-sajson-
> > > types.patch
> > >  create mode 100644 gnu/packages/patches/sajson-for-gemmi-
> > > numbers-as-
> > > strings.patch
> > > 
> > > diff --git a/gnu/packages/chemistry.scm
> > > b/gnu/packages/chemistry.scm
> > > index c517610fe8..f8fd85814f 100644
> > > --- a/gnu/packages/chemistry.scm
> > > +++ b/gnu/packages/chemistry.scm
> > > @@ -6,6 +6,7 @@
> > >  ;;; Copyright © 2020 Björn Höfling
> > > <bjoern.hoefling@bjoernhoefling.de>
> > >  ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
> > >  ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
> > > +;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
> > >  ;;;
> > >  ;;; This file is part of GNU Guix.
> > >  ;;;
> > > @@ -23,6 +24,7 @@
> > >  ;;; along with GNU Guix.  If not, see
> > > <http://www.gnu.org/licenses/>.
> > >  
> > >  (define-module (gnu packages chemistry)
> > > +  #:use-module (guix gexp)
> > >    #:use-module (guix packages)
> > >    #:use-module (guix utils)
> > >    #:use-module ((guix licenses) #:prefix license:)
> > > @@ -35,6 +37,7 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages boost)
> > >    #:use-module (gnu packages check)
> > >    #:use-module (gnu packages compression)
> > > +  #:use-module (gnu packages cpp)
> > >    #:use-module (gnu packages documentation)
> > >    #:use-module (gnu packages fontutils)
> > >    #:use-module (gnu packages gl)
> > > @@ -50,8 +53,10 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages qt)
> > >    #:use-module (gnu packages serialization)
> > >    #:use-module (gnu packages sphinx)
> > > +  #:use-module (gnu packages stb)
> > >    #:use-module (gnu packages xml)
> > >    #:use-module (guix build-system cmake)
> > > +  #:use-module (guix build-system copy)
> > >    #:use-module (guix build-system gnu)
> > >    #:use-module (guix build-system python))
> > >  
> > > @@ -566,3 +571,120 @@ (define-public python-pymol
> > >  used to prepare publication-quality figures, to share
> > > interactive
> > > results with
> > >  your colleagues, or to generate pre-rendered animations.")
> > >      (license license:bsd-3)))
> > > +
> > > +(define sajson-for-gemmi
> > > +  (package/inherit sajson
> > > +    (name "sajson-for-gemmi")
> > > +    (source (origin
> > > +              (inherit (package-source sajson))
> > > +              (patches (cons
> > > +                        (search-patch
> > > +                         "sajson-for-gemmi-numbers-as-
> > > strings.patch")
> > > +                        (origin-patches (package-source
> > > sajson))))))
> > > +    (build-system copy-build-system)
> > > +    (arguments
> > > +     (list
> > > +      #:install-plan
> > > +      #~'(("include/sajson.h" "include/")
> > > +          ("include/sajson_ostream.h" "include/"))))))
> > These are technically two packages; therefore two patches.
> > You should reuse as much as you can from sajson.  Since this patch
> > is
> > likely to break tests, you might use an appropriately annotated
> > #:tests? #f to convey this information.
> > 
> You mean to copy the GCC10 patch?
> Building the tests also fails, but the rest works. :)
> Should I put it in a separate commit?
One commit for sajson-for-gemmi, one commit for gemmi.
"Reuse as much as possible" particularly means reuse the build system,
but highlight that #:tests? need to be set to #f.  (Also, use
substitute-keyword-arguments to actually set it to #f.)

> > > +(define-public gemmi
> > > +  (package
> > > +    (name "gemmi")
> > > +    (version "0.5.7")
> > > +    (source (origin
> > > +              (method git-fetch)
> > > +              (uri (git-reference
> > > +                    (url
> > > "https://github.com/project-gemmi/gemmi")
> > > +                    (commit (string-append "v" version))))
> > > +              (file-name (git-file-name name version))
> > > +              (sha256
> > > +               (base32
> > > +               
> > > "00km5q726bslrw7xbfwb3f3mrsk19qbimfnl3hvr4wi1y3z8i18a"))
> > > +              (patches
> > > +               (search-patches "gemmi-fix-sajson-types.patch"))
> > > +              (modules '((guix build utils)))
> > > +              (snippet
> > > +               '(begin
> > > +                  (delete-file-recursively
> > > "include/gemmi/third_party")
> > > +                  (delete-file-recursively "third_party")
> > > +                  #t))))
> > > +    (build-system cmake-build-system)
> > > +    (native-inputs (list optionparser pybind11))
> > > +    (propagated-inputs
> > > +     (list fast-float
> > > +           pocketfft
> > > +           sajson-for-gemmi
> > > +           stb-sprintf
> > > +           pegtl
> > > +           tinydir))
> > Refrain from propagating inputs.
> Ah ok.
> > > +    (inputs (list zlib python))
> > > +    (outputs '("out" "bin" "python"))
> > > +    (arguments
> > The usual sequence is outputs, build-system, arguments, *inputs.
> Is there also a usual sequence for the *inputs?
IIRC it's plain, propagated, native.
> > 

Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 07/11] gnu: Add freesasa.
  2022-10-07 15:12     ` David Elsing
@ 2022-10-07 15:19       ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-07 15:19 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:12 +0000 schrieb David Elsing:
> Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:
> 
> > Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> > > * gnu/packages/chemistry.scm (freesasa): New variable.
> > > ---
> > >  gnu/packages/chemistry.scm | 81
> > > ++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 81 insertions(+)
> > > 
> > > diff --git a/gnu/packages/chemistry.scm
> > > b/gnu/packages/chemistry.scm
> > > index f8fd85814f..223a27a20d 100644
> > > --- a/gnu/packages/chemistry.scm
> > > +++ b/gnu/packages/chemistry.scm
> > > @@ -34,11 +34,13 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages algebra)
> > >    #:use-module (gnu packages autotools)
> > >    #:use-module (gnu packages backup)
> > > +  #:use-module (gnu packages bison)
> > >    #:use-module (gnu packages boost)
> > >    #:use-module (gnu packages check)
> > >    #:use-module (gnu packages compression)
> > >    #:use-module (gnu packages cpp)
> > >    #:use-module (gnu packages documentation)
> > > +  #:use-module (gnu packages flex)
> > >    #:use-module (gnu packages fontutils)
> > >    #:use-module (gnu packages gl)
> > >    #:use-module (gnu packages graphviz)
> > > @@ -54,6 +56,7 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages serialization)
> > >    #:use-module (gnu packages sphinx)
> > >    #:use-module (gnu packages stb)
> > > +  #:use-module (gnu packages web)
> > >    #:use-module (gnu packages xml)
> > >    #:use-module (guix build-system cmake)
> > >    #:use-module (guix build-system copy)
> > > @@ -688,3 +691,81 @@ (define-public gemmi
> > >  @item crystallographic symmetry.
> > >  @end enumerate")
> > >      (license license:mpl2.0)))
> > > +
> > > +(define-public freesasa
> > > +  (package
> > > +    (name "freesasa")
> > > +    (version "2.1.2")
> > > +    (source (origin
> > > +              (method git-fetch)
> > > +              (uri (git-reference
> > > +                    (url
> > > "https://github.com/mittinatten/freesasa")
> > > +                    (commit version)))
> > > +              (file-name (git-file-name name version))
> > > +              (sha256
> > > +               (base32
> > > +               
> > > "07wdnahf3g355ryaiqvfxd5f4rl54wv8jwxcbn0nia89fqysbv0f"))
> > > +              (modules '((guix build utils)))
> > > +              (snippet
> > > +               '(begin
> > > +                  ;; Remove C files generated by Flex and Bison
> > > +                  (for-each delete-file
> > > +                            '("src/parser.c" "src/parser.h"
> > > +                              "src/lexer.c" "src/lexer.h"))
> > > +                  #t))))
> > > +    (build-system gnu-build-system)
> > > +    (inputs
> > > +     (list gemmi json-c libxml2))
> > > +    (native-inputs
> > > +     (list bison flex check autoconf automake pkg-config doxygen
> > > perl libtool))
> > > +    (outputs '("out" "doc"))
> > > +    (arguments
> > > +     (list
> > > +      #:configure-flags
> > > +      #~(list "--enable-check"
> > > +              "--enable-parser-generator"
> > > +              "CXXFLAGS=-std=c++17"
> > > +              "--enable-doxygen")
> > > +      #:phases
> > > +      #~(modify-phases %standard-phases
> > > +          (add-after 'unpack 'remove-libc++-linking
> > > +            (lambda _
> > > +              (substitute* "src/Makefile.am"
> > > +                (("-lc\\+\\+") ""))
> > > +              #t))
> > Why?  If it's because you're building a shared library, do this in
> > the
> > next phase.
> This is libc++ from LLVM and the linking against the standard library
> is
> automatic anyway, right?
> > > +          (add-after 'unpack 'build-shared-library
> > > +            (lambda _
> > > +              (substitute* "src/Makefile.am"
> > > +                (("lib_LIBRARIES") "lib_LTLIBRARIES")
> > > +                (("libfreesasa\\.a") "libfreesasa.la")
> > > +                (("freesasa_LDADD \\+= libfreesasa\\.la" prev)
> > > +                 (string-append prev "\nlibfreesasa_la_LIBADD"
> > > +                                " = -ljson-c
> > > ${libxml2_LIBS}\n"))
> > > +                (("_a_SOURCES") "_la_SOURCES"))
> > > +              (substitute* "configure.ac"
> > > +                (("AC_PROG_INSTALL" inst)
> > > +                 (string-append "AM_PROG_LIBTOOL\n" inst)))
> > > +              (substitute* "tests/Makefile.am"
> > > +                (("libfreesasa\\.a") "libfreesasa.la"))
> > > +              #t))
> > > +          (add-before 'build 'build-lexer-and-parser
> > > +            (lambda _
> > > +              (with-directory-excursion "src"
> > > +                (invoke "make" "lexer.h")
> > > +                (invoke "make" "parser.h"))
> > > +              #t))
> > You can do this in one make.
> > > +          (add-after 'install 'install-doc
> > > +            (lambda _
> > > +              (copy-recursively
> > > +               "doc/html"
> > > +               (string-append #$output:doc "/share/doc/" #$name
> > > "-"
> > > #$version))
> > > +              #t)))))
> > > +    (home-page "https://freesasa.github.io/")
> > > +    (synopsis "Library for calculating the solvent accessible
> > > surface area
> > > +(SASA) of molecules")
> > "Calculate the..."
> > > +    (description "FreeSASA is a command line tool and C-library
> > > for
> > > +calculating solvent accessible surface areas (SASA).  By default
> > > Lee
> > > &
> > Use @abbr.
> I get the error "warning: invalid Texinfo markup", do you have an
> idea why?
> > 
Typo'd?  @abbr{SASA, solvent accessible surface areas}

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 00/13] Add rdkit v2.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (10 preceding siblings ...)
  2022-10-03  0:19 ` [bug#58261] [PATCH 11/11] gnu: Add rdkit David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-09 10:02   ` Liliana Marie Prikler
                     ` (16 more replies)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 01/13] gnu: Add fast-float David Elsing
                   ` (12 subsequent siblings)
  24 siblings, 17 replies; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

Thanks a lot for your comments, they are very helpful!
Sorry about the descriptions, I took them mostly from upstream. :)
Are they still too short?

I still have the following problems:
* The tests of tinydir contain a bundled fork of cbehave which uses a
  (bundled) copy of rlutil, so I left them disabled for now.
* Building the documentation of yaehmop with pdflatex is not reproducible even
  though I set FORCE_SOURCE_DATE=1. Is it even necessary to build the
  documentation?
* Using @abbr in the description does not work (I also did not find it in any
  other package).

Greetings,
David

David Elsing (13):
  gnu: Add fast-float.
  gnu: Add pocketfft.
  gnu: Add sajson.
  gnu: Add tinydir.
  gnu: Add optionparser.
  gnu: Add gemmi.
  gnu: Add freesasa.
  gnu: Add maeparser.
  gnu: Add coordgenlibs.
  gnu: Add yaehmop-tightbind.
  gnu: Add avalontoolkit.
  gnu: Add ringdecomposerlib.
  gnu: Add rdkit.

 gnu/packages/chemistry.scm                    | 713 ++++++++++++++++++
 gnu/packages/cpp.scm                          | 232 ++++++
 .../patches/gemmi-fix-sajson-types.patch      |  11 +
 .../rdkit-cmake-external-dependencies.patch   | 102 +++
 .../patches/sajson-build-with-gcc10.patch     |  45 ++
 .../sajson-for-gemmi-build-with-gcc10.patch   |  45 ++
 .../sajson-for-gemmi-numbers-as-strings.patch | 195 +++++
 7 files changed, 1343 insertions(+)
 create mode 100644 gnu/packages/patches/gemmi-fix-sajson-types.patch
 create mode 100644 gnu/packages/patches/rdkit-cmake-external-dependencies.patch
 create mode 100644 gnu/packages/patches/sajson-build-with-gcc10.patch
 create mode 100644 gnu/packages/patches/sajson-for-gemmi-build-with-gcc10.patch
 create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch

-- 
2.37.0





^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 01/13] gnu: Add fast-float.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (11 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-09 10:04   ` Liliana Marie Prikler
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 02/13] gnu: Add pocketfft David Elsing
                   ` (11 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (fast-float): New variable.
---
 gnu/packages/cpp.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index d03e0bc7e1..a7404df563 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -29,6 +29,7 @@
 ;;; Copyright © 2022 muradm <mail@muradm.net>
 ;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
 ;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1907,3 +1908,56 @@ (define-public cpp-mustache
 templated string type for compatibility with any STL-like string (std::string,
 std::wstring, etc).")
     (license license:boost1.0)))
+
+(define-public fast-float
+  (package
+    (name "fast-float")
+    (version "3.5.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/fastfloat/fast_float")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0z3rxxd0pwvw70dbnv63rm67biw829vdqf50y16isxm6g3sbrz8g"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list
+         "-DFASTFLOAT_TEST=ON"
+         "-DSYSTEM_DOCTEST=ON")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-cmake-tests
+            (lambda _
+              (substitute* "tests/CMakeLists.txt"
+                (("FetchContent_GetProperties\\(supplemental_test_files.*")
+                 "")
+                (("if\\(NOT supplemental_test_files_POPULATED.*")
+                 (string-append
+                  "set(supplemental_test_files_BINARY_DIR "
+                  #$(this-package-native-input "test-data") "/data"
+                  ")\nif(0)\n"))))))))
+    (native-inputs
+     `(("test-data"
+        ,(let ((commit "97a0b2e638feb479387554cf253e346500541e7e"))
+           (origin
+             (method git-fetch)
+             (uri (git-reference
+                   (url
+                    "https://github.com/fastfloat/supplemental_test_files.git")
+                   (commit commit)))
+             (file-name (git-file-name "fast_float_test-data" commit))
+             (sha256
+              (base32
+               "0dxbiyzyh7i847i89ablfzypfc3ckhm7f74w98jsh73v1mppmxlf")))))
+       ("doctest" ,doctest)))
+    (home-page "https://github.com/fastfloat/fast_float")
+    (synopsis "Floating point number parser for C++")
+    (description "@code{fast_float} is a header-only C++ library for parsing
+floating point numbers from strings.  It implements the C++ from_chars
+functions for the float and double types.")
+    (license (list license:asl2.0 license:expat)))) ; dual licensed
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 02/13] gnu: Add pocketfft.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (12 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 01/13] gnu: Add fast-float David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-09 11:42   ` Liliana Marie Prikler
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 03/13] gnu: Add sajson David Elsing
                   ` (10 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (pocketfft): New variable.
---
 gnu/packages/cpp.scm | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index a7404df563..38a2a9e829 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1961,3 +1961,47 @@ (define-public fast-float
 floating point numbers from strings.  It implements the C++ from_chars
 functions for the float and double types.")
     (license (list license:asl2.0 license:expat)))) ; dual licensed
+
+(define-public pocketfft-cpp
+  (let ((commit "daa8bb18327bc5c7d22c69428c25cf5dc64167d3")
+        (revision "0"))
+    (package
+      (name "pocketfft-cpp")
+      (version (git-version "0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mreineck/pocketfft")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1dbkkqkmkxgmz1qjpsqzic5ig3qw1pqndbb3dvjc7xq5f2rdzyq1"))))
+      (build-system copy-build-system)
+      (arguments
+       (list
+        #:install-plan
+        #~'(("pocketfft_hdronly.h" "include/"))
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-before 'install 'patch-novectors
+              (lambda _
+                (substitute* "pocketfft_hdronly.h"
+                  (("#ifndef POCKETFFT_NO_VECTORS")
+                   "#if !(POCKETFFT_NO_VECTORS)")
+                  (("#if defined\\(POCKETFFT_NO_VECTORS\\)")
+                   "#if POCKETFFT_NO_VECTORS")
+                  (("#define POCKETFFT_NO_VECTORS")
+                   "#define POCKETFFT_NO_VECTORS 1")
+                  (("#\\s*undef POCKETFFT_NO_VECTORS")
+                   "#define POCKETFFT_NO_VECTORS 0")
+                  (("#define POCKETFFT_HDRONLY_H.*" orig)
+                   (string-append
+                    orig "\n#ifndef POCKETFFT_NO_VECTORS\n"
+                    "#define POCKETFFT_NO_VECTORS 1\n" "#endif\n"))))))))
+      (home-page "https://github.com/mreineck/pocketfft")
+      (synopsis "C++11 header-only Fast Fourier Transform library")
+      (description "This package provides a single-header C++11 library for
+computing Fast Fourier transformations.  It supports multidimensional arrays,
+different floating point sizes and complex transformations.")
+      (license license:bsd-3))))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 03/13] gnu: Add sajson.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (13 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 02/13] gnu: Add pocketfft David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-09 11:46   ` Liliana Marie Prikler
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 04/13] gnu: Add tinydir David Elsing
                   ` (9 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (sajson): New variable.
---
 gnu/packages/cpp.scm                          | 60 +++++++++++++++++++
 .../patches/sajson-build-with-gcc10.patch     | 45 ++++++++++++++
 2 files changed, 105 insertions(+)
 create mode 100644 gnu/packages/patches/sajson-build-with-gcc10.patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 38a2a9e829..dca0245df5 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -57,6 +57,7 @@ (define-module (gnu packages cpp)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system scons)
   #:use-module (guix modules)
   #:use-module (guix gexp)
   #:use-module (gnu packages)
@@ -2005,3 +2006,62 @@ (define-public pocketfft-cpp
 computing Fast Fourier transformations.  It supports multidimensional arrays,
 different floating point sizes and complex transformations.")
       (license license:bsd-3))))
+
+(define-public sajson
+  (let ((commit "ec644013e34f9984a3cc9ba568cab97a391db9cd")
+        (revision "0"))
+    (package
+      (name "sajson")
+      (version (git-version "1.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/chadaustin/sajson")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (patches
+                 (search-patches "sajson-build-with-gcc10.patch"))
+                (sha256
+                 (base32
+                  "0fjag27w7gvkc5pdhq3ad7yc09rabpzahndw1sgsg04ipznidmmq"))
+                (modules '((guix build utils)))
+                (snippet '(delete-file-recursively "third-party"))))
+      (build-system scons-build-system)
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'disable-other-builds
+              (lambda _
+                (substitute* "SConstruct"
+                  (("for name, tools in builds:")
+                   "for name, tools in [('opt', [gcc, opt])]:"))))
+            (add-after 'unpack 'use-external-unittest-cpp
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "SConscript"
+                  (("unittestpp_env\\.Library") "_dummy = ")
+                  (("test_env = env.Clone\\(tools=\\[unittestpp, sajson\\]\\)")
+                   (string-append
+                    "test_env = env.Clone(tools=[sajson])\n"
+                    "test_env.Append(CPPPATH='"
+                    (search-input-directory inputs "/include/UnitTest++")
+                    "', LIBPATH='"
+                    (string-append #$(this-package-native-input "unittest-cpp")
+                                   "/lib")
+                    "', LIBS=['UnitTest++'])")))))
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (invoke "build/opt/test")
+                  (invoke "build/opt/test_unsorted"))))
+            (replace 'install
+              (lambda _
+                (let ((out (string-append #$output "/include")))
+                  (install-file "include/sajson.h" out)
+                  (install-file "include/sajson_ostream.h" out)))))))
+      (native-inputs (list unittest-cpp))
+      (home-page "https://github.com/chadaustin/sajson")
+      (synopsis "C++11 header-only, in-place JSON parser")
+      (description "@code{sajson} is an in-place JSON parser with support for
+parsing with only a single memory allocation.")
+      (license license:expat))))
diff --git a/gnu/packages/patches/sajson-build-with-gcc10.patch b/gnu/packages/patches/sajson-build-with-gcc10.patch
new file mode 100644
index 0000000000..878706dc79
--- /dev/null
+++ b/gnu/packages/patches/sajson-build-with-gcc10.patch
@@ -0,0 +1,45 @@
+This patch is from the upstream pull request
+https://github.com/chadaustin/sajson/pull/54.
+It fixes linking with GCC.
+
+diff --git a/include/sajson.h b/include/sajson.h
+index 8b4e05a..1bd045b 100644
+--- a/include/sajson.h
++++ b/include/sajson.h
+@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t, size_t value) {
+ // header. This trick courtesy of Rich Geldreich's Purple JSON parser.
+ template <typename unused = void>
+ struct globals_struct {
++    static const unsigned char parse_flags[256];
++};
++typedef globals_struct<> globals;
++
+ // clang-format off
+ 
+     // bit 0 (1) - set if: plain ASCII string character
+     // bit 1 (2) - set if: whitespace
+     // bit 4 (0x10) - set if: 0-9 e E .
+-    constexpr static const uint8_t parse_flags[256] = {
++    template <typename unused>
++    const unsigned char globals_struct<unused>::parse_flags[256] = {
+      // 0    1    2    3    4    5    6    7      8    9    A    B    C    D    E    F
+         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,   2,   0,   0,   2,   0,   0, // 0
+         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,   0,   0,   0,   0,   0,   0, // 1
+@@ -162,15 +167,13 @@ struct globals_struct {
+     };
+ 
+ // clang-format on
+-};
+-typedef globals_struct<> globals;
+ 
+-constexpr inline bool is_plain_string_character(char c) {
++inline bool is_plain_string_character(char c) {
+     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
+     return (globals::parse_flags[static_cast<unsigned char>(c)] & 1) != 0;
+ }
+ 
+-constexpr inline bool is_whitespace(char c) {
++inline bool is_whitespace(char c) {
+     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
+     return (globals::parse_flags[static_cast<unsigned char>(c)] & 2) != 0;
+ }
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 04/13] gnu: Add tinydir.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (14 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 03/13] gnu: Add sajson David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-09 11:48   ` Liliana Marie Prikler
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 05/13] gnu: Add optionparser David Elsing
                   ` (8 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (tinydir): New variable.
---
 gnu/packages/cpp.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index dca0245df5..e99fdcecd8 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2065,3 +2065,30 @@ (define-public sajson
       (description "@code{sajson} is an in-place JSON parser with support for
 parsing with only a single memory allocation.")
       (license license:expat))))
+
+(define-public tinydir
+  (package
+    (name "tinydir")
+    (version "1.2.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/cxong/tinydir")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
+              (modules '((guix build utils)))
+              (snippet '(delete-file-recursively "tests/cbehave"))))
+    (build-system copy-build-system)
+    (arguments
+     (list
+      ;; TODO: Tests contain a private fork of cbehave and a bundled copy of rlutil
+      #:install-plan
+      #~'(("tinydir.h" "include/"))))
+    (home-page "https://github.com/cxong/tinydir")
+    (synopsis "C header-only directory and file reader")
+    (description "@code{tinydir} is a header-only C library to portably read
+files and directories.")
+    (license license:bsd-2)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 05/13] gnu: Add optionparser.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (15 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 04/13] gnu: Add tinydir David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 06/13] gnu: Add gemmi David Elsing
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (optionparser): New variable.
---
 gnu/packages/cpp.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index e99fdcecd8..d1c580a1fc 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2092,3 +2092,50 @@ (define-public tinydir
     (description "@code{tinydir} is a header-only C library to portably read
 files and directories.")
     (license license:bsd-2)))
+
+(define-public optionparser
+  (package
+    (name "optionparser")
+    (version "1.7")
+    (source (origin
+              (method url-fetch)
+              (uri
+               (string-append "mirror://sourceforge/optionparser/"
+                              "optionparser-" version ".tar.gz"))
+              (sha256
+               (base32
+                "04gfxrdzwacaynb8scsz6rr7nh64n6yk6w9dh2qdhrxw4caqr0dk"))))
+    (outputs '("out" "doc"))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure)
+          (add-before 'build 'chdir
+            (lambda _ (chdir "src")))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                  (begin
+                    (invoke "./example_arg")
+                    (invoke "./testparse")
+                    (invoke "./testprintusage")
+                    (invoke "./testodr")
+                    (invoke "./example")))))
+          (replace 'install
+            (lambda _
+              (install-file "optionparser.h" (string-append #$output "/include"))))
+          (add-after 'install 'install-doc
+            (lambda _
+              (copy-recursively
+               "../html"
+               (string-append #$output:doc "/share/doc/optionparser/html")))))))
+    (native-inputs (list doxygen))
+    (home-page "https://optionparser.sourceforge.net/")
+    (synopsis "Header-only C++ library to parse command line options")
+    (description "This library can be used to handle the command line
+arguments of a C++ program.  It supports the short and long option formats of
+getopt(), getopt_long() and getopt_long_only(), but has a more convenient
+interface.")
+    (license license:expat)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 06/13] gnu: Add gemmi.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (16 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 05/13] gnu: Add optionparser David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-09 11:54   ` Liliana Marie Prikler
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 07/13] gnu: Add freesasa David Elsing
                   ` (6 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (gemmi): New variable.
---
 gnu/packages/chemistry.scm                    | 118 +++++++++++
 .../patches/gemmi-fix-sajson-types.patch      |  11 +
 .../sajson-for-gemmi-build-with-gcc10.patch   |  45 ++++
 .../sajson-for-gemmi-numbers-as-strings.patch | 195 ++++++++++++++++++
 4 files changed, 369 insertions(+)
 create mode 100644 gnu/packages/patches/gemmi-fix-sajson-types.patch
 create mode 100644 gnu/packages/patches/sajson-for-gemmi-build-with-gcc10.patch
 create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index c517610fe8..d8f1608a3a 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -23,6 +24,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages chemistry)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix utils)
   #:use-module ((guix licenses) #:prefix license:)
@@ -35,6 +37,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cpp)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gl)
@@ -50,8 +53,10 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages stb)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python))
 
@@ -566,3 +571,116 @@ (define-public python-pymol
 used to prepare publication-quality figures, to share interactive results with
 your colleagues, or to generate pre-rendered animations.")
     (license license:bsd-3)))
+
+(define-public sajson-for-gemmi
+  (package/inherit sajson
+    (name "sajson-for-gemmi")
+    (source (origin
+              (inherit (package-source sajson))
+              (patches (search-patches
+                        "sajson-for-gemmi-numbers-as-strings.patch"
+                        "sajson-for-gemmi-build-with-gcc10.patch"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments sajson)
+       ((#:tests? _ #f) #f)
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (delete 'build)))))))
+
+(define-public gemmi
+  (package
+    (name "gemmi")
+    (version "0.5.7")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/project-gemmi/gemmi")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "00km5q726bslrw7xbfwb3f3mrsk19qbimfnl3hvr4wi1y3z8i18a"))
+              (patches
+               (search-patches "gemmi-fix-sajson-types.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (delete-file-recursively "include/gemmi/third_party")
+                  (delete-file-recursively "third_party")))))
+    (outputs '("out" "bin" "python"))
+    (build-system cmake-build-system)
+    (native-inputs
+     (list fast-float
+           optionparser
+           pegtl
+           pocketfft-cpp
+           pybind11
+           sajson-for-gemmi
+           stb-sprintf
+           tinydir))
+    (inputs (list python zlib))
+    (arguments
+     (list
+      #:configure-flags
+      #~(let* ((python-lib
+                (string-append
+                 #$output:python "/lib/python"
+                 #$(version-major+minor (package-version python))
+                 "/site-packages")))
+          (list "-DUSE_PYTHON=ON"
+                (string-append "-DPYTHON_INSTALL_DIR=" python-lib)))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-includes
+            (lambda _
+              (substitute* "include/gemmi/sprintf.hpp"
+                (("<stb/stb_sprintf.h>") "<stb_sprintf.h>"))
+              (substitute* "include/gemmi/dirwalk.hpp"
+                (("\"third_party/tinydir.h\"") "<tinydir.h>"))
+              (substitute* "include/gemmi/cif.hpp"
+                (("\"third_party/tao/pegtl.hpp\"") "<tao/pegtl.hpp>"))
+              (substitute* "include/gemmi/json.hpp"
+                (("\"third_party/sajson.h\"") "<sajson.h>"))
+              (substitute* "python/gemmi.cpp"
+                (("\"gemmi/third_party/tao/pegtl/parse_error.hpp\"")
+                 "<tao/pegtl/parse_error.hpp>"))
+              (substitute* '("include/gemmi/atof.hpp"
+                             "include/gemmi/numb.hpp")
+                (("\"third_party/fast_float.h\"")
+                 "<fast_float/fast_float.h>"))
+              (substitute* "include/gemmi/fourier.hpp"
+                (("\"third_party/pocketfft_hdronly.h\"")
+                 "<pocketfft_hdronly.h>"))))
+          (add-after 'patch-includes 'patch-cif
+            (lambda _
+              (substitute* "include/gemmi/cif.hpp"
+                (((string-append
+                   "^.*using analyze_t = pegtl::analysis::generic"
+                   "<pegtl::analysis::rule_type::ANY>;.*$")) "")
+                (("TAOCPP_PEGTL_") "TAO_PEGTL_"))))
+          (add-after 'unpack 'change-bin-prefix
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("install\\(TARGETS program DESTINATION bin\\)")
+                 (string-append
+                  "install(TARGETS program DESTINATION "
+                  #$output:bin "/bin)")))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (with-directory-excursion "../source"
+                  (setenv "PYTHONPATH" "../build")
+                  (invoke "python3" "-m" "unittest" "discover" "-v"
+                          "-s" "tests"))))))))
+    (home-page "https://gemmi.readthedocs.io/en/latest/")
+    (synopsis "Macromolecular crystallography library and utilities")
+    (description "GEMMI is a C++ library for macromolecular crystallography.
+It can be used for working with
+@enumerate
+@item macromolecular models (content of PDB, PDBx/mmCIF and mmJSON files),
+@item refinement restraints (CIF files),
+@item reflection data (MTZ and mmCIF formats),
+@item data on a 3D grid (electron density maps, masks, MRC/CCP4 format)
+@item crystallographic symmetry.
+@end enumerate")
+    (license license:mpl2.0)))
diff --git a/gnu/packages/patches/gemmi-fix-sajson-types.patch b/gnu/packages/patches/gemmi-fix-sajson-types.patch
new file mode 100644
index 0000000000..9633ddac8b
--- /dev/null
+++ b/gnu/packages/patches/gemmi-fix-sajson-types.patch
@@ -0,0 +1,11 @@
+diff -ur a/include/gemmi/json.hpp b/include/gemmi/json.hpp
+--- a/include/gemmi/json.hpp
++++ b/include/gemmi/json.hpp
+@@ -38,6 +38,7 @@
+ 
+ inline std::string as_cif_value(const sajson::value& val) {
+   switch (val.get_type()) {
++    case sajson::TYPE_INTEGER:
+     case sajson::TYPE_DOUBLE:
+       return val.as_string();
+     case sajson::TYPE_NULL:
diff --git a/gnu/packages/patches/sajson-for-gemmi-build-with-gcc10.patch b/gnu/packages/patches/sajson-for-gemmi-build-with-gcc10.patch
new file mode 100644
index 0000000000..878706dc79
--- /dev/null
+++ b/gnu/packages/patches/sajson-for-gemmi-build-with-gcc10.patch
@@ -0,0 +1,45 @@
+This patch is from the upstream pull request
+https://github.com/chadaustin/sajson/pull/54.
+It fixes linking with GCC.
+
+diff --git a/include/sajson.h b/include/sajson.h
+index 8b4e05a..1bd045b 100644
+--- a/include/sajson.h
++++ b/include/sajson.h
+@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t, size_t value) {
+ // header. This trick courtesy of Rich Geldreich's Purple JSON parser.
+ template <typename unused = void>
+ struct globals_struct {
++    static const unsigned char parse_flags[256];
++};
++typedef globals_struct<> globals;
++
+ // clang-format off
+ 
+     // bit 0 (1) - set if: plain ASCII string character
+     // bit 1 (2) - set if: whitespace
+     // bit 4 (0x10) - set if: 0-9 e E .
+-    constexpr static const uint8_t parse_flags[256] = {
++    template <typename unused>
++    const unsigned char globals_struct<unused>::parse_flags[256] = {
+      // 0    1    2    3    4    5    6    7      8    9    A    B    C    D    E    F
+         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,   2,   0,   0,   2,   0,   0, // 0
+         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,   0,   0,   0,   0,   0,   0, // 1
+@@ -162,15 +167,13 @@ struct globals_struct {
+     };
+ 
+ // clang-format on
+-};
+-typedef globals_struct<> globals;
+ 
+-constexpr inline bool is_plain_string_character(char c) {
++inline bool is_plain_string_character(char c) {
+     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
+     return (globals::parse_flags[static_cast<unsigned char>(c)] & 1) != 0;
+ }
+ 
+-constexpr inline bool is_whitespace(char c) {
++inline bool is_whitespace(char c) {
+     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
+     return (globals::parse_flags[static_cast<unsigned char>(c)] & 2) != 0;
+ }
diff --git a/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
new file mode 100644
index 0000000000..6f476b8583
--- /dev/null
+++ b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
@@ -0,0 +1,195 @@
+Patch for gemmi: Keep numbers in JSON file as strings.
+
+Adapted from this commit of the bundled fork of sajson in gemmi:
+https://github.com/project-gemmi/gemmi/commit/fccbca4f6040364ba708613e1429c2251872240d
+
+diff -ur a/include/sajson.h b/include/sajson.h
+--- a/include/sajson.h
++++ b/include/sajson.h
+@@ -411,43 +411,6 @@
+ };
+ } // namespace internal
+ 
+-namespace integer_storage {
+-enum { word_length = 1 };
+-
+-inline int load(const size_t* location) {
+-    int value;
+-    memcpy(&value, location, sizeof(value));
+-    return value;
+-}
+-
+-inline void store(size_t* location, int value) {
+-    // NOTE: Most modern compilers optimize away this constant-size
+-    // memcpy into a single instruction. If any don't, and treat
+-    // punning through a union as legal, they can be special-cased.
+-    static_assert(
+-        sizeof(value) <= sizeof(*location),
+-        "size_t must not be smaller than int");
+-    memcpy(location, &value, sizeof(value));
+-}
+-} // namespace integer_storage
+-
+-namespace double_storage {
+-enum { word_length = sizeof(double) / sizeof(size_t) };
+-
+-inline double load(const size_t* location) {
+-    double value;
+-    memcpy(&value, location, sizeof(double));
+-    return value;
+-}
+-
+-inline void store(size_t* location, double value) {
+-    // NOTE: Most modern compilers optimize away this constant-size
+-    // memcpy into a single instruction. If any don't, and treat
+-    // punning through a union as legal, they can be special-cased.
+-    memcpy(location, &value, sizeof(double));
+-}
+-} // namespace double_storage
+-
+ /// Represents a JSON value.  First, call get_type() to check its type,
+ /// which determines which methods are available.
+ ///
+@@ -585,70 +548,10 @@
+         return length;
+     }
+ 
+-    /// If a numeric value was parsed as a 32-bit integer, returns it.
+-    /// Only legal if get_type() is TYPE_INTEGER.
+-    int get_integer_value() const {
+-        assert_tag(tag::integer);
+-        return integer_storage::load(payload);
+-    }
+-
+-    /// If a numeric value was parsed as a double, returns it.
+-    /// Only legal if get_type() is TYPE_DOUBLE.
+-    double get_double_value() const {
+-        assert_tag(tag::double_);
+-        return double_storage::load(payload);
+-    }
+-
+-    /// Returns a numeric value as a double-precision float.
+-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
+-    double get_number_value() const {
+-        assert_tag_2(tag::integer, tag::double_);
+-        if (value_tag == tag::integer) {
+-            return get_integer_value();
+-        } else {
+-            return get_double_value();
+-        }
+-    }
+-
+-    /// Returns true and writes to the output argument if the numeric value
+-    /// fits in a 53-bit integer.  This is useful for timestamps and other
+-    /// situations where integral values with greater than 32-bit precision
+-    /// are used, as 64-bit values are not understood by all JSON
+-    /// implementations or languages.
+-    /// Returns false if the value is not an integer or not in range.
+-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
+-    bool get_int53_value(int64_t* out) const {
+-        // Make sure the output variable is always defined to avoid any
+-        // possible situation like
+-        // https://gist.github.com/chadaustin/2c249cb850619ddec05b23ca42cf7a18
+-        *out = 0;
+-
+-        assert_tag_2(tag::integer, tag::double_);
+-        switch (value_tag) {
+-        case tag::integer:
+-            *out = get_integer_value();
+-            return true;
+-        case tag::double_: {
+-            double v = get_double_value();
+-            if (v < -(1LL << 53) || v > (1LL << 53)) {
+-                return false;
+-            }
+-            int64_t as_int = static_cast<int64_t>(v);
+-            if (as_int != v) {
+-                return false;
+-            }
+-            *out = as_int;
+-            return true;
+-        }
+-        default:
+-            return false;
+-        }
+-    }
+-
+     /// Returns the length of the string.
+     /// Only legal if get_type() is TYPE_STRING.
+     size_t get_string_length() const {
+-        assert_tag(tag::string);
++        assert_tag_3(tag::string, tag::integer, tag::double_);
+         return payload[1] - payload[0];
+     }
+ 
+@@ -659,7 +562,7 @@
+     /// embedded NULs.
+     /// Only legal if get_type() is TYPE_STRING.
+     const char* as_cstring() const {
+-        assert_tag(tag::string);
++        assert_tag_3(tag::string, tag::integer, tag::double_);
+         return text + payload[0];
+     }
+ 
+@@ -667,7 +570,7 @@
+     /// Returns a string's value as a std::string.
+     /// Only legal if get_type() is TYPE_STRING.
+     std::string as_string() const {
+-        assert_tag(tag::string);
++        assert_tag_3(tag::string, tag::integer, tag::double_);
+         return std::string(text + payload[0], text + payload[1]);
+     }
+ #endif
+@@ -690,6 +593,10 @@
+         assert(e1 == value_tag || e2 == value_tag);
+     }
+ 
++    void assert_tag_3(tag e1, tag e2, tag e3) const {
++        assert(e1 == value_tag || e2 == value_tag || e3 == value_tag);
++    }
++
+     void assert_in_bounds(size_t i) const { assert(i < get_length()); }
+ 
+     const tag value_tag;
+@@ -2059,6 +1966,8 @@
+     std::pair<char*, internal::tag> parse_number(char* p) {
+         using internal::tag;
+ 
++	size_t start = p - input.get_data();
++
+         // Assume 32-bit, two's complement integers.
+         static constexpr unsigned RISKY = INT_MAX / 10u;
+         unsigned max_digit_after_risky = INT_MAX % 10u;
+@@ -2235,23 +2144,18 @@
+                 u = 0u - u;
+             }
+         }
++
++        bool success;
++        size_t* out = allocator.reserve(2, &success);
++        if (SAJSON_UNLIKELY(!success)) {
++            return std::make_pair(oom(p, "number"), tag::null);
++        }
++        out[0] = start;
++        out[1] = p - input.get_data();
++
+         if (try_double) {
+-            bool success;
+-            size_t* out
+-                = allocator.reserve(double_storage::word_length, &success);
+-            if (SAJSON_UNLIKELY(!success)) {
+-                return std::make_pair(oom(p, "double"), tag::null);
+-            }
+-            double_storage::store(out, d);
+             return std::make_pair(p, tag::double_);
+         } else {
+-            bool success;
+-            size_t* out
+-                = allocator.reserve(integer_storage::word_length, &success);
+-            if (SAJSON_UNLIKELY(!success)) {
+-                return std::make_pair(oom(p, "integer"), tag::null);
+-            }
+-            integer_storage::store(out, static_cast<int>(u));
+             return std::make_pair(p, tag::integer);
+         }
+     }
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 07/13] gnu: Add freesasa.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (17 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 06/13] gnu: Add gemmi David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 08/13] gnu: Add maeparser David Elsing
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (freesasa): New variable.
---
 gnu/packages/chemistry.scm | 86 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index d8f1608a3a..681e026186 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -34,11 +34,13 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
+  #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages graphviz)
@@ -54,6 +56,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages stb)
+  #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
@@ -684,3 +687,86 @@ (define-public gemmi
 @item crystallographic symmetry.
 @end enumerate")
     (license license:mpl2.0)))
+
+(define-public freesasa
+  (package
+    (name "freesasa")
+    (version "2.1.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/mittinatten/freesasa")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "07wdnahf3g355ryaiqvfxd5f4rl54wv8jwxcbn0nia89fqysbv0f"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Remove C files generated by Flex and Bison
+                  (for-each delete-file
+                            '("src/parser.c" "src/parser.h"
+                              "src/lexer.c" "src/lexer.h"))))))
+    (outputs '("out" "doc"))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "--enable-check"
+              "--enable-parser-generator"
+              "CXXFLAGS=-std=c++17"
+              "--enable-doxygen")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'remove-libc++-linking
+            (lambda _
+              (substitute* "src/Makefile.am"
+                (("-lc\\+\\+") ""))))
+          (add-after 'unpack 'build-shared-library
+            (lambda _
+              (substitute* "src/Makefile.am"
+                (("lib_LIBRARIES") "lib_LTLIBRARIES")
+                (("libfreesasa\\.a") "libfreesasa.la")
+                (("freesasa_LDADD \\+= libfreesasa\\.la" prev)
+                 (string-append prev "\nlibfreesasa_la_LIBADD"
+                                " = -ljson-c ${libxml2_LIBS}\n"))
+                (("_a_SOURCES") "_la_SOURCES"))
+              (substitute* "configure.ac"
+                (("AC_PROG_INSTALL" inst)
+                 (string-append "AM_PROG_LIBTOOL\n" inst)))
+              (substitute* "tests/Makefile.am"
+                (("libfreesasa\\.a") "libfreesasa.la"))))
+          (add-before 'build 'build-lexer-and-parser
+            (lambda _
+              (with-directory-excursion "src"
+                (invoke "make" "lexer.h" "parser.h"))))
+          (add-after 'install 'install-doc
+            (lambda _
+              (copy-recursively
+               "doc/html"
+               (string-append #$output:doc "/share/doc/" #$name "-" #$version)))))))
+    (native-inputs
+     (list autoconf
+           automake
+           bison
+           check
+           doxygen
+           fast-float
+           flex
+           libtool
+           pegtl
+           perl
+           pkg-config))
+    (inputs
+     (list gemmi json-c libxml2))
+    (home-page "https://freesasa.github.io/")
+    (synopsis "Calculate the solvent accessible surface area (SASA) of
+molecules")
+    ;; TODO: @abbr
+    (description "FreeSASA is a command line tool and C-library for
+calculating solvent accessible surface areas.  By default Lee & Richards'
+algorithm is used, but Shrake & Rupley's is also available.  Both can be
+parameterized to arbitrary precision, and for high resolution versions of the
+algorithms, the calculations give identical results.")
+    (license license:expat)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 08/13] gnu: Add maeparser.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (18 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 07/13] gnu: Add freesasa David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 09/13] gnu: Add coordgenlibs David Elsing
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (maeparser): New variable.
---
 gnu/packages/chemistry.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 681e026186..6eb1e4a694 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -770,3 +770,24 @@ (define-public freesasa
 parameterized to arbitrary precision, and for high resolution versions of the
 algorithms, the calculations give identical results.")
     (license license:expat)))
+
+(define-public maeparser
+  (package
+    (name "maeparser")
+    (version "1.3.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/schrodinger/maeparser")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1yv4y5hn49fhylziigsg922bb244lb57p69r7vg9q899zd3l5b7l"))))
+    (build-system cmake-build-system)
+    (native-inputs (list boost))
+    (inputs (list zlib))
+    (home-page "https://github.com/schrodinger/maeparser")
+    (synopsis "Maestro file parser")
+    (description "maeparser is a parser for Schrodinger Maestro files.")
+    (license license:expat)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 09/13] gnu: Add coordgenlibs.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (19 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 08/13] gnu: Add maeparser David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-09 11:56   ` Liliana Marie Prikler
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 10/13] gnu: Add yaehmop-tightbind David Elsing
                   ` (3 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (coordgenlibs): New variable.
---
 gnu/packages/chemistry.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 6eb1e4a694..1510cbab41 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -791,3 +791,30 @@ (define-public maeparser
     (synopsis "Maestro file parser")
     (description "maeparser is a parser for Schrodinger Maestro files.")
     (license license:expat)))
+
+(define-public coordgenlibs
+  (package
+    (name "coordgenlibs")
+    (version "3.0.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/schrodinger/coordgenlibs/")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0d09x3v38i9y184bml020bq7xizdrdwng38qmdxlplzfhqkjdidv"))))
+    (build-system cmake-build-system)
+    (native-inputs (list boost))
+    (inputs (list maeparser))
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "-DCOORDGEN_RIGOROUS_BUILD=OFF"
+              "-DCOORDGEN_USE_MAEPARSER=ON")))
+    (home-page "https://github.com/schrodinger/coordgenlibs/")
+    (synopsis "2D coordinate generation")
+    (description "@code{coordgenlibs} contains algorithms to generate 2D
+coordinates.  It has an emphasis on quality rather than speed.")
+    (license license:bsd-3)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 10/13] gnu: Add yaehmop-tightbind.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (20 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 09/13] gnu: Add coordgenlibs David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-09 12:02   ` Liliana Marie Prikler
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 11/13] gnu: Add avalontoolkit David Elsing
                   ` (2 subsequent siblings)
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
---
 gnu/packages/chemistry.scm | 110 +++++++++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 1510cbab41..68d28a52c3 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gv)
@@ -56,6 +57,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages stb)
+  #:use-module (gnu packages tex)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
@@ -818,3 +820,111 @@ (define-public coordgenlibs
     (description "@code{coordgenlibs} contains algorithms to generate 2D
 coordinates.  It has an emphasis on quality rather than speed.")
     (license license:bsd-3)))
+
+(define-public yaehmop
+  (package
+    (name "yaehmop")
+    (version "2022.09.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/greglandrum/yaehmop")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Separate program
+                  (delete-file-recursively "viewkel")
+                  ;; Remove example output (some are corrupted)
+                  (for-each delete-file (find-files "examples" "\\.Z$"))
+                  ;; Documentation outputs
+                  (for-each delete-file (find-files "docs" "\\.(ps|pdf)$"))
+                  ;; These are transpiled from Fortran to C, but we build the
+                  ;; Fortran code instead
+                  (delete-file-recursively "tightbind/f2c_files")
+                  (delete-file "tightbind/diag.c")
+                  (delete-file "tightbind/cboris.c")
+                  (delete-file "tightbind/abfns.c")
+                  (delete-file "tightbind/lovlap.c")))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list
+         "-DUSE_BLAS_LAPACK=ON"
+         (string-append "-DPARM_FILE_LOC=" #$output
+                        "/share/" #$name "-" #$version "/eht_parms.dat")
+         "-DBIND_EXE_NAME=yaehmop-bind")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _
+              (chdir "tightbind")))
+          (add-after 'chdir 'patch-fortran-functions
+            (lambda _
+              (substitute* '("mov.c" "prototypes.h")
+                (("lovlap\\(") "lovlap_(")
+                (("abfns\\(") "abfns_("))))
+          (add-after 'chdir 'patch-cmake
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("project\\(yaehmop C\\)") "project(yaehmop C Fortran)")
+                (("abfns.c") "fortran77/abfns.f")
+                (("lovlap.c") "fortran77/lovlap.f")
+                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
+                 (string-append init " CACHE STRING \"\")"))
+                (("add_library\\(yaehmop_eht" lib)
+                 (string-append lib " SHARED "))
+                (("target_link_libraries\\(test_eht \\$\\{LAPACK_LIBRARIES\\}.*"
+                  all)
+                 (string-append all "\ntarget_link_libraries(yaehmop_eht "
+                                "${LAPACK_LIBRARIES})\n")))))
+          (add-after 'build 'fix-latex
+            (lambda _
+              (chdir "../docs")
+              (substitute* "bind_manual.tex"
+                (("\\\\usepackage\\{bindpage\\}")
+                 (string-append
+                  "\\usepackage[left=2cm,right=2cm,top=4cm,bottom=2cm]"
+                  "{geometry}")))
+              (substitute* "Zmat_appendix.tex"
+                (("file=dihedral\\.eps")
+                 "file=figs/dihedral.eps"))))
+          (add-after 'fix-latex 'build-doc
+            (lambda _
+              ;; TODO: not reproducible
+              (setenv "FORCE_SOURCE_DATE" "1")
+              ;; Needs to run twice to compile completely
+              (invoke "pdflatex" "bind_manual.tex")
+              (invoke "pdflatex" "bind_manual.tex")
+              (chdir "../build")))
+          (add-after 'install 'install-eht-parms
+            (lambda _
+              (install-file "../tightbind/eht_parms.dat"
+                            (string-append #$output "/share/"
+                                           #$name "-" #$version))))
+          (add-after 'install-eht-parms 'install-doc
+            (lambda _
+              (install-file "../docs/bind_manual.pdf"
+                            (string-append #$output "/share/doc/"
+                                           #$name "-" #$version))))
+          (delete 'check)
+          (add-after 'install-doc 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "./test_eht")))))))
+    (native-inputs
+     `(("gfortran" ,gfortran)
+       ("texlive" ,(texlive-updmap.cfg (list texlive-fonts-ec
+                                             texlive-latex-graphics
+                                             texlive-latex-geometry)))))
+    (inputs (list openblas))
+    (home-page "https://github.com/greglandrum/yaehmop")
+    (synopsis "Yet Another extended Hueckel Molecular Orbital Package")
+    (description "@code{YAeHMOP} contains a program and library for performing
+extended Hückel calculations.")
+    (license license:bsd-2)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 11/13] gnu: Add avalontoolkit.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (21 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 10/13] gnu: Add yaehmop-tightbind David Elsing
@ 2022-10-07 15:21 ` David Elsing
  2022-10-09 12:06   ` Liliana Marie Prikler
  2022-10-07 15:22 ` [bug#58261] [PATCH v2 12/13] gnu: Add ringdecomposerlib David Elsing
  2022-10-07 15:22 ` [bug#58261] [PATCH v2 13/13] gnu: Add rdkit David Elsing
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:21 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (avalontoolkit): New variable.
---
 gnu/packages/chemistry.scm | 93 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 68d28a52c3..e52dd2f3b6 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -928,3 +928,96 @@ (define-public yaehmop
     (description "@code{YAeHMOP} contains a program and library for performing
 extended Hückel calculations.")
     (license license:bsd-2)))
+
+(define-public avalontoolkit
+  (package
+    (name "avalontoolkit")
+    (version "1.2.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "mirror://sourceforge/avalontoolkit/"
+             "AvalonToolkit_" (substring version 0 3) "/AvalonToolkit_"
+             version ".source.tar"))
+       (sha256
+        (base32
+         "0rnnyy6axs2da7aa4q6l30ldavbk49v6l22llj1adn74h1i67bpv"))
+       (modules '((guix build utils) (ice-9 ftw)))
+       (snippet
+        #~(begin
+            (chdir "..")
+            (delete-file-recursively "SourceDistribution/java")))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      ;; There are no tests
+      #:tests? #f
+      #:phases
+      #~(let ((programs '("canonizer" "matchtest" "smi2mol" "struchk")))
+          (modify-phases %standard-phases
+            (delete 'configure)
+            (add-before 'build 'remove-free
+              (lambda _
+                ;; Remove incorrect free of getenv result (patch also in rdkit)
+                (substitute* "common/reaccsio.c"
+                  (("MyFree.*tempdir.*") ""))))
+            (replace 'build
+              (lambda _
+                (chdir "common")
+                (let* ((parts
+                        (list
+                         "aacheck" "casutils" "denormal" "depictutil"
+                         "didepict" "fixcharges" "forio" "geometry" "graph"
+                         "hashcode" "layout" "local" "patclean" "pattern"
+                         "perceive" "reaccsio" "rtutils" "set" "shortcut"
+                         "sketch" "ssmatch" "stereo" "symbol_lists"
+                         "symboltable" "utilities"))
+                       (objects (map (lambda (name) (string-append name ".o"))
+                                     parts)))
+                  (for-each
+                   (lambda (name)
+                     (display (string-append "Compiling " name ".c\n"))
+                     (invoke "gcc" "-c" "-fPIC" "-O2"
+                             (string-append name ".c")
+                             "-o" (string-append name ".o")))
+                   parts)
+                  (display "Building shared library\n")
+                  (apply invoke "gcc" "-fPIC" "-shared" "-lm"
+                         "-o" "libavalontoolkit.so"
+                         "canonizer.c" "smi2mol.c" "struchk.c" objects)
+                  (for-each
+                   (lambda (program)
+                     (display (string-append "Building " program "\n"))
+                     (invoke "gcc" "-L." "-lavalontoolkit" "-lm" "-O2"
+                             (string-append "-Wl,-rpath=" #$output "/lib")
+                             "-DMAIN" (string-append program ".c") "-o" program))
+                   programs))))
+            (replace 'install
+              (lambda _
+                ;; Executables
+                (for-each
+                 (lambda (program)
+                   (install-file program (string-append #$output "/bin")))
+                 programs)
+                (for-each
+                 (lambda (name)
+                   (symlink (string-append #$output "/bin/smi2mol")
+                            (string-append #$output "/bin/" name)))
+                 '("mol2smi" "rdf2smi" "mol2tbl" "mol2sma" "smi2rdf"))
+                ;; Library
+                (install-file "libavalontoolkit.so" (string-append #$output "/lib"))
+                (for-each
+                 (lambda (file)
+                   (install-file file (string-append #$output
+                                                    "/include/avalontoolkit")))
+                 (find-files "." "\\.h$"))
+                (install-file "../license.txt"
+                              (string-append #$output "/share/doc/"
+                                             #$name "-" #$version "/"))))))))
+    (home-page "https://sourceforge.net/projects/avalontoolkit/")
+    (synopsis "Tools for SMILES and MOL files and for structure fingerprinting")
+    (description "This package contains a library and programs for
+canonicalization of SMILES and MOL files, molecular structure fingerprinting
+and rendering molecules.")
+    (license license:bsd-3)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 12/13] gnu: Add ringdecomposerlib.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (22 preceding siblings ...)
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 11/13] gnu: Add avalontoolkit David Elsing
@ 2022-10-07 15:22 ` David Elsing
  2022-10-07 15:22 ` [bug#58261] [PATCH v2 13/13] gnu: Add rdkit David Elsing
  24 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:22 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (ringdecomposerlib): New variable.
---
 gnu/packages/chemistry.scm | 80 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index e52dd2f3b6..43953238cd 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -1021,3 +1021,83 @@ (define-public avalontoolkit
 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 "Library for calculating ring topology descriptions such as
+unique ring families")
+    (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)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 13/13] gnu: Add rdkit.
  2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
                   ` (23 preceding siblings ...)
  2022-10-07 15:22 ` [bug#58261] [PATCH v2 12/13] gnu: Add ringdecomposerlib David Elsing
@ 2022-10-07 15:22 ` David Elsing
  2022-10-09 12:12   ` Liliana Marie Prikler
  24 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-07 15:22 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (rdkit): New variable.
---
 gnu/packages/chemistry.scm                    | 178 ++++++++++++++++++
 .../rdkit-cmake-external-dependencies.patch   | 102 ++++++++++
 2 files changed, 280 insertions(+)
 create mode 100644 gnu/packages/patches/rdkit-cmake-external-dependencies.patch

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 43953238cd..4b34a38797 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -34,6 +34,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
@@ -41,10 +42,12 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
+  #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages graphviz)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages image)
   #:use-module (gnu packages maths)
@@ -56,6 +59,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages sqlite)
   #:use-module (gnu packages stb)
   #:use-module (gnu packages tex)
   #:use-module (gnu packages web)
@@ -1101,3 +1105,177 @@ (define-public ringdecomposerlib
 unique ring families, relevant cycles, the smallest set of smallest rings and
 other ring topology descriptions.")
     (license license:bsd-3)))
+
+(define-public rdkit
+  (package
+    (name "rdkit")
+    (version "2022.03.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/rdkit/rdkit")
+                    (commit
+                     (string-append
+                      "Release_" (string-replace-substring version "." "_")))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "19idgilabh04cbr1qj6zgrgsfjm248mmfz6fsr0smrd68d0xnml9"))
+              (patches
+               (search-patches "rdkit-cmake-external-dependencies.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               #~(begin
+                   ;; Remove pickle files (only used in tests),
+                   ;; as they are compiled programs
+                   (for-each
+                    (lambda (name)
+                      (display (string-append name "\n"))
+                      (delete-file name))
+                    (find-files "." "\\.pkl(\\.gz)?$"))
+                   ;; Remove SQLite data files (can be generated)
+                   (delete-file "Data/RDData.sqlt")
+                   (delete-file "Data/RDTests.sqlt")))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #: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)))
+      #:configure-flags
+      #~(list
+         "-DRDK_BUILD_AVALON_SUPPORT=ON"
+         "-DRDK_BUILD_CAIRO_SUPPORT=ON"
+         "-DRDK_BUILD_CPP_TESTS=ON"
+         "-DRDK_BUILD_FREESASA_SUPPORT=ON"
+         "-DRDK_BUILD_INCHI_SUPPORT=ON"
+         "-DRDK_BUILD_YAEHMOP_SUPPORT=ON"
+         (string-append "-DCATCH_DIR="
+                        #$(this-package-native-input "catch2")
+                        "/include/catch2")
+         "-DRDK_INSTALL_DEV_COMPONENT=ON"
+         "-DRDK_INSTALL_INTREE=OFF"
+         "-DRDK_INSTALL_STATIC_LIBS=OFF"
+         (string-append
+          "-DRDK_OPTIMIZE_POPCNT="
+          #$(let ((system (or (%current-target-system)
+                              (%current-system))))
+              (cond
+               ((string-prefix? "x86_64" system) "ON")
+               ((string-prefix? "i686" system) "ON")
+               (else "OFF"))))
+         "-DRDK_USE_BOOST_IOSTREAMS=ON"
+         "-DRDK_USE_FLEXBISON=ON")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'copy-external-dependencies
+            (lambda _
+              (symlink
+               (string-append
+                #$(this-package-input "font-comic-neue")
+                "/share/fonts/truetype/ComicNeue-Regular.ttf")
+               "Data/Fonts/ComicNeue-Regular.ttf")))
+          (add-after 'copy-external-dependencies 'patch-source
+            (lambda _
+              (substitute* "External/AvalonTools/CMakeLists.txt"
+                (("^if\\(NOT RDK_BUILD" orig)
+                 (string-append "if(0)\n" orig))
+                (("include_directories.*AVALON_SRC_PATH.*")
+                 (string-append "endif()\ninclude_directories("
+                                #$avalontoolkit "/include/avalontoolkit)\n"))
+                (("LINK_LIBRARIES avalon_clib")
+                 (string-append
+                  "LINK_LIBRARIES -L" #$avalontoolkit "/lib -lavalontoolkit")))
+              (let ((port
+                     (open-file "External/RingFamilies/dummy.cpp" "w")))
+                (display "" port)
+                (close port))
+              (let ((port
+                     (open-file "External/RingFamilies/CMakeLists.txt" "w")))
+                (display (string-append
+                          "rdkit_library(RingDecomposerLib dummy.cpp SHARED"
+                          " LINK_LIBRARIES -lRingDecomposerLib)\n"
+                          "set(RDK_URF_LIBS RingDecomposerLib CACHE STRING \"\" FORCE)\n")
+                         port)
+                (close port))
+              (substitute* "Code/GraphMol/MolInterchange/CMakeLists.txt"
+                (("if\\(NOT" orig)
+                 (string-append "if(0)\n" orig))
+                (("^include_directories.*") "endif()\n"))
+              (substitute* "External/YAeHMOP/EHTTools.cpp"
+                (("<yaehmop/tightbind/bind.h>") "<yaehmop/bind.h>"))))
+          (add-after 'unpack 'fix-inchi-include
+            (lambda _
+              (substitute* "Code/cmake/Modules/FindInchi.cmake"
+                (("inchi_api.h.*\\)") "inchi/inchi_api.h)")
+                (("INCHI_LIBRARY NAMES.*\\)")
+                 "INCHI_LIBRARY NAMES inchi PATH_SUFFIXES inchi)")
+                (("find_library" prev)
+                 (string-append
+                  "list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.1)\n"
+                  prev)))
+              (substitute* "External/INCHI-API/inchi.cpp"
+                (("<inchi_api.h>") "<inchi/inchi_api.h>"))))
+          (add-before 'build 'enable-bytecode-determinism
+              (lambda _
+                (setenv "PYTHONHASHSEED" "0")
+                (setenv "PYTHONDONTWRITEBYTECODE" "1")))
+          (add-after 'install 'pre-check
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (with-directory-excursion "../source"
+                (invoke "sqlite3" "Data/RDData.sqlt"
+                        ".read rdkit/Dbase/test_data/RDData.sqlite")
+                (invoke "sqlite3" "Data/RDTests.sqlt"
+                        ".read rdkit/Dbase/test_data/RDTests.sqlite")
+                (setenv "RDBASE" (canonicalize-path ".")))
+              (add-installed-pythonpath inputs outputs)))
+          (delete 'check)
+          (add-after 'pre-check 'check
+            (lambda* (#:key tests? parallel-tests? #:allow-other-keys)
+              (when tests?
+                (let ((job-count (number->string
+                                  (if parallel-tests? (parallel-job-count) 1))))
+                  (invoke
+                   "ctest" "-j" job-count
+                   "-E" (string-append
+                         "(" (string-join
+                              '(;; need pickled data
+                                "(pyDiscreteValueVect" "pySparseIntVect"
+                                "graphmoltestPickler" "pyPartialCharges"
+                                "substructLibraryTest" "pyFeatures"
+                                "pythonTestDirML" "pythonTestDirChem"
+                                ;; Catching Python exception fails
+                                "pyRanker)") "|") ")")))))))))
+    (native-inputs
+     (list bison
+           boost
+           catch2
+           eigen
+           flex
+           freesasa
+           pkg-config
+           rapidjson
+           tar))
+    (inputs
+     (list avalontoolkit
+           cairo
+           coordgenlibs
+           font-comic-neue
+           freetype
+           inchi
+           maeparser
+           python
+           ringdecomposerlib
+           sqlite
+           yaehmop))
+    (propagated-inputs
+     (list python-numpy python-cairocffi python-pillow))
+    (home-page "https://rdkit.org/")
+    (synopsis "Collection of cheminformatics software")
+    (description "RDKit is a C++ and Python library for cheminformatics, which
+includes (among other things) the analysis and modification of molecules in 2D
+and 3D and descriptor generation for machine learning.")
+    (license license:bsd-3)))
diff --git a/gnu/packages/patches/rdkit-cmake-external-dependencies.patch b/gnu/packages/patches/rdkit-cmake-external-dependencies.patch
new file mode 100644
index 0000000000..5b73864f51
--- /dev/null
+++ b/gnu/packages/patches/rdkit-cmake-external-dependencies.patch
@@ -0,0 +1,102 @@
+diff -ur a/External/FreeSASA/CMakeLists.txt b/External/FreeSASA/CMakeLists.txt
+--- a/External/FreeSASA/CMakeLists.txt
++++ b/External/FreeSASA/CMakeLists.txt
+@@ -10,7 +10,7 @@
+   endif()
+ endif()
+ 
+-if(needDownload)
++if(FALSE)
+   # don't actually use the md5 here
+   set(FREESASA_VERSION "2.0.3")
+   set(FREESASA_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/freesasa-${FREESASA_VERSION}")
+@@ -66,24 +66,24 @@
+ endif()
+ 
+ set (freesasa_h ${FREESASA_SRC_DIR}/src/freesasa.h)
+-file(READ ${freesasa_h} freesasa_h_data)
++#file(READ ${freesasa_h} freesasa_h_data)
+ string(REGEX REPLACE "(#include <stdio.h>)" "\\1\n#include <RDGeneral/export.h>" freesasa_h_data "${freesasa_h_data}")
+ string(REGEX REPLACE "([^R][^D][^K][^I][^T][^_][^F][^R][^E][^E][^S][^A][^S][^A][^_][^C][^L][^I][^B][^_][^E][^X][^P][^O][^R][^T][^ ])(extern const)" "\\1RDKIT_FREESASA_CLIB_EXPORT \\2" freesasa_h_data "${freesasa_h_data}")
+-file(WRITE ${freesasa_h} "${freesasa_h_data}")
++#file(WRITE ${freesasa_h} "${freesasa_h_data}")
+ 
+ add_definitions(-DUSE_THREADS=0)
+ add_definitions(-DUSE_JSON=0)
+ add_definitions(-DUSE_XML=0)
+-rdkit_library(freesasa_clib ${freesasa_clib_srcs})
+-target_compile_definitions(freesasa_clib PRIVATE RDKIT_FREESASALIB_BUILD)
++#rdkit_library(freesasa_clib ${freesasa_clib_srcs})
++#target_compile_definitions(freesasa_clib PRIVATE RDKIT_FREESASALIB_BUILD)
+ 
+ if((MSVC AND RDK_INSTALL_DLLS_MSVC) OR ((NOT MSVC) AND WIN32))
+   set_target_properties(freesasa_clib PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
+ endif()
+-include_directories("${FREESASA_SRC_DIR}/src")
++#include_directories("${FREESASA_SRC_DIR}/src")
+ 
+ rdkit_library(FreeSASALib RDFreeSASA.cpp SHARED 
+-    LINK_LIBRARIES freesasa_clib GraphMol )
++    LINK_LIBRARIES -lfreesasa GraphMol )
+ target_compile_definitions(FreeSASALib PRIVATE RDKIT_FREESASALIB_BUILD)
+ 
+ rdkit_headers(RDFreeSASA.h DEST GraphMol)
+diff -ur a/External/YAeHMOP/CMakeLists.txt b/External/YAeHMOP/CMakeLists.txt
+--- a/External/YAeHMOP/CMakeLists.txt
++++ b/External/YAeHMOP/CMakeLists.txt
+@@ -18,32 +18,32 @@
+ 
+ include_directories( ${RDKit_ExternalDir}/YAeHMOP )
+ 
+-ExternalProject_Add(yaehmop_project
+-  GIT_REPOSITORY https://github.com/greglandrum/yaehmop.git
+-  GIT_TAG master
+-  UPDATE_COMMAND ""
+-  PATCH_COMMAND ""
+-  PREFIX ${CMAKE_CURRENT_SOURCE_DIR}
+-  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop"
+-  SOURCE_SUBDIR "tightbind"
+-  CMAKE_ARGS -DUSE_BLAS_LAPACK=OFF -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+-  TEST_COMMAND "")
+-
+-include_directories(${PROJECT_BINARY_DIR}/include)
+-link_directories(${PROJECT_BINARY_DIR}/lib)
+-link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build)
+-
+-set(EHT_PARAM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind/eht_parms.dat )
+-install(FILES ${EHT_PARAM_FILE}
+-        DESTINATION ${RDKit_ShareDir}/Data
+-        COMPONENT data)
++#ExternalProject_Add(yaehmop_project
++#  GIT_REPOSITORY https://github.com/greglandrum/yaehmop.git
++#  GIT_TAG master
++#  UPDATE_COMMAND ""
++#  PATCH_COMMAND ""
++#  PREFIX ${CMAKE_CURRENT_SOURCE_DIR}
++#  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop"
++#  SOURCE_SUBDIR "tightbind"
++#  CMAKE_ARGS -DUSE_BLAS_LAPACK=OFF -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
++#  TEST_COMMAND "")
++
++#include_directories(${PROJECT_BINARY_DIR}/include)
++#link_directories(${PROJECT_BINARY_DIR}/lib)
++#link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build)
++
++#set(EHT_PARAM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind/eht_parms.dat )
++#install(FILES ${EHT_PARAM_FILE}
++#        DESTINATION ${RDKit_ShareDir}/Data
++#        COMPONENT data)
+ 
+-message("YAeHMOP include_dirs: ${PROJECT_BINARY_DIR}/include")
+-message("YAeHMOP link_dirs: ${PROJECT_BINARY_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build")
++#message("YAeHMOP include_dirs: ${PROJECT_BINARY_DIR}/include")
++#message("YAeHMOP link_dirs: ${PROJECT_BINARY_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build")
+ 
+-rdkit_library(EHTLib EHTTools.cpp SHARED LINK_LIBRARIES yaehmop_eht GraphMol )
++rdkit_library(EHTLib EHTTools.cpp SHARED LINK_LIBRARIES -lyaehmop_eht GraphMol )
+ target_compile_definitions(EHTLib PRIVATE RDKIT_EHTLIB_BUILD)
+-add_dependencies(EHTLib yaehmop_project)
++#add_dependencies(EHTLib yaehmop_project)
+ rdkit_headers(EHTTools.h DEST GraphMol)
+ rdkit_catch_test(testEHTLib1 test1.cpp
+            LINK_LIBRARIES EHTLib FileParsers SmilesParse )
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 10/11] gnu: Add yaehmop-tightbind.
  2022-10-07 15:12     ` David Elsing
@ 2022-10-07 15:25       ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-07 15:25 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:12 +0000 schrieb David Elsing:
> Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:
> 
> > Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> > > * gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
> > > ---
> > >  gnu/packages/chemistry.scm | 82
> > > ++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 82 insertions(+)
> > > 
> > > diff --git a/gnu/packages/chemistry.scm
> > > b/gnu/packages/chemistry.scm
> > > index cc26aa329a..a39deff4bf 100644
> > > --- a/gnu/packages/chemistry.scm
> > > +++ b/gnu/packages/chemistry.scm
> > > @@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages documentation)
> > >    #:use-module (gnu packages flex)
> > >    #:use-module (gnu packages fontutils)
> > > +  #:use-module (gnu packages gcc)
> > >    #:use-module (gnu packages gl)
> > >    #:use-module (gnu packages graphviz)
> > >    #:use-module (gnu packages gv)
> > > @@ -817,3 +818,84 @@ (define-public coordgenlibs
> > >      (description "@code{coordgenlibs} contains algorithms to
> > > generate 2D
> > >  coordinates.  It has an emphasis on quality rather than speed.")
> > >      (license license:bsd-3)))
> > > +
> > > +(define-public yaehmop-tightbind
> > > +  (package
> > > +    (name "yaehmop-tightbind")
> > > +    (version "2022.09.1")
> > > +    (source (origin
> > > +              (method git-fetch)
> > > +              (uri (git-reference
> > > +                    (url
> > > "https://github.com/greglandrum/yaehmop")
> > > +                    (commit (string-append "v" version))))
> > > +              (file-name (git-file-name name version))
> > > +              (sha256
> > > +               (base32
> > > +               
> > > "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
> > > +              (modules '((guix build utils)))
> > > +              (snippet
> > > +               '(begin
> > > +                  (delete-file-recursively "docs")
> > This one looks suspicious.
> > > +                  (delete-file-recursively "examples")
> > As does this.
> > What gives?
> I did not want to check the documentation in detail and the examples
> contain some corrupted "compress" archives of program outputs. :)
> But now I build the documentation instead and remove the archives.
> There still is one problem: Even though I set FORCE_SOURCE_DATE=1,
> the
> output of pdflatex is still not reproducible. Do you have an idea why
> that could be? There are only 3 bytes different in the pdf.
> Alternatively, I could just not build the documentation as it is
> independent of the build scripts anyway.
pdflatex has troubles with reproducible builds, but I can't quite
recall what option makes it not so, but rest assured those are likely 3
very well known bytes.

> > > +                  (delete-file-recursively "viewkel")
> > > +                  (delete-file-recursively
> > > "tightbind/f2c_files")
> > > +                  (delete-file "tightbind/diag.c")
> > > +                  (delete-file "tightbind/cboris.c")
> > > +                  (delete-file "tightbind/abfns.c")
> > > +                  (delete-file "tightbind/lovlap.c")
> > > +                  #t))))
> > > +    (build-system cmake-build-system)
> > > +    (native-inputs (list gfortran))
> > > +    (inputs (list openblas))
> > > +    (arguments
> > > +     (list
> > > +      #:configure-flags
> > > +      #~(list
> > > +         "-DUSE_BLAS_LAPACK=ON"
> > > +         (string-append "-DPARM_FILE_LOC=" #$output
> > > +                        "/share/" #$name "-" #$version
> > > "/eht_parms.dat")
> > > +         "-DBIND_EXE_NAME=yaehmop-bind")
> > > +      #:phases
> > > +      #~(modify-phases %standard-phases
> > > +          (add-after 'unpack 'chdir
> > > +            (lambda _
> > > +              (chdir "tightbind")
> > > +              #t))
> > > +          (add-after 'chdir 'patch-fortran-functions
> > > +            (lambda _
> > > +              (substitute* '("mov.c" "prototypes.h")
> > > +                (("lovlap\\(") "lovlap_(")
> > > +                (("abfns\\(") "abfns_("))
> > > +              #t))
> > > +          (add-after 'chdir 'patch-cmake
> > > +            (lambda _
> > > +              (substitute* "CMakeLists.txt"
> > > +                (("project\\(yaehmop C\\)") "project(yaehmop C
> > > Fortran)")
> > > +                (("abfns.c") "fortran77/abfns.f")
> > > +                (("lovlap.c") "fortran77/lovlap.f")
> > > +                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
> > > +                 (string-append init " CACHE STRING \"\")"))
> > > +                (("add_library\\(yaehmop_eht" lib)
> > > +                 (string-append lib " SHARED "))
> > > +                (("target_link_libraries\\(test_eht
> > > \\$\\{LAPACK_LIBRARIES\\}.*"
> > > +                  all)
> > > +                 (string-append all
> > > "\ntarget_link_libraries(yaehmop_eht "
> > > +                                "${LAPACK_LIBRARIES})\n")))
> > > +              #t))
> > > +          (add-after 'install 'install-eht-parms
> > > +            (lambda _
> > > +              (install-file "../tightbind/eht_parms.dat"
> > > +                            (string-append #$output "/share/"
> > > +                                           #$name "-"
> > > #$version))
> > > +              #t))
> > > +          (delete 'check)
> > > +          (add-after 'install-eht-parms 'check
> > > +            (lambda* (#:key tests? #:allow-other-keys)
> > > +              (when tests?
> > > +                (invoke "./test_eht"))
> > > +              #t)))))
> > > +    (home-page "https://github.com/greglandrum/yaehmop")
> > > +    (synopsis "Yet Another extended Hueckel Molecular Orbital
> > > Package")
> > > +    (description "@code{YAeHMOP} contains a program and library
> > > for
> > > performing
> > > +extended Hückel calculations.")
> > > +    (license license:bsd-2)))
> > Looking at this it seems unclear whether you are building yaehmop
> > or
> > tightbind.  What's going on?
> I'm building the yaehmop library (with the source code in tightbind/)
> and the "bind" program (which I called yaehmop-bind) that uses the
> library.
> Is it better to just call the package "yaehmop" (which I now did)?
> The source also includes a separate visualization program "viewkel",
> which does not use the library and would belong in another package in
> my opinion.
Taking a cursory glance at the CMakeLists, calling it yaehmop is indeed
the correct thing.  I have no idea what viewkel is supposed to do tbh.

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH 11/11] gnu: Add rdkit.
  2022-10-07 15:12     ` David Elsing
@ 2022-10-07 15:29       ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-07 15:29 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:12 +0000 schrieb David Elsing:
> Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:
> 
> > Am Montag, dem 03.10.2022 um 00:19 +0000 schrieb David Elsing:
> > > * gnu/packages/chemistry.scm (rdkit): New variable.
> > > ---
> > >  gnu/packages/chemistry.scm                    | 198
> > > ++++++++++++++++++
> > >  .../rdkit-cmake-external-dependencies.patch   | 102 +++++++++
> > >  2 files changed, 300 insertions(+)
> > >  create mode 100644 gnu/packages/patches/rdkit-cmake-external-
> > > dependencies.patch
> > > 
> > > diff --git a/gnu/packages/chemistry.scm
> > > b/gnu/packages/chemistry.scm
> > > index a39deff4bf..869cf264e3 100644
> > > --- a/gnu/packages/chemistry.scm
> > > +++ b/gnu/packages/chemistry.scm
> > > @@ -34,6 +34,7 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages algebra)
> > >    #:use-module (gnu packages autotools)
> > >    #:use-module (gnu packages backup)
> > > +  #:use-module (gnu packages base)
> > >    #:use-module (gnu packages bison)
> > >    #:use-module (gnu packages boost)
> > >    #:use-module (gnu packages check)
> > > @@ -41,10 +42,12 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages cpp)
> > >    #:use-module (gnu packages documentation)
> > >    #:use-module (gnu packages flex)
> > > +  #:use-module (gnu packages fonts)
> > >    #:use-module (gnu packages fontutils)
> > >    #:use-module (gnu packages gcc)
> > >    #:use-module (gnu packages gl)
> > >    #:use-module (gnu packages graphviz)
> > > +  #:use-module (gnu packages gtk)
> > >    #:use-module (gnu packages gv)
> > >    #:use-module (gnu packages image)
> > >    #:use-module (gnu packages maths)
> > > @@ -56,6 +59,7 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages qt)
> > >    #:use-module (gnu packages serialization)
> > >    #:use-module (gnu packages sphinx)
> > > +  #:use-module (gnu packages sqlite)
> > >    #:use-module (gnu packages stb)
> > >    #:use-module (gnu packages web)
> > >    #:use-module (gnu packages xml)
> > > @@ -899,3 +903,197 @@ (define-public yaehmop-tightbind
> > >      (description "@code{YAeHMOP} contains a program and library
> > > for
> > > performing
> > >  extended Hückel calculations.")
> > >      (license license:bsd-2)))
> > > +
> > > +(define-public rdkit
> > > +  (package
> > > +    (name "rdkit")
> > > +    (version "2022.03.5")
> > > +    (source (origin
> > > +              (method git-fetch)
> > > +              (uri (git-reference
> > > +                    (url "https://github.com/rdkit/rdkit")
> > > +                    (commit
> > > +                     (string-append
> > > +                      "Release_" (string-replace-substring
> > > version
> > > "." "_")))))
> > > +              (file-name (git-file-name name version))
> > > +              (sha256
> > > +               (base32
> > > +               
> > > "19idgilabh04cbr1qj6zgrgsfjm248mmfz6fsr0smrd68d0xnml9"))
> > > +              (patches
> > > +               (search-patches "rdkit-cmake-external-
> > > dependencies.patch"))
> > > +              (modules '((guix build utils)))
> > > +              (snippet
> > > +               #~(begin
> > > +                   ;; Remove pickle files (only used in tests),
> > > +                   ;; as they are compiled programs
> > > +                   (for-each
> > > +                    (lambda (name)
> > > +                      (display (string-append name "\n"))
> > > +                      (delete-file name))
> > > +                    (find-files "." "\\.pkl(\\.gz)?$"))
> > > +                   ;; Remove SQLite data files (can be
> > > generated)
> > > +                   (delete-file "Data/RDData.sqlt")
> > > +                   (delete-file "Data/RDTests.sqlt")
> > > +                   #t))))
> > > +    (build-system cmake-build-system)
> > > +    (native-inputs
> > > +     `(("bison" ,bison)
> > > +       ("boost" ,boost)
> > > +       ("catch2" ,catch2)
> > > +       ("eigen" ,eigen)
> > > +       ("flex" ,flex)
> > > +       ("freesasa" ,freesasa)
> > > +       ("pkg-config" ,pkg-config)
> > > +       ("rapidjson" ,rapidjson)
> > > +       ("tar" ,tar)
> > > +       ("avalontoolkit-src"
> > > +        ,(let ((version "1.2.0"))
> > > +           (origin
> > > +             (method url-fetch)
> > > +             (uri (string-append
> > > +                  
> > > "http://sourceforge.net/projects/avalontoolkit/files/"
> > > +                   "AvalonToolkit_" (substring version 0 3)
> > > "/AvalonToolkit_"
> > > +                   version ".source.tar"))
> > > +             (sha256
> > > +              (base32
> > > +              
> > > "0rnnyy6axs2da7aa4q6l30ldavbk49v6l22llj1adn74h1i67bpv"))
> > > +             (modules '((guix build utils) (ice-9 ftw) (srfi
> > > srfi-
> > > 26)))
> > > +             (snippet
> > > +              #~(begin
> > > +                  (chdir "..")
> > > +                  (delete-file-recursively "StandardFiles")
> > > +                  (delete-file-recursively
> > > "SourceDistribution/java")
> > > +                  #t)))))
> > > +       ("ringdecomposerlib-src"
> > > +        ,(let ((version "1.1.3"))
> > > +           (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")))))))
> > > +    (inputs
> > > +     (list cairo
> > > +           coordgenlibs
> > > +           font-comic-neue
> > > +           freetype
> > > +           inchi
> > > +           maeparser
> > > +           python
> > > +           sqlite
> > > +           yaehmop-tightbind))
> > > +    (propagated-inputs
> > > +     (list python-numpy python-cairocffi python-pillow))
> > > +    (arguments
> > > +     (list
> > > +      #: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)))
> > > +      #:configure-flags
> > > +      #~(list
> > > +         "-DRDK_BUILD_AVALON_SUPPORT=ON"
> > > +         "-DRDK_BUILD_CAIRO_SUPPORT=ON"
> > > +         "-DRDK_BUILD_CPP_TESTS=ON"
> > > +         "-DRDK_BUILD_FREESASA_SUPPORT=ON"
> > > +         "-DRDK_BUILD_INCHI_SUPPORT=ON"
> > > +         "-DRDK_BUILD_YAEHMOP_SUPPORT=ON"
> > > +         (string-append "-DCATCH_DIR="
> > > +                        #$(this-package-native-input "catch2")
> > > +                        "/include/catch2")
> > > +         "-DRDK_INSTALL_DEV_COMPONENT=ON"
> > > +         "-DRDK_INSTALL_INTREE=OFF"
> > > +         "-DRDK_INSTALL_STATIC_LIBS=OFF"
> > > +         (string-append
> > > +          "-DRDK_OPTIMIZE_POPCNT="
> > > +          #$(let ((system (or (%current-target-system)
> > > +                              (%current-system))))
> > > +              (cond
> > > +               ((string-prefix? "x86_64" system) "ON")
> > > +               ((string-prefix? "i686" system) "ON")
> > > +               (else "OFF"))))
> > > +         "-DRDK_USE_BOOST_IOSTREAMS=ON"
> > > +         "-DRDK_USE_FLEXBISON=ON")
> > > +      #:phases
> > > +      #~(modify-phases %standard-phases
> > > +          (add-after 'unpack 'copy-external-dependencies
> > > +            (lambda _
> > > +              (symlink
> > > +               (string-append
> > > +                #$(this-package-input "font-comic-neue")
> > > +                "/share/fonts/truetype/ComicNeue-Regular.ttf")
> > > +               "Data/Fonts/ComicNeue-Regular.ttf")
> > > +              (symlink #$(this-package-native-input "rapidjson")
> > > +                       "External/rapidjson-1.1.0")
> > > +              (invoke "tar" "xvf"
> > > +                      #$(this-package-native-input
> > > "avalontoolkit-
> > > src")
> > > +                      "-C" "External/AvalonTools")
> > > +              (symlink #$(this-package-native-input
> > > "ringdecomposerlib-src")
> > > +                      
> > > "External/RingFamilies/RingDecomposerLib")
> > > +              #t))
> > You might want to try unbundling those.  Either way, you should
> > find a
> > solution that doesn't depend on native-input labels.
> Ok, I unbundled them, but the package definitions became a bit long.
> :)  Do you think it is ok like that?
> > 
Long package definitions are not inherently bad (unless of course there
is an obviously less verbose way of writing them).  I'll take a look at
your v2 at a later time.

Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 00/13] Add rdkit v2.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
@ 2022-10-09 10:02   ` Liliana Marie Prikler
  2022-10-13 20:58     ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 00/15] Add rdkit v3 David Elsing
                     ` (15 subsequent siblings)
  16 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-09 10:02 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> Thanks a lot for your comments, they are very helpful!
> Sorry about the descriptions, I took them mostly from upstream. :)
> Are they still too short?
I don't think we can magically poof good descriptions into existence
when upstreams don't provide them.  That being said, it's best to clean
up whatever's there.  Changing descriptions is a lowball issue, though,
I (or another committer) can do so as we're upstreaming it.

> I still have the following problems:
> * The tests of tinydir contain a bundled fork of cbehave which uses a
>   (bundled) copy of rlutil, so I left them disabled for now.
I mentioned this in a reply to another message already, but the idea
would be to 1. try to use upstream versions or 2. try to package the
bundles. 

> * Building the documentation of yaehmop with pdflatex is not
> reproducible even
>   though I set FORCE_SOURCE_DATE=1. Is it even necessary to build the
>   documentation?
Maybe pdftrailerid can help you?  You could also try to convert the
documentation into a reproducible format -- e.g. using pandoc.

> * Using @abbr in the description does not work (I also did not find
> it in any
>   other package).
My bad, that should be @acronym.

Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 01/13] gnu: Add fast-float.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 01/13] gnu: Add fast-float David Elsing
@ 2022-10-09 10:04   ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-09 10:04 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (fast-float): New variable.
> ---
>  gnu/packages/cpp.scm | 54
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index d03e0bc7e1..a7404df563 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -29,6 +29,7 @@
>  ;;; Copyright © 2022 muradm <mail@muradm.net>
>  ;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
>  ;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
> +;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -1907,3 +1908,56 @@ (define-public cpp-mustache
>  templated string type for compatibility with any STL-like string
> (std::string,
>  std::wstring, etc).")
>      (license license:boost1.0)))
> +
> +(define-public fast-float
> +  (package
> +    (name "fast-float")
> +    (version "3.5.1")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/fastfloat/fast_float")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "0z3rxxd0pwvw70dbnv63rm67biw829vdqf50y16isxm6g3sbrz8g"))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list
> +      #:configure-flags
> +      #~(list
> +         "-DFASTFLOAT_TEST=ON"
> +         "-DSYSTEM_DOCTEST=ON")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'patch-cmake-tests
> +            (lambda _
> +              (substitute* "tests/CMakeLists.txt"
> +               
> (("FetchContent_GetProperties\\(supplemental_test_files.*")
> +                 "")
> +                (("if\\(NOT supplemental_test_files_POPULATED.*")
> +                 (string-append
> +                  "set(supplemental_test_files_BINARY_DIR "
> +                  #$(this-package-native-input "test-data") "/data"
> +                  ")\nif(0)\n"))))))))
> +    (native-inputs
> +     `(("test-data"
> +        ,(let ((commit "97a0b2e638feb479387554cf253e346500541e7e"))
> +           (origin
> +             (method git-fetch)
> +             (uri (git-reference
> +                   (url
> +                   
> "https://github.com/fastfloat/supplemental_test_files.git")
> +                   (commit commit)))
> +             (file-name (git-file-name "fast_float_test-data"
> commit))
> +             (sha256
> +              (base32
> +              
> "0dxbiyzyh7i847i89ablfzypfc3ckhm7f74w98jsh73v1mppmxlf")))))
You can use the origin directly in the recipe via #$.  Alternatively,
search-input-directory "data" would probably also work.
> +       ("doctest" ,doctest)))
> +    (home-page "https://github.com/fastfloat/fast_float")
> +    (synopsis "Floating point number parser for C++")
> +    (description "@code{fast_float} is a header-only C++ library for
> parsing
> +floating point numbers from strings.  It implements the C++
> from_chars
> +functions for the float and double types.")
> +    (license (list license:asl2.0 license:expat)))) ; dual licensed
Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 02/13] gnu: Add pocketfft.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 02/13] gnu: Add pocketfft David Elsing
@ 2022-10-09 11:42   ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-09 11:42 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (pocketfft): New variable.
> ---
>  gnu/packages/cpp.scm | 44
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index a7404df563..38a2a9e829 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -1961,3 +1961,47 @@ (define-public fast-float
>  floating point numbers from strings.  It implements the C++
> from_chars
>  functions for the float and double types.")
>      (license (list license:asl2.0 license:expat)))) ; dual licensed
> +
> +(define-public pocketfft-cpp
> +  (let ((commit "daa8bb18327bc5c7d22c69428c25cf5dc64167d3")
> +        (revision "0"))
> +    (package
> +      (name "pocketfft-cpp")
> +      (version (git-version "0" revision commit))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/mreineck/pocketfft")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                 
> "1dbkkqkmkxgmz1qjpsqzic5ig3qw1pqndbb3dvjc7xq5f2rdzyq1"))))
> +      (build-system copy-build-system)
> +      (arguments
> +       (list
> +        #:install-plan
> +        #~'(("pocketfft_hdronly.h" "include/"))
> +        #:phases
> +        #~(modify-phases %standard-phases
> +            (add-before 'install 'patch-novectors
> +              (lambda _
> +                (substitute* "pocketfft_hdronly.h"
> +                  (("#ifndef POCKETFFT_NO_VECTORS")
> +                   "#if !(POCKETFFT_NO_VECTORS)")
> +                  (("#if defined\\(POCKETFFT_NO_VECTORS\\)")
> +                   "#if POCKETFFT_NO_VECTORS")
> +                  (("#define POCKETFFT_NO_VECTORS")
> +                   "#define POCKETFFT_NO_VECTORS 1")
This one I don't think changes anything.
> +                  (("#\\s*undef POCKETFFT_NO_VECTORS")
> +                   "#define POCKETFFT_NO_VECTORS 0")
Here too, I think you can ignore that.
> +                  (("#define POCKETFFT_HDRONLY_H.*" orig)
> +                   (string-append
> +                    orig "\n#ifndef POCKETFFT_NO_VECTORS\n"
> +                    "#define POCKETFFT_NO_VECTORS 1\n"
> "#endif\n"))))))))
More importantly, I think this should be done with a snippet or even
better a patch – I'd recommend the latter because I think it'd be
easier to reason about.
> +      (home-page "https://github.com/mreineck/pocketfft")
> +      (synopsis "C++11 header-only Fast Fourier Transform library")
> +      (description "This package provides a single-header C++11
> library for
> +computing Fast Fourier transformations.  It supports
> multidimensional arrays,
> +different floating point sizes and complex transformations.")
> +      (license license:bsd-3))))


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 03/13] gnu: Add sajson.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 03/13] gnu: Add sajson David Elsing
@ 2022-10-09 11:46   ` Liliana Marie Prikler
  2022-10-13 20:59     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-09 11:46 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (sajson): New variable.
> ---
>  gnu/packages/cpp.scm                          | 60
> +++++++++++++++++++
>  .../patches/sajson-build-with-gcc10.patch     | 45 ++++++++++++++
>  2 files changed, 105 insertions(+)
>  create mode 100644 gnu/packages/patches/sajson-build-with-
> gcc10.patch
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index 38a2a9e829..dca0245df5 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -57,6 +57,7 @@ (define-module (gnu packages cpp)
>    #:use-module (guix build-system gnu)
>    #:use-module (guix build-system meson)
>    #:use-module (guix build-system python)
> +  #:use-module (guix build-system scons)
>    #:use-module (guix modules)
>    #:use-module (guix gexp)
>    #:use-module (gnu packages)
> @@ -2005,3 +2006,62 @@ (define-public pocketfft-cpp
>  computing Fast Fourier transformations.  It supports
> multidimensional arrays,
>  different floating point sizes and complex transformations.")
>        (license license:bsd-3))))
> +
> +(define-public sajson
> +  (let ((commit "ec644013e34f9984a3cc9ba568cab97a391db9cd")
> +        (revision "0"))
> +    (package
> +      (name "sajson")
> +      (version (git-version "1.0" revision commit))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/chadaustin/sajson")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (patches
> +                 (search-patches "sajson-build-with-gcc10.patch"))
> +                (sha256
> +                 (base32
> +                 
> "0fjag27w7gvkc5pdhq3ad7yc09rabpzahndw1sgsg04ipznidmmq"))
> +                (modules '((guix build utils)))
> +                (snippet '(delete-file-recursively "third-party"))))
> +      (build-system scons-build-system)
> +      (arguments
> +       (list
> +        #:phases
> +        #~(modify-phases %standard-phases
> +            (add-after 'unpack 'disable-other-builds
> +              (lambda _
> +                (substitute* "SConstruct"
> +                  (("for name, tools in builds:")
> +                   "for name, tools in [('opt', [gcc, opt])]:"))))
> +            (add-after 'unpack 'use-external-unittest-cpp
> +              (lambda* (#:key inputs #:allow-other-keys)
> +                (substitute* "SConscript"
> +                  (("unittestpp_env\\.Library") "_dummy = ")
> +                  (("test_env = env.Clone\\(tools=\\[unittestpp,
> sajson\\]\\)")
> +                   (string-append
> +                    "test_env = env.Clone(tools=[sajson])\n"
> +                    "test_env.Append(CPPPATH='"
> +                    (search-input-directory inputs
> "/include/UnitTest++")
Note that you need (or native-inputs inputs) wherever you wrote inputs.
> +                    "', LIBPATH='"
> +                    (string-append #$(this-package-native-input
> "unittest-cpp")
> +                                   "/lib")
> +                    "', LIBS=['UnitTest++'])")))))
> +            (replace 'check
> +              (lambda* (#:key tests? #:allow-other-keys)
> +                (when tests?
> +                  (invoke "build/opt/test")
> +                  (invoke "build/opt/test_unsorted"))))
> +            (replace 'install
> +              (lambda _
> +                (let ((out (string-append #$output "/include")))
> +                  (install-file "include/sajson.h" out)
> +                  (install-file "include/sajson_ostream.h"
> out)))))))
For the record, what would a regular install do?
> +      (native-inputs (list unittest-cpp))
> +      (home-page "https://github.com/chadaustin/sajson")
> +      (synopsis "C++11 header-only, in-place JSON parser")
> +      (description "@code{sajson} is an in-place JSON parser with
> support for
> +parsing with only a single memory allocation.")
> +      (license license:expat))))
> diff --git a/gnu/packages/patches/sajson-build-with-gcc10.patch
> b/gnu/packages/patches/sajson-build-with-gcc10.patch
> new file mode 100644
> index 0000000000..878706dc79
> --- /dev/null
> +++ b/gnu/packages/patches/sajson-build-with-gcc10.patch
> @@ -0,0 +1,45 @@
> +This patch is from the upstream pull request
> +https://github.com/chadaustin/sajson/pull/54.
> +It fixes linking with GCC.
> +
> +diff --git a/include/sajson.h b/include/sajson.h
> +index 8b4e05a..1bd045b 100644
> +--- a/include/sajson.h
> ++++ b/include/sajson.h
> +@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t,
> size_t value) {
> + // header. This trick courtesy of Rich Geldreich's Purple JSON
> parser.
> + template <typename unused = void>
> + struct globals_struct {
> ++    static const unsigned char parse_flags[256];
> ++};
> ++typedef globals_struct<> globals;
> ++
> + // clang-format off
> + 
> +     // bit 0 (1) - set if: plain ASCII string character
> +     // bit 1 (2) - set if: whitespace
> +     // bit 4 (0x10) - set if: 0-9 e E .
> +-    constexpr static const uint8_t parse_flags[256] = {
> ++    template <typename unused>
> ++    const unsigned char globals_struct<unused>::parse_flags[256] =
> {
> +      // 0    1    2    3    4    5    6    7      8    9    A   
> B    C    D    E    F
> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,   2,  
> 0,   0,   2,   0,   0, // 0
> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,   0,  
> 0,   0,   0,   0,   0, // 1
> +@@ -162,15 +167,13 @@ struct globals_struct {
> +     };
> + 
> + // clang-format on
> +-};
> +-typedef globals_struct<> globals;
> + 
> +-constexpr inline bool is_plain_string_character(char c) {
> ++inline bool is_plain_string_character(char c) {
> +     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
> 1) != 0;
> + }
> + 
> +-constexpr inline bool is_whitespace(char c) {
> ++inline bool is_whitespace(char c) {
> +     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
> 2) != 0;
> + }


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 04/13] gnu: Add tinydir.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 04/13] gnu: Add tinydir David Elsing
@ 2022-10-09 11:48   ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-09 11:48 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (tinydir): New variable.
> ---
>  gnu/packages/cpp.scm | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index dca0245df5..e99fdcecd8 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -2065,3 +2065,30 @@ (define-public sajson
>        (description "@code{sajson} is an in-place JSON parser with
> support for
>  parsing with only a single memory allocation.")
>        (license license:expat))))
> +
> +(define-public tinydir
> +  (package
> +    (name "tinydir")
> +    (version "1.2.5")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/cxong/tinydir")
> +                    (commit version)))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
> +              (modules '((guix build utils)))
> +              (snippet '(delete-file-recursively "tests/cbehave"))))
> +    (build-system copy-build-system)
> +    (arguments
> +     (list
> +      ;; TODO: Tests contain a private fork of cbehave and a bundled
> copy of rlutil
> +      #:install-plan
> +      #~'(("tinydir.h" "include/"))))
> +    (home-page "https://github.com/cxong/tinydir")
> +    (synopsis "C header-only directory and file reader")
Just "Directory and file reader", though I'm not too sure whether it
actually reads files.
> +    (description "@code{tinydir} is a header-only C library to
> portably read
> +files and directories.")
Since in this case "portable" means "works on the Microsoft OS and
Unix", I'm pretty sure it's but a buzzword.
> +    (license license:bsd-2)))


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 06/13] gnu: Add gemmi.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 06/13] gnu: Add gemmi David Elsing
@ 2022-10-09 11:54   ` Liliana Marie Prikler
  2022-10-13 21:00     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-09 11:54 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> * gnu/packages/chemistry.scm (gemmi): New variable.
> ---
>  gnu/packages/chemistry.scm                    | 118 +++++++++++
>  .../patches/gemmi-fix-sajson-types.patch      |  11 +
>  .../sajson-for-gemmi-build-with-gcc10.patch   |  45 ++++
>  .../sajson-for-gemmi-numbers-as-strings.patch | 195
> ++++++++++++++++++
>  4 files changed, 369 insertions(+)
>  create mode 100644 gnu/packages/patches/gemmi-fix-sajson-types.patch
>  create mode 100644 gnu/packages/patches/sajson-for-gemmi-build-with-
> gcc10.patch
>  create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-
> strings.patch
> 
> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
> index c517610fe8..d8f1608a3a 100644
> --- a/gnu/packages/chemistry.scm
> +++ b/gnu/packages/chemistry.scm
> @@ -6,6 +6,7 @@
>  ;;; Copyright © 2020 Björn Höfling
> <bjoern.hoefling@bjoernhoefling.de>
>  ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
>  ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
> +;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -23,6 +24,7 @@
>  ;;; along with GNU Guix.  If not, see
> <http://www.gnu.org/licenses/>.
>  
>  (define-module (gnu packages chemistry)
> +  #:use-module (guix gexp)
>    #:use-module (guix packages)
>    #:use-module (guix utils)
>    #:use-module ((guix licenses) #:prefix license:)
> @@ -35,6 +37,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages boost)
>    #:use-module (gnu packages check)
>    #:use-module (gnu packages compression)
> +  #:use-module (gnu packages cpp)
>    #:use-module (gnu packages documentation)
>    #:use-module (gnu packages fontutils)
>    #:use-module (gnu packages gl)
> @@ -50,8 +53,10 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages qt)
>    #:use-module (gnu packages serialization)
>    #:use-module (gnu packages sphinx)
> +  #:use-module (gnu packages stb)
>    #:use-module (gnu packages xml)
>    #:use-module (guix build-system cmake)
> +  #:use-module (guix build-system copy)
>    #:use-module (guix build-system gnu)
>    #:use-module (guix build-system python))
>  
> @@ -566,3 +571,116 @@ (define-public python-pymol
>  used to prepare publication-quality figures, to share interactive
> results with
>  your colleagues, or to generate pre-rendered animations.")
>      (license license:bsd-3)))
> +
> +(define-public sajson-for-gemmi
> +  (package/inherit sajson
> +    (name "sajson-for-gemmi")
> +    (source (origin
> +              (inherit (package-source sajson))
> +              (patches (search-patches
> +                        "sajson-for-gemmi-numbers-as-strings.patch"
> +                        "sajson-for-gemmi-build-with-
> gcc10.patch"))))
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments sajson)
> +       ((#:tests? _ #f) #f)
Don't forget the comment as to why they're disabled.
> +       ((#:phases phases)
> +        #~(modify-phases #$phases
> +            (delete 'build)))))))
Why is the build deleted?

Split here.
> +(define-public gemmi
> +  (package
> +    (name "gemmi")
> +    (version "0.5.7")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/project-gemmi/gemmi")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "00km5q726bslrw7xbfwb3f3mrsk19qbimfnl3hvr4wi1y3z8i18a"))
> +              (patches
> +               (search-patches "gemmi-fix-sajson-types.patch"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               '(begin
> +                  (delete-file-recursively
> "include/gemmi/third_party")
> +                  (delete-file-recursively "third_party")))))
> +    (outputs '("out" "bin" "python"))
> +    (build-system cmake-build-system)
> +    (native-inputs
> +     (list fast-float
> +           optionparser
> +           pegtl
> +           pocketfft-cpp
> +           pybind11
> +           sajson-for-gemmi
> +           stb-sprintf
> +           tinydir))
> +    (inputs (list python zlib))
> +    (arguments
> +     (list
> +      #:configure-flags
> +      #~(let* ((python-lib
> +                (string-append
> +                 #$output:python "/lib/python"
> +                 #$(version-major+minor (package-version python))
> +                 "/site-packages")))
Note that python-build-system has a (site-packages) procedure.  Writing
the boilerplate to include it in the build shouldn't be much worse in
terms of lines than what you're doing here.
> +          (list "-DUSE_PYTHON=ON"
> +                (string-append "-DPYTHON_INSTALL_DIR=" python-lib)))
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'patch-includes
> +            (lambda _
> +              (substitute* "include/gemmi/sprintf.hpp"
> +                (("<stb/stb_sprintf.h>") "<stb_sprintf.h>"))
> +              (substitute* "include/gemmi/dirwalk.hpp"
> +                (("\"third_party/tinydir.h\"") "<tinydir.h>"))
> +              (substitute* "include/gemmi/cif.hpp"
> +                (("\"third_party/tao/pegtl.hpp\"")
> "<tao/pegtl.hpp>"))
> +              (substitute* "include/gemmi/json.hpp"
> +                (("\"third_party/sajson.h\"") "<sajson.h>"))
> +              (substitute* "python/gemmi.cpp"
> +                (("\"gemmi/third_party/tao/pegtl/parse_error.hpp\"")
> +                 "<tao/pegtl/parse_error.hpp>"))
> +              (substitute* '("include/gemmi/atof.hpp"
> +                             "include/gemmi/numb.hpp")
> +                (("\"third_party/fast_float.h\"")
> +                 "<fast_float/fast_float.h>"))
> +              (substitute* "include/gemmi/fourier.hpp"
> +                (("\"third_party/pocketfft_hdronly.h\"")
> +                 "<pocketfft_hdronly.h>"))))
I'd collect all the files into a (list ...) and then write out the
substitutes.

> +          (add-after 'patch-includes 'patch-cif
> +            (lambda _
> +              (substitute* "include/gemmi/cif.hpp"
> +                (((string-append
> +                   "^.*using analyze_t = pegtl::analysis::generic"
> +                   "<pegtl::analysis::rule_type::ANY>;.*$")) "")
> +                (("TAOCPP_PEGTL_") "TAO_PEGTL_"))))
Uhm... I think I'd prefer a patch for this one.
> +          (add-after 'unpack 'change-bin-prefix
> +            (lambda _
> +              (substitute* "CMakeLists.txt"
> +                (("install\\(TARGETS program DESTINATION bin\\)")
> +                 (string-append
> +                  "install(TARGETS program DESTINATION "
> +                  #$output:bin "/bin)")))))
> +          (replace 'check
> +            (lambda* (#:key tests? #:allow-other-keys)
> +              (when tests?
> +                (with-directory-excursion "../source"
> +                  (setenv "PYTHONPATH" "../build")
> +                  (invoke "python3" "-m" "unittest" "discover" "-v"
> +                          "-s" "tests"))))))))
> +    (home-page "https://gemmi.readthedocs.io/en/latest/")
> +    (synopsis "Macromolecular crystallography library and
> utilities")
> +    (description "GEMMI is a C++ library for macromolecular
> crystallography.
> +It can be used for working with
> +@enumerate
> +@item macromolecular models (content of PDB, PDBx/mmCIF and mmJSON
> files),
> +@item refinement restraints (CIF files),
> +@item reflection data (MTZ and mmCIF formats),
> +@item data on a 3D grid (electron density maps, masks, MRC/CCP4
> format)
> +@item crystallographic symmetry.
> +@end enumerate")
> +    (license license:mpl2.0)))
> diff --git a/gnu/packages/patches/gemmi-fix-sajson-types.patch
> b/gnu/packages/patches/gemmi-fix-sajson-types.patch
> new file mode 100644
> index 0000000000..9633ddac8b
> --- /dev/null
> +++ b/gnu/packages/patches/gemmi-fix-sajson-types.patch
> @@ -0,0 +1,11 @@
> +diff -ur a/include/gemmi/json.hpp b/include/gemmi/json.hpp
> +--- a/include/gemmi/json.hpp
> ++++ b/include/gemmi/json.hpp
> +@@ -38,6 +38,7 @@
> + 
> + inline std::string as_cif_value(const sajson::value& val) {
> +   switch (val.get_type()) {
> ++    case sajson::TYPE_INTEGER:
> +     case sajson::TYPE_DOUBLE:
> +       return val.as_string();
> +     case sajson::TYPE_NULL:
> diff --git a/gnu/packages/patches/sajson-for-gemmi-build-with-
> gcc10.patch b/gnu/packages/patches/sajson-for-gemmi-build-with-
> gcc10.patch
> new file mode 100644
> index 0000000000..878706dc79
> --- /dev/null
> +++ b/gnu/packages/patches/sajson-for-gemmi-build-with-gcc10.patch
> @@ -0,0 +1,45 @@
> +This patch is from the upstream pull request
> +https://github.com/chadaustin/sajson/pull/54.
> +It fixes linking with GCC.
> +
> +diff --git a/include/sajson.h b/include/sajson.h
> +index 8b4e05a..1bd045b 100644
> +--- a/include/sajson.h
> ++++ b/include/sajson.h
> +@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t,
> size_t value) {
> + // header. This trick courtesy of Rich Geldreich's Purple JSON
> parser.
> + template <typename unused = void>
> + struct globals_struct {
> ++    static const unsigned char parse_flags[256];
> ++};
> ++typedef globals_struct<> globals;
> ++
> + // clang-format off
> + 
> +     // bit 0 (1) - set if: plain ASCII string character
> +     // bit 1 (2) - set if: whitespace
> +     // bit 4 (0x10) - set if: 0-9 e E .
> +-    constexpr static const uint8_t parse_flags[256] = {
> ++    template <typename unused>
> ++    const unsigned char globals_struct<unused>::parse_flags[256] =
> {
> +      // 0    1    2    3    4    5    6    7      8    9    A   
> B    C    D    E    F
> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,   2,  
> 0,   0,   2,   0,   0, // 0
> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,   0,  
> 0,   0,   0,   0,   0, // 1
> +@@ -162,15 +167,13 @@ struct globals_struct {
> +     };
> + 
> + // clang-format on
> +-};
> +-typedef globals_struct<> globals;
> + 
> +-constexpr inline bool is_plain_string_character(char c) {
> ++inline bool is_plain_string_character(char c) {
> +     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
> 1) != 0;
> + }
> + 
> +-constexpr inline bool is_whitespace(char c) {
> ++inline bool is_whitespace(char c) {
> +     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
> 2) != 0;
> + }
> diff --git a/gnu/packages/patches/sajson-for-gemmi-numbers-as-
> strings.patch b/gnu/packages/patches/sajson-for-gemmi-numbers-as-
> strings.patch
> new file mode 100644
> index 0000000000..6f476b8583
> --- /dev/null
> +++ b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
> @@ -0,0 +1,195 @@
> +Patch for gemmi: Keep numbers in JSON file as strings.
> +
> +Adapted from this commit of the bundled fork of sajson in gemmi:
> +
> https://github.com/project-gemmi/gemmi/commit/fccbca4f6040364ba708613e
> 1429c2251872240d
> +
> +diff -ur a/include/sajson.h b/include/sajson.h
> +--- a/include/sajson.h
> ++++ b/include/sajson.h
> +@@ -411,43 +411,6 @@
> + };
> + } // namespace internal
> + 
> +-namespace integer_storage {
> +-enum { word_length = 1 };
> +-
> +-inline int load(const size_t* location) {
> +-    int value;
> +-    memcpy(&value, location, sizeof(value));
> +-    return value;
> +-}
> +-
> +-inline void store(size_t* location, int value) {
> +-    // NOTE: Most modern compilers optimize away this constant-size
> +-    // memcpy into a single instruction. If any don't, and treat
> +-    // punning through a union as legal, they can be special-cased.
> +-    static_assert(
> +-        sizeof(value) <= sizeof(*location),
> +-        "size_t must not be smaller than int");
> +-    memcpy(location, &value, sizeof(value));
> +-}
> +-} // namespace integer_storage
> +-
> +-namespace double_storage {
> +-enum { word_length = sizeof(double) / sizeof(size_t) };
> +-
> +-inline double load(const size_t* location) {
> +-    double value;
> +-    memcpy(&value, location, sizeof(double));
> +-    return value;
> +-}
> +-
> +-inline void store(size_t* location, double value) {
> +-    // NOTE: Most modern compilers optimize away this constant-size
> +-    // memcpy into a single instruction. If any don't, and treat
> +-    // punning through a union as legal, they can be special-cased.
> +-    memcpy(location, &value, sizeof(double));
> +-}
> +-} // namespace double_storage
> +-
> + /// Represents a JSON value.  First, call get_type() to check its
> type,
> + /// which determines which methods are available.
> + ///
> +@@ -585,70 +548,10 @@
> +         return length;
> +     }
> + 
> +-    /// If a numeric value was parsed as a 32-bit integer, returns
> it.
> +-    /// Only legal if get_type() is TYPE_INTEGER.
> +-    int get_integer_value() const {
> +-        assert_tag(tag::integer);
> +-        return integer_storage::load(payload);
> +-    }
> +-
> +-    /// If a numeric value was parsed as a double, returns it.
> +-    /// Only legal if get_type() is TYPE_DOUBLE.
> +-    double get_double_value() const {
> +-        assert_tag(tag::double_);
> +-        return double_storage::load(payload);
> +-    }
> +-
> +-    /// Returns a numeric value as a double-precision float.
> +-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
> +-    double get_number_value() const {
> +-        assert_tag_2(tag::integer, tag::double_);
> +-        if (value_tag == tag::integer) {
> +-            return get_integer_value();
> +-        } else {
> +-            return get_double_value();
> +-        }
> +-    }
> +-
> +-    /// Returns true and writes to the output argument if the
> numeric value
> +-    /// fits in a 53-bit integer.  This is useful for timestamps
> and other
> +-    /// situations where integral values with greater than 32-bit
> precision
> +-    /// are used, as 64-bit values are not understood by all JSON
> +-    /// implementations or languages.
> +-    /// Returns false if the value is not an integer or not in
> range.
> +-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
> +-    bool get_int53_value(int64_t* out) const {
> +-        // Make sure the output variable is always defined to avoid
> any
> +-        // possible situation like
> +-        //
> https://gist.github.com/chadaustin/2c249cb850619ddec05b23ca42cf7a18
> +-        *out = 0;
> +-
> +-        assert_tag_2(tag::integer, tag::double_);
> +-        switch (value_tag) {
> +-        case tag::integer:
> +-            *out = get_integer_value();
> +-            return true;
> +-        case tag::double_: {
> +-            double v = get_double_value();
> +-            if (v < -(1LL << 53) || v > (1LL << 53)) {
> +-                return false;
> +-            }
> +-            int64_t as_int = static_cast<int64_t>(v);
> +-            if (as_int != v) {
> +-                return false;
> +-            }
> +-            *out = as_int;
> +-            return true;
> +-        }
> +-        default:
> +-            return false;
> +-        }
> +-    }
> +-
> +     /// Returns the length of the string.
> +     /// Only legal if get_type() is TYPE_STRING.
> +     size_t get_string_length() const {
> +-        assert_tag(tag::string);
> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
> +         return payload[1] - payload[0];
> +     }
> + 
> +@@ -659,7 +562,7 @@
> +     /// embedded NULs.
> +     /// Only legal if get_type() is TYPE_STRING.
> +     const char* as_cstring() const {
> +-        assert_tag(tag::string);
> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
> +         return text + payload[0];
> +     }
> + 
> +@@ -667,7 +570,7 @@
> +     /// Returns a string's value as a std::string.
> +     /// Only legal if get_type() is TYPE_STRING.
> +     std::string as_string() const {
> +-        assert_tag(tag::string);
> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
> +         return std::string(text + payload[0], text + payload[1]);
> +     }
> + #endif
> +@@ -690,6 +593,10 @@
> +         assert(e1 == value_tag || e2 == value_tag);
> +     }
> + 
> ++    void assert_tag_3(tag e1, tag e2, tag e3) const {
> ++        assert(e1 == value_tag || e2 == value_tag || e3 ==
> value_tag);
> ++    }
> ++
> +     void assert_in_bounds(size_t i) const { assert(i <
> get_length()); }
> + 
> +     const tag value_tag;
> +@@ -2059,6 +1966,8 @@
> +     std::pair<char*, internal::tag> parse_number(char* p) {
> +         using internal::tag;
> + 
> ++      size_t start = p - input.get_data();
> ++
> +         // Assume 32-bit, two's complement integers.
> +         static constexpr unsigned RISKY = INT_MAX / 10u;
> +         unsigned max_digit_after_risky = INT_MAX % 10u;
> +@@ -2235,23 +2144,18 @@
> +                 u = 0u - u;
> +             }
> +         }
> ++
> ++        bool success;
> ++        size_t* out = allocator.reserve(2, &success);
> ++        if (SAJSON_UNLIKELY(!success)) {
> ++            return std::make_pair(oom(p, "number"), tag::null);
> ++        }
> ++        out[0] = start;
> ++        out[1] = p - input.get_data();
> ++
> +         if (try_double) {
> +-            bool success;
> +-            size_t* out
> +-                = allocator.reserve(double_storage::word_length,
> &success);
> +-            if (SAJSON_UNLIKELY(!success)) {
> +-                return std::make_pair(oom(p, "double"), tag::null);
> +-            }
> +-            double_storage::store(out, d);
> +             return std::make_pair(p, tag::double_);
> +         } else {
> +-            bool success;
> +-            size_t* out
> +-                = allocator.reserve(integer_storage::word_length,
> &success);
> +-            if (SAJSON_UNLIKELY(!success)) {
> +-                return std::make_pair(oom(p, "integer"),
> tag::null);
> +-            }
> +-            integer_storage::store(out, static_cast<int>(u));
> +             return std::make_pair(p, tag::integer);
> +         }
> +     }


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 09/13] gnu: Add coordgenlibs.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 09/13] gnu: Add coordgenlibs David Elsing
@ 2022-10-09 11:56   ` Liliana Marie Prikler
  2022-10-13 21:00     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-09 11:56 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> * gnu/packages/chemistry.scm (coordgenlibs): New variable.
> ---
>  gnu/packages/chemistry.scm | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
> index 6eb1e4a694..1510cbab41 100644
> --- a/gnu/packages/chemistry.scm
> +++ b/gnu/packages/chemistry.scm
> @@ -791,3 +791,30 @@ (define-public maeparser
>      (synopsis "Maestro file parser")
>      (description "maeparser is a parser for Schrodinger Maestro
> files.")
>      (license license:expat)))
> +
> +(define-public coordgenlibs
> +  (package
> +    (name "coordgenlibs")
> +    (version "3.0.1")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url
> "https://github.com/schrodinger/coordgenlibs/")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "0d09x3v38i9y184bml020bq7xizdrdwng38qmdxlplzfhqkjdidv"))))
> +    (build-system cmake-build-system)
> +    (native-inputs (list boost))
> +    (inputs (list maeparser))
> +    (arguments
> +     (list
> +      #:configure-flags
> +      #~(list "-DCOORDGEN_RIGOROUS_BUILD=OFF"
> +              "-DCOORDGEN_USE_MAEPARSER=ON")))
> +    (home-page "https://github.com/schrodinger/coordgenlibs/")
> +    (synopsis "2D coordinate generation")
> +    (description "@code{coordgenlibs} contains algorithms to
> generate 2D
> +coordinates.  It has an emphasis on quality rather than speed.")
It emphasises quality over speed.  That being said, is it that hard to
generate points?  What's the full context here?
> +    (license license:bsd-3)))


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 10/13] gnu: Add yaehmop-tightbind.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 10/13] gnu: Add yaehmop-tightbind David Elsing
@ 2022-10-09 12:02   ` Liliana Marie Prikler
  2022-10-13 21:00     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-09 12:02 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> * gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
Don't forget to update the ChangeLog.
> ---
>  gnu/packages/chemistry.scm | 110
> +++++++++++++++++++++++++++++++++++++
>  1 file changed, 110 insertions(+)
> 
> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
> index 1510cbab41..68d28a52c3 100644
> --- a/gnu/packages/chemistry.scm
> +++ b/gnu/packages/chemistry.scm
> @@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages documentation)
>    #:use-module (gnu packages flex)
>    #:use-module (gnu packages fontutils)
> +  #:use-module (gnu packages gcc)
>    #:use-module (gnu packages gl)
>    #:use-module (gnu packages graphviz)
>    #:use-module (gnu packages gv)
> @@ -56,6 +57,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages serialization)
>    #:use-module (gnu packages sphinx)
>    #:use-module (gnu packages stb)
> +  #:use-module (gnu packages tex)
>    #:use-module (gnu packages web)
>    #:use-module (gnu packages xml)
>    #:use-module (guix build-system cmake)
> @@ -818,3 +820,111 @@ (define-public coordgenlibs
>      (description "@code{coordgenlibs} contains algorithms to
> generate 2D
>  coordinates.  It has an emphasis on quality rather than speed.")
>      (license license:bsd-3)))
> +
> +(define-public yaehmop
> +  (package
> +    (name "yaehmop")
> +    (version "2022.09.1")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/greglandrum/yaehmop")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               '(begin
> +                  ;; Separate program
> +                  (delete-file-recursively "viewkel")
> +                  ;; Remove example output (some are corrupted)
> +                  (for-each delete-file (find-files "examples"
> "\\.Z$"))
> +                  ;; Documentation outputs
> +                  (for-each delete-file (find-files "docs"
> "\\.(ps|pdf)$"))
> +                  ;; These are transpiled from Fortran to C, but we
> build the
> +                  ;; Fortran code instead
> +                  (delete-file-recursively "tightbind/f2c_files")
> +                  (delete-file "tightbind/diag.c")
> +                  (delete-file "tightbind/cboris.c")
> +                  (delete-file "tightbind/abfns.c")
> +                  (delete-file "tightbind/lovlap.c")))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list
> +      #:configure-flags
> +      #~(list
> +         "-DUSE_BLAS_LAPACK=ON"
> +         (string-append "-DPARM_FILE_LOC=" #$output
> +                        "/share/" #$name "-" #$version
> "/eht_parms.dat")
> +         "-DBIND_EXE_NAME=yaehmop-bind")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'chdir
> +            (lambda _
> +              (chdir "tightbind")))
> +          (add-after 'chdir 'patch-fortran-functions
> +            (lambda _
> +              (substitute* '("mov.c" "prototypes.h")
> +                (("lovlap\\(") "lovlap_(")
> +                (("abfns\\(") "abfns_("))))
> +          (add-after 'chdir 'patch-cmake
> +            (lambda _
> +              (substitute* "CMakeLists.txt"
> +                (("project\\(yaehmop C\\)") "project(yaehmop C
> Fortran)")
> +                (("abfns.c") "fortran77/abfns.f")
> +                (("lovlap.c") "fortran77/lovlap.f")
> +                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
> +                 (string-append init " CACHE STRING \"\")"))
> +                (("add_library\\(yaehmop_eht" lib)
> +                 (string-append lib " SHARED "))
> +                (("target_link_libraries\\(test_eht
> \\$\\{LAPACK_LIBRARIES\\}.*"
> +                  all)
> +                 (string-append all
> "\ntarget_link_libraries(yaehmop_eht "
> +                                "${LAPACK_LIBRARIES})\n")))))
> +          (add-after 'build 'fix-latex
> +            (lambda _
> +              (chdir "../docs")
> +              (substitute* "bind_manual.tex"
> +                (("\\\\usepackage\\{bindpage\\}")
> +                 (string-append
> +                 
> "\\usepackage[left=2cm,right=2cm,top=4cm,bottom=2cm]"
> +                  "{geometry}")))
> +              (substitute* "Zmat_appendix.tex"
> +                (("file=dihedral\\.eps")
> +                 "file=figs/dihedral.eps"))))
> +          (add-after 'fix-latex 'build-doc
> +            (lambda _
> +              ;; TODO: not reproducible
> +              (setenv "FORCE_SOURCE_DATE" "1")
> +              ;; Needs to run twice to compile completely
> +              (invoke "pdflatex" "bind_manual.tex")
> +              (invoke "pdflatex" "bind_manual.tex")
> +              (chdir "../build")))
Note that we have rubber to automate building PDFs.  Also prefer "with-
directory-excursion" over chdir where possible.
> +          (add-after 'install 'install-eht-parms
> +            (lambda _
> +              (install-file "../tightbind/eht_parms.dat"
> +                            (string-append #$output "/share/"
> +                                           #$name "-" #$version))))
> +          (add-after 'install-eht-parms 'install-doc
> +            (lambda _
> +              (install-file "../docs/bind_manual.pdf"
> +                            (string-append #$output "/share/doc/"
> +                                           #$name "-" #$version))))
> +          (delete 'check)
> +          (add-after 'install-doc 'check
> +            (lambda* (#:key tests? #:allow-other-keys)
> +              (when tests?
> +                (invoke "./test_eht")))))))
> +    (native-inputs
> +     `(("gfortran" ,gfortran)
> +       ("texlive" ,(texlive-updmap.cfg (list texlive-fonts-ec
> +                                             texlive-latex-graphics
> +                                             texlive-latex-
> geometry)))))
I think you can do without labels here (see my comment regarding
rubber).
> +    (inputs (list openblas))
> +    (home-page "https://github.com/greglandrum/yaehmop")
> +    (synopsis "Yet Another extended Hueckel Molecular Orbital
> Package")
You can use this as an @acronym in the description.  For the synopsis,
I'd use something else, e.g. "Perform Hückel calculations".
> +    (description "@code{YAeHMOP} contains a program and library for
> performing
> +extended Hückel calculations.")
I recommend adding "and analyzing and visualizing the results." (see
plug_it.tex)
> +    (license license:bsd-2)))

Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 11/13] gnu: Add avalontoolkit.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 11/13] gnu: Add avalontoolkit David Elsing
@ 2022-10-09 12:06   ` Liliana Marie Prikler
  2022-10-13 21:01     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-09 12:06 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> * gnu/packages/chemistry.scm (avalontoolkit): New variable.
> ---
>  gnu/packages/chemistry.scm | 93
> ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 93 insertions(+)
> 
> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
> index 68d28a52c3..e52dd2f3b6 100644
> --- a/gnu/packages/chemistry.scm
> +++ b/gnu/packages/chemistry.scm
> @@ -928,3 +928,96 @@ (define-public yaehmop
>      (description "@code{YAeHMOP} contains a program and library for
> performing
>  extended Hückel calculations.")
>      (license license:bsd-2)))
> +
> +(define-public avalontoolkit
> +  (package
> +    (name "avalontoolkit")
I think we could do a hyphen between avalon and toolkit.
> +    (version "1.2.0")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append
> +             "mirror://sourceforge/avalontoolkit/"
> +             "AvalonToolkit_" (substring version 0 3)
> "/AvalonToolkit_"
> +             version ".source.tar"))
> +       (sha256
> +        (base32
> +         "0rnnyy6axs2da7aa4q6l30ldavbk49v6l22llj1adn74h1i67bpv"))
> +       (modules '((guix build utils) (ice-9 ftw)))
> +       (snippet
> +        #~(begin
> +            (chdir "..")
> +            (delete-file-recursively "SourceDistribution/java")))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     (list
> +      ;; There are no tests
> +      #:tests? #f
> +      #:phases
> +      #~(let ((programs '("canonizer" "matchtest" "smi2mol"
> "struchk")))
> +          (modify-phases %standard-phases
> +            (delete 'configure)
> +            (add-before 'build 'remove-free
> +              (lambda _
> +                ;; Remove incorrect free of getenv result (patch
> also in rdkit)
> +                (substitute* "common/reaccsio.c"
> +                  (("MyFree.*tempdir.*") ""))))
> +            (replace 'build
> +              (lambda _
> +                (chdir "common")
> +                (let* ((parts
> +                        (list
> +                         "aacheck" "casutils" "denormal"
> "depictutil"
> +                         "didepict" "fixcharges" "forio" "geometry"
> "graph"
> +                         "hashcode" "layout" "local" "patclean"
> "pattern"
> +                         "perceive" "reaccsio" "rtutils" "set"
> "shortcut"
> +                         "sketch" "ssmatch" "stereo" "symbol_lists"
> +                         "symboltable" "utilities"))
> +                       (objects (map (lambda (name) (string-append
> name ".o"))
> +                                     parts)))
> +                  (for-each
> +                   (lambda (name)
> +                     (display (string-append "Compiling " name
> ".c\n"))
> +                     (invoke "gcc" "-c" "-fPIC" "-O2"
> +                             (string-append name ".c")
> +                             "-o" (string-append name ".o")))
> +                   parts)
> +                  (display "Building shared library\n")
> +                  (apply invoke "gcc" "-fPIC" "-shared" "-lm"
> +                         "-o" "libavalontoolkit.so"
> +                         "canonizer.c" "smi2mol.c" "struchk.c"
> objects)
> +                  (for-each
> +                   (lambda (program)
> +                     (display (string-append "Building " program
> "\n"))
> +                     (invoke "gcc" "-L." "-lavalontoolkit" "-lm" "-
> O2"
> +                             (string-append "-Wl,-rpath=" #$output
> "/lib")
> +                             "-DMAIN" (string-append program ".c")
> "-o" program))
> +                   programs))))
Uhm... is the Makefile that unusable?
> +            (replace 'install
> +              (lambda _
> +                ;; Executables
> +                (for-each
> +                 (lambda (program)
> +                   (install-file program (string-append #$output
> "/bin")))
> +                 programs)
> +                (for-each
> +                 (lambda (name)
> +                   (symlink (string-append #$output "/bin/smi2mol")
> +                            (string-append #$output "/bin/" name)))
> +                 '("mol2smi" "rdf2smi" "mol2tbl" "mol2sma"
> "smi2rdf"))
> +                ;; Library
> +                (install-file "libavalontoolkit.so" (string-append
> #$output "/lib"))
> +                (for-each
> +                 (lambda (file)
> +                   (install-file file (string-append #$output
> +                                                   
> "/include/avalontoolkit")))
> +                 (find-files "." "\\.h$"))
> +                (install-file "../license.txt"
> +                              (string-append #$output "/share/doc/"
> +                                             #$name "-" #$version
> "/"))))))))
Same as above.
> +    (home-page "https://sourceforge.net/projects/avalontoolkit/")
> +    (synopsis "Tools for SMILES and MOL files and for structure
> fingerprinting")
> +    (description "This package contains a library and programs for
> +canonicalization of SMILES and MOL files, molecular structure
> fingerprinting
> +and rendering molecules.")
> +    (license license:bsd-3)))


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 13/13] gnu: Add rdkit.
  2022-10-07 15:22 ` [bug#58261] [PATCH v2 13/13] gnu: Add rdkit David Elsing
@ 2022-10-09 12:12   ` Liliana Marie Prikler
  2022-10-13 21:01     ` David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-09 12:12 UTC (permalink / raw)
  To: David Elsing, 58261

Am Freitag, dem 07.10.2022 um 15:22 +0000 schrieb David Elsing:
> * gnu/packages/chemistry.scm (rdkit): New variable.
> ---
>  gnu/packages/chemistry.scm                    | 178
> ++++++++++++++++++
>  .../rdkit-cmake-external-dependencies.patch   | 102 ++++++++++
>  2 files changed, 280 insertions(+)
>  create mode 100644 gnu/packages/patches/rdkit-cmake-external-
> dependencies.patch
> 
> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
> index 43953238cd..4b34a38797 100644
> --- a/gnu/packages/chemistry.scm
> +++ b/gnu/packages/chemistry.scm
> @@ -34,6 +34,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages algebra)
>    #:use-module (gnu packages autotools)
>    #:use-module (gnu packages backup)
> +  #:use-module (gnu packages base)
>    #:use-module (gnu packages bison)
>    #:use-module (gnu packages boost)
>    #:use-module (gnu packages check)
> @@ -41,10 +42,12 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages cpp)
>    #:use-module (gnu packages documentation)
>    #:use-module (gnu packages flex)
> +  #:use-module (gnu packages fonts)
>    #:use-module (gnu packages fontutils)
>    #:use-module (gnu packages gcc)
>    #:use-module (gnu packages gl)
>    #:use-module (gnu packages graphviz)
> +  #:use-module (gnu packages gtk)
>    #:use-module (gnu packages gv)
>    #:use-module (gnu packages image)
>    #:use-module (gnu packages maths)
> @@ -56,6 +59,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages qt)
>    #:use-module (gnu packages serialization)
>    #:use-module (gnu packages sphinx)
> +  #:use-module (gnu packages sqlite)
>    #:use-module (gnu packages stb)
>    #:use-module (gnu packages tex)
>    #:use-module (gnu packages web)
> @@ -1101,3 +1105,177 @@ (define-public ringdecomposerlib
>  unique ring families, relevant cycles, the smallest set of smallest
> rings and
>  other ring topology descriptions.")
>      (license license:bsd-3)))
> +
> +(define-public rdkit
> +  (package
> +    (name "rdkit")
> +    (version "2022.03.5")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/rdkit/rdkit")
> +                    (commit
> +                     (string-append
> +                      "Release_" (string-replace-substring version
> "." "_")))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "19idgilabh04cbr1qj6zgrgsfjm248mmfz6fsr0smrd68d0xnml9"))
> +              (patches
> +               (search-patches "rdkit-cmake-external-
> dependencies.patch"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               #~(begin
> +                   ;; Remove pickle files (only used in tests),
> +                   ;; as they are compiled programs
> +                   (for-each
> +                    (lambda (name)
> +                      (display (string-append name "\n"))
> +                      (delete-file name))
> +                    (find-files "." "\\.pkl(\\.gz)?$"))
> +                   ;; Remove SQLite data files (can be generated)
> +                   (delete-file "Data/RDData.sqlt")
> +                   (delete-file "Data/RDTests.sqlt")))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list
> +      #: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)))
> +      #:configure-flags
> +      #~(list
> +         "-DRDK_BUILD_AVALON_SUPPORT=ON"
> +         "-DRDK_BUILD_CAIRO_SUPPORT=ON"
> +         "-DRDK_BUILD_CPP_TESTS=ON"
> +         "-DRDK_BUILD_FREESASA_SUPPORT=ON"
> +         "-DRDK_BUILD_INCHI_SUPPORT=ON"
> +         "-DRDK_BUILD_YAEHMOP_SUPPORT=ON"
Are any of these implied or do they have to be explicitly enabled?
> +         (string-append "-DCATCH_DIR="
> +                        #$(this-package-native-input "catch2")
> +                        "/include/catch2")
> +         "-DRDK_INSTALL_DEV_COMPONENT=ON"
> +         "-DRDK_INSTALL_INTREE=OFF"
> +         "-DRDK_INSTALL_STATIC_LIBS=OFF"
> +         (string-append
> +          "-DRDK_OPTIMIZE_POPCNT="
> +          #$(let ((system (or (%current-target-system)
> +                              (%current-system))))
> +              (cond
> +               ((string-prefix? "x86_64" system) "ON")
> +               ((string-prefix? "i686" system) "ON")
> +               (else "OFF"))))
> +         "-DRDK_USE_BOOST_IOSTREAMS=ON"
> +         "-DRDK_USE_FLEXBISON=ON")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'copy-external-dependencies
> +            (lambda _
> +              (symlink
> +               (string-append
> +                #$(this-package-input "font-comic-neue")
> +                "/share/fonts/truetype/ComicNeue-Regular.ttf")
> +               "Data/Fonts/ComicNeue-Regular.ttf")))
Try (search-input-file) instead.
> +          (add-after 'copy-external-dependencies 'patch-source
> +            (lambda _
> +              (substitute* "External/AvalonTools/CMakeLists.txt"
> +                (("^if\\(NOT RDK_BUILD" orig)
> +                 (string-append "if(0)\n" orig))
> +                (("include_directories.*AVALON_SRC_PATH.*")
> +                 (string-append "endif()\ninclude_directories("
> +                                #$avalontoolkit
> "/include/avalontoolkit)\n"))
> +                (("LINK_LIBRARIES avalon_clib")
> +                 (string-append
> +                  "LINK_LIBRARIES -L" #$avalontoolkit "/lib -
> lavalontoolkit")))
> +              (let ((port
> +                     (open-file "External/RingFamilies/dummy.cpp"
> "w")))
> +                (display "" port)
> +                (close port))
> +              (let ((port
> +                     (open-file
> "External/RingFamilies/CMakeLists.txt" "w")))
> +                (display (string-append
> +                          "rdkit_library(RingDecomposerLib dummy.cpp
> SHARED"
> +                          " LINK_LIBRARIES -lRingDecomposerLib)\n"
> +                          "set(RDK_URF_LIBS RingDecomposerLib CACHE
> STRING \"\" FORCE)\n")
> +                         port)
> +                (close port))
> +              (substitute*
> "Code/GraphMol/MolInterchange/CMakeLists.txt"
> +                (("if\\(NOT" orig)
> +                 (string-append "if(0)\n" orig))
> +                (("^include_directories.*") "endif()\n"))
> +              (substitute* "External/YAeHMOP/EHTTools.cpp"
> +                (("<yaehmop/tightbind/bind.h>")
> "<yaehmop/bind.h>"))))
I think you might want to unbundle these with a patch.
> +          (add-after 'unpack 'fix-inchi-include
> +            (lambda _
> +              (substitute* "Code/cmake/Modules/FindInchi.cmake"
> +                (("inchi_api.h.*\\)") "inchi/inchi_api.h)")
> +                (("INCHI_LIBRARY NAMES.*\\)")
> +                 "INCHI_LIBRARY NAMES inchi PATH_SUFFIXES inchi)")
> +                (("find_library" prev)
> +                 (string-append
> +                  "list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.1)\n"
> +                  prev)))
> +              (substitute* "External/INCHI-API/inchi.cpp"
> +                (("<inchi_api.h>") "<inchi/inchi_api.h>"))))
> +          (add-before 'build 'enable-bytecode-determinism
> +              (lambda _
> +                (setenv "PYTHONHASHSEED" "0")
> +                (setenv "PYTHONDONTWRITEBYTECODE" "1")))
> +          (add-after 'install 'pre-check
> +            (lambda* (#:key inputs outputs #:allow-other-keys)
> +              (with-directory-excursion "../source"
> +                (invoke "sqlite3" "Data/RDData.sqlt"
> +                        ".read rdkit/Dbase/test_data/RDData.sqlite")
> +                (invoke "sqlite3" "Data/RDTests.sqlt"
> +                        ".read
> rdkit/Dbase/test_data/RDTests.sqlite")
> +                (setenv "RDBASE" (canonicalize-path ".")))
> +              (add-installed-pythonpath inputs outputs)))
> +          (delete 'check)
> +          (add-after 'pre-check 'check
> +            (lambda* (#:key tests? parallel-tests? #:allow-other-
> keys)
> +              (when tests?
> +                (let ((job-count (number->string
> +                                  (if parallel-tests? (parallel-job-
> count) 1))))
> +                  (invoke
> +                   "ctest" "-j" job-count
> +                   "-E" (string-append
> +                         "(" (string-join
> +                              '(;; need pickled data
> +                                "(pyDiscreteValueVect"
> "pySparseIntVect"
> +                                "graphmoltestPickler"
> "pyPartialCharges"
> +                                "substructLibraryTest" "pyFeatures"
> +                                "pythonTestDirML"
> "pythonTestDirChem"
> +                                ;; Catching Python exception fails
> +                                "pyRanker)") "|") ")")))))))))
I think you have two layers of brackets now – delete the inner ones.
> +    (native-inputs
> +     (list bison
> +           boost
> +           catch2
> +           eigen
> +           flex
> +           freesasa
> +           pkg-config
> +           rapidjson
> +           tar))
> +    (inputs
> +     (list avalontoolkit
> +           cairo
> +           coordgenlibs
> +           font-comic-neue
> +           freetype
> +           inchi
> +           maeparser
> +           python
> +           ringdecomposerlib
> +           sqlite
> +           yaehmop))
> +    (propagated-inputs
> +     (list python-numpy python-cairocffi python-pillow))
> +    (home-page "https://rdkit.org/")
> +    (synopsis "Collection of cheminformatics software")
> +    (description "RDKit is a C++ and Python library for
> cheminformatics, which
> +includes (among other things) the analysis and modification of
> molecules in 2D
> +and 3D and descriptor generation for machine learning.")
> +    (license license:bsd-3)))
> diff --git a/gnu/packages/patches/rdkit-cmake-external-
> dependencies.patch b/gnu/packages/patches/rdkit-cmake-external-
> dependencies.patch
> new file mode 100644
> index 0000000000..5b73864f51
> --- /dev/null
> +++ b/gnu/packages/patches/rdkit-cmake-external-dependencies.patch
> @@ -0,0 +1,102 @@
> +diff -ur a/External/FreeSASA/CMakeLists.txt
> b/External/FreeSASA/CMakeLists.txt
> +--- a/External/FreeSASA/CMakeLists.txt
> ++++ b/External/FreeSASA/CMakeLists.txt
> +@@ -10,7 +10,7 @@
> +   endif()
> + endif()
> + 
> +-if(needDownload)
> ++if(FALSE)
> +   # don't actually use the md5 here
> +   set(FREESASA_VERSION "2.0.3")
> +   set(FREESASA_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/freesasa-
> ${FREESASA_VERSION}")
> +@@ -66,24 +66,24 @@
> + endif()
> + 
> + set (freesasa_h ${FREESASA_SRC_DIR}/src/freesasa.h)
> +-file(READ ${freesasa_h} freesasa_h_data)
> ++#file(READ ${freesasa_h} freesasa_h_data)
> + string(REGEX REPLACE "(#include <stdio.h>)" "\\1\n#include
> <RDGeneral/export.h>" freesasa_h_data "${freesasa_h_data}")
> + string(REGEX REPLACE
> "([^R][^D][^K][^I][^T][^_][^F][^R][^E][^E][^S][^A][^S][^A][^_][^C][^L
> ][^I][^B][^_][^E][^X][^P][^O][^R][^T][^ ])(extern const)"
> "\\1RDKIT_FREESASA_CLIB_EXPORT \\2" freesasa_h_data
> "${freesasa_h_data}")
> +-file(WRITE ${freesasa_h} "${freesasa_h_data}")
> ++#file(WRITE ${freesasa_h} "${freesasa_h_data}")
> + 
> + add_definitions(-DUSE_THREADS=0)
> + add_definitions(-DUSE_JSON=0)
> + add_definitions(-DUSE_XML=0)
> +-rdkit_library(freesasa_clib ${freesasa_clib_srcs})
> +-target_compile_definitions(freesasa_clib PRIVATE
> RDKIT_FREESASALIB_BUILD)
> ++#rdkit_library(freesasa_clib ${freesasa_clib_srcs})
> ++#target_compile_definitions(freesasa_clib PRIVATE
> RDKIT_FREESASALIB_BUILD)
> + 
> + if((MSVC AND RDK_INSTALL_DLLS_MSVC) OR ((NOT MSVC) AND WIN32))
> +   set_target_properties(freesasa_clib PROPERTIES
> WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
> + endif()
> +-include_directories("${FREESASA_SRC_DIR}/src")
> ++#include_directories("${FREESASA_SRC_DIR}/src")
> + 
> + rdkit_library(FreeSASALib RDFreeSASA.cpp SHARED 
> +-    LINK_LIBRARIES freesasa_clib GraphMol )
> ++    LINK_LIBRARIES -lfreesasa GraphMol )
> + target_compile_definitions(FreeSASALib PRIVATE
> RDKIT_FREESASALIB_BUILD)
> + 
> + rdkit_headers(RDFreeSASA.h DEST GraphMol)
> +diff -ur a/External/YAeHMOP/CMakeLists.txt
> b/External/YAeHMOP/CMakeLists.txt
> +--- a/External/YAeHMOP/CMakeLists.txt
> ++++ b/External/YAeHMOP/CMakeLists.txt
> +@@ -18,32 +18,32 @@
> + 
> + include_directories( ${RDKit_ExternalDir}/YAeHMOP )
> + 
> +-ExternalProject_Add(yaehmop_project
> +-  GIT_REPOSITORY https://github.com/greglandrum/yaehmop.git
> +-  GIT_TAG master
> +-  UPDATE_COMMAND ""
> +-  PATCH_COMMAND ""
> +-  PREFIX ${CMAKE_CURRENT_SOURCE_DIR}
> +-  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop"
> +-  SOURCE_SUBDIR "tightbind"
> +-  CMAKE_ARGS -DUSE_BLAS_LAPACK=OFF -
> DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} -
> DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -
> DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
> +-  TEST_COMMAND "")
> +-
> +-include_directories(${PROJECT_BINARY_DIR}/include)
> +-link_directories(${PROJECT_BINARY_DIR}/lib)
> +-link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-
> build)
> +-
> +-set(EHT_PARAM_FILE
> ${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind/eht_parms.dat )
> +-install(FILES ${EHT_PARAM_FILE}
> +-        DESTINATION ${RDKit_ShareDir}/Data
> +-        COMPONENT data)
> ++#ExternalProject_Add(yaehmop_project
> ++#  GIT_REPOSITORY https://github.com/greglandrum/yaehmop.git
> ++#  GIT_TAG master
> ++#  UPDATE_COMMAND ""
> ++#  PATCH_COMMAND ""
> ++#  PREFIX ${CMAKE_CURRENT_SOURCE_DIR}
> ++#  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop"
> ++#  SOURCE_SUBDIR "tightbind"
> ++#  CMAKE_ARGS -DUSE_BLAS_LAPACK=OFF -
> DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} -
> DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -
> DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
> ++#  TEST_COMMAND "")
> ++
> ++#include_directories(${PROJECT_BINARY_DIR}/include)
> ++#link_directories(${PROJECT_BINARY_DIR}/lib)
> ++#link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-
> build)
> ++
> ++#set(EHT_PARAM_FILE
> ${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind/eht_parms.dat )
> ++#install(FILES ${EHT_PARAM_FILE}
> ++#        DESTINATION ${RDKit_ShareDir}/Data
> ++#        COMPONENT data)
> + 
> +-message("YAeHMOP include_dirs: ${PROJECT_BINARY_DIR}/include")
> +-message("YAeHMOP link_dirs: ${PROJECT_BINARY_DIR}/lib
> ${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build")
> ++#message("YAeHMOP include_dirs: ${PROJECT_BINARY_DIR}/include")
> ++#message("YAeHMOP link_dirs: ${PROJECT_BINARY_DIR}/lib
> ${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build")
> + 
> +-rdkit_library(EHTLib EHTTools.cpp SHARED LINK_LIBRARIES yaehmop_eht
> GraphMol )
> ++rdkit_library(EHTLib EHTTools.cpp SHARED LINK_LIBRARIES -
> lyaehmop_eht GraphMol )
> + target_compile_definitions(EHTLib PRIVATE RDKIT_EHTLIB_BUILD)
> +-add_dependencies(EHTLib yaehmop_project)
> ++#add_dependencies(EHTLib yaehmop_project)
> + rdkit_headers(EHTTools.h DEST GraphMol)
> + rdkit_catch_test(testEHTLib1 test1.cpp
> +            LINK_LIBRARIES EHTLib FileParsers SmilesParse )
Cheers


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 00/13] Add rdkit v2.
  2022-10-09 10:02   ` Liliana Marie Prikler
@ 2022-10-13 20:58     ` David Elsing
  0 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 20:58 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
>> Thanks a lot for your comments, they are very helpful!
>> Sorry about the descriptions, I took them mostly from upstream. :)
>> Are they still too short?
> I don't think we can magically poof good descriptions into existence
> when upstreams don't provide them.  That being said, it's best to clean
> up whatever's there.  Changing descriptions is a lowball issue, though,
> I (or another committer) can do so as we're upstreaming it.
>
>> I still have the following problems:
>> * The tests of tinydir contain a bundled fork of cbehave which uses a
>>   (bundled) copy of rlutil, so I left them disabled for now.
> I mentioned this in a reply to another message already, but the idea
> would be to 1. try to use upstream versions or 2. try to package the
> bundles. 
I noticed that there was only one test anyway, so I just made a patch to
run it with the upstream version (which was last updated in 2013).
>
>> * Building the documentation of yaehmop with pdflatex is not
>> reproducible even
>>   though I set FORCE_SOURCE_DATE=1. Is it even necessary to build the
>>   documentation?
> Maybe pdftrailerid can help you?  You could also try to convert the
> documentation into a reproducible format -- e.g. using pandoc.
It worked with \pdfsuppressptexinfo=-1. :)
>
>> * Using @abbr in the description does not work (I also did not find
>> it in any
>>   other package).
> My bad, that should be @acronym.
Ok thanks!
>
> Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 03/13] gnu: Add sajson.
  2022-10-09 11:46   ` Liliana Marie Prikler
@ 2022-10-13 20:59     ` David Elsing
  2022-10-14 21:30       ` Liliana Marie Prikler
  0 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-13 20:59 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
>> * gnu/packages/cpp.scm (sajson): New variable.
>> ---
>>  gnu/packages/cpp.scm                          | 60
>> +++++++++++++++++++
>>  .../patches/sajson-build-with-gcc10.patch     | 45 ++++++++++++++
>>  2 files changed, 105 insertions(+)
>>  create mode 100644 gnu/packages/patches/sajson-build-with-
>> gcc10.patch
>> 
>> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
>> index 38a2a9e829..dca0245df5 100644
>> --- a/gnu/packages/cpp.scm
>> +++ b/gnu/packages/cpp.scm
>> @@ -57,6 +57,7 @@ (define-module (gnu packages cpp)
>>    #:use-module (guix build-system gnu)
>>    #:use-module (guix build-system meson)
>>    #:use-module (guix build-system python)
>> +  #:use-module (guix build-system scons)
>>    #:use-module (guix modules)
>>    #:use-module (guix gexp)
>>    #:use-module (gnu packages)
>> @@ -2005,3 +2006,62 @@ (define-public pocketfft-cpp
>>  computing Fast Fourier transformations.  It supports
>> multidimensional arrays,
>>  different floating point sizes and complex transformations.")
>>        (license license:bsd-3))))
>> +
>> +(define-public sajson
>> +  (let ((commit "ec644013e34f9984a3cc9ba568cab97a391db9cd")
>> +        (revision "0"))
>> +    (package
>> +      (name "sajson")
>> +      (version (git-version "1.0" revision commit))
>> +      (source (origin
>> +                (method git-fetch)
>> +                (uri (git-reference
>> +                      (url "https://github.com/chadaustin/sajson")
>> +                      (commit commit)))
>> +                (file-name (git-file-name name version))
>> +                (patches
>> +                 (search-patches "sajson-build-with-gcc10.patch"))
>> +                (sha256
>> +                 (base32
>> +                 
>> "0fjag27w7gvkc5pdhq3ad7yc09rabpzahndw1sgsg04ipznidmmq"))
>> +                (modules '((guix build utils)))
>> +                (snippet '(delete-file-recursively "third-party"))))
>> +      (build-system scons-build-system)
>> +      (arguments
>> +       (list
>> +        #:phases
>> +        #~(modify-phases %standard-phases
>> +            (add-after 'unpack 'disable-other-builds
>> +              (lambda _
>> +                (substitute* "SConstruct"
>> +                  (("for name, tools in builds:")
>> +                   "for name, tools in [('opt', [gcc, opt])]:"))))
>> +            (add-after 'unpack 'use-external-unittest-cpp
>> +              (lambda* (#:key inputs #:allow-other-keys)
>> +                (substitute* "SConscript"
>> +                  (("unittestpp_env\\.Library") "_dummy = ")
>> +                  (("test_env = env.Clone\\(tools=\\[unittestpp,
>> sajson\\]\\)")
>> +                   (string-append
>> +                    "test_env = env.Clone(tools=[sajson])\n"
>> +                    "test_env.Append(CPPPATH='"
>> +                    (search-input-directory inputs
>> "/include/UnitTest++")
> Note that you need (or native-inputs inputs) wherever you wrote inputs.
Is %build-inputs ok?
>> +                    "', LIBPATH='"
>> +                    (string-append #$(this-package-native-input
>> "unittest-cpp")
>> +                                   "/lib")
>> +                    "', LIBS=['UnitTest++'])")))))
>> +            (replace 'check
>> +              (lambda* (#:key tests? #:allow-other-keys)
>> +                (when tests?
>> +                  (invoke "build/opt/test")
>> +                  (invoke "build/opt/test_unsorted"))))
>> +            (replace 'install
>> +              (lambda _
>> +                (let ((out (string-append #$output "/include")))
>> +                  (install-file "include/sajson.h" out)
>> +                  (install-file "include/sajson_ostream.h"
>> out)))))))
> For the record, what would a regular install do?
Just nothing.
>> +      (native-inputs (list unittest-cpp))
>> +      (home-page "https://github.com/chadaustin/sajson")
>> +      (synopsis "C++11 header-only, in-place JSON parser")
>> +      (description "@code{sajson} is an in-place JSON parser with
>> support for
>> +parsing with only a single memory allocation.")
>> +      (license license:expat))))
>> diff --git a/gnu/packages/patches/sajson-build-with-gcc10.patch
>> b/gnu/packages/patches/sajson-build-with-gcc10.patch
>> new file mode 100644
>> index 0000000000..878706dc79
>> --- /dev/null
>> +++ b/gnu/packages/patches/sajson-build-with-gcc10.patch
>> @@ -0,0 +1,45 @@
>> +This patch is from the upstream pull request
>> +https://github.com/chadaustin/sajson/pull/54.
>> +It fixes linking with GCC.
>> +
>> +diff --git a/include/sajson.h b/include/sajson.h
>> +index 8b4e05a..1bd045b 100644
>> +--- a/include/sajson.h
>> ++++ b/include/sajson.h
>> +@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t,
>> size_t value) {
>> + // header. This trick courtesy of Rich Geldreich's Purple JSON
>> parser.
>> + template <typename unused = void>
>> + struct globals_struct {
>> ++    static const unsigned char parse_flags[256];
>> ++};
>> ++typedef globals_struct<> globals;
>> ++
>> + // clang-format off
>> + 
>> +     // bit 0 (1) - set if: plain ASCII string character
>> +     // bit 1 (2) - set if: whitespace
>> +     // bit 4 (0x10) - set if: 0-9 e E .
>> +-    constexpr static const uint8_t parse_flags[256] = {
>> ++    template <typename unused>
>> ++    const unsigned char globals_struct<unused>::parse_flags[256] =
>> {
>> +      // 0    1    2    3    4    5    6    7      8    9    A   
>> B    C    D    E    F
>> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,   2,  
>> 0,   0,   2,   0,   0, // 0
>> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,   0,  
>> 0,   0,   0,   0,   0, // 1
>> +@@ -162,15 +167,13 @@ struct globals_struct {
>> +     };
>> + 
>> + // clang-format on
>> +-};
>> +-typedef globals_struct<> globals;
>> + 
>> +-constexpr inline bool is_plain_string_character(char c) {
>> ++inline bool is_plain_string_character(char c) {
>> +     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
>> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
>> 1) != 0;
>> + }
>> + 
>> +-constexpr inline bool is_whitespace(char c) {
>> ++inline bool is_whitespace(char c) {
>> +     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
>> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
>> 2) != 0;
>> + }

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 06/13] gnu: Add gemmi.
  2022-10-09 11:54   ` Liliana Marie Prikler
@ 2022-10-13 21:00     ` David Elsing
  2022-10-14 21:32       ` Liliana Marie Prikler
  0 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:00 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
>> * gnu/packages/chemistry.scm (gemmi): New variable.
>> ---
>>  gnu/packages/chemistry.scm                    | 118 +++++++++++
>>  .../patches/gemmi-fix-sajson-types.patch      |  11 +
>>  .../sajson-for-gemmi-build-with-gcc10.patch   |  45 ++++
>>  .../sajson-for-gemmi-numbers-as-strings.patch | 195
>> ++++++++++++++++++
>>  4 files changed, 369 insertions(+)
>>  create mode 100644 gnu/packages/patches/gemmi-fix-sajson-types.patch
>>  create mode 100644 gnu/packages/patches/sajson-for-gemmi-build-with-
>> gcc10.patch
>>  create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-
>> strings.patch
>> 
>> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
>> index c517610fe8..d8f1608a3a 100644
>> --- a/gnu/packages/chemistry.scm
>> +++ b/gnu/packages/chemistry.scm
>> @@ -6,6 +6,7 @@
>>  ;;; Copyright © 2020 Björn Höfling
>> <bjoern.hoefling@bjoernhoefling.de>
>>  ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
>>  ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
>> +;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
>>  ;;;
>>  ;;; This file is part of GNU Guix.
>>  ;;;
>> @@ -23,6 +24,7 @@
>>  ;;; along with GNU Guix.  If not, see
>> <http://www.gnu.org/licenses/>.
>>  
>>  (define-module (gnu packages chemistry)
>> +  #:use-module (guix gexp)
>>    #:use-module (guix packages)
>>    #:use-module (guix utils)
>>    #:use-module ((guix licenses) #:prefix license:)
>> @@ -35,6 +37,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages boost)
>>    #:use-module (gnu packages check)
>>    #:use-module (gnu packages compression)
>> +  #:use-module (gnu packages cpp)
>>    #:use-module (gnu packages documentation)
>>    #:use-module (gnu packages fontutils)
>>    #:use-module (gnu packages gl)
>> @@ -50,8 +53,10 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages qt)
>>    #:use-module (gnu packages serialization)
>>    #:use-module (gnu packages sphinx)
>> +  #:use-module (gnu packages stb)
>>    #:use-module (gnu packages xml)
>>    #:use-module (guix build-system cmake)
>> +  #:use-module (guix build-system copy)
>>    #:use-module (guix build-system gnu)
>>    #:use-module (guix build-system python))
>>  
>> @@ -566,3 +571,116 @@ (define-public python-pymol
>>  used to prepare publication-quality figures, to share interactive
>> results with
>>  your colleagues, or to generate pre-rendered animations.")
>>      (license license:bsd-3)))
>> +
>> +(define-public sajson-for-gemmi
>> +  (package/inherit sajson
>> +    (name "sajson-for-gemmi")
>> +    (source (origin
>> +              (inherit (package-source sajson))
>> +              (patches (search-patches
>> +                        "sajson-for-gemmi-numbers-as-strings.patch"
>> +                        "sajson-for-gemmi-build-with-
>> gcc10.patch"))))
>> +    (arguments
>> +     (substitute-keyword-arguments (package-arguments sajson)
>> +       ((#:tests? _ #f) #f)
> Don't forget the comment as to why they're disabled.
>> +       ((#:phases phases)
>> +        #~(modify-phases #$phases
>> +            (delete 'build)))))))
> Why is the build deleted?
It fails due to the change and only builds the tests anyway.
>
> Split here.
>> +(define-public gemmi
>> +  (package
>> +    (name "gemmi")
>> +    (version "0.5.7")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/project-gemmi/gemmi")
>> +                    (commit (string-append "v" version))))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "00km5q726bslrw7xbfwb3f3mrsk19qbimfnl3hvr4wi1y3z8i18a"))
>> +              (patches
>> +               (search-patches "gemmi-fix-sajson-types.patch"))
>> +              (modules '((guix build utils)))
>> +              (snippet
>> +               '(begin
>> +                  (delete-file-recursively
>> "include/gemmi/third_party")
>> +                  (delete-file-recursively "third_party")))))
>> +    (outputs '("out" "bin" "python"))
>> +    (build-system cmake-build-system)
>> +    (native-inputs
>> +     (list fast-float
>> +           optionparser
>> +           pegtl
>> +           pocketfft-cpp
>> +           pybind11
>> +           sajson-for-gemmi
>> +           stb-sprintf
>> +           tinydir))
>> +    (inputs (list python zlib))
>> +    (arguments
>> +     (list
>> +      #:configure-flags
>> +      #~(let* ((python-lib
>> +                (string-append
>> +                 #$output:python "/lib/python"
>> +                 #$(version-major+minor (package-version python))
>> +                 "/site-packages")))
> Note that python-build-system has a (site-packages) procedure.  Writing
> the boilerplate to include it in the build shouldn't be much worse in
> terms of lines than what you're doing here.
>> +          (list "-DUSE_PYTHON=ON"
>> +                (string-append "-DPYTHON_INSTALL_DIR=" python-lib)))
>> +      #:phases
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'unpack 'patch-includes
>> +            (lambda _
>> +              (substitute* "include/gemmi/sprintf.hpp"
>> +                (("<stb/stb_sprintf.h>") "<stb_sprintf.h>"))
>> +              (substitute* "include/gemmi/dirwalk.hpp"
>> +                (("\"third_party/tinydir.h\"") "<tinydir.h>"))
>> +              (substitute* "include/gemmi/cif.hpp"
>> +                (("\"third_party/tao/pegtl.hpp\"")
>> "<tao/pegtl.hpp>"))
>> +              (substitute* "include/gemmi/json.hpp"
>> +                (("\"third_party/sajson.h\"") "<sajson.h>"))
>> +              (substitute* "python/gemmi.cpp"
>> +                (("\"gemmi/third_party/tao/pegtl/parse_error.hpp\"")
>> +                 "<tao/pegtl/parse_error.hpp>"))
>> +              (substitute* '("include/gemmi/atof.hpp"
>> +                             "include/gemmi/numb.hpp")
>> +                (("\"third_party/fast_float.h\"")
>> +                 "<fast_float/fast_float.h>"))
>> +              (substitute* "include/gemmi/fourier.hpp"
>> +                (("\"third_party/pocketfft_hdronly.h\"")
>> +                 "<pocketfft_hdronly.h>"))))
> I'd collect all the files into a (list ...) and then write out the
> substitutes.
Is it preferred to put list elements on separate lines (also in inputs)?
>
>> +          (add-after 'patch-includes 'patch-cif
>> +            (lambda _
>> +              (substitute* "include/gemmi/cif.hpp"
>> +                (((string-append
>> +                   "^.*using analyze_t = pegtl::analysis::generic"
>> +                   "<pegtl::analysis::rule_type::ANY>;.*$")) "")
>> +                (("TAOCPP_PEGTL_") "TAO_PEGTL_"))))
> Uhm... I think I'd prefer a patch for this one.
>> +          (add-after 'unpack 'change-bin-prefix
>> +            (lambda _
>> +              (substitute* "CMakeLists.txt"
>> +                (("install\\(TARGETS program DESTINATION bin\\)")
>> +                 (string-append
>> +                  "install(TARGETS program DESTINATION "
>> +                  #$output:bin "/bin)")))))
>> +          (replace 'check
>> +            (lambda* (#:key tests? #:allow-other-keys)
>> +              (when tests?
>> +                (with-directory-excursion "../source"
>> +                  (setenv "PYTHONPATH" "../build")
>> +                  (invoke "python3" "-m" "unittest" "discover" "-v"
>> +                          "-s" "tests"))))))))
>> +    (home-page "https://gemmi.readthedocs.io/en/latest/")
>> +    (synopsis "Macromolecular crystallography library and
>> utilities")
>> +    (description "GEMMI is a C++ library for macromolecular
>> crystallography.
>> +It can be used for working with
>> +@enumerate
>> +@item macromolecular models (content of PDB, PDBx/mmCIF and mmJSON
>> files),
>> +@item refinement restraints (CIF files),
>> +@item reflection data (MTZ and mmCIF formats),
>> +@item data on a 3D grid (electron density maps, masks, MRC/CCP4
>> format)
>> +@item crystallographic symmetry.
>> +@end enumerate")
>> +    (license license:mpl2.0)))
>> diff --git a/gnu/packages/patches/gemmi-fix-sajson-types.patch
>> b/gnu/packages/patches/gemmi-fix-sajson-types.patch
>> new file mode 100644
>> index 0000000000..9633ddac8b
>> --- /dev/null
>> +++ b/gnu/packages/patches/gemmi-fix-sajson-types.patch
>> @@ -0,0 +1,11 @@
>> +diff -ur a/include/gemmi/json.hpp b/include/gemmi/json.hpp
>> +--- a/include/gemmi/json.hpp
>> ++++ b/include/gemmi/json.hpp
>> +@@ -38,6 +38,7 @@
>> + 
>> + inline std::string as_cif_value(const sajson::value& val) {
>> +   switch (val.get_type()) {
>> ++    case sajson::TYPE_INTEGER:
>> +     case sajson::TYPE_DOUBLE:
>> +       return val.as_string();
>> +     case sajson::TYPE_NULL:
>> diff --git a/gnu/packages/patches/sajson-for-gemmi-build-with-
>> gcc10.patch b/gnu/packages/patches/sajson-for-gemmi-build-with-
>> gcc10.patch
>> new file mode 100644
>> index 0000000000..878706dc79
>> --- /dev/null
>> +++ b/gnu/packages/patches/sajson-for-gemmi-build-with-gcc10.patch
>> @@ -0,0 +1,45 @@
>> +This patch is from the upstream pull request
>> +https://github.com/chadaustin/sajson/pull/54.
>> +It fixes linking with GCC.
>> +
>> +diff --git a/include/sajson.h b/include/sajson.h
>> +index 8b4e05a..1bd045b 100644
>> +--- a/include/sajson.h
>> ++++ b/include/sajson.h
>> +@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t,
>> size_t value) {
>> + // header. This trick courtesy of Rich Geldreich's Purple JSON
>> parser.
>> + template <typename unused = void>
>> + struct globals_struct {
>> ++    static const unsigned char parse_flags[256];
>> ++};
>> ++typedef globals_struct<> globals;
>> ++
>> + // clang-format off
>> + 
>> +     // bit 0 (1) - set if: plain ASCII string character
>> +     // bit 1 (2) - set if: whitespace
>> +     // bit 4 (0x10) - set if: 0-9 e E .
>> +-    constexpr static const uint8_t parse_flags[256] = {
>> ++    template <typename unused>
>> ++    const unsigned char globals_struct<unused>::parse_flags[256] =
>> {
>> +      // 0    1    2    3    4    5    6    7      8    9    A   
>> B    C    D    E    F
>> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,   2,  
>> 0,   0,   2,   0,   0, // 0
>> +         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,   0,  
>> 0,   0,   0,   0,   0, // 1
>> +@@ -162,15 +167,13 @@ struct globals_struct {
>> +     };
>> + 
>> + // clang-format on
>> +-};
>> +-typedef globals_struct<> globals;
>> + 
>> +-constexpr inline bool is_plain_string_character(char c) {
>> ++inline bool is_plain_string_character(char c) {
>> +     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
>> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
>> 1) != 0;
>> + }
>> + 
>> +-constexpr inline bool is_whitespace(char c) {
>> ++inline bool is_whitespace(char c) {
>> +     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
>> +     return (globals::parse_flags[static_cast<unsigned char>(c)] &
>> 2) != 0;
>> + }
>> diff --git a/gnu/packages/patches/sajson-for-gemmi-numbers-as-
>> strings.patch b/gnu/packages/patches/sajson-for-gemmi-numbers-as-
>> strings.patch
>> new file mode 100644
>> index 0000000000..6f476b8583
>> --- /dev/null
>> +++ b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
>> @@ -0,0 +1,195 @@
>> +Patch for gemmi: Keep numbers in JSON file as strings.
>> +
>> +Adapted from this commit of the bundled fork of sajson in gemmi:
>> +
>> https://github.com/project-gemmi/gemmi/commit/fccbca4f6040364ba708613e
>> 1429c2251872240d
>> +
>> +diff -ur a/include/sajson.h b/include/sajson.h
>> +--- a/include/sajson.h
>> ++++ b/include/sajson.h
>> +@@ -411,43 +411,6 @@
>> + };
>> + } // namespace internal
>> + 
>> +-namespace integer_storage {
>> +-enum { word_length = 1 };
>> +-
>> +-inline int load(const size_t* location) {
>> +-    int value;
>> +-    memcpy(&value, location, sizeof(value));
>> +-    return value;
>> +-}
>> +-
>> +-inline void store(size_t* location, int value) {
>> +-    // NOTE: Most modern compilers optimize away this constant-size
>> +-    // memcpy into a single instruction. If any don't, and treat
>> +-    // punning through a union as legal, they can be special-cased.
>> +-    static_assert(
>> +-        sizeof(value) <= sizeof(*location),
>> +-        "size_t must not be smaller than int");
>> +-    memcpy(location, &value, sizeof(value));
>> +-}
>> +-} // namespace integer_storage
>> +-
>> +-namespace double_storage {
>> +-enum { word_length = sizeof(double) / sizeof(size_t) };
>> +-
>> +-inline double load(const size_t* location) {
>> +-    double value;
>> +-    memcpy(&value, location, sizeof(double));
>> +-    return value;
>> +-}
>> +-
>> +-inline void store(size_t* location, double value) {
>> +-    // NOTE: Most modern compilers optimize away this constant-size
>> +-    // memcpy into a single instruction. If any don't, and treat
>> +-    // punning through a union as legal, they can be special-cased.
>> +-    memcpy(location, &value, sizeof(double));
>> +-}
>> +-} // namespace double_storage
>> +-
>> + /// Represents a JSON value.  First, call get_type() to check its
>> type,
>> + /// which determines which methods are available.
>> + ///
>> +@@ -585,70 +548,10 @@
>> +         return length;
>> +     }
>> + 
>> +-    /// If a numeric value was parsed as a 32-bit integer, returns
>> it.
>> +-    /// Only legal if get_type() is TYPE_INTEGER.
>> +-    int get_integer_value() const {
>> +-        assert_tag(tag::integer);
>> +-        return integer_storage::load(payload);
>> +-    }
>> +-
>> +-    /// If a numeric value was parsed as a double, returns it.
>> +-    /// Only legal if get_type() is TYPE_DOUBLE.
>> +-    double get_double_value() const {
>> +-        assert_tag(tag::double_);
>> +-        return double_storage::load(payload);
>> +-    }
>> +-
>> +-    /// Returns a numeric value as a double-precision float.
>> +-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
>> +-    double get_number_value() const {
>> +-        assert_tag_2(tag::integer, tag::double_);
>> +-        if (value_tag == tag::integer) {
>> +-            return get_integer_value();
>> +-        } else {
>> +-            return get_double_value();
>> +-        }
>> +-    }
>> +-
>> +-    /// Returns true and writes to the output argument if the
>> numeric value
>> +-    /// fits in a 53-bit integer.  This is useful for timestamps
>> and other
>> +-    /// situations where integral values with greater than 32-bit
>> precision
>> +-    /// are used, as 64-bit values are not understood by all JSON
>> +-    /// implementations or languages.
>> +-    /// Returns false if the value is not an integer or not in
>> range.
>> +-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
>> +-    bool get_int53_value(int64_t* out) const {
>> +-        // Make sure the output variable is always defined to avoid
>> any
>> +-        // possible situation like
>> +-        //
>> https://gist.github.com/chadaustin/2c249cb850619ddec05b23ca42cf7a18
>> +-        *out = 0;
>> +-
>> +-        assert_tag_2(tag::integer, tag::double_);
>> +-        switch (value_tag) {
>> +-        case tag::integer:
>> +-            *out = get_integer_value();
>> +-            return true;
>> +-        case tag::double_: {
>> +-            double v = get_double_value();
>> +-            if (v < -(1LL << 53) || v > (1LL << 53)) {
>> +-                return false;
>> +-            }
>> +-            int64_t as_int = static_cast<int64_t>(v);
>> +-            if (as_int != v) {
>> +-                return false;
>> +-            }
>> +-            *out = as_int;
>> +-            return true;
>> +-        }
>> +-        default:
>> +-            return false;
>> +-        }
>> +-    }
>> +-
>> +     /// Returns the length of the string.
>> +     /// Only legal if get_type() is TYPE_STRING.
>> +     size_t get_string_length() const {
>> +-        assert_tag(tag::string);
>> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
>> +         return payload[1] - payload[0];
>> +     }
>> + 
>> +@@ -659,7 +562,7 @@
>> +     /// embedded NULs.
>> +     /// Only legal if get_type() is TYPE_STRING.
>> +     const char* as_cstring() const {
>> +-        assert_tag(tag::string);
>> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
>> +         return text + payload[0];
>> +     }
>> + 
>> +@@ -667,7 +570,7 @@
>> +     /// Returns a string's value as a std::string.
>> +     /// Only legal if get_type() is TYPE_STRING.
>> +     std::string as_string() const {
>> +-        assert_tag(tag::string);
>> ++        assert_tag_3(tag::string, tag::integer, tag::double_);
>> +         return std::string(text + payload[0], text + payload[1]);
>> +     }
>> + #endif
>> +@@ -690,6 +593,10 @@
>> +         assert(e1 == value_tag || e2 == value_tag);
>> +     }
>> + 
>> ++    void assert_tag_3(tag e1, tag e2, tag e3) const {
>> ++        assert(e1 == value_tag || e2 == value_tag || e3 ==
>> value_tag);
>> ++    }
>> ++
>> +     void assert_in_bounds(size_t i) const { assert(i <
>> get_length()); }
>> + 
>> +     const tag value_tag;
>> +@@ -2059,6 +1966,8 @@
>> +     std::pair<char*, internal::tag> parse_number(char* p) {
>> +         using internal::tag;
>> + 
>> ++      size_t start = p - input.get_data();
>> ++
>> +         // Assume 32-bit, two's complement integers.
>> +         static constexpr unsigned RISKY = INT_MAX / 10u;
>> +         unsigned max_digit_after_risky = INT_MAX % 10u;
>> +@@ -2235,23 +2144,18 @@
>> +                 u = 0u - u;
>> +             }
>> +         }
>> ++
>> ++        bool success;
>> ++        size_t* out = allocator.reserve(2, &success);
>> ++        if (SAJSON_UNLIKELY(!success)) {
>> ++            return std::make_pair(oom(p, "number"), tag::null);
>> ++        }
>> ++        out[0] = start;
>> ++        out[1] = p - input.get_data();
>> ++
>> +         if (try_double) {
>> +-            bool success;
>> +-            size_t* out
>> +-                = allocator.reserve(double_storage::word_length,
>> &success);
>> +-            if (SAJSON_UNLIKELY(!success)) {
>> +-                return std::make_pair(oom(p, "double"), tag::null);
>> +-            }
>> +-            double_storage::store(out, d);
>> +             return std::make_pair(p, tag::double_);
>> +         } else {
>> +-            bool success;
>> +-            size_t* out
>> +-                = allocator.reserve(integer_storage::word_length,
>> &success);
>> +-            if (SAJSON_UNLIKELY(!success)) {
>> +-                return std::make_pair(oom(p, "integer"),
>> tag::null);
>> +-            }
>> +-            integer_storage::store(out, static_cast<int>(u));
>> +             return std::make_pair(p, tag::integer);
>> +         }
>> +     }




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 09/13] gnu: Add coordgenlibs.
  2022-10-09 11:56   ` Liliana Marie Prikler
@ 2022-10-13 21:00     ` David Elsing
  0 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:00 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
>> * gnu/packages/chemistry.scm (coordgenlibs): New variable.
>> ---
>>  gnu/packages/chemistry.scm | 27 +++++++++++++++++++++++++++
>>  1 file changed, 27 insertions(+)
>> 
>> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
>> index 6eb1e4a694..1510cbab41 100644
>> --- a/gnu/packages/chemistry.scm
>> +++ b/gnu/packages/chemistry.scm
>> @@ -791,3 +791,30 @@ (define-public maeparser
>>      (synopsis "Maestro file parser")
>>      (description "maeparser is a parser for Schrodinger Maestro
>> files.")
>>      (license license:expat)))
>> +
>> +(define-public coordgenlibs
>> +  (package
>> +    (name "coordgenlibs")
>> +    (version "3.0.1")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url
>> "https://github.com/schrodinger/coordgenlibs/")
>> +                    (commit (string-append "v" version))))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "0d09x3v38i9y184bml020bq7xizdrdwng38qmdxlplzfhqkjdidv"))))
>> +    (build-system cmake-build-system)
>> +    (native-inputs (list boost))
>> +    (inputs (list maeparser))
>> +    (arguments
>> +     (list
>> +      #:configure-flags
>> +      #~(list "-DCOORDGEN_RIGOROUS_BUILD=OFF"
>> +              "-DCOORDGEN_USE_MAEPARSER=ON")))
>> +    (home-page "https://github.com/schrodinger/coordgenlibs/")
>> +    (synopsis "2D coordinate generation")
>> +    (description "@code{coordgenlibs} contains algorithms to
>> generate 2D
>> +coordinates.  It has an emphasis on quality rather than speed.")
> It emphasises quality over speed.  That being said, is it that hard to
> generate points?  What's the full context here?
Ah, it's 2D coordinates for molecules. :)
>> +    (license license:bsd-3)))

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 10/13] gnu: Add yaehmop-tightbind.
  2022-10-09 12:02   ` Liliana Marie Prikler
@ 2022-10-13 21:00     ` David Elsing
  2022-10-14 21:33       ` Liliana Marie Prikler
  0 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:00 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
>> * gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
> Don't forget to update the ChangeLog.
Ah thanks. :)
>> ---
>>  gnu/packages/chemistry.scm | 110
>> +++++++++++++++++++++++++++++++++++++
>>  1 file changed, 110 insertions(+)
>> 
>> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
>> index 1510cbab41..68d28a52c3 100644
>> --- a/gnu/packages/chemistry.scm
>> +++ b/gnu/packages/chemistry.scm
>> @@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages documentation)
>>    #:use-module (gnu packages flex)
>>    #:use-module (gnu packages fontutils)
>> +  #:use-module (gnu packages gcc)
>>    #:use-module (gnu packages gl)
>>    #:use-module (gnu packages graphviz)
>>    #:use-module (gnu packages gv)
>> @@ -56,6 +57,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages serialization)
>>    #:use-module (gnu packages sphinx)
>>    #:use-module (gnu packages stb)
>> +  #:use-module (gnu packages tex)
>>    #:use-module (gnu packages web)
>>    #:use-module (gnu packages xml)
>>    #:use-module (guix build-system cmake)
>> @@ -818,3 +820,111 @@ (define-public coordgenlibs
>>      (description "@code{coordgenlibs} contains algorithms to
>> generate 2D
>>  coordinates.  It has an emphasis on quality rather than speed.")
>>      (license license:bsd-3)))
>> +
>> +(define-public yaehmop
>> +  (package
>> +    (name "yaehmop")
>> +    (version "2022.09.1")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/greglandrum/yaehmop")
>> +                    (commit (string-append "v" version))))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
>> +              (modules '((guix build utils)))
>> +              (snippet
>> +               '(begin
>> +                  ;; Separate program
>> +                  (delete-file-recursively "viewkel")
>> +                  ;; Remove example output (some are corrupted)
>> +                  (for-each delete-file (find-files "examples"
>> "\\.Z$"))
>> +                  ;; Documentation outputs
>> +                  (for-each delete-file (find-files "docs"
>> "\\.(ps|pdf)$"))
>> +                  ;; These are transpiled from Fortran to C, but we
>> build the
>> +                  ;; Fortran code instead
>> +                  (delete-file-recursively "tightbind/f2c_files")
>> +                  (delete-file "tightbind/diag.c")
>> +                  (delete-file "tightbind/cboris.c")
>> +                  (delete-file "tightbind/abfns.c")
>> +                  (delete-file "tightbind/lovlap.c")))))
>> +    (build-system cmake-build-system)
>> +    (arguments
>> +     (list
>> +      #:configure-flags
>> +      #~(list
>> +         "-DUSE_BLAS_LAPACK=ON"
>> +         (string-append "-DPARM_FILE_LOC=" #$output
>> +                        "/share/" #$name "-" #$version
>> "/eht_parms.dat")
>> +         "-DBIND_EXE_NAME=yaehmop-bind")
>> +      #:phases
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'unpack 'chdir
>> +            (lambda _
>> +              (chdir "tightbind")))
>> +          (add-after 'chdir 'patch-fortran-functions
>> +            (lambda _
>> +              (substitute* '("mov.c" "prototypes.h")
>> +                (("lovlap\\(") "lovlap_(")
>> +                (("abfns\\(") "abfns_("))))
>> +          (add-after 'chdir 'patch-cmake
>> +            (lambda _
>> +              (substitute* "CMakeLists.txt"
>> +                (("project\\(yaehmop C\\)") "project(yaehmop C
>> Fortran)")
>> +                (("abfns.c") "fortran77/abfns.f")
>> +                (("lovlap.c") "fortran77/lovlap.f")
>> +                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
>> +                 (string-append init " CACHE STRING \"\")"))
>> +                (("add_library\\(yaehmop_eht" lib)
>> +                 (string-append lib " SHARED "))
>> +                (("target_link_libraries\\(test_eht
>> \\$\\{LAPACK_LIBRARIES\\}.*"
>> +                  all)
>> +                 (string-append all
>> "\ntarget_link_libraries(yaehmop_eht "
>> +                                "${LAPACK_LIBRARIES})\n")))))
>> +          (add-after 'build 'fix-latex
>> +            (lambda _
>> +              (chdir "../docs")
>> +              (substitute* "bind_manual.tex"
>> +                (("\\\\usepackage\\{bindpage\\}")
>> +                 (string-append
>> +                 
>> "\\usepackage[left=2cm,right=2cm,top=4cm,bottom=2cm]"
>> +                  "{geometry}")))
>> +              (substitute* "Zmat_appendix.tex"
>> +                (("file=dihedral\\.eps")
>> +                 "file=figs/dihedral.eps"))))
>> +          (add-after 'fix-latex 'build-doc
>> +            (lambda _
>> +              ;; TODO: not reproducible
>> +              (setenv "FORCE_SOURCE_DATE" "1")
>> +              ;; Needs to run twice to compile completely
>> +              (invoke "pdflatex" "bind_manual.tex")
>> +              (invoke "pdflatex" "bind_manual.tex")
>> +              (chdir "../build")))
> Note that we have rubber to automate building PDFs.  Also prefer "with-
> directory-excursion" over chdir where possible.
I used latexmk as it's already included in texlive-bin
(it is also reproducible with \pdfsuppressptexinfo=-1).
>> +          (add-after 'install 'install-eht-parms
>> +            (lambda _
>> +              (install-file "../tightbind/eht_parms.dat"
>> +                            (string-append #$output "/share/"
>> +                                           #$name "-" #$version))))
>> +          (add-after 'install-eht-parms 'install-doc
>> +            (lambda _
>> +              (install-file "../docs/bind_manual.pdf"
>> +                            (string-append #$output "/share/doc/"
>> +                                           #$name "-" #$version))))
>> +          (delete 'check)
>> +          (add-after 'install-doc 'check
>> +            (lambda* (#:key tests? #:allow-other-keys)
>> +              (when tests?
>> +                (invoke "./test_eht")))))))
>> +    (native-inputs
>> +     `(("gfortran" ,gfortran)
>> +       ("texlive" ,(texlive-updmap.cfg (list texlive-fonts-ec
>> +                                             texlive-latex-graphics
>> +                                             texlive-latex-
>> geometry)))))
> I think you can do without labels here (see my comment regarding
> rubber).
>> +    (inputs (list openblas))
>> +    (home-page "https://github.com/greglandrum/yaehmop")
>> +    (synopsis "Yet Another extended Hueckel Molecular Orbital
>> Package")
> You can use this as an @acronym in the description.  For the synopsis,
> I'd use something else, e.g. "Perform Hückel calculations".
>> +    (description "@code{YAeHMOP} contains a program and library for
>> performing
>> +extended Hückel calculations.")
> I recommend adding "and analyzing and visualizing the results." (see
> plug_it.tex)
The visualization program is not built, so maybe without visualizing?
>> +    (license license:bsd-2)))
>
> Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 11/13] gnu: Add avalontoolkit.
  2022-10-09 12:06   ` Liliana Marie Prikler
@ 2022-10-13 21:01     ` David Elsing
  0 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:01 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
>> * gnu/packages/chemistry.scm (avalontoolkit): New variable.
>> ---
>>  gnu/packages/chemistry.scm | 93
>> ++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 93 insertions(+)
>> 
>> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
>> index 68d28a52c3..e52dd2f3b6 100644
>> --- a/gnu/packages/chemistry.scm
>> +++ b/gnu/packages/chemistry.scm
>> @@ -928,3 +928,96 @@ (define-public yaehmop
>>      (description "@code{YAeHMOP} contains a program and library for
>> performing
>>  extended Hückel calculations.")
>>      (license license:bsd-2)))
>> +
>> +(define-public avalontoolkit
>> +  (package
>> +    (name "avalontoolkit")
> I think we could do a hyphen between avalon and toolkit.
>> +    (version "1.2.0")
>> +    (source
>> +     (origin
>> +       (method url-fetch)
>> +       (uri (string-append
>> +             "mirror://sourceforge/avalontoolkit/"
>> +             "AvalonToolkit_" (substring version 0 3)
>> "/AvalonToolkit_"
>> +             version ".source.tar"))
>> +       (sha256
>> +        (base32
>> +         "0rnnyy6axs2da7aa4q6l30ldavbk49v6l22llj1adn74h1i67bpv"))
>> +       (modules '((guix build utils) (ice-9 ftw)))
>> +       (snippet
>> +        #~(begin
>> +            (chdir "..")
>> +            (delete-file-recursively "SourceDistribution/java")))))
>> +    (build-system gnu-build-system)
>> +    (arguments
>> +     (list
>> +      ;; There are no tests
>> +      #:tests? #f
>> +      #:phases
>> +      #~(let ((programs '("canonizer" "matchtest" "smi2mol"
>> "struchk")))
>> +          (modify-phases %standard-phases
>> +            (delete 'configure)
>> +            (add-before 'build 'remove-free
>> +              (lambda _
>> +                ;; Remove incorrect free of getenv result (patch
>> also in rdkit)
>> +                (substitute* "common/reaccsio.c"
>> +                  (("MyFree.*tempdir.*") ""))))
>> +            (replace 'build
>> +              (lambda _
>> +                (chdir "common")
>> +                (let* ((parts
>> +                        (list
>> +                         "aacheck" "casutils" "denormal"
>> "depictutil"
>> +                         "didepict" "fixcharges" "forio" "geometry"
>> "graph"
>> +                         "hashcode" "layout" "local" "patclean"
>> "pattern"
>> +                         "perceive" "reaccsio" "rtutils" "set"
>> "shortcut"
>> +                         "sketch" "ssmatch" "stereo" "symbol_lists"
>> +                         "symboltable" "utilities"))
>> +                       (objects (map (lambda (name) (string-append
>> name ".o"))
>> +                                     parts)))
>> +                  (for-each
>> +                   (lambda (name)
>> +                     (display (string-append "Compiling " name
>> ".c\n"))
>> +                     (invoke "gcc" "-c" "-fPIC" "-O2"
>> +                             (string-append name ".c")
>> +                             "-o" (string-append name ".o")))
>> +                   parts)
>> +                  (display "Building shared library\n")
>> +                  (apply invoke "gcc" "-fPIC" "-shared" "-lm"
>> +                         "-o" "libavalontoolkit.so"
>> +                         "canonizer.c" "smi2mol.c" "struchk.c"
>> objects)
>> +                  (for-each
>> +                   (lambda (program)
>> +                     (display (string-append "Building " program
>> "\n"))
>> +                     (invoke "gcc" "-L." "-lavalontoolkit" "-lm" "-
>> O2"
>> +                             (string-append "-Wl,-rpath=" #$output
>> "/lib")
>> +                             "-DMAIN" (string-append program ".c")
>> "-o" program))
>> +                   programs))))
> Uhm... is the Makefile that unusable?
Pretty much: Not all programs are built, the compiler and linker options
need to be adjusted in several places and the shared library is missing
some object files. :)
>> +            (replace 'install
>> +              (lambda _
>> +                ;; Executables
>> +                (for-each
>> +                 (lambda (program)
>> +                   (install-file program (string-append #$output
>> "/bin")))
>> +                 programs)
>> +                (for-each
>> +                 (lambda (name)
>> +                   (symlink (string-append #$output "/bin/smi2mol")
>> +                            (string-append #$output "/bin/" name)))
>> +                 '("mol2smi" "rdf2smi" "mol2tbl" "mol2sma"
>> "smi2rdf"))
>> +                ;; Library
>> +                (install-file "libavalontoolkit.so" (string-append
>> #$output "/lib"))
>> +                (for-each
>> +                 (lambda (file)
>> +                   (install-file file (string-append #$output
>> +                                                   
>> "/include/avalontoolkit")))
>> +                 (find-files "." "\\.h$"))
>> +                (install-file "../license.txt"
>> +                              (string-append #$output "/share/doc/"
>> +                                             #$name "-" #$version
>> "/"))))))))
> Same as above.
There is no install target.
>> +    (home-page "https://sourceforge.net/projects/avalontoolkit/")
>> +    (synopsis "Tools for SMILES and MOL files and for structure
>> fingerprinting")
>> +    (description "This package contains a library and programs for
>> +canonicalization of SMILES and MOL files, molecular structure
>> fingerprinting
>> +and rendering molecules.")
>> +    (license license:bsd-3)))

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 13/13] gnu: Add rdkit.
  2022-10-09 12:12   ` Liliana Marie Prikler
@ 2022-10-13 21:01     ` David Elsing
  0 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:01 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Freitag, dem 07.10.2022 um 15:22 +0000 schrieb David Elsing:
>> * gnu/packages/chemistry.scm (rdkit): New variable.
>> ---
>>  gnu/packages/chemistry.scm                    | 178
>> ++++++++++++++++++
>>  .../rdkit-cmake-external-dependencies.patch   | 102 ++++++++++
>>  2 files changed, 280 insertions(+)
>>  create mode 100644 gnu/packages/patches/rdkit-cmake-external-
>> dependencies.patch
>> 
>> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
>> index 43953238cd..4b34a38797 100644
>> --- a/gnu/packages/chemistry.scm
>> +++ b/gnu/packages/chemistry.scm
>> @@ -34,6 +34,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages algebra)
>>    #:use-module (gnu packages autotools)
>>    #:use-module (gnu packages backup)
>> +  #:use-module (gnu packages base)
>>    #:use-module (gnu packages bison)
>>    #:use-module (gnu packages boost)
>>    #:use-module (gnu packages check)
>> @@ -41,10 +42,12 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages cpp)
>>    #:use-module (gnu packages documentation)
>>    #:use-module (gnu packages flex)
>> +  #:use-module (gnu packages fonts)
>>    #:use-module (gnu packages fontutils)
>>    #:use-module (gnu packages gcc)
>>    #:use-module (gnu packages gl)
>>    #:use-module (gnu packages graphviz)
>> +  #:use-module (gnu packages gtk)
>>    #:use-module (gnu packages gv)
>>    #:use-module (gnu packages image)
>>    #:use-module (gnu packages maths)
>> @@ -56,6 +59,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages qt)
>>    #:use-module (gnu packages serialization)
>>    #:use-module (gnu packages sphinx)
>> +  #:use-module (gnu packages sqlite)
>>    #:use-module (gnu packages stb)
>>    #:use-module (gnu packages tex)
>>    #:use-module (gnu packages web)
>> @@ -1101,3 +1105,177 @@ (define-public ringdecomposerlib
>>  unique ring families, relevant cycles, the smallest set of smallest
>> rings and
>>  other ring topology descriptions.")
>>      (license license:bsd-3)))
>> +
>> +(define-public rdkit
>> +  (package
>> +    (name "rdkit")
>> +    (version "2022.03.5")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/rdkit/rdkit")
>> +                    (commit
>> +                     (string-append
>> +                      "Release_" (string-replace-substring version
>> "." "_")))))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "19idgilabh04cbr1qj6zgrgsfjm248mmfz6fsr0smrd68d0xnml9"))
>> +              (patches
>> +               (search-patches "rdkit-cmake-external-
>> dependencies.patch"))
>> +              (modules '((guix build utils)))
>> +              (snippet
>> +               #~(begin
>> +                   ;; Remove pickle files (only used in tests),
>> +                   ;; as they are compiled programs
>> +                   (for-each
>> +                    (lambda (name)
>> +                      (display (string-append name "\n"))
>> +                      (delete-file name))
>> +                    (find-files "." "\\.pkl(\\.gz)?$"))
>> +                   ;; Remove SQLite data files (can be generated)
>> +                   (delete-file "Data/RDData.sqlt")
>> +                   (delete-file "Data/RDTests.sqlt")))))
>> +    (build-system cmake-build-system)
>> +    (arguments
>> +     (list
>> +      #: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)))
>> +      #:configure-flags
>> +      #~(list
>> +         "-DRDK_BUILD_AVALON_SUPPORT=ON"
>> +         "-DRDK_BUILD_CAIRO_SUPPORT=ON"
>> +         "-DRDK_BUILD_CPP_TESTS=ON"
>> +         "-DRDK_BUILD_FREESASA_SUPPORT=ON"
>> +         "-DRDK_BUILD_INCHI_SUPPORT=ON"
>> +         "-DRDK_BUILD_YAEHMOP_SUPPORT=ON"
> Are any of these implied or do they have to be explicitly enabled?
Oops, I overlooked some, now only flags changing the default are specified.
>> +         (string-append "-DCATCH_DIR="
>> +                        #$(this-package-native-input "catch2")
>> +                        "/include/catch2")
>> +         "-DRDK_INSTALL_DEV_COMPONENT=ON"
>> +         "-DRDK_INSTALL_INTREE=OFF"
>> +         "-DRDK_INSTALL_STATIC_LIBS=OFF"
>> +         (string-append
>> +          "-DRDK_OPTIMIZE_POPCNT="
>> +          #$(let ((system (or (%current-target-system)
>> +                              (%current-system))))
>> +              (cond
>> +               ((string-prefix? "x86_64" system) "ON")
>> +               ((string-prefix? "i686" system) "ON")
>> +               (else "OFF"))))
>> +         "-DRDK_USE_BOOST_IOSTREAMS=ON"
>> +         "-DRDK_USE_FLEXBISON=ON")
>> +      #:phases
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'unpack 'copy-external-dependencies
>> +            (lambda _
>> +              (symlink
>> +               (string-append
>> +                #$(this-package-input "font-comic-neue")
>> +                "/share/fonts/truetype/ComicNeue-Regular.ttf")
>> +               "Data/Fonts/ComicNeue-Regular.ttf")))
> Try (search-input-file) instead.
>> +          (add-after 'copy-external-dependencies 'patch-source
>> +            (lambda _
>> +              (substitute* "External/AvalonTools/CMakeLists.txt"
>> +                (("^if\\(NOT RDK_BUILD" orig)
>> +                 (string-append "if(0)\n" orig))
>> +                (("include_directories.*AVALON_SRC_PATH.*")
>> +                 (string-append "endif()\ninclude_directories("
>> +                                #$avalontoolkit
>> "/include/avalontoolkit)\n"))
>> +                (("LINK_LIBRARIES avalon_clib")
>> +                 (string-append
>> +                  "LINK_LIBRARIES -L" #$avalontoolkit "/lib -
>> lavalontoolkit")))
>> +              (let ((port
>> +                     (open-file "External/RingFamilies/dummy.cpp"
>> "w")))
>> +                (display "" port)
>> +                (close port))
>> +              (let ((port
>> +                     (open-file
>> "External/RingFamilies/CMakeLists.txt" "w")))
>> +                (display (string-append
>> +                          "rdkit_library(RingDecomposerLib dummy.cpp
>> SHARED"
>> +                          " LINK_LIBRARIES -lRingDecomposerLib)\n"
>> +                          "set(RDK_URF_LIBS RingDecomposerLib CACHE
>> STRING \"\" FORCE)\n")
>> +                         port)
>> +                (close port))
>> +              (substitute*
>> "Code/GraphMol/MolInterchange/CMakeLists.txt"
>> +                (("if\\(NOT" orig)
>> +                 (string-append "if(0)\n" orig))
>> +                (("^include_directories.*") "endif()\n"))
>> +              (substitute* "External/YAeHMOP/EHTTools.cpp"
>> +                (("<yaehmop/tightbind/bind.h>")
>> "<yaehmop/bind.h>"))))
> I think you might want to unbundle these with a patch.
Is the patch ok?
>> +          (add-after 'unpack 'fix-inchi-include
>> +            (lambda _
>> +              (substitute* "Code/cmake/Modules/FindInchi.cmake"
>> +                (("inchi_api.h.*\\)") "inchi/inchi_api.h)")
>> +                (("INCHI_LIBRARY NAMES.*\\)")
>> +                 "INCHI_LIBRARY NAMES inchi PATH_SUFFIXES inchi)")
>> +                (("find_library" prev)
>> +                 (string-append
>> +                  "list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.1)\n"
>> +                  prev)))
>> +              (substitute* "External/INCHI-API/inchi.cpp"
>> +                (("<inchi_api.h>") "<inchi/inchi_api.h>"))))
>> +          (add-before 'build 'enable-bytecode-determinism
>> +              (lambda _
>> +                (setenv "PYTHONHASHSEED" "0")
>> +                (setenv "PYTHONDONTWRITEBYTECODE" "1")))
>> +          (add-after 'install 'pre-check
>> +            (lambda* (#:key inputs outputs #:allow-other-keys)
>> +              (with-directory-excursion "../source"
>> +                (invoke "sqlite3" "Data/RDData.sqlt"
>> +                        ".read rdkit/Dbase/test_data/RDData.sqlite")
>> +                (invoke "sqlite3" "Data/RDTests.sqlt"
>> +                        ".read
>> rdkit/Dbase/test_data/RDTests.sqlite")
>> +                (setenv "RDBASE" (canonicalize-path ".")))
>> +              (add-installed-pythonpath inputs outputs)))
>> +          (delete 'check)
>> +          (add-after 'pre-check 'check
>> +            (lambda* (#:key tests? parallel-tests? #:allow-other-
>> keys)
>> +              (when tests?
>> +                (let ((job-count (number->string
>> +                                  (if parallel-tests? (parallel-job-
>> count) 1))))
>> +                  (invoke
>> +                   "ctest" "-j" job-count
>> +                   "-E" (string-append
>> +                         "(" (string-join
>> +                              '(;; need pickled data
>> +                                "(pyDiscreteValueVect"
>> "pySparseIntVect"
>> +                                "graphmoltestPickler"
>> "pyPartialCharges"
>> +                                "substructLibraryTest" "pyFeatures"
>> +                                "pythonTestDirML"
>> "pythonTestDirChem"
>> +                                ;; Catching Python exception fails
>> +                                "pyRanker)") "|") ")")))))))))
> I think you have two layers of brackets now – delete the inner ones.
Oh thanks!
>> +    (native-inputs
>> +     (list bison
>> +           boost
>> +           catch2
>> +           eigen
>> +           flex
>> +           freesasa
>> +           pkg-config
>> +           rapidjson
>> +           tar))
>> +    (inputs
>> +     (list avalontoolkit
>> +           cairo
>> +           coordgenlibs
>> +           font-comic-neue
>> +           freetype
>> +           inchi
>> +           maeparser
>> +           python
>> +           ringdecomposerlib
>> +           sqlite
>> +           yaehmop))
>> +    (propagated-inputs
>> +     (list python-numpy python-cairocffi python-pillow))
>> +    (home-page "https://rdkit.org/")
>> +    (synopsis "Collection of cheminformatics software")
>> +    (description "RDKit is a C++ and Python library for
>> cheminformatics, which
>> +includes (among other things) the analysis and modification of
>> molecules in 2D
>> +and 3D and descriptor generation for machine learning.")
>> +    (license license:bsd-3)))
>> diff --git a/gnu/packages/patches/rdkit-cmake-external-
>> dependencies.patch b/gnu/packages/patches/rdkit-cmake-external-
>> dependencies.patch
>> new file mode 100644
>> index 0000000000..5b73864f51
>> --- /dev/null
>> +++ b/gnu/packages/patches/rdkit-cmake-external-dependencies.patch
>> @@ -0,0 +1,102 @@
>> +diff -ur a/External/FreeSASA/CMakeLists.txt
>> b/External/FreeSASA/CMakeLists.txt
>> +--- a/External/FreeSASA/CMakeLists.txt
>> ++++ b/External/FreeSASA/CMakeLists.txt
>> +@@ -10,7 +10,7 @@
>> +   endif()
>> + endif()
>> + 
>> +-if(needDownload)
>> ++if(FALSE)
>> +   # don't actually use the md5 here
>> +   set(FREESASA_VERSION "2.0.3")
>> +   set(FREESASA_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/freesasa-
>> ${FREESASA_VERSION}")
>> +@@ -66,24 +66,24 @@
>> + endif()
>> + 
>> + set (freesasa_h ${FREESASA_SRC_DIR}/src/freesasa.h)
>> +-file(READ ${freesasa_h} freesasa_h_data)
>> ++#file(READ ${freesasa_h} freesasa_h_data)
>> + string(REGEX REPLACE "(#include <stdio.h>)" "\\1\n#include
>> <RDGeneral/export.h>" freesasa_h_data "${freesasa_h_data}")
>> + string(REGEX REPLACE
>> "([^R][^D][^K][^I][^T][^_][^F][^R][^E][^E][^S][^A][^S][^A][^_][^C][^L
>> ][^I][^B][^_][^E][^X][^P][^O][^R][^T][^ ])(extern const)"
>> "\\1RDKIT_FREESASA_CLIB_EXPORT \\2" freesasa_h_data
>> "${freesasa_h_data}")
>> +-file(WRITE ${freesasa_h} "${freesasa_h_data}")
>> ++#file(WRITE ${freesasa_h} "${freesasa_h_data}")
>> + 
>> + add_definitions(-DUSE_THREADS=0)
>> + add_definitions(-DUSE_JSON=0)
>> + add_definitions(-DUSE_XML=0)
>> +-rdkit_library(freesasa_clib ${freesasa_clib_srcs})
>> +-target_compile_definitions(freesasa_clib PRIVATE
>> RDKIT_FREESASALIB_BUILD)
>> ++#rdkit_library(freesasa_clib ${freesasa_clib_srcs})
>> ++#target_compile_definitions(freesasa_clib PRIVATE
>> RDKIT_FREESASALIB_BUILD)
>> + 
>> + if((MSVC AND RDK_INSTALL_DLLS_MSVC) OR ((NOT MSVC) AND WIN32))
>> +   set_target_properties(freesasa_clib PROPERTIES
>> WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
>> + endif()
>> +-include_directories("${FREESASA_SRC_DIR}/src")
>> ++#include_directories("${FREESASA_SRC_DIR}/src")
>> + 
>> + rdkit_library(FreeSASALib RDFreeSASA.cpp SHARED 
>> +-    LINK_LIBRARIES freesasa_clib GraphMol )
>> ++    LINK_LIBRARIES -lfreesasa GraphMol )
>> + target_compile_definitions(FreeSASALib PRIVATE
>> RDKIT_FREESASALIB_BUILD)
>> + 
>> + rdkit_headers(RDFreeSASA.h DEST GraphMol)
>> +diff -ur a/External/YAeHMOP/CMakeLists.txt
>> b/External/YAeHMOP/CMakeLists.txt
>> +--- a/External/YAeHMOP/CMakeLists.txt
>> ++++ b/External/YAeHMOP/CMakeLists.txt
>> +@@ -18,32 +18,32 @@
>> + 
>> + include_directories( ${RDKit_ExternalDir}/YAeHMOP )
>> + 
>> +-ExternalProject_Add(yaehmop_project
>> +-  GIT_REPOSITORY https://github.com/greglandrum/yaehmop.git
>> +-  GIT_TAG master
>> +-  UPDATE_COMMAND ""
>> +-  PATCH_COMMAND ""
>> +-  PREFIX ${CMAKE_CURRENT_SOURCE_DIR}
>> +-  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop"
>> +-  SOURCE_SUBDIR "tightbind"
>> +-  CMAKE_ARGS -DUSE_BLAS_LAPACK=OFF -
>> DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} -
>> DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -
>> DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
>> +-  TEST_COMMAND "")
>> +-
>> +-include_directories(${PROJECT_BINARY_DIR}/include)
>> +-link_directories(${PROJECT_BINARY_DIR}/lib)
>> +-link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-
>> build)
>> +-
>> +-set(EHT_PARAM_FILE
>> ${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind/eht_parms.dat )
>> +-install(FILES ${EHT_PARAM_FILE}
>> +-        DESTINATION ${RDKit_ShareDir}/Data
>> +-        COMPONENT data)
>> ++#ExternalProject_Add(yaehmop_project
>> ++#  GIT_REPOSITORY https://github.com/greglandrum/yaehmop.git
>> ++#  GIT_TAG master
>> ++#  UPDATE_COMMAND ""
>> ++#  PATCH_COMMAND ""
>> ++#  PREFIX ${CMAKE_CURRENT_SOURCE_DIR}
>> ++#  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop"
>> ++#  SOURCE_SUBDIR "tightbind"
>> ++#  CMAKE_ARGS -DUSE_BLAS_LAPACK=OFF -
>> DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} -
>> DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -
>> DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
>> ++#  TEST_COMMAND "")
>> ++
>> ++#include_directories(${PROJECT_BINARY_DIR}/include)
>> ++#link_directories(${PROJECT_BINARY_DIR}/lib)
>> ++#link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-
>> build)
>> ++
>> ++#set(EHT_PARAM_FILE
>> ${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind/eht_parms.dat )
>> ++#install(FILES ${EHT_PARAM_FILE}
>> ++#        DESTINATION ${RDKit_ShareDir}/Data
>> ++#        COMPONENT data)
>> + 
>> +-message("YAeHMOP include_dirs: ${PROJECT_BINARY_DIR}/include")
>> +-message("YAeHMOP link_dirs: ${PROJECT_BINARY_DIR}/lib
>> ${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build")
>> ++#message("YAeHMOP include_dirs: ${PROJECT_BINARY_DIR}/include")
>> ++#message("YAeHMOP link_dirs: ${PROJECT_BINARY_DIR}/lib
>> ${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build")
>> + 
>> +-rdkit_library(EHTLib EHTTools.cpp SHARED LINK_LIBRARIES yaehmop_eht
>> GraphMol )
>> ++rdkit_library(EHTLib EHTTools.cpp SHARED LINK_LIBRARIES -
>> lyaehmop_eht GraphMol )
>> + target_compile_definitions(EHTLib PRIVATE RDKIT_EHTLIB_BUILD)
>> +-add_dependencies(EHTLib yaehmop_project)
>> ++#add_dependencies(EHTLib yaehmop_project)
>> + rdkit_headers(EHTTools.h DEST GraphMol)
>> + rdkit_catch_test(testEHTLib1 test1.cpp
>> +            LINK_LIBRARIES EHTLib FileParsers SmilesParse )
> Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 00/15] Add rdkit v3.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
  2022-10-09 10:02   ` Liliana Marie Prikler
@ 2022-10-13 21:04   ` David Elsing
  2022-10-15 14:37     ` bug#58261: " Liliana Marie Prikler
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 01/15] gnu: Add fast-float David Elsing
                     ` (14 subsequent siblings)
  16 siblings, 1 reply; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

Thanks again for your comments! Here is the next version. :)
Now all packages were reproducible again after two rounds.

David Elsing (15):
  gnu: Add fast-float.
  gnu: Add pocketfft-cpp.
  gnu: Add sajson.
  gnu: Add cbehave.
  gnu: Add tinydir.
  gnu: Add optionparser.
  gnu: Add sajson-for-gemmi.
  gnu: Add gemmi.
  gnu: Add freesasa.
  gnu: Add maeparser.
  gnu: Add coordgenlibs.
  gnu: Add yaehmop.
  gnu: Add avalon-toolkit.
  gnu: Add ringdecomposerlib.
  gnu: Add rdkit.

 gnu/packages/check.scm                        |  56 ++
 gnu/packages/chemistry.scm                    | 686 ++++++++++++++++++
 gnu/packages/cpp.scm                          | 228 ++++++
 .../patches/gemmi-fix-pegtl-usage.patch       |  31 +
 .../patches/gemmi-fix-sajson-types.patch      |  11 +
 .../pocketfft-cpp-default-disable-simd.patch  | 108 +++
 ...rdkit-unbundle-external-dependencies.patch | 384 ++++++++++
 .../patches/sajson-build-with-gcc10.patch     |  45 ++
 .../sajson-for-gemmi-numbers-as-strings.patch | 195 +++++
 .../patches/tinydir-fix-cbehave-test.patch    |  16 +
 10 files changed, 1760 insertions(+)
 create mode 100644 gnu/packages/patches/gemmi-fix-pegtl-usage.patch
 create mode 100644 gnu/packages/patches/gemmi-fix-sajson-types.patch
 create mode 100644 gnu/packages/patches/pocketfft-cpp-default-disable-simd.patch
 create mode 100644 gnu/packages/patches/rdkit-unbundle-external-dependencies.patch
 create mode 100644 gnu/packages/patches/sajson-build-with-gcc10.patch
 create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
 create mode 100644 gnu/packages/patches/tinydir-fix-cbehave-test.patch

-- 
2.37.0





^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 01/15] gnu: Add fast-float.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
  2022-10-09 10:02   ` Liliana Marie Prikler
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 00/15] Add rdkit v3 David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 02/15] gnu: Add pocketfft-cpp David Elsing
                     ` (13 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (fast-float): New variable.
---
 gnu/packages/cpp.scm | 50 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 805413cc61..eba39ed660 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -29,6 +29,7 @@
 ;;; Copyright © 2022 muradm <mail@muradm.net>
 ;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
 ;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1954,3 +1955,52 @@ (define-public crc32c
      "This package provides architecture-specific implementations of the
 CRC32C algorithm, which is specified in RFC 3720, section 12.1.")
     (license license:bsd-3)))
+
+(define-public fast-float
+  (package
+    (name "fast-float")
+    (version "3.5.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/fastfloat/fast_float")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0z3rxxd0pwvw70dbnv63rm67biw829vdqf50y16isxm6g3sbrz8g"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list
+         "-DFASTFLOAT_TEST=ON"
+         "-DSYSTEM_DOCTEST=ON")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-cmake-tests
+            (lambda _
+              (substitute* "tests/CMakeLists.txt"
+                (("FetchContent_GetProperties\\(supplemental_test_files.*")
+                 "")
+                (("if\\(NOT supplemental_test_files_POPULATED.*")
+                 (string-append
+                  "set(supplemental_test_files_BINARY_DIR "
+                  #$(origin
+                      (method git-fetch)
+                      (uri (git-reference
+                            (url (string-append "https://github.com/fastfloat"
+                                                "/supplemental_test_files.git"))
+                            (commit "97a0b2e638feb479387554cf253e346500541e7e")))
+                      (file-name (git-file-name "fast_float_test-data" version))
+                      (sha256
+                       (base32
+                        "0dxbiyzyh7i847i89ablfzypfc3ckhm7f74w98jsh73v1mppmxlf")))
+                  "/data)\nif(0)\n"))))))))
+    (native-inputs (list doctest))
+    (home-page "https://github.com/fastfloat/fast_float")
+    (synopsis "Floating point number parser for C++")
+    (description "@code{fast_float} is a header-only C++ library for parsing
+floating point numbers from strings.  It implements the C++ from_chars
+functions for the float and double types.")
+    (license (list license:asl2.0 license:expat)))) ; dual licensed
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 02/15] gnu: Add pocketfft-cpp.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (2 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 01/15] gnu: Add fast-float David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 03/15] gnu: Add sajson David Elsing
                     ` (12 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (pocketfft-cpp): New variable.
---
 gnu/packages/cpp.scm                          |  29 +++++
 .../pocketfft-cpp-default-disable-simd.patch  | 108 ++++++++++++++++++
 2 files changed, 137 insertions(+)
 create mode 100644 gnu/packages/patches/pocketfft-cpp-default-disable-simd.patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index eba39ed660..2b5841e777 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2004,3 +2004,32 @@ (define-public fast-float
 floating point numbers from strings.  It implements the C++ from_chars
 functions for the float and double types.")
     (license (list license:asl2.0 license:expat)))) ; dual licensed
+
+(define-public pocketfft-cpp
+  (let ((commit "daa8bb18327bc5c7d22c69428c25cf5dc64167d3")
+        (revision "0"))
+    (package
+      (name "pocketfft-cpp")
+      (version (git-version "0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mreineck/pocketfft")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1dbkkqkmkxgmz1qjpsqzic5ig3qw1pqndbb3dvjc7xq5f2rdzyq1"))
+                (patches (search-patches
+                          "pocketfft-cpp-default-disable-simd.patch"))))
+      (build-system copy-build-system)
+      (arguments
+       (list
+        #:install-plan
+        #~'(("pocketfft_hdronly.h" "include/"))))
+      (home-page "https://github.com/mreineck/pocketfft")
+      (synopsis "C++11 header-only Fast Fourier Transform library")
+      (description "This package provides a single-header C++11 library for
+computing Fast Fourier transformations.  It supports multidimensional arrays,
+different floating point sizes and complex transformations.")
+      (license license:bsd-3))))
diff --git a/gnu/packages/patches/pocketfft-cpp-default-disable-simd.patch b/gnu/packages/patches/pocketfft-cpp-default-disable-simd.patch
new file mode 100644
index 0000000000..4d2ddae4b5
--- /dev/null
+++ b/gnu/packages/patches/pocketfft-cpp-default-disable-simd.patch
@@ -0,0 +1,108 @@
+Disable SIMD instructions by default.
+They can be enabled by setting -DPOCKETFFT_NO_VECTORS=0.
+
+diff --git a/pocketfft_hdronly.h b/pocketfft_hdronly.h
+index d75ada6..b2d0a23 100644
+--- a/pocketfft_hdronly.h
++++ b/pocketfft_hdronly.h
+@@ -39,6 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #ifndef POCKETFFT_HDRONLY_H
+ #define POCKETFFT_HDRONLY_H
+ 
++#ifndef POCKETFFT_NO_VECTORS
++#define POCKETFFT_NO_VECTORS 1
++#endif
++
+ #ifndef __cplusplus
+ #error This file is C++ and requires a C++ compiler.
+ #endif
+@@ -106,29 +110,29 @@ constexpr bool FORWARD  = true,
+                BACKWARD = false;
+ 
+ // only enable vector support for gcc>=5.0 and clang>=5.0
+-#ifndef POCKETFFT_NO_VECTORS
+-#define POCKETFFT_NO_VECTORS
++#if !(POCKETFFT_NO_VECTORS)
++#define POCKETFFT_NO_VECTORS 1
+ #if defined(__INTEL_COMPILER)
+ // do nothing. This is necessary because this compiler also sets __GNUC__.
+ #elif defined(__clang__)
+ // AppleClang has their own version numbering
+ #ifdef __apple_build_version__
+ #  if (__clang_major__ > 9) || (__clang_major__ == 9 && __clang_minor__ >= 1)
+-#     undef POCKETFFT_NO_VECTORS
++#define POCKETFFT_NO_VECTORS 0
+ #  endif
+ #elif __clang_major__ >= 5
+-#  undef POCKETFFT_NO_VECTORS
++#define POCKETFFT_NO_VECTORS 0
+ #endif
+ #elif defined(__GNUC__)
+ #if __GNUC__>=5
+-#undef POCKETFFT_NO_VECTORS
++#define POCKETFFT_NO_VECTORS 0
+ #endif
+ #endif
+ #endif
+ 
+ template<typename T> struct VLEN { static constexpr size_t val=1; };
+ 
+-#ifndef POCKETFFT_NO_VECTORS
++#if !(POCKETFFT_NO_VECTORS)
+ #if (defined(__AVX512F__))
+ template<> struct VLEN<float> { static constexpr size_t val=16; };
+ template<> struct VLEN<double> { static constexpr size_t val=8; };
+@@ -145,7 +149,7 @@ template<> struct VLEN<double> { static constexpr size_t val=2; };
+ template<> struct VLEN<float> { static constexpr size_t val=4; };
+ template<> struct VLEN<double> { static constexpr size_t val=2; };
+ #else
+-#define POCKETFFT_NO_VECTORS
++#define POCKETFFT_NO_VECTORS 1
+ #endif
+ #endif
+ 
+@@ -180,7 +184,7 @@ template<typename T> class arr
+     T *p;
+     size_t sz;
+ 
+-#if defined(POCKETFFT_NO_VECTORS)
++#if POCKETFFT_NO_VECTORS
+     static T *ralloc(size_t num)
+       {
+       if (num==0) return nullptr;
+@@ -3026,7 +3030,7 @@ class rev_iter
+ template<typename T> struct VTYPE {};
+ template <typename T> using vtype_t = typename VTYPE<T>::type;
+ 
+-#ifndef POCKETFFT_NO_VECTORS
++#if !(POCKETFFT_NO_VECTORS)
+ template<> struct VTYPE<float>
+   {
+   using type = float __attribute__ ((vector_size (VLEN<float>::val*sizeof(float))));
+@@ -3139,7 +3143,7 @@ POCKETFFT_NOINLINE void general_nd(const cndarr<T> &in, ndarr<T> &out,
+         auto storage = alloc_tmp<T0>(in.shape(), len, sizeof(T));
+         const auto &tin(iax==0? in : out);
+         multi_iter<vlen> it(tin, out, axes[iax]);
+-#ifndef POCKETFFT_NO_VECTORS
++#if !(POCKETFFT_NO_VECTORS)
+         if (vlen>1)
+           while (it.remaining()>=vlen)
+             {
+@@ -3245,7 +3249,7 @@ template<typename T> POCKETFFT_NOINLINE void general_r2c(
+     constexpr auto vlen = VLEN<T>::val;
+     auto storage = alloc_tmp<T>(in.shape(), len, sizeof(T));
+     multi_iter<vlen> it(in, out, axis);
+-#ifndef POCKETFFT_NO_VECTORS
++#if !(POCKETFFT_NO_VECTORS)
+     if (vlen>1)
+       while (it.remaining()>=vlen)
+         {
+@@ -3300,7 +3304,7 @@ template<typename T> POCKETFFT_NOINLINE void general_c2r(
+       constexpr auto vlen = VLEN<T>::val;
+       auto storage = alloc_tmp<T>(out.shape(), len, sizeof(T));
+       multi_iter<vlen> it(in, out, axis);
+-#ifndef POCKETFFT_NO_VECTORS
++#if !(POCKETFFT_NO_VECTORS)
+       if (vlen>1)
+         while (it.remaining()>=vlen)
+           {
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 03/15] gnu: Add sajson.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (3 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 02/15] gnu: Add pocketfft-cpp David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 04/15] gnu: Add cbehave David Elsing
                     ` (11 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (sajson): New variable.
---
 gnu/packages/cpp.scm                          | 60 +++++++++++++++++++
 .../patches/sajson-build-with-gcc10.patch     | 45 ++++++++++++++
 2 files changed, 105 insertions(+)
 create mode 100644 gnu/packages/patches/sajson-build-with-gcc10.patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 2b5841e777..b6a0a70ed7 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -57,6 +57,7 @@ (define-module (gnu packages cpp)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system scons)
   #:use-module (guix modules)
   #:use-module (guix gexp)
   #:use-module (gnu packages)
@@ -2033,3 +2034,62 @@ (define-public pocketfft-cpp
 computing Fast Fourier transformations.  It supports multidimensional arrays,
 different floating point sizes and complex transformations.")
       (license license:bsd-3))))
+
+(define-public sajson
+  (let ((commit "ec644013e34f9984a3cc9ba568cab97a391db9cd")
+        (revision "0"))
+    (package
+      (name "sajson")
+      (version (git-version "1.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/chadaustin/sajson")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (patches
+                 (search-patches "sajson-build-with-gcc10.patch"))
+                (sha256
+                 (base32
+                  "0fjag27w7gvkc5pdhq3ad7yc09rabpzahndw1sgsg04ipznidmmq"))
+                (modules '((guix build utils)))
+                (snippet '(delete-file-recursively "third-party"))))
+      (build-system scons-build-system)
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'disable-other-builds
+              (lambda _
+                (substitute* "SConstruct"
+                  (("for name, tools in builds:")
+                   "for name, tools in [('opt', [gcc, opt])]:"))))
+            (add-after 'unpack 'use-external-unittest-cpp
+              (lambda _
+                (substitute* "SConscript"
+                  (("unittestpp_env\\.Library") "_dummy = ")
+                  (("test_env = env.Clone\\(tools=\\[unittestpp, sajson\\]\\)")
+                   (string-append
+                    "test_env = env.Clone(tools=[sajson])\n"
+                    "test_env.Append(CPPPATH='"
+                    (search-input-directory %build-inputs "/include/UnitTest++")
+                    "', LIBPATH='"
+                    (string-append #$(this-package-native-input "unittest-cpp")
+                                   "/lib")
+                    "', LIBS=['UnitTest++'])")))))
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (invoke "build/opt/test")
+                  (invoke "build/opt/test_unsorted"))))
+            (replace 'install
+              (lambda _
+                (let ((out (string-append #$output "/include")))
+                  (install-file "include/sajson.h" out)
+                  (install-file "include/sajson_ostream.h" out)))))))
+      (native-inputs (list unittest-cpp))
+      (home-page "https://github.com/chadaustin/sajson")
+      (synopsis "C++11 header-only, in-place JSON parser")
+      (description "@code{sajson} is an in-place JSON parser with support for
+parsing with only a single memory allocation.")
+      (license license:expat))))
diff --git a/gnu/packages/patches/sajson-build-with-gcc10.patch b/gnu/packages/patches/sajson-build-with-gcc10.patch
new file mode 100644
index 0000000000..878706dc79
--- /dev/null
+++ b/gnu/packages/patches/sajson-build-with-gcc10.patch
@@ -0,0 +1,45 @@
+This patch is from the upstream pull request
+https://github.com/chadaustin/sajson/pull/54.
+It fixes linking with GCC.
+
+diff --git a/include/sajson.h b/include/sajson.h
+index 8b4e05a..1bd045b 100644
+--- a/include/sajson.h
++++ b/include/sajson.h
+@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t, size_t value) {
+ // header. This trick courtesy of Rich Geldreich's Purple JSON parser.
+ template <typename unused = void>
+ struct globals_struct {
++    static const unsigned char parse_flags[256];
++};
++typedef globals_struct<> globals;
++
+ // clang-format off
+ 
+     // bit 0 (1) - set if: plain ASCII string character
+     // bit 1 (2) - set if: whitespace
+     // bit 4 (0x10) - set if: 0-9 e E .
+-    constexpr static const uint8_t parse_flags[256] = {
++    template <typename unused>
++    const unsigned char globals_struct<unused>::parse_flags[256] = {
+      // 0    1    2    3    4    5    6    7      8    9    A    B    C    D    E    F
+         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,   2,   0,   0,   2,   0,   0, // 0
+         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,   0,   0,   0,   0,   0,   0, // 1
+@@ -162,15 +167,13 @@ struct globals_struct {
+     };
+ 
+ // clang-format on
+-};
+-typedef globals_struct<> globals;
+ 
+-constexpr inline bool is_plain_string_character(char c) {
++inline bool is_plain_string_character(char c) {
+     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
+     return (globals::parse_flags[static_cast<unsigned char>(c)] & 1) != 0;
+ }
+ 
+-constexpr inline bool is_whitespace(char c) {
++inline bool is_whitespace(char c) {
+     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
+     return (globals::parse_flags[static_cast<unsigned char>(c)] & 2) != 0;
+ }
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 04/15] gnu: Add cbehave.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (4 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 03/15] gnu: Add sajson David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 05/15] gnu: Add tinydir David Elsing
                     ` (10 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/check.scm (cbehave): New variable.
---
 gnu/packages/check.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 797fe71277..70dfbbac27 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -38,6 +38,7 @@
 ;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Hugo Lecomte <hugo.lecomte@inria.fr>
 ;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3190,3 +3191,58 @@ (define-public python-pytest-regressions
 tables by saving expected data in a data directory (courtesy of pytest-datadir)
 that can be used to verify that future runs produce the same data.")
     (license license:expat)))
+
+(define-public cbehave
+  (let ((commit "5deaea0eaaf52f1c5ccdac0c68c003988f348fb4")
+        (revision "1"))
+    (package
+      (name "cbehave")
+      (version (git-version "0.2.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/bigwhite/cbehave")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0kicawxmxn059n3rmfc7r2q5wfjrqbr6lm8dmsi86ba76ak0f9gi"))
+                (snippet
+                 #~(begin
+                     (for-each
+                      (lambda (file)
+                        (delete-file file))
+                      '("Makefile.in" "aclocal.m4" "config.guess" "config.sub"
+                        "configure" "depcomp" "install-sh" "libtool"
+                        "ltmain.sh" "missing" "src/Makefile.in"
+                        "src/example/Makefile.in"))))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:configure-flags #~(list "--enable-shared" "--disable-static")
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-before 'bootstrap 'rename-configure.in
+              (lambda _
+                (rename-file "configure.in" "configure.ac")))
+            (add-after 'rename-configure.in 'set-AM_PROG_AR
+              (lambda _
+                (substitute* "configure.ac"
+                  (("^AC_PROG_LIBTOOL.*" orig)
+                   (string-append "AM_PROG_AR\n" orig)))))
+            (add-after 'set-AM_PROG_AR 'enable-tests
+              (lambda _
+                (let ((port (open-file "src/example/Makefile.am" "a")))
+                  (display (string-append "\nTESTS = calculator_test"
+                                          " text_editor_test string_test"
+                                          " product_database_test mock_test\n")
+                           port)
+                  (close-port port))))
+            (add-before 'check 'create-dummy-file
+              (lambda _
+                (invoke "touch" "src/example/foo.txt"))))))
+      (native-inputs (list autoconf automake libtool))
+      (home-page "https://github.com/bigwhite/cbehave")
+      (synopsis "Behavior-driven development framework for C")
+      (description "CBehave is a C framework for behavior-driven development.")
+      (license license:apsl2))))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 05/15] gnu: Add tinydir.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (5 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 04/15] gnu: Add cbehave David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 06/15] gnu: Add optionparser David Elsing
                     ` (9 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (tinydir): New variable.
---
 gnu/packages/cpp.scm                          | 41 +++++++++++++++++++
 .../patches/tinydir-fix-cbehave-test.patch    | 16 ++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 gnu/packages/patches/tinydir-fix-cbehave-test.patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index b6a0a70ed7..7871660611 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2093,3 +2093,44 @@ (define-public sajson
       (description "@code{sajson} is an in-place JSON parser with support for
 parsing with only a single memory allocation.")
       (license license:expat))))
+
+(define-public tinydir
+  (package
+    (name "tinydir")
+    (version "1.2.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/cxong/tinydir")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
+              (patches (search-patches "tinydir-fix-cbehave-test.patch"))
+              (modules '((guix build utils)))
+              (snippet '(delete-file-recursively "tests/cbehave"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'path-cmake
+            (lambda _
+              (substitute* "tests/CMakeLists.txt"
+                (("^include_dir.*cbehave.*")
+                 (string-append "include_directories("#$cbehave "/include)"))
+                (("^add_subdir.*cbeha.*") ""))))
+          (add-before 'configure 'chdir
+            (lambda _
+              (chdir "tests")))
+          (replace 'install
+            (lambda _
+              (install-file "../tinydir.h"
+                            (string-append #$output "/include")))))))
+    (native-inputs (list cbehave))
+    (home-page "https://github.com/cxong/tinydir")
+    (synopsis "Directory listing wrapper")
+    (description "@code{tinydir} is a header-only C wrapper for listing
+directory contents.")
+    (license license:bsd-2)))
diff --git a/gnu/packages/patches/tinydir-fix-cbehave-test.patch b/gnu/packages/patches/tinydir-fix-cbehave-test.patch
new file mode 100644
index 0000000000..84ecee12c2
--- /dev/null
+++ b/gnu/packages/patches/tinydir-fix-cbehave-test.patch
@@ -0,0 +1,16 @@
+Make test work with upstream cbehave
+(tinydir bundles a modified version)
+
+diff --git a/tests/file_open_test.c b/tests/file_open_test.c
+index 3e659bc..9f6f88d 100644
+--- a/tests/file_open_test.c
++++ b/tests/file_open_test.c
+@@ -19,4 +19,7 @@ FEATURE(file_open, "File open")
+ 	SCENARIO_END
+ FEATURE_END
+ 
+-CBEHAVE_RUN("File open:", TEST_FEATURE(file_open))
++int main(void) {
++	cbehave_feature _cfeatures[] = {{feature_idx(file_open)}};
++	return cbehave_runner("File open:", _cfeatures);
++}
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 06/15] gnu: Add optionparser.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (6 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 05/15] gnu: Add tinydir David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 07/15] gnu: Add sajson-for-gemmi David Elsing
                     ` (8 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/cpp.scm (optionparser): New variable.
---
 gnu/packages/cpp.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 7871660611..51d146476f 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2134,3 +2134,51 @@ (define-public tinydir
     (description "@code{tinydir} is a header-only C wrapper for listing
 directory contents.")
     (license license:bsd-2)))
+
+(define-public optionparser
+  (package
+    (name "optionparser")
+    (version "1.7")
+    (source (origin
+              (method url-fetch)
+              (uri
+               (string-append "mirror://sourceforge/optionparser/"
+                              "optionparser-" version ".tar.gz"))
+              (sha256
+               (base32
+                "04gfxrdzwacaynb8scsz6rr7nh64n6yk6w9dh2qdhrxw4caqr0dk"))))
+    (outputs '("out" "doc"))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure)
+          (add-before 'build 'chdir
+            (lambda _ (chdir "src")))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (begin
+                  (invoke "./example_arg")
+                  (invoke "./testparse")
+                  (invoke "./testprintusage")
+                  (invoke "./testodr")
+                  (invoke "./example")))))
+          (replace 'install
+            (lambda _
+              (install-file "optionparser.h"
+                            (string-append #$output "/include"))))
+          (add-after 'install 'install-doc
+            (lambda _
+              (copy-recursively
+               "../html"
+               (string-append #$output:doc "/share/doc/optionparser/html")))))))
+    (native-inputs (list doxygen))
+    (home-page "https://optionparser.sourceforge.net/")
+    (synopsis "Header-only C++ library to parse command line options")
+    (description "This library can be used to handle the command line
+arguments of a C++ program.  It supports the short and long option formats of
+getopt(), getopt_long() and getopt_long_only(), but has a more convenient
+interface.")
+    (license license:expat)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 07/15] gnu: Add sajson-for-gemmi.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (7 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 06/15] gnu: Add optionparser David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 08/15] gnu: Add gemmi David Elsing
                     ` (7 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (sajson-for-gemmi): New variable.
---
 gnu/packages/chemistry.scm                    |  23 +++
 .../sajson-for-gemmi-numbers-as-strings.patch | 195 ++++++++++++++++++
 2 files changed, 218 insertions(+)
 create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index c517610fe8..723b7ee8db 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,6 +28,7 @@ (define-module (gnu packages chemistry)
   #:use-module (guix utils)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
@@ -35,6 +37,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cpp)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gl)
@@ -50,8 +53,10 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages stb)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python))
 
@@ -566,3 +571,21 @@ (define-public python-pymol
 used to prepare publication-quality figures, to share interactive results with
 your colleagues, or to generate pre-rendered animations.")
     (license license:bsd-3)))
+
+(define-public sajson-for-gemmi
+  (package/inherit sajson
+    (name "sajson-for-gemmi")
+    (source (origin
+              (inherit (package-source sajson))
+              (patches (cons
+                        (search-patch
+                         "sajson-for-gemmi-numbers-as-strings.patch")
+                        (origin-patches (package-source sajson))))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments sajson)
+       ;; This is a modified version used in gemmi, in which numbers are kept
+       ;; as strings. Building the tests fails with the modification.
+       ((#:tests? _ #f) #f)
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (delete 'build)))))))
diff --git a/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
new file mode 100644
index 0000000000..6f476b8583
--- /dev/null
+++ b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch
@@ -0,0 +1,195 @@
+Patch for gemmi: Keep numbers in JSON file as strings.
+
+Adapted from this commit of the bundled fork of sajson in gemmi:
+https://github.com/project-gemmi/gemmi/commit/fccbca4f6040364ba708613e1429c2251872240d
+
+diff -ur a/include/sajson.h b/include/sajson.h
+--- a/include/sajson.h
++++ b/include/sajson.h
+@@ -411,43 +411,6 @@
+ };
+ } // namespace internal
+ 
+-namespace integer_storage {
+-enum { word_length = 1 };
+-
+-inline int load(const size_t* location) {
+-    int value;
+-    memcpy(&value, location, sizeof(value));
+-    return value;
+-}
+-
+-inline void store(size_t* location, int value) {
+-    // NOTE: Most modern compilers optimize away this constant-size
+-    // memcpy into a single instruction. If any don't, and treat
+-    // punning through a union as legal, they can be special-cased.
+-    static_assert(
+-        sizeof(value) <= sizeof(*location),
+-        "size_t must not be smaller than int");
+-    memcpy(location, &value, sizeof(value));
+-}
+-} // namespace integer_storage
+-
+-namespace double_storage {
+-enum { word_length = sizeof(double) / sizeof(size_t) };
+-
+-inline double load(const size_t* location) {
+-    double value;
+-    memcpy(&value, location, sizeof(double));
+-    return value;
+-}
+-
+-inline void store(size_t* location, double value) {
+-    // NOTE: Most modern compilers optimize away this constant-size
+-    // memcpy into a single instruction. If any don't, and treat
+-    // punning through a union as legal, they can be special-cased.
+-    memcpy(location, &value, sizeof(double));
+-}
+-} // namespace double_storage
+-
+ /// Represents a JSON value.  First, call get_type() to check its type,
+ /// which determines which methods are available.
+ ///
+@@ -585,70 +548,10 @@
+         return length;
+     }
+ 
+-    /// If a numeric value was parsed as a 32-bit integer, returns it.
+-    /// Only legal if get_type() is TYPE_INTEGER.
+-    int get_integer_value() const {
+-        assert_tag(tag::integer);
+-        return integer_storage::load(payload);
+-    }
+-
+-    /// If a numeric value was parsed as a double, returns it.
+-    /// Only legal if get_type() is TYPE_DOUBLE.
+-    double get_double_value() const {
+-        assert_tag(tag::double_);
+-        return double_storage::load(payload);
+-    }
+-
+-    /// Returns a numeric value as a double-precision float.
+-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
+-    double get_number_value() const {
+-        assert_tag_2(tag::integer, tag::double_);
+-        if (value_tag == tag::integer) {
+-            return get_integer_value();
+-        } else {
+-            return get_double_value();
+-        }
+-    }
+-
+-    /// Returns true and writes to the output argument if the numeric value
+-    /// fits in a 53-bit integer.  This is useful for timestamps and other
+-    /// situations where integral values with greater than 32-bit precision
+-    /// are used, as 64-bit values are not understood by all JSON
+-    /// implementations or languages.
+-    /// Returns false if the value is not an integer or not in range.
+-    /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE.
+-    bool get_int53_value(int64_t* out) const {
+-        // Make sure the output variable is always defined to avoid any
+-        // possible situation like
+-        // https://gist.github.com/chadaustin/2c249cb850619ddec05b23ca42cf7a18
+-        *out = 0;
+-
+-        assert_tag_2(tag::integer, tag::double_);
+-        switch (value_tag) {
+-        case tag::integer:
+-            *out = get_integer_value();
+-            return true;
+-        case tag::double_: {
+-            double v = get_double_value();
+-            if (v < -(1LL << 53) || v > (1LL << 53)) {
+-                return false;
+-            }
+-            int64_t as_int = static_cast<int64_t>(v);
+-            if (as_int != v) {
+-                return false;
+-            }
+-            *out = as_int;
+-            return true;
+-        }
+-        default:
+-            return false;
+-        }
+-    }
+-
+     /// Returns the length of the string.
+     /// Only legal if get_type() is TYPE_STRING.
+     size_t get_string_length() const {
+-        assert_tag(tag::string);
++        assert_tag_3(tag::string, tag::integer, tag::double_);
+         return payload[1] - payload[0];
+     }
+ 
+@@ -659,7 +562,7 @@
+     /// embedded NULs.
+     /// Only legal if get_type() is TYPE_STRING.
+     const char* as_cstring() const {
+-        assert_tag(tag::string);
++        assert_tag_3(tag::string, tag::integer, tag::double_);
+         return text + payload[0];
+     }
+ 
+@@ -667,7 +570,7 @@
+     /// Returns a string's value as a std::string.
+     /// Only legal if get_type() is TYPE_STRING.
+     std::string as_string() const {
+-        assert_tag(tag::string);
++        assert_tag_3(tag::string, tag::integer, tag::double_);
+         return std::string(text + payload[0], text + payload[1]);
+     }
+ #endif
+@@ -690,6 +593,10 @@
+         assert(e1 == value_tag || e2 == value_tag);
+     }
+ 
++    void assert_tag_3(tag e1, tag e2, tag e3) const {
++        assert(e1 == value_tag || e2 == value_tag || e3 == value_tag);
++    }
++
+     void assert_in_bounds(size_t i) const { assert(i < get_length()); }
+ 
+     const tag value_tag;
+@@ -2059,6 +1966,8 @@
+     std::pair<char*, internal::tag> parse_number(char* p) {
+         using internal::tag;
+ 
++	size_t start = p - input.get_data();
++
+         // Assume 32-bit, two's complement integers.
+         static constexpr unsigned RISKY = INT_MAX / 10u;
+         unsigned max_digit_after_risky = INT_MAX % 10u;
+@@ -2235,23 +2144,18 @@
+                 u = 0u - u;
+             }
+         }
++
++        bool success;
++        size_t* out = allocator.reserve(2, &success);
++        if (SAJSON_UNLIKELY(!success)) {
++            return std::make_pair(oom(p, "number"), tag::null);
++        }
++        out[0] = start;
++        out[1] = p - input.get_data();
++
+         if (try_double) {
+-            bool success;
+-            size_t* out
+-                = allocator.reserve(double_storage::word_length, &success);
+-            if (SAJSON_UNLIKELY(!success)) {
+-                return std::make_pair(oom(p, "double"), tag::null);
+-            }
+-            double_storage::store(out, d);
+             return std::make_pair(p, tag::double_);
+         } else {
+-            bool success;
+-            size_t* out
+-                = allocator.reserve(integer_storage::word_length, &success);
+-            if (SAJSON_UNLIKELY(!success)) {
+-                return std::make_pair(oom(p, "integer"), tag::null);
+-            }
+-            integer_storage::store(out, static_cast<int>(u));
+             return std::make_pair(p, tag::integer);
+         }
+     }
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 08/15] gnu: Add gemmi.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (8 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 07/15] gnu: Add sajson-for-gemmi David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 09/15] gnu: Add freesasa David Elsing
                     ` (6 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (gemmi): New variable.
---
 gnu/packages/chemistry.scm                    | 96 +++++++++++++++++++
 .../patches/gemmi-fix-pegtl-usage.patch       | 31 ++++++
 .../patches/gemmi-fix-sajson-types.patch      | 11 +++
 3 files changed, 138 insertions(+)
 create mode 100644 gnu/packages/patches/gemmi-fix-pegtl-usage.patch
 create mode 100644 gnu/packages/patches/gemmi-fix-sajson-types.patch

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 723b7ee8db..c6b8376248 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -589,3 +589,99 @@ (define-public sajson-for-gemmi
        ((#:phases phases)
         #~(modify-phases #$phases
             (delete 'build)))))))
+
+(define-public gemmi
+  (package
+    (name "gemmi")
+    (version "0.5.7")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/project-gemmi/gemmi")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "00km5q726bslrw7xbfwb3f3mrsk19qbimfnl3hvr4wi1y3z8i18a"))
+              (patches
+               (search-patches "gemmi-fix-sajson-types.patch"
+                               "gemmi-fix-pegtl-usage.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (delete-file-recursively "include/gemmi/third_party")
+                  (delete-file-recursively "third_party")))))
+    (outputs '("out" "bin" "python"))
+    (build-system cmake-build-system)
+    (native-inputs
+     (list fast-float
+           optionparser
+           pegtl
+           pocketfft-cpp
+           pybind11
+           sajson-for-gemmi
+           stb-sprintf
+           tinydir))
+    (inputs (list python zlib))
+    (arguments
+     (list
+      #:modules '((guix build cmake-build-system)
+                  (guix build utils)
+                  ((guix build python-build-system)
+                   #:select (site-packages)))
+      #:imported-modules (append %cmake-build-system-modules
+                                 '((guix build python-build-system)))
+      #:configure-flags
+      #~(list "-DUSE_PYTHON=ON"
+              (string-append "-DPYTHON_INSTALL_DIR="
+                             (site-packages %build-inputs %outputs)))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-includes
+            (lambda _
+              (substitute*
+                  (list
+                   "include/gemmi/sprintf.hpp"
+                   "include/gemmi/dirwalk.hpp"
+                   "include/gemmi/cif.hpp"
+                   "include/gemmi/json.hpp"
+                   "python/gemmi.cpp"
+                   "include/gemmi/atof.hpp"
+                   "include/gemmi/numb.hpp"
+                   "include/gemmi/fourier.hpp")
+                (("<stb/stb_sprintf.h>") "<stb_sprintf.h>")
+                (("\"third_party/tinydir.h\"") "<tinydir.h>")
+                (("\"third_party/tao/pegtl.hpp\"") "<tao/pegtl.hpp>")
+                (("\"third_party/sajson.h\"") "<sajson.h>")
+                (("\"gemmi/third_party/tao/pegtl/parse_error.hpp\"")
+                 "<tao/pegtl/parse_error.hpp>")
+                (("\"third_party/fast_float.h\"")
+                 "<fast_float/fast_float.h>")
+                (("\"third_party/pocketfft_hdronly.h\"")
+                 "<pocketfft_hdronly.h>"))))
+          (add-after 'unpack 'change-bin-prefix
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("install\\(TARGETS program DESTINATION bin\\)")
+                 (string-append
+                  "install(TARGETS program DESTINATION "
+                  #$output:bin "/bin)")))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (with-directory-excursion "../source"
+                  (setenv "PYTHONPATH" "../build")
+                  (invoke "python3" "-m" "unittest" "discover" "-v"
+                          "-s" "tests"))))))))
+    (home-page "https://gemmi.readthedocs.io/en/latest/")
+    (synopsis "Macromolecular crystallography library and utilities")
+    (description "GEMMI is a C++ library for macromolecular crystallography.
+It can be used for working with
+@enumerate
+@item macromolecular models (content of PDB, PDBx/mmCIF and mmJSON files),
+@item refinement restraints (CIF files),
+@item reflection data (MTZ and mmCIF formats),
+@item data on a 3D grid (electron density maps, masks, MRC/CCP4 format)
+@item crystallographic symmetry.
+@end enumerate")
+    (license license:mpl2.0)))
diff --git a/gnu/packages/patches/gemmi-fix-pegtl-usage.patch b/gnu/packages/patches/gemmi-fix-pegtl-usage.patch
new file mode 100644
index 0000000000..3667474847
--- /dev/null
+++ b/gnu/packages/patches/gemmi-fix-pegtl-usage.patch
@@ -0,0 +1,31 @@
+Use the definitions from (newer) upstream PEGTL.
+
+diff --git a/include/gemmi/cif.hpp b/include/gemmi/cif.hpp
+index c7ffdb44..35d24210 100644
+--- a/include/gemmi/cif.hpp
++++ b/include/gemmi/cif.hpp
+@@ -37,7 +37,6 @@ namespace pegtl = tao::pegtl;
+ namespace rules {
+ 
+   template<int TableVal> struct lookup_char {
+-    using analyze_t = pegtl::analysis::generic<pegtl::analysis::rule_type::ANY>;
+     template<typename Input> static bool match(Input& in) {
+       if (!in.empty() && cif::char_table(in.peek_char()) == TableVal) {
+         if (TableVal == 2)  // this set includes new-line
+@@ -71,11 +70,11 @@ namespace rules {
+   struct ws_or_eof : pegtl::sor<whitespace, pegtl::eof> {};
+ 
+   // (b) Reserved words.
+-  struct str_data : TAOCPP_PEGTL_ISTRING("data_") {};
+-  struct str_loop : TAOCPP_PEGTL_ISTRING("loop_") {};
+-  struct str_global : TAOCPP_PEGTL_ISTRING("global_") {};
+-  struct str_save : TAOCPP_PEGTL_ISTRING("save_") {};
+-  struct str_stop : TAOCPP_PEGTL_ISTRING("stop_") {};
++  struct str_data : TAO_PEGTL_ISTRING("data_") {};
++  struct str_loop : TAO_PEGTL_ISTRING("loop_") {};
++  struct str_global : TAO_PEGTL_ISTRING("global_") {};
++  struct str_save : TAO_PEGTL_ISTRING("save_") {};
++  struct str_stop : TAO_PEGTL_ISTRING("stop_") {};
+   struct keyword : pegtl::sor<str_data, str_loop, str_global,
+                               str_save, str_stop> {};
+ 
diff --git a/gnu/packages/patches/gemmi-fix-sajson-types.patch b/gnu/packages/patches/gemmi-fix-sajson-types.patch
new file mode 100644
index 0000000000..9633ddac8b
--- /dev/null
+++ b/gnu/packages/patches/gemmi-fix-sajson-types.patch
@@ -0,0 +1,11 @@
+diff -ur a/include/gemmi/json.hpp b/include/gemmi/json.hpp
+--- a/include/gemmi/json.hpp
++++ b/include/gemmi/json.hpp
+@@ -38,6 +38,7 @@
+ 
+ inline std::string as_cif_value(const sajson::value& val) {
+   switch (val.get_type()) {
++    case sajson::TYPE_INTEGER:
+     case sajson::TYPE_DOUBLE:
+       return val.as_string();
+     case sajson::TYPE_NULL:
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 09/15] gnu: Add freesasa.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (9 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 08/15] gnu: Add gemmi David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 10/15] gnu: Add maeparser David Elsing
                     ` (5 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (freesasa): New variable.
---
 gnu/packages/chemistry.scm | 86 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index c6b8376248..a9868ed64d 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -34,11 +34,13 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
+  #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages graphviz)
@@ -54,6 +56,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages stb)
+  #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
@@ -685,3 +688,86 @@ (define-public gemmi
 @item crystallographic symmetry.
 @end enumerate")
     (license license:mpl2.0)))
+
+(define-public freesasa
+  (package
+    (name "freesasa")
+    (version "2.1.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/mittinatten/freesasa")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "07wdnahf3g355ryaiqvfxd5f4rl54wv8jwxcbn0nia89fqysbv0f"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Remove C files generated by Flex and Bison
+                  (for-each delete-file
+                            '("src/parser.c" "src/parser.h"
+                              "src/lexer.c" "src/lexer.h"))))))
+    (outputs '("out" "doc"))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "--enable-check"
+              "--enable-parser-generator"
+              "CXXFLAGS=-std=c++17"
+              "--enable-doxygen")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'remove-libc++-linking
+            (lambda _
+              (substitute* "src/Makefile.am"
+                (("-lc\\+\\+") ""))))
+          (add-after 'unpack 'build-shared-library
+            (lambda _
+              (substitute* "src/Makefile.am"
+                (("lib_LIBRARIES") "lib_LTLIBRARIES")
+                (("libfreesasa\\.a") "libfreesasa.la")
+                (("freesasa_LDADD \\+= libfreesasa\\.la" prev)
+                 (string-append prev "\nlibfreesasa_la_LIBADD"
+                                " = -ljson-c ${libxml2_LIBS}\n"))
+                (("_a_SOURCES") "_la_SOURCES"))
+              (substitute* "configure.ac"
+                (("AC_PROG_INSTALL" inst)
+                 (string-append "AM_PROG_LIBTOOL\n" inst)))
+              (substitute* "tests/Makefile.am"
+                (("libfreesasa\\.a") "libfreesasa.la"))))
+          (add-before 'build 'build-lexer-and-parser
+            (lambda _
+              (with-directory-excursion "src"
+                (invoke "make" "lexer.h" "parser.h"))))
+          (add-after 'install 'install-doc
+            (lambda _
+              (copy-recursively
+               "doc/html"
+               (string-append #$output:doc "/share/doc/"
+                              #$name "-" #$version)))))))
+    (native-inputs
+     (list autoconf
+           automake
+           bison
+           check
+           doxygen
+           fast-float
+           flex
+           libtool
+           pegtl
+           perl
+           pkg-config))
+    (inputs
+     (list gemmi json-c libxml2))
+    (home-page "https://freesasa.github.io/")
+    (synopsis "Calculate the solvent accessible surface area (SASA) of
+molecules")
+    (description "FreeSASA is a command line tool and C-library for
+calculating @acronym{SASAs, solvent accessible surface areas}.  By default Lee
+& Richards'algorithm is used, but Shrake & Rupley's is also available.  Both
+can be parameterized to arbitrary precision, and for high resolution versions
+of the algorithms, the calculations give identical results.")
+    (license license:expat)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 10/15] gnu: Add maeparser.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (10 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 09/15] gnu: Add freesasa David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 11/15] gnu: Add coordgenlibs David Elsing
                     ` (4 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (maeparser): New variable.
---
 gnu/packages/chemistry.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index a9868ed64d..0712c44ad9 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -771,3 +771,24 @@ (define-public freesasa
 can be parameterized to arbitrary precision, and for high resolution versions
 of the algorithms, the calculations give identical results.")
     (license license:expat)))
+
+(define-public maeparser
+  (package
+    (name "maeparser")
+    (version "1.3.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/schrodinger/maeparser")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1yv4y5hn49fhylziigsg922bb244lb57p69r7vg9q899zd3l5b7l"))))
+    (build-system cmake-build-system)
+    (native-inputs (list boost))
+    (inputs (list zlib))
+    (home-page "https://github.com/schrodinger/maeparser")
+    (synopsis "Maestro file parser")
+    (description "maeparser is a parser for Schrodinger Maestro files.")
+    (license license:expat)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 11/15] gnu: Add coordgenlibs.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (11 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 10/15] gnu: Add maeparser David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 12/15] gnu: Add yaehmop David Elsing
                     ` (3 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (coordgenlibs): New variable.
---
 gnu/packages/chemistry.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 0712c44ad9..4da1bc10f1 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -792,3 +792,31 @@ (define-public maeparser
     (synopsis "Maestro file parser")
     (description "maeparser is a parser for Schrodinger Maestro files.")
     (license license:expat)))
+
+(define-public coordgenlibs
+  (package
+    (name "coordgenlibs")
+    (version "3.0.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/schrodinger/coordgenlibs/")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0d09x3v38i9y184bml020bq7xizdrdwng38qmdxlplzfhqkjdidv"))))
+    (build-system cmake-build-system)
+    (native-inputs (list boost))
+    (inputs (list maeparser))
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "-DCOORDGEN_RIGOROUS_BUILD=OFF"
+              "-DCOORDGEN_USE_MAEPARSER=ON")))
+    (home-page "https://github.com/schrodinger/coordgenlibs/")
+    (synopsis "2D molecule coordinate generation")
+    (description "@code{coordgenlibs} contains algorithms to generate 2D
+coordinates of molecules including macrocycles and metal complexes.  It has an
+emphasis on quality rather than speed.")
+    (license license:bsd-3)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 12/15] gnu: Add yaehmop.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (12 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 11/15] gnu: Add coordgenlibs David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 13/15] gnu: Add avalon-toolkit David Elsing
                     ` (2 subsequent siblings)
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (yaehmop): New variable.
---
 gnu/packages/chemistry.scm | 106 +++++++++++++++++++++++++++++++++++++
 1 file changed, 106 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 4da1bc10f1..a1c1dbfa1b 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gv)
@@ -56,6 +57,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages stb)
+  #:use-module (gnu packages tex)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
@@ -820,3 +822,107 @@ (define-public coordgenlibs
 coordinates of molecules including macrocycles and metal complexes.  It has an
 emphasis on quality rather than speed.")
     (license license:bsd-3)))
+
+(define-public yaehmop
+  (package
+    (name "yaehmop")
+    (version "2022.09.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/greglandrum/yaehmop")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Separate program
+                  (delete-file-recursively "viewkel")
+                  ;; Remove example output (some are corrupted)
+                  (for-each delete-file (find-files "examples" "\\.Z$"))
+                  ;; Documentation outputs
+                  (for-each delete-file (find-files "docs" "\\.(ps|pdf)$"))
+                  ;; These are transpiled from Fortran to C, but we build the
+                  ;; Fortran code instead
+                  (delete-file-recursively "tightbind/f2c_files")
+                  (delete-file "tightbind/diag.c")
+                  (delete-file "tightbind/cboris.c")
+                  (delete-file "tightbind/abfns.c")
+                  (delete-file "tightbind/lovlap.c")))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list
+         "-DUSE_BLAS_LAPACK=ON"
+         (string-append "-DPARM_FILE_LOC=" #$output
+                        "/share/" #$name "-" #$version "/eht_parms.dat")
+         "-DBIND_EXE_NAME=yaehmop-bind")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _
+              (chdir "tightbind")))
+          (add-after 'chdir 'patch-fortran-functions
+            (lambda _
+              (substitute* '("mov.c" "prototypes.h")
+                (("lovlap\\(") "lovlap_(")
+                (("abfns\\(") "abfns_("))))
+          (add-after 'chdir 'patch-cmake
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("project\\(yaehmop C\\)") "project(yaehmop C Fortran)")
+                (("abfns.c") "fortran77/abfns.f")
+                (("lovlap.c") "fortran77/lovlap.f")
+                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
+                 (string-append init " CACHE STRING \"\")"))
+                (("add_library\\(yaehmop_eht" lib)
+                 (string-append lib " SHARED "))
+                (("target_link_libraries\\(test_eht \\$\\{LAPACK_LIBRARIES\\}.*"
+                  all)
+                 (string-append all "\ntarget_link_libraries(yaehmop_eht "
+                                "${LAPACK_LIBRARIES})\n")))))
+          (add-after 'build 'build-doc
+            (lambda _
+              (with-directory-excursion "../docs"
+                (substitute* "bind_manual.tex"
+                  (("\\\\usepackage\\{bindpage\\}")
+                   (string-append
+                    "\\usepackage[left=2cm,right=2cm,top=4cm,bottom=2cm]"
+                    "{geometry}\n"
+                    "\\pdfsuppressptexinfo=-1\n")))
+                (substitute* "Zmat_appendix.tex"
+                  (("file=dihedral\\.eps")
+                   "file=figs/dihedral.eps"))
+                (setenv "FORCE_SOURCE_DATE" "1")
+                (invoke "latexmk" "-pdf" "bind_manual.tex"))))
+          (add-after 'install 'install-eht-parms
+            (lambda _
+              (install-file "../tightbind/eht_parms.dat"
+                            (string-append #$output "/share/"
+                                           #$name "-" #$version))))
+          (add-after 'install-eht-parms 'install-doc
+            (lambda _
+              (install-file "../docs/bind_manual.pdf"
+                            (string-append #$output "/share/doc/"
+                                           #$name "-" #$version))))
+          (delete 'check)
+          (add-after 'install-doc 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "./test_eht")))))))
+    (native-inputs
+     (list gfortran
+           (texlive-updmap.cfg (list texlive-fonts-ec
+                                     texlive-latex-graphics
+                                     texlive-latex-geometry))))
+    (inputs (list openblas))
+    (home-page "https://github.com/greglandrum/yaehmop")
+    (synopsis "Perform extended Hückel calculations")
+    (description "@acronym{YAeHMOP, Yet Another extended Hueckel Molecular
+Orbital Package} contains a program and library for performing extended Hückel
+calculations and analyzing the results.")
+    (license license:bsd-2)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 13/15] gnu: Add avalon-toolkit.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (13 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 12/15] gnu: Add yaehmop David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 14/15] gnu: Add ringdecomposerlib David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 15/15] gnu: Add rdkit David Elsing
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (avalon-toolkit): New variable.
---
 gnu/packages/chemistry.scm | 96 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index a1c1dbfa1b..82bc3ae29e 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -926,3 +926,99 @@ (define-public yaehmop
 Orbital Package} contains a program and library for performing extended Hückel
 calculations and analyzing the results.")
     (license license:bsd-2)))
+
+(define-public avalon-toolkit
+  (package
+    (name "avalon-toolkit")
+    (version "1.2.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "mirror://sourceforge/avalontoolkit/"
+             "AvalonToolkit_" (substring version 0 3) "/AvalonToolkit_"
+             version ".source.tar"))
+       (sha256
+        (base32
+         "0rnnyy6axs2da7aa4q6l30ldavbk49v6l22llj1adn74h1i67bpv"))
+       (modules '((guix build utils) (ice-9 ftw)))
+       (snippet
+        #~(begin
+            (delete-file-recursively "../SourceDistribution/java")))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      ;; There are no intended tests
+      #:tests? #f
+      #:phases
+      #~(let ((programs '("canonizer" "matchtest" "sketch" "smi2mol" "struchk")))
+          (modify-phases %standard-phases
+            (delete 'configure)
+            (add-before 'build 'remove-free
+              (lambda _
+                ;; Remove incorrect free of getenv result (patch also in rdkit)
+                (substitute* "common/reaccsio.c"
+                  (("MyFree.*tempdir.*") ""))))
+            ;; The makefile has incorrect compiler flags and is missing some
+            ;; object files, so we build it ourselves.
+            (replace 'build
+              (lambda _
+                (chdir "common")
+                (let* ((parts
+                        (list
+                         "aacheck" "casutils" "denormal" "depictutil" "didepict"
+                         "fixcharges" "forio" "geometry" "graph" "hashcode"
+                         "layout" "local" "pattern" "perceive" "reaccsio"
+                         "rtutils" "set" "shortcut" "sketch" "ssmatch" "stereo"
+                         "symbol_lists" "symboltable" "utilities"))
+                       (objects (map (lambda (name) (string-append name ".o"))
+                                     parts)))
+                  (for-each
+                   (lambda (name)
+                     (display (string-append "Compiling " name ".c\n"))
+                     (invoke "gcc" "-c" "-fPIC" "-O2"
+                             (string-append name ".c")
+                             "-o" (string-append name ".o")))
+                   parts)
+                  (display "Building shared library\n")
+                  (apply invoke "gcc" "-fPIC" "-shared" "-lm"
+                         "-o" "libavalontoolkit.so" "canonizer.c" "smi2mol.c"
+                         "struchk.c" "patclean.c" objects)
+                  ;; patclean is not built here as there is an undeclared
+                  ;; variable in main().
+                  (for-each
+                   (lambda (program)
+                     (display (string-append "Building " program "\n"))
+                     (invoke "gcc" "-L." "-lavalontoolkit" "-lm" "-O2"
+                             (string-append "-Wl,-rpath=" #$output "/lib")
+                             "-DMAIN" (string-append program ".c") "-o" program))
+                   programs))))
+            (replace 'install
+              (lambda _
+                ;; Executables
+                (for-each
+                 (lambda (program)
+                   (install-file program (string-append #$output "/bin")))
+                 programs)
+                (for-each
+                 (lambda (name)
+                   (symlink (string-append #$output "/bin/smi2mol")
+                            (string-append #$output "/bin/" name)))
+                 '("mol2smi" "rdf2smi" "mol2tbl" "mol2sma" "smi2rdf"))
+                ;; Library
+                (install-file "libavalontoolkit.so"
+                              (string-append #$output "/lib"))
+                (for-each
+                 (lambda (file)
+                   (install-file file (string-append #$output
+                                                    "/include/avalontoolkit")))
+                 (find-files "." "\\.h$"))
+                (install-file "../license.txt"
+                              (string-append #$output "/share/doc/"
+                                             #$name "-" #$version "/"))))))))
+    (home-page "https://sourceforge.net/projects/avalontoolkit/")
+    (synopsis "Tools for SMILES and MOL files and for structure fingerprinting")
+    (description "This package contains a library and programs for
+canonicalization of SMILES and MOL files, molecular structure fingerprinting
+and rendering molecules.")
+    (license license:bsd-3)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 14/15] gnu: Add ringdecomposerlib.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (14 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 13/15] gnu: Add avalon-toolkit David Elsing
@ 2022-10-13 21:04   ` David Elsing
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 15/15] gnu: Add rdkit David Elsing
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (ringdecomposerlib): New variable.
---
 gnu/packages/chemistry.scm | 81 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 82bc3ae29e..1a80bd1ad5 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -1022,3 +1022,84 @@ (define-public avalon-toolkit
 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 "Library for calculating ring topology descriptions such as
+unique ring families")
+    (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)))
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 15/15] gnu: Add rdkit.
  2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
                     ` (15 preceding siblings ...)
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 14/15] gnu: Add ringdecomposerlib David Elsing
@ 2022-10-13 21:04   ` David Elsing
  16 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-13 21:04 UTC (permalink / raw)
  To: 58261; +Cc: David Elsing

* gnu/packages/chemistry.scm (rdkit): New variable.
---
 gnu/packages/chemistry.scm                    | 149 +++++++
 ...rdkit-unbundle-external-dependencies.patch | 384 ++++++++++++++++++
 2 files changed, 533 insertions(+)
 create mode 100644 gnu/packages/patches/rdkit-unbundle-external-dependencies.patch

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 1a80bd1ad5..e72ecd6206 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -34,6 +34,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
@@ -41,10 +42,12 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
+  #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages graphviz)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages image)
   #:use-module (gnu packages maths)
@@ -56,6 +59,7 @@ (define-module (gnu packages chemistry)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages sqlite)
   #:use-module (gnu packages stb)
   #:use-module (gnu packages tex)
   #:use-module (gnu packages web)
@@ -1103,3 +1107,148 @@ (define-public ringdecomposerlib
 unique ring families, relevant cycles, the smallest set of smallest rings and
 other ring topology descriptions.")
     (license license:bsd-3)))
+
+(define-public rdkit
+  (package
+    (name "rdkit")
+    (version "2022.03.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/rdkit/rdkit")
+                    (commit
+                     (string-append
+                      "Release_" (string-replace-substring version "." "_")))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "19idgilabh04cbr1qj6zgrgsfjm248mmfz6fsr0smrd68d0xnml9"))
+              (patches
+               (search-patches "rdkit-unbundle-external-dependencies.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               #~(begin
+                   ;; Remove pickle files (only used in tests),
+                   ;; as they are compiled programs
+                   (for-each
+                    (lambda (name)
+                      (display (string-append name "\n"))
+                      (delete-file name))
+                    (find-files "." "\\.pkl(\\.gz)?$"))
+                   ;; Remove SQLite data files (can be generated)
+                   (delete-file "Data/RDData.sqlt")
+                   (delete-file "Data/RDTests.sqlt")))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #: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)))
+      #:configure-flags
+      #~(list
+         "-DRDK_BUILD_AVALON_SUPPORT=ON"
+         "-DRDK_BUILD_CAIRO_SUPPORT=ON"
+         "-DRDK_BUILD_FREESASA_SUPPORT=ON"
+         "-DRDK_BUILD_INCHI_SUPPORT=ON"
+         "-DRDK_BUILD_YAEHMOP_SUPPORT=ON"
+         (string-append "-DCATCH_DIR="
+                        #$(this-package-native-input "catch2")
+                        "/include/catch2")
+         "-DRDK_INSTALL_INTREE=OFF"
+         "-DRDK_INSTALL_STATIC_LIBS=OFF"
+         (string-append
+          "-DRDK_OPTIMIZE_POPCNT="
+          #$(let ((system (or (%current-target-system)
+                              (%current-system))))
+              (cond
+               ((string-prefix? "x86_64" system) "ON")
+               ((string-prefix? "i686" system) "ON")
+               (else "OFF"))))
+         "-DRDK_USE_FLEXBISON=ON"
+         (string-append
+          "-DCMAKE_INCLUDE_PATH="
+          #$(this-package-input "avalon-toolkit") "/include/avalontoolkit"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'copy-external-dependencies
+            (lambda _
+              (symlink
+               (string-append
+                (search-input-file
+                 %build-inputs "/share/fonts/truetype/ComicNeue-Regular.ttf"))
+               "Data/Fonts/ComicNeue-Regular.ttf")))
+          (add-after 'unpack 'fix-inchi-include
+            (lambda _
+              (substitute* "Code/cmake/Modules/FindInchi.cmake"
+                (("inchi_api.h.*\\)") "inchi/inchi_api.h)")
+                (("INCHI_LIBRARY NAMES.*\\)")
+                 "INCHI_LIBRARY NAMES inchi PATH_SUFFIXES inchi)")
+                (("find_library" prev)
+                 (string-append
+                  "list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.1)\n"
+                  prev)))
+              (substitute* "External/INCHI-API/inchi.cpp"
+                (("<inchi_api.h>") "<inchi/inchi_api.h>"))))
+          (add-before 'build 'enable-bytecode-determinism
+              (lambda _
+                (setenv "PYTHONHASHSEED" "0")
+                (setenv "PYTHONDONTWRITEBYTECODE" "1")))
+          (add-after 'install 'pre-check
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (with-directory-excursion "../source"
+                (invoke "sqlite3" "Data/RDData.sqlt"
+                        ".read rdkit/Dbase/test_data/RDData.sqlite")
+                (invoke "sqlite3" "Data/RDTests.sqlt"
+                        ".read rdkit/Dbase/test_data/RDTests.sqlite")
+                (setenv "RDBASE" (canonicalize-path ".")))
+              (add-installed-pythonpath inputs outputs)))
+          (delete 'check)
+          (add-after 'pre-check 'check
+            (lambda* (#:key tests? parallel-tests? #:allow-other-keys)
+              (when tests?
+                (let ((job-count (number->string
+                                  (if parallel-tests? (parallel-job-count) 1))))
+                  (invoke
+                   "ctest" "-j" job-count
+                   "-E" (string-append
+                         (string-join
+                          '(;; need pickled data
+                            "(pyDiscreteValueVect" "pySparseIntVect"
+                            "graphmoltestPickler" "pyPartialCharges"
+                            "substructLibraryTest" "pyFeatures"
+                            "pythonTestDirML" "pythonTestDirChem"
+                            ;; Catching Python exception fails
+                            "pyRanker)") "|"))))))))))
+    (native-inputs
+     (list bison
+           boost
+           catch2
+           eigen
+           flex
+           freesasa
+           pkg-config
+           rapidjson
+           tar))
+    (inputs
+     (list avalon-toolkit
+           cairo
+           coordgenlibs
+           font-comic-neue
+           freetype
+           inchi
+           maeparser
+           python
+           ringdecomposerlib
+           sqlite
+           yaehmop))
+    (propagated-inputs
+     (list python-numpy python-cairocffi python-pillow))
+    (home-page "https://rdkit.org/")
+    (synopsis "Collection of cheminformatics software")
+    (description "RDKit is a C++ and Python library for cheminformatics, which
+includes (among other things) the analysis and modification of molecules in 2D
+and 3D and descriptor generation for machine learning.")
+    (license license:bsd-3)))
diff --git a/gnu/packages/patches/rdkit-unbundle-external-dependencies.patch b/gnu/packages/patches/rdkit-unbundle-external-dependencies.patch
new file mode 100644
index 0000000000..8ee0611d3b
--- /dev/null
+++ b/gnu/packages/patches/rdkit-unbundle-external-dependencies.patch
@@ -0,0 +1,384 @@
+Remove CMake code for downloading and builing bundled dependencies:
+They are packaged separately as rapidjson, avalon-toolkit, freesasa,
+ringdecomposerlib and yaehmop.
+
+diff --git a/Code/GraphMol/MolInterchange/CMakeLists.txt b/Code/GraphMol/MolInterchange/CMakeLists.txt
+index 1673386a4..c3504e6f1 100644
+--- a/Code/GraphMol/MolInterchange/CMakeLists.txt
++++ b/Code/GraphMol/MolInterchange/CMakeLists.txt
+@@ -1,18 +1,3 @@
+-
+-if(NOT EXISTS "${CMAKE_SOURCE_DIR}/External/rapidjson-1.1.0")
+-    downloadAndCheckMD5("https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz"
+-          "${CMAKE_SOURCE_DIR}/External/rapidjson-1.1.0.tar.gz"
+-          "badd12c511e081fec6c89c43a7027bce")
+-    execute_process(COMMAND ${CMAKE_COMMAND} -E tar zxf
+-      ${CMAKE_SOURCE_DIR}/External/rapidjson-1.1.0.tar.gz
+-      WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/External)
+-else()
+-  message("-- Found RapidJSON source in ${CMAKE_SOURCE_DIR}/External")
+-endif()
+-
+-include_directories(${CMAKE_SOURCE_DIR}/External/rapidjson-1.1.0/include)
+-
+-
+ rdkit_library(MolInterchange
+               Parser.cpp Writer.cpp
+               LINK_LIBRARIES GraphMol)
+diff --git a/External/AvalonTools/AvalonTools.cpp b/External/AvalonTools/AvalonTools.cpp
+index e6c382123..d83d80668 100644
+--- a/External/AvalonTools/AvalonTools.cpp
++++ b/External/AvalonTools/AvalonTools.cpp
+@@ -24,15 +24,15 @@
+ #include "AvalonTools.h"
+ 
+ extern "C" {
+-#include "local.h"
+-#include "reaccs.h"
+-#include "reaccsio.h"
+-#include "utilities.h"
+-#include "ssmatch.h"
+-#include "smi2mol.h"
+-#include "canonizer.h"
+-#include "layout.h"
+-#include "struchk.h"
++#include <avalontoolkit/local.h>
++#include <avalontoolkit/reaccs.h>
++#include <avalontoolkit/reaccsio.h>
++#include <avalontoolkit/utilities.h>
++#include <avalontoolkit/ssmatch.h>
++#include <avalontoolkit/smi2mol.h>
++#include <avalontoolkit/canonizer.h>
++#include <avalontoolkit/layout.h>
++#include <avalontoolkit/struchk.h>
+ 
+ extern int RunStruchk(struct reaccs_molecule_t **mpp,
+                       struct data_line_t *data_list);
+diff --git a/External/AvalonTools/CMakeLists.txt b/External/AvalonTools/CMakeLists.txt
+index 3e31195fc..314ba35b5 100644
+--- a/External/AvalonTools/CMakeLists.txt
++++ b/External/AvalonTools/CMakeLists.txt
+@@ -2,107 +2,14 @@ if(NOT RDK_BUILD_AVALON_SUPPORT)
+   return()
+ endif(NOT RDK_BUILD_AVALON_SUPPORT)
+ 
+-if(NOT DEFINED AVALONTOOLS_DIR)
+-  set(AVALONTOOLS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/SourceDistribution")
+-  set(fileToPatch "${CMAKE_CURRENT_SOURCE_DIR}/SourceDistribution/common/reaccsio.c")
+-  set(needDownload "TRUE")
+-  if(EXISTS "${fileToPatch}")
+-    file(READ "${fileToPatch}" buffer)
+-    if("${buffer}" MATCHES "//MyFree\\(\\(char \\*\\)tempdir\\);")
+-      set(needDownload "FALSE")
+-    endif()
+-  endif()
+-else()
+-  string(REGEX REPLACE "\\\\" "/" AVALONTOOLS_DIR ${AVALONTOOLS_DIR})
+-  set(needDownload "FALSE")
+-endif()
+-
+-set(AVALON_SRC_PATH ${AVALONTOOLS_DIR}/common)
+-
+-if(needDownload)
+-  if(NOT DEFINED AVALONTOOLS_URL)
+-    set(AVALONTOOLS_URL "https://sourceforge.net/projects/avalontoolkit/files/AvalonToolkit_1.2/AvalonToolkit_1.2.0.source.tar")
+-  endif()
+-  if(NOT DEFINED AVALONTOOLS_MD5SUM)
+-    set(AVALONTOOLS_MD5SUM "092a94f421873f038aa67d4a6cc8cb54")
+-  endif()
+-  if(NOT DEFINED AVALONTOOLS_BASE)
+-    string(REGEX REPLACE "^.*/" "" AVALONTOOLS_BASE "${AVALONTOOLS_URL}")
+-  endif()
+-  downloadAndCheckMD5(${AVALONTOOLS_URL} "${CMAKE_CURRENT_SOURCE_DIR}/${AVALONTOOLS_BASE}" ${AVALONTOOLS_MD5SUM})
+-  execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf
+-    ${CMAKE_CURRENT_SOURCE_DIR}/AvalonToolkit_1.2.0.source.tar
+-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+-  # apply patch to AvalonTools
+-  configure_file("${fileToPatch}" "${fileToPatch}.orig" COPYONLY)
+-  file(READ "${fileToPatch}" buffer)
+-  string(REGEX REPLACE "MyFree\\(\\(char \\*\\)tempdir\\);"
+-    "//MyFree((char *)tempdir);" buffer "${buffer}")
+-  file(WRITE "${fileToPatch}" "${buffer}")
+-endif()
+ 
+ if (MSVC)
+   add_definitions("/D_CRT_SECURE_NO_WARNINGS")
+   add_compile_options(/wd4224 /wd4101 /wd4018 /wd4996 /wd4244 /wd4305 /wd4013 /wd4146 /wd4334 /wd4715 /wd4715 /nologo)
+ endif(MSVC)
+ 
+-set(avalon_clib_srcs ${AVALON_SRC_PATH}/layout.c
+-	${AVALON_SRC_PATH}/symboltable.c
+-	${AVALON_SRC_PATH}/patclean.c
+-	${AVALON_SRC_PATH}/utilities.c
+-	${AVALON_SRC_PATH}/symbol_lists.c
+-	${AVALON_SRC_PATH}/stereo.c
+-	${AVALON_SRC_PATH}/set.c
+-	${AVALON_SRC_PATH}/perceive.c
+-	${AVALON_SRC_PATH}/local.c
+-	${AVALON_SRC_PATH}/graph.c
+-	${AVALON_SRC_PATH}/geometry.c
+-	${AVALON_SRC_PATH}/forio.c
+-	${AVALON_SRC_PATH}/depictutil.c
+-	${AVALON_SRC_PATH}/denormal.c
+-	${AVALON_SRC_PATH}/casutils.c
+-	${AVALON_SRC_PATH}/ssmatch.c
+-	${AVALON_SRC_PATH}/rtutils.c
+-	${AVALON_SRC_PATH}/smi2mol.c
+-	${AVALON_SRC_PATH}/didepict.c
+-	${AVALON_SRC_PATH}/pattern.c
+-	${AVALON_SRC_PATH}/canonizer.c
+-	${AVALON_SRC_PATH}/aacheck.c
+-	${AVALON_SRC_PATH}/fixcharges.c
+-	${AVALON_SRC_PATH}/struchk.c
+-	${AVALON_SRC_PATH}/reaccsio.c
+-	${AVALON_SRC_PATH}/hashcode.c
+-  )
+-
+-# we need this to ensure that builds continue
+-# to work on linux systems with older versions
+-# of glibc when we're building with gcc-4.1.
+-# Without this flag, we'll endup requiring
+-# glibc 2.7.
+-if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+-    add_definitions(-D_GNU_SOURCE=1)
+-endif()
+-
+-if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type -Wno-implicit-function-declaration -Wno-absolute-value -Wno-parentheses -Wno-logical-op-parentheses -Wno-dangling-else -Wno-format")
+-endif()
+-if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result -Wformat-overflow=0 -Wformat=0 -Wno-format-security -Wno-implicit-function-declaration")
+-endif()
+-
+-
+-
+-rdkit_library(avalon_clib ${avalon_clib_srcs})
+-target_compile_definitions(avalon_clib PRIVATE RDKIT_AVALONLIB_BUILD)
+-if((MSVC AND RDK_INSTALL_DLLS_MSVC) OR ((NOT MSVC) AND WIN32))
+-  set_target_properties(avalon_clib PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
+-endif()
+-
+-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+-include_directories(${AVALON_SRC_PATH})
+-
+ rdkit_library(AvalonLib AvalonTools.cpp SHARED 
+-     LINK_LIBRARIES avalon_clib SubstructMatch FileParsers SmilesParse GraphMol DataStructs  )
++     LINK_LIBRARIES -lavalontoolkit SubstructMatch FileParsers SmilesParse GraphMol DataStructs  )
+ target_compile_definitions(AvalonLib PRIVATE RDKIT_AVALONLIB_BUILD)
+ rdkit_headers(AvalonTools.h DEST GraphMol)
+ rdkit_test(testAvalonLib1 test1.cpp
+diff --git a/External/AvalonTools/Wrap/pyAvalonTools.cpp b/External/AvalonTools/Wrap/pyAvalonTools.cpp
+index fb24c497e..31997bc0a 100644
+--- a/External/AvalonTools/Wrap/pyAvalonTools.cpp
++++ b/External/AvalonTools/Wrap/pyAvalonTools.cpp
+@@ -12,7 +12,7 @@
+ #include <boost/cstdint.hpp>
+ 
+ extern "C" {
+-#include "struchk.h"
++#include <avalontoolkit/struchk.h>
+ }
+ 
+ namespace python = boost::python;
+diff --git a/External/FreeSASA/CMakeLists.txt b/External/FreeSASA/CMakeLists.txt
+index 43dfbdc40..81165a143 100644
+--- a/External/FreeSASA/CMakeLists.txt
++++ b/External/FreeSASA/CMakeLists.txt
+@@ -2,88 +2,8 @@ if(NOT RDK_BUILD_FREESASA_SUPPORT)
+   return()
+ endif(NOT RDK_BUILD_FREESASA_SUPPORT)
+ 
+-if(NOT DEFINED FREESASA_DIR)
+-  set(FREESASA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/freesasa")
+-  set(needDownload "TRUE")
+-  if(EXISTS "${FREESASA_DIR}/src/freesasa.h")
+-    set(needDownload "FALSE")
+-  endif()
+-endif()
+-
+-if(needDownload)
+-  # don't actually use the md5 here
+-  set(FREESASA_VERSION "2.0.3")
+-  set(FREESASA_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/freesasa-${FREESASA_VERSION}")
+-  if(NOT EXISTS "${FREESASA_SRC_DIR}/src")
+-    downloadAndCheckMD5("https://github.com/mittinatten/freesasa/releases/download/${FREESASA_VERSION}/freesasa-${FREESASA_VERSION}.tar.gz"
+-          "${CMAKE_CURRENT_SOURCE_DIR}/master.tar.gz"
+-          "")
+-    execute_process(COMMAND ${CMAKE_COMMAND} -E tar zxf
+-      ${CMAKE_CURRENT_SOURCE_DIR}/master.tar.gz
+-      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+-    message("Copying freesasa2.c to ${FREESASA_SRC_DIR}/src/freesasa2.c")
+-    file(COPY freesasa2.c DESTINATION ${FREESASA_SRC_DIR}/src/)
+-  else()
+-    message("FreeSASA found in ${FREESASA_SRC_DIR}, no download required")
+-  endif()
+-endif()
+-
+-set(CMAKE_C_STANDARD 99)
+-
+-set (freesasa_clib_srcs
+-    ${FREESASA_SRC_DIR}/src/classifier.c
+-    ${FREESASA_SRC_DIR}/src/classifier_naccess.c
+-    ${FREESASA_SRC_DIR}/src/classifier_oons.c
+-    ${FREESASA_SRC_DIR}/src/classifier_protor.c
+-    ${FREESASA_SRC_DIR}/src/coord.c
+-    ${FREESASA_SRC_DIR}/src/freesasa2.c
+-    ${FREESASA_SRC_DIR}/src/lexer.c
+-    ${FREESASA_SRC_DIR}/src/log.c
+-    ${FREESASA_SRC_DIR}/src/nb.c
+-    ${FREESASA_SRC_DIR}/src/node.c
+-    ${FREESASA_SRC_DIR}/src/parser.c
+-    ${FREESASA_SRC_DIR}/src/pdb.c
+-    ${FREESASA_SRC_DIR}/src/rsa.c
+-    ${FREESASA_SRC_DIR}/src/sasa_lr.c
+-    ${FREESASA_SRC_DIR}/src/sasa_sr.c
+-    ${FREESASA_SRC_DIR}/src/selection.c
+-    ${FREESASA_SRC_DIR}/src/structure.c
+-    ${FREESASA_SRC_DIR}/src/util.c
+-    )
+-if((MSVC AND RDK_INSTALL_DLLS_MSVC) OR ((NOT MSVC) AND WIN32))
+-  set(freesasa_additional_exports ${CMAKE_CURRENT_SOURCE_DIR}/additional_exports.def)
+-  file(WRITE ${freesasa_additional_exports}
+-    "EXPORTS\n"
+-    "freesasa_default_parameters DATA\n"
+-    "freesasa_protor_classifier DATA\n"
+-    "freesasa_naccess_classifier DATA\n"
+-    "freesasa_oons_classifier DATA\n"
+-  )
+-  set (freesasa_clib_srcs
+-    ${freesasa_clib_srcs}
+-    ${freesasa_additional_exports}
+-  )
+-endif()
+-
+-set (freesasa_h ${FREESASA_SRC_DIR}/src/freesasa.h)
+-file(READ ${freesasa_h} freesasa_h_data)
+-string(REGEX REPLACE "(#include <stdio.h>)" "\\1\n#include <RDGeneral/export.h>" freesasa_h_data "${freesasa_h_data}")
+-string(REGEX REPLACE "([^R][^D][^K][^I][^T][^_][^F][^R][^E][^E][^S][^A][^S][^A][^_][^C][^L][^I][^B][^_][^E][^X][^P][^O][^R][^T][^ ])(extern const)" "\\1RDKIT_FREESASA_CLIB_EXPORT \\2" freesasa_h_data "${freesasa_h_data}")
+-file(WRITE ${freesasa_h} "${freesasa_h_data}")
+-
+-add_definitions(-DUSE_THREADS=0)
+-add_definitions(-DUSE_JSON=0)
+-add_definitions(-DUSE_XML=0)
+-rdkit_library(freesasa_clib ${freesasa_clib_srcs})
+-target_compile_definitions(freesasa_clib PRIVATE RDKIT_FREESASALIB_BUILD)
+-
+-if((MSVC AND RDK_INSTALL_DLLS_MSVC) OR ((NOT MSVC) AND WIN32))
+-  set_target_properties(freesasa_clib PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
+-endif()
+-include_directories("${FREESASA_SRC_DIR}/src")
+-
+ rdkit_library(FreeSASALib RDFreeSASA.cpp SHARED 
+-    LINK_LIBRARIES freesasa_clib GraphMol )
++    LINK_LIBRARIES -lfreesasa GraphMol )
+ target_compile_definitions(FreeSASALib PRIVATE RDKIT_FREESASALIB_BUILD)
+ 
+ rdkit_headers(RDFreeSASA.h DEST GraphMol)
+diff --git a/External/RingFamilies/CMakeLists.txt b/External/RingFamilies/CMakeLists.txt
+index 08dd1fe04..66ecd5834 100644
+--- a/External/RingFamilies/CMakeLists.txt
++++ b/External/RingFamilies/CMakeLists.txt
+@@ -1,47 +1,6 @@
+-add_custom_target(ringdecomposerlib_support ALL)
+-
+ if(NOT RDK_USE_URF)
+   return()
+ endif(NOT RDK_USE_URF)
+ 
+-if(NOT DEFINED URFLIB_DIR)
+-    set(URFLIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/RingDecomposerLib/src/RingDecomposerLib")
+-endif()
+-
+-if(NOT EXISTS "${URFLIB_DIR}/RingDecomposerLib.h")
+-    set(RELEASE_NO "1.1.3_rdkit")
+-    set(MD5 "e9a0bcdda8b921a35e812b9888a9a874")
+-    downloadAndCheckMD5("https://github.com/rareylab/RingDecomposerLib/archive/v${RELEASE_NO}.tar.gz"
+-            "${CMAKE_CURRENT_SOURCE_DIR}/RingDecomposerLib-v${RELEASE_NO}.tar.gz" ${MD5})
+-    execute_process(COMMAND ${CMAKE_COMMAND} -E tar zxf
+-        ${CMAKE_CURRENT_SOURCE_DIR}/RingDecomposerLib-v${RELEASE_NO}.tar.gz
+-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+-    file(RENAME "RingDecomposerLib-${RELEASE_NO}" "RingDecomposerLib")
+-else()
+-    message("-- Found RingDecomposerLib source in ${URFLIB_DIR}")
+-endif()
+-
+-set(urflib_INCLUDE_DIRS ${URFLIB_DIR}
+-    CACHE STRING "RingDecomposerLib Include Dir" FORCE)
+-file(GLOB URFSOURCES "${URFLIB_DIR}/*.c")
+-
+-#if((MSVC AND RDK_INSTALL_DLLS_MSVC) OR ((NOT MSVC) AND WIN32 AND (NOT RDK_INSTALL_STATIC_LIBS)))
+-if(WIN32)
+-    set (ringdecomposerlib_h ${URFLIB_DIR}/RingDecomposerLib.h)
+-    file(READ ${ringdecomposerlib_h} ringdecomposerlib_h_data)
+-    if (NOT "${ringdecomposerlib_h_data}" MATCHES "RDKIT_URFLIB_BUILD")
+-        string(REGEX REPLACE "(#if[ ]+\\([ ]*defined[ ]*\\([ ]*_WIN32[ ]*\\)[ ]*&&[ ]*)(defined\\([ ]*_MSC_VER[ ]*\\))" "\\1!defined( RDL_WIN_STATIC )" ringdecomposerlib_h_data "${ringdecomposerlib_h_data}")
+-        string(REGEX REPLACE "([ ]*)(#define[ ]+RDL_API[ ]+__declspec)(\\([ ]*dllexport[ ]*\\))" "\\1#ifdef RDKIT_URFLIB_BUILD\n\\1\\1\\2\\3\n\\1#else\n\\1\\1\\2(dllimport)\n\\1#endif" ringdecomposerlib_h_data "${ringdecomposerlib_h_data}")
+-        file(WRITE ${ringdecomposerlib_h} "${ringdecomposerlib_h_data}")
+-    endif()
+-endif()
+-rdkit_library(RingDecomposerLib ${URFSOURCES} SHARED)
+-if((MSVC AND RDK_INSTALL_DLLS_MSVC) OR ((NOT MSVC) AND WIN32 AND (NOT RDK_INSTALL_STATIC_LIBS)))
+-    target_compile_definitions(RingDecomposerLib PRIVATE RDKIT_URFLIB_BUILD)
+-endif()
+-install(TARGETS RingDecomposerLib DESTINATION ${RDKit_LibDir})
+-rdkit_headers(${URFLIB_DIR}/RingDecomposerLib.h DEST "")
+-
+-
+-set(RDK_URF_LIBS RingDecomposerLib
+-    CACHE STRING "the libraries for the URF calculation" FORCE)
++rdkit_library(RingDecomposerLib dummy.cpp SHARED LINK_LIBRARIES -lRingDecomposerLib)
++set(RDK_URF_LIBS RingDecomposerLib CACHE STRING "" FORCE)
+diff --git a/External/RingFamilies/dummy.cpp b/External/RingFamilies/dummy.cpp
+new file mode 100644
+index 000000000..e69de29bb
+diff --git a/External/YAeHMOP/CMakeLists.txt b/External/YAeHMOP/CMakeLists.txt
+index f1027b3bd..8bee2f910 100644
+--- a/External/YAeHMOP/CMakeLists.txt
++++ b/External/YAeHMOP/CMakeLists.txt
+@@ -18,32 +18,8 @@ endif()
+ 
+ include_directories( ${RDKit_ExternalDir}/YAeHMOP )
+ 
+-ExternalProject_Add(yaehmop_project
+-  GIT_REPOSITORY https://github.com/greglandrum/yaehmop.git
+-  GIT_TAG master
+-  UPDATE_COMMAND ""
+-  PATCH_COMMAND ""
+-  PREFIX ${CMAKE_CURRENT_SOURCE_DIR}
+-  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop"
+-  SOURCE_SUBDIR "tightbind"
+-  CMAKE_ARGS -DUSE_BLAS_LAPACK=OFF -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+-  TEST_COMMAND "")
+-
+-include_directories(${PROJECT_BINARY_DIR}/include)
+-link_directories(${PROJECT_BINARY_DIR}/lib)
+-link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build)
+-
+-set(EHT_PARAM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind/eht_parms.dat )
+-install(FILES ${EHT_PARAM_FILE}
+-        DESTINATION ${RDKit_ShareDir}/Data
+-        COMPONENT data)
+-
+-message("YAeHMOP include_dirs: ${PROJECT_BINARY_DIR}/include")
+-message("YAeHMOP link_dirs: ${PROJECT_BINARY_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/src/yaehmop_project-build")
+-
+-rdkit_library(EHTLib EHTTools.cpp SHARED LINK_LIBRARIES yaehmop_eht GraphMol )
++rdkit_library(EHTLib EHTTools.cpp SHARED LINK_LIBRARIES -lyaehmop_eht GraphMol )
+ target_compile_definitions(EHTLib PRIVATE RDKIT_EHTLIB_BUILD)
+-add_dependencies(EHTLib yaehmop_project)
+ rdkit_headers(EHTTools.h DEST GraphMol)
+ rdkit_catch_test(testEHTLib1 test1.cpp
+            LINK_LIBRARIES EHTLib FileParsers SmilesParse )
+diff --git a/External/YAeHMOP/EHTTools.cpp b/External/YAeHMOP/EHTTools.cpp
+index 7a229f51f..71033dc5c 100644
+--- a/External/YAeHMOP/EHTTools.cpp
++++ b/External/YAeHMOP/EHTTools.cpp
+@@ -10,7 +10,7 @@
+ #include <fstream>
+ 
+ extern "C" {
+-#include <yaehmop/tightbind/bind.h>
++#include <yaehmop/bind.h>
+ }
+ 
+ namespace RDKit {
-- 
2.37.0





^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 03/13] gnu: Add sajson.
  2022-10-13 20:59     ` David Elsing
@ 2022-10-14 21:30       ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-14 21:30 UTC (permalink / raw)
  To: David Elsing, 58261

Am Donnerstag, dem 13.10.2022 um 20:59 +0000 schrieb David Elsing:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> > > * gnu/packages/cpp.scm (sajson): New variable.
> > > ---
> > >  gnu/packages/cpp.scm                          | 60
> > > +++++++++++++++++++
> > >  .../patches/sajson-build-with-gcc10.patch     | 45
> > > ++++++++++++++
> > >  2 files changed, 105 insertions(+)
> > >  create mode 100644 gnu/packages/patches/sajson-build-with-
> > > gcc10.patch
> > > 
> > > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> > > index 38a2a9e829..dca0245df5 100644
> > > --- a/gnu/packages/cpp.scm
> > > +++ b/gnu/packages/cpp.scm
> > > @@ -57,6 +57,7 @@ (define-module (gnu packages cpp)
> > >    #:use-module (guix build-system gnu)
> > >    #:use-module (guix build-system meson)
> > >    #:use-module (guix build-system python)
> > > +  #:use-module (guix build-system scons)
> > >    #:use-module (guix modules)
> > >    #:use-module (guix gexp)
> > >    #:use-module (gnu packages)
> > > @@ -2005,3 +2006,62 @@ (define-public pocketfft-cpp
> > >  computing Fast Fourier transformations.  It supports
> > > multidimensional arrays,
> > >  different floating point sizes and complex transformations.")
> > >        (license license:bsd-3))))
> > > +
> > > +(define-public sajson
> > > +  (let ((commit "ec644013e34f9984a3cc9ba568cab97a391db9cd")
> > > +        (revision "0"))
> > > +    (package
> > > +      (name "sajson")
> > > +      (version (git-version "1.0" revision commit))
> > > +      (source (origin
> > > +                (method git-fetch)
> > > +                (uri (git-reference
> > > +                      (url
> > > "https://github.com/chadaustin/sajson")
> > > +                      (commit commit)))
> > > +                (file-name (git-file-name name version))
> > > +                (patches
> > > +                 (search-patches "sajson-build-with-
> > > gcc10.patch"))
> > > +                (sha256
> > > +                 (base32
> > > +                 
> > > "0fjag27w7gvkc5pdhq3ad7yc09rabpzahndw1sgsg04ipznidmmq"))
> > > +                (modules '((guix build utils)))
> > > +                (snippet '(delete-file-recursively "third-
> > > party"))))
> > > +      (build-system scons-build-system)
> > > +      (arguments
> > > +       (list
> > > +        #:phases
> > > +        #~(modify-phases %standard-phases
> > > +            (add-after 'unpack 'disable-other-builds
> > > +              (lambda _
> > > +                (substitute* "SConstruct"
> > > +                  (("for name, tools in builds:")
> > > +                   "for name, tools in [('opt', [gcc,
> > > opt])]:"))))
> > > +            (add-after 'unpack 'use-external-unittest-cpp
> > > +              (lambda* (#:key inputs #:allow-other-keys)
> > > +                (substitute* "SConscript"
> > > +                  (("unittestpp_env\\.Library") "_dummy = ")
> > > +                  (("test_env = env.Clone\\(tools=\\[unittestpp,
> > > sajson\\]\\)")
> > > +                   (string-append
> > > +                    "test_env = env.Clone(tools=[sajson])\n"
> > > +                    "test_env.Append(CPPPATH='"
> > > +                    (search-input-directory inputs
> > > "/include/UnitTest++")
> > Note that you need (or native-inputs inputs) wherever you wrote
> > inputs.
> Is %build-inputs ok?
No, we only use this in trivial-build-system and other places where we
don't have the split.
> > > +                    "', LIBPATH='"
> > > +                    (string-append #$(this-package-native-input
> > > "unittest-cpp")
> > > +                                   "/lib")
> > > +                    "', LIBS=['UnitTest++'])")))))
> > > +            (replace 'check
> > > +              (lambda* (#:key tests? #:allow-other-keys)
> > > +                (when tests?
> > > +                  (invoke "build/opt/test")
> > > +                  (invoke "build/opt/test_unsorted"))))
> > > +            (replace 'install
> > > +              (lambda _
> > > +                (let ((out (string-append #$output "/include")))
> > > +                  (install-file "include/sajson.h" out)
> > > +                  (install-file "include/sajson_ostream.h"
> > > out)))))))
> > For the record, what would a regular install do?
> Just nothing.
Fair enough.
> > > +      (native-inputs (list unittest-cpp))
> > > +      (home-page "https://github.com/chadaustin/sajson")
> > > +      (synopsis "C++11 header-only, in-place JSON parser")
> > > +      (description "@code{sajson} is an in-place JSON parser
> > > with
> > > support for
> > > +parsing with only a single memory allocation.")
> > > +      (license license:expat))))
> > > diff --git a/gnu/packages/patches/sajson-build-with-gcc10.patch
> > > b/gnu/packages/patches/sajson-build-with-gcc10.patch
> > > new file mode 100644
> > > index 0000000000..878706dc79
> > > --- /dev/null
> > > +++ b/gnu/packages/patches/sajson-build-with-gcc10.patch
> > > @@ -0,0 +1,45 @@
> > > +This patch is from the upstream pull request
> > > +https://github.com/chadaustin/sajson/pull/54.
> > > +It fixes linking with GCC.
> > > +
> > > +diff --git a/include/sajson.h b/include/sajson.h
> > > +index 8b4e05a..1bd045b 100644
> > > +--- a/include/sajson.h
> > > ++++ b/include/sajson.h
> > > +@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag
> > > t,
> > > size_t value) {
> > > + // header. This trick courtesy of Rich Geldreich's Purple JSON
> > > parser.
> > > + template <typename unused = void>
> > > + struct globals_struct {
> > > ++    static const unsigned char parse_flags[256];
> > > ++};
> > > ++typedef globals_struct<> globals;
> > > ++
> > > + // clang-format off
> > > + 
> > > +     // bit 0 (1) - set if: plain ASCII string character
> > > +     // bit 1 (2) - set if: whitespace
> > > +     // bit 4 (0x10) - set if: 0-9 e E .
> > > +-    constexpr static const uint8_t parse_flags[256] = {
> > > ++    template <typename unused>
> > > ++    const unsigned char
> > > globals_struct<unused>::parse_flags[256] =
> > > {
> > > +      // 0    1    2    3    4    5    6    7      8    9   
> > > A   
> > > B    C    D    E    F
> > > +         0,   0,   0,   0,   0,   0,   0,   0,     0,   2,  
> > > 2,  
> > > 0,   0,   2,   0,   0, // 0
> > > +         0,   0,   0,   0,   0,   0,   0,   0,     0,   0,  
> > > 0,  
> > > 0,   0,   0,   0,   0, // 1
> > > +@@ -162,15 +167,13 @@ struct globals_struct {
> > > +     };
> > > + 
> > > + // clang-format on
> > > +-};
> > > +-typedef globals_struct<> globals;
> > > + 
> > > +-constexpr inline bool is_plain_string_character(char c) {
> > > ++inline bool is_plain_string_character(char c) {
> > > +     // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
> > > +     return (globals::parse_flags[static_cast<unsigned char>(c)]
> > > &
> > > 1) != 0;
> > > + }
> > > + 
> > > +-constexpr inline bool is_whitespace(char c) {
> > > ++inline bool is_whitespace(char c) {
> > > +     // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
> > > +     return (globals::parse_flags[static_cast<unsigned char>(c)]
> > > &
> > > 2) != 0;
> > > + }


^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 06/13] gnu: Add gemmi.
  2022-10-13 21:00     ` David Elsing
@ 2022-10-14 21:32       ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-14 21:32 UTC (permalink / raw)
  To: David Elsing, 58261

Am Donnerstag, dem 13.10.2022 um 21:00 +0000 schrieb David Elsing:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> > > * gnu/packages/chemistry.scm (gemmi): New variable.
> > > ---
> > >  gnu/packages/chemistry.scm                    | 118 +++++++++++
> > >  .../patches/gemmi-fix-sajson-types.patch      |  11 +
> > >  .../sajson-for-gemmi-build-with-gcc10.patch   |  45 ++++
> > >  .../sajson-for-gemmi-numbers-as-strings.patch | 195
> > > ++++++++++++++++++
> > >  4 files changed, 369 insertions(+)
> > >  create mode 100644 gnu/packages/patches/gemmi-fix-sajson-
> > > types.patch
> > >  create mode 100644 gnu/packages/patches/sajson-for-gemmi-build-
> > > with-
> > > gcc10.patch
> > >  create mode 100644 gnu/packages/patches/sajson-for-gemmi-
> > > numbers-as-
> > > strings.patch
> > > 
> > > diff --git a/gnu/packages/chemistry.scm
> > > b/gnu/packages/chemistry.scm
> > > index c517610fe8..d8f1608a3a 100644
> > > --- a/gnu/packages/chemistry.scm
> > > +++ b/gnu/packages/chemistry.scm
> > > @@ -6,6 +6,7 @@
> > >  ;;; Copyright © 2020 Björn Höfling
> > > <bjoern.hoefling@bjoernhoefling.de>
> > >  ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
> > >  ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
> > > +;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
> > >  ;;;
> > >  ;;; This file is part of GNU Guix.
> > >  ;;;
> > > @@ -23,6 +24,7 @@
> > >  ;;; along with GNU Guix.  If not, see
> > > <http://www.gnu.org/licenses/>.
> > >  
> > >  (define-module (gnu packages chemistry)
> > > +  #:use-module (guix gexp)
> > >    #:use-module (guix packages)
> > >    #:use-module (guix utils)
> > >    #:use-module ((guix licenses) #:prefix license:)
> > > @@ -35,6 +37,7 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages boost)
> > >    #:use-module (gnu packages check)
> > >    #:use-module (gnu packages compression)
> > > +  #:use-module (gnu packages cpp)
> > >    #:use-module (gnu packages documentation)
> > >    #:use-module (gnu packages fontutils)
> > >    #:use-module (gnu packages gl)
> > > @@ -50,8 +53,10 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages qt)
> > >    #:use-module (gnu packages serialization)
> > >    #:use-module (gnu packages sphinx)
> > > +  #:use-module (gnu packages stb)
> > >    #:use-module (gnu packages xml)
> > >    #:use-module (guix build-system cmake)
> > > +  #:use-module (guix build-system copy)
> > >    #:use-module (guix build-system gnu)
> > >    #:use-module (guix build-system python))
> > >  
> > > @@ -566,3 +571,116 @@ (define-public python-pymol
> > >  used to prepare publication-quality figures, to share
> > > interactive
> > > results with
> > >  your colleagues, or to generate pre-rendered animations.")
> > >      (license license:bsd-3)))
> > > +
> > > +(define-public sajson-for-gemmi
> > > +  (package/inherit sajson
> > > +    (name "sajson-for-gemmi")
> > > +    (source (origin
> > > +              (inherit (package-source sajson))
> > > +              (patches (search-patches
> > > +                        "sajson-for-gemmi-numbers-as-
> > > strings.patch"
> > > +                        "sajson-for-gemmi-build-with-
> > > gcc10.patch"))))
> > > +    (arguments
> > > +     (substitute-keyword-arguments (package-arguments sajson)
> > > +       ((#:tests? _ #f) #f)
> > Don't forget the comment as to why they're disabled.
> > > +       ((#:phases phases)
> > > +        #~(modify-phases #$phases
> > > +            (delete 'build)))))))
> > Why is the build deleted?
> It fails due to the change and only builds the tests anyway.
> > 
> > Split here.
> > > +(define-public gemmi
> > > +  (package
> > > +    (name "gemmi")
> > > +    (version "0.5.7")
> > > +    (source (origin
> > > +              (method git-fetch)
> > > +              (uri (git-reference
> > > +                    (url
> > > "https://github.com/project-gemmi/gemmi")
> > > +                    (commit (string-append "v" version))))
> > > +              (file-name (git-file-name name version))
> > > +              (sha256
> > > +               (base32
> > > +               
> > > "00km5q726bslrw7xbfwb3f3mrsk19qbimfnl3hvr4wi1y3z8i18a"))
> > > +              (patches
> > > +               (search-patches "gemmi-fix-sajson-types.patch"))
> > > +              (modules '((guix build utils)))
> > > +              (snippet
> > > +               '(begin
> > > +                  (delete-file-recursively
> > > "include/gemmi/third_party")
> > > +                  (delete-file-recursively "third_party")))))
> > > +    (outputs '("out" "bin" "python"))
> > > +    (build-system cmake-build-system)
> > > +    (native-inputs
> > > +     (list fast-float
> > > +           optionparser
> > > +           pegtl
> > > +           pocketfft-cpp
> > > +           pybind11
> > > +           sajson-for-gemmi
> > > +           stb-sprintf
> > > +           tinydir))
> > > +    (inputs (list python zlib))
> > > +    (arguments
> > > +     (list
> > > +      #:configure-flags
> > > +      #~(let* ((python-lib
> > > +                (string-append
> > > +                 #$output:python "/lib/python"
> > > +                 #$(version-major+minor (package-version
> > > python))
> > > +                 "/site-packages")))
> > Note that python-build-system has a (site-packages) procedure. 
> > Writing
> > the boilerplate to include it in the build shouldn't be much worse
> > in
> > terms of lines than what you're doing here.
> > > +          (list "-DUSE_PYTHON=ON"
> > > +                (string-append "-DPYTHON_INSTALL_DIR=" python-
> > > lib)))
> > > +      #:phases
> > > +      #~(modify-phases %standard-phases
> > > +          (add-after 'unpack 'patch-includes
> > > +            (lambda _
> > > +              (substitute* "include/gemmi/sprintf.hpp"
> > > +                (("<stb/stb_sprintf.h>") "<stb_sprintf.h>"))
> > > +              (substitute* "include/gemmi/dirwalk.hpp"
> > > +                (("\"third_party/tinydir.h\"") "<tinydir.h>"))
> > > +              (substitute* "include/gemmi/cif.hpp"
> > > +                (("\"third_party/tao/pegtl.hpp\"")
> > > "<tao/pegtl.hpp>"))
> > > +              (substitute* "include/gemmi/json.hpp"
> > > +                (("\"third_party/sajson.h\"") "<sajson.h>"))
> > > +              (substitute* "python/gemmi.cpp"
> > > +               
> > > (("\"gemmi/third_party/tao/pegtl/parse_error.hpp\"")
> > > +                 "<tao/pegtl/parse_error.hpp>"))
> > > +              (substitute* '("include/gemmi/atof.hpp"
> > > +                             "include/gemmi/numb.hpp")
> > > +                (("\"third_party/fast_float.h\"")
> > > +                 "<fast_float/fast_float.h>"))
> > > +              (substitute* "include/gemmi/fourier.hpp"
> > > +                (("\"third_party/pocketfft_hdronly.h\"")
> > > +                 "<pocketfft_hdronly.h>"))))
> > I'd collect all the files into a (list ...) and then write out the
> > substitutes.
> Is it preferred to put list elements on separate lines (also in
> inputs)?
> 
Depends on the length, but in this case I'd say yes.
However, if things neatly fit into one line, you don't have to add a
new line.

Cheers

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v2 10/13] gnu: Add yaehmop-tightbind.
  2022-10-13 21:00     ` David Elsing
@ 2022-10-14 21:33       ` Liliana Marie Prikler
  0 siblings, 0 replies; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-14 21:33 UTC (permalink / raw)
  To: David Elsing, 58261

Am Donnerstag, dem 13.10.2022 um 21:00 +0000 schrieb David Elsing:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> > > * gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
> > Don't forget to update the ChangeLog.
> Ah thanks. :)
> > > ---
> > >  gnu/packages/chemistry.scm | 110
> > > +++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 110 insertions(+)
> > > 
> > > diff --git a/gnu/packages/chemistry.scm
> > > b/gnu/packages/chemistry.scm
> > > index 1510cbab41..68d28a52c3 100644
> > > --- a/gnu/packages/chemistry.scm
> > > +++ b/gnu/packages/chemistry.scm
> > > @@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages documentation)
> > >    #:use-module (gnu packages flex)
> > >    #:use-module (gnu packages fontutils)
> > > +  #:use-module (gnu packages gcc)
> > >    #:use-module (gnu packages gl)
> > >    #:use-module (gnu packages graphviz)
> > >    #:use-module (gnu packages gv)
> > > @@ -56,6 +57,7 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages serialization)
> > >    #:use-module (gnu packages sphinx)
> > >    #:use-module (gnu packages stb)
> > > +  #:use-module (gnu packages tex)
> > >    #:use-module (gnu packages web)
> > >    #:use-module (gnu packages xml)
> > >    #:use-module (guix build-system cmake)
> > > @@ -818,3 +820,111 @@ (define-public coordgenlibs
> > >      (description "@code{coordgenlibs} contains algorithms to
> > > generate 2D
> > >  coordinates.  It has an emphasis on quality rather than speed.")
> > >      (license license:bsd-3)))
> > > +
> > > +(define-public yaehmop
> > > +  (package
> > > +    (name "yaehmop")
> > > +    (version "2022.09.1")
> > > +    (source (origin
> > > +              (method git-fetch)
> > > +              (uri (git-reference
> > > +                    (url
> > > "https://github.com/greglandrum/yaehmop")
> > > +                    (commit (string-append "v" version))))
> > > +              (file-name (git-file-name name version))
> > > +              (sha256
> > > +               (base32
> > > +               
> > > "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
> > > +              (modules '((guix build utils)))
> > > +              (snippet
> > > +               '(begin
> > > +                  ;; Separate program
> > > +                  (delete-file-recursively "viewkel")
> > > +                  ;; Remove example output (some are corrupted)
> > > +                  (for-each delete-file (find-files "examples"
> > > "\\.Z$"))
> > > +                  ;; Documentation outputs
> > > +                  (for-each delete-file (find-files "docs"
> > > "\\.(ps|pdf)$"))
> > > +                  ;; These are transpiled from Fortran to C, but
> > > we
> > > build the
> > > +                  ;; Fortran code instead
> > > +                  (delete-file-recursively
> > > "tightbind/f2c_files")
> > > +                  (delete-file "tightbind/diag.c")
> > > +                  (delete-file "tightbind/cboris.c")
> > > +                  (delete-file "tightbind/abfns.c")
> > > +                  (delete-file "tightbind/lovlap.c")))))
> > > +    (build-system cmake-build-system)
> > > +    (arguments
> > > +     (list
> > > +      #:configure-flags
> > > +      #~(list
> > > +         "-DUSE_BLAS_LAPACK=ON"
> > > +         (string-append "-DPARM_FILE_LOC=" #$output
> > > +                        "/share/" #$name "-" #$version
> > > "/eht_parms.dat")
> > > +         "-DBIND_EXE_NAME=yaehmop-bind")
> > > +      #:phases
> > > +      #~(modify-phases %standard-phases
> > > +          (add-after 'unpack 'chdir
> > > +            (lambda _
> > > +              (chdir "tightbind")))
> > > +          (add-after 'chdir 'patch-fortran-functions
> > > +            (lambda _
> > > +              (substitute* '("mov.c" "prototypes.h")
> > > +                (("lovlap\\(") "lovlap_(")
> > > +                (("abfns\\(") "abfns_("))))
> > > +          (add-after 'chdir 'patch-cmake
> > > +            (lambda _
> > > +              (substitute* "CMakeLists.txt"
> > > +                (("project\\(yaehmop C\\)") "project(yaehmop C
> > > Fortran)")
> > > +                (("abfns.c") "fortran77/abfns.f")
> > > +                (("lovlap.c") "fortran77/lovlap.f")
> > > +                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
> > > +                 (string-append init " CACHE STRING \"\")"))
> > > +                (("add_library\\(yaehmop_eht" lib)
> > > +                 (string-append lib " SHARED "))
> > > +                (("target_link_libraries\\(test_eht
> > > \\$\\{LAPACK_LIBRARIES\\}.*"
> > > +                  all)
> > > +                 (string-append all
> > > "\ntarget_link_libraries(yaehmop_eht "
> > > +                                "${LAPACK_LIBRARIES})\n")))))
> > > +          (add-after 'build 'fix-latex
> > > +            (lambda _
> > > +              (chdir "../docs")
> > > +              (substitute* "bind_manual.tex"
> > > +                (("\\\\usepackage\\{bindpage\\}")
> > > +                 (string-append
> > > +                 
> > > "\\usepackage[left=2cm,right=2cm,top=4cm,bottom=2cm]"
> > > +                  "{geometry}")))
> > > +              (substitute* "Zmat_appendix.tex"
> > > +                (("file=dihedral\\.eps")
> > > +                 "file=figs/dihedral.eps"))))
> > > +          (add-after 'fix-latex 'build-doc
> > > +            (lambda _
> > > +              ;; TODO: not reproducible
> > > +              (setenv "FORCE_SOURCE_DATE" "1")
> > > +              ;; Needs to run twice to compile completely
> > > +              (invoke "pdflatex" "bind_manual.tex")
> > > +              (invoke "pdflatex" "bind_manual.tex")
> > > +              (chdir "../build")))
> > Note that we have rubber to automate building PDFs.  Also prefer
> > "with-
> > directory-excursion" over chdir where possible.
> I used latexmk as it's already included in texlive-bin
> (it is also reproducible with \pdfsuppressptexinfo=-1).
> > > +          (add-after 'install 'install-eht-parms
> > > +            (lambda _
> > > +              (install-file "../tightbind/eht_parms.dat"
> > > +                            (string-append #$output "/share/"
> > > +                                           #$name "-"
> > > #$version))))
> > > +          (add-after 'install-eht-parms 'install-doc
> > > +            (lambda _
> > > +              (install-file "../docs/bind_manual.pdf"
> > > +                            (string-append #$output
> > > "/share/doc/"
> > > +                                           #$name "-"
> > > #$version))))
> > > +          (delete 'check)
> > > +          (add-after 'install-doc 'check
> > > +            (lambda* (#:key tests? #:allow-other-keys)
> > > +              (when tests?
> > > +                (invoke "./test_eht")))))))
> > > +    (native-inputs
> > > +     `(("gfortran" ,gfortran)
> > > +       ("texlive" ,(texlive-updmap.cfg (list texlive-fonts-ec
> > > +                                             texlive-latex-
> > > graphics
> > > +                                             texlive-latex-
> > > geometry)))))
> > I think you can do without labels here (see my comment regarding
> > rubber).
> > > +    (inputs (list openblas))
> > > +    (home-page "https://github.com/greglandrum/yaehmop")
> > > +    (synopsis "Yet Another extended Hueckel Molecular Orbital
> > > Package")
> > You can use this as an @acronym in the description.  For the
> > synopsis,
> > I'd use something else, e.g. "Perform Hückel calculations".
> > > +    (description "@code{YAeHMOP} contains a program and library
> > > for
> > > performing
> > > +extended Hückel calculations.")
> > I recommend adding "and analyzing and visualizing the results."
> > (see
> > plug_it.tex)
> The visualization program is not built, so maybe without visualizing?
SGTM


^ permalink raw reply	[flat|nested] 87+ messages in thread

* bug#58261: [PATCH v3 00/15] Add rdkit v3.
  2022-10-13 21:04   ` [bug#58261] [PATCH v3 00/15] Add rdkit v3 David Elsing
@ 2022-10-15 14:37     ` Liliana Marie Prikler
  2022-10-17  9:55       ` [bug#58261] " David Elsing
  0 siblings, 1 reply; 87+ messages in thread
From: Liliana Marie Prikler @ 2022-10-15 14:37 UTC (permalink / raw)
  To: David Elsing, 58261-done

Am Donnerstag, dem 13.10.2022 um 21:04 +0000 schrieb David Elsing:
> Thanks again for your comments! Here is the next version. :)
> Now all packages were reproducible again after two rounds.
I've made some adjustments – some cosmetic, some otherwise – and pushed
this series.

Cheers




^ permalink raw reply	[flat|nested] 87+ messages in thread

* [bug#58261] [PATCH v3 00/15] Add rdkit v3.
  2022-10-15 14:37     ` bug#58261: " Liliana Marie Prikler
@ 2022-10-17  9:55       ` David Elsing
  0 siblings, 0 replies; 87+ messages in thread
From: David Elsing @ 2022-10-17  9:55 UTC (permalink / raw)
  To: Liliana Marie Prikler, 58261-done

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Donnerstag, dem 13.10.2022 um 21:04 +0000 schrieb David Elsing:
>> Thanks again for your comments! Here is the next version. :)
>> Now all packages were reproducible again after two rounds.
> I've made some adjustments – some cosmetic, some otherwise – and pushed
> this series.
>
> Cheers
Thank you!
I'll see whether I can find the reason some tests in freesasa fail on
i686, but it was possible to reproduce them at least.




^ permalink raw reply	[flat|nested] 87+ messages in thread

end of thread, other threads:[~2022-10-17  9:56 UTC | newest]

Thread overview: 87+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-02 22:55 [bug#58261] [PATCH 00/11] Add rdkit David Elsing
2022-10-03  0:19 ` [bug#58261] [PATCH 01/11] gnu: Add fast-float David Elsing
2022-10-04  6:57   ` Liliana Marie Prikler via Guix-patches via
2022-10-07 15:08     ` David Elsing
2022-10-03  0:19 ` [bug#58261] [PATCH 02/11] gnu: Add pocketfft David Elsing
2022-10-04  7:09   ` Liliana Marie Prikler
2022-10-07 15:10     ` David Elsing
2022-10-03  0:19 ` [bug#58261] [PATCH 03/11] gnu: Add sajson David Elsing
2022-10-04  7:22   ` Liliana Marie Prikler
2022-10-07 15:10     ` David Elsing
2022-10-03  0:19 ` [bug#58261] [PATCH 04/11] gnu: Add tinydir David Elsing
2022-10-04  7:27   ` Liliana Marie Prikler
2022-10-07 15:11     ` David Elsing
2022-10-07 15:13       ` Liliana Marie Prikler
2022-10-03  0:19 ` [bug#58261] [PATCH 05/11] gnu: Add optionparser David Elsing
2022-10-04  7:42   ` Liliana Marie Prikler
2022-10-07 15:11     ` David Elsing
2022-10-03  0:19 ` [bug#58261] [PATCH 06/11] gnu: Add gemmi David Elsing
2022-10-04  7:49   ` Liliana Marie Prikler
2022-10-07 15:11     ` David Elsing
2022-10-07 15:17       ` Liliana Marie Prikler
2022-10-03  0:19 ` [bug#58261] [PATCH 07/11] gnu: Add freesasa David Elsing
2022-10-04  8:02   ` Liliana Marie Prikler
2022-10-07 15:12     ` David Elsing
2022-10-07 15:19       ` Liliana Marie Prikler
2022-10-03  0:19 ` [bug#58261] [PATCH 08/11] gnu: Add maeparser David Elsing
2022-10-03  0:19 ` [bug#58261] [PATCH 09/11] gnu: Add coordgenlibs David Elsing
2022-10-03  0:19 ` [bug#58261] [PATCH 10/11] gnu: Add yaehmop-tightbind David Elsing
2022-10-04  7:54   ` Liliana Marie Prikler
2022-10-07 15:12     ` David Elsing
2022-10-07 15:25       ` Liliana Marie Prikler
2022-10-03  0:19 ` [bug#58261] [PATCH 11/11] gnu: Add rdkit David Elsing
2022-10-04  8:13   ` Liliana Marie Prikler
2022-10-07 15:12     ` David Elsing
2022-10-07 15:29       ` Liliana Marie Prikler
2022-10-07 15:21 ` [bug#58261] [PATCH v2 00/13] Add rdkit v2 David Elsing
2022-10-09 10:02   ` Liliana Marie Prikler
2022-10-13 20:58     ` David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 00/15] Add rdkit v3 David Elsing
2022-10-15 14:37     ` bug#58261: " Liliana Marie Prikler
2022-10-17  9:55       ` [bug#58261] " David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 01/15] gnu: Add fast-float David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 02/15] gnu: Add pocketfft-cpp David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 03/15] gnu: Add sajson David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 04/15] gnu: Add cbehave David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 05/15] gnu: Add tinydir David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 06/15] gnu: Add optionparser David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 07/15] gnu: Add sajson-for-gemmi David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 08/15] gnu: Add gemmi David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 09/15] gnu: Add freesasa David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 10/15] gnu: Add maeparser David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 11/15] gnu: Add coordgenlibs David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 12/15] gnu: Add yaehmop David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 13/15] gnu: Add avalon-toolkit David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 14/15] gnu: Add ringdecomposerlib David Elsing
2022-10-13 21:04   ` [bug#58261] [PATCH v3 15/15] gnu: Add rdkit David Elsing
2022-10-07 15:21 ` [bug#58261] [PATCH v2 01/13] gnu: Add fast-float David Elsing
2022-10-09 10:04   ` Liliana Marie Prikler
2022-10-07 15:21 ` [bug#58261] [PATCH v2 02/13] gnu: Add pocketfft David Elsing
2022-10-09 11:42   ` Liliana Marie Prikler
2022-10-07 15:21 ` [bug#58261] [PATCH v2 03/13] gnu: Add sajson David Elsing
2022-10-09 11:46   ` Liliana Marie Prikler
2022-10-13 20:59     ` David Elsing
2022-10-14 21:30       ` Liliana Marie Prikler
2022-10-07 15:21 ` [bug#58261] [PATCH v2 04/13] gnu: Add tinydir David Elsing
2022-10-09 11:48   ` Liliana Marie Prikler
2022-10-07 15:21 ` [bug#58261] [PATCH v2 05/13] gnu: Add optionparser David Elsing
2022-10-07 15:21 ` [bug#58261] [PATCH v2 06/13] gnu: Add gemmi David Elsing
2022-10-09 11:54   ` Liliana Marie Prikler
2022-10-13 21:00     ` David Elsing
2022-10-14 21:32       ` Liliana Marie Prikler
2022-10-07 15:21 ` [bug#58261] [PATCH v2 07/13] gnu: Add freesasa David Elsing
2022-10-07 15:21 ` [bug#58261] [PATCH v2 08/13] gnu: Add maeparser David Elsing
2022-10-07 15:21 ` [bug#58261] [PATCH v2 09/13] gnu: Add coordgenlibs David Elsing
2022-10-09 11:56   ` Liliana Marie Prikler
2022-10-13 21:00     ` David Elsing
2022-10-07 15:21 ` [bug#58261] [PATCH v2 10/13] gnu: Add yaehmop-tightbind David Elsing
2022-10-09 12:02   ` Liliana Marie Prikler
2022-10-13 21:00     ` David Elsing
2022-10-14 21:33       ` Liliana Marie Prikler
2022-10-07 15:21 ` [bug#58261] [PATCH v2 11/13] gnu: Add avalontoolkit David Elsing
2022-10-09 12:06   ` Liliana Marie Prikler
2022-10-13 21:01     ` David Elsing
2022-10-07 15:22 ` [bug#58261] [PATCH v2 12/13] gnu: Add ringdecomposerlib David Elsing
2022-10-07 15:22 ` [bug#58261] [PATCH v2 13/13] gnu: Add rdkit David Elsing
2022-10-09 12:12   ` Liliana Marie Prikler
2022-10-13 21:01     ` David Elsing

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.