createGraphvizBundle.sh revision 2578:0bf994fa4ee5
1#!/bin/bash -e
2# Create a bundle in the current directory, containing what's needed to run
3# the 'dot' program from the graphviz suite by the OpenJDK build.
4
5TMPDIR=`mktemp -d -t graphvizbundle-XXXX`
6trap "rm -rf \"$TMPDIR\"" EXIT
7
8ORIG_DIR=`pwd`
9cd "$TMPDIR"
10GRAPHVIZ_VERSION=2.38.0-1
11PACKAGE_VERSION=1.1
12TARGET_PLATFORM=linux_x64
13BUNDLE_NAME=graphviz-$TARGET_PLATFORM-$GRAPHVIZ_VERSION+$PACKAGE_VERSION.tar.gz
14wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-$GRAPHVIZ_VERSION.el6.x86_64.rpm
15wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-libs-$GRAPHVIZ_VERSION.el6.x86_64.rpm
16wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-plugins-core-$GRAPHVIZ_VERSION.el6.x86_64.rpm
17wget http://www.graphviz.org/pub/graphviz/stable/redhat/el6/x86_64/os/graphviz-plugins-x-$GRAPHVIZ_VERSION.el6.x86_64.rpm
18
19mkdir graphviz
20cd graphviz
21for rpm in ../*.rpm; do
22  rpm2cpio $rpm | cpio --extract --make-directories
23done
24
25cat > dot << EOF
26#!/bin/bash
27# Get an absolute path to this script
28this_script_dir=\`dirname \$0\`
29this_script_dir=\`cd \$this_script_dir > /dev/null && pwd\`
30export LD_LIBRARY_PATH="\$this_script_dir/usr/lib64:\$LD_LIBRARY_PATH"
31exec \$this_script_dir/usr/bin/dot "\$@"
32EOF
33chmod +x dot
34export LD_LIBRARY_PATH="$TMPDIR/graphviz/usr/lib64:$LD_LIBRARY_PATH"
35# create config file
36./dot -c
37tar -cvzf ../$BUNDLE_NAME *
38cp ../$BUNDLE_NAME "$ORIG_DIR"
39