]> SALOME platform Git repositories - tools/install.git/blob - config_files/graphviz-2.2.1.sh
Salome HOME
1) remove required size calculations for each product: just read its from XML and...
[tools/install.git] / config_files / graphviz-2.2.1.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : graphviz-2.2.1.sh
5 #  Created   : Thu Dec 18 12:01:00 2002
6 #  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
7 #  Project   : SALOME
8 #  Module    : Installation Wizard
9 #  Copyright : 2002-2007 CEA
10 #
11 #  This script is the part of the SALOME installation procedure.
12 #
13 ####################################################################################
14
15 check_version()
16 {
17 isdot=`which dot 2>/dev/null`
18 if [ -n "$isdot" ]; then
19   ver=`dot -V 2>&1 | awk '{print $3}'`
20   maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
21   min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
22   rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
23   let ver=$maj_ver*10000+$min_ver*100+$rel_ver
24   if [ $ver -eq 20201 ] ; then
25     return 0
26   fi
27 fi
28 return 1
29 }
30
31 print_env_bin()
32 {
33 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
34 #$DELIM ${PRODUCT_TYPE} $DELIM
35 export PATH=\${INSTALL_ROOT}/${PRODUCT}/bin:\${PATH}
36 export LD_LIBRARY_PATH=\${INSTALL_ROOT}/${PRODUCT}/lib/graphviz:\${LD_LIBRARY_PATH}
37 ##
38 EOF
39 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
40 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
41 }
42
43 print_env_src()
44 {
45 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
46 #$DELIM ${PRODUCT_TYPE}_src $DELIM
47 # nothing to do
48 ##
49 EOF
50 (test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
51 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
52 }
53
54 try_preinstalled(){
55 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
56 try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
57 return $?
58 }
59
60 install_source()
61 {
62 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
63 source ${INSTALL_WORK}/$SHRC
64
65 # unpack
66 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
67
68 # to generate environment scripts
69 try_preinstalled
70 }
71
72 install_source_and_build()
73 {
74 # install sources
75 install_source
76
77 # build sources
78 cd ${PRODUCT_DIR}_SRC
79 makedir ${PRODUCT_DIR}
80   if test `uname -m` = "x86_64" ; then
81 check_job ${PRODUCT_DIR}/CONFIGURE.LOG configure --prefix=${PRODUCT_DIR} --with-expatlibdir=/usr/lib64 --with-tcl=${TCLHOME} --disable-rpath CFLAGS=-m64 CXXFLAGS=-m64
82   else
83 check_job ${PRODUCT_DIR}/CONFIGURE.LOG configure --prefix=${PRODUCT_DIR} --with-tcl=${TCLHOME} --disable-rpath 
84   fi
85 GCC=`which gcc`
86 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
87 used gcc=$GCC
88 EOF
89 check_job ${PRODUCT_DIR}/MAKE.LOG make
90 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
91
92 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
93 cd ${PRODUCT_DIR};
94
95 # remove sources and temporary files after building
96 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
97     test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
98 fi
99
100 # to generate environment scripts
101 try_preinstalled
102 }
103
104 install_binary()
105 {
106 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
107 source ${INSTALL_WORK}/$SHRC
108
109 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
110 cd ${PRODUCT_DIR}/lib/graphviz
111 for l in `ls *.la`; do
112     libdir=`grep -e "libdir=.*" $l | sed -e "s/libdir=[\'|\"]\(.*\)[\'|\"]/\1/g"`
113     sed -e "s%${libdir}%${PRODUCT_DIR}/lib/graphviz%g" $l > _$l
114     libdir=`dirname $libdir`
115     sed -e "s%${libdir}%${PRODUCT_DIR}/lib/graphviz%g" _$l > $l
116     rm -f _$l
117     chmod a+x $l
118 done
119
120 # to generate environment scripts
121 try_preinstalled
122 }
123
124 export PROCEDURE=$1;
125 export INSTALL_WORK=$2;
126 export SOURCE_DIR=$3;
127 export INSTALL_ROOT=$4;
128 export PRODUCT_SEQUENCE=$5;
129 export PRODUCT_TYPE=$6;
130 export INSTALL_PRODUCTS=$7;
131 shift
132 REMOVE_SRC_TMP=$8;
133 export PRODUCT="graphviz-2.2.1"
134 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
135 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
136 source ./common.sh
137 $PROCEDURE