]> SALOME platform Git repositories - tools/install.git/blob - config_files/tcltk-8.3.3.sh
Salome HOME
Update for Salome 3.2.6
[tools/install.git] / config_files / tcltk-8.3.3.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : tcltk-8.3.3.sh
5 #  Created   : Thu Dec 18 12:01:00 2002
6 #  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
7 #  Project   : SALOME
8 #  Module    : Installation Wizard
9 #  Copyright : 2002-2007 CEA
10 #
11 #  This script is the part of the SALOME installation procedure.
12 #
13 ####################################################################################
14
15 VERSION="8.3"
16
17 check_version()
18 {
19 if [ -z "$TCLHOME" ]; then
20    echo "TCLHOME doesn't set"
21    return 1
22 fi
23
24 # check tcl version
25 tcl_cfg=${TCLHOME}/lib/tclConfig.sh
26 if [ ! -f ${tcl_cfg} ]; then tcl_cfg=${TCLHOME}/tcl${VERSION}/lib/tclConfig.sh; fi
27 if [ ! -f ${tcl_cfg} ]; then tcl_cfg=${TCLHOME}/lib/tcl${VERSION}/tclConfig.sh; fi
28 if [ ! -f ${tcl_cfg} ]; then tcl_cfg=${TCLHOME}/lib/tcl${VERSION}/lib/tclConfig.sh; fi
29 if [ -f ${tcl_cfg} ]; then
30     tcl_ver=`awk '/^TCL_VERSION=.*/ {gsub("TCL_VERSION=","",$1);print $1}' ${tcl_cfg} | cut -d "'" -f 2`
31     if [ "$tcl_ver" != ${VERSION} ] ; then
32         return 1
33     fi
34 else
35     return 1
36 fi
37
38 # check tk version
39 tk_cfg=${TCLHOME}/lib/tkConfig.sh
40 if [ ! -f ${tk_cfg} ]; then tk_cfg=${TCLHOME}/tk${VERSION}/tkConfig.sh; fi
41 if [ ! -f ${tk_cfg} ]; then tk_cfg=${TCLHOME}/lib/tk${VERSION}/tkConfig.sh; fi
42 if [ ! -f ${tk_cfg} ]; then tk_cfg=${TCLHOME}/lib/tk${VERSION}/lib/tkConfig.sh; fi
43 if [ -f ${tk_cfg} ]; then
44     tk_ver=`awk '/^TK_VERSION=.*/ {gsub("TK_VERSION=","",$1);print $1}' ${tk_cfg} | cut -d "'" -f 2`
45     if [ "$tk_ver" != ${VERSION} ] ; then
46         return 1
47     fi
48 else
49     return 1
50 fi
51
52 return 0
53 }
54
55 print_env()
56 {
57 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
58 #$DELIM ${PRODUCT_TYPE} $DELIM
59 export TCLHOME=\${INSTALL_ROOT}/${PRODUCT}
60 export PATH=\${TCLHOME}/bin:\${PATH}
61 export LD_LIBRARY_PATH=\${TCLHOME}/lib:\${LD_LIBRARY_PATH}
62 export TCLLIBPATH="\${TCLHOME}/lib \${TCLHOME}/lib/tcl${VERSION} \${TCLHOME}/lib/tk${VERSION} \${TCLLIBPATH}"
63 ##
64 EOF
65 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
66 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
67 }
68
69 # looks for the native product and collects it's environment (used by make_env())
70 try_native(){
71 tclhome="`find_in_path tclsh ${PATH}`"
72 if [ -z "${tclhome}" ] ; then
73     tclhome="`find_in_path tclsh /usr/bin`"
74 fi
75 if [ -n "${tclhome}" ] ; then
76     tclhome=`cd ${tclhome}/..; pwd`
77     tmp="\${TCLHOME}/bin ${tclhome}/bin \${PATH} ${PATH}";  
78     path=`sort_path ${tmp}`
79     tmp="\${TCLHOME}/lib ${tclhome}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
80     ld_library_path=`sort_path ${tmp}`
81     cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
82 #$DELIM ${PRODUCT_TYPE} $DELIM
83 export TCLHOME=${tclhome}
84 export PATH=${path}
85 export LD_LIBRARY_PATH=${ld_library_path}
86 export TCLLIBPATH="\${TCLHOME}/lib \${TCLHOME}/lib/tcl${VERSION} \${TCLHOME}/lib/tk${VERSION} \${TCLLIBPATH}"
87 ##
88 EOF
89     (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
90     make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
91     return 0
92 fi
93 return 1;
94 }
95
96 try_preinstalled(){
97 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
98 return $?
99 }
100
101 install_source()
102 {
103 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
104 source ${INSTALL_WORK}/$SHRC
105
106 makedir ${PRODUCT_DIR}
107
108 check_jb tar xfz ${SOURCE_DIR}/tcl8.3.3.tar.gz -C ${INSTALL_WORK}
109 cd ${INSTALL_WORK}/tcl8.3.3/unix
110 cat >> ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
111 -------------------
112 Configuring tcl...
113 -------------------
114 EOF
115 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ./configure --enable-gcc --enable-shared --enable-threads \
116     --prefix=${PRODUCT_DIR}
117 GCC=`which gcc`
118 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
119 used gcc=$GCC
120 -------------------
121 Making tcl...
122 -------------------
123 EOF
124 check_job ${PRODUCT_DIR}/MAKE.LOG make
125 cat >> ${PRODUCT_DIR}/MAKEINSTALL.LOG <<EOF
126 -------------------
127 Installing tcl...
128 -------------------
129 EOF
130 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
131
132 (cd ${PRODUCT_DIR}/bin; ln -s tclsh8.3 tclsh)
133 (cd ${PRODUCT_DIR}/lib; ln -s libtcl8.3.so libtcl.so)
134 (cd ${PRODUCT_DIR}/lib; ln -s libtclstub8.3.a libtclstub.a)
135
136 check_jb tar xfz ${SOURCE_DIR}/tk8.3.3.tar.gz -C ${INSTALL_WORK}
137 cd ${INSTALL_WORK}/tk8.3.3/unix
138 cat >> ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
139 -------------------
140 Configuring tk...
141 -------------------
142 EOF
143 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ./configure --enable-gcc --enable-shared --enable-threads \
144     --prefix=${PRODUCT_DIR} 
145 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
146 -------------------
147 Making tk...
148 -------------------
149 EOF
150 check_job ${PRODUCT_DIR}/MAKE.LOG make
151 cat >> ${PRODUCT_DIR}/MAKEINSTALL.LOG <<EOF
152 -------------------
153 Installing tk...
154 -------------------
155 EOF
156 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
157
158 (cd ${PRODUCT_DIR}/bin; ln -s wish8.3 wish)
159 (cd ${PRODUCT_DIR}/lib; ln -s libtk8.3.so libtk.so)
160 (cd ${PRODUCT_DIR}/lib; ln -s libtkstub8.3.a libtkstub.a)
161
162 check_jb tar xfz ${SOURCE_DIR}/tclx8.3.tar.gz -C ${INSTALL_WORK}
163 cd ${INSTALL_WORK}/tclx8.3/unix
164 #VRV - bug in a tclx configure 
165 chmod +w ./configure
166 echo -e '/test "$no_create" = yes || ${CONFIG_SHELL-\/bin\/sh} $CONFIG_STATUS || exit 1\ns/test "$no_create" = yes || ${CONFIG_SHELL-\/bin\/sh} $CONFIG_STATUS || exit 1/test "$no_create" = yes || ${CONFIG_SHELL-\/bin\/sh} $CONFIG_STATUS || exit 0\nwq' | ed - configure 
167 chmod -w ./configure
168 #VRV - bug in a tclx configure 
169 cat >> ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
170 -------------------
171 Configuring tclx...
172 -------------------
173 EOF
174 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
175     ./configure --enable-gcc --enable-shared --enable-threads \
176     --prefix=${PRODUCT_DIR}
177 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
178 -------------------
179 Making tclx...
180 -------------------
181 EOF
182 check_job ${PRODUCT_DIR}/MAKE.LOG make
183 cat >> ${PRODUCT_DIR}/MAKEINSTALLEXEC.LOG <<EOF
184 -------------------
185 Installing tclx...
186 -------------------
187 EOF
188 check_job ${PRODUCT_DIR}/MAKEINSTALLEXEC.LOG make install-exec
189
190 (cd ${PRODUCT_DIR}/lib; ln -s libtclx8.3.so libtclx.so)
191 (cd ${PRODUCT_DIR}/lib; ln -s libtclx8.3.a  libtclx.a)
192 (cd ${PRODUCT_DIR}/lib; ln -s libtkx8.3.so  libtkx.so)
193 (cd ${PRODUCT_DIR}/lib; ln -s libtkx8.3.a   libtkx.a)
194
195 #du -sk ${INSTALL_WORK}/tcl8.3.3 > ${PRODUCT_DIR}/size.log
196 #du -sk ${INSTALL_WORK}/tk8.3.3 >> ${PRODUCT_DIR}/size.log
197 #du -sk ${INSTALL_WORK}/tclx8.3 >> ${PRODUCT_DIR}/size.log
198 cd ${PRODUCT_DIR}
199 rm -fr ${INSTALL_WORK}/tcl8.3.3 ${INSTALL_WORK}/tk8.3.3 ${INSTALL_WORK}/tclx8.3
200 print_env
201 }
202
203 install_binary()
204 {
205 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
206 source ${INSTALL_WORK}/$SHRC
207
208 check_jb tar xfz ${SOURCE_DIR}/tcltk-8.3.3.tar.gz -C ${INSTALL_ROOT}
209
210 # overriding installation path
211 cd ${PRODUCT_DIR}/lib
212 old_prefix=`grep -e "^TCL_PREFIX='.*'" tclConfig.sh | sed -e "s%^TCL_PREFIX='\(.*\)'%\1%g"`
213 sed -e "s%${old_prefix}%${PRODUCT_DIR}%g" tclConfig.sh > _tclConfig.sh
214 mv -f _tclConfig.sh tclConfig.sh
215 sed -e "s%${old_prefix}%${PRODUCT_DIR}%g" tkConfig.sh > _tkConfig.sh
216 mv -f _tkConfig.sh tkConfig.sh
217
218 print_env
219 }
220
221 export PROCEDURE=$1;
222 export INSTALL_WORK=$2;
223 export SOURCE_DIR=$3;
224 export INSTALL_ROOT=$4;
225 export PRODUCT_SEQUENCE=$5;
226 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="tcl" ; fi
227 export PRODUCT="tcltk-8.3.3"
228 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
229 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
230 source ./common.sh
231 $PROCEDURE