Subject: [bug#58261] [PATCH 10/11] gnu: Add yaehmop-tightbind.

From: David Elsing <[email-masked]>
Date: Fri, 07 Oct 2022 15:12:25 +0000

Liliana Marie Prikler <[email-masked]> 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.