]> SALOME platform Git repositories - tools/install.git/commitdiff
Salome HOME
Modifications in according to improvement 15165.
authorakl <akl@opencascade.com>
Fri, 27 Jul 2007 13:51:37 +0000 (13:51 +0000)
committerakl <akl@opencascade.com>
Fri, 27 Jul 2007 13:51:37 +0000 (13:51 +0000)
39 files changed:
config_files/BOOST-1.31.0.sh
config_files/BOOST-1.32.0.sh
config_files/CAS-6.2.sh
config_files/HXX2SALOME.sh
config_files/HXX2SALOMEDOC.sh
config_files/Numeric-22.0.sh
config_files/Numeric-23.7.sh
config_files/PyQt-3.13.sh
config_files/PyQt-3.14.1.sh
config_files/Python-2.3.4.sh
config_files/Python-2.3.5.sh
config_files/Python-2.4.1.sh
config_files/SAMPLES.sh
config_files/SWIG-1.3.24.sh
config_files/VTK-4.2.2.sh
config_files/VTK-4.2.6.sh
config_files/common.sh
config_files/docutils-0.3.7.sh
config_files/doxygen-1.4.6.sh
config_files/gcc-common.sh
config_files/graphviz-1.9.sh
config_files/graphviz-2.2.1.sh
config_files/hdf5-1.6.3.sh
config_files/hdf5-1.6.4.sh
config_files/med-2.2.3.sh
config_files/msg2qm.sh
config_files/netgen-4.5.sh
config_files/omniORB-4.0.5.sh
config_files/omniORB-4.0.6.sh
config_files/omniORB-4.0.7.sh
config_files/qt-3.3.3.sh
config_files/qt-3.3.4.sh
config_files/qwt-0.4.1.sh
config_files/qwt-4.2.0.sh
config_files/sip-4.1.sh
config_files/sip-4.2.1.sh
config_files/tcltk-8.3.3.sh
config_files/tcltk-8.4.5.sh
config_files/tcltk-8.4.7.sh

index 44537818dc6a26b157ed75a4d1f061ca60a1e7b8..3c05694b4d0f05cf8bda6c90e15a689b7409be34 100755 (executable)
@@ -22,78 +22,73 @@ fi
 return 1;
 }
 
