-
Notifications
You must be signed in to change notification settings - Fork 17
/
dist_macos.sh
executable file
·122 lines (86 loc) · 4.66 KB
/
dist_macos.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
#!/bin/bash
# Stop at any error
set -e
# Location of the QT tools
if [ -z ${QTDIR+x} ]; then
echo "QTDIR not defined- please set it to the location containing the Qt version to build against. For example:"
echo " export QTDIR=~/Qt5.8.0/5.8/clang_64"
exit 1
fi
QMAKE=${QTDIR}/bin/qmake
MAKE=make
# location of the source tree
SOURCEDIR=`pwd`'/src'
# Location to build PatternPaint
BUILDDIR=`pwd`'/build-dist-macos'
################### Extract the version info ###################
source ./gitversion.sh
################## Build PatternPaint ###################
mkdir -p ${BUILDDIR}
pushd ${BUILDDIR}
${QMAKE} ${SOURCEDIR}/PatternPaint.pro \
-r \
-spec macx-clang \
CONFIG+=x86_64
#${MAKE} clean
${MAKE} -j6
popd
################## Run Unit Tests ##############################
pushd ${BUILDDIR}
# TODO: this dylib path is being pulled in incorrectly, find a way for the build to load it correctly?
install_name_tool libblinky-test/libblinky-test.app/Contents/MacOS/libblinky-test -change libblinky.1.dylib @rpath/libblinky.1.0.0.dylib
libblinky-test/libblinky-test.app/Contents/MacOS/libblinky-test
popd
################## Package using macdeployqt #################
pushd ${BUILDDIR}
APP=app/PatternPaint.app
# TODO: this dylib path is being pulled in incorrectly, find a way for the build to load it correctly?
install_name_tool ${APP}/Contents/MacOS/PatternPaint -change libblinky.1.dylib @rpath/libblinky.1.0.0.dylib
# Integrate the system frameworks
${QTDIR}/bin/macdeployqt ${APP} -verbose=1
if [ -z "$SIGNING_ID" ]; then
echo "**************************************************************"
echo "WARNING: Signing id not found, skipping code signature phase."
echo "Resulting binary will not be signed."
echo ""
echo "To activate the code signature, define a SIGNING_ID envirnment"
echo "variable before running the script. Example:"
echo "export SIGNING_ID='Developer ID Application: BLINKINLABS, LLC'"
echo "**************************************************************"
else
# TODO: automate this instead of listing each plugin separately?
CODESIGN_FLAGS="--verbose --force"
# Sign the frameworks
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/Frameworks/Sparkle.framework/Versions/A
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/Frameworks/libusb-1.0.0.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/Frameworks/libblinky.1.0.0.dylib
# And the system frameworks
# TODO: This is a workaround for toolchain changes in 5.5.1
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/Frameworks/QtCore.framework/Versions/5
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/Frameworks/QtGui.framework/Versions/5
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/Frameworks/QtPrintSupport.framework/Versions/5
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/Frameworks/QtSerialPort.framework/Versions/5
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/Frameworks/QtWidgets.framework/Versions/5
# And the plugins
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/imageformats/libqgif.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/imageformats/libqicns.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/imageformats/libqico.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/imageformats/libqjpeg.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/imageformats/libqmacjp2.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/imageformats/libqtga.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/imageformats/libqtiff.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/imageformats/libqwbmp.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/imageformats/libqwebp.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/Contents/PlugIns/platforms/libqcocoa.dylib
# Finally the app
codesign ${CODESIGN_FLAGS} --sign "${SIGNING_ID}" ${APP}/
# Perform a quick verification of the application signature
codesign --deep --verify --verbose=4 ${APP}
fi
DMG_NAME=PatternPaint_${VERSION}
mkdir ${DMG_NAME}
mv ${APP}/ ${DMG_NAME}/
hdiutil create -volname ${DMG_NAME} -srcfolder ${DMG_NAME} -ov -format UDZO ${DMG_NAME}.dmg
rm -R ${DMG_NAME}
popd