-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.sh
executable file
·105 lines (87 loc) · 2.36 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
#!/bin/bash
show_help() {
echo "build.sh - build irodsclient package for OS X and Linux"
echo "usage: ./build.sh [-h] [-v] [-r os-release-label] [-q qt-root-dir]"
echo "-h prints help"
echo "-v sets verbose mode on"
echo "-r sets os release label in build package"
echo "-q sets Qt root directory path"
}
# initialize parameters with defaults
PLATFORM=`uname`
VERSION=1.1.0b2
OSRELEASE=unknown
# reset POSIX option index variable
OPTIND=1
# parse command line arguments
while getopts "hvr:q:" opt; do
case "$opt" in
h)
show_help
exit 0
;;
v)
VERBOSE=1
;;
r)
OSRELEASE=$OPTARG
;;
q)
QTROOT=$OPTARG
;;
esac
done
if [ "$PLATFORM" = "Darwin" ]; then
echo "Building for OS X"
# if no Qt path was provided, set to default
if [ "$QTROOT" == "" ]; then
QTROOT=~/Qt/5.5/clang_64
fi
QTDEPLOY=$QTROOT/bin/macdeployqt
APPBUNDLE=iRODS.app
APPBUNDLE_SRC=./src/$APPBUNDLE
PKGROOT=./pkgroot
PKG_PLIST=iRODS.app.pkg.plist
PKG_VERSION=$VERSION
PKG_ID=fi.jyu.iRODS.app
PKG_INSTALL=/Applications
PKG_FILE=iRODS.app-$VERSION.pkg
# compile executable and build app bundle
echo "compiling executable and building osx app bundle..."
(cd src; $QTROOT/bin/qmake -spec macx-clang CONFIG+=x86_64 && make)
# continue build only if make is successful
if [ $? -ne "0" ]; then
exit
fi
# setup package root with app bundle
echo "staging package root..."
mkdir -p $PKGROOT
cp -R $APPBUNDLE_SRC $PKGROOT/
# deploy Qt libraries
echo "deploying Qt libaries to app bundle..."
$QTDEPLOY $PKGROOT/$APPBUNDLE
# build install package
echo "building install package..."
pkgbuild --root $PKGROOT \
--component-plist $PKG_PLIST \
--version $PKG_VERSION \
--identifier $PKG_ID \
--install-location $PKG_INSTALL \
$PKG_FILE
else
echo "Building for Linux:"
# if no Qt path was provided, set to default
if [ "$QTROOT" == "" ]; then
QTROOT=/usr/lib64/qt5
fi
# build a makefile and make
echo "building executable..."
(cd src; $QTROOT/bin/qmake && make)
# continue build only if make was successful
if [ $? -ne "0" ]; then
exit
fi
# create tar package
echo "creating rpmbuild dist tarball package..."
(cd src; tar cvzf ../kanki-irodsclient-$VERSION-linux-$OSRELEASE.tar.gz irodsclient schema.xml)
fi