-print_env()
+print_env_bin()
 {
-cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
 #$DELIM ${PRODUCT_TYPE} $DELIM 
 export BOOSTDIR=\${INSTALL_ROOT}/${PRODUCT}
 export LD_LIBRARY_PATH=\${BOOSTDIR}/lib:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-boostdir="`find_in_path version.hpp /usr/include/boost:/usr/share/include/boost`"
-if [ -n "${boostdir}" ] ; then
-    boostdir=`cd ${boostdir}/../..; pwd`
-    ls ${boostdir}/lib/libboost_thread* &> /dev/null
-    if [ "$?" -ne "0" ] ; then 
-       return 1
-    fi
-    ver=`egrep 'BOOST_VERSION [0-9]+' ${boostdir}/include/boost/version.hpp | sed 's/.*BOOST_VERSION \([0-9]\+\)/\1/g'`
-    if [ $ver -ge 103100 ] ;  then 
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM 
-export BOOSTDIR=${boostdir}
-export LD_LIBRARY_PATH=\${BOOSTDIR}/lib:\${LD_LIBRARY_PATH}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF 
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       if [ $ver -eq 103100 ] ;  then 
-           return 0
-       else
-           return 2
-       fi
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
-
 # unpack
-check_jb tar xzf ${SOURCE_DIR}/boost-1.31.0.tar.gz -C ${INSTALL_WORK}
+check_jb tar xzf ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
 
-# build
 GCC=`which gcc`
 cat >> ${PRODUCT_DIR}/BUILD.LOG <<EOF
 used gcc=$GCC
 EOF
-cd ${PRODUCT_WORK}/tools/build/jam_src
+cd ${PRODUCT_DIR}_SRC/tools/build/jam_src
 check_job ${PRODUCT_DIR}/BUILD.LOG ./build.sh
 
 # apply patch to avoid conflicts with Qt signals
 # VSR 07/03/06 : this is no more needed
-#cd ${PRODUCT_WORK}/boost/signals/detail
+#cd ${PRODUCT_DIR}_SRC/boost/signals/detail
 #sed -e "s%#  define BOOST_SIGNALS_NAMESPACE signals%#  define BOOST_SIGNALS_NAMESPACE bsignals%g" \
 #    signals_common.hpp > signals_common.hpp.orig
 #mv -f signals_common.hpp.orig signals_common.hpp
 
 # install
-cd ${PRODUCT_WORK}
+cd ${PRODUCT_DIR}_SRC
 python_root=`find_in_path python $PATH`;
 python_root=`cd ${python_root}/..; pwd`
 python_version=`python -c "import sys; print sys.version[:3]"`
@@ -101,7 +96,7 @@ python_version=`python -c "import sys; print sys.version[:3]"`
 echo "`pwd` -> ./tools/build/jam_src/bin.linuxx86/bjam >> ${PRODUCT_DIR}/INSTALL.LOG"
 ./tools/build/jam_src/bin.linuxx86/bjam "-sBOOST_ALL_DYN_LINK=1"         \
     "-sBUILD=release <runtime-link>dynamic <threading>multi"             \
-    --prefix=${PRODUCT_DIR} --builddir=${PRODUCT_WORK}                   \
+    --prefix=${PRODUCT_DIR} --builddir=${PRODUCT_DIR}_SRC                \
     "-sPYTHON_VERSION=$python_version" --with-python-root=${python_root} \
     install >> ${PRODUCT_DIR}/INSTALL.LOG 2> $INSTALL_WORK/errlog
 
@@ -124,20 +119,27 @@ for aLib in date_time filesystem prg_exec_monitor python regex signals test_exec
     fi
 done
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/boost-1.31.0.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -145,7 +147,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="boost" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="boost-1.31.0"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index fa03e146e5acc9b1a1990cf16d74d7408ffc08f5..b658da9305ac6850696e8302ad1d8d4e23a022e8 100755 (executable)
@@ -22,7 +22,7 @@ fi
 return 1;
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM 
@@ -31,69 +31,64 @@ export LD_LIBRARY_PATH=\${BOOSTDIR}/lib:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-boostdir="`find_in_path version.hpp /usr/include/boost:/usr/share/include/boost`"
-if [ -n "${boostdir}" ] ; then
-    boostdir=`cd ${boostdir}/../..; pwd`
-    ls ${boostdir}/lib/libboost_thread* &> /dev/null
-    if [ "$?" -ne "0" ] ; then 
-       return 1
-    fi
-    ver=`egrep 'BOOST_VERSION [0-9]+' ${boostdir}/include/boost/version.hpp | sed 's/.*BOOST_VERSION \([0-9]\+\)/\1/g'`
-    if [ $ver -ge 103200 ] ;  then 
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM 
-export BOOSTDIR=${boostdir}
-export LD_LIBRARY_PATH=\${BOOSTDIR}/lib:\${LD_LIBRARY_PATH}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF 
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       if [ $ver -eq 103200 ] ;  then 
-           return 0
-       else
-           return 2
-       fi
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
-
 # unpack
-check_jb tar xzf ${SOURCE_DIR}/boost-1.32.0.tar.gz -C ${INSTALL_WORK}
+check_jb tar xzf ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
 
-# build
 GCC=`which gcc`
 cat >> ${PRODUCT_DIR}/BUILD.LOG <<EOF
 used gcc=$GCC
 EOF
-cd ${PRODUCT_WORK}/tools/build/jam_src
+cd ${PRODUCT_DIR}_SRC/tools/build/jam_src
 check_job ${PRODUCT_DIR}/BUILD.LOG ./build.sh
 
 # apply patch to avoid conflicts with Qt signals
 # VSR 07/03/06 : this is no more needed
-#cd ${PRODUCT_WORK}/boost/signals/detail
+#cd ${PRODUCT_DIR}_SRC/boost/signals/detail
 #sed -e "s%#  define BOOST_SIGNALS_NAMESPACE signals%#  define BOOST_SIGNALS_NAMESPACE bsignals%g" \
 #    signals_common.hpp > signals_common.hpp.orig
 #mv -f signals_common.hpp.orig signals_common.hpp
 
 # install
-cd ${PRODUCT_WORK}
+cd ${PRODUCT_DIR}_SRC
 python_root=`find_in_path python $PATH`;
 python_root=`cd ${python_root}/..; pwd`
 python_version=`python -c "import sys; print sys.version[:3]"`
@@ -105,7 +100,7 @@ fi
 echo "`pwd` -> ./tools/build/jam_src/${binfolder}/bjam >> ${PRODUCT_DIR}/INSTALL.LOG"
 ./tools/build/jam_src/${binfolder}/bjam "-sBOOST_ALL_DYN_LINK=1"         \
     "-sBUILD=release <runtime-link>dynamic <threading>multi"             \
-    --prefix=${PRODUCT_DIR} --builddir=${PRODUCT_WORK}                   \
+    --prefix=${PRODUCT_DIR} --builddir=${PRODUCT_DIR}_SRC                \
     "-sPYTHON_VERSION=$python_version" --with-python-root=${python_root} \
     install >> ${PRODUCT_DIR}/INSTALL.LOG 2> $INSTALL_WORK/errlog
 
@@ -130,20 +125,27 @@ done
   if test `uname -m` = "x86_64" ; then
       cd ${PRODUCT_DIR}; ln -sf lib lib64
   fi
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/boost-1.32.0.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -151,7 +153,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="boost" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="boost-1.32.0"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 2f70beea7f933d22afa15bcb49a3480e9c344091..9108292957b67f78759ea607a41326a59a5d97fc 100755 (executable)
@@ -31,7 +31,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -52,52 +52,52 @@ export MMGT_REENTRANT=1
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-check_version
-if [ $? -eq 0 ] ; then
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export CASROOT=${CASROOT}
-export PATH=\${CASROOT}/bin:\${PATH}
-export LD_LIBRARY_PATH=\${CASROOT}/lib:\${CASROOT}/lin/lib:\${LD_LIBRARY_PATH}
-# Variable for Foundation Classes : 
-export CSF_UnitsLexicon=\${CASROOT}/src/UnitsAPI/Lexi_Expr.dat 
-export CSF_UnitsDefinition=\${CASROOT}/src/UnitsAPI/Units.dat 
-# Variable for DataExchange : 
-export CSF_SHMessage=\${CASROOT}/src/SHMessage
-export CSF_XSMessage=\${CASROOT}/src/XSMessage 
-# Variable for Font : 
-export CSF_MDTVFontDirectory=\${CASROOT}/src/FontMFT 
-export CSF_MDTVTexturesDirectory=\${CASROOT}/src/Textures 
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_preinstalled()
+{
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
-
 # unpack
-check_jb tar xfz ${SOURCE_DIR}/CAS-6.2.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC
 
 # configure
+echo " +++++++++++ configure"
 if test `uname -m` = "x86_64" ; then
     flags="$flags CFLAGS=-m64 -D_OCC64"
     flags="$flags CXXFLAGS=-m64 -D_OCC64"
@@ -120,10 +120,11 @@ dpsdir="`where_dps`"
 if [ $? -eq 0 ] ; then flags="$flags --with-dps-include=$dpsdir/include --with-dps-library=$dpsdir/lib"; fi
 flags="$flags --disable-debug --enable-production"
 
-export CASROOT=${PRODUCT_WORK}
+export CASROOT=${PRODUCT_DIR}_SRC
 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ./configure $flags --prefix=${PRODUCT_DIR}
 
 # make
+echo " +++++++++++ make"
 GCC=`which gcc`
 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
 used gcc=$GCC
@@ -131,10 +132,12 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make -j4 install-strip
 
 # copy includes
+echo " +++++++++++ copy includes"
 cp -fr inc ${PRODUCT_DIR}
 cp -f config.h ${PRODUCT_DIR}
 (cd ${PRODUCT_DIR}/inc; ln -fs ../config.h config.h)
 # copy resources
+echo " +++++++++++ copy resources"
 makedir ${PRODUCT_DIR}/src
 for d in UnitsAPI SHMessage FontMFT Textures XSMessage DrawResources ; do
     cp -rp src/${d} ${PRODUCT_DIR}/src
@@ -143,6 +146,7 @@ done
 (cd ${PRODUCT_DIR}; mkdir -p lin;   cd lin;   ln -fs ../lib lib; ln -fs ../bin bin)
 
 # fix libGL dependencies
+echo " +++++++++++ fix libGL dependencies"
 cd ${PRODUCT_DIR}/lib
 gllibdir="`where_gl_libs`"
 if [ "$gllibdir" != "" ] ; then
@@ -162,17 +166,24 @@ if [ "$gllibdir" != "" ] ; then
     mv -f libTKOpenGl.la.new libTKOpenGl.la
 fi
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/CAS-6.2.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # modify *.la files
 ldir=${PRODUCT_DIR}/lib
@@ -215,7 +226,8 @@ if [ "$gllibdir" != "" ] ; then
     mv -f libTKOpenGl.la.new libTKOpenGl.la
 fi
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -223,7 +235,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="cas" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="CAS-6.2"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 450d3b07497e090abe743f2f678aaa4852a5b0fc..e840cd3c0511e7b3353df98f95112358a41948cc 100755 (executable)
 #
 ####################################################################################
 
+VERSION="3.2.6"
+
 check_version(){
 # No way to check version!
 return 0
 }
 
-print_env(){
+print_env_bin(){
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
 export HXX2SALOME_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}/bin
@@ -25,39 +27,47 @@ export PATH=\${HXX2SALOME_ROOT_DIR}:\${PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-HXX2SALOME_ROOT_DIR="`find_in_path hxx2salome ${PATH}`"
-if [ -n "${adir}" ] ; then
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export HXX2SALOME_ROOT_DIR=${HXX2SALOME_ROOT_DIR}
-export PATH=\${HXX2SALOME_ROOT_DIR}:\${PATH}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_SRC_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_SRC_DIR})
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_SRC_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/HXX2SALOMEsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
 
-makedir ${PRODUCT_DIR}
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
 
-check_jb tar xfz ${SOURCE_DIR}/HXX2SALOMEsourcesV3.2.6.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_SRC_DIR}
 cat >> ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
 -------------------
 Build configure...
@@ -79,20 +89,27 @@ check_job ${PRODUCT_DIR}/MAKE.LOG make
 
 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
+#du -sk ${PRODUCT_SRC_DIR} > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_SRC_DIR} && rm -fr ${PRODUCT_SRC_DIR}
+fi
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/HXX2SALOMEbinariesV3.2.6.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/HXX2SALOMEbinariesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -100,9 +117,12 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="HXX2SALOME" ; fi
-export PRODUCT="HXX2SALOME_3.2.6"
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
+export PRODUCT="HXX2SALOME_${VERSION}"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
-export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
+export PRODUCT_SRC_DIR=${INSTALL_ROOT}/"HXX2SALOME_SRC_${VERSION}"
 source ./common.sh
 $PROCEDURE 
index dccfdcaa9f18f3a1c562ad14a391c102633648a5..47ab052599720b91a1c238f95037cccf209b72a3 100755 (executable)
 #
 ####################################################################################
 
+VERSION="3.2.6"
+
 check_version(){
 # No way to check version!
 return 0
 }
 
-print_env(){
+print_env_bin(){
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
 #nothing to do
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-try_native(){
-return 0
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
+##
+EOF
+(test -w ${PRODUCT_SRC_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_SRC_DIR})
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_SRC_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source(){
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/HXX2SALOMEDOCsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
 
-check_jb tar xfz ${SOURCE_DIR}/HXX2SALOMEDOCsourcesV3.2.6.tar.gz -C ${INSTALL_ROOT}
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
 
-print_env
+install_source_and_build()
+{
+# install sources
+install_source
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_SRC_DIR} && rm -fr ${PRODUCT_SRC_DIR}
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary(){
-echo "Can't install binaries for ${PRODUCT}"
+echo "It's impossible to install ${PRODUCT} from binaries"
+
+# to generate environment scripts
+try_preinstalled
+
 return 1
 }
 
@@ -55,9 +86,12 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="HXX2SALOMEDOC" ; fi
-export PRODUCT="HXX2SALOMEDOC_3.2.6"
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
+export PRODUCT="HXX2SALOMEDOC_${VERSION}"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
-export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
+export PRODUCT_SRC_DIR=${INSTALL_ROOT}/"HXX2SALOMEDOC_SRC_${VERSION}"
 source ./common.sh
 $PROCEDURE 
index 3acf3bb30b45ca7e56847037345426748eed2060..23df1f344552bb5860c0d8d2d9ce5b0a7c5e30fc 100755 (executable)
@@ -20,68 +20,75 @@ fi
 return 1
 }
 
-print_env(){
+print_env_bin(){
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
 export PYTHONPATH=\${INSTALL_ROOT}/${PRODUCT}/lib/python\${PYTHON_VERSION}/site-packages/Numeric:\${PYTHONPATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-numpath=`python -c "import Numeric; print Numeric.__file__" 2>/dev/null`
-if [ -n "${numpath}" ] ; then
-    numpath=`dirname ${numpath}`
-    ver=`python -c 'import Numeric; print Numeric.__version__' 2>/dev/null | awk -F. '{v=0;for(i=1;i<=NF;i++)v=v*100+$i;print v}'`
-    if [ $ver -ge 2200 ] ; then
-       tmp="${numpath} ${numpath} \${PYTHONPATH} ${PYTHONPATH}";  
-       pythonpath=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PYTHONPATH=${pythonpath}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       if [ $ver -eq 2200 ] ; then
-           return 0
-       else
-           return 2
-       fi
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
 
-check_jb tar xfz ${SOURCE_DIR}/Numeric-22.0.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC
 
 check_job ${PRODUCT_DIR}/INSTALL.LOG python setup.py install --prefix=${PRODUCT_DIR}
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-check_jb tar xfz ${SOURCE_DIR}/Numeric-22.0.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -89,7 +96,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="numeric" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="Numeric-22.0"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 96f50958ec6575be68d5f0b6c35ab9d07b5398d2..4435559cd39401245ebbcbdc9de64625c228aa53 100755 (executable)
@@ -12,7 +12,8 @@
 #
 ####################################################################################
 
-check_version(){
+check_version()
+{
 ver=`python -c 'import Numeric; print Numeric.__version__' 2>/dev/null`
 if [ "$ver" == "23.7" ]; then
    return 0
@@ -20,55 +21,56 @@ fi
 return 1
 }
 
-print_env(){
+print_env_bin()
+{
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
 export PYTHONPATH=\${INSTALL_ROOT}/${PRODUCT}/lib/python\${PYTHON_VERSION}/site-packages/Numeric:\${PYTHONPATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-numpath=`python -c "import Numeric; print Numeric.__file__" 2>/dev/null`
-if [ -n "${numpath}" ] ; then
-    numpath=`dirname ${numpath}`
-    ver=`python -c 'import Numeric; print Numeric.__version__' 2>/dev/null | awk -F. '{v=0;for(i=1;i<=NF;i++)v=v*100+$i;print v}'`
-    if [ $ver -ge 2307 ] ; then
-       tmp="${numpath} ${numpath} \${PYTHONPATH} ${PYTHONPATH}";  
-       pythonpath=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PYTHONPATH=${pythonpath}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       if [ $ver -eq 2307 ] ; then
-           return 0
-       else
-           return 2
-       fi
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_preinstalled()
+{
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-makedir ${PRODUCT_DIR}
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
 
-check_jb tar xfz ${SOURCE_DIR}/Numeric-23.7.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC
   if test `uname -m` = "x86_64" ; then
 export CFLAGS=-m64
 export CXXFLAGS=-m64
@@ -127,16 +129,24 @@ check_job ${PRODUCT_DIR}/INSTALL.LOG python setup.py install --prefix=${PRODUCT_
       cd ${PRODUCT_DIR}; ln -sf lib64 lib
   fi
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-check_jb tar xfz ${SOURCE_DIR}/Numeric-23.7.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -144,7 +154,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="numeric" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="Numeric-23.7"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 62c2e1bc30213d6968d41816e98767e0118a8a87..4d81ab656ab621a9f6307a8221f5a0a77de64d39 100755 (executable)
@@ -29,7 +29,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -41,70 +41,47 @@ export LD_LIBRARY_PATH=\${PYQTDIR}:\$LD_LIBRARY_PATH
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-# we need version 3.13 or newer
-try_native(){
-# check pyuic
-pyqtdir="`find_in_path pyuic ${PATH}:/usr/bin`"
-if [ -z "${pyqtdir}" ] ; then return 1 ; fi
-# check sip files
-pyqt_sips="`find_in_path qtmod.sip ${pyqtdir}/sip/qt:/usr/share/sip/qt:/usr/share/sip/qt/qt`"
-if [ -z "${pyqt_sips}" ] ; then return 1 ; fi
-pyqt_sips=`cd $pyqt_sips/.. ; pwd`
-# check configuration file
-python_version="`python -c 'import sys; print sys.version[:3]'`"
-pyqt_cfg="`find_in_path pyqtconfig.py ${pyqtdir}:/usr/lib/python${python_version}/site-packages`"
-if [ -z "${pyqt_cfg}" ] ; then return 1 ; fi
-# check library
-pyqt_lib="`find_in_path qt.so ${pyqtdir}:/usr/lib/python${python_version}/site-packages`"
-if [ -z "${pyqt_lib}" ] ; then return 1 ; fi
-# check version
-ver=`cd ${pyqt_cfg} && python -c "from pyqtconfig import Configuration; c=Configuration();print c.__getattr__('pyqt_version_str')" 2>/dev/null`
-if [ -n "$ver" ] ; then
-    maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    let ver=$maj_ver*10000+$min_ver*100+$rel_ver
-    # version number should be at least 3.13
-    if [ $ver -ge 031300 ] ; then
-       tmp="${pyqtdir} ${pyqtdir} \${PATH} ${PATH}";  
-       path=`sort_path ${tmp}`
-       tmp="${pyqt_lib} ${pyqt_lib} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-       ld_library_path=`sort_path ${tmp}`
-       tmp="${pyqt_cfg} ${pyqt_cfg} \${PYTHONPATH} ${PYTHONPATH}";  
-       pythonpath=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PYQT_SIPS=${pyqt_sips}
-export PATH=${path}
-export PYTHONPATH=${pythonpath}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       return 0
-    fi
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
 
-check_jb tar xfz ${SOURCE_DIR}/PyQt-3.13.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC
 
 sed -e 's%check_license()$%#check_license()%g' configure.py > configure.py.new
 mv -f configure.py.new configure.py
@@ -118,17 +95,24 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make
 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/PyQt-3.13.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # modify pyqtconfig.py file
 cd ${PRODUCT_DIR}
@@ -137,7 +121,8 @@ sed -e "s%\('pyqt_mod_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g"     pyqtconfi
 sed -e "s%\('pyqt_sip_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}/sip',%g" pyqtconfig.py > pyqtconfig.py.1
 mv pyqtconfig.py.1 pyqtconfig.py
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -145,7 +130,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="pyqt" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="PyQt-3.13"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 951eec96d04cdf754787e2cf4d6bee748913efc0..fb6f2dd2ec028d909a7bb94f53bf3cade0a890e9 100755 (executable)
@@ -29,7 +29,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -41,78 +41,47 @@ export LD_LIBRARY_PATH=\${PYQTDIR}:\$LD_LIBRARY_PATH
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-# we need version 3.13 or newer
-try_native(){
-# check pyuic
-pyqtdir="`find_in_path pyuic ${PATH}:/usr/bin`"
-if [ -z "${pyqtdir}" ] ; then return 1 ; fi
-# check sip files
-pyqt_sips="`find_in_path qtmod.sip ${pyqtdir}/sip/qt:/usr/share/sip/qt:/usr/share/sip/qt/qt`"
-if [ -z "${pyqt_sips}" ] ; then return 1 ; fi
-pyqt_sips=`cd $pyqt_sips/.. ; pwd`
-# check configuration file
-python_version="`python -c 'import sys; print sys.version[:3]'`"
-if test `uname -m` = "x86_64" ; then
-pyqt_cfg="`find_in_path pyqtconfig.py ${pyqtdir}:/usr/lib64/python${python_version}/site-packages`"
-else
-pyqt_cfg="`find_in_path pyqtconfig.py ${pyqtdir}:/usr/lib/python${python_version}/site-packages`"
-fi
-if [ -z "${pyqt_cfg}" ] ; then return 1 ; fi
-# check library
-if test `uname -m` = "x86_64" ; then
-pyqt_lib="`find_in_path qt.so ${pyqtdir}:/usr/lib64/python${python_version}/site-packages`"
-else
-pyqt_lib="`find_in_path qt.so ${pyqtdir}:/usr/lib/python${python_version}/site-packages`"
-fi
-if [ -z "${pyqt_lib}" ] ; then return 1 ; fi
-# check version
-ver=`cd ${pyqt_cfg} && python -c "from pyqtconfig import Configuration; c=Configuration();print c.__getattr__('pyqt_version_str')" 2>/dev/null`
-if [ -n "$ver" ] ; then
-    maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    let ver=$maj_ver*10000+$min_ver*100+$rel_ver
-    # version number should be at least 3.13
-    if [ $ver -ge 031300 ] ; then
-       tmp="${pyqtdir} ${pyqtdir} \${PATH} ${PATH}";  
-       path=`sort_path ${tmp}`
-       tmp="${pyqt_lib} ${pyqt_lib} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-       ld_library_path=`sort_path ${tmp}`
-       tmp="${pyqt_cfg} ${pyqt_cfg} \${PYTHONPATH} ${PYTHONPATH}";  
-       pythonpath=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PYQT_SIPS=${pyqt_sips}
-export PATH=${path}
-export PYTHONPATH=${pythonpath}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       return 0
-    fi
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-check_jb tar xfz ${SOURCE_DIR}/PyQt-3.14.1.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC
 
 if test `uname -m` = "x86_64" ; then
 export CFLAGS=-m64 CXXFLAGS=-m64
@@ -130,17 +99,24 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make
 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/PyQt-3.14.1.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # modify pyqtconfig.py file
 cd ${PRODUCT_DIR}
@@ -149,7 +125,8 @@ sed -e "s%\('pyqt_mod_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g"     pyqtconfi
 sed -e "s%\('pyqt_sip_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}/sip',%g" pyqtconfig.py > pyqtconfig.py.1
 mv pyqtconfig.py.1 pyqtconfig.py
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -157,7 +134,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="pyqt" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="PyQt-3.14.1"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 086675c3d7493ce4a3fb13e2ad435be9aeef3b42..ad5b11bb92d6f7b6ea194a6c888ece71ccba9f5d 100755 (executable)
@@ -30,7 +30,7 @@ fi
 return 1 
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -43,71 +43,48 @@ export PYTHONPATH=\${PYTHONHOME}/lib/python\${PYTHON_VERSION}:\${PYTHONPATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-pythonhome="`find_in_path python ${PATH}`"
-if [ -z "${pythonhome}" ] ; then
-    pythonhome="`find_in_path python /usr/bin`"
-fi
-if [ -n "${pythonhome}" ] ; then
-    pythonhome=`cd ${pythonhome}/..; pwd`
-    # get version number: <major>, <minor> and <release>
-    # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
-    # version number is calculated as: <major>*10000+<minor>*100+<release>
-    # e.g. for Python 2.3.4 it is equal to 20304
-    ver=`python -V 2>&1`
-    maj_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>0) print $1; else print 0}'`
-    min_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>1) print $2; else print 0}'`
-    rel_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>2) print $3; else print 0}'`
-    let ver=$maj_ver*10000+$min_ver*100+$rel_ver
-    if [ $ver -ge 20304 ] ;  then 
-       tmp="\${PYTHONHOME}/bin ${pythonhome}/bin \${PATH} ${PATH}";  
-       path=`sort_path ${tmp}`
-       tmp="\${PYTHONHOME}/lib/python\${PYTHON_VERSION} ${pythonhome}/lib/python${maj_ver}.${min_ver} \${PYTHONPATH} ${PYTHONPATH}";  
-       pythonpath=`sort_path ${tmp}`
-       tmp="\${PYTHONHOME}/lib ${pythonhome}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-       ld_library_path=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PYTHONHOME=${pythonhome}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-export PYTHON_VERSION=\`python -c "import sys; print sys.version[:3]"\`
-export PYTHON_INCLUDE=\${PYTHONHOME}/include/python\${PYTHON_VERSION}
-export PYTHONPATH=${pythonpath}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-#######       THIS COULD BE USED FOR STRICT COMPARISON  ##############################
-#      if [ $maj_ver -eq 2 ] && [ $min_ver -eq 3 ] && [ $rel_ver -eq 4 ] ;  then 
-######################################################################################
-       if [ $maj_ver -eq 2 ] && [ $min_ver -eq 3 ] && [ $rel_ver -ge 4 ] ;  then 
-           return 0
-       else
-           return 2
-       fi
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-check_jb tar xfz ${SOURCE_DIR}/Python-2.3.4.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+cd ${PRODUCT_DIR}_SRC
+makedir ${PRODUCT_DIR}
 
 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
     ./configure --prefix=${PRODUCT_DIR} --with-threads --with-cxx=`which g++` --enable-shared
@@ -131,17 +108,24 @@ for sc in idle pydoc smtpd.py ; do
        chmod a+x "$sc"
     fi
 done
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/Python-2.3.4.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 (cd ${PRODUCT_DIR}/lib/python2.3/config; ln -fs ../../libpython2.3.so.1.0 libpython2.3.so)
 
@@ -154,7 +138,8 @@ for sc in idle pydoc smtpd.py ; do
     fi
 done
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -162,7 +147,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="python" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="Python-2.3.4"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index d53d267940bcc1ed57685d1b7c4ddde07563a1b9..6d37cad43a79646ec99a9444f513ac1462d7fe35 100755 (executable)
@@ -30,7 +30,7 @@ fi
 return 1 
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -43,71 +43,47 @@ export PYTHONPATH=\${PYTHONHOME}/lib/python\${PYTHON_VERSION}:\${PYTHONPATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-pythonhome="`find_in_path python ${PATH}`"
-if [ -z "${pythonhome}" ] ; then
-    pythonhome="`find_in_path python /usr/bin`"
-fi
-if [ -n "${pythonhome}" ] ; then
-    pythonhome=`cd ${pythonhome}/..; pwd`
-    # get version number: <major>, <minor> and <release>
-    # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
-    # version number is calculated as: <major>*10000+<minor>*100+<release>
-    # e.g. for Python 2.3.5 it is equal to 20305
-    ver=`python -V 2>&1`
-    maj_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>0) print $1; else print 0}'`
-    min_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>1) print $2; else print 0}'`
-    rel_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>2) print $3; else print 0}'`
-    let ver=$maj_ver*10000+$min_ver*100+$rel_ver
-    if [ $ver -ge 20305 ] ;  then 
-       tmp="\${PYTHONHOME}/bin ${pythonhome}/bin \${PATH} ${PATH}";  
-       path=`sort_path ${tmp}`
-       tmp="\${PYTHONHOME}/lib/python\${PYTHON_VERSION} ${pythonhome}/lib/python${maj_ver}.${min_ver} \${PYTHONPATH} ${PYTHONPATH}";  
-       pythonpath=`sort_path ${tmp}`
-       tmp="\${PYTHONHOME}/lib ${pythonhome}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-       ld_library_path=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PYTHONHOME=${pythonhome}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-export PYTHON_VERSION=\`python -c "import sys; print sys.version[:3]"\`
-export PYTHON_INCLUDE=\${PYTHONHOME}/include/python\${PYTHON_VERSION}
-export PYTHONPATH=${pythonpath}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-#######       THIS COULD BE USED FOR STRICT COMPARISON  ##############################
-#      if [ $maj_ver -eq 2 ] && [ $min_ver -eq 3 ] && [ $rel_ver -eq 4 ] ;  then 
-######################################################################################
-       if [ $maj_ver -eq 2 ] && [ $min_ver -eq 3 ] && [ $rel_ver -ge 5 ] ;  then 
-           return 0
-       else
-           return 2
-       fi
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-check_jb tar xfz ${SOURCE_DIR}/Python-2.3.5.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC
 
 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
     ./configure --prefix=${PRODUCT_DIR} --with-threads --with-cxx=`which g++` --enable-shared
@@ -132,17 +108,24 @@ for sc in idle pydoc smtpd.py ; do
     fi
 done
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/Python-2.3.5.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 (cd ${PRODUCT_DIR}/lib/python2.3/config; ln -fs ../../libpython2.3.so.1.0 libpython2.3.so)
 
@@ -155,7 +138,8 @@ for sc in idle pydoc smtpd.py ; do
     fi
 done
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -163,7 +147,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="python" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="Python-2.3.5"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 0cbf69df5abc8ff128e40ed3e06735c7ff4e792e..f4bbcddef09b3b76f1e69d4a7527f8058935b018 100755 (executable)
@@ -30,7 +30,7 @@ fi
 return 1 
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -43,69 +43,31 @@ export PYTHONPATH=\${PYTHONHOME}/lib/python\${PYTHON_VERSION}:\${PYTHONPATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-pythonhome="`find_in_path python ${PATH}`"
-if [ -z "${pythonhome}" ] ; then
-    pythonhome="`find_in_path python /usr/bin`"
-fi
-if [ -n "${pythonhome}" ] ; then
-    pythonhome=`cd ${pythonhome}/..; pwd`
-    # get version number: <major>, <minor> and <release>
-    # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
-    # version number is calculated as: <major>*10000+<minor>*100+<release>
-    # for Python 2.4.1 it is equal to 20401
-    ver=`python -V 2>&1`
-    maj_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>0) print $1; else print 0}'`
-    min_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>1) print $2; else print 0}'`
-    rel_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>2) print $3; else print 0}'`
-    let ver=$maj_ver*10000+$min_ver*100+$rel_ver
-    if [ $ver -ge 20401 ] ;  then 
-       tmp="\${PYTHONHOME}/bin ${pythonhome}/bin \${PATH} ${PATH}";  
-       path=`sort_path ${tmp}`
-       tmp="\${PYTHONHOME}/lib/python\${PYTHON_VERSION} ${pythonhome}/lib/python${maj_ver}.${min_ver} \${PYTHONPATH} ${PYTHONPATH}";  
-       pythonpath=`sort_path ${tmp}`
-       tmp="\${PYTHONHOME}/lib ${pythonhome}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-       ld_library_path=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PYTHONHOME=${pythonhome}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-export PYTHON_VERSION=\`python -c "import sys; print sys.version[:3]"\`
-export PYTHON_INCLUDE=\${PYTHONHOME}/include/python\${PYTHON_VERSION}
-export PYTHONPATH=${pythonpath}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-#######       THIS COULD BE USED FOR STRICT COMPARISON  ##############################
-#      if [ $maj_ver -eq 2 ] && [ $min_ver -eq 4 ] && [ $rel_ver -eq 1 ] ;  then 
-######################################################################################
-       if [ $maj_ver -eq 2 ] && [ $min_ver -eq 4 ] && [ $rel_ver -ge 1 ] ;  then 
-           return 0
-       else
-           return 2
-       fi
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
-
 if test `uname -m` = "x86_64" ; then
     export PYTHON_ARCHIVE_PREFIX="-lib64"
     export PYTHON_LIB_PREFIX="64"
