@@ -35,9 +35,8 @@ rm -f "$APP_TEMPLATE_PLIST.tmp.bak"
35
35
export MACOSX_DEPLOYMENT_TARGET=" 11.0"
36
36
37
37
echo " Building Harbor for Apple Silicon..."
38
- cd harbor-ui
39
- cargo build --release --target=aarch64-apple-darwin --features vendored
40
- cd ..
38
+ # Build from the root directory and explicitly specify the package
39
+ cargo build --release --target=aarch64-apple-darwin --features vendored -p harbor-ui
41
40
42
41
echo " Creating app bundle..."
43
42
# build app
@@ -46,4 +45,77 @@ mkdir -p "$APP_EXTRAS_DIR"
46
45
cp -fRp " $APP_TEMPLATE " " $APP_DIR "
47
46
cp -fp " target/aarch64-apple-darwin/release/$TARGET " " $APP_BINARY_DIR /harbor"
48
47
touch -r " target/aarch64-apple-darwin/release/$TARGET " " $APP_DIR /$APP_NAME "
48
+
49
+ # Bundle libintl.8.dylib with the app
50
+ echo " Bundling and fixing libintl.8.dylib..."
51
+ FRAMEWORKS_DIR=" $APP_DIR /$APP_NAME /Contents/Frameworks"
52
+ # Ensure directory exists with proper permissions
53
+ mkdir -p " $FRAMEWORKS_DIR "
54
+ chmod 755 " $FRAMEWORKS_DIR "
55
+
56
+ # Find libintl.8.dylib in nix store
57
+ LIBINTL_PATH=$( find /nix/store -name " libintl.8.dylib" -type f | head -n 1)
58
+ if [ -n " $LIBINTL_PATH " ]; then
59
+ echo " Found libintl at: $LIBINTL_PATH "
60
+
61
+ # Copy to Frameworks directory with sudo if needed
62
+ echo " Copying library to Frameworks..."
63
+ if ! cp " $LIBINTL_PATH " " $FRAMEWORKS_DIR /" ; then
64
+ echo " Standard copy failed, trying with elevated permissions..."
65
+ # Try with sudo if available
66
+ if command -v sudo > /dev/null 2>&1 ; then
67
+ sudo cp " $LIBINTL_PATH " " $FRAMEWORKS_DIR /"
68
+ sudo chown $( whoami) " $FRAMEWORKS_DIR /libintl.8.dylib"
69
+ sudo chmod 644 " $FRAMEWORKS_DIR /libintl.8.dylib"
70
+ else
71
+ echo " ERROR: Could not copy libintl.8.dylib to Frameworks directory"
72
+ exit 1
73
+ fi
74
+ fi
75
+
76
+ # Update binary to reference the bundled library using @rpath
77
+ echo " Fixing reference in binary..."
78
+ install_name_tool -add_rpath " @executable_path/../Frameworks" " $APP_BINARY_DIR /harbor"
79
+ install_name_tool -change " $LIBINTL_PATH " " @rpath/libintl.8.dylib" " $APP_BINARY_DIR /harbor"
80
+
81
+ # Check if there are any other dependencies of libintl.8.dylib
82
+ SUB_DEPS=$( otool -L " $FRAMEWORKS_DIR /libintl.8.dylib" | grep -v " /System/" | grep -v " @rpath" | grep -v " @executable_path" | grep -v " /usr/lib/" | awk -F' ' ' {print $1}' )
83
+ if [ -n " $SUB_DEPS " ]; then
84
+ echo " Processing dependencies of libintl.8.dylib..."
85
+ for SUB_DEP_PATH in $SUB_DEPS ; do
86
+ # Skip if it's referring to itself
87
+ if [[ " $SUB_DEP_PATH " == * " libintl.8.dylib" * ]]; then
88
+ continue
89
+ fi
90
+
91
+ SUB_DEP_NAME=$( basename " $SUB_DEP_PATH " )
92
+ echo " Processing dependency: $SUB_DEP_NAME "
93
+
94
+ # Copy to Frameworks directory with sudo if needed
95
+ if ! cp " $SUB_DEP_PATH " " $FRAMEWORKS_DIR /" ; then
96
+ echo " Standard copy failed for $SUB_DEP_NAME , trying with elevated permissions..."
97
+ if command -v sudo > /dev/null 2>&1 ; then
98
+ sudo cp " $SUB_DEP_PATH " " $FRAMEWORKS_DIR /"
99
+ sudo chown $( whoami) " $FRAMEWORKS_DIR /$SUB_DEP_NAME "
100
+ sudo chmod 644 " $FRAMEWORKS_DIR /$SUB_DEP_NAME "
101
+ else
102
+ echo " WARNING: Could not copy $SUB_DEP_NAME to Frameworks directory"
103
+ continue
104
+ fi
105
+ fi
106
+
107
+ # Fix the reference in libintl
108
+ install_name_tool -change " $SUB_DEP_PATH " " @rpath/$SUB_DEP_NAME " " $FRAMEWORKS_DIR /libintl.8.dylib"
109
+
110
+ # Set the ID
111
+ install_name_tool -id " @rpath/$SUB_DEP_NAME " " $FRAMEWORKS_DIR /$SUB_DEP_NAME "
112
+ done
113
+ fi
114
+
115
+ # Fix the ID of libintl itself
116
+ install_name_tool -id " @rpath/libintl.8.dylib" " $FRAMEWORKS_DIR /libintl.8.dylib"
117
+ else
118
+ echo " Warning: Could not find libintl.8.dylib in nix store!"
119
+ fi
120
+
49
121
echo " ✨ Created '$APP_NAME ' in '$APP_DIR '"
0 commit comments