move static linking management to build.bqn

This commit is contained in:
dzaima 2023-06-19 12:27:49 +03:00
parent fe3135213e
commit 774fb9b72f
2 changed files with 5 additions and 1 deletions

View File

@ -45,6 +45,7 @@ opts ← ⟨
1, "shared", 0, "Build a shared library"
1, "static-lib", 0, "Build a static library"
1, "static-bin", 0, "Statically link the executable"
1, "wasi", 0, "Build with WASI; default output name is BQN.wasm"
1, "emcc", 0, "Build with emscripten; outputs two files - BQN.wasm and BQN.js"
1, "clangd", 0, "Don't build, instead generate a compile_commands.json for clangd"@+10
@ -181,6 +182,7 @@ po ← { # parsed options
sharedLib GetOpt "shared"
staticLib GetOpt "static-lib"
staticBin GetOpt "static-bin"
lib staticLib sharedLib
native 0 DOpt "native"
emcc GetOpt "emcc"
@ -189,6 +191,7 @@ po ← { # parsed options
{𝕊: "Error: usz can only be 32 or 64"}_assert_ usz3264
versionName {sharedLib? @; "0"@ GetOpt "v"}
wasm wasiemcc
"Error: Static linking for wasm is pointless"_assert_¬ staticBin wasm
cc {emcc? "emcc"; "clang"} DOpt "CC"
cxx GetOpt "CXX"
@ -352,6 +355,7 @@ po ← { # parsed options
args ((¬wasm) ¬pie) / "-no-pie"
args (pie ¬sharedLib) / "-fPIE", "-pie"
args ( windows) / "-lpthread"
args ( staticBin) / "-static"
args args (¬/) GetOpt "rm_lf"
{"linker: "•Repr 𝕩} _verboseLog args
}

View File

@ -81,7 +81,7 @@ shared-o3:
shared-c:
@"${MAKE}" to-bqn-build REPLXX=0 i_SHARED=1 i_build_opts=c
static-bin:
@"${MAKE}" to-bqn-build FFI=0 LDFLAGS="-static"
@"${MAKE}" to-bqn-build FFI=0 i_build_opts="static-bin"
# mappings of old names
o3-singeli: o3