@@ -117,13 +79,13 @@ else
     PYTHON_CONFIGURE_OPTIONS="--with-threads --with-cxx=`which g++` --enable-shared"
 fi
 
-check_jb tar xfz ${SOURCE_DIR}/Python-2.4.1${PYTHON_ARCHIVE_PREFIX}.tar.gz -C ${INSTALL_WORK}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}${PYTHON_ARCHIVE_PREFIX}.tar.gz -C ${INSTALL_ROOT}
 
 # apply patch for 64-bit platforms
 if test `uname -m` = "x86_64" ; then
     if [ -f patches/Python-2.4.1-lib64.patch ] ; then
-       cp patches/Python-2.4.1-lib64.patch ${PRODUCT_WORK} 
-       ( cd ${PRODUCT_WORK} ;                   \
+       cp patches/Python-2.4.1-lib64.patch ${PRODUCT_DIR}_SRC 
+       ( cd ${PRODUCT_DIR}_SRC ;                \
          patch -p1 < Python-2.4.1-lib64.patch ; \
          rm -rf aclocal.m4 ;                    \
          aclocal >& /dev/null ;                 \
@@ -133,7 +95,20 @@ if test `uname -m` = "x86_64" ; then
     fi
 fi
 
-cd ${PRODUCT_WORK}
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC
 
 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
     ./configure --prefix=${PRODUCT_DIR} $PYTHON_CONFIGURE_OPTIONS
@@ -162,17 +137,24 @@ if test `uname -m` = "x86_64" ; then
     ( cd ${PRODUCT_DIR}; ln -sf lib64 lib )
 fi
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/Python-2.4.1.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 (cd ${PRODUCT_DIR}/lib/python2.4/config; ln -fs ../../libpython2.4.so.1.0 libpython2.4.so)
 
@@ -185,7 +167,8 @@ for sc in idle pydoc smtpd.py ; do
     fi
 done
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -193,7 +176,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="python" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="Python-2.4.1"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 5e5ffd7bbcad75ce8b83087b34106339d5594d2e..9f4aa6630fc59e05d96f1771430018d45ce5fe43 100755 (executable)
@@ -19,44 +19,34 @@ check_version(){
 return 0
 }
 
-print_env(){
-cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export DATA_DIR=\${INSTALL_ROOT}/${PRODUCT}
-##
-EOF
-(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+print_env_bin(){
+return 1
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-check_version
-if [ $? -eq 0 ] ; then
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export DATA_DIR=\${INSTALL_ROOT}/${PRODUCT}
+print_env_src(){
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF 
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+export DATA_DIR=\${INSTALL_ROOT}/${PRODUCT}_SRC
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_SRC_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_SRC_DIR})
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_SRC_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/SAMPLESsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SRC_DIR}/SAMPLESsourcesV${VERSION}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 install_source_and_build()
@@ -66,7 +56,7 @@ install_source
 
 install_binary()
 {
-return 1
+install_source
 }
 
 export PROCEDURE=$1;
@@ -74,9 +64,12 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="SAMPLES" ; fi
-export PRODUCT="SAMPLES_SRC_${VERSION}"
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+SRC_DIR=$8;
+export PRODUCT="SAMPLES_${VERSION}"
+export PRODUCT_SRC="SAMPLES_SRC_${VERSION}"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
-export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
+export PRODUCT_SRC_DIR=${INSTALL_ROOT}/${PRODUCT_SRC}
 source ./common.sh
 $PROCEDURE 
index 4cc23b0b95b78d4cb05f6dac1959fca49e4e1faf..ddad1a3f1833a899e819bcfe20a49304a7dc17ec 100755 (executable)
@@ -22,7 +22,7 @@ fi
 return 1;
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM 
@@ -31,51 +31,51 @@ export PATH=\${SWIG_ROOT}/bin:\${PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-swig_root="`find_in_path swig ${PATH}`"
-if [ -z "${swig_root}" ] ; then
-    swig_root="`find_in_path swig /usr/bin`"
-fi
-if [ -n "${swig_root}" ] ; then
-    swig_root=`cd ${swig_root}/..; pwd`
-    ver=`swig -version 2>&1 | grep -i version | awk '{ print $3 }' | sed -e 's/^\([0-9.]*\)\(.*\)/\1/'`
-    if [ "$ver" == "1.3.24" ] ;  then 
-       tmp="\${SWIG_ROOT}/bin ${swig_root}/bin \${PATH} ${PATH}";
-       path=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM 
-export SWIG_ROOT=${swig_root}
-export PATH=${path}
-#
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
+##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       return 0;
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
+check_jb tar xfz ${SRC_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
 if test `uname -m` = "x86_64" ; then
 export CFLAGS=-m64 
 export CXXFLAGS=-m64
 fi
 
-check_jb tar xfz ${SOURCE_DIR}/swig-1.3.24.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+cd ${PRODUCT_DIR}_SRC
 makedir ${PRODUCT_DIR}
 
 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
@@ -87,15 +87,22 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make
 check_job ${PRODUCT_DIR}/INSTALL.LOG make install 
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-echo "It impossible to install SWIG 1.3.24 from binaries, try to install it from sources."
-return 1
+echo "It impossible to install ${PRODUCT} from binaries! So this one will be build from sources."
+install_source_and_build
 }
 
 export PROCEDURE=$1;
@@ -103,8 +110,12 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="swig" ; fi
-export PRODUCT="SWIG-1.3.24"
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+SRC_DIR=$8;
+shift
+REMOVE_SRC_TMP=$8;
+export PRODUCT="swig-1.3.24"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
 source ./common.sh
index 74b80355c15700196f1902db154bda39baf8fa73..b8399afa189051fb5bb4e4e67a14728a6472591e 100755 (executable)
@@ -24,7 +24,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -36,57 +36,57 @@ export TCLLIBPATH="\${VTKHOME}/lib/vtk/tcl \${TCLLIBPATH}"
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-check_version
-if [ $? -eq 0 ] ; then
-    python_version="`python -c 'import sys; print sys.version[:3]'`"
-    tmp="\${VTKHOME}/bin ${VTKHOME}/bin \${PATH} ${PATH}";  
-    path=`sort_path ${tmp}`
-    tmp="\${VTKHOME}/lib/vtk ${VTKHOME}/lib/vtk \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-    ld_library_path=`sort_path ${tmp}`
-    tmp="\${VTKHOME}/lib/vtk:\${VTKHOME}/lib/python${PYTHON_VERSION}/site-packages/vtk_python ${VTKHOME}/lib/vtk:${VTKHOME}/lib/python${python_version}/site-packages/vtk_python \${PYTHONPATH} ${PYTHONPATH}";  
-    python_path=`sort_path ${tmp}`
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export VTKHOME=${VTKHOME}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-export PYTHONPATH=${python_path}
-export TCLLIBPATH="\${VTKHOME}/lib/vtk/tcl \${TCLLIBPATH}"
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
-return $?
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
+eturn $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+makedir ${PRODUCT_DIR}_SRC
+
+check_jb tar xfz ${SOURCE_DIR}/cmake-1.6.6.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${PRODUCT_DIR}_SRC
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
 
-check_jb tar xfz ${SOURCE_DIR}/cmake-1.6.6.tar.gz -C ${INSTALL_WORK}
-cd ${INSTALL_WORK}/cmake-1.6.6
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC
 check_job ${PRODUCT_DIR}/CONFIGUREcmake.LOG ./configure
 cat >> ${PRODUCT_DIR}/MAKEcmake.LOG <<EOF
 used gcc=$GCC
 EOF
 check_job ${PRODUCT_DIR}/MAKEcmake.LOG make
 
-check_jb tar xfz ${SOURCE_DIR}/VTK-4.2-LatestRelease.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
 
 # get Python and tcl/tk version
 python_version="`python -c 'import sys; print sys.version[:3]'`"
@@ -138,7 +138,7 @@ cat > ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
 used VTK settings:
 $VTK_CMAKE_OPTIONS
 EOF
-check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${INSTALL_WORK}/cmake-1.6.6/Source/cmake . $VTK_CMAKE_OPTIONS
+check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC/Source/cmake . $VTK_CMAKE_OPTIONS
 
 cat > ${PRODUCT_DIR}/MAKE.LOG <<EOF
 used gcc=$GCC
@@ -147,28 +147,34 @@ check_job ${PRODUCT_DIR}/MAKE.LOG make
 
 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 
-cd ${PRODUCT_WORK}/Wrapping/Python
+cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC/Wrapping/Python
 check_job ${PRODUCT_DIR}/SETUPPYTHON.LOG python setup.py install --prefix=${PRODUCT_DIR}
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-#du -sk ${INSTALL_WORK}/cmake-1.6.6 >> ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK} ${INSTALL_WORK}/cmake-1.6.6
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
 
 # set correct symbolic links - bug of python wrappings installation
 cd ${PRODUCT_DIR}/lib/python${python_version}/site-packages/vtk_python
 ln -sf ../../../vtk/*Python*.so .
 
-print_env
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/VTK-4.2.2.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -176,7 +182,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="vtk" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="VTK-4.2.2"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 9c15a1f6e79749679e623c02c6cf5c0b508f046b..f3cd24622cf45c9d13beb853360b359efb1c4768 100755 (executable)
@@ -24,7 +24,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -36,68 +36,68 @@ export TCLLIBPATH="\${VTKHOME}/lib/vtk/tcl \${TCLLIBPATH}"
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-check_version
-if [ $? -eq 0 ] ; then
-    python_version="`python -c 'import sys; print sys.version[:3]'`"
-    tmp="\${VTKHOME}/bin ${VTKHOME}/bin \${PATH} ${PATH}";  
-    path=`sort_path ${tmp}`
-    tmp="\${VTKHOME}/lib/vtk ${VTKHOME}/lib/vtk \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-    ld_library_path=`sort_path ${tmp}`
-    tmp="\${VTKHOME}/lib/vtk:\${VTKHOME}/lib/python${PYTHON_VERSION}/site-packages/vtk_python ${VTKHOME}/lib/vtk:${VTKHOME}/lib/python${python_version}/site-packages/vtk_python \${PYTHONPATH} ${PYTHONPATH}";  
-    python_path=`sort_path ${tmp}`
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export VTKHOME=${VTKHOME}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-export PYTHONPATH=${python_path}
-export TCLLIBPATH="\${VTKHOME}/lib/vtk/tcl \${TCLLIBPATH}"
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+makedir ${PRODUCT_DIR}_SRC
 
-check_jb tar xfz ${SOURCE_DIR}/cmake-1.6.6.tar.gz -C ${INSTALL_WORK}
-check_jb tar xfz ${SOURCE_DIR}/VTK-4.2.6.tar.gz -C ${INSTALL_WORK}
+check_jb tar xfz ${SOURCE_DIR}/cmake-1.6.6.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${PRODUCT_DIR}_SRC
 
 # apply patches for 64-bit platforms
 if test `uname -m` = "x86_64" ; then
     if [ -f patches/cmake-1.6.6-lib64.patch ] ; then
-       cp patches/cmake-1.6.6-lib64.patch ${INSTALL_WORK}/cmake-1.6.6 
-       ( cd ${INSTALL_WORK}/cmake-1.6.6 ; patch -p1 < cmake-1.6.6-lib64.patch )
+       cp patches/cmake-1.6.6-lib64.patch ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC
+       ( cd ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC ; patch -p1 < cmake-1.6.6-lib64.patch )
     fi
     if [ -f patches/vtk-4.2.6-lib64.patch ] ; then
-       cp patches/vtk-4.2.6-lib64.patch ${PRODUCT_WORK}
-       ( cd ${PRODUCT_WORK} ; patch -p1 < vtk-4.2.6-lib64.patch )
+       cp patches/vtk-4.2.6-lib64.patch ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
+       ( cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC ; patch -p1 < vtk-4.2.6-lib64.patch )
     fi
 fi
 # apply patch: fix pb with importing Python vtk modules on some platforms
 if [ -f patches/vtk-4.2.6-patented.patch ] ; then
-    cp patches/vtk-4.2.6-patented.patch ${PRODUCT_WORK}
-    ( cd ${PRODUCT_WORK} ; patch -p1 < vtk-4.2.6-patented.patch )
+    cp patches/vtk-4.2.6-patented.patch ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
+    ( cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC ; patch -p1 < vtk-4.2.6-patented.patch )
+fi
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
 fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
 
-cd ${INSTALL_WORK}/cmake-1.6.6 
+# build sources
+makedir ${PRODUCT_DIR}
+
+cd ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC
 
 check_job ${PRODUCT_DIR}/CONFIGUREcmake.LOG ./configure
 cat >> ${PRODUCT_DIR}/MAKEcmake.LOG <<EOF
@@ -105,7 +105,7 @@ used gcc=$GCC
 EOF
 check_job ${PRODUCT_DIR}/MAKEcmake.LOG make
 
-cd ${PRODUCT_WORK}
+cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
 
 # apply a small patch for VTK (needed for gcc-3.4)
 sed -e "s%seekg(self->GetFile()->tellg()%seekg(static_cast<long>(self->GetFile()->tellg())%g" IO/vtkBMPReader.cxx > IO/vtkBMPReader.cxx.orig
@@ -179,7 +179,7 @@ cat > ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
 used VTK settings:
 $VTK_CMAKE_OPTIONS
 EOF
-check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${INSTALL_WORK}/cmake-1.6.6/Source/cmake . $VTK_CMAKE_OPTIONS
+check_job ${PRODUCT_DIR}/CONFIGURE.LOG ${PRODUCT_DIR}_SRC/cmake-1.6.6_SRC/Source/cmake . $VTK_CMAKE_OPTIONS
 
 cat > ${PRODUCT_DIR}/MAKE.LOG <<EOF
 used gcc=$GCC
@@ -188,7 +188,7 @@ check_job ${PRODUCT_DIR}/MAKE.LOG make
 
 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 
-cd ${PRODUCT_WORK}/Wrapping/Python
+cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC/Wrapping/Python
 
 check_job ${PRODUCT_DIR}/SETUPPYTHON.LOG python setup.py install --prefix=${PRODUCT_DIR}
 
@@ -204,25 +204,31 @@ check_job ${PRODUCT_DIR}/SETUPPYTHON.LOG python setup.py install --prefix=${PROD
       cd ${PRODUCT_DIR}; ln -s lib64 lib
   fi
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-#du -sk ${INSTALL_WORK}/cmake-1.6.6 >> ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK} ${INSTALL_WORK}/cmake-1.6.6
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
 if [ -n "$MESA_HOME" ]; then
-  check_jb tar xfz ${SOURCE_DIR}/VTK-4.2.6-with-Mesa.tar.gz -C ${INSTALL_ROOT}
+  check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}_with_Mesa.tar.gz -C ${INSTALL_ROOT}
 else
-  check_jb tar xfz ${SOURCE_DIR}/VTK-4.2.6.tar.gz -C ${INSTALL_ROOT}
+  check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 fi
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -230,7 +236,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="vtk" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="VTK-4.2.6"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index f1a8def2c4970cda02b735a796faf7fa962807e0..0a86f3aa77eb58c4e302b889a36b9fe765985684 100755 (executable)
@@ -84,8 +84,8 @@ for i in $SHRC $CSHRC ; do
     touch ${install_work}/$i
 done
 
-if [ $# -eq 3 ] ; then
-    product_name=$3;
+if [ $# -eq 4 ] ; then
+    product_name=$4;
     product_env=${install_work}/env_${product_name}.sh
     (test -e ${product_env} && rm ${product_env} )
 fi
@@ -136,9 +136,20 @@ fi
 
 # 1. first dump all environment files into the $SHRC file
 product_sequence="$2"
+install_products="$3"
 for i in $product_sequence ; do
     env_file=${install_work}/env_${i}.sh
-    ( test -e $env_file && cat $env_file >> ${install_work}/$SHRC 2>/dev/null )
+    _env_file=${install_work}/_env_${i}.sh
+    if [ -e $_env_file ] ; then
+       cat $_env_file >> ${install_work}/$SHRC 2>/dev/null
+    elif [ -e $env_file ] ; then
+       echo $install_products | grep -q "\b${i}\b"
+       if [ $? -eq 1 ] ; then
+           cat $env_file | sed 's/^/## /' >> ${install_work}/$SHRC 2>/dev/null
+       else
+           cat $env_file >> ${install_work}/$SHRC 2>/dev/null
+       fi
+    fi
 done
 
 # 2. writing global functions to _salome.sh file
@@ -339,25 +350,31 @@ cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$CSHRC 2>/dev/null
 
 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
 
-if [ $# -eq 4 ] ; then
-    product_dir=$4
+if [ $# -eq 5 ] ; then
+    product_dir=$5
     if [ -e ${product_dir} ] ; then
-       cp -f ${install_work}/_$SHRC  ${product_dir}/$SHRC
-       cp -f ${install_work}/_$CSHRC ${product_dir}/$CSHRC
+       test -e ${product_dir}/$SHRC && mv ${product_dir}/$SHRC ${product_dir}/${SHRC}_`date +%F_%T`
+       cp ${install_work}/_$SHRC  ${product_dir}/$SHRC
+       test -e ${product_dir}/$CSHRC && mv ${product_dir}/$CSHRC ${product_dir}/${CSHRC}_`date +%F_%T`
+       cp ${install_work}/_$CSHRC ${product_dir}/$CSHRC
     fi
 fi
 sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_$CSHRC > ${install_root}/env_build.csh
 sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_$SHRC  > ${install_root}/env_build.sh
 
+#test -e ${install_root}/env_products.csh && mv ${install_root}/env_products.csh ${install_root}/env_products.csh_`date +%F_%T`
 cp -f ${install_work}/_$CSHRC ${install_root}/env_products.csh
+#test -e ${install_root}/env_products.sh && mv ${install_root}/env_products.sh ${install_root}/env_products.sh_`date +%F_%T`
 cp -f ${install_work}/_$SHRC  ${install_root}/env_products.sh
 
 rm -f ${install_work}/_$SHRC ${install_work}/_$CSHRC
 ### !!! copying build.csh and build.sh scripts
 if [ -e ./build.csh ]; then
+    #test -e ${install_root}/build.csh && mv ${install_root}/build.csh ${install_root}/build.csh_`date +%F_%T`
     cp -f ./build.csh ${install_root}
 fi
 if [ -e ./build.sh ]; then
+    #test -e ${install_root}/build.sh && mv ${install_root}/build.sh ${install_root}/build.sh_`date +%F_%T`
     cp -f ./build.sh ${install_root}
 fi
 ### !!! copying release notes
@@ -376,25 +393,26 @@ done
 #try use already existing product
 try_existing()
 {
-product_dir=$1;  install_root=$2;  install_work=$3;  product_sequence="$4";  product_type=$5
+product_dir=$1;  install_root=$2;  install_work=$3;
+product_sequence="$4"; installed_products="$5";  product_type=$6
 env_file=${product_dir}/env_${product_type}.sh
 if [ -f ${env_file} ] ; then
-    cp -f ${env_file} ${install_work}
-    make_env ${install_root} ${install_work} "${product_sequence}"
+#    cp -f ${env_file} ${install_work}
+    cp -f ${env_file} ${install_work}/_env_${product_type}.sh
+    make_env ${install_root} ${install_work} "${product_sequence}" "${installed_products}"
     source ${install_work}/$SHRC
     check_version
     if [ $? -eq 0 ] ; then
-       if [ -d ${product_dir} ] && [ -w ${product_dir} ] ; then
-           #makedir ${product_dir}
-           print_env
-           return 0    
-       fi
-    else
-       rm -f ${install_work}/env_${product_type}.sh
-       make_env ${install_root} ${install_work} "${product_sequence}"
+       return 0
     fi
 fi
-return 1;
+echo ${product_type} | grep -q '_src$'
+if [ $? -eq 1 ] ; then
+    print_env_bin
+else
+    print_env_src
+fi
+return 0
 }
 
 #check existance of lib passed as first parameter
index c847e46ae66c35b4680b88b5350bbde6c5387076..b994dd147b839d5e75b0284ad4f135d8c7d8341e 100755 (executable)
@@ -17,7 +17,7 @@ check_version(){
 return 0
 }
 
-print_env(){
+print_env_bin(){
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
 export PYTHONPATH=\${INSTALL_ROOT}/${PRODUCT}/lib/python\${PYTHON_VERSION}/site-packages:\${PYTHONPATH}
@@ -25,27 +25,48 @@ export PATH=\${INSTALL_ROOT}/${PRODUCT}/bin:\${PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-try_native(){
-return 1
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
+##
+EOF
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-check_jb tar xfz ${SOURCE_DIR}/docutils-0.3.7.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK} ; python setup.py install --prefix=${PRODUCT_DIR}
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC ; python setup.py install --prefix=${PRODUCT_DIR}
 
 cd ${PRODUCT_DIR}/bin; 
 
@@ -63,17 +84,21 @@ ln -sf rst2html.py rst2html
       cd ${PRODUCT_DIR}; ln -sf lib64 lib
   fi
 
-rm -fr ${PRODUCT_WORK}
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/docutils-0.3.7.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 cd ${PRODUCT_DIR}/bin; 
 
 sed -e "s%#\!.*python%#\!/usr/bin/env python%" rst2latex.py > _rst2latex.py
@@ -86,7 +111,8 @@ mv -f _rst2html.py rst2html.py
 chmod a+x rst2html.py
 ln -sf rst2html.py rst2html
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -94,7 +120,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="docutils" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="docutils-0.3.7"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index c27509b746138fe74381b393e0131fd2bbd87482..f9e58af29c1a2439f46a3db94deec1b1bd7aea86 100755 (executable)
@@ -29,7 +29,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -37,47 +37,47 @@ export PATH=\${INSTALL_ROOT}/${PRODUCT}/bin:\${PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-# we need version 1.4.4 or newer
-try_native(){
-doxyhome="`find_in_path doxygen ${PATH}:/usr/bin`"
-if [ -n "${doxyhome}" ] ; then
-    ver=`doxygen --version`
-    maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    let ver=$maj_ver*10000+$min_ver*100+$rel_ver
-    if [ $ver -ge 10404 ] ; then
-       tmp="${doxyhome} ${doxyhome} \${PATH} ${PATH}";
-       path=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PATH=${path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       return 0
-    fi
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/doxygen-1.4.6.tar.gz -C ${INSTALL_WORK}
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
 
-cd ${PRODUCT_WORK}
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+cd ${PRODUCT_DIR}_SRC
 makedir ${PRODUCT_DIR}
 # vsr: fix a bug on Mandrake-10.1: wrong qt library reference
 sed -e "s/-lqt$/-lqt-mt/g" ./tmake/lib/linux-g++/tmake.conf > ./tmake/lib/linux-g++/tmake.conf.new
@@ -114,19 +114,27 @@ check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 #EOF
 #fi
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/doxygen-1.4.6.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -134,7 +142,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="doxygen" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="doxygen-1.4.6"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index af4d79479593fd548c55a0029ff5bdd55f9fadce..960294e0e8d6eef931977c6525614d8f8de34b50 100755 (executable)
@@ -20,7 +20,8 @@ GCC_VERSION_MIN=`echo $GCC_VERSION | awk -F[.-] '{if(NF>1) print $2; else print
 GCC_VERSION_REL=`echo $GCC_VERSION | awk -F[.-] '{if(NF>2) print $3; else print 0}'`
 let GCC_VERSION_ID=$GCC_VERSION_MAJ*10000+$GCC_VERSION_MIN*100+$GCC_VERSION_REL
 
-check_version(){
+check_version()
+{
 # version number is calculated as: <major>*10000+<minor>*100+<release>
 # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202
 gcc_ver=`gcc -dumpversion | awk -F[.-] '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'`
@@ -30,20 +31,6 @@ fi
 return 1
 }
 
-print_env(){
-cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export GCC_ROOT=\${INSTALL_ROOT}/${PRODUCT}
-export CXX=\${GCC_ROOT}/bin/g++
-export CC=\${GCC_ROOT}/bin/gcc
-export PATH=\${GCC_ROOT}/bin:\${PATH}
-export LD_LIBRARY_PATH=\${GCC_ROOT}/lib:\${LD_LIBRARY_PATH}
-##
-EOF
-(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-}
-
 # looks for the native product and collects it's environment (used by make_env())
 try_native(){
 gcc_root="`where_gcc $GCC_VERSION`"
@@ -71,7 +58,7 @@ export PATH=${path}
 export LD_LIBRARY_PATH=${ld_library_path}
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 #######       THIS COULD BE USED FOR STRICT COMPARISON  ##############################
 #      if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -eq 0 ] ;  then 
 ######################################################################################
@@ -86,20 +73,8 @@ return 1
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
-return $?
-}
-
-install_source()
-{
-echo "The installation of gcc $GCC_VERSION from sources is not provided! Use native gcc."
-return 1
-}
-
-install_binary()
-{
-echo "It impossible to install gcc $GCC_VERSION from binaries, try install from sources."
-return 1
+echo "It is impossible to install gcc from binaries or sources! So native gcc will be used."
+try_native
 }
 
 export PROCEDURE=$1;
@@ -107,7 +82,8 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="gcc" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
 export PRODUCT="gcc-$GCC_VERSION"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 0a9627de3b6bd5a6183c7b7621cc2b76195ceeb5..d5737d954c052651343d1ddd1c44090f11620761 100755 (executable)
@@ -24,7 +24,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -33,45 +33,48 @@ export LD_LIBRARY_PATH=\${INSTALL_ROOT}/${PRODUCT}/lib/graphviz:\${LD_LIBRARY_PA
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-check_version
-if [ $? -eq 0 ] ; then
-    dot="`find_in_path dot ${PATH}`"
-    dot=`cd ${dot}/..; pwd`
-    tmp="${dot}/bin ${dot}/bin \${PATH} ${PATH}";  
-    path=`sort_path ${tmp}`
-    tmp="${dot}/lib/graphviz ${dot}/lib/graphviz \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-    ld_library_path=`sort_path ${tmp}`
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}""${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/graphviz-1.9.tar.gz -C ${INSTALL_WORK}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
 
-cd ${PRODUCT_WORK}
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+cd ${PRODUCT_DIR}_SRC
 makedir ${PRODUCT_DIR}
+
 check_job ${PRODUCT_DIR}/CONFIGURE.LOG configure --prefix=${PRODUCT_DIR} --with-tcl=${TCLHOME} --disable-rpath 
 GCC=`which gcc`
 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
@@ -80,17 +83,24 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make
 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/graphviz-1.9.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 cd ${PRODUCT_DIR}/lib/graphviz
 for l in `ls *.la`; do
     libdir=`grep -e "libdir=.*" $l | sed -e "s/libdir=[\'|\"]\(.*\)[\'|\"]/\1/g"`
@@ -101,7 +111,8 @@ for l in `ls *.la`; do
     chmod a+x $l
 done
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -109,7 +120,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="graphviz" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="graphviz-1.9"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 7d4ddbffa1733c6943c1fe0195c0dcc205ebcc0c..5c66a10a56b764aa37d60bd7c54fbd83f2ef7f29 100755 (executable)
@@ -28,7 +28,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -37,50 +37,47 @@ export LD_LIBRARY_PATH=\${INSTALL_ROOT}/${PRODUCT}/lib/graphviz:\${LD_LIBRARY_PA
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-dothome="`find_in_path dot ${PATH}:/usr/bin`"
-if [ -n "${dothome}" ] ; then
-    ver=`dot -V 2>&1 | awk '{print $3}'`
-    maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-    let ver=$maj_ver*10000+$min_ver*100+$rel_ver
-    if [ $ver -ge 20201 ] ; then
-       dothome=`cd ${dothome}/..; pwd`
-       tmp="${dothome}/bin ${dothome}/bin \${PATH} ${PATH}";  
-       path=`sort_path ${tmp}`
-       tmp="${dothome}/lib/graphviz ${dothome}/lib/graphviz \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-       ld_library_path=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       return 0
-    fi
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/graphviz-2.2.1.tar.gz -C ${INSTALL_WORK}
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
 
-cd ${PRODUCT_WORK}
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+cd ${PRODUCT_DIR}_SRC
 makedir ${PRODUCT_DIR}
   if test `uname -m` = "x86_64" ; then
 check_job ${PRODUCT_DIR}/CONFIGURE.LOG configure --prefix=${PRODUCT_DIR} --with-expatlibdir=/usr/lib64 --with-tcl=${TCLHOME} --disable-rpath CFLAGS=-m64 CXXFLAGS=-m64
@@ -94,17 +91,24 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make
 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/graphviz-2.2.1.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 cd ${PRODUCT_DIR}/lib/graphviz
 for l in `ls *.la`; do
     libdir=`grep -e "libdir=.*" $l | sed -e "s/libdir=[\'|\"]\(.*\)[\'|\"]/\1/g"`
@@ -115,7 +119,8 @@ for l in `ls *.la`; do
     chmod a+x $l
 done
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -123,7 +128,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="graphviz" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="graphviz-2.2.1"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 8a2718fe80de07662fbccd5bee592fc73b4c9c9c..efb89a93749cf9e78a50b9e9fde1eef2672905b8 100755 (executable)
@@ -31,7 +31,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -41,47 +41,46 @@ export LD_LIBRARY_PATH=\${HDF5HOME}/lib:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-hdfdir="`find_in_path libhdf5.so ${LD_LIBRARY_PATH}:/usr/lib`"
-if [ -z "${hdfdir}" ] ; then return 1 ; fi
-if [ -f ${hdfdir}/libhdf5.settings ]; then
-    ver=`grep "HDF5 Version:" ${hdfdir}/libhdf5.settings | awk '{print $3}'` 
-    if [ "$ver" == "1.6.3" ]; then 
-       hdfdir=`cd ${hdfdir}/..; pwd`
-       tmp="\${HDF5HOME}/bin ${hdfdir}/bin \${PATH} ${PATH}";  
-       path=`sort_path ${tmp}`
-       tmp="\${HDF5HOME}/lib ${hdfdir}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-       ld_library_path=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export HDF5HOME=${hdfdir}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       return 0
-    fi
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/hdf5-1.6.3.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+cd ${PRODUCT_DIR}_SRC
 makedir ${PRODUCT_DIR}
 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
     ./configure --prefix=${PRODUCT_DIR} -disable-debug --enable-production --enable-threadsafe --enable-hdf5v1_2 \
@@ -93,17 +92,24 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make 
 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/hdf5-1.6.3.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 ### modify libhdf5.la file to correct direct path to hdf5 library
 ### no need to do this for sources installation because 'make install' does it!
@@ -111,7 +117,8 @@ cd ${PRODUCT_DIR}/lib
 sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libhdf5.la > libhdf5.la.new
 mv -f libhdf5.la.new libhdf5.la
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -119,7 +126,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="hdf" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="hdf5-1.6.3"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index a80569f65b08e4b5482eb2a68f376d49ed243bea..939e0313f6cd5fef4c89ba456650fb2bb41620d5 100755 (executable)
@@ -31,7 +31,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -41,51 +41,53 @@ export LD_LIBRARY_PATH=\${HDF5HOME}/lib:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-hdfdir="`find_in_path libhdf5.so ${LD_LIBRARY_PATH}:/usr/lib`"
-if [ -z "${hdfdir}" ] ; then return 1 ; fi
-if [ -f ${hdfdir}/libhdf5.settings ]; then
-    ver=`grep "HDF5 Version:" ${hdfdir}/libhdf5.settings | awk '{print $3}'` 
-    if [ "$ver" == "1.6.4" ]; then 
-       hdfdir=`cd ${hdfdir}/..; pwd`
-       tmp="\${HDF5HOME}/bin ${hdfdir}/bin \${PATH} ${PATH}";  
-       path=`sort_path ${tmp}`
-       tmp="\${HDF5HOME}/lib ${hdfdir}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-       ld_library_path=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export HDF5HOME=${hdfdir}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       return 0
-    fi
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
+
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
 if test `uname -m` = "x86_64" ; then
 HDF_CONFIGURE_OPTIONS="-disable-debug --enable-production --enable-threadsafe --enable-hdf5v1_2        --enable-stream-vfd --disable-hsizet --with-pthread=/usr/include,/usr/lib CFLAGS=-m64 CXXFLAGS=-m64"
 else
 HDF_CONFIGURE_OPTIONS="-disable-debug --enable-production --enable-threadsafe --enable-hdf5v1_2        --enable-stream-vfd --disable-hsizet --with-pthread=/usr/include,/usr/lib"
 fi
-check_jb tar xfz ${SOURCE_DIR}/hdf5-1.6.4.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+
+cd ${PRODUCT_DIR}_SRC
 makedir ${PRODUCT_DIR}
 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
     ./configure --prefix=${PRODUCT_DIR} $HDF_CONFIGURE_OPTIONS
@@ -96,17 +98,24 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make 
 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/hdf5-1.6.4.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 ### modify libhdf5.la file to correct direct path to hdf5 library
 ### no need to do this for sources installation because 'make install' does it!
@@ -118,7 +127,8 @@ if [ -e libhdf5_hl.la ] ; then
     mv -f libhdf5_hl.la.new libhdf5_hl.la
 fi
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -126,7 +136,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="hdf" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="hdf5-1.6.4"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index b642fdf21c1c8be11b3e1eb64be1bb02fdfea92a..82ba28abee05e74a3da0e7ce7470f8a4a7e7e6df 100755 (executable)
@@ -26,7 +26,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -36,43 +36,47 @@ export LD_LIBRARY_PATH=\${MED2HOME}/lib:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-check_version
-if [ $? -eq 0 ] ; then
-    tmp="\${MED2HOME}/bin ${MED2HOME}/bin \${PATH} ${PATH}";  
-    path=`sort_path ${tmp}`
-    tmp="\${MED2HOME}/lib ${MED2HOME}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-    ld_library_path=`sort_path ${tmp}`
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export MED2HOME=${MED2HOME}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/med_fichier2.2.3.src.tar.gz -C ${INSTALL_WORK}
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
 
-cd ${PRODUCT_WORK}
+# build sources
+cd ${PRODUCT_DIR}_SRC
 makedir ${PRODUCT_DIR}
 
 #vsr: provide additional flags for f95 (Mandriva 2006.0, Fedora Core 4)
@@ -88,15 +92,15 @@ fi
 if [ $is_mandriva == 1 ] || [ $is_fedora == 1 ] ; then
     if test `uname -m` = "x86_64" ; then
     echo "`pwd` -> ./configure --prefix=${PRODUCT_DIR} FFLAGS='-g -O2 -ffixed-line-length-none' CFLAGS=-m64 CXXFLAGS=-m64 >> ${PRODUCT_DIR}/CONFIGURE.LOG"
-    ./configure --prefix=${PRODUCT_DIR} FFLAGS="-g -O2 -ffixed-line-length-none" CFLAGS=-m64 CXXFLAGS=-m64 >> ${PRODUCT_DIR}/CONFIGURE.LOG 2> ${INSTALL_WORK}/errlog
+    ./configure --prefix=${PRODUCT_DIR} FFLAGS="-g -O2 -ffixed-line-length-none" CFLAGS=-m64 CXXFLAGS=-m64 >> ${PRODUCT_DIR}/CONFIGURE.LOG 2> ${PRODUCT_DIR}_SRC/errlog
     else
     echo "`pwd` -> ./configure --prefix=${PRODUCT_DIR} FFLAGS='-g -O2 -ffixed-line-length-none' >> ${PRODUCT_DIR}/CONFIGURE.LOG"
-    ./configure --prefix=${PRODUCT_DIR} FFLAGS="-g -O2 -ffixed-line-length-none" >> ${PRODUCT_DIR}/CONFIGURE.LOG 2> ${INSTALL_WORK}/errlog
+    ./configure --prefix=${PRODUCT_DIR} FFLAGS="-g -O2 -ffixed-line-length-none" >> ${PRODUCT_DIR}/CONFIGURE.LOG 2> ${PRODUCT_DIR}_SRC/errlog
     fi
     if [ "$?" -ne "0" ] ; then
       cat ${PRODUCT_DIR}/CONFIGURE.LOG
-      cat ${INSTALL_WORK}/errlog >&2
-      cat ${INSTALL_WORK}/errlog >> ${PRODUCT_DIR}/CONFIGURE.LOG
+      cat ${PRODUCT_DIR}_SRC/errlog >&2
+      cat ${PRODUCT_DIR}_SRC/errlog >> ${PRODUCT_DIR}/CONFIGURE.LOG
       exit 1
     fi
 else
@@ -111,8 +115,8 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make
 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
 
 ### modify libmed.la libmedC.la files to correct direct path to hdf5 library
 cd ${PRODUCT_DIR}/lib
@@ -132,15 +136,21 @@ mv -f libmedC.la.new libmedC.la
 chmod 755 libmed.la
 chmod 755 libmedC.la
 
-print_env
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/med-2.2.3.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 ### modify libmed.la libmedC.la files to correct direct path to hdf5 library
 ### also modify libmed.la and libmedC.la files to correct direct path to med libraries
@@ -168,7 +178,8 @@ sed -e "s%set cmd \".*/bin/mdump\"%set cmd \"${PRODUCT_DIR}/bin/mdump\"%g" xmdum
 mv _xmdump xmdump
 chmod a+x xmdump
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -176,9 +187,12 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="med" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="med-2.2.3"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
-export PRODUCT_WORK=${INSTALL_WORK}/med_fichier2.2.3.src
+export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
 source ./common.sh
 $PROCEDURE 
index 43df2014f52edefee8b8f7a33ab0ff27229660ac..bf06151d71f4edb1b2a181a86510eebd37b76f6a 100755 (executable)
@@ -21,7 +21,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -30,40 +30,49 @@ export PATH=\${MSG2QM_ROOT}:\${PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-msg2qmroot="`find_in_path msg2qm ${PATH}`"
-if [ -n "${msg2qmroot}" ] ; then
-    tmp="\${MSG2QM_ROOT} ${msg2qmroot} \${PATH} ${PATH}";  
-    path=`sort_path ${tmp}`
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export MSG2QM_ROOT=${msg2qmroot}
-export PATH=${path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_preinstalled()
+{
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/msg2qm.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
 makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC
 
 qmake msg2qm.pro -o Makefile
 
@@ -75,20 +84,27 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make 
 cp -f msg2qm ${PRODUCT_DIR}
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -rf ${PRODUCT_WORK}
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/msg2qm.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -96,7 +112,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="msg2qm" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="msg2qm"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index b5800df009f1e01b42dac2a476acf6cac21fe188..9c7a416177e45ff01d7b9e28dbb6c87928dd2911 100755 (executable)
@@ -22,7 +22,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -30,61 +30,69 @@ export NETGENHOME=\${INSTALL_ROOT}/${PRODUCT}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-check_version
-if [ $? -eq 0 ] ; then
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export NETGENHOME=\${NETGENROOT}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
-
-makedir ${PRODUCT_DIR}
-
-check_jb tar xfz ${SOURCE_DIR}/netgen-4.5.tar.gz -C ${INSTALL_WORK}
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # apply general patch for SALOME
 if [ -f patches/netgen-4.5-for-SALOME.patch ] ; then
-    cp patches/netgen-4.5-for-SALOME.patch ${PRODUCT_WORK}
-    ( cd ${PRODUCT_WORK}; patch -p1 < netgen-4.5-for-SALOME.patch )
+    cp patches/netgen-4.5-for-SALOME.patch ${PRODUCT_DIR}_SRC
+    ( cd ${PRODUCT_DIR}_SRC; patch -p1 < netgen-4.5-for-SALOME.patch )
 fi
 
 # apply patch for 64-bit platforms
 if test `uname -m` = "x86_64" ; then
     if [ -f patches/netgen-4.5-lib64.patch ] ; then
-       cp patches/netgen-4.5-lib64.patch ${PRODUCT_WORK}
-       ( cd ${PRODUCT_WORK}; patch -p1 < netgen-4.5-lib64.patch )
+       cp patches/netgen-4.5-lib64.patch ${PRODUCT_DIR}_SRC
+       ( cd ${PRODUCT_DIR}_SRC; patch -p1 < netgen-4.5-lib64.patch )
     fi
 fi
 
 # additional patching for SALOME
-(cd ${PRODUCT_WORK}; cp ngtcltk/ngnewdelete.* libsrc/interface)
+(cd ${PRODUCT_DIR}_SRC; cp ngtcltk/ngnewdelete.* libsrc/interface)
 
 # apply patch: to make compilable on latest versions of gcc
-(cd ${PRODUCT_WORK}/libsrc/meshing; echo -e '16s/^$/class Mesh;\nwq' | ed - meshtype.hpp > /dev/null)
+(cd ${PRODUCT_DIR}_SRC/libsrc/meshing; echo -e '16s/^$/class Mesh;\nwq' | ed - meshtype.hpp > /dev/null)
 
 # apply patch: to make compilable with CASCADE-6.1.1
-(cd ${PRODUCT_WORK}/libsrc; sed -e "s%\(.*\)-DHAVE_LIMITS\'%\1-DHAVE_LIMITS_H%g" makefile.inc > makefile.inc.new; mv makefile.inc.new makefile.inc)
+(cd ${PRODUCT_DIR}_SRC/libsrc; sed -e "s%\(.*\)-DHAVE_LIMITS\'%\1-DHAVE_LIMITS_H%g" makefile.inc > makefile.inc.new; mv makefile.inc.new makefile.inc)
 
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
 # set platform type variable
 if test `uname -m` = "x86_64" ; then
     export MACHINE=LINUX64
@@ -94,33 +102,41 @@ fi
 
 # compile
 for directory in csg general geom2d gprim interface linalg occ meshing opti stlgeom ; do
-    cd ${PRODUCT_WORK}/libsrc/${directory}
+    cd ${PRODUCT_DIR}_SRC/libsrc/${directory}
     check_job ${PRODUCT_DIR}/MAKE.LOG make
 done
 
 # install
 mkdir -p ${PRODUCT_DIR}/lib
-cp -f ${PRODUCT_WORK}/lib/${MACHINE}/* ${PRODUCT_DIR}/lib
+cp -f ${PRODUCT_DIR}_SRC/lib/${MACHINE}/* ${PRODUCT_DIR}/lib
 mkdir -p ${PRODUCT_DIR}/include
-cp -f ${PRODUCT_WORK}/libsrc/interface/nglib.h ${PRODUCT_DIR}/include
+cp -f ${PRODUCT_DIR}_SRC/libsrc/interface/nglib.h ${PRODUCT_DIR}/include
 for directory in csg general geom2d gprim linalg occ meshing opti stlgeom ; do
-    cp -f ${PRODUCT_WORK}/libsrc/${directory}/*.hpp ${PRODUCT_DIR}/include
+    cp -f ${PRODUCT_DIR}_SRC/libsrc/${directory}/*.hpp ${PRODUCT_DIR}/include
 done
-cp -f ${PRODUCT_WORK}/libsrc/include/mystdlib.h ${PRODUCT_WORK}/libsrc/include/mydefs.hpp ${PRODUCT_DIR}/include
+cp -f ${PRODUCT_DIR}_SRC/libsrc/include/mystdlib.h ${PRODUCT_DIR}_SRC/libsrc/include/mydefs.hpp ${PRODUCT_DIR}/include
+
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/netgen-4.5.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -128,7 +144,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="netgen" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="netgen-4.5"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index e31f4f6ad4638b037c4f88acedd6e5ea27a6c351..0d0b8ee796f1458492083b886e720d9149f3579c 100755 (executable)
@@ -38,7 +38,7 @@ fi
 return 0
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -49,57 +49,58 @@ export PATH=\$OMNIORBDIR/bin:\$PATH
 export LD_LIBRARY_PATH=\$OMNIORBDIR/lib:\$LD_LIBRARY_PATH 
 ##
 EOF
-cat > ${PRODUCT_DIR}/.omniORB.cfg <<EOF
+if [ $PROCEDURE != "try_preinstalled" ] && [ -w ${PRODUCT_DIR} ] ; then
+    cat > ${PRODUCT_DIR}/.omniORB.cfg <<EOF
 InitRef = NameService=corbaname::`hostname`:2810
 EOF
+fi
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-check_version
-if [ $? -eq 0 ] ; then
-    python_version="`python -c 'import sys; print sys.version[:3]'`"
-    tmp="\${OMNIORBDIR}/bin ${OMNIORBDIR}/bin \${PATH} ${PATH}";  
-    path=`sort_path ${tmp}`
-    tmp="\${OMNIORBDIR}/lib ${OMNIORBDIR}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-    ld_library_path=`sort_path ${tmp}`
-    tmp="\${OMNIORBDIR}/lib:\${OMNIORBDIR}/lib/python\${PYTHON_VERSION}/site-packages ${OMNIORBDIR}/lib:${OMNIORBDIR}/lib/python${python_version}/site-packages \${PYTHONPATH} ${PYTHONPATH}";  
-    pythonpath=`sort_path ${tmp}`
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export OMNIORBDIR=${OMNIORBDIR}
-export OMNIORB_CONFIG=\${OMNIORBDIR}/.omniORB.cfg
-export PYTHONPATH=${pythonpath}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+makedir ${PRODUCT_DIR}_SRC
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/omniORBpy-2.5.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/omniNotify-2.1.tar.gz -C ${PRODUCT_DIR}_SRC
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
 
-check_jb tar xfz ${SOURCE_DIR}/omniORB-4.0.5.tar.gz -C ${INSTALL_WORK}
-check_jb tar xfz ${SOURCE_DIR}/omniORBpy-2.5.tar.gz -C ${INSTALL_WORK}
-check_jb tar xfz ${SOURCE_DIR}/omniNotify-2.1.tar.gz -C ${INSTALL_WORK}
+install_source_and_build()
+{
+# install sources
+install_source
 
+# build sources
+makedir ${PRODUCT_DIR}
 # install omniORB
-cd ${INSTALL_WORK}/omniORB-4.0.5
+cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
 mkdir build
 cd build
 
@@ -114,7 +115,7 @@ check_job ${PRODUCT_DIR}/MAKE_OMNIORB.LOG make
 check_job ${PRODUCT_DIR}/INSTALL_OMNIORB.LOG make install
 
 # install omniORBpy
-cd ${INSTALL_WORK}/omniORBpy-2.5
+cd ${PRODUCT_DIR}_SRC/omniORBpy-2.5_SRC
 mkdir build
 cd build
 
@@ -129,7 +130,7 @@ check_job ${PRODUCT_DIR}/MAKE_OMNIORBPY.LOG make
 check_job ${PRODUCT_DIR}/INSTALL_OMNIORBPY.LOG make install
 
 # install omniNotify
-cd ${INSTALL_WORK}/omniNotify
+cd ${PRODUCT_DIR}_SRC/omniNotify-2.1_SRC
 mkdir build
 cd build
 
@@ -151,20 +152,24 @@ sed -e "s%#\!.*python%#\!/usr/bin/env python%" omniidlrun.py > _omniidlrun.py
 mv -f _omniidlrun.py omniidlrun.py
 chmod a+x omniidlrun.py
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
 cd ${PRODUCT_DIR}
-rm -fr ${INSTALL_WORK}/omniORB-4.0.5
-rm -fr ${INSTALL_WORK}/omniORBpy-2.5
-rm -fr ${INSTALL_WORK}/omniNotify
-print_env
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/omniORB-4.0.5.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 ln -sf ${PRODUCT_DIR} ${INSTALL_ROOT}/omni
 
@@ -176,7 +181,8 @@ sed -e "s%#\!.*python%#\!/usr/bin/env python%" omniidlrun.py > _omniidlrun.py
 mv -f _omniidlrun.py omniidlrun.py
 chmod a+x omniidlrun.py
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -184,7 +190,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="omni" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="omniORB-4.0.5"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 987d5f261d3b31566010af95a4099d6ecb8615a6..e679708e50dc32a77e37ec5ec246bfbe536fea86 100755 (executable)
@@ -38,7 +38,7 @@ fi
 return 0
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -53,58 +53,53 @@ cat > ${PRODUCT_DIR}/.omniORB.cfg <<EOF
 InitRef = NameService=corbaname::`hostname`:2810
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-omnidir="`find_in_path omniidl ${PATH}:/usr/bin`"
-if [ -n "${omnidir}" ] ; then
-  omnidir=`cd ${omnidir}/..; pwd`
-  OMNIORBDIR=${omnidir}
-  python_version="`python -c 'import sys; print sys.version[:3]'`"
-  check_lib_version libomniORB4.so.0.6 ${OMNIORBDIR}/lib
-  if [ "$?" -ne "0" ]; then return 1 ; fi
-  check_lib_version _omnipymodule.so.2.6 ${OMNIORBDIR}/lib/python${python_version}/site-packages
-  if [ "$?" -ne "0" ]; then return 1 ; fi
-  tmp="${omnidir}/bin ${omnidir}/bin \${PATH} ${PATH}";  
-  path=`sort_path ${tmp}`
-  tmp="${omnidir}/lib ${omnidir}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-  ld_library_path=`sort_path ${tmp}`
-  tmp="${omnidir}/lib:${omnidir}/lib/python\${PYTHON_VERSION}:${omnidir}/lib/python\${PYTHON_VERSION}/site-packages ${omnidir}/lib:${omnidir}/lib/python${python_version}/site-packages \${PYTHONPATH} ${PYTHONPATH}";  
-  pythonpath=`sort_path ${tmp}`
-  cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export OMNIORB_CONFIG=\${HOME}/.omniORB.cfg
-export PYTHONPATH=${pythonpath}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-  make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-  return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+makedir ${PRODUCT_DIR}_SRC
 
-check_jb tar xfz ${SOURCE_DIR}/omniORB-4.0.6.tar.gz -C ${INSTALL_WORK}
-check_jb tar xfz ${SOURCE_DIR}/omniORBpy-2.6.tar.gz -C ${INSTALL_WORK}
-check_jb tar xfz ${SOURCE_DIR}/omniNotify-2.1.tar.gz -C ${INSTALL_WORK}
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/omniORBpy-2.6.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/omniNotify-2.1.tar.gz -C ${PRODUCT_DIR}_SRC
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
 
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
 # install omniORB
-cd ${INSTALL_WORK}/omniORB-4.0.6
+cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
 mkdir build
 cd build
 
@@ -119,7 +114,7 @@ check_job ${PRODUCT_DIR}/MAKE_OMNIORB.LOG make
 check_job ${PRODUCT_DIR}/INSTALL_OMNIORB.LOG make install
 
 # install omniORBpy
-cd ${INSTALL_WORK}/omniORBpy-2.6
+cd ${PRODUCT_DIR}_SRC/omniORBpy-2.6_SRC
 mkdir build
 cd build
 
@@ -134,7 +129,7 @@ check_job ${PRODUCT_DIR}/MAKE_OMNIORBPY.LOG make
 check_job ${PRODUCT_DIR}/INSTALL_OMNIORBPY.LOG make install
 
 # install omniNotify
-cd ${INSTALL_WORK}/omniNotify
+cd ${PRODUCT_DIR}_SRC/omniNotify_SRC
 mkdir build
 cd build
 
@@ -156,20 +151,24 @@ sed -e "s%#\!.*python%#\!/usr/bin/env python%" omniidlrun.py > _omniidlrun.py
 mv -f _omniidlrun.py omniidlrun.py
 chmod a+x omniidlrun.py
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
 cd ${PRODUCT_DIR}
-rm -fr ${INSTALL_WORK}/omniORB-4.0.6
-rm -fr ${INSTALL_WORK}/omniORBpy-2.6
-rm -fr ${INSTALL_WORK}/omniNotify
-print_env
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/omniORB-4.0.6.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 ln -sf ${PRODUCT_DIR} ${INSTALL_ROOT}/omni
 
@@ -181,7 +180,8 @@ sed -e "s%#\!.*python%#\!/usr/bin/env python%" omniidlrun.py > _omniidlrun.py
 mv -f _omniidlrun.py omniidlrun.py
 chmod a+x omniidlrun.py
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -189,7 +189,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="omni" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="omniORB-4.0.6"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index c707b0817d78167a0309f512a996c40a051d8e3e..e2492b6cd12de499d56c079ac460455414f362cd 100755 (executable)
@@ -38,7 +38,7 @@ fi
 return 0
 }
 
-print_env()
+print_env_bin()
 {
 
 if test `uname -m` = "x86_64" ; then
@@ -58,75 +58,68 @@ cat > ${PRODUCT_DIR}/.omniORB.cfg <<EOF
 InitRef = NameService=corbaname::`hostname`:2810
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-omnidir="`find_in_path omniidl ${PATH}:/usr/bin`"
-if [ -n "${omnidir}" ] ; then
-  omnidir=`cd ${omnidir}/..; pwd`
-  OMNIORBDIR=${omnidir}
-  python_version="`python -c 'import sys; print sys.version[:3]'`"
-  check_lib_version libomniORB4.so.0.6 ${OMNIORBDIR}/lib
-  if [ "$?" -ne "0" ]; then return 1 ; fi
-  check_lib_version _omnipymodule.so.2.6 ${OMNIORBDIR}/lib/python${python_version}/site-packages
-  if [ "$?" -ne "0" ]; then return 1 ; fi
-  tmp="${omnidir}/bin ${omnidir}/bin \${PATH} ${PATH}";  
-  path=`sort_path ${tmp}`
-  tmp="${omnidir}/lib ${omnidir}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-  ld_library_path=`sort_path ${tmp}`
-  tmp="${omnidir}/lib:${omnidir}/lib/python\${PYTHON_VERSION}:${omnidir}/lib/python\${PYTHON_VERSION}/site-packages ${omnidir}/lib:${omnidir}/lib/python${python_version}/site-packages \${PYTHONPATH} ${PYTHONPATH}";  
-  pythonpath=`sort_path ${tmp}`
-  cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export OMNIORB_CONFIG=\${HOME}/.omniORB.cfg
-export PYTHONPATH=${pythonpath}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-  make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-  return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-
-makedir ${PRODUCT_DIR}
-
-check_jb tar xfz ${SOURCE_DIR}/omniORB-4.0.7.tar.gz -C ${INSTALL_WORK}
-check_jb tar xfz ${SOURCE_DIR}/omniORBpy-2.7.tar.gz -C ${INSTALL_WORK}
-check_jb tar xfz ${SOURCE_DIR}/omniNotify-2.1.tar.gz -C ${INSTALL_WORK}
+makedir ${PRODUCT_DIR}_SRC
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/omniORBpy-2.7.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/omniNotify-2.1.tar.gz -C ${PRODUCT_DIR}_SRC
 
 # apply patches for 64-bit platforms
 if test `uname -m` = "x86_64" ; then
     if [ -f patches/omniORB-4.0.7-lib64.patch ] ; then
-       cp patches/omniORB-4.0.7-lib64.patch ${INSTALL_WORK}/omniORB-4.0.7
-       ( cd ${INSTALL_WORK}/omniORB-4.0.7 ; patch -p1 < omniORB-4.0.7-lib64.patch )
+       cp patches/omniORB-4.0.7-lib64.patch ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC
+       ( cd ${PRODUCT_DIR}_SRC/${PRODUCT}_SRC ; patch -p1 < omniORB-4.0.7-lib64.patch )
     fi
     if [ -f patches/omniORBpy-2.7-lib64.patch ] ; then
-       cp patches/omniORBpy-2.7-lib64.patch ${INSTALL_WORK}/omniORBpy-2.7
-       ( cd ${INSTALL_WORK}/omniORBpy-2.7 ; patch -p1 < omniORBpy-2.7-lib64.patch )
+       cp patches/omniORBpy-2.7-lib64.patch ${PRODUCT_DIR}_SRC/omniORBpy-2.7_SRC
+       ( cd ${PRODUCT_DIR}_SRC/omniORBpy-2.7_SRC ; patch -p1 < omniORBpy-2.7-lib64.patch )
     fi
     if [ -f patches/omniNotify-2.1-lib64.patch ] ; then
-       cp patches/omniNotify-2.1-lib64.patch ${INSTALL_WORK}/omniNotify
-       ( cd ${INSTALL_WORK}/omniNotify ; patch -p1 < omniNotify-2.1-lib64.patch )
+       cp patches/omniNotify-2.1-lib64.patch ${PRODUCT_DIR}_SRC/omniNotify-2.1_SRC
+       ( cd ${PRODUCT_DIR}_SRC/omniNotify-2.1_SRC ; patch -p1 < omniNotify-2.1-lib64.patch )
     fi
 fi
 
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
 # install omniORB
-cd ${INSTALL_WORK}/omniORB-4.0.7
+cd ${PRODUCT_DIR}_SRC/omniORB-4.0.7_SRC
 mkdir build
 cd build
 
@@ -145,7 +138,7 @@ cd ${PRODUCT_DIR}/lib; ln -s ../lib64/python2.4 .
 fi
 
 # install omniORBpy
-cd ${INSTALL_WORK}/omniORBpy-2.7
+cd ${PRODUCT_DIR}_SRC/omniORBpy-2.7_SRC
 mkdir build
 cd build
 
@@ -160,7 +153,7 @@ check_job ${PRODUCT_DIR}/MAKE_OMNIORBPY.LOG make
 check_job ${PRODUCT_DIR}/INSTALL_OMNIORBPY.LOG make install
 
 # install omniNotify
-cd ${INSTALL_WORK}/omniNotify
+cd ${PRODUCT_DIR}_SRC/omniNotify-2.1_SRC
 
 mkdir build
 cd build
@@ -183,20 +176,24 @@ sed -e "s%#\!.*python%#\!/usr/bin/env python%" omniidlrun.py > _omniidlrun.py
 mv -f _omniidlrun.py omniidlrun.py
 chmod a+x omniidlrun.py
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
 cd ${PRODUCT_DIR}
-rm -fr ${INSTALL_WORK}/omniORB-4.0.7
-rm -fr ${INSTALL_WORK}/omniORBpy-2.7
-rm -fr ${INSTALL_WORK}/omniNotify
-print_env
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/omniORB-4.0.7.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 ln -sf ${PRODUCT_DIR} ${INSTALL_ROOT}/omni
 
@@ -208,7 +205,8 @@ sed -e "s%#\!.*python%#\!/usr/bin/env python%" omniidlrun.py > _omniidlrun.py
 mv -f _omniidlrun.py omniidlrun.py
 chmod a+x omniidlrun.py
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -216,7 +214,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="omni" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="omniORB-4.0.7"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 5744bf1549c367f623f0b072ff22f8e4daf03309..2e2299c5f07400a48eb0cad5768ac1b1a3383370 100755 (executable)
 ####################################################################################
 
 check_version(){
-if [ -z "$QTDIR" ]; then
+if [ -z "$QTDIR" ] || [ ! -f ${QTDIR}/include/qglobal.h ]; then
    return 1
 fi
+
 ver=`grep "QT_VERSION_STR" ${QTDIR}/include/qglobal.h | sed -e 's%^#define QT_VERSION_STR\([[:space:]]*\)%%g' -e 's%\"%%g'`
 if [ "$ver" == "3.3.3" ] ; then
     return 0
@@ -23,7 +24,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -33,75 +34,61 @@ export LD_LIBRARY_PATH=\${QTDIR}/lib:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-qtdir=""
-if [ -d /usr/share/qt3/lib ] ; then
-    qtdir="`find_in_path libqt-mt.so.3.3.3 /usr/share/qt3/lib`"
-fi
-if [ -z "${qtdir}" ] && [ -d /usr/lib/qt3/lib ] ; then
-    qtdir="`find_in_path libqt-mt.so.3.3.3 /usr/lib/qt3/lib`"
-fi
-if [ -z "${qtdir}" ] ; then
-    qtdir="`find_in_path libqt-mt.so.3.3.3 /usr/lib`"
-fi
-if [ -z "${qtdir}" ] ; then
-    qtdir="`find_in_path libqt-mt.so.3.3.3 ${LD_LIBRARY_PATH}`"
-fi
-if [ -n "${qtdir}" ] ; then
-    qtdir=`cd ${qtdir}/..; pwd`
-    moc="`find_in_path moc ${qtdir}/bin`"
-    uic="`find_in_path uic ${qtdir}/bin`"
-    if [ -n "${moc}" ] && [ -n "${uic}" ] ; then
-       tmp="\${QTDIR}/bin ${qtdir}/bin \${PATH} ${PATH}";  
-       path=`sort_path ${tmp}`
-       tmp="\${QTDIR}/lib ${qtdir}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-       ld_library_path=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export QTDIR=${qtdir}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF 
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       return 0
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
 
-check_jb tar xfz ${SOURCE_DIR}/qt-3.3.3.tar.gz -C ${INSTALL_WORK}
+# build sources
+makedir ${PRODUCT_DIR}
 
 # apply patch : fix pb of libGL loading
 if [ -f patches/qt-3.3.3-load-gl.patch ] ; then
-    cp patches/qt-3.3.3-load-gl.patch ${PRODUCT_WORK}
-    ( cd ${PRODUCT_WORK} ; patch -p1 < qt-3.3.3-load-gl.patch )
+    cp patches/qt-3.3.3-load-gl.patch ${PRODUCT_DIR}_SRC
+    ( cd ${PRODUCT_DIR}_SRC ; patch -p1 < qt-3.3.3-load-gl.patch )
     patched_for_gl="yes"
 fi
 
-cd ${PRODUCT_WORK}
+cd ${PRODUCT_DIR}_SRC
 
 mv -f configure configure-orig
 sed -e "s%read acceptance%acceptance=yes%" configure-orig > configure
 chmod +x configure
 
-export QTDIR=${PRODUCT_WORK}
+export QTDIR=${PRODUCT_DIR}_SRC
 export LD_LIBRARY_PATH=${QTDIR}/lib:$LD_LIBRARY_PATH
 
 # basic flags
@@ -140,7 +127,7 @@ for b in `find bin -mindepth 1 -maxdepth 1 -name "*"`; do
        if [ -h ${PRODUCT_DIR}/bin/$b ]; then
            rm -f ${PRODUCT_DIR}/bin/$b
        fi
-       cp -f ${PRODUCT_WORK}/bin/$b ${PRODUCT_DIR}/bin/$b
+       cp -f ${PRODUCT_DIR}_SRC/bin/$b ${PRODUCT_DIR}/bin/$b
     fi
 done
 
@@ -156,17 +143,24 @@ fi
 
 #rm -rf ${PRODUCT_DIR}/doc
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/qt-3.3.3.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 cd ${PRODUCT_DIR}/lib
 
@@ -189,7 +183,8 @@ cd ${PRODUCT_DIR}/lib/pkgconfig
 sed -e "s%^prefix=\(.*\)%prefix=${PRODUCT_DIR}%g" qt-mt.pc > qt-mt.pc.new
 mv -f qt-mt.pc.new qt-mt.pc
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -197,7 +192,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="qt" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="qt-3.3.3"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index ee0b25edf820df2d5c790d75f1b121477572fc0a..5195d0d04b6e0ad3cf22a6ffd3d2cfe53cc9ab24 100755 (executable)
@@ -23,7 +23,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -33,90 +33,69 @@ export LD_LIBRARY_PATH=\${QTDIR}/lib:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-
-qtdir=""
-  if test `uname -m` = "x86_64" ; then
-      export QT_LD_PREFIX='64'
-  else
-      QT_LD_PREFIX=''
-  fi
-
-if [ -d /usr/share/qt3/lib${QT_LD_PREFIX} ] ; then
-    qtdir="`find_in_path libqt-mt.so.3.3 /usr/share/qt3/lib\${QT_LD_PREFIX}`"
-fi
-if [ -z "${qtdir}" ] && [ -d /usr/lib/qt3/lib${QT_LD_PREFIX} ] ; then
-    qtdir="`find_in_path libqt-mt.so.3.3 /usr/lib/qt3/lib${QT_LD_PREFIX}`"
-fi
-if [ -z "${qtdir}" ] ; then
-    qtdir="`find_in_path libqt-mt.so.3.3 /usr/lib${QT_LD_PREFIX}`"
-fi
-if [ -z "${qtdir}" ] ; then
-    qtdir="`find_in_path libqt-mt.so.3.3 ${LD_LIBRARY_PATH}`"
-fi
-if [ -n "${qtdir}" ] ; then
-    qtdir=`cd ${qtdir}/..; pwd`
-    moc="`find_in_path moc ${qtdir}/bin`"
-    uic="`find_in_path uic ${qtdir}/bin`"
-    if [ -n "${moc}" ] && [ -n "${uic}" ] ; then
-       tmp="\${QTDIR}/bin ${qtdir}/bin \${PATH} ${PATH}";  
-       path=`sort_path ${tmp}`
-       tmp="\${QTDIR}/lib${QT_LD_PREFIX} ${qtdir}/lib${QT_LD_PREFIX} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-       ld_library_path=`sort_path ${tmp}`
-       cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export QTDIR=${qtdir}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF 
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-       make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-       return 0
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
 
-check_jb tar xfz ${SOURCE_DIR}/qt-3.3.4.tar.gz -C ${INSTALL_WORK}
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
 
 # apply patch : fix pb of libGL loading
 if [ -f patches/qt-3.3.3-load-gl.patch ] ; then
-    cp patches/qt-3.3.3-load-gl.patch ${PRODUCT_WORK}
-    ( cd ${PRODUCT_WORK} ; patch -p1 < qt-3.3.3-load-gl.patch )
+    cp patches/qt-3.3.3-load-gl.patch ${PRODUCT_DIR}_SRC
+    ( cd ${PRODUCT_DIR}_SRC ; patch -p1 < qt-3.3.3-load-gl.patch )
     patched_for_gl="yes"
 fi
 
 # apply patch for 64-bit platforms
 if test `uname -m` = "x86_64" ; then
     if [ -f patches/qt-3.3.4-lib64.patch ] ; then
-       cp patches/qt-3.3.4-lib64.patch ${PRODUCT_WORK}
-       ( cd ${PRODUCT_WORK} ; patch -p1 < qt-3.3.4-lib64.patch )
+       cp patches/qt-3.3.4-lib64.patch ${PRODUCT_DIR}_SRC
+       ( cd ${PRODUCT_DIR}_SRC ; patch -p1 < qt-3.3.4-lib64.patch )
     fi
 fi
 
-cd ${PRODUCT_WORK}
+cd ${PRODUCT_DIR}_SRC
 
 mv -f configure configure-orig
 sed -e "s%read acceptance%acceptance=yes%" configure-orig > configure
 chmod +x configure
 
-export QTDIR=${PRODUCT_WORK}
+export QTDIR=${PRODUCT_DIR}_SRC
 export LD_LIBRARY_PATH=${QTDIR}/lib:$LD_LIBRARY_PATH
 
 # basic flags
@@ -170,7 +149,7 @@ for b in `find bin -mindepth 1 -maxdepth 1 -name "*"`; do
        if [ -h ${PRODUCT_DIR}/bin/$b ]; then
            rm -f ${PRODUCT_DIR}/bin/$b
        fi
-       cp -f ${PRODUCT_WORK}/bin/$b ${PRODUCT_DIR}/bin/$b
+       cp -f ${PRODUCT_DIR}_SRC/bin/$b ${PRODUCT_DIR}/bin/$b
     fi
 done
 
@@ -186,17 +165,24 @@ fi
 
 #rm -rf ${PRODUCT_DIR}/doc
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/qt-3.3.4.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # modify libdir
 cd ${PRODUCT_DIR}/lib
@@ -218,7 +204,8 @@ cd ${PRODUCT_DIR}/lib/pkgconfig
 sed -e "s%^prefix=\(.*\)%prefix=${PRODUCT_DIR}%g" qt-mt.pc > qt-mt.pc.new
 mv -f qt-mt.pc.new qt-mt.pc
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -226,7 +213,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="qt" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="qt-3.3.4"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index c7c9aa7b366e62689e60569f3f25f35231e9dcd1..ed8e8b4efb19f0d0cba55a5d25abc793cc2f0e79 100755 (executable)
@@ -23,7 +23,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -32,41 +32,46 @@ export LD_LIBRARY_PATH=\${QWTHOME}/lib:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-qwthome="`find_in_path libqwt.so.0.4.1 ${LD_LIBRARY_PATH}`"
-if [ -z "${qwthome}" ] ; then
-    qwthome="`find_in_path libqwt.so.0.4.1 /usr/lib`"
-fi
-if [ -n "${qwthome}" ] ; then
-    tmp="${qwthome} ${qwthome} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-    ld_library_path=`sort_path ${tmp}`
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/qwt-0.4.1.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+cd ${PRODUCT_DIR}_SRC
 makedir ${PRODUCT_DIR}
 
 qmake qwt.pro -o Makefile
@@ -79,20 +84,27 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make 
 cp -rf include lib ${PRODUCT_DIR}
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -rf ${PRODUCT_WORK}
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/qwt-0.4.1.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -100,7 +112,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="qwt" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="qwt-0.4.1"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 30f690e9bfc03e0becfd83e17673f7a493a4e63c..0bbe5c82c90580ee76fdb161e6ecdb006c4b993b 100755 (executable)
@@ -29,7 +29,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -38,49 +38,46 @@ export LD_LIBRARY_PATH=\${QWTHOME}/lib:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-if test `uname -m` = "x86_64" ; then
-qwthome="`find_in_path libqwt.so ${LD_LIBRARY_PATH}:/usr/lib64:/usr/local/lib64`"
-else
-qwthome="`find_in_path libqwt.so ${LD_LIBRARY_PATH}:/usr/lib:/usr/local/lib`"
-fi
-if [ -n "${qwthome}" ] ; then
-    qwtroot=`cd ${qwthome}/..; pwd`
-    qwtinc="`find_in_path qwt_global.h ${qwtroot}/include:${qwtroot}/include/qwt:${QTDIR}/include/qwt:/usr/lib/qt3/include/qwt:/usr/local/lib/qt3/include/qwt`"
-    if [ -n "${qwtinc}" ] ; then
-       ver=`grep -e "^#define[[:space:]]\+QWT_VERSION_STR" ${qwtinc}/qwt_global.h | sed -e 's/^#define[[:space:]]\+QWT_VERSION_STR[[:space:]]*"\(.*\)"/\1/'`
-       if [ "$ver" == "4.2.0" ]; then
-           tmp="${qwthome} ${qwthome} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-           ld_library_path=`sort_path ${tmp}`
-           cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-           make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-           return 0
-       fi
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfj ${SOURCE_DIR}/qwt-4.2.0.tar.bz2 -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+cd ${PRODUCT_DIR}_SRC
 makedir ${PRODUCT_DIR}
 
 qmake qwt.pro -o Makefile
@@ -93,20 +90,27 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make 
 cp -rf include lib ${PRODUCT_DIR}
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -rf ${PRODUCT_WORK}
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/qwt-4.2.0.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-print_env
+# to generate environment script for sources
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -114,7 +118,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="qwt" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="qwt-4.2.0"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index b06cbc9d71d960cecbb1a5627b0404626d062d5f..6f43df18c5d2ca18a2a4ee95680287228f96ca91 100755 (executable)
@@ -27,7 +27,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -38,59 +38,47 @@ export LD_LIBRARY_PATH=\${SIPDIR}:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-# we need version 4.1 or newer
-try_native(){
-sipdir="`find_in_path sip ${PATH}:/usr/bin`"
-if [ -n "${sipdir}" ] ; then
-    python_version="`python -c 'import sys; print sys.version[:3]'`"
-    sippython="`find_in_path sip.so ${PYTHONPATH}:/usr/lib/python${python_version}/site-packages`"
-    if [ -n "${sippython}" ]; then
-       ver=`${sipdir}/sip -V | awk '{print $1}'`
-       maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-       min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-       rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-       let ver=$maj_ver*10000+$min_ver*100+$rel_ver
-       # minimal required version is 4.1
-       if [ $ver -ge 40100 ] ; then
-           tmp="${sipdir} ${sipdir} \${PATH} ${PATH}";
-           path=`sort_path ${tmp}`
-           tmp="${sippython} ${sippython} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
-           ld_library_path=`sort_path ${tmp}`
-           tmp="${sippython} ${sippython} \${PYTHONPATH} ${PYTHONPATH}";
-           pythonpath=`sort_path ${tmp}`
-           cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PATH=${path}
-export PYTHONPATH=${pythonpath}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-           make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-           return 0
-       fi
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
-check_jb tar xfz ${SOURCE_DIR}/sip-4.1.tar.gz -C ${INSTALL_WORK}
-cd ${PRODUCT_WORK}
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC
 
 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
     python configure.py -b ${PRODUCT_DIR} -d ${PRODUCT_DIR} -e ${PRODUCT_DIR} -v ${PRODUCT_DIR} -l qt-mt 
@@ -101,17 +89,24 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make
 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/sip-4.1.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # modify sipconfig.py file
 if [ -n "${PYTHONHOME}" ] && [ -n "${QTDIR}" ] ; then
@@ -137,7 +132,8 @@ if [ -n "${PYTHONHOME}" ] && [ -n "${QTDIR}" ] ; then
     rm sipconfig.py.1
 fi
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -145,7 +141,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="sip" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="sip-4.1"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 0a4dc7611914b84f852a39a358ef434735077b90..8b6be70d1d98513d4e9ead1aba1af3105db0e714 100755 (executable)
@@ -27,7 +27,7 @@ fi
 return 1
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -38,72 +38,55 @@ export LD_LIBRARY_PATH=\${SIPDIR}:\${LD_LIBRARY_PATH}
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-# we need version 4.1 or newer
-try_native(){
-sipdir="`find_in_path sip ${PATH}:/usr/bin`"
-if [ -n "${sipdir}" ] ; then
-    python_version="`python -c 'import sys; print sys.version[:3]'`"
-if test `uname -m` = "x86_64" ; then
-    sippython="`find_in_path sip.so ${PYTHONPATH}:/usr/lib64/python${python_version}/site-packages`"
-else
-    sippython="`find_in_path sip.so ${PYTHONPATH}:/usr/lib/python${python_version}/site-packages`"
-fi
-    if [ -n "${sippython}" ]; then
-       ver=`${sipdir}/sip -V | awk '{print $1}'`
-       maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-       min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-       rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
-       let ver=$maj_ver*10000+$min_ver*100+$rel_ver
-       # minimal required version is 4.1
-       if [ $ver -ge 40100 ] ; then
-           tmp="${sipdir} ${sipdir} \${PATH} ${PATH}";
-           path=`sort_path ${tmp}`
-           tmp="${sippython} ${sippython} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
-           ld_library_path=`sort_path ${tmp}`
-           tmp="${sippython} ${sippython} \${PYTHONPATH} ${PYTHONPATH}";
-           pythonpath=`sort_path ${tmp}`
-           cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export PATH=${path}
-export PYTHONPATH=${pythonpath}
-export LD_LIBRARY_PATH=${ld_library_path}
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-           make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-           return 0
-       fi
-    fi
-fi
-return 1
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
-makedir ${PRODUCT_DIR}
-
-check_jb tar xfz ${SOURCE_DIR}/sip-4.2.1.tar.gz -C ${INSTALL_WORK}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # apply patch for 64-bit platforms
 if test `uname -m` = "x86_64" ; then
     if [ -f patches/sip-4.2.1-lib64.patch ] ; then
-       cp patches/sip-4.2.1-lib64.patch ${PRODUCT_WORK}
-       ( cd ${PRODUCT_WORK} ; patch -p1 < sip-4.2.1-lib64.patch )
+       cp patches/sip-4.2.1-lib64.patch ${PRODUCT_DIR}_SRC
+       ( cd ${PRODUCT_DIR}_SRC ; patch -p1 < sip-4.2.1-lib64.patch )
     fi
 fi
 
-cd ${PRODUCT_WORK}
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
+makedir ${PRODUCT_DIR}
+cd ${PRODUCT_DIR}_SRC
 
 if test `uname -m` = "x86_64" ; then
     SIP_CONFIGURE_OPTIONS="-b ${PRODUCT_DIR} -d ${PRODUCT_DIR} -e ${PRODUCT_DIR} -v ${PRODUCT_DIR} -l qt-mt -p linux-g++-64"
@@ -120,17 +103,24 @@ EOF
 check_job ${PRODUCT_DIR}/MAKE.LOG make
 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
 
-#du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/sip-4.2.1.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # modify sipconfig.py file
 if [ -n "${PYTHONHOME}" ] && [ -n "${QTDIR}" ] ; then
@@ -156,7 +146,8 @@ if [ -n "${PYTHONHOME}" ] && [ -n "${QTDIR}" ] ; then
     rm sipconfig.py.1
 fi
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -164,7 +155,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="sip" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="sip-4.2.1"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 6b33f2653f0b54a1463286beed4cc4619ad5bd37..9e7ff1c48e7b343939d75190126a5b439b234ee4 100755 (executable)
@@ -52,7 +52,7 @@ fi
 return 0
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -63,50 +63,52 @@ export TCLLIBPATH="\${TCLHOME}/lib \${TCLHOME}/lib/tcl${VERSION} \${TCLHOME}/lib
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-tclhome="`find_in_path tclsh ${PATH}`"
-if [ -z "${tclhome}" ] ; then
-    tclhome="`find_in_path tclsh /usr/bin`"
-fi
-if [ -n "${tclhome}" ] ; then
-    tclhome=`cd ${tclhome}/..; pwd`
-    tmp="\${TCLHOME}/bin ${tclhome}/bin \${PATH} ${PATH}";  
-    path=`sort_path ${tmp}`
-    tmp="\${TCLHOME}/lib ${tclhome}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-    ld_library_path=`sort_path ${tmp}`
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export TCLHOME=${tclhome}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-export TCLLIBPATH="\${TCLHOME}/lib \${TCLHOME}/lib/tcl${VERSION} \${TCLHOME}/lib/tk${VERSION} \${TCLLIBPATH}"
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF 
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
+mkdir -p ${PRODUCT_DIR}_SRC
+
+check_jb tar xfz ${SOURCE_DIR}/tcl8.3.3.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/tk8.3.3.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/tclx8.3.tar.gz -C ${PRODUCT_DIR}_SRC
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
 makedir ${PRODUCT_DIR}
 
-check_jb tar xfz ${SOURCE_DIR}/tcl8.3.3.tar.gz -C ${INSTALL_WORK}
-cd ${INSTALL_WORK}/tcl8.3.3/unix
+cd ${PRODUCT_DIR}_SRC/tcl-8.3.3_SRC/unix
 cat >> ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
 -------------------
 Configuring tcl...
@@ -133,8 +135,7 @@ check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 (cd ${PRODUCT_DIR}/lib; ln -s libtcl8.3.so libtcl.so)
 (cd ${PRODUCT_DIR}/lib; ln -s libtclstub8.3.a libtclstub.a)
 
-check_jb tar xfz ${SOURCE_DIR}/tk8.3.3.tar.gz -C ${INSTALL_WORK}
-cd ${INSTALL_WORK}/tk8.3.3/unix
+cd ${PRODUCT_DIR}_SRC/tk-8.3.3_SRC/unix
 cat >> ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
 -------------------
 Configuring tk...
@@ -159,8 +160,7 @@ check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 (cd ${PRODUCT_DIR}/lib; ln -s libtk8.3.so libtk.so)
 (cd ${PRODUCT_DIR}/lib; ln -s libtkstub8.3.a libtkstub.a)
 
-check_jb tar xfz ${SOURCE_DIR}/tclx8.3.tar.gz -C ${INSTALL_WORK}
-cd ${INSTALL_WORK}/tclx8.3/unix
+cd ${PRODUCT_DIR}_SRC/tclx-8.3_SRC/unix
 #VRV - bug in a tclx configure 
 chmod +w ./configure
 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 
@@ -192,20 +192,24 @@ check_job ${PRODUCT_DIR}/MAKEINSTALLEXEC.LOG make install-exec
 (cd ${PRODUCT_DIR}/lib; ln -s libtkx8.3.so  libtkx.so)
 (cd ${PRODUCT_DIR}/lib; ln -s libtkx8.3.a   libtkx.a)
 
-#du -sk ${INSTALL_WORK}/tcl8.3.3 > ${PRODUCT_DIR}/size.log
-#du -sk ${INSTALL_WORK}/tk8.3.3 >> ${PRODUCT_DIR}/size.log
-#du -sk ${INSTALL_WORK}/tclx8.3 >> ${PRODUCT_DIR}/size.log
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
 cd ${PRODUCT_DIR}
-rm -fr ${INSTALL_WORK}/tcl8.3.3 ${INSTALL_WORK}/tk8.3.3 ${INSTALL_WORK}/tclx8.3
-print_env
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/tcltk-8.3.3.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # overriding installation path
 cd ${PRODUCT_DIR}/lib
@@ -215,7 +219,8 @@ mv -f _tclConfig.sh tclConfig.sh
 sed -e "s%${old_prefix}%${PRODUCT_DIR}%g" tkConfig.sh > _tkConfig.sh
 mv -f _tkConfig.sh tkConfig.sh
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -223,7 +228,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="tcl" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="tcltk-8.3.3"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
index 7b8397864448498c48809d9eecac87d21eb32840..2f7ee9a6c3c88f095ab650ecbae3589a5b3c4ffb 100755 (executable)
@@ -52,7 +52,7 @@ fi
 return 0
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -63,53 +63,56 @@ export TCLLIBPATH="\${TCLHOME}/lib \${TCLHOME}/lib/tcl${VERSION} \${TCLHOME}/lib
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-tclhome="`find_in_path tclsh ${PATH}`"
-if [ -z "${tclhome}" ] ; then
-    tclhome="`find_in_path tclsh /usr/bin`"
-fi
-if [ -n "${tclhome}" ] ; then
-    tclhome=`cd ${tclhome}/..; pwd`
-    tmp="\${TCLHOME}/bin ${tclhome}/bin \${PATH} ${PATH}";  
-    path=`sort_path ${tmp}`
-    tmp="\${TCLHOME}/lib ${tclhome}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-    ld_library_path=`sort_path ${tmp}`
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export TCLHOME=${tclhome}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-export TCLLIBPATH="\${TCLHOME}/lib \${TCLHOME}/lib/tcl${VERSION} \${TCLHOME}/lib/tk${VERSION} \${TCLLIBPATH}"
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF 
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
+mkdir -p ${PRODUCT_DIR}_SRC
+
+# unpack
+check_jb tar xfz ${SOURCE_DIR}/tcl-8.4.5.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/tk-8.4.5.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/tclx-8.3.5.tar.gz -C ${PRODUCT_DIR}_SRC
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
 if test `uname -m` = "x86_64" ; then
 export CFLAGS=-m64
 fi
 
 makedir ${PRODUCT_DIR}
-check_jb tar xfz ${SOURCE_DIR}/tcl8.4.5.tar.gz -C ${INSTALL_WORK}
-cd ${INSTALL_WORK}/tcl8.4.5/unix
+cd ${PRODUCT_DIR}_SRC/tcl-8.4.5_SRC/unix
 cat >> ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
 -------------------
 Configuring tcl...
@@ -136,8 +139,7 @@ check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 (cd ${PRODUCT_DIR}/lib; ln -fs libtcl8.4.so libtcl.so)
 (cd ${PRODUCT_DIR}/lib; ln -fs libtclstub8.4.a libtclstub.a)
 
-check_jb tar xfz ${SOURCE_DIR}/tk8.4.5.tar.gz -C ${INSTALL_WORK}
-cd ${INSTALL_WORK}/tk8.4.5/unix
+cd ${PRODUCT_DIR}_SRC/tk-8.4.5_SRC/unix
 cat >> ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
 -------------------
 Configuring tk...
@@ -162,20 +164,18 @@ check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 (cd ${PRODUCT_DIR}/lib; ln -fs libtk8.4.so libtk.so)
 (cd ${PRODUCT_DIR}/lib; ln -fs libtkstub8.4.a libtkstub.a)
 
-check_jb tar xfz ${SOURCE_DIR}/tclx8.3.5.tar.gz -C ${INSTALL_WORK}
-
 #vsr: patch tclx 8.3.5 to make it compiliable on Mandriva 2006.0
-cd ${INSTALL_WORK}/tclx8.3.5/unix
+cd ${PRODUCT_DIR}_SRC/tclx-8.3.5_SRC/unix
 mv Common.mk.in Common.mk.in.orig
 sed -e 's/@DEFS@/-DSTDC_HEADERS=1 -DNDEBUG=1 -DRETSIGTYPE=void/g' Common.mk.in.orig > Common.mk.in
-cd ${INSTALL_WORK}/tclx8.3.5/tcl/unix
+cd ${PRODUCT_DIR}_SRC/tclx-8.3.5_SRC/tcl/unix
 mv tclxConfig.sh.in tclxConfig.sh.in.orig
 sed -e 's/@DEFS@/ -DSTDC_HEADERS=1 -DNDEBUG=1 -DRETSIGTYPE=void /g' tclxConfig.sh.in.orig > tclxConfig.sh.in
-cd ${INSTALL_WORK}/tclx8.3.5/tk/unix
+cd ${PRODUCT_DIR}_SRC/tclx-8.3.5_SRC/tk/unix
 mv tkxConfig.sh.in tkxConfig.sh.in.orig
 sed -e 's/@DEFS@/ -DSTDC_HEADERS=1 -DNDEBUG=1 -DRETSIGTYPE=void /g' tkxConfig.sh.in.orig > tkxConfig.sh.in
 
-cd ${INSTALL_WORK}/tclx8.3.5/unix
+cd ${PRODUCT_DIR}_SRC/tclx-8.3.5_SRC/unix
 #VRV - bug in a tclx configure 
 chmod +w ./configure
 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 
@@ -207,20 +207,25 @@ check_job ${PRODUCT_DIR}/MAKEINSTALLEXEC.LOG make install-exec
 (cd ${PRODUCT_DIR}/lib; ln -fs libtkx8.3.so  libtkx.so)
 (cd ${PRODUCT_DIR}/lib; ln -fs libtkx8.3.a   libtkx.a)
 
-#du -sk ${INSTALL_WORK}/tcl8.4.5 > ${PRODUCT_DIR}/size.log
-#du -sk ${INSTALL_WORK}/tk8.4.5 >> ${PRODUCT_DIR}/size.log
-#du -sk ${INSTALL_WORK}/tclx8.3.5 >> ${PRODUCT_DIR}/size.log
-cd ${PRODUCT_DIR}
-rm -fr ${INSTALL_WORK}/tcl8.4.5 ${INSTALL_WORK}/tk8.4.5 ${INSTALL_WORK}/tclx8.3.5
-print_env
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
+cd ${PRODUCT_DIR};
+
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/tcltk-8.4.5.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # overriding installation path
 cd ${PRODUCT_DIR}/lib
@@ -230,7 +235,8 @@ mv -f _tclConfig.sh tclConfig.sh
 sed -e "s%${old_prefix}%${PRODUCT_DIR}%g" tkConfig.sh > _tkConfig.sh
 mv -f _tkConfig.sh tkConfig.sh
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -238,8 +244,11 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="tcl" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
 export PRODUCT="tcltk-8.4.5"
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
 source ./common.sh
index 992b9ecb4128ad4e8e3c32eeb68b96975d5502b7..40f042ef6be8a52ac1ee5a8cdb0e4ab699a7d8d1 100755 (executable)
@@ -52,7 +52,7 @@ fi
 return 0
 }
 
-print_env()
+print_env_bin()
 {
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
@@ -63,50 +63,52 @@ export TCLLIBPATH="\${TCLHOME}/lib \${TCLHOME}/lib/tcl${VERSION} \${TCLHOME}/lib
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
-# looks for the native product and collects it's environment (used by make_env())
-try_native(){
-tclhome="`find_in_path tclsh ${PATH}`"
-if [ -z "${tclhome}" ] ; then
-    tclhome="`find_in_path tclsh /usr/bin`"
-fi
-if [ -n "${tclhome}" ] ; then
-    tclhome=`cd ${tclhome}/..; pwd`
-    tmp="\${TCLHOME}/bin ${tclhome}/bin \${PATH} ${PATH}";  
-    path=`sort_path ${tmp}`
-    tmp="\${TCLHOME}/lib ${tclhome}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
-    ld_library_path=`sort_path ${tmp}`
-    cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export TCLHOME=${tclhome}
-export PATH=${path}
-export LD_LIBRARY_PATH=${ld_library_path}
-export TCLLIBPATH="\${TCLHOME}/lib \${TCLHOME}/lib/tcl${VERSION} \${TCLHOME}/lib/tk${VERSION} \${TCLLIBPATH}"
+print_env_src()
+{
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF 
+#$DELIM ${PRODUCT_TYPE}_src $DELIM
+# nothing to do
 ##
 EOF
-    (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
-    make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
-    return 0
-fi
-return 1;
+(test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
 }
 
 try_preinstalled(){
-try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
+try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 return $?
 }
 
 install_source()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
 source ${INSTALL_WORK}/$SHRC
 
+mkdir -p ${PRODUCT_DIR}_SRC
+
+check_jb tar xfz ${SOURCE_DIR}/tcl-8.4.7.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/tk-8.4.7.tar.gz -C ${PRODUCT_DIR}_SRC
+check_jb tar xfz ${SOURCE_DIR}/tclx-8.3.5.tar.gz -C ${PRODUCT_DIR}_SRC
+
+if [ $PROCEDURE == "install_source" ]; then
+# to generate environment scripts
+    try_preinstalled
+fi
+}
+
+install_source_and_build()
+{
+# install sources
+install_source
+
+# build sources
 makedir ${PRODUCT_DIR}
 
-check_jb tar xfz ${SOURCE_DIR}/tcl8.4.7.tar.gz -C ${INSTALL_WORK}
-cd ${INSTALL_WORK}/tcl8.4.7/unix
+cd ${PRODUCT_DIR}_SRC/tcl-8.4.7_SRC/unix
 cat >> ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
 -------------------
 Configuring tcl...
@@ -133,8 +135,7 @@ check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 (cd ${PRODUCT_DIR}/lib; ln -fs libtcl8.4.so libtcl.so)
 (cd ${PRODUCT_DIR}/lib; ln -fs libtclstub8.4.a libtclstub.a)
 
-check_jb tar xfz ${SOURCE_DIR}/tk8.4.7.tar.gz -C ${INSTALL_WORK}
-cd ${INSTALL_WORK}/tk8.4.7/unix
+cd ${PRODUCT_DIR}_SRC/tk-8.4.7_SRC/unix
 cat >> ${PRODUCT_DIR}/CONFIGURE.LOG <<EOF
 -------------------
 Configuring tk...
@@ -159,20 +160,18 @@ check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
 (cd ${PRODUCT_DIR}/lib; ln -fs libtk8.4.so libtk.so)
 (cd ${PRODUCT_DIR}/lib; ln -fs libtkstub8.4.a libtkstub.a)
 
-check_jb tar xfz ${SOURCE_DIR}/tclx8.3.5.tar.gz -C ${INSTALL_WORK}
-
 #vsr: patch tclx 8.3.5 to make it compiliable on Mandriva 2006.0
-cd ${INSTALL_WORK}/tclx8.3.5/unix
+cd ${PRODUCT_DIR}_SRC/tclx-8.3.5_SRC/unix
 mv Common.mk.in Common.mk.in.orig
 sed -e 's/@DEFS@/-DSTDC_HEADERS=1 -DNDEBUG=1 -DRETSIGTYPE=void/g' Common.mk.in.orig > Common.mk.in
-cd ${INSTALL_WORK}/tclx8.3.5/tcl/unix
+cd ${PRODUCT_DIR}_SRC/tclx-8.3.5_SRC/tcl/unix
 mv tclxConfig.sh.in tclxConfig.sh.in.orig
 sed -e 's/@DEFS@/ -DSTDC_HEADERS=1 -DNDEBUG=1 -DRETSIGTYPE=void /g' tclxConfig.sh.in.orig > tclxConfig.sh.in
-cd ${INSTALL_WORK}/tclx8.3.5/tk/unix
+cd ${PRODUCT_DIR}_SRC/tclx-8.3.5_SRC/tk/unix
 mv tkxConfig.sh.in tkxConfig.sh.in.orig
 sed -e 's/@DEFS@/ -DSTDC_HEADERS=1 -DNDEBUG=1 -DRETSIGTYPE=void /g' tkxConfig.sh.in.orig > tkxConfig.sh.in
 
-cd ${INSTALL_WORK}/tclx8.3.5/unix
+cd ${PRODUCT_DIR}_SRC/tclx-8.3.5_SRC/unix
 #VRV - bug in a tclx configure 
 chmod +w ./configure
 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 
@@ -204,20 +203,24 @@ check_job ${PRODUCT_DIR}/MAKEINSTALLEXEC.LOG make install-exec
 (cd ${PRODUCT_DIR}/lib; ln -fs libtkx8.3.so  libtkx.so)
 (cd ${PRODUCT_DIR}/lib; ln -fs libtkx8.3.a   libtkx.a)
 
-#du -sk ${INSTALL_WORK}/tcl8.4.7 > ${PRODUCT_DIR}/size.log
-#du -sk ${INSTALL_WORK}/tk8.4.7 >> ${PRODUCT_DIR}/size.log
-#du -sk ${INSTALL_WORK}/tclx8.3.5 >> ${PRODUCT_DIR}/size.log
+#du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
 cd ${PRODUCT_DIR}
-rm -fr ${INSTALL_WORK}/tcl8.4.7 ${INSTALL_WORK}/tk8.4.7 ${INSTALL_WORK}/tclx8.3.5
-print_env
+
+# remove sources and temporary files after building
+if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+    test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
+fi
+
+# to generate environment scripts
+try_preinstalled
 }
 
 install_binary()
 {
-make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
 source ${INSTALL_WORK}/$SHRC
 
-check_jb tar xfz ${SOURCE_DIR}/tcltk-8.4.7.tar.gz -C ${INSTALL_ROOT}
+check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
 
 # overriding installation path
 cd ${PRODUCT_DIR}/lib
@@ -227,7 +230,8 @@ mv -f _tclConfig.sh tclConfig.sh
 sed -e "s%${old_prefix}%${PRODUCT_DIR}%g" tkConfig.sh > _tkConfig.sh
 mv -f _tkConfig.sh tkConfig.sh
 
-print_env
+# to generate environment scripts
+try_preinstalled
 }
 
 export PROCEDURE=$1;
@@ -235,7 +239,10 @@ export INSTALL_WORK=$2;
 export SOURCE_DIR=$3;
 export INSTALL_ROOT=$4;
 export PRODUCT_SEQUENCE=$5;
-if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="tcl" ; fi
+export PRODUCT_TYPE=$6;
+export INSTALL_PRODUCTS=$7;
+shift
+REMOVE_SRC_TMP=$8;
 export PRODUCT="tcltk-8.4.7"
 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}