2021-11-02 22:43:20 +01:00
|
|
|
(define-module (glicid utils)
|
2022-11-24 13:03:48 +01:00
|
|
|
#:use-module (guix packages)
|
|
|
|
#:use-module (guix transformations)
|
|
|
|
#:use-module (guix utils)
|
|
|
|
#:use-module (gnu packages gcc)
|
|
|
|
#:use-module (glicid packages gcc)
|
|
|
|
#:use-module (gnu packages commencement)
|
|
|
|
#:use-module (gnu packages)
|
2022-11-24 13:30:05 +01:00
|
|
|
#:export (
|
|
|
|
latest-version
|
|
|
|
gcc11-instead-of-gcc
|
|
|
|
transform-package
|
|
|
|
instead-of
|
|
|
|
touch
|
|
|
|
))
|
2022-11-24 14:13:55 +01:00
|
|
|
|
2022-05-10 10:00:46 +02:00
|
|
|
(define (latest-version v1 v2)
|
2022-11-24 13:03:48 +01:00
|
|
|
(case (version-compare (package-version v1) (package-version v2))
|
|
|
|
((>) v1)
|
|
|
|
((=) v1)
|
|
|
|
((<) v2)))
|
2022-05-10 10:00:46 +02:00
|
|
|
|
|
|
|
(define gcc11-instead-of-gcc
|
2022-11-24 13:03:48 +01:00
|
|
|
(package-input-rewriting
|
|
|
|
`((,gcc-toolchain . ,gcc-toolchain-11)
|
|
|
|
(,gfortran-toolchain . ,gfortran-toolchain-11)
|
|
|
|
)))
|
2022-05-10 10:00:46 +02:00
|
|
|
|
|
|
|
(define (transform-package original-package suffix)
|
|
|
|
(package
|
|
|
|
(inherit original-package)
|
2022-11-24 13:03:48 +01:00
|
|
|
(name (string-append (package-name original-package) "-" suffix ))))
|
2021-11-02 22:23:00 +01:00
|
|
|
|
2022-05-10 10:00:46 +02:00
|
|
|
(define (instead-of package-a-spec package-b)
|
2022-11-24 14:13:55 +01:00
|
|
|
(package-input-rewriting/spec `( (,package-a-spec . ,(const package-b)))))
|
2022-11-24 13:30:05 +01:00
|
|
|
|
|
|
|
(define (touch filename)
|
2022-11-24 14:13:55 +01:00
|
|
|
(call-with-output-file file-name (const #t)))
|