root/middleware-offline/trunk/_src/eidmw/build_eidmw_linux.sh @ 5

Revision 5, 5.9 KB (checked in by vsilva, 9 years ago)

Initial comit

Line 
1#!/bin/bash
2#-----------------------------------------
3# this script will build the eID MW project on linux
4# it will call all necessary scripts to build and will log
5# the build process to a file build_eidmw_<distro>_<buildnr>.log
6# parameters:
7# local: build the eID MW locally. No network dependencies are used
8#
9# The script will use some settings from a file to set paths correctly. These
10# files depend on the platform and are:
11#      source ${DIR_CURR}/build_${PROJ_NAME}_${DISTRO}.source
12#
13# Verify these files before the build script is started
14#
15# REMARK: make sure the path to Qt and javac is set before this script is started
16#-----------------------------------------
17DISTRO=none
18TARBALLDISTRO=none
19DIR_CURR=`pwd`
20PROJ_NAME=eidmw
21DIR_PROJ=~${DIR_CURR}
22#TARGETDIR="~/.gvfs/eidmwbuilds\ on\ 10.2.250.42"
23PROCESSOR=`uname -p`
24TESTFILE=test.txt
25LOCALBUILD=0
26GENERATETAR=0
27
28until [ -z "$1" ]
29do
30        if [ $1 == "local" ]
31        then
32                LOCALBUILD=$1
33                echo "[Info ] Local build eID MW."
34        else if [ $1 == "notar" ]
35        then
36                GENERATETAR=$1
37                echo "[Info ] Not generating tarball."
38        else if [ $1 == "help" ]
39        then
40                echo "$0 [local,notar] "
41                echo "local: build the eID MW on the local machine."
42                echo "notar: do not generate tarball."
43                exit -1
44        fi
45        fi
46        fi
47        shift
48done
49
50#-----------------------------------------
51# check if the file local.cfg exists. If it exists, then do not
52# access SVN, network, etc.
53#-----------------------------------------
54if [ -e "local.cfg" ]
55then
56        LOCALBUILD="local"
57fi
58
59if [ -e "/etc/fedora-release" ]
60then
61        DISTRO=fedora
62        TARBALLDISTRO=fedora
63else
64if [ -e "/etc/SuSE-release" ]
65then
66        DISTRO=suse
67        TARBALLDISTRO=opensuse
68else
69if [ -e "/etc/debian_version" ]
70then
71        DISTRO=debian
72        TARBALLDISTRO=debian
73        PROCESSOR=`uname -m`
74#       TARGETDIR=/mnt/eidmwbuilds
75else
76        echo "[Error] Unsupported Linux distribution."
77        echo "[Error] Done..."
78        exit -1
79fi
80fi
81fi
82
83#-----------------------------------------
84# check that the eID MW 2.6 is available
85#-----------------------------------------
86#echo "[Info ] checking eID MW 2.6 directory ../pteid-2.6"
87#if [ ! -d ../pteid-2.6 ]
88#then
89#       echo "[Error] eID MW 2.6 directory ../pteid-2.6 not found "
90#       exit -1
91#fi
92#-----------------------------------------
93# make sure all scripts are executable
94#-----------------------------------------
95chmod +x *.sh
96chmod +x *.pl
97chmod +x configure
98
99chmod +x _DocsInternal/API/*.sh
100chmod +x misc/*.pl
101#-----------------------------------------
102# make sure all pteid-2.6 scripts are executable
103#-----------------------------------------
104#chmod +x ../pteid-2.6/*.sh
105#chmod +x ../pteid-2.6/*.pl
106#chmod +x ../pteid-2.6/configure
107#
108mkdir -p _DocsInternal/API
109mkdir -p _DocsInternal/C++_Api/html
110mkdir -p _DocsExternal/Java_Api/html
111#-----------------------------------------
112# test if the target directory is accessible
113# this is done by touching a file since testing the existance
114# of the directory does not work due to the spaces in the directory
115# name on fedora and suse.
116#-----------------------------------------
117if [ ${LOCALBUILD} != "local" ]
118then
119        eval touch $TARGETDIR/$TESTFILE &> /dev/null
120        NRFILES=`eval ls $TARGETDIR 2> /dev/null | wc -l`
121
122        if [ $NRFILES == 0 ]
123        then
124                echo "[Error] SMB not mounted to store build results."
125                echo "[Error] Expected mount point: $TARGETDIR"
126                if [ -e "/etc/debian_version" ]
127                then
128                        echo "[Error] Please mount as follows as 'root':"
129                        cat howtomount.sh
130                fi
131                exit -1
132        fi
133        eval rm $TARGETDIR/$TESTFILE
134fi
135
136#-----------------------------------------
137# make sure we get the SVN revision nr for this build
138#-----------------------------------------
139if [ ${LOCALBUILD} != "local" ]
140then
141        ./getsvnrevision.pl
142fi
143
144if [ ! -e "svn_revision" ]
145then
146        echo "[Error] File svn_revision not found"
147        exit -1
148fi
149
150BUILD_NR=`cat svn_revision | tr -d "\r"`
151LOGFILE=build_${PROJ_NAME}_${DISTRO}_${BUILD_NR}.log
152
153echo "[Info] Logging to file: " ${LOGFILE}
154
155#-----------------------------------------
156# first build the 2.6 version
157#-----------------------------------------
158#source ${DIR_CURR}/build_${PROJ_NAME}_${DISTRO}.source
159#cd ../pteid-2.6
160#./build_eidmw_linux.sh ${LOCALBUILD} 2>&1 | tee ${LOGFILE}
161#cd ${DIR_CURR}
162
163#-----------------------------------------
164# perform all steps to do a complete build
165#-----------------------------------------
166# set the environment variables
167# run the configure script
168# start the make process
169#-----------------------------------------
170echo "[Info] Building eID MW"
171chmod +x configure_${DISTRO}.sh
172./configure_${DISTRO}.sh
173make 2>&1 | tee -a ${LOGFILE} 
174
175#-----------------------------------------
176# this looks odd, but the $PIPESTATUS holds the return
177# value of make
178#-----------------------------------------
179if [ "$PIPESTATUS" -ne 0 ] 
180then
181        echo "[Error] Make failed. See logfile '${LOGFILE}'"
182        exit -1
183fi
184
185#-----------------------------------------
186# build the documentation
187#-----------------------------------------
188cd _DocsInternal/API
189echo "[Info] Generating doxygen documentation"
190#./doxygen_sdk_c.sh >> ${LOGFILE}
191./doxygen_sdk.sh >> ${LOGFILE}
192cd ${DIR_CURR} 
193
194if [ ${GENERATETAR} != "notar" ]
195then
196        cd misc
197        echo "[Info] Generating tarball"
198        ./prepareBinTarball.pl >> ${LOGFILE}
199        cd ${DIR_CURR} 
200        cd install
201        BINTARBALL=`ls pteid-middleware-3.?.*-${PROCESSOR}-${BUILD_NR}.tgz 2> /dev/null`
202        if [ -e "${BINTARBALL}" ]
203        then
204                BINTARBALL=`ls pteid-middleware-3.?.*-${PROCESSOR}-${BUILD_NR}.tgz`
205                cd ${DIR_CURR} 
206                echo "[Info] Tarball generated: " ${BINTARBALL}
207        else
208                echo "pteid-middleware-3.?.*-${PROCESSOR}-${BUILD_NR}.tgz not found"
209                echo "[Error] Bin tarball creation failed. See logfile 'misc/${LOGFILE}'"
210                exit -1
211        fi
212else
213        echo "[Info] Not generating tarball"
214fi
215
216       
217#-----------------------------------------
218# copy the tarball to the machine such everybody can access it
219#-----------------------------------------
220#if [ ${LOCALBUILD} != "local" ]
221#then
222#       if [ ${GENERATETAR} != "notar"  ]
223#       then
224#               echo "[Info] Copy ${BINTARBALL} to ${TARGETDIR}"
225#               cd install
226#               eval cp ${BINTARBALL} ${TARGETDIR}
227#               cd ${DIR_CURR}
228#       fi
229#fi
230echo "[Info] Done"
Note: See TracBrowser for help on using the browser.