help-guix
[Top][All Lists]
Advanced

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

How to copy a file to the package /bin folder using the r-build-system?


From: Kyle Andrews
Subject: How to copy a file to the package /bin folder using the r-build-system?
Date: Fri, 31 Mar 2023 23:21:18 +0000

Dear Guix,

I want to package the littler R package.

Unlike most R packages, this one provides an executable (a little r to
complement the big R) that should go on the PATH rather than be tucked
away into site-library where it cannot be used. Surprisingly, to me,
when the command below fails ...

```
guix build -K -f littler.scm
```

... the resulting temporary directory skips directly to the littler
folder wheras the /gnu/store builds show the output inside of
site-library. The /tmp output also looks different, lacking a bin/
folder like in the /gnu/store/*littlr* builds.

How do I go about getting r out of site-library/littler/bin/r in there
using the r-build-system?

Here is what I have right now:

```
(use-modules
 (guix packages)
 (guix download)
 (gnu packages statistics)
 (gnu packages compression)
 (gnu packages icu4c)
 (guix gexp)
 (guix build-system r)
 (gnu packages cran)
 (gnu packages autotools)
 ((guix licenses) #:prefix license:))

(define-public r-littler
  (package
    (name "r-littler")
    (version "0.3.18")
    (source (origin
              (method url-fetch)
              (uri (cran-uri "littler" version))
              (sha256
               (base32
                "1lp6a62g3yhzr4pv9kynibv7k9pd546w6hifs1aficyxbyg4dgqq"))))
    (properties `((upstream-name . "littler")))
    (build-system r-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'install 'add-to-path
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
                ;;; TODO: this doesn't work!
                ;; copy site-library/littler/bin/r to bin/r
                (copy-file
                 (string-append out "site-library/littler/src/r")
                 (string-append out "/bin/r"))))))))
    (inputs (list icu4c))
    (native-inputs (list r-simplermarkdown automake autoconf zlib))
    (home-page "https://github.com/eddelbuettel/littler";)
    (synopsis "R at the Command-Line via 'r'")
    (description
     "This package provides a scripting and command-line front-end is provided 
by r
(aka littler') as a lightweight binary wrapper around the GNU R language and
environment for statistical computing and graphics.  While R can be used in
batch mode, the r binary adds full support for both shebang'-style scripting
(i.e.  using a hash-mark-exclamation-path expression as the first line in
scripts) as well as command-line use in standard Unix pipelines.  In other
words, r provides the R language without the environment.")
    (license license:gpl2+)))

;; (packages->manifest (list r r-littler))

r-littler
```

I'm grateful for any assistance!

Best Regards,
Kyle



reply via email to

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