(zilch lang ninja): support CMake
Change-Id: I6a6a696445c5513215b7e1df512514586a1dfd3a
This commit is contained in:
parent
48692fc50d
commit
268b6fb8c2
2 changed files with 18 additions and 4 deletions
|
|
@ -258,6 +258,10 @@
|
||||||
(define copies (list))
|
(define copies (list))
|
||||||
(define (process-input path)
|
(define (process-input path)
|
||||||
(define input-file (mapping-ref edges path (lambda () (mapping-ref/default edges (normalize-path path) #f))))
|
(define input-file (mapping-ref edges path (lambda () (mapping-ref/default edges (normalize-path path) #f))))
|
||||||
|
(define input-edge (force (cdr input-file)))
|
||||||
|
; Passthru CMake library symlinks, as CMake assumes this is valid
|
||||||
|
(when (and input-edge (string=? (build-edge-rule (built-edge-edge input-edge)) "CMAKE_SYMLINK_LIBRARY"))
|
||||||
|
(for-each process-input (build-edge-inputs (built-edge-edge input-edge))))
|
||||||
(if (eq? (car input-file) 'phony)
|
(if (eq? (car input-file) 'phony)
|
||||||
(for-each process-input (built-edge-phony-inputs (force (cdr input-file))))
|
(for-each process-input (built-edge-phony-inputs (force (cdr input-file))))
|
||||||
(set! copies (cons #~,(string-append "mkdir -p \"$out/$(dirname " path ")\"; cp -rf " #$(force (car input-file)) " $out/" path) copies))))
|
(set! copies (cons #~,(string-append "mkdir -p \"$out/$(dirname " path ")\"; cp -rf " #$(force (car input-file)) " $out/" path) copies))))
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
"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; mv $sourceRoot bdir/src; sourceRoot=bdir/src; cd $sourceRoot\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"mesonBuildDir=$NIX_BUILD_TOP/bdir/build\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"
|
||||||
"for curPhase in ${phases[*]}; do runPhase \"$curPhase\"; done\n"
|
"for curPhase in ${phases[*]}; do runPhase \"$curPhase\"; done\n"
|
||||||
"find . '(' -name cmake_trace.txt -o -name meson-log.txt -o -name CMakeConfigureLog.yaml ')' -delete\n"
|
"find . '(' -name cmake_trace.txt -o -name meson-log.txt -o -name CMakeConfigureLog.yaml ')' -delete\n"
|
||||||
|
|
@ -150,8 +150,7 @@
|
||||||
"cp -rf --no-preserve=ownership " #$realised-built "/* bdir/build\n"
|
"cp -rf --no-preserve=ownership " #$realised-built "/* bdir/build\n"
|
||||||
"cd bdir/build\n"
|
"cd bdir/build\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"mesonBuildDir=$NIX_BUILD_TOP/bdir/build\n"
|
"mesonBuildDir=$NIX_BUILD_TOP/bdir/build cmakeBuildDir=$NIX_BUILD_TOP/bdir/build cmakeDir=\"$NIX_BUILD_TOP/bdir/src/${cmakeDir:-.}\"\n"
|
||||||
"installPhase=zilchInstall; checkPhase=mesonCheckPhase\n"
|
|
||||||
"zilchFixPlaceholder() {\n"
|
"zilchFixPlaceholder() {\n"
|
||||||
" find ../out -type f -exec sed -i -e \"s|$1|$2|g\" \"{}\" \";\" || exit 1\n"
|
" find ../out -type f -exec sed -i -e \"s|$1|$2|g\" \"{}\" \";\" || exit 1\n"
|
||||||
" find \"../out\" -type l | while read link; do\n"
|
" find \"../out\" -type l | while read link; do\n"
|
||||||
|
|
@ -163,7 +162,7 @@
|
||||||
fix-placeholders-command
|
fix-placeholders-command
|
||||||
copy-in-place-command
|
copy-in-place-command
|
||||||
"}\n"
|
"}\n"
|
||||||
"zilchInstall() {\n"
|
"zilchMesonInstall() {\n"
|
||||||
" runHook preInstall\n"
|
" runHook preInstall\n"
|
||||||
" local flagsArray=()\n"
|
" local flagsArray=()\n"
|
||||||
" if [[ -n \"$mesonInstallTags\" ]]; then\n"
|
" if [[ -n \"$mesonInstallTags\" ]]; then\n"
|
||||||
|
|
@ -174,6 +173,17 @@
|
||||||
" zilchFixup\n"
|
" zilchFixup\n"
|
||||||
" runHook postInstall\n"
|
" runHook postInstall\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
"zilchCmakeInstall() {\n"
|
||||||
|
" runHook preInstall\n"
|
||||||
|
" DESTDIR=$NIX_BUILD_TOP/bdir/out cmake --install .\n"
|
||||||
|
" zilchFixup\n"
|
||||||
|
" runHook postInstall\n"
|
||||||
|
"}\n"
|
||||||
|
"if [[ $(type -t mesonInstallPhase) == function ]]; then\n"
|
||||||
|
" installPhase=zilchMesonInstall; checkPhase=mesonCheckPhase\n"
|
||||||
|
"else\n"
|
||||||
|
" installPhase=zilchCmakeInstall; checkPhase=ninjaCheckPhase\n"
|
||||||
|
"fi\n"
|
||||||
"phases=\"zilchPlace checkPhase ${preInstallPhases[*]:-} installPhase ${preFixupPhases[*]:-} fixupPhase installCheckPhase ${preDistPhases[*]:-} distPhase ${postPhases[*]:-}\"\n"
|
"phases=\"zilchPlace checkPhase ${preInstallPhases[*]:-} installPhase ${preFixupPhases[*]:-} fixupPhase installCheckPhase ${preDistPhases[*]:-} distPhase ${postPhases[*]:-}\"\n"
|
||||||
"for curPhase in ${phases[*]}; do runPhase \"$curPhase\"; done\n"))
|
"for curPhase in ${phases[*]}; do runPhase \"$curPhase\"; done\n"))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue