forked from mltframework/shotcut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-osx.sh
executable file
·124 lines (109 loc) · 4.22 KB
/
deploy-osx.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
# Directions
# 1. install MacPorts
# 1.1 sudo echo +no_x11 >>/opt/local/etc/macports/variants.conf
# 2. port install qt4-mac frei0r-plugins ffmpeg libsamplerate libsdl sox glib2 jack
# 3. get LADSPA swh-plugins and CFLAGS="-march=nocona $CFLAGS" ./configure --enable-darwin --enable-sse
# 4. get and cd mlt
# 5. ./configure --enable-gpl --prefix=/opt/local
# 6. CFLAGS="-I/opt/local/include -DRELOCATABLE" make -j3
# 7. sudo make install
# 8. get shotcut
# 9. mkdir shotcut-build-desktop && cd shotcut-build-desktop
# 10. qmake ../shotcut/shotcut.pro -r -spec macx-g++
# 11. make -j3
# 12. cd ../shotcut && ./deploy-osx.sh
# 13. Shotcut.dmg is in shotcut-build-desktop
fixlibs()
{
target=$(dirname "$1")/$(basename "$1")
echo fixlibs $target
libs=$(otool -L "$target" | awk '/^\t\/opt\/local/{print $1}')
# if the target is a lib, change its id
#if [ $(echo "$1" | grep '\.dylib$') ] || [ $(echo "$1" | grep '\.so$') ]; then
# echo install_name_tool -id "@executable_path/lib/$(basename "$1")" "$target"
# install_name_tool -id "@executable_path/lib/$(basename "$1")" "$target"
#fi
for lib in $libs; do
if [ $(basename "$lib") != $(basename "$target") ]; then
newlib=$(basename "$lib")
echo cp -n "$lib" lib/
cp -n "$lib" lib/
echo install_name_tool -change "$lib" "@executable_path/lib/$newlib" "$target"
install_name_tool -change "$lib" "@executable_path/lib/$newlib" "$target"
fi
done
for lib in $libs; do
if [ $(basename "$lib") != $(basename "$target") ]; then
newlib=$(basename "$lib")
echo
fixlibs "lib/$newlib"
fi
done
}
BUILD_DIR="../shotcut-build-desktop/Shotcut.app/Contents"
# copy qt_menu.nib
# try MacPorts first
if [ -d "/opt/local/lib/Resources/qt_menu.nib" ]; then
echo cp -Rn /opt/local/lib/Resources/qt_menu.nib "$BUILD_DIR/Resources/"
cp -Rn /opt/local/lib/Resources/qt_menu.nib "$BUILD_DIR/Resources/"
# try Qt Creator after that
elif [ -d "/Applications/Qt Creator.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib" ]; then
echo cp -Rn "/Applications/Qt Creator.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib" "$BUILD_DIR/Resources/"
cp -Rn "/Applications/Qt Creator.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib" "$BUILD_DIR/Resources/"
fi
cd "$BUILD_DIR/MacOS"
mkdir lib 2>/dev/null
fixlibs Shotcut
# MLT plugins
mkdir -p lib/mlt 2>/dev/null
echo cp ~/src/mlt/src/modules/libmlt*.dylib lib/mlt
cp ~/src/mlt/src/modules/libmlt*.dylib lib/mlt
mkdir share 2>/dev/null
echo cp -R /opt/local/share/mlt share
cp -R /opt/local/share/mlt share
for lib in lib/mlt/*; do
fixlibs "$lib"
done
# Qt4 plugins
mkdir -p lib/qt4 2>/dev/null
# try MacPorts first
if [ -d "/opt/local/share/qt4/plugins" ]; then
echo cp -Rn "/opt/local/share/qt4/plugins"/{accessible,bearer,codecs,designer,graphicssystems,iconengines,imageformats,qmltooling,sceneformats,script,sqldrivers} lib/qt4
cp -Rn "/opt/local/share/qt4/plugins"/{accessible,bearer,codecs,designer,graphicssystems,iconengines,imageformats,qmltooling,sceneformats,script,sqldrivers} lib/qt4
# try Qt Creator next
elif [ -d "/Applications/Qt Creator.app/Contents/PlugIns" ]; then
echo cp -Rn "/Applications/Qt Creator.app/Contents/PlugIns"/{accessible,bearer,codecs,designer,graphicssystems,iconengines,imageformats,qmltooling,sceneformats,script,sqldrivers} lib/qt4
cp -Rn "/Applications/Qt Creator.app/Contents/PlugIns"/{accessible,bearer,codecs,designer,graphicssystems,iconengines,imageformats,qmltooling,sceneformats,script,sqldrivers} lib/qt4
fi
for dir in lib/qt4/*; do
for lib in $dir/*; do
fixlibs "$lib"
done
done
# frei0r plugins
mkdir lib 2>/dev/null
cp -Rn /opt/local/lib/frei0r-1 lib
for lib in lib/frei0r-1/*; do
fixlibs "$lib"
done
# LADSPA plugins
mkdir lib/ladspa 2>/dev/null
cp -Rn /usr/local/lib/ladspa/* lib/ladspa
for lib in lib/ladspa/*; do
fixlibs "$lib"
done
# build DMG
cd ../../..
rm Shotcut.dmg 2>/dev/null
rm -rf staging 2>/dev/null
mkdir staging
cp -a Shotcut.app staging/
ln -s /Applications staging/
sync
hdiutil create -fs HFS+ -srcfolder staging -volname Shotcut -format UDBZ Shotcut.dmg
while [ "$?" -ne 0 ]; do
hdiutil create -fs HFS+ -srcfolder staging -volname Shotcut -format UDBZ Shotcut.dmg
done
sync
rm -rf staging 2>/dev/null