forked from FedoraQt/MediaWriter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·123 lines (104 loc) · 4.21 KB
/
build.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
#!/bin/bash
set -x
set -e
PATH="/usr/local/opt/qt@5/bin:/usr/local/opt/git/bin:/usr/local/bin:$PATH"
DEVELOPER_ID="Developer ID Application: Martin Briza (Z52EFCPL6D)"
QT_ROOT="/usr/local/opt/qt"
QMAKE="${QT_ROOT}/bin/qmake"
MACDEPLOYQT="${QT_ROOT}/bin/macdeployqt"
NOTARIZATION_EMAIL=""
NOTARIZATION_KEYCHAIN_ITEM="XCODE_NOTARY"
NOTARIZATION_ITUNES_ORGID=""
pushd $(dirname $0) >/dev/null
SCRIPTDIR=$(pwd -P)
popd >/dev/null
cd "${SCRIPTDIR}/../.."
if [[ "$TAG_NAME" == "" ]]; then
VERSION=$(git describe --tags --always)
else
VERSION="$TAG_NAME"
fi
INSTALLER="$SCRIPTDIR/FedoraMediaWriter-osx-$VERSION.dmg"
function configure() {
rm -fr "build"
mkdir -p "build"
pushd build >/dev/null
echo "=== Building Adwaita-qt ==="
git clone https://github.com/FedoraQt/adwaita-qt.git
pushd adwaita-qt > /dev/null
git checkout 1.2
mkdir -p "build"
pushd build > /dev/null
cmake ..
make -j9
make install
popd >/dev/null
popd >/dev/null
echo "=== Building ==="
cmake .. -DCREATE_STANDALONE_MAC_BUNDLE=true
popd >/dev/null
}
function build() {
pushd build >/dev/null
make -j9
popd >/dev/null
}
function deps() {
pushd build >/dev/null
echo "=== Checking unresolved library deps ==="
# Look at the binaries and search for dynamic library dependencies that are not included on every system
# So far, this finds only liblzma but in the future it may be necessary for more libs
for binary in "helper" "Fedora Media Writer"; do
otool -L "app/Fedora Media Writer.app/Contents/MacOS/$binary" |\
grep -E "^\s" | grep -Ev "AppKit|Metal|Foundation|OpenGL|AGL|DiskArbitration|IOKit|libc\+\+|libobjc|libSystem|@rpath|$(basename $binary)" |\
sed -e 's/[[:space:]]\([^[:space:]]*\).*/\1/' |\
while read library; do
if [[ ! $library == @loader_path/* ]]; then
echo "Copying $(basename $library)"
cp $library "app/Fedora Media Writer.app/Contents/Frameworks"
install_name_tool -change "$library" "@executable_path/../Frameworks/$(basename ${library})" "app/Fedora Media Writer.app/Contents/MacOS/$binary"
fi
done
done
popd >/dev/null
}
function sign() {
pushd build >/dev/null
echo "=== Signing the package ==="
# sign all frameworks and then the package
find app/Fedora\ Media\ Writer.app -name "*framework" | while read framework; do
codesign -s "$DEVELOPER_ID" --deep -v -f "$framework/Versions/Current/" -o runtime
done
find app/Fedora\ Media\ Writer.app -name "*adwaita*" | while read framework; do
codesign -s "$DEVELOPER_ID" --deep -v -f "$framework" -o runtime
done
codesign -s "$DEVELOPER_ID" --deep -v -f app/Fedora\ Media\ Writer.app/Contents/MacOS/Fedora\ Media\ Writer -o runtime
codesign -s "$DEVELOPER_ID" --deep -v -f app/Fedora\ Media\ Writer.app/Contents/MacOS/helper -o runtime
codesign -s "$DEVELOPER_ID" --deep -v -f app/Fedora\ Media\ Writer.app/ -o runtime
popd >/dev/null
}
function dmg() {
pushd build >/dev/null
echo "=== Creating a disk image ==="
# create the .dmg package - beware, it won't work while FMW is running (blocks partition mounting)
rm -f "../FedoraMediaWriter-osx-$VERSION.dmg"
hdiutil create -srcfolder app/Fedora\ Media\ Writer.app -format UDCO -imagekey zlib-level=9 -scrub -volname FedoraMediaWriter-osx ../FedoraMediaWriter-osx-$VERSION.unnotarized.dmg
popd >/dev/null
}
function notarize() {
echo "=== Submitting for notarization ==="
xcrun altool --notarize-app --primary-bundle-id "org.fedoraproject.mediawriter" --username "${NOTARIZATION_EMAIL}" --password "@keychain:${NOTARIZATION_KEYCHAIN_ITEM}" --asc-provider "${NOTARIZATION_ITUNES_ORGID}" --file "../FedoraMediaWriter-osx-$VERSION.unnotarized.dmg"
echo "DONE. After notarization finished (you'll get an email), run:"
echo "$ xcrun stabler stable app/Fedora\ Media\ Writer.app"
echo "$ hdiutil create -srcfolder app/Fedora\ Media\ Writer.app -format UDCO -imagekey zlib-level=9 -scrub -volname FedoraMediaWriter-osx ../FedoraMediaWriter-osx-$VERSION.dmg"
}
if [[ $# -eq 0 ]]; then
configure
build
deps
sign
dmg
notarize
else
$1
fi