Add install name for MacOS dylib

Without setting the install name, the copied object will still reference
to the original object, which is not going to work if it is ever moved
out of CBQN directory:

$ otool -L libcbqn.dylib
libcbqn.dylib:
	build/obj2/linker-4qa8skka2dk9e991rjom3lns7elgmlak4h98e0bcb0t8os3o6o5/res (compatibility version 0.0.0, current version 0.0.0)

With this change the install name of the dylib object is set to
@rpath/libcbqn.dylib, so it's loaded the same way .so files on Linux
are.
This commit is contained in:
Antti Keränen 2023-04-25 23:43:28 +03:00
parent d43ffd6b62
commit 6edc3b934d

View File

@ -320,14 +320,15 @@ po ← { # parsed options
args GetOpt "lf"
args GetOpt "CCFLAGS"
args GetOpt "LDFLAGS"
args ( emcc) / "-s", "EXPORTED_FUNCTIONS=_main,_cbqn_runLine,_cbqn_evalSrc", "-s", "EXPORTED_RUNTIME_METHODS=ccall,cwrap", "-s", "ALLOW_MEMORY_GROWTH=1"
args ( wasi) / "-lwasi-emulated-mman", "--target=wasm32-wasi", "-Wl,-z,stack-size=8388608", "-Wl,--initial-memory=67108864"
args (shared wasi) / "-mexec-model=reactor", "-Wl,--export-dynamic", "-Wl,--export=malloc", "-Wl,--export=free"
args (shared ¬wasi) / "-shared"
args ( rdynamic) / "-rdynamic"
args ((¬wasm) ¬pie) / "-no-pie"
args (pie ¬shared) / "-fPIE", "-pie"
args ( windows) / "-lpthread"
args ( emcc) / "-s", "EXPORTED_FUNCTIONS=_main,_cbqn_runLine,_cbqn_evalSrc", "-s", "EXPORTED_RUNTIME_METHODS=ccall,cwrap", "-s", "ALLOW_MEMORY_GROWTH=1"
args ( wasi) / "-lwasi-emulated-mman", "--target=wasm32-wasi", "-Wl,-z,stack-size=8388608", "-Wl,--initial-memory=67108864"
args (shared wasi) / "-mexec-model=reactor", "-Wl,--export-dynamic", "-Wl,--export=malloc", "-Wl,--export=free"
args (shared ¬wasi) / "-shared"
args (shared macos) / "-install_name", "@rpath/libcbqn.dylib"
args ( rdynamic) / "-rdynamic"
args ((¬wasm) ¬pie) / "-no-pie"
args (pie ¬shared) / "-fPIE", "-pie"
args ( windows) / "-lpthread"
args args (¬/) GetOpt "rm_lf"
{"linker: "•Repr 𝕩} _verboseLog args
linker args