Subject: [bug#58261] [PATCH v2 11/13] gnu: Add avalontoolkit.

From: Liliana Marie Prikler <[email-masked]>
Date: Sun, 09 Oct 2022 14:06:02 +0200

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)))