]> SALOME platform Git repositories - tools/install.git/blob - config_files/graphviz-2.16.1.sh
Salome HOME
To introduce a new possibility - installation of binaries of the prerequisites into...
[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 $5}'`
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}/${SINGLE_DIR:-${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_SRC_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_SRC_DIR})
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_SRC_DIR} ${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_SRC_DIR}
80 test -z ${SINGLE_DIR} && makedir ${PRODUCT_DIR} || mkdir -p ${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_SRC_DIR} > ${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_SRC_DIR} && rm -fr ${PRODUCT_SRC_DIR}
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 # create a product directory
111 test -z ${SINGLE_DIR} && makedir ${PRODUCT_DIR} || mkdir -p ${PRODUCT_DIR}
112
113 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${PRODUCT_DIR}
114 cd ${PRODUCT_DIR}/lib/graphviz
115
116 for l in `ls *.la`; do
117     libdir=`grep -e "libdir=.*" $l | sed -e "s/libdir=[\'|\"]\(.*\)[\'|\"]/\1/g"`
118     sed -e "s%${libdir}%${PRODUCT_DIR}/lib/graphviz%g" $l > _$l
119     libdir=`dirname $libdir`
120     sed -e "s%${libdir}%${PRODUCT_DIR}/lib/graphviz%g" _$l > $l
121     tmp=""
122     if [ -n "${TCLHOME}" ]; then
123         tmp="-L${TCLHOME}/lib"
124     fi
125     sed -e "s%-L[^[:space:]]*/tcltk-[0-9]\+\.[0-9]\+\.[0-9]\+/lib[[:space:]]%$tmp %g" $l > _$l
126     mv -f _$l $l
127     chmod a+x $l
128 done
129
130 # to generate environment scripts
131 try_preinstalled
132 }
133
134 export PROCEDURE=$1;
135 export INSTALL_WORK=$2;
136 export SOURCE_DIR=$3;
137 export INSTALL_ROOT=$4;
138 export PRODUCT_SEQUENCE=$5;
139 export PRODUCT_TYPE=$6;
140 export INSTALL_PRODUCTS=$7;
141 shift
142 REMOVE_SRC_TMP=$8;
143 test $# == 10 && shift && SINGLE_DIR=$9
144 export PRODUCT="graphviz-2.16.1"
145 export PRODUCT_DIR=${INSTALL_ROOT}/${SINGLE_DIR:-${PRODUCT}}
146 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
147 export PRODUCT_SRC_DIR=${INSTALL_ROOT}/${PRODUCT}_SRC
148 source ./common.sh
149 $PROCEDURE