]> SALOME platform Git repositories - tools/install.git/blob - config_files/qt-3.3.3.sh
Salome HOME
Update for version 3.0.0
[tools/install.git] / config_files / qt-3.3.3.sh
1 #!/bin/sh
2
3 check_version(){
4 if [ -z "$QTDIR" ]; then
5    return 1
6 fi
7 ver=`grep "QT_VERSION_STR" ${QTDIR}/include/qglobal.h | sed -e 's%^#define QT_VERSION_STR\([[:space:]]*\)%%g' -e 's%\"%%g'`
8 if [ "$ver" == "3.3.3" ] ; then
9     return 0
10 fi
11 return 1
12 }
13
14 print_env()
15 {
16 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
17 #$DELIM ${PRODUCT_TYPE} $DELIM
18 export QTDIR=\${INSTALL_ROOT}/${PRODUCT}
19 export PATH=\${QTDIR}/bin:\$PATH 
20 export LD_LIBRARY_PATH=\${QTDIR}/lib:\${LD_LIBRARY_PATH}
21 ##
22 EOF
23 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
24 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
25 }
26
27 # looks for the native product and collects it's environment (used by make_env())
28 try_native(){
29 qtdir="`find_in_path libqt-mt.so.3.3.3 ${LD_LIBRARY_PATH}`"
30 if [ -z "${qtdir}" ] ; then
31     qtdir="`find_in_path libqt-mt.so.3.3.3 /usr/lib/qt3`"
32 fi
33 if [ -n "${qtdir}" ] ; then
34     qtdir=`cd ${qtdir}/..; pwd`
35     moc="`find_in_path moc ${qtdir}/bin`"
36     uic="`find_in_path uic ${qtdir}/bin`"
37     if [ -n "${moc}" ] && [ -n "${uic}" ] ; then
38         tmp="\${QTDIR}/bin ${qtdir}/bin \${PATH} ${PATH}";  
39         path=`sort_path ${tmp}`
40         tmp="\${QTDIR}/lib ${qtdir}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
41         ld_library_path=`sort_path ${tmp}`
42         cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
43 #$DELIM ${PRODUCT_TYPE} $DELIM
44 export QTDIR=${qtdir}
45 export PATH=${path}
46 export LD_LIBRARY_PATH=${ld_library_path}
47 ##
48 EOF
49         make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
50         return 0
51     fi
52 fi
53 return 1
54 }
55
56 try_preinstalled(){
57 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
58 return $?
59 }
60
61 install_source()
62 {
63 echo "The installation of Qt 3.3.3 from sources is not provided! Use native Qt."
64 return 1
65 }
66
67 install_binary()
68 {
69 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
70 source ${INSTALL_WORK}/$SHRC
71
72 check_jb tar xfz ${SOURCE_DIR}/qt-3.3.3.tar.gz -C ${INSTALL_ROOT}
73
74 cd ${PRODUCT_DIR}/lib
75 sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libqt-mt.la > libqt-mt.la.new
76 mv -f libqt-mt.la.new libqt-mt.la
77 cd ${PRODUCT_DIR}/bin
78 sed -e "s%export QTDIR=\(.*\)%export QTDIR=${PRODUCT_DIR}%g" designer > designer.new
79 mv -f designer.new designer
80 chmod 755 designer
81
82 print_env
83 }
84
85 export PROCEDURE=$1;
86 export INSTALL_WORK=$2;
87 export SOURCE_DIR=$3;
88 export INSTALL_ROOT=$4;
89 export PRODUCT_SEQUENCE=$5;
90 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="qt" ; fi
91 export PRODUCT="qt-3.3.3"
92 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
93 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
94 source ./common.sh
95 $PROCEDURE