-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild_mac.sh
98 lines (73 loc) · 3.06 KB
/
build_mac.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
#!/bin/sh -x
QT_PATH=$HOME/Qt/5.12.5/clang_64
RELEASE_VERSION=$(cat "release_version.txt")
echo $RELEASE_VERSION
SOURCE_PATH=$PWD
BUILD_NAME=yara_sort_mac_portable
GUIEXE=yara-sort
cd $SOURCE_PATH
rm -rf build
function makeproject
{
cd $SOURCE_PATH/$1
$QT_PATH/bin/qmake $1.pro -spec macx-clang CONFIG+=x86_64
make -f Makefile clean
make -f Makefile
rm -rf Makefile
rm -rf Makefile.Release
rm -rf Makefile.Debug
rm -rf object_script.*
cd $SOURCE_PATH
}
makeproject gui_source
mkdir -p release
rm -rf release/$BUILD_NAME
mkdir -p release/$BUILD_NAME
cp -R $SOURCE_PATH/build/release/$GUIEXE.app $SOURCE_PATH/release/$BUILD_NAME
cp -R $SOURCE_PATH/packer.yar $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/MacOS/
mkdir $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/PlugIns
function fixlibrary
{
install_name_tool -change @rpath/$1.framework/Versions/5/$1 @executable_path/../Frameworks/$1.framework/Versions/5/$1 $2
}
function fiximport
{
fixlibrary QtWidgets $1
fixlibrary QtGui $1
fixlibrary QtCore $1
#fixlibrary QtDBus $1
fixlibrary QtPrintSupport $1
}
function copylibrary
{
mkdir $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/Frameworks
mkdir $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/Frameworks/$1.framework
mkdir $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/Frameworks/$1.framework/Versions
mkdir $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/Frameworks/$1.framework/Versions/5
cp -R $QT_PATH/lib/$1.framework/Versions/5/$1 $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/Frameworks/$1.framework/Versions/5
install_name_tool -id @executable_path/../Frameworks/$1.framework/Versions/5/$1 $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/Frameworks/$1.framework/Versions/5/$1
fiximport $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/Frameworks/$1.framework/Versions/5/$1
}
function copyplugin
{
mkdir $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/PlugIns/$1/
cp -R $QT_PATH/plugins/$1/$2.dylib $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/PlugIns/$1/
install_name_tool -id @executable_path/../PlugIns/$1/$2.dylib $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/PlugIns/$1/$2.dylib
fiximport $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/PlugIns/$1/$2.dylib
}
fiximport $SOURCE_PATH/release/$BUILD_NAME/$GUIEXE.app/Contents/MacOS/$GUIEXE
copylibrary QtWidgets
copylibrary QtGui
copylibrary QtCore
copylibrary QtSql
#copylibrary QtDBus
copylibrary QtPrintSupport
copyplugin platforms libqcocoa
copyplugin platforms libqminimal
copyplugin platforms libqoffscreen
copyplugin sqldrivers libqsqlite
rm -rf $SOURCE_PATH/release/${BUILD_NAME}_${RELEASE_VERSION}.dmg
hdiutil create -format UDBZ -quiet -srcfolder $SOURCE_PATH/release/$BUILD_NAME $SOURCE_PATH/release/${BUILD_NAME}_${RELEASE_VERSION}.dmg
cd $SOURCE_PATH/release/
zip -r $SOURCE_PATH/release/${BUILD_NAME}_${RELEASE_VERSION}.zip ${BUILD_NAME}
rm -rf $SOURCE_PATH/release/$BUILD_NAME