]> SALOME platform Git repositories - tools/install.git/blob - config_files/qt-3.3.3.sh
Salome HOME
Remove HappyDoc dependencies
[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=""
30 if [ -d /usr/share/qt3/lib ] ; then
31     qtdir="`find_in_path libqt-mt.so.3.3.3 /usr/share/qt3/lib`"
32 fi
33 if [ -z "${qtdir}" ] && [ -d /usr/lib/qt3/lib ] ; then
34     qtdir="`find_in_path libqt-mt.so.3.3.3 /usr/lib/qt3/lib`"
35 fi
36 if [ -z "${qtdir}" ] ; then
37     qtdir="`find_in_path libqt-mt.so.3.3.3 /usr/lib`"
38 fi
39 if [ -z "${qtdir}" ] ; then
40     qtdir="`find_in_path libqt-mt.so.3.3.3 ${LD_LIBRARY_PATH}`"
41 fi
42 if [ -n "${qtdir}" ] ; then
43     qtdir=`cd ${qtdir}/..; pwd`
44     moc="`find_in_path moc ${qtdir}/bin`"
45     uic="`find_in_path uic ${qtdir}/bin`"
46     if [ -n "${moc}" ] && [ -n "${uic}" ] ; then
47         tmp="\${QTDIR}/bin ${qtdir}/bin \${PATH} ${PATH}";  
48         path=`sort_path ${tmp}`
49         tmp="\${QTDIR}/lib ${qtdir}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
50         ld_library_path=`sort_path ${tmp}`
51         cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
52 #$DELIM ${PRODUCT_TYPE} $DELIM
53 export QTDIR=${qtdir}
54 export PATH=${path}
55 export LD_LIBRARY_PATH=${ld_library_path}
56 ##
57 EOF
58         make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
59         return 0
60     fi
61 fi
62 return 1
63 }
64
65 try_preinstalled(){
66 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
67 return $?
68 }
69
70 install_source()
71 {
72 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
73 source ${INSTALL_WORK}/$SHRC
74
75 makedir ${PRODUCT_DIR}
76
77 check_jb tar xfz ${SOURCE_DIR}/qt-3.3.3.tar.gz -C ${INSTALL_WORK}
78 cd ${PRODUCT_WORK}
79
80 mv -f configure configure-orig
81 sed -e "s%read acceptance%acceptance=yes%" configure-orig > configure
82 chmod +x configure
83
84 export QTDIR=${PRODUCT_WORK}
85 export LD_LIBRARY_PATH=${QTDIR}/lib:$LD_LIBRARY_PATH
86
87 # basic flags
88 QT_FLAGS="-release -thread -shared -qt-gif -platform linux-g++"
89 # use system graphics libraries
90 QT_FLAGS=$QT_FLAGS" -system-libjpeg -system-libpng -system-libmng -qt-imgfmt-jpeg -qt-imgfmt-png -qt-imgfmt-mng -lpng -lmng -ljpeg"
91 # prefix
92
93 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ./configure $QT_FLAGS -prefix ${PRODUCT_DIR}
94
95 sed -e "s%^all: symlinks src-qmake src-moc sub-src sub-tools sub-tutorial sub-examples%all: symlinks src-qmake src-moc sub-src sub-tools%g" Makefile > _Makefile
96 mv -f _Makefile Makefile
97
98 GCC=`which gcc`
99 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
100 used gcc=$GCC
101 EOF
102 # small trick: INSTALL_ROOT is used inside qt-3.3.3 installation
103 # so it should be set to empty string
104 export INSTALL_ROOT_BACKUP=$INSTALL_ROOT
105 export INSTALL_ROOT=""
106 check_job ${PRODUCT_DIR}/MAKE.LOG make 
107 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
108 export INSTALL_ROOT=$INSTALL_ROOT_BACKUP
109
110 for b in `ls ${PRODUCT_WORK}/bin`; do
111     if [ ! -e ${PRODUCT_DIR}/bin/$b ] || [ -h ${PRODUCT_DIR}/bin/$b ]; then
112         if [ -h ${PRODUCT_DIR}/bin/$b ]; then
113             rm -f ${PRODUCT_DIR}/bin/$b
114         fi
115         cp -f ${PRODUCT_WORK}/bin/$b ${PRODUCT_DIR}/bin/$b
116     fi
117 done
118 #rm -rf ${PRODUCT_DIR}/doc
119
120 #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
121 cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
122 print_env
123 }
124
125 install_binary()
126 {
127 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
128 source ${INSTALL_WORK}/$SHRC
129
130 check_jb tar xfz ${SOURCE_DIR}/qt-3.3.3.tar.gz -C ${INSTALL_ROOT}
131
132 cd ${PRODUCT_DIR}/lib
133 sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libqt-mt.la > libqt-mt.la.new
134 mv -f libqt-mt.la.new libqt-mt.la
135 cd ${PRODUCT_DIR}/lib/pkgconfig
136 sed -e "s%^prefix=\(.*\)%prefix=${PRODUCT_DIR}%g" qt-mt.pc > qt-mt.pc.new
137 mv -f qt-mt.pc.new qt-mt.pc
138
139 print_env
140 }
141
142 export PROCEDURE=$1;
143 export INSTALL_WORK=$2;
144 export SOURCE_DIR=$3;
145 export INSTALL_ROOT=$4;
146 export PRODUCT_SEQUENCE=$5;
147 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="qt" ; fi
148 export PRODUCT="qt-3.3.3"
149 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
150 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
151 source ./common.sh
152 $PROCEDURE