(zilch lang ninja nixpkgs): misc fixes
Change-Id: I6a6a6964260d2be34c1b70aad431018ce37dca26
This commit is contained in:
parent
a57b991013
commit
86e07faa8a
1 changed files with 14 additions and 9 deletions
|
|
@ -28,12 +28,17 @@
|
||||||
(define rewrite-hooks
|
(define rewrite-hooks
|
||||||
(string-append
|
(string-append
|
||||||
"__zilch_rewrite_sed=\"\"\n"
|
"__zilch_rewrite_sed=\"\"\n"
|
||||||
|
"while read -d ' ' rewrite_from; do\n"
|
||||||
|
" read -d ' ' rewrite_to\n"
|
||||||
|
" if [ -e $rewrite_from ]; then\n"
|
||||||
|
" export __zilch_rewrite_sed=\"$__zilch_rewrite_sed;s|$rewrite_from|$rewrite_to|g\"\n"
|
||||||
|
" fi\n"
|
||||||
|
"done <<< \"$__zilch_rewrites\"\n"
|
||||||
"echo \"$__zilch_rewrites\" | while read -d ' ' rewrite_from; do\n"
|
"echo \"$__zilch_rewrites\" | while read -d ' ' rewrite_from; do\n"
|
||||||
" read -d ' ' rewrite_to\n"
|
" read -d ' ' rewrite_to\n"
|
||||||
" __zilch_rewrite_sed=\"$__zilch_rewrite_sed s|$rewrite_from|$rewrite_to|g\"\n"
|
" if ! [ -e $rewrite_from ]; then\n"
|
||||||
"done || true\n"
|
" continue\n"
|
||||||
"echo \"$__zilch_rewrites\" | while read -d ' ' rewrite_from; do\n"
|
" fi\n"
|
||||||
" read -d ' ' rewrite_to\n"
|
|
||||||
" cp --no-preserve=ownership -rf \"$rewrite_from\" \"$rewrite_to\"\n"
|
" cp --no-preserve=ownership -rf \"$rewrite_from\" \"$rewrite_to\"\n"
|
||||||
" chmod -R ugo+rw \"$rewrite_to\"\n"
|
" chmod -R ugo+rw \"$rewrite_to\"\n"
|
||||||
" find \"$rewrite_to\" -type f -exec sed -i -e \"$__zilch_rewrite_sed\" \"{}\" \";\" || exit 1\n"
|
" find \"$rewrite_to\" -type f -exec sed -i -e \"$__zilch_rewrite_sed\" \"{}\" \";\" || exit 1\n"
|
||||||
|
|
@ -52,7 +57,7 @@
|
||||||
"export DETERMINISTIC_BUILD=1\n"
|
"export DETERMINISTIC_BUILD=1\n"
|
||||||
"export PYTHONHASHSEED=0\n"
|
"export PYTHONHASHSEED=0\n"
|
||||||
"zilchPreConfigure() {\n"
|
"zilchPreConfigure() {\n"
|
||||||
" cd $NIX_BUILD_TOP; mkdir bdir; mv $sourceRoot bdir/src; sourceRoot=bdir/src; cd $sourceRoot\n"
|
" cd $NIX_BUILD_TOP; mkdir bdir; cp -rf --no-preserve=ownership $sourceRoot bdir/src; sourceRoot=bdir/src; cd $sourceRoot\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"mesonBuildDir=$NIX_BUILD_TOP/bdir/build cmakeBuildDir=$NIX_BUILD_TOP/bdir/build cmakeDir=\"$NIX_BUILD_TOP/bdir/src/${cmakeDir:-.}\"\n"
|
"mesonBuildDir=$NIX_BUILD_TOP/bdir/build cmakeBuildDir=$NIX_BUILD_TOP/bdir/build cmakeDir=\"$NIX_BUILD_TOP/bdir/src/${cmakeDir:-.}\"\n"
|
||||||
"phases=\"${prePhases[*]:-} unpackPhase patchPhase ${preConfigurePhases[*]:-} zilchPreConfigure configurePhase ${preBuildPhases[*]:-}\"\n"
|
"phases=\"${prePhases[*]:-} unpackPhase patchPhase ${preConfigurePhases[*]:-} zilchPreConfigure configurePhase ${preBuildPhases[*]:-}\"\n"
|
||||||
|
|
@ -165,7 +170,7 @@
|
||||||
(mapping-for-each
|
(mapping-for-each
|
||||||
(lambda (orig-path virtual-path)
|
(lambda (orig-path virtual-path)
|
||||||
(set! rewrites (cons (cons (string->utf8 orig-path) (string->utf8 virtual-path)) rewrites))
|
(set! rewrites (cons (cons (string->utf8 orig-path) (string->utf8 virtual-path)) rewrites))
|
||||||
(set! rewrite-extra (string-append rewrite-extra orig-path " " virtual-path "\n")))
|
(set! rewrite-extra (string-append rewrite-extra orig-path " " virtual-path " ")))
|
||||||
(drv-rewrite-source-paths secondary-root)))
|
(drv-rewrite-source-paths secondary-root)))
|
||||||
secondary-roots)
|
secondary-roots)
|
||||||
|
|
||||||
|
|
@ -246,13 +251,13 @@
|
||||||
(lambda (key obj)
|
(lambda (key obj)
|
||||||
(define base-store-path (mapping-ref output-map (car key)))
|
(define base-store-path (mapping-ref output-map (car key)))
|
||||||
(define full-path (string-append base-store-path "/" (if (string=? "" (cadr key)) (cddr key) (string-append (cadr key) "/" (cddr key)))))
|
(define full-path (string-append base-store-path "/" (if (string=? "" (cadr key)) (cddr key) (string-append (cadr key) "/" (cddr key)))))
|
||||||
(if (or (string-suffix? ".hh" (cddr key)) (string-suffix? ".h" (cddr key)) (string-suffix? ".hpp" (cddr key)))
|
(if (or (string-suffix? ".hh" (cddr key)) (string-suffix? ".h" (cddr key)) (string-suffix? ".hpp" (cddr key)) (string-suffix? ".so" (cddr key)))
|
||||||
(set! extra-paths (cons (cons full-path (transform-obj obj)) extra-paths))
|
(set! extra-paths (cons (cons full-path (transform-obj obj)) extra-paths))
|
||||||
(set! vfses (mapping-set! vfses (car key) (mapping-set! (mapping-ref vfses (car key)) (cdr key) (transform-obj obj))))))
|
(set! vfses (mapping-set! vfses (car key) (mapping-set! (mapping-ref vfses (car key)) (cdr key) (transform-obj obj))))))
|
||||||
(determine-data-flow conf))
|
(determine-data-flow conf))
|
||||||
(set! vfses (mapping-map/monotone! (lambda (k v) (values k (vfs-to-store (make-vfs v)))) (make-default-comparator) vfses))
|
(set! vfses (mapping-map/monotone! (lambda (k v) (values (mapping-ref output-map k) (vfs-to-store (make-vfs v)))) (make-default-comparator) vfses))
|
||||||
(define finalized (delay (finalize-drv conf its-secondary-roots initial-drv configured-drv placeholders edge-ref defaults export-depfile rewrites)))
|
(define finalized (delay (finalize-drv conf its-secondary-roots initial-drv configured-drv placeholders edge-ref defaults export-depfile rewrites)))
|
||||||
(make-drv-rewrite output-map finalized vfses extra-paths))
|
(make-drv-rewrite (alist->mapping (make-default-comparator) future-rewrites) finalized vfses extra-paths))
|
||||||
;; Takes a `<ninja-build-config>` representing a Nixpkgs derivation, and
|
;; Takes a `<ninja-build-config>` representing a Nixpkgs derivation, and
|
||||||
;; build it using Zilch.
|
;; build it using Zilch.
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue