]> SALOME platform Git repositories - tools/install.git/blob - config_files/graphviz-1.9.sh
Salome HOME
Remove HappyDoc dependencies
[tools/install.git] / config_files / graphviz-1.9.sh
1 #!/bin/sh
2
3 check_version()
4 {
5 isdot=`which dot 2>/dev/null`
6 if [ -n "$isdot" ]; then
7   ver=`dot -V 2>&1 | awk '{print $3}'`
8   if [ "$ver" == "1.9" ]; then
9     return 0
10   fi
11 fi
12 return 1
13 }
14
15 print_env()
16 {
17 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
18 #$DELIM ${PRODUCT_TYPE} $DELIM
19 export PATH=\${INSTALL_ROOT}/${PRODUCT}/bin:\${PATH}
20 export LD_LIBRARY_PATH=\${INSTALL_ROOT}/${PRODUCT}/lib/graphviz:\${LD_LIBRARY_PATH}
21 ##
22 EOF
23 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
24 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
25 }
26
27 # looks for the native product and collects it's environment (used by make_env())
28 try_native(){
29 check_version
30 if [ $? -eq 0 ] ; then
31     dot="`find_in_path dot ${PATH}`"
32     dot=`cd ${dot}/..; pwd`
33     tmp="${dot}/bin ${dot}/bin \${PATH} ${PATH}";  
34     path=`sort_path ${tmp}`
35     tmp="${dot}/lib/graphviz ${dot}/lib/graphviz \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
36     ld_library_path=`sort_path ${tmp}`
37     cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
38 #$DELIM ${PRODUCT_TYPE} $DELIM
39 export PATH=${path}
40 export LD_LIBRARY_PATH=${ld_library_path}
41 ##
42 EOF
43     make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
44     return 0
45 fi
46 return 1;
47 }
48
49 try_preinstalled(){
50 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
51 return $?
52 }
53
54 install_source()
55 {
56 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
57 source ${INSTALL_WORK}/$SHRC
58
59 check_jb tar xfz ${SOURCE_DIR}/graphviz-1.9.tar.gz -C ${INSTALL_WORK}
60
61 cd ${PRODUCT_WORK}
62 makedir ${PRODUCT_DIR}
63 check_job ${PRODUCT_DIR}/CONFIGURE.LOG configure --prefix=${PRODUCT_DIR} --with-tcl=${TCLHOME} --disable-rpath 
64 GCC=`which gcc`
65 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
66 used gcc=$GCC
67 EOF
68 check_job ${PRODUCT_DIR}/MAKE.LOG make
69 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
70
71 #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
72 cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
73 print_env
74 }
75
76 install_binary()
77 {
78 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
79 source ${INSTALL_WORK}/$SHRC
80
81 check_jb tar xfz ${SOURCE_DIR}/graphviz-1.9.tar.gz -C ${INSTALL_ROOT}
82 cd ${PRODUCT_DIR}/lib/graphviz
83 for l in `ls *.la`; do
84     libdir=`grep -e "libdir=.*" $l | sed -e "s/libdir=[\'|\"]\(.*\)[\'|\"]/\1/g"`
85     sed -e "s%${libdir}%${PRODUCT_DIR}/lib/graphviz%g" $l > _$l
86     libdir=`dirname $libdir`
87     sed -e "s%${libdir}%${PRODUCT_DIR}/lib/graphviz%g" _$l > $l
88     rm -f _$l
89     chmod a+x $l
90 done
91
92 print_env
93 }
94
95 export PROCEDURE=$1;
96 export INSTALL_WORK=$2;
97 export SOURCE_DIR=$3;
98 export INSTALL_ROOT=$4;
99 export PRODUCT_SEQUENCE=$5;
100 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="graphviz" ; fi
101 export PRODUCT="graphviz-1.9"
102 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
103 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
104 source ./common.sh
105 $PROCEDURE