]> SALOME platform Git repositories - tools/install.git/blob - config_files/graphviz-2.16.1.sh
Salome HOME
Update of products
[tools/install.git] / config_files / graphviz-2.16.1.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : graphviz-2.16.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 20203 ] ; 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 GRAPHVIZHOME=\${INSTALL_ROOT}/${PRODUCT}
36 export PATH=\${GRAPHVIZHOME}/bin:\${PATH}
37 export LD_LIBRARY_PATH=\${GRAPHVIZHOME}/lib:\${GRAPHVIZHOME}/lib/graphviz:\${LD_LIBRARY_PATH}
38 ##
39 EOF
40 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
41 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
42 }
43
44 print_env_src()
45 {
46 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
47 #$DELIM ${PRODUCT_TYPE}_src $DELIM
48 # nothing to do
49 ##
50 EOF
51 (test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
52 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
53 }
54
55 try_preinstalled(){
56 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
57 try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
58 return $?
59 }
60
61 install_source()
62 {
63 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
64 source ${INSTALL_WORK}/$SHRC
65
66 # unpack
67 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
68
69 # to generate environment scripts
70 try_preinstalled
71 }
72
73 install_source_and_build()
74 {
75 # install sources
76 install_source
77
78 # build sources
79 cd ${PRODUCT_DIR}_SRC
80 makedir ${PRODUCT_DIR}
81   if test `uname -m` = "x86_64" ; then
82 check_job ${PRODUCT_DIR}/CONFIGURE.LOG configure --prefix=${PRODUCT_DIR} --with-mylibgd --with-gdlibdir=/usr/lib64 --with-fontconfiglibdir=/usr/lib64 --with-expatlibdir=/usr/lib64 --with-freetypelibdir=/usr/lib64 --with-tcl=${TCLHOME} --disable-rpath  --enable-perl=no CFLAGS=-m64 CXXFLAGS=-m64
83   else
84 check_job ${PRODUCT_DIR}/CONFIGURE.LOG configure --prefix=${PRODUCT_DIR} --with-tcl=${TCLHOME} --disable-rpath --enable-perl=no
85   fi
86 GCC=`which gcc`
87 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
88 used gcc=$GCC
89 EOF
90 check_job ${PRODUCT_DIR}/MAKE.LOG make
91 check_job ${PRODUCT_DIR}/MAKEINSTALL.LOG make install
92
93 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
94 cd ${PRODUCT_DIR};
95
96 # remove sources and temporary files after building
97 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
98     test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
99 fi
100
101 # to generate environment scripts
102 try_preinstalled
103 }
104
105 install_binary()
106 {
107 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
108 source ${INSTALL_WORK}/$SHRC
109
110 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
111 cd ${PRODUCT_DIR}/lib/graphviz
112
113 for l in `ls *.la`; do
114     libdir=`grep -e "libdir=.*" $l | sed -e "s/libdir=[\'|\"]\(.*\)[\'|\"]/\1/g"`
115     sed -e "s%${libdir}%${PRODUCT_DIR}/lib/graphviz%g" $l > _$l
116     libdir=`dirname $libdir`
117     sed -e "s%${libdir}%${PRODUCT_DIR}/lib/graphviz%g" _$l > $l
118     tmp=""
119     if [ -n "${TCLHOME}" ]; then
120         tmp="-L${TCLHOME}/lib"
121     fi
122     sed -e "s%-L[^[:space:]]*/tcltk-[0-9]\+\.[0-9]\+\.[0-9]\+/lib[[:space:]]%$tmp %g" $l > _$l
123     mv -f _$l $l
124     chmod a+x $l
125 done
126
127 # to generate environment scripts
128 try_preinstalled
129 }
130
131 export PROCEDURE=$1;
132 export INSTALL_WORK=$2;
133 export SOURCE_DIR=$3;
134 export INSTALL_ROOT=$4;
135 export PRODUCT_SEQUENCE=$5;
136 export PRODUCT_TYPE=$6;
137 export INSTALL_PRODUCTS=$7;
138 shift
139 REMOVE_SRC_TMP=$8;
140 export PRODUCT="graphviz-2.16.1"
141 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
142 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
143 source ./common.sh
144 $PROCEDURE