-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild-qt-wallet-macos.sh
executable file
·153 lines (128 loc) · 5.63 KB
/
build-qt-wallet-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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/sh
echo "Starting build-qt-wallet-macos.sh"
NUMBER_GLOBAL=`cat ./version.txt`
export MACOSX_DEPLOYMENT_TARGET=10.9
. ~/.cargo/env
# Clean everything. This is a release build so we can wait
rm -rf mwc713 mwc-node mwc-qt-wallet target/*
mkdir -p target
# Build mwc-node
git clone https://github.com/mwcproject/mwc-node
cd mwc-node
TAG_FOR_BUILD_FILE=../mwc-node.version
if [ -f "$TAG_FOR_BUILD_FILE" ]; then
git fetch && git fetch --tags;
git checkout `cat $TAG_FOR_BUILD_FILE`;
fi
./build_static.sh
FILE=target/release/mwc
if [ ! -f "$FILE" ]; then
echo "ERROR: $FILE does not exist";
exit 1;
fi
cd ..
# First build mwc713 statically
git clone https://github.com/mwcproject/mwc713
cd mwc713
TAG_FOR_BUILD_FILE=../mwc713.version
if [ -f "$TAG_FOR_BUILD_FILE" ]; then
git fetch && git fetch --tags;
git checkout `cat $TAG_FOR_BUILD_FILE`;
fi
./build_static.sh
FILE=target/release/mwc713
if [ ! -f "$FILE" ]; then
echo "ERROR: $FILE does not exist";
exit 1;
fi
FILE=target/release/mwczip
if [ ! -f "$FILE" ]; then
echo "ERROR: $FILE does not exist";
exit 1;
fi
cd ..
# prepare for QT fix
export QT_INSTALL_PATH=`pwd`/Qt
echo "QT_INSTALL_PATH=$QT_INSTALL_PATH"
# Second build mwc-qt-wallet
git clone https://github.com/mwcproject/mwc-qt-wallet
cp fix_macos_makefile.sh mwc-qt-wallet
cd mwc-qt-wallet
TAG_FOR_BUILD_FILE=../mwc-qt-wallet.version
if [ -f "$TAG_FOR_BUILD_FILE" ]; then
git fetch && git fetch --tags;
git checkout `cat $TAG_FOR_BUILD_FILE`;
echo "#define BUILD_VERSION \"`cat $TAG_FOR_BUILD_FILE`\"" > build_version.h
else
echo "#define BUILD_VERSION \"1.1-$NUMBER_GLOBAL.beta.$1\"" > build_version.h
fi
echo "Here is what we have at build_version.h"
cat build_version.h
../Qt/5.9.9/clang_64/bin/qmake mwc-wallet-desktop.pro -spec macx-clang CONFIG+=x86_64
./fix_macos_makefile.sh
make -j8
# Finally prep dmg
cp ../mwc-node/target/release/mwc mwc-qt-wallet.app/Contents/MacOS/mwc
cp ../mwc713/target/release/mwc713 mwc-qt-wallet.app/Contents/MacOS/mwc713
cp ../mwc713/target/release/mwczip mwc-qt-wallet.app/Contents/MacOS/mwczip
cp ../resources/macOs/* mwc-qt-wallet.app/Contents/MacOS/
mkdir -p mwc-qt-wallet.app/Contents/Frameworks/xz
cp ../resources/liblzma.5.dylib mwc-qt-wallet.app/Contents/Frameworks/xz
# fix tor lib
install_name_tool -change /usr/local/opt/xz/lib/liblzma.5.dylib "@executable_path/../Frameworks/xz/liblzma.5.dylib" ./mwc-qt-wallet.app/Contents/MacOS/tor
../Qt/5.9.9/clang_64/bin/macdeployqt mwc-qt-wallet.app -appstore-compliant -verbose=2
echo "deployqt complete"
if [ -z "$2" ]
then
echo "not signing just building dmg"
# We can't sign so just build dmg
hdiutil create ../target/mwc-qt-wallet.dmg -fs HFS+ -srcfolder mwc-qt-wallet.app -format UDZO -volname mwc-qt-wallet;
echo "Complete!";
else
echo "Setting up certs"
unzip -P $4 ../certs.zip
ls -al ./certs
# setup certs
sudo security list-keychains
ls -l ~/Library/Keychains
#echo 'export PATH="/usr/local/opt/libressl/bin:$PATH"' >> /Users/runner/.bash_profile
#source /Users/runner/.bash_profile
#openssl version
#openssl enc -d -aes-256-cbc -in ../certs.tar.gz.enc -out certs.tar.gz -k $3
#openssl enc -d -aes-256-cbc -in ../certsJB.tar.gz.enc -out certs.tar.gz -k $4
sudo security create-keychain -p password nchain.keychain
sudo security add-certificates -k nchain.keychain certs/azure_cert.cer
sudo security unlock-keychain -p password nchain.keychain
sudo security import certs/azure_cert.p12 -k nchain.keychain -P $4 -T /usr/bin/codesign
echo "Finished creating keychain"
security list-keychains -s login.keychain nchain.keychain
ls -l ~/Library/Keychains
sudo security list-keychain
sudo security set-key-partition-list -S apple-tool:,apple: -s -k password nchain.keychain >/dev/null 2>&1
echo "signing the app now"
# Sign
#codesign --force --options runtime --sign 'Developer ID Application: Christopher Gilliard (D6WGXN9XBM)' --deep mwc-qt-wallet.app
codesign --force --options runtime --sign 'Developer ID Application: James Byrer (76DUL32Z4P)' --deep mwc-qt-wallet.app
# Building the disk image for the app folder
hdiutil create ../target/mwc-qt-wallet.dmg -fs HFS+ -srcfolder mwc-qt-wallet.app -format UDZO -volname mwc-qt-wallet
# echo "SIGNING AND NOTARIZING IS DISABLED!!! Please fix me"
# exit
echo "Your diskimage is created. Now we need to sign it..."
# signing resulting package
#codesign --sign 'Developer ID Application: Christopher Gilliard (D6WGXN9XBM)' ../target/mwc-qt-wallet.dmg
codesign --sign 'Developer ID Application: James Byrer (76DUL32Z4P)' ../target/mwc-qt-wallet.dmg
# now notarize the app
echo "Notarizing this will take a while..."
rm -rf /tmp/notarize_out.log;
#xcrun altool --notarize-app -f ../target/mwc-qt-wallet.dmg --primary-bundle-id com.yourcompany.mwc-qt-wallet -u [email protected] -p $2
#xcrun altool --notarize-app -f ../target/mwc-qt-wallet.dmg --primary-bundle-id com.yourcompany.mwc-qt-wallet -u [email protected] -p $5
xcrun altool --notarize-app -f ../target/mwc-qt-wallet.dmg --primary-bundle-id com.yourcompany.mwc-qt-wallet -u [email protected] -p $5
echo "Sleeping for 2 minutes to let apple process things."
sleep 120;
xcrun stapler staple -q -v ../target/mwc-qt-wallet.dmg
echo "Check your resulting image at target/mwc-qt-wallet.dmg. Check contents at mwc-qt-wallet/mwc-qt-wallet.app"
echo "To do this, open the dmg, and drag the app into the /Applications folder"
echo "Then run this command: spctl -a -v /Applications/mwc-qt-wallet.app"
echo "You should see a message like this: source=Notarized Developer ID"
echo "Note you must be on MacOSX10.14+"
fi