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,4 +1,4 @@
|
|||
{ pkgs, eggDerivation, chickenPackages }:
|
||||
{ pkgs, eggDerivation, chickenPackages, xxd }:
|
||||
eggDerivation {
|
||||
name = "zilch-cli";
|
||||
src = ./.;
|
||||
|
|
@ -9,4 +9,8 @@ eggDerivation {
|
|||
(pkgs.callPackage ../lang/go {})
|
||||
(pkgs.callPackage ../lang/rust {})
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
(cat ${./overrides.json}; printf '\0') | ${xxd}/bin/xxd -i -n stock_overrides > stock_overrides.h
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
30
cli/overrides.json
Normal file
30
cli/overrides.json
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"cc": { "buildScriptDependency": { "PATH": "${pkgs.gcc}/bin" } },
|
||||
"attic": { "buildScript": { "NIX_INCLUDE_PATH": "${pkgs.nix.dev}/include", "_zilch_pkgconfig": "${pkgs.nix.dev}" } },
|
||||
"pkg-config": { "buildScriptDependency": { "PATH": "${pkgs.pkg-config}/bin" } },
|
||||
"openssl-sys": { "buildScript": { "PATH": "${pkgs.gcc}/bin", "_zilch_pkgconfig": "${pkgs.openssl.dev}" } },
|
||||
"ring": { "buildScript": { "PATH": "${pkgs.gcc}/bin" } },
|
||||
"bzip2-sys": { "buildScript": { "PATH": "${pkgs.gcc}/bin" } },
|
||||
"zstd-sys": { "buildScript": { "PATH": "${pkgs.gcc}/bin" } },
|
||||
"lzma-sys": { "buildScript": { "PATH": "${pkgs.gcc}/bin" } },
|
||||
"prost-build": { "buildScriptDependency": { "PROTOC": "${pkgs.protobuf}/bin/protoc" } },
|
||||
"libmialloc-sys": { "buildScript": { "PATH": "${pkgs.gcc}/bin" } },
|
||||
"magic-sys": { "buildScript": { "NIX_LDFLAGS": "${pkgs.file}/lib" }, "rustc": { "NIX_LDFLAGS": "${pkgs.file}/lib" } },
|
||||
|
||||
"pango-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.pango.dev}" } },
|
||||
"glib-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.glib.dev}" } },
|
||||
"gtk4-wayland-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.gtk4.dev}" } },
|
||||
"gdk4-wayland-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.gtk4.dev}" } },
|
||||
"gdk4-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.gtk4.dev}" } },
|
||||
"graphene-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.graphene.dev}:${pkgs.glib.dev}" } },
|
||||
"gdk4-x11-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.gtk4.dev}" } },
|
||||
"gtk4-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.gtk4.dev}" } },
|
||||
"gobject-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.glib.dev}" } },
|
||||
"gsk4-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.gtk4.dev}" } },
|
||||
"glib-build-tools": { "buildScriptDependency": { "PATH": "${pkgs.glib.dev}/bin" } },
|
||||
"cairo-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.cairo.dev}" } },
|
||||
"cairo-sys-rs": { "buildScript": { "_zilch_pkgconfig": "${pkgs.cairo.dev}" } },
|
||||
"gio-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.glib.dev}" } },
|
||||
"libadwaita-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.libadwaita.dev}" } },
|
||||
"gdk-pixbuf-sys": { "buildScript": { "_zilch_pkgconfig": "${pkgs.gdk-pixbuf.dev}" } }
|
||||
}
|
||||
|
|
@ -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