33set -euo pipefail
44
55ARCH=" ${1:- x86_64} "
6+ VERSION=" ${2:- dev} "
67BUILD_DIR=" build"
78APP_PATH=" ${BUILD_DIR} /iDescriptor.app"
89
9- echo " Starting deployment for architecture: ${ARCH} "
1010
11- # Deploy Qt dependencies
12- echo " Deploying Qt dependencies..."
13- macdeployqt " ${APP_PATH} " -qmldir=qml -verbose=2
11+ echo " Deploying iDescriptor DMG for ${ARCH} architecture (version: ${VERSION} )"
12+
13+ # Determine the platform-specific suffix for the DMG name based on architecture
14+ PLATFORM_SUFFIX=" "
15+ if [ " ${ARCH} " == " x86_64" ]; then
16+ PLATFORM_SUFFIX=" Apple_Intel"
17+ elif [ " ${ARCH} " == " arm64" ]; then
18+ PLATFORM_SUFFIX=" Apple_Silicon"
19+ else
20+ echo " Error: Unsupported architecture '${ARCH} '."
21+ exit 1
22+ fi
23+
24+ # Ensure the app exists
25+ if [ ! -d " ${APP_PATH} " ]; then
26+ echo " Error: ${APP_PATH} not found."
27+ exit 1
28+ fi
29+
1430
15- # Bundle GStreamer
16- echo " Bundling GStreamer..."
1731GST_PLUGIN_DIR=" ${APP_PATH} /Contents/Frameworks/gstreamer"
1832mkdir -p " ${GST_PLUGIN_DIR} "
1933
@@ -30,28 +44,26 @@ PLUGINS=(
3044 " libgstvolume"
3145)
3246
47+ BREW_PREFIX=" $( brew --prefix) "
48+
49+ # Copy GStreamer plugins
3350for plugin in " ${PLUGINS[@]} " ; do
34- cp " $( brew --prefix gstreamer ) /lib/gstreamer-1.0/${plugin} .dylib" " ${GST_PLUGIN_DIR} /"
51+ cp " ${BREW_PREFIX} /lib/gstreamer-1.0/${plugin} .dylib" " ${GST_PLUGIN_DIR} /"
3552done
3653
54+ # Copy gst-plugin-scanner
3755cp " $( brew --prefix gstreamer) /libexec/gstreamer-1.0/gst-plugin-scanner" " ${APP_PATH} /Contents/Frameworks/"
3856
3957# Bundle libjxl_cms
40- echo " Bundling libjxl_cms... "
41- cp " $( brew --prefix ) /lib/libjxl_cms.0.11.dylib" " ${APP_PATH} /Contents/Frameworks/"
58+ # For some reason libjxl_cms is not bundled by macdeployqt, so we do it manually
59+ cp " ${BREW_PREFIX} /lib/libjxl_cms.0.11.dylib" " ${APP_PATH} /Contents/Frameworks/"
4260install_name_tool -id " @rpath/libjxl_cms.0.11.dylib" " ${APP_PATH} /Contents/Frameworks/libjxl_cms.0.11.dylib"
43- install_name_tool -change " $( brew --prefix) /lib/libjxl_cms.0.11.dylib" " @rpath/libjxl_cms.0.11.dylib" " ${APP_PATH} /Contents/Frameworks/libjxl.0.11.dylib"
4461
45- # Add rpath to main executable
46- echo " Adding rpath to main executable..."
62+ # Add RPATH to main executable
4763install_name_tool -add_rpath " @executable_path/../Frameworks" " ${APP_PATH} /Contents/MacOS/iDescriptor"
4864
49- # Fix GStreamer library paths
50- echo " Fixing GStreamer library paths..."
51- FRAMEWORKS_DIR=" ${APP_PATH} /Contents/Frameworks"
52- BREW_PREFIX=" $( brew --prefix) "
5365
54- # Copy GStreamer core libraries
66+ # Copy GStreamer + GLib core libraries
5567GST_LIBS=(
5668 " libgstreamer-1.0.0.dylib"
5769 " libgstbase-1.0.0.dylib"
@@ -62,86 +74,33 @@ GST_LIBS=(
6274 " libgsttag-1.0.0.dylib"
6375 " libgstriff-1.0.0.dylib"
6476 " libgstcodecparsers-1.0.0.dylib"
77+ " libgstrtp-1.0.0.dylib"
78+ " libgstsdp-1.0.0.dylib"
6579 " libglib-2.0.0.dylib"
6680 " libgobject-2.0.0.dylib"
6781 " libgmodule-2.0.0.dylib"
6882 " libgio-2.0.0.dylib"
6983 " libgthread-2.0.0.dylib"
7084)
7185
86+ FRAMEWORKS_DIR=" ${APP_PATH} /Contents/Frameworks"
87+
7288for lib in " ${GST_LIBS[@]} " ; do
7389 if [ -f " ${BREW_PREFIX} /lib/${lib} " ]; then
7490 cp " ${BREW_PREFIX} /lib/${lib} " " ${FRAMEWORKS_DIR} /"
7591 install_name_tool -id " @rpath/${lib} " " ${FRAMEWORKS_DIR} /${lib} "
76- echo " Copied and fixed ID for ${lib} "
92+ echo " ✓ Copied and fixed ID for ${lib} "
7793 fi
7894done
7995
80- # For some reason libavfilter sometimes doesnt get copied by macdeployqt
96+ # Copy FFmpeg libavfilter
8197FFMPEG_LIB_DIR=" $( brew --prefix ffmpeg) /lib"
8298cp " ${FFMPEG_LIB_DIR} " /libavfilter.* .dylib " ${FRAMEWORKS_DIR} /"
8399
84- # Copy additional audio-related libraries that are missing
85- echo " Bundling additional audio libraries..."
86- ADDITIONAL_LIBS=(
87- " libarchive.13.dylib"
88- " libass.9.dylib"
89- " libb2.1.dylib"
90- " libfribidi.0.dylib"
91- " libgif.dylib"
92- " libgraphite2.3.dylib"
93- " libharfbuzz.0.dylib"
94- " libjpeg.8.dylib"
95- " liblcms2.2.dylib"
96- " libleptonica.6.dylib"
97- " liblz4.1.dylib"
98- " librubberband.3.dylib"
99- " libsamplerate.0.dylib"
100- " libtesseract.5.dylib"
101- " libtiff.6.dylib"
102- " libunibreak.6.dylib"
103- " libvidstab.1.2.dylib"
104- " libzimg.2.dylib"
105- )
106-
107- for lib in " ${ADDITIONAL_LIBS[@]} " ; do
108- if [ -f " ${BREW_PREFIX} /lib/${lib} " ]; then
109- cp " ${BREW_PREFIX} /lib/${lib} " " ${FRAMEWORKS_DIR} /"
110- install_name_tool -id " @rpath/${lib} " " ${FRAMEWORKS_DIR} /${lib} "
111- else
112- echo " Warning: ${lib} not found, skipping..."
113- fi
114- done
115-
116- # Fix dependencies in all GStreamer plugins
117- echo " Fixing GStreamer plugin dependencies..."
118- for plugin in " ${GST_PLUGIN_DIR} " /* .dylib; do
119- echo " Fixing plugin: $( basename " ${plugin} " ) "
120-
121- # Get all dependencies and fix them
122- otool -L " ${plugin} " | grep -E " ${BREW_PREFIX} " | awk ' {print $1}' | while read dep; do
123- depname=$( basename " ${dep} " )
124- echo " Changing ${depname} "
125- install_name_tool -change " ${dep} " " @rpath/${depname} " " ${plugin} " 2> /dev/null || true
126- done
127- done
100+ macdeployqt " ${APP_PATH} " -qmldir=qml -verbose=2
128101
129- # Fix dependencies in GStreamer core libraries themselves
130- echo " Fixing GStreamer core library dependencies..."
131- for lib in " ${FRAMEWORKS_DIR} " /libgst* .dylib " ${FRAMEWORKS_DIR} " /libglib* .dylib " ${FRAMEWORKS_DIR} " /libgobject* .dylib " ${FRAMEWORKS_DIR} " /libgmodule* .dylib " ${FRAMEWORKS_DIR} " /libgio* .dylib " ${FRAMEWORKS_DIR} " /libgthread* .dylib; do
132- if [ -f " ${lib} " ]; then
133- echo " Fixing library: $( basename " ${lib} " ) "
134-
135- otool -L " ${lib} " | grep -E " ${BREW_PREFIX} " | awk ' {print $1}' | while read dep; do
136- depname=$( basename " ${dep} " )
137- echo " Changing ${depname} "
138- install_name_tool -change " ${dep} " " @rpath/${depname} " " ${lib} " 2> /dev/null || true
139- done
140- fi
141- done
102+ DMG_NAME=" iDescriptor-${VERSION} -${PLATFORM_SUFFIX} .dmg"
142103
143- # Create DMG
144- echo " Creating DMG..."
145104create-dmg \
146105 --volname " iDescriptor" \
147106 --volicon " resources/icons/app-icon/icon.icns" \
@@ -151,7 +110,5 @@ create-dmg \
151110 --icon " iDescriptor.app" 175 190 \
152111 --hide-extension " iDescriptor.app" \
153112 --app-drop-link 425 190 \
154- " ${BUILD_DIR} /iDescriptor-macOS-${ARCH} .dmg" \
155- " ${APP_PATH} "
156-
157- echo " Deployment complete for architecture: ${ARCH} "
113+ " ${BUILD_DIR} /${DMG_NAME} " \
114+ " ${APP_PATH} "
0 commit comments