unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Add external data to a package
@ 2024-11-12 16:14 Aristide Doussot
  2024-11-12 19:30 ` Julian Flake
  0 siblings, 1 reply; 3+ messages in thread
From: Aristide Doussot @ 2024-11-12 16:14 UTC (permalink / raw)
  To: help-guix

Hello,

     I am new to Guix and want to add data from an external source to my 
package build. More precisely, I am trying to install the library 
casacore and need to add data in its subdirectory share/casacore/data. I 
can download these data as tar via ftp. For now, my code looks like this :

"
(defineWSRT_Measures
(origin
(method url-fetch)
(uri "[...not sure I can disclose...]/WSRT_Measures.ztar")
(sha256
(base32 "1d9qlcmkpsnw8wm7sidp17iwd2d771nsgjwwp568886g5f239a8k"))
)
)
(define-public casacore
(package
(name "casacore")
(version "3.5.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/casacore/casacore.git")
(recursive? #t)
(commit "v3.5.0")))
(file-name (git-file-name name version))
(sha256 (base32 "0zw70slc3681mnadg169avjg7d3jwn1x49xn0022207blcig8g2l"))))
(inputs
(listfftwf fftw openblas boost gcc-toolchain git gsl lapack 
gfortran-toolchain readline flex bison cfitsio wcslib python python-numpy
))
(build-system cmake-build-system)
(arguments (list
#:configure-flags #~(list"-DHELLO_WHO=Guix""-DBUILD_DYSCO=ON")
#:build-type "Release"
#:tests? #f;; some test are failing due to lack of data that are 
downloable via ftp for now testing is disable
#:parallel-build? #t;; TODO : check if it makes a difference in building 
time
#:phases
#~(modify-phases %standard-phases
(add-after 'install'install-data
(lambda* (#:key inputs outputs #:allow-other-keys)
(let*(
(out (assoc-ref outputs "out"))
(data (list-ref(find-files "/gnu/store""WSRT_Measures.ztar")0))
(share-dir (string-append out "/share/casacore/data/"))
)
(mkdir-p share-dir)
(invoke "tar""-xzf"data "-C"share-dir)
#t))))
))
(home-page "http://casacore.github.io/casacore/")
(synopsis "")
(description "A suite of C++ libraries for radio astronomy data 
processing.")
(license license:gpl2+)))

"


And it seems to work but I am sure there are far better ways to do this 
than my "take the first element of an overall find-files on 
/gnu/store/". Can someone teach me these better ways ?

Thanks,
Aristide Doussot

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

end of thread, other threads:[~2024-11-13  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12 16:14 Add external data to a package Aristide Doussot
2024-11-12 19:30 ` Julian Flake
2024-11-13  8:34   ` Parnikkapore via

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).