123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- (define-module (guix build-system)
- #:use-module (guix records)
- #:use-module (srfi srfi-1)
- #:use-module (ice-9 match)
- #:export (build-system
- build-system?
- build-system-name
- build-system-description
- build-system-lower
- bag
- bag?
- bag-name
- bag-system
- bag-target
- bag-build-inputs
- bag-host-inputs
- bag-target-inputs
- bag-outputs
- bag-arguments
- bag-build
- make-bag
- build-system-with-c-toolchain))
- (define-record-type* <build-system> build-system make-build-system
- build-system?
- (name build-system-name)
- (description build-system-description)
- (lower build-system-lower))
- (define-record-type* <bag> bag %make-bag
- bag?
- (name bag-name)
- (system bag-system)
- (target bag-target
- (default #f))
-
-
- (build-inputs bag-build-inputs
- (default '()))
- (host-inputs bag-host-inputs
- (default '()))
-
-
-
-
-
-
- (target-inputs bag-target-inputs
- (default '()))
- (outputs bag-outputs
- (default '("out")))
- (arguments bag-arguments
- (default '()))
- (build bag-build))
- (define* (make-bag build-system name
- #:key source (inputs '()) (native-inputs '())
- (outputs '()) (arguments '())
- system target)
- "Ask BUILD-SYSTEM to return a 'bag' for NAME, with the given SOURCE,
- INPUTS, NATIVE-INPUTS, OUTPUTS, and additional ARGUMENTS. If TARGET is not
- #f, it must be a string with the GNU triplet of a cross-compilation target.
- This is the mechanism by which a package is \"lowered\" to a bag, which is the
- intermediate representation just above derivations."
- (match build-system
- (($ <build-system> _ description lower)
- (apply lower name
- #:system system
- #:source source
- #:inputs inputs
- #:native-inputs native-inputs
- #:outputs outputs
- #:target target
- arguments))))
- (define (build-system-with-c-toolchain bs toolchain)
- "Return a variant of BS, a build system, that uses TOOLCHAIN instead of the
- default GNU C/C++ toolchain. TOOLCHAIN must be a list of
- inputs (label/package tuples) providing equivalent functionality, such as the
- 'gcc-toolchain' package."
- (define lower
- (build-system-lower bs))
- (define toolchain-packages
-
-
-
- '("gcc" "binutils" "libc" "libc:static" "ld-wrapper"))
- (define (lower* . args)
- (let ((lowered (apply lower args)))
- (bag
- (inherit lowered)
- (build-inputs
- (append (fold alist-delete
- (bag-build-inputs lowered)
- toolchain-packages)
- toolchain)))))
- (build-system
- (inherit bs)
- (lower lower*)))
|