From f42af6487d18d4c4c062195862bb815d484b092c Mon Sep 17 00:00:00 2001 From: Apprentice-Alchemist <53486764+Apprentice-Alchemist@users.noreply.github.com> Date: Sat, 30 Nov 2024 10:11:42 +0100 Subject: [PATCH] Add fmt sample, and temp hack to hopefully make the ninja generator work on macOS. --- .github/workflows/build.yml | 7 +++++-- other/fmtsample/FmtSample.hx | 10 ++++++++++ other/haxelib/Run.hx | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 other/fmtsample/FmtSample.hx diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5309f07c..239d129bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -234,8 +234,11 @@ jobs: popd fi - haxe -hl out/main.c -cp other/tests -main HelloWorld -D hlgen.makefile=ninja - out/main + haxe -hl out/helloworld/main.c -cp other/tests -main HelloWorld -D hlgen.makefile=ninja + out/helloworld/main + + haxe -hl out/fmtsample/main.c -cp other/fmtsample -main FmtSample -D hlgen.makefile=ninja + out/fmtsample/main ;; esac diff --git a/other/fmtsample/FmtSample.hx b/other/fmtsample/FmtSample.hx new file mode 100644 index 000000000..6939fbf74 --- /dev/null +++ b/other/fmtsample/FmtSample.hx @@ -0,0 +1,10 @@ +function main() { + var out = haxe.io.Bytes.alloc(16); + var src = haxe.io.Bytes.ofString("Hello World!"); + hl.Format.digest(out.getData(), src.getData(), src.length, 0 /* md5 */); + final expected = "ed076287532e86365e841e92bfc50d8c"; + final got = out.toHex(); + if (got != expected) { + throw 'expected $expected, got $got'; + } +} \ No newline at end of file diff --git a/other/haxelib/Run.hx b/other/haxelib/Run.hx index 4ec739c38..03942eeb8 100644 --- a/other/haxelib/Run.hx +++ b/other/haxelib/Run.hx @@ -60,8 +60,8 @@ class NinjaGenerator { gen.bind('cflags', '$opt_flag -std=c11 -DHL_MAKE -Wall -I. -pthread'); final libflags = config.libs.map((lib) -> switch lib { case "std": "-lhl"; - case "uv": '-l:$lib.hdll -luv'; - case var lib: '-l:$lib.hdll'; + case "uv": '/usr/local/lib/$lib.hdll -luv'; + case var lib: '/usr/local/lib/$lib.hdll'; }).join(' '); gen.bind('ldflags', '-pthread -lm -L/usr/local/lib $libflags $rpath'); gen.rule('cc', [