zilch-cli-rust: provide default overrides
This commit is contained in:
parent
56ab2a7b71
commit
071bc48a8b
3 changed files with 47 additions and 2 deletions
|
|
@ -1,5 +1,8 @@
|
|||
(import (scheme base) (scheme write) (zilch statusbar) (zilch nix daemon) (zilch magic) (zilch lib getopt) (scheme process-context) (chicken process-context) (srfi 146) (chicken port) (chicken foreign) (chicken condition))
|
||||
(foreign-declare "#include <sched.h>")
|
||||
(foreign-declare "#include \"stock_overrides.h\"")
|
||||
(define stock-overrides (foreign-value "stock_overrides" nonnull-c-string))
|
||||
|
||||
(define get-cpu-count
|
||||
(foreign-lambda* int ()
|
||||
"cpu_set_t set; sched_getaffinity(0, sizeof(set), &set); C_return(CPU_COUNT(&set));"))
|
||||
|
|
@ -26,6 +29,9 @@ executables in the crate, if unspecified)
|
|||
the upstream module. Can be specified more
|
||||
than once.
|
||||
-z, --overrides PATH Read build script overrides from this file.
|
||||
By default, a stock set of overrides is read.
|
||||
This can be disabled by passing `-z \"\"`
|
||||
(a blank string).
|
||||
|
||||
--debug Crash on the first error, rather than
|
||||
continuing with the next package.
|
||||
|
|
@ -156,9 +162,14 @@ executables in the crate, if unspecified)
|
|||
(set! rustc-overrides (mapping-set! rustc-overrides crate-name (parse-inner rustc))))
|
||||
(vector->list data)))
|
||||
|
||||
|
||||
; If we have no request to disable stock overrides, apply them.
|
||||
(unless (member '(overrides "") options)
|
||||
(process-overrides (call-with-port (open-input-string stock-overrides) json-read)))
|
||||
|
||||
(for-each
|
||||
(lambda (kv)
|
||||
(when (eq? (car kv) 'overrides) (process-overrides (call-with-input-file (cdr kv) json-read))))
|
||||
(when (eq? (car kv) 'overrides) (unless (string=? (cdr kv) "") (process-overrides (call-with-input-file (cdr kv) json-read)))))
|
||||
options)
|
||||
|
||||
(define (build-script-env-overrides crate-name is-dependency)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue