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