-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_macOS_ci.sh
executable file
·130 lines (98 loc) · 4.43 KB
/
build_macOS_ci.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
#!/bin/bash
set -o errexit -o nounset
PROJECT_DIR="${SOURCE_DIR}"
QT_PATH="${Qt6_DIR}"
KRYVO_VERSION="${KRYVO_VERSION:-dev}"
OPENSSL_PATH="/usr/local/opt/openssl@3"
# Output macOS version
sw_vers
# Update platform
echo "Updating platform..."
brew update
brew install p7zip
# npm install -g appdmeg
# Add Qt binaries to path
echo "Adding Qt binaries to path..."
PATH="${QT_PATH}/bin/:${PATH}"
# Check qmake version
echo "Check qmake version..."
qmake --version
cd "${PROJECT_DIR}"
# Clean build directory
rm -rf "${PROJECT_DIR}/build/macOS/"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/widgets/"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/widgets/moc"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/widgets/qrc"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/widgets/obj"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/quick/"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/quick/moc"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/quick/qrc"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/quick/obj"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/lib/"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/lib/zlib/"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/test/"
mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/Kryvo/"
# Build Kryvo
echo "Building Kryvo..."
if [ -f "${PROJECT_DIR}/Makefile" ]; then
make distclean
fi
qmake -makefile CONFIG+=release OPENSSL_INCLUDE_PATH=${OPENSSL_PATH}/include OPENSSL_LIB_PATH=${OPENSSL_PATH}/lib
make
echo "Skipping tests..."
# Copy Qt dependencies for test app
# echo "Copying Qt dependencies to test app..."
# cd "${PROJECT_DIR}/build/macOS/clang/x86_64/release/test/"
# macdeployqt tests.app
# Copy plugins to test app
# echo "Copying plugins for test app..."
# mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/test/tests.app/Contents/PlugIns/cryptography/botan/"
# cd "${PROJECT_DIR}/build/macOS/clang/x86_64/release/test/tests.app/Contents/PlugIns/cryptography/botan/"
# cp "${PROJECT_DIR}/build/macOS/clang/x86_64/release/plugins/cryptography/botan/libbotan.dylib" libbotan.dylib
# Copy test data
# echo "Copying test data archive..."
# cd "${PROJECT_DIR}/build/macOS/clang/x86_64/release/test/tests.app/Contents/MacOS/"
# cp "${PROJECT_DIR}/src/tests/data/test-data.zip" test-data.zip
#
# echo "Extracting test data..."
# 7z e test-data.zip &>/dev/null
# Run tests
# echo "Running tests..."
# chmod +x tests
# ./tests
# Copy plugins to app
# echo "Copy plugins to app..."
# mkdir -p "${PROJECT_DIR}/build/macOS/clang/x86_64/release/widgets/Kryvo.app/Contents/PlugIns/cryptography/botan/"
# cd "${PROJECT_DIR}/build/macOS/clang/x86_64/release/widgets/Kryvo.app/Contents/PlugIns/cryptography/botan/"
# cp "${PROJECT_DIR}/build/macOS/clang/x86_64/release/plugins/cryptography/botan/libbotan.dylib" libbotan.dylib
# Package Kryvo
echo "Packaging..."
echo "Copying app to packaging directory..."
cp -a "${PROJECT_DIR}/build/macOS/clang/x86_64/release/widgets/." "${PROJECT_DIR}/build/macOS/clang/x86_64/release/Kryvo/"
cd "${PROJECT_DIR}/build/macOS/clang/x86_64/release/Kryvo/"
rm -rf moc
rm -rf obj
rm -rf qrc
mkdir -p "./Kryvo.app/Contents/Frameworks/"
cp -a "${OPENSSL_PATH}/lib/libcrypto.3.dylib" "./Kryvo.app/Contents/Frameworks/libcrypto.3.dylib"
ln -s "./Kryvo.app/Contents/Frameworks/libcrypto.3.dylib" "./Kryvo.app/Contents/Frameworks/libcrypto.dylib"
mkdir -p "./Kryvo.app/Contents/MacOS/themes/"
cp -a "${PROJECT_DIR}/resources/stylesheets/kryvo.qss" "./Kryvo.app/Contents/MacOS/themes/kryvo.qss"
echo "Copying Qt dependencies and creating dmg archive..."
macdeployqt ./Kryvo.app -dmg
mv Kryvo.dmg "Kryvo_${KRYVO_VERSION}.dmg"
# appdmg json-path Kryvo_${TRAVIS_TAG}.dmg
cp -a "${PROJECT_DIR}/Release Notes" "./Release Notes"
cp -a "${PROJECT_DIR}/README.md" "./README.md"
cp -a "${PROJECT_DIR}/LICENSE" "./LICENSE"
cp -a "${PROJECT_DIR}/OpenSSL License" "./OpenSSL License"
cp -a "${PROJECT_DIR}/Botan License" "./Botan License"
cp -a "${PROJECT_DIR}/Qt License" "./Qt License"
mkdir themes
cp -a "${PROJECT_DIR}/resources/stylesheets/kryvo.qss" "./themes/kryvo.qss"
echo "Packaging archive..."
tar czvf "kryvo_${KRYVO_VERSION}_macos.tar.gz" "Kryvo_${KRYVO_VERSION}.dmg" "Release Notes" "README.md" "LICENSE" "Botan License" "Qt License"
cd "${PROJECT_DIR}/build/macOS/clang/x86_64/release/"
mv "./Kryvo/kryvo_${KRYVO_VERSION}_macos.tar.gz" "./kryvo_${KRYVO_VERSION}_macos.tar.gz"
echo "Done!"
exit 0