~ubuntu-branches/ubuntu/utopic/sip-tester/utopic

« back to all changes in this revision

Viewing changes to sipp-build-ext-lib.ksh

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2010-06-13 16:15:44 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20100613161544-34ke9f9x5kole5p3
Tags: upstream-3.1
ImportĀ upstreamĀ versionĀ 3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/ksh
 
2
#
 
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.
 
7
#
 
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.
 
12
#
 
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
 
16
#
 
17
# (c)Copyright 2006 Hewlett-Packard Development Company, LP.
 
18
#
 
19
 
 
20
BUILD_UNCOMPRESS=""
 
21
#BUILD_VERSION_FILE=build.conf
 
22
CURRENT_DIR=`pwd`
 
23
EXT_SRC_DIR="sipp-external-lib-src"
 
24
EXTBUILD_CONF_FILE=sipp-build-ext-lib.conf
 
25
 
 
26
EXT_ROOT_DIR=${CURRENT_DIR}
 
27
 
 
28
function kerror
 
29
{
 
30
    echo "ERROR: $1"
 
31
    exit 1
 
32
}
 
33
 
 
34
function kwarning
 
35
{
 
36
    echo "WARNING: $1"
 
37
}
 
38
 
 
39
function symbol_value
 
40
{
 
41
    L_symbol=$1
 
42
    eval L_value='$'${L_symbol}
 
43
    echo ${L_value}
 
44
}
 
45
 
 
46
echo "[Building external library]"
 
47
 
 
48
#if test -f ${BUILD_VERSION_FILE}
 
49
#then
 
50
#       . ./${BUILD_VERSION_FILE}
 
51
#        BUILD_VERSION=${PROJECT_VERSION}
 
52
#else
 
53
#       kerror "no version file ${BUILD_VERSION_FILE} found"
 
54
#fi
 
55
 
 
56
BUILD_VERSION=3.1
 
57
EXT_VERSION=${BUILD_VERSION}
 
58
 
 
59
if test -f ${EXTBUILD_CONF_FILE}
 
60
then
 
61
        . ./${EXTBUILD_CONF_FILE}
 
62
else
 
63
        kerror "no version file ${EXTBUILD_CONF_FILE} found"
 
64
fi
 
65
 
 
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`
 
68
 
 
69
echo -n "[External build "
 
70
for build in ${NB_BUILD}
 
71
do
 
72
  echo -n "[${build}]"
 
73
done
 
74
echo "]"
 
75
 
 
76
if test ! -d ${CURRENT_DIR}/${EXT_SRC_DIR}
 
77
then
 
78
   kerror "unable to find directory [${CURRENT_DIR}/${EXT_SRC_DIR}]"
 
79
fi
 
80
 
 
81
 
 
82
EXT_WORK_DIR="${CURRENT_DIR}/work-${BUILD_VERSION}"
 
83
EXT_BUILD_DIR="${CURRENT_DIR}/build-${BUILD_VERSION}"
 
84
 
 
85
if test -x /usr/bin/gzip
 
86
then 
 
87
  BUILD_UNCOMPRESS="/usr/bin/gzip -dv"
 
88
fi
 
89
 
 
90
if test -z "${BUILD_UNCOMPRESS}"
 
91
then
 
92
  if test -x /bin/gzip
 
93
  then
 
94
    BUILD_UNCOMPRESS="/bin/gzip -dv"
 
95
  fi
 
96
fi
 
97
 
 
98
if test -z "${BUILD_UNCOMPRESS}"
 
99
then
 
100
  if test -x /usr/contrib/bin/gzip
 
101
  then
 
102
    BUILD_UNCOMPRESS="/usr/contrib/bin/gzip -dv"
 
103
  fi
 
104
fi
 
105
 
 
106
if test -z "${BUILD_UNCOMPRESS}"
 
107
then
 
108
  if test -x /usr/local/bin/gzip
 
109
  then
 
110
    BUILD_UNCOMPRESS="/usr/local/bin/gzip -dv"
 
111
  fi
 
112
fi
 
113
 
 
114
if test -z "${BUILD_UNCOMPRESS}"
 
115
then
 
116
  if test -x /usr/bin/uncompress
 
117
  then
 
118
    BUILD_UNCOMPRESS="/usr/bin/uncompress"
 
119
  fi
 
120
fi
 
121
 
 
122
if test -z "${BUILD_UNCOMPRESS}"
 
123
then
 
124
    kerror "Unable to find [gzip or uncompress]"
 
125
fi
 
126
 
 
127
echo "[Using ${BUILD_UNCOMPRESS}]"
 
128
 
 
129
if test ! -d ${EXT_WORK_DIR}
 
130
then
 
131
    echo "[Creating directory ${EXT_WORK_DIR}]"
 
132
    mkdir ${EXT_WORK_DIR}
 
133
fi 
 
134
 
 
135
if test ! -d ${EXT_BUILD_DIR}
 
136
then
 
137
    echo "[Creating directory ${EXT_BUILD_DIR}]"
 
138
    mkdir ${EXT_BUILD_DIR}
 
139
fi 
 
140
 
 
141
 
 
142
for build in ${NB_BUILD}
 
143
do
 
144
 
 
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}]"
 
151
 
 
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}]"
 
156
 
 
157
  echo "[go to directory ${EXT_WORK_DIR}]"
 
158
  cd ${EXT_WORK_DIR}
 
159
 
 
160
  if test -f ${CURRENT_DIR}/${EXT_SRC_DIR}/${EXT_FILE}
 
161
  then
 
162
      if test -d ${EXT_DIR}
 
163
      then
 
164
         echo "[Directory ${EXT_DIR} already exists]"
 
165
      else
 
166
         if test ! -f ${EXT_FILE}
 
167
         then
 
168
           cp ${CURRENT_DIR}/${EXT_SRC_DIR}/${EXT_FILE} .
 
169
         fi
 
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}
 
174
         then
 
175
             kerror "[Directory ${EXT_DIR} not created]"
 
176
         fi
 
177
      fi
 
178
  else 
 
179
      kerror "unable to find directory [${CURRENT_DIR}/${EXT_SRC_DIR}/${EXT_FILE}]"     
 
180
  fi
 
181
 
 
182
  cd ${EXT_DIR}
 
183
 
 
184
  if test -n ${EXT_GENSCRIPT}
 
185
  then
 
186
      echo "[Executing ${EXT_GENSCRIPT}]"
 
187
      ${EXT_GENSCRIPT}
 
188
  fi
 
189
 
 
190
  if test -n ${EXT_ENDSCRIPT}
 
191
  then
 
192
      echo "[Executing ${EXT_ENDSCRIPT}]"
 
193
      ${EXT_ENDSCRIPT}
 
194
  fi
 
195
 
 
196
  cd ${CURRENT_DIR}  
 
197
 
 
198
  echo "[go to directory ${CURRENT_DIR}]"
 
199
done
 
200