File: deploy.sh

package info (click to toggle)
antimony 0.9.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,392 kB
  • sloc: cpp: 42,593; ansic: 28,661; python: 1,093; yacc: 128; lex: 114; sh: 90; makefile: 10
file content (82 lines) | stat: -rwxr-xr-x 3,336 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
set -x -e

if [ $# -ne 1 ]; then
    echo "Usage: deploy_app.sh (debug|release)"
    exit 1
fi

RELEASE=`git describe --exact-match --tags || echo "($(git rev-parse --abbrev-ref HEAD))"`
RELEASE=`echo $RELEASE|sed s:/:-:g`

cd ../../build-$1
ninja clean
ninja

# Pull out framework paths info with otool
MACDEPLOYQT=`otool -L app/Antimony.app/Contents/MacOS/Antimony | sed -n -e "s:\(.*\)lib/QtCore.*:\1/bin/macdeployqt:gp"`
PY3_VERSION=`otool -L app/Antimony.app/Contents/MacOS/Antimony | sed -n -e "s:.*Python.framework/Versions/\(3\..\).*:\1:gp"`
PY3_FRAMEWORK=`otool -L app/Antimony.app/Contents/MacOS/Antimony | sed -n -e "s:\(.*Python.framework\)/Versions.*:\1:gp"`
BOOST_DYLIB=`otool -L app/Antimony.app/Contents/MacOS/Antimony | sed -n -e "s:.*\(libboost.*python.*\.dylib\).*:\1:gp"`

$MACDEPLOYQT app/Antimony.app

# Delete unused Qt plugins
cd app/Antimony.app/Contents/PlugIns
rm -rf accessible audio imageformats mediaservice playlistformats position printsupport qml1tooling sensorgestures sensors bearer

fix_qt () {
    echo "Fixing Qt for $1"
    for LIB in $( otool -L $1 | sed -n -e "s:\(.*Qt.*.framework[^ ]*\).*:\1:gp" )
    do
        RENAMED=`echo $LIB | sed -n -e "s:.*\(Qt.*\)\.framework.*:@executable_path/../Frameworks/\1.framework/Versions/5/\1:gp"`
        install_name_tool -change $LIB $RENAMED $1
    done
}

# Remap platform links
cd platforms
fix_qt libqcocoa.dylib

# Delete unused Qt frameworks
cd ../../Frameworks
rm -rf QtDeclarative.framework QtMultimedia.framework QtMultimediaWidgets.framework QtPositioning.framework QtQml.framework QtQuick.framework QtScript.framework QtSensors.framework QtSql.framework QtXmlPatterns.framework Qt3DCore.framework Qt3DRender.framework QtLocation.framework QtSerialBus.framework QtSerialPort.framework

# Clean up remaining Qt frameworks
for LIB in $( ls|sed -n -e "s:\(Qt.*\)\.framework:\1:gp" )
do
    fix_qt $LIB.framework/Versions/Current/$LIB
done

# Deploy the Python framework, cleaning out older versions and site-packages
rm -rf Python.framework
cp -R  $PY3_FRAMEWORK .
rm -rf Python.framework/Versions/2.7
rm -r  Python.framework/Versions/Current
rm -rf Python.framework/Versions/$PY3_VERSION/lib/python$PY3_VERSION/site-packages/*
rm -r  Python.framework/Versions/$PY3_VERSION/lib/python$PY3_VERSION/test
rm -r  Python.framework/Versions/$PY3_VERSION/lib/python$PY3_VERSION/__pycache__
rm -rf Python.framework/Versions/$PY3_VERSION/lib/python$PY3_VERSION/*/__pycache__
rm -r  Python.framework/Versions/$PY3_VERSION/Resources/English.lproj
rm -r  Python.framework/Versions/$PY3_VERSION/share/doc
chmod a+w $BOOST_DYLIB

# Rewire Python framework to point into the application bundle
cd ../MacOS
install_name_tool -change $PY3_FRAMEWORK/Versions/$PY3_VERSION/Python \
                          @executable_path/../Frameworks/Python.framework/Versions/$PY3_VERSION/Python \
                          Antimony

# Update release number in Info.plist
cd ../../..
sed -i "" "s:0\.0\.0:$RELEASE:g" Antimony.app/Contents/Info.plist

# Create the disk image
mkdir Antimony
cp ../../README.md ./Antimony/README.txt
cp ../../doc/USAGE.md ./Antimony/USAGE.txt
cp ../../doc/SCRIPTING.md ./Antimony/SCRIPTING.txt
cp -R Antimony.app ./Antimony
hdiutil create Antimony.dmg -volname "Antimony $RELEASE" -srcfolder Antimony
rm -rf Antimony
mv Antimony.dmg ..