File: make-mac.sh

package info (click to toggle)
beid 3.5.2.dfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 147,240 kB
  • ctags: 34,507
  • sloc: cpp: 149,944; ansic: 41,577; java: 8,927; cs: 6,528; sh: 2,426; perl: 1,866; xml: 805; python: 463; makefile: 263; lex: 92
file content (282 lines) | stat: -rw-r--r-- 7,961 bytes parent folder | download
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
#!/bin/bash

# java 1.4.2 is not supported any more since oct 2008
MINJAVAVER=1.5
MACHINETYPE=i386
OSXVER=10.5

#########################################
# we must be running on intel
#########################################
echo "[Info ] Verifying machine type..."
MACHINE=`uname -p`
if [ "$MACHINE" != "i386" ]
then
	echo "[Error] Incorrect machine type. Must be $MACHINETYPE."
	exit -1
else
	echo "[Info ] Machine type: $MACHINE."
fi

#########################################
# we must be on a 10.5
#########################################
echo "[Info ] Verifying OSX version..."
IFS=$'\n' ver=($(sw_vers))
ver=(${ver[1]})

if [[ $ver != *$OSXVER* ]]
then
	echo "[Error] Incorrect OS version: $ver. Must be $OSXVER."
	exit -1	
else
	echo "[Info ] OSX version: $ver[1]."
fi


#########################################
# check gcc compiler installed
#########################################
GCC=`which gcc 2> /dev/null | wc -l`
echo "[Info ] Verifying gcc compiler..."
if [[ $GCC -eq 0 ]]
then
	echo "[Error] gcc compiler not found. Please verify or install."
	exit -1

else
	GCCVER=`gcc --version`
	echo "[Info ] Installed. gcc version: $GCCVER"
fi

#########################################
# check g++ compiler installed
#########################################
echo "[Info ] Verifying g++ compiler..."
GPP=`which g++ 2> /dev/null | wc -l`
if [ $GPP -eq 0  ]
then
	echo "[Error] g++ compiler not found. Please verify or install."
	exit -1
else
	GPPVER=`g++ --version`
	echo "[Info ] Installed. g++ version: $GPPVER"
fi

#########################################
# check xerces installed
#########################################
XERCESCLIB=libxerces-c.28.0.dylib
XERCESCPATH=../_src/ThirdParty/Xerces/Xerces-2.8.0-mac
echo "[Info ] Verifying xerces libraries..."
if [ ! -e $XERCESCPATH/lib/$XERCESCLIB ]
then
	echo "[Error] xerces library not found at $XERCESCPATH/lib. Please verify or install."
	exit -1
else
	echo "[Info ] Installed"
fi

echo "[Info ] Verifying xerces include..."
XERCESCINC=SAXParser.hpp
if [ ! -e $XERCESCPATH/include/xercesc/parsers/$XERCESCINC ]
then
	echo "[Error] xerces include file not found at $XERCESPATH//include/xercesc/parsers/. Please verify or install."
	exit -1
else
	echo "[Info ] Installed"
fi


#########################################
# check Qt4 installed
#########################################

MINQT4VER=4.5.0
pkg=qmake

echo "[Info ] Checking Qt4"

QT4=`which $pkg 2> /dev/null | wc -l`
if [ $QT4 -eq 0 ]
then
	echo "[Error] qmake can not be found."
	echo "[Error] Set the PATH environment variable or download/install Qt4 and try again."
	exit -1
else
	#-----------------------------------------
	# parse the version string assumed to be in the format: XXX.YYY.ZZZ
	# we use 'moc' to make parsing of the version nr easier
	#-----------------------------------------
	QT4=`which qmake`
	THEPATH=${QT4%/*}
	QT4VERSION=`${THEPATH}/moc -v 2>&1`
	VERSIONSTR=`expr ${QT4VERSION} : '.*\([1-9]\.[0-9]\.[0-9]\)'`

	if [[ "${VERSIONSTR}" = "${MINQT4VER}" ]]
	then
		echo "[Info ] Qt4 version ${VERSIONSTR} found at ${THEPATH}"
	else if [[ "${VERSIONSTR}" > "${MINQT4VER}" ]]
		then
			echo "[Warn ] Qt4 version ${VERSIONSTR} found at ${THEPATH}"
			echo "[Warn ] The Qt4 version used is ideally ${MINQT4VER}"
			echo "[Warn ] If needed, stop the process and install Qt4 ${MINQT4VER}"
		else
			echo "[Error] Minimum Qt4 version ${MINQT4VER} not installed"
		exit -1
	fi
	fi
fi


#-----------------------------------------
# verify the java installation
# we assume that a JDK is installed. To find out the jdk version we have to find the java
# command. When a JDK is installed, the java will be at the same location as the javac.
# therefor, we first try to locate the javac, and from that path, we execute the java -version
# command.
# we parse the output and compare this to the predefined minimum java version
#-----------------------------------------
pkg=javac

echo "[Info ] Verifying JDK"

JDK=`which javac 2> /dev/null | wc -l`
if [ $JDK -eq 0 ]
then
	echo "[Error] javac can not be found."
	echo "[Error] Set the PATH environment variable or download/install the jdk and try again."
	exit -1
else
	#-----------------------------------------
	# get the path of the javac and execute from this path the 'java -version' command
	# parse the version string assumed to be in the format: XXX.YYY.ZZZ_NNN
	#-----------------------------------------
	JDK=`which javac`
	THEPATH=${JDK%/*}
	IFS=$'\n' JAVAVERSION=($(${THEPATH}/javac -version 2>&1))

	VERSIONSTR=`expr $JAVAVERSION : '.*\([1-9]\.[0-9]\.[0-9]\)'`

	if [[ "${VERSIONSTR}" == "*${MINJAVAVER}*" ]]
	then
		echo "[Info ] Java version ${VERSIONSTR} found at ${THEPATH}"
	else if [[ "${VERSIONSTR}" > "${MINJAVAVER}" ]]
		then
			echo "[Warn ] Java version ${VERSIONSTR} found at ${THEPATH}"
			echo "[Warn ] The java version used is ideally ${MINJAVAVER}"
			echo "[Warn ] If needed, stop the process and install java ${MINJAVAVER}"
		else
			echo "[Error] javac version ${VERSIONSTR} must be higher than ${MINJAVAVER} "
			echo "[Error] Install version ${MINJAVAVER} or higher of the jdk."
			exit -1
		fi
	fi
fi

#-----------------------------------------
# make sure scripts are executable
#-----------------------------------------
CURRDIR=`pwd`
cd ../_src/eidmw
chmod +x configure_mac.sh
chmod +x configure

#-----------------------------------------
# configure and build the eID MW
# we don't run the makefile just like that because we want
# to control what is built
#-----------------------------------------
./configure_mac.sh
if [[ "${UNIVERSAL}" != "true" ]]
then
	make
fi
cd -

if [[ "${UNIVERSAL}" == "true" ]]
then
	cd ../_src/eidmw/_Builds
	xcodebuild -configuration Release
	cd -
fi

#-----------------------------------------
# Check the tokend is present, otherwise unzip the sources
#-----------------------------------------
if [ -d ../_src/eidmw/tokend/Sources ]
then
	cd ../_src/eidmw/tokend
	sudo rm -rf Sources
	cd -
fi

cd ../_src/eidmw/tokend 
tar -xvf SourcesDeploy.tar.gz
cd -

#-----------------------------------------
# build the tokend
#-----------------------------------------
cd ../_src/eidmw/tokend/Sources

xcodebuild -configuration Deployment

if [ ! -d build/Deployment/BEID.tokend ] 
then
	echo "[Error] Build tokend failed"
	exit -1
fi

if [ -d ../../bin/BEID.tokend ] 
then
	rm -rf ../../bin/BEID.tokend
fi

mv build/Deployment/BEID.tokend ../../bin

cd -

#-----------------------------------------
# 
#-----------------------------------------
cd ../_src/eidmw/misc/mac/OOoRegister
make
cd -

#-----------------------------------------
# create a pkg and dmg file
# The makefile requires
#-----------------------------------------
cd ../_src/eidmw/_Builds
sudo make -f Makefile_mac release QTBASEDIR=$QTBASEDIR UNIVERSAL=${UNIVERSAL}
cd -

#-----------------------------------------
# build the Quickinstaller in release mode
#-----------------------------------------
cd ../_src/eID-QuickInstaller/eID-EZinstaller
xcodebuild -project eID-EZinstaller.xcodeproj clean
xcodebuild -project eID-EZinstaller.xcodeproj -target eID-Quickinstaller -configuration Release
cd -

BUILDNR=`cat ../_src/eidmw/svn_revision | tr -d "\r"`

#-----------------------------------------
# move the beid.pkg to the quickinstaller and keep a copy locally
#-----------------------------------------
sudo rm -rf beid-$BUILDNR.pkg

sudo cp -r /release_build/beid.pkg .
sudo mv beid.pkg beid-$BUILDNR.pkg

#-----------------------------------------
# move the QuickInstaller dmg here with the correct build nr
#-----------------------------------------
if [ -e eID-Quickinstaller-$BUILDNR.dmg ]
then
	rm eID-Quickinstaller-$BUILDNR.dmg
fi
echo "[Info ] Copy ../_src/eID-QuickInstaller/eID-EZinstaller/build/Release/eID-Quickinstaller-$BUILDNR.dmg to ./eID-Quickinstaller-$BUILDNR.dmg "
cp ../_src/eID-QuickInstaller/eID-EZinstaller/build/Release/eID-Quickinstaller-$BUILDNR.dmg eID-Quickinstaller-$BUILDNR.dmg
echo "[Info ] Done..."