Skip to content

Commit 05bcb41

Browse files
committed
fix(dmg): Prefer linking through nim than relying on mac dynamic loading
1 parent 2988d75 commit 05bcb41

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

non-nix-build/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ case $platform in
2020
./build_in_simple_env.sh "$platform" "$os"
2121
;;
2222
'mac')
23+
export MACOSX_DEPLOYMENT_TARGET=12.0
2324
./build_in_simple_env.sh "$platform" "$os"
2425
./build_mac_app.sh
25-
./install_libraries.sh
2626
echo Successfully built non-nix-build/CodeTracer.app
2727
./build_dmg.sh
2828
echo Successfully built non-nix-build/CodeTracer.dmg

non-nix-build/build_with_nim.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66

77
set -e
88

9+
export GIT_ROOT=$(git rev-parse --show-toplevel)
10+
11+
"${GIT_ROOT}"/non-nix-build/install_libraries.sh
12+
913
echo "==========="
1014
echo "codetracer build: build based on nim"
11-
echo "-----------"
15+
echo "==========="
1216

1317
# TODO: The defines pointing to directories should be investigated.
1418
# Such defines are reasonable only for loading resources at
@@ -18,6 +22,8 @@ echo "-----------"
1822
# codetracer
1923
nim -d:release \
2024
-d:asyncBackend=asyncdispatch \
25+
--dynlibOverride: "libzip" \
26+
--passL:"${GIT_ROOT}/non-nix-build/CodeTracer.app/Contents/Frameworks/libzip.dylib" \
2127
--gc:refc --hints:on --warnings:off \
2228
--debugInfo --lineDir:on \
2329
--boundChecks:on --stacktrace:on --linetrace:on \
@@ -28,6 +34,7 @@ nim -d:release \
2834
-d:builtWithNix \
2935
-d:ctEntrypoint \
3036
--nimcache:nimcache \
37+
-d:nimDebugDlOpen \
3138
--out:"$DIST_DIR/bin/ct" c ./src/ct/codetracer.nim
3239

3340
# this works --passL:/nix/store/f6afb4jw9g5f94ixw0jn6cl0ah4liy35-sqlite-3.45.3/lib/libsqlite3.so.0 \

non-nix-build/install_libraries.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
#!/usr/bin/env bash
22

3-
GIT_ROOT=$(git rev-parse --show-toplevel)
4-
5-
LIB_DIR="${GIT_ROOT}/CodeTracer.app/Contents/Frameworks"
3+
LIB_DIR="${GIT_ROOT}/non-nix-build/CodeTracer.app/Contents/Frameworks"
64

75
mkdir -p "${LIB_DIR}"
86

7+
echo "DIST DIR ${DIST_DIR}"
8+
99
brew install libzip
1010

1111
HOMEBREW_LIB_DIR="/System/Volumes/Data/opt/homebrew/lib"
1212

1313
cp "${HOMEBREW_LIB_DIR}/libzip.dylib" "${LIB_DIR}"
14-
15-
install_name_tool -add_rpath "${LIB_DIR}" "${DIST_DIR}"/bin/ct
16-
install_name_tool -change /usr/lib/libzip.dylib @rpath/libzip.dylib "${DIST_DIR}"/bin/ct
17-

0 commit comments

Comments
 (0)