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