|
|
@ -3,7 +3,7 @@ |
|
|
|
(import "CHelpers.cake" "BuildTools.cake" "Dependencies.cake") |
|
|
|
|
|
|
|
(export-and-evaluate |
|
|
|
(add-c-search-directory-module "cakelisp_cache/OnigurumaInstallDir/include") |
|
|
|
(add-c-search-directory-module "Dependencies/oniguruma/src") |
|
|
|
(c-import "oniguruma.h")) |
|
|
|
|
|
|
|
(var-global c-onig-free-self-and-contents (const int) 1) |
|
|
@ -73,64 +73,79 @@ |
|
|
|
(return 0)))) |
|
|
|
|
|
|
|
(defun-comptime build-oniguruma (manager (& ModuleManager) module (* Module) &return bool) |
|
|
|
(var oniguruma-archive (* (const char)) |
|
|
|
(comptime-cond ('Windows "Dependencies/oniguruma/onig_s.lib") |
|
|
|
('Unix "cakelisp_cache/OnigurumaInstallDir/lib/libonig.a"))) |
|
|
|
;; Already built? |
|
|
|
;; We could enhance this by checking for modifications, but that's pretty rare |
|
|
|
(when (and (fileExists "cakelisp_cache/OnigurumaInstallDir/lib/libonig.a")) |
|
|
|
(when (and (fileExists oniguruma-archive)) |
|
|
|
(return true)) |
|
|
|
|
|
|
|
(Log "Oniguruma: Building via Configure and Make\n") |
|
|
|
|
|
|
|
(var working-dir (* (const char)) "cakelisp_cache/OnigurumaBuildDir") |
|
|
|
(makeDirectory working-dir) |
|
|
|
|
|
|
|
(var output-dir (* (const char)) "cakelisp_cache/OnigurumaInstallDir") |
|
|
|
(makeDirectory output-dir) |
|
|
|
|
|
|
|
(var configure-output-prefix ([] MAX_PATH_LENGTH char) (array 0)) |
|
|
|
(scope ;; Output must be absolute directory |
|
|
|
(var absolute-output-path (* (const char)) |
|
|
|
(makeAbsolutePath_Allocated null output-dir)) |
|
|
|
|
|
|
|
(unless absolute-output-path |
|
|
|
(Logf "error: failed to make Oniguruma output directory '%s'\n" output-dir) |
|
|
|
(return false)) |
|
|
|
|
|
|
|
(PrintfBuffer configure-output-prefix "--prefix=%s" absolute-output-path) |
|
|
|
(free (type-cast absolute-output-path (* void)))) |
|
|
|
|
|
|
|
(run-process-sequential-or |
|
|
|
("autoreconf" "-vfi" :in-directory "Dependencies/oniguruma") |
|
|
|
(Log |
|
|
|
"failed at Oniguruma autoreconf step. This requires autoconf to execute.") |
|
|
|
(return false)) |
|
|
|
|
|
|
|
(run-process-sequential-or |
|
|
|
("sh" "../../Dependencies/oniguruma/configure" configure-output-prefix :in-directory working-dir) |
|
|
|
(Log |
|
|
|
"failed at Oniguruma configure step. This requires a sh/bash-style shell to execute.") |
|
|
|
(return false)) |
|
|
|
|
|
|
|
(run-process-sequential-or |
|
|
|
("make" "--jobs=8" :in-directory working-dir) |
|
|
|
(Log "failed at Oniguruma make. This tool requires Makefile support.") |
|
|
|
(return false)) |
|
|
|
|
|
|
|
(run-process-sequential-or |
|
|
|
("make" "install" :in-directory working-dir) |
|
|
|
(Log |
|
|
|
"failed at Oniguruma make install. Was there a configuration issue with --prefix?") |
|
|
|
(return false)) |
|
|
|
(comptime-cond |
|
|
|
('Unix |
|
|
|
(Log "Oniguruma: Building via Configure and Make\n") |
|
|
|
|
|
|
|
(var working-dir (* (const char)) "cakelisp_cache/OnigurumaBuildDir") |
|
|
|
(makeDirectory working-dir) |
|
|
|
|
|
|
|
(var output-dir (* (const char)) "cakelisp_cache/OnigurumaInstallDir") |
|
|
|
(makeDirectory output-dir) |
|
|
|
|
|
|
|
(var configure-output-prefix ([] MAX_PATH_LENGTH char) (array 0)) |
|
|
|
(scope ;; Output must be absolute directory |
|
|
|
(var absolute-output-path (* (const char)) |
|
|
|
(makeAbsolutePath_Allocated null output-dir)) |
|
|
|
|
|
|
|
(unless absolute-output-path |
|
|
|
(Logf "error: failed to make Oniguruma output directory '%s'\n" output-dir) |
|
|
|
(return false)) |
|
|
|
|
|
|
|
(PrintfBuffer configure-output-prefix "--prefix=%s" absolute-output-path) |
|
|
|
(free (type-cast absolute-output-path (* void)))) |
|
|
|
|
|
|
|
(run-process-sequential-or |
|
|
|
("autoreconf" "-vfi" :in-directory "Dependencies/oniguruma") |
|
|
|
(Log |
|
|
|
"failed at Oniguruma autoreconf step. This requires autoconf to execute.") |
|
|
|
(return false)) |
|
|
|
|
|
|
|
(run-process-sequential-or |
|
|
|
("sh" "../../Dependencies/oniguruma/configure" configure-output-prefix :in-directory working-dir) |
|
|
|
(Log |
|
|
|
"failed at Oniguruma configure step. This requires a sh/bash-style shell to execute.") |
|
|
|
(return false)) |
|
|
|
|
|
|
|
(run-process-sequential-or |
|
|
|
("make" "--jobs=8" :in-directory working-dir) |
|
|
|
(Log "failed at Oniguruma make. This tool requires Makefile support.") |
|
|
|
(return false)) |
|
|
|
|
|
|
|
(run-process-sequential-or |
|
|
|
("make" "install" :in-directory working-dir) |
|
|
|
(Log |
|
|
|
"failed at Oniguruma make install. Was there a configuration issue with --prefix?") |
|
|
|
(return false))) |
|
|
|
('Windows |
|
|
|
;; TODO: This assumes we're running with VCVars! |
|
|
|
(run-process-sequential-or |
|
|
|
("C:\\Windows\\System32\\cmd.exe" "/C" "make_win64.bat" :in-directory "Dependencies/oniguruma") |
|
|
|
(Log "failed to build Oniguruma via make_win64\n") |
|
|
|
(return false)))) |
|
|
|
|
|
|
|
;; One final to check to ensure everything's good to go |
|
|
|
(unless (fileExists "cakelisp_cache/OnigurumaInstallDir/lib/libonig.a") |
|
|
|
(Log |
|
|
|
"error: Raylib build sequence completed, but files are not where expected. Is there an issue |
|
|
|
with the configuration?\nFile expected:\n\tcakelisp_cache/OnigurumaInstallDir/lib/libonig.a\n") |
|
|
|
(unless (fileExists oniguruma-archive) |
|
|
|
(Logf |
|
|
|
"error: Oniguruma build sequence completed, but files are not where expected. Is there an issue |
|
|
|
with the configuration?\nFile expected:\n\t%s\n" oniguruma-archive) |
|
|
|
(return false)) |
|
|
|
(return true)) |
|
|
|
(add-compile-time-hook-module pre-build build-oniguruma) |
|
|
|
|
|
|
|
(add-static-link-objects "cakelisp_cache/OnigurumaInstallDir/lib/libonig.a") |
|
|
|
(comptime-cond |
|
|
|
('Unix |
|
|
|
(add-static-link-objects "cakelisp_cache/OnigurumaInstallDir/lib/libonig.a")) |
|
|
|
('Windows |
|
|
|
(add-static-link-objects "Dependencies/oniguruma/onig_s.lib"))) |
|
|
|
|
|
|
|
(add-dependency-git-submodule |
|
|
|
clone-oniguruma |
|
|
|