forked from cyberb/gemalto
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathproject-build.sh
executable file
·149 lines (123 loc) · 4.11 KB
/
project-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
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
#!/bin/bash
# Linux Gemalto PKCS#11 library for Secure Element build script
# Build mode argument management
usage ()
{
echo 'Usage : ' $0 '<Release|Debug|CodeCoverage|CodeProfile>'
exit
}
BUILDTYPE=
if [ $# -gt 0 ]; then
SHELLNOCASEMATCH=`shopt -p nocasematch`
shopt -s nocasematch
[[ $1 =~ "release" ]] && BUILDTYPE=Release
[[ $1 =~ "Release" ]] && BUILDTYPE=Release
[[ $1 =~ "debug" ]] && BUILDTYPE=Debug
[[ $1 =~ "Debug" ]] && BUILDTYPE=Debug
[[ $1 =~ "codecoverage" ]] && BUILDTYPE=CodeCoverage
[[ $1 =~ "CodeCoverage" ]] && BUILDTYPE=CodeCoverage
[[ $1 =~ "codeprofile" ]] && BUILDTYPE=CodeProfile
[[ $1 =~ "CodeProfile" ]] && BUILDTYPE=CodeProfile
$SHELLNOCASEMATCH
fi
if [ "$BUILDTYPE" = "" ]
then
usage
fi
echo 'Building in' ${BUILDTYPE} 'mode ...'
# Get the absolute path of this script
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "${SCRIPT}")
#cross compilation setting
# export CXX=arm-linux-gnueabihf-g++
# export CC=arm-linux-gnueabihf-gcc
# Create the PROJECT_DIR environment variable
export PROJECT_DIR="${SCRIPTPATH}/"
# Save the current path
set SAVEDPATH=`pwd`
PKCS11LIB_SRCDIR=se-pkcs11-lib
SEACCESSLIB_SRCDIR=se-access-lib
TESTP11LIB_SRCDIR=test
# Make sure all files are Linux text files. can be commented out once formated
find ${PKCS11LIB_SRCDIR} -type f -exec dos2unix {} \;
find ${SEACCESSLIB_SRCDIR} -type f -exec dos2unix {} \;
find ${TESTP11LIB_SRCDIR} -type f -exec dos2unix {} \;
echo "========================================================"
echo "----- Secure Element Access library - Build -----"
echo "========================================================"
cd ${SCRIPTPATH}/${SEACCESSLIB_SRCDIR}/cinterion-modem/build
make clean BUILDTYPE=${BUILDTYPE}
make BUILDTYPE=${BUILDTYPE}
if [ $? -ne 0 ]; then
cd ${SAVEDPATH}
exit 1
fi
printf "\n"
echo "========================================================"
echo "----- Secure Element Access library - Installation -----"
echo "========================================================"
make install BUILDTYPE=${BUILDTYPE}
if [ $? -ne 0 ]; then
cd ${SAVEDPATH}
exit 1
fi
echo "========================================================"
echo "--------------- Modem Access tests - Build 1/2 ---------"
echo "========================================================"
cd ${SCRIPTPATH}/${SEACCESSLIB_SRCDIR}/test/build
make -f p11-cardmgr-Makefile clean
make -f p11-cardmgr-Makefile BUILDTYPE=${BUILDTYPE}
if [ $? -ne 0 ]; then
cd ${SAVEDPATH}
exit 1
fi
printf "\n"
echo "========================================================"
echo "--------------- Modem Access tests - Build 2/2 ---------"
echo "========================================================"
cd ${SCRIPTPATH}/${SEACCESSLIB_SRCDIR}/test/build
make -f cinterion-modem-test-Makefile clean
make -f cinterion-modem-test-Makefile BUILDTYPE=${BUILDTYPE}
if [ $? -ne 0 ]; then
cd ${SAVEDPATH}
exit 1
fi
printf "\n"
# Build and install the PKCS#11 library
printf "\n"
echo "=================================================="
echo "----- Secure Element PKCS#11 library - Build -----"
echo "=================================================="
cd ${SCRIPTPATH}
cd ${PKCS11LIB_SRCDIR}/build
make clean BUILDTYPE=${BUILDTYPE} #Can be commented out for faster build
make BUILDTYPE=${BUILDTYPE}
if [ $? -ne 0 ]; then
cd ${SAVEDPATH}
exit 1
fi
printf "\n"
echo "========================================================="
echo "----- Secure Element PKCS#11 library - Installation -----"
echo "========================================================="
make install BUILDTYPE=${BUILDTYPE}
if [ $? -ne 0 ]; then
cd ${SAVEDPATH}
exit 1
fi
# Display the result
echo "The PKCS#11 library for Secure Element is located :"
ls -ld `find /usr/local/lib/libgtosepkcs11* -print`
printf "\n"
echo "========================================================"
echo "----- Secure Element PKCS#11 library tests - Build -----"
echo "========================================================"
cd ${SCRIPTPATH}
cd ${TESTP11LIB_SRCDIR}/build
make clean BUILDTYPE=${BUILDTYPE}
make BUILDTYPE=${BUILDTYPE}
if [ $? -ne 0 ]; then
cd ${SAVEDPATH}
exit 1
fi
cd ${SAVEDPATH}