guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#28802] [PATCH] gnu: Add paml.


From: Ricardo Wurmus
Subject: [bug#28802] [PATCH] gnu: Add paml.
Date: Fri, 13 Oct 2017 15:25:34 +0200
User-agent: mu4e 0.9.18; emacs 25.2.1

Hi Roel,

> I guess I'm too late already.  I had a similar patch, but the program
> uses the data files it ships with, and expects them to be in the same
> location.  So this patch seems incomplete to me.

Oh, that’s too bad.  Do you have a test case we could use to verify that
the tools work correctly after installation?

It doesn’t seem to be easy to fix this, as variables in which file names
are stored are size-restricted, and as they are copied around multiple
times it is difficult to ensure that our patch wouldn’t break things.

Here’s an untested draft of the new phases, but I suspect this would
take a lot more work:

--8<---------------cut here---------------start------------->8---
       (modify-phases %standard-phases
         (replace 'configure
           (lambda _
             (substitute* "src/BFdriver.c"
               (("/bin/bash") (which "bash")))
             (let ((share (string-append (assoc-ref outputs "out")
                                         "/share/paml/")))
               (substitute* ""
                 (("aaRatefile = dat/jones.dat"
                   (string-append "aaRatefile = "
                                  share "jones.dat"))))
               (substitute* '("src/yn00.c"
                              "src/baseml.c"
                              "src/basemlg.c"
                              "src/pamp.c"
                              "src/codeml.c"
                              "src/mcmctree.c"
                              "src/BFdriver.c")
                 (("ctlf\\[...?\\] ?= 
?\"(yn00|pamp|baseml|codeml|mcmctree).ctl\"" _ file)
                  (string-append "ctlf[PATH_MAX]=\""
                                 share file ".ctl\"")))
               (substitute* "src/codeml.c"
                 (("strcpy\\(com.daafile, \"jones.dat\"\\)")
                  (string-append "strcpy(com.daafile, \""
                                 share "jones.dat\")")))
               (substitute* "src/evolver.c"
                 (("char 
\\*MCctlf0\\[\\]=\\{\"MCbase.dat\",\"MCcodon.dat\",\"MCaa.dat\"\\}")
                  (string-append "char *MCctlf0[]={"
                                 (string-join
                                  (map (lambda (f)
                                         (string-append "\"" share f "\""))
                                       '("MCbase.dat" "MCcodon.dat" "MCaa.dat"))
                                  ",")
                                 "}"))))
             (chdir "src")
             #t))
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((tools '("baseml" "basemlg" "codeml"
                            "pamp" "evolver" "yn00" "chi2"))
                   (bin    (string-append (assoc-ref outputs "out") "/bin"))
                   (docdir (string-append (assoc-ref outputs "out")
                                          "/share/doc/paml"))
                   (share  (string-append (assoc-ref outputs "out")
                                          "/share/paml"))
                   (data   (append (find-files ".." "\\.(ctl|dat)$")
                                   (find-files "../dat" "\\.dat$"))))
               (mkdir-p bin)
               (for-each (lambda (file) (install-file file bin)) tools)
               (for-each (lambda (file) (install-file file share)) data)
               (copy-recursively "../doc" docdir)
               #t))))
--8<---------------cut here---------------end--------------->8---

The alternative is to just install the data files to $out/share/paml and
expect users to copy them to their current working directory.  That
seems to work.

I prefer this over patching the code, which is much too invasive.

What do you think?

-- Ricardo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]