From 11854bc61f31976962962afbfbbbb6f178529027 Mon Sep 17 00:00:00 2001 From: Marcus Buretorp Date: Thu, 12 Feb 2026 19:18:53 +0100 Subject: [PATCH 1/3] MSYS2 make script --- make_msys2.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 make_msys2.sh diff --git a/make_msys2.sh b/make_msys2.sh new file mode 100644 index 0000000..d5fc285 --- /dev/null +++ b/make_msys2.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +case "$(uname)" in + *BSD) ccorder='clang gcc'; ldl= ;; + *) ccorder='gcc clang'; ldl='-ldl' ;; +esac + +# auto detection of compiler +if [ -z "$CC" ]; then + for cctry in $ccorder; do + if $cctry --version > /dev/null 2>&1; then + CC=$cctry + break; + fi + done + + if [ -z "$CC" ]; then + echo "No compiler found. Specify compiler by setting the CC environment variable." >&2 + echo "Example: CC=gcc ./$0" >&2 + exit 1 + fi +fi + +# the actual compile +echo "compiling using $CC..." >&2 +$CC -Wall -pedantic -O1 src/tools/txt2c.c -o src/tools/txt2c +src/tools/txt2c src/base.lua src/tools.lua src/driver_gcc.lua src/driver_clang.lua src/driver_cl.lua src/driver_solstudio.lua src/driver_xlc.lua > src/internal_base.h +$CC -w -pedantic src/*.c src/lua/*.c -o bam -I src/lua -Os -s -flto $* From 4a871bd947a8e70a484e03753e89105747d9dc4e Mon Sep 17 00:00:00 2001 From: Marcus Buretorp Date: Thu, 29 May 2025 21:44:15 +0200 Subject: [PATCH 2/3] Remove 'u' flag from ar command line to avoid warning with GNU ar 2.44: "'u' modifier ignored since 'D' is the default (see 'U')". This flag is also seem unnecessary here as the archive is deleted before creation making update checks redundant. Also tested with BSD ar and llvm-ar. --- src/driver_gcc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver_gcc.lua b/src/driver_gcc.lua index 674ccc5..b680434 100644 --- a/src/driver_gcc.lua +++ b/src/driver_gcc.lua @@ -53,7 +53,7 @@ end function DriverGCC_Lib(output, inputs, settings) -- output archive must be removed because ar will update existing archives, possibly leaving stray objects local e = "rm -f " .. output .. " 2> /dev/null; " - local e = e .. settings.lib.exe .. " rcu " .. output + local e = e .. settings.lib.exe .. " rc " .. output local e = e .. " " .. TableToString(inputs, '', ' ') .. settings.lib.flags:ToString() return e end From 5bcd97390bd653ba8a12109cbc64a23c7d3463cf Mon Sep 17 00:00:00 2001 From: Marcus Buretorp Date: Thu, 12 Feb 2026 19:28:26 +0100 Subject: [PATCH 3/3] Prioritize script directory for Import() resolution --- src/base.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base.lua b/src/base.lua index dcde6f5..b4dea72 100644 --- a/src/base.lua +++ b/src/base.lua @@ -455,7 +455,7 @@ end [ModuleFilename] function. @END]]-- function Import(filename) - local paths = {"", PathDir(ModuleFilename())} + local paths = {PathDir(ModuleFilename()), ""} local s = os.getenv("BAM_PACKAGES") if s then