3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
# (c)Copyright 2006 Hewlett-Packard Development Company, LP.
21
#BUILD_VERSION_FILE=build.conf
23
EXT_SRC_DIR="sipp-external-lib-src"
24
EXTBUILD_CONF_FILE=sipp-build-ext-lib.conf
26
EXT_ROOT_DIR=${CURRENT_DIR}
42
eval L_value='$'${L_symbol}
46
echo "[Building external library]"
48
#if test -f ${BUILD_VERSION_FILE}
50
# . ./${BUILD_VERSION_FILE}
51
# BUILD_VERSION=${PROJECT_VERSION}
53
# kerror "no version file ${BUILD_VERSION_FILE} found"
57
EXT_VERSION=${BUILD_VERSION}
59
if test -f ${EXTBUILD_CONF_FILE}
61
. ./${EXTBUILD_CONF_FILE}
63
kerror "no version file ${EXTBUILD_CONF_FILE} found"
66
# determine number of library to be generated
67
NB_BUILD=`cat ${EXTBUILD_CONF_FILE} | sed -n -e 's/^EXTBUILD_\([^_]*\)_FILE=.*$/\1/p' | sort -u`
69
echo -n "[External build "
70
for build in ${NB_BUILD}
76
if test ! -d ${CURRENT_DIR}/${EXT_SRC_DIR}
78
kerror "unable to find directory [${CURRENT_DIR}/${EXT_SRC_DIR}]"
82
EXT_WORK_DIR="${CURRENT_DIR}/work-${BUILD_VERSION}"
83
EXT_BUILD_DIR="${CURRENT_DIR}/build-${BUILD_VERSION}"
85
if test -x /usr/bin/gzip
87
BUILD_UNCOMPRESS="/usr/bin/gzip -dv"
90
if test -z "${BUILD_UNCOMPRESS}"
94
BUILD_UNCOMPRESS="/bin/gzip -dv"
98
if test -z "${BUILD_UNCOMPRESS}"
100
if test -x /usr/contrib/bin/gzip
102
BUILD_UNCOMPRESS="/usr/contrib/bin/gzip -dv"
106
if test -z "${BUILD_UNCOMPRESS}"
108
if test -x /usr/local/bin/gzip
110
BUILD_UNCOMPRESS="/usr/local/bin/gzip -dv"
114
if test -z "${BUILD_UNCOMPRESS}"
116
if test -x /usr/bin/uncompress
118
BUILD_UNCOMPRESS="/usr/bin/uncompress"
122
if test -z "${BUILD_UNCOMPRESS}"
124
kerror "Unable to find [gzip or uncompress]"
127
echo "[Using ${BUILD_UNCOMPRESS}]"
129
if test ! -d ${EXT_WORK_DIR}
131
echo "[Creating directory ${EXT_WORK_DIR}]"
132
mkdir ${EXT_WORK_DIR}
135
if test ! -d ${EXT_BUILD_DIR}
137
echo "[Creating directory ${EXT_BUILD_DIR}]"
138
mkdir ${EXT_BUILD_DIR}
142
for build in ${NB_BUILD}
145
EXT_FILE=`symbol_value EXTBUILD_${build}_FILE`
146
echo "[File: ${EXT_FILE}]"
147
EXT_DIR=`symbol_value EXTBUILD_${build}_DIR`
148
echo "[Directory: ${EXT_DIR}]"
149
EXT_BEGINSCRIPT=`symbol_value EXTBUILD_${build}_BEGINSCRIPT`
150
echo "[Begin script: ${EXT_BEGINSCRIPT}]"
152
EXT_GENSCRIPT=`symbol_value EXTBUILD_${build}_GENSCRIPT`
153
echo "[Gen script: ${EXT_GENSCRIPT}]"
154
EXT_ENDSCRIPT=`symbol_value EXTBUILD_${build}_ENDSCRIPT`
155
echo "[End script: ${EXT_ENDSCRIPT}]"
157
echo "[go to directory ${EXT_WORK_DIR}]"
160
if test -f ${CURRENT_DIR}/${EXT_SRC_DIR}/${EXT_FILE}
162
if test -d ${EXT_DIR}
164
echo "[Directory ${EXT_DIR} already exists]"
166
if test ! -f ${EXT_FILE}
168
cp ${CURRENT_DIR}/${EXT_SRC_DIR}/${EXT_FILE} .
170
echo "[Executing ${BUILD_UNCOMPRESS} ${EXT_FILE}]"
171
${BUILD_UNCOMPRESS} ${EXT_FILE}
172
tar -xvf `echo ${EXT_FILE} | sed -e 's/\.tgz$/\.tar/' | sed -e 's/\.tar.gz$/\.tar/'`
173
if test ! -d ${EXT_DIR}
175
kerror "[Directory ${EXT_DIR} not created]"
179
kerror "unable to find directory [${CURRENT_DIR}/${EXT_SRC_DIR}/${EXT_FILE}]"
184
if test -n ${EXT_GENSCRIPT}
186
echo "[Executing ${EXT_GENSCRIPT}]"
190
if test -n ${EXT_ENDSCRIPT}
192
echo "[Executing ${EXT_ENDSCRIPT}]"
198
echo "[go to directory ${CURRENT_DIR}]"