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