3 changed files with 85 additions and 1 deletions
@ -0,0 +1,80 @@ |
|||
;; Oniguruma: a regular expression engine with multiple encodings supported |
|||
(add-cakelisp-search-directory "Dependencies/cakelisp/runtime") |
|||
(import "CHelpers.cake" "BuildTools.cake" "Dependencies.cake") |
|||
|
|||
(export-and-evaluate |
|||
(add-c-search-directory-module "cakelisp_cache/OnigurumaInstallDir/include") |
|||
(c-import "oniguruma.h")) |
|||
|
|||
(comptime-cond |
|||
('auto-test |
|||
(defun test--oniguruma (&return int) |
|||
(var encodings ([] OnigEncoding) (array ONIG_ENCODING_UTF8)) |
|||
(onig_initialize encodings (array-size encodings)) |
|||
(onig_end) |
|||
(return 0)))) |
|||
|
|||
(defun-comptime build-oniguruma (manager (& ModuleManager) module (* Module) &return bool) |
|||
;; Already built? |
|||
;; We could enhance this by checking for modifications, but that's pretty rare |
|||
(when (and (fileExists "cakelisp_cache/OnigurumaInstallDir/lib/libonig.a")) |
|||
(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)) |
|||
|
|||
;; 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") |
|||
(return false)) |
|||
(return true)) |
|||
(add-compile-time-hook-module pre-build build-oniguruma) |
|||
|
|||
(add-static-link-objects "cakelisp_cache/OnigurumaInstallDir/lib/libonig.a") |
|||
|
|||
(add-dependency-git-submodule |
|||
clone-oniguruma |
|||
"https://github.com/kkos/oniguruma.git" |
|||
"Dependencies/oniguruma") |
Loading…
Reference in new issue