move static linking management to build.bqn
This commit is contained in:
parent
fe3135213e
commit
774fb9b72f
@ -45,6 +45,7 @@ opts ← ⟨
|
|||||||
|
|
||||||
⟨1, "shared", 0, "Build a shared library"⟩
|
⟨1, "shared", 0, "Build a shared library"⟩
|
||||||
⟨1, "static-lib", 0, "Build a static 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, "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, "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⟩
|
⟨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"
|
sharedLib ← GetOpt "shared"
|
||||||
staticLib ⇐ GetOpt "static-lib"
|
staticLib ⇐ GetOpt "static-lib"
|
||||||
|
staticBin ⇐ GetOpt "static-bin"
|
||||||
lib ← staticLib ∨ sharedLib
|
lib ← staticLib ∨ sharedLib
|
||||||
native ⇐ 0 DOpt "native"
|
native ⇐ 0 DOpt "native"
|
||||||
emcc ⇐ GetOpt "emcc"
|
emcc ⇐ GetOpt "emcc"
|
||||||
@ -189,6 +191,7 @@ po ← { # parsed options
|
|||||||
{𝕊: "Error: usz can only be 32 or 64"}_assert_⊢ ⊑usz∊32‿64
|
{𝕊: "Error: usz can only be 32 or 64"}_assert_⊢ ⊑usz∊32‿64
|
||||||
versionName ← {sharedLib? @; "0"⊸≡◶⊢‿@ GetOpt "v"}
|
versionName ← {sharedLib? @; "0"⊸≡◶⊢‿@ GetOpt "v"}
|
||||||
wasm ⇐ wasi∨emcc
|
wasm ⇐ wasi∨emcc
|
||||||
|
"Error: Static linking for wasm is pointless"_assert_¬ staticBin ∧ wasm
|
||||||
|
|
||||||
cc ← {emcc? "emcc"; "clang"} DOpt "CC"
|
cc ← {emcc? "emcc"; "clang"} DOpt "CC"
|
||||||
cxx ← GetOpt "CXX"
|
cxx ← GetOpt "CXX"
|
||||||
@ -352,6 +355,7 @@ po ← { # parsed options
|
|||||||
args∾↩ ((¬wasm)∧ ¬pie) / ⟨"-no-pie"⟩
|
args∾↩ ((¬wasm)∧ ¬pie) / ⟨"-no-pie"⟩
|
||||||
args∾↩ (pie∧ ¬sharedLib) / ⟨"-fPIE", "-pie"⟩
|
args∾↩ (pie∧ ¬sharedLib) / ⟨"-fPIE", "-pie"⟩
|
||||||
args∾↩ ( windows) / ⟨"-lpthread"⟩
|
args∾↩ ( windows) / ⟨"-lpthread"⟩
|
||||||
|
args∾↩ ( staticBin) / ⟨"-static"⟩
|
||||||
args ↩ args (¬∘∊/⊣) GetOpt "rm_lf"
|
args ↩ args (¬∘∊/⊣) GetOpt "rm_lf"
|
||||||
{"linker: "∾•Repr 𝕩} _verboseLog args
|
{"linker: "∾•Repr 𝕩} _verboseLog args
|
||||||
}
|
}
|
||||||
|
|||||||
2
makefile
2
makefile
@ -81,7 +81,7 @@ shared-o3:
|
|||||||
shared-c:
|
shared-c:
|
||||||
@"${MAKE}" to-bqn-build REPLXX=0 i_SHARED=1 i_build_opts=c
|
@"${MAKE}" to-bqn-build REPLXX=0 i_SHARED=1 i_build_opts=c
|
||||||
static-bin:
|
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
|
# mappings of old names
|
||||||
o3-singeli: o3
|
o3-singeli: o3
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user