forked from pgmodeler/pgmodeler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
macdeploy.sh
executable file
·110 lines (89 loc) · 2.35 KB
/
macdeploy.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
#/bin/bash
USR=`whoami`
QT_ROOT=/Users/$USR/Qt5.3.0/5.3/clang_64
QMAKE_ARGS="-r CONFIG+=x86_64 -spec macx-clang"
LOG=macdeploy.log
# Detecting current pgModeler version
DEPLOY_VER=`cat libutils/src/globalattributes.h | grep PGMODELER_VERSION | grep -o '[0-9].[0-9].[0-9]\(.\)*'`
DEPLOY_VER=${DEPLOY_VER/\",/}
BUILD_NUM=$(date '+%Y%m%d')
PKGNAME="pgmodeler-$DEPLOY_VER-macosx"
WITH_BUILD_NUM='-with-build-num'
if [[ "$*" == "$WITH_BUILD_NUM" ]]; then
PKGNAME="${PKGNAME}_${BUILD_NUM}"
fi
PKGFILE=$PKGNAME.dmg
APPNAME=pgmodeler
BUNDLE=$APPNAME.app
clear
echo
echo "pgModeler Mac OSX deployment script"
echo "PostgreSQL Database Modeler Project - pgmodeler.com.br"
echo "Copyright 2006-2014 Raphael A. Silva <rkhaotix@gmail.com>"
# Identifying System Qt version
if [ -e "$QT_ROOT/bin/qmake" ]; then
QT_VER=`$QT_ROOT/bin/qmake --version | grep -m 1 -o '[0-9].[0-9].[0-9]'`
QT_VER=${QT_VER:0:5}
fi
# If Qt was not found in system path
if [ -z "$QT_VER" ]; then
echo
echo "** No Qt framework was found!"
echo
exit 1
else
# Checking if identified version is valid (>= 5.0.0)
if [[ "$QT_VER" < "5.0.0" ]]; then
echo
echo "** Qt framework found but in no suitable version (>= 5.0.0)!"
echo "** Installed Qt version: $QT_VER"
echo
exit 1
fi
fi
echo
echo "Deploying version: $DEPLOY_VER"
echo "Cleaning previous compilation..."
rm -r build/* &> $LOG
make distclean >> $LOG 2>&1
echo "Running qmake..."
$QT_ROOT/bin/qmake $QMAKE_ARGS >> $LOG 2>&1
if [ $? -ne 0 ]; then
echo
echo "** Failed to execute qmake with arguments '$QMAKE_ARGS'"
echo
exit 1
fi
echo "Compiling code..."
make >> $LOG 2>&1
if [ $? -ne 0 ]; then
echo
echo "** Compilation failed!"
echo
exit 1
fi
echo "Installing dependencies..."
make install >> $LOG 2>&1
if [ $? -ne 0 ]; then
echo
echo "** Installation failed!"
echo
exit 1
fi
echo "Packaging installation..."
rm $PKGFILE >> $LOG 2>&1
# Deploy the Qt libraries onto app bundle
$QT_ROOT/bin/macdeployqt build/$BUNDLE >> $LOG 2>&1
# Remove the libpq from Frameworks path
rm build/$BUNDLE/Contents/Frameworks/libpq* >> $LOG 2>&1
# Creates an empty dmg file named
hdiutil create -fs HFS+ $PKGFILE -volname $APPNAME -srcfolder build/ >> $LOG 2>&1
if [ $? -ne 0 ]; then
echo
echo "** Failed to create package!"
echo
exit 1
fi
echo "File created: $PKGFILE"
echo "pgModeler successfully deployed!"
echo