make/devkit/createGraphvizBundle.sh
author ihse
Sun, 23 Apr 2017 21:34:02 +0200
changeset 44734 70bbd6884287
parent 44726 04aa2c065f5c
child 44831 4577394d5b98
permissions -rw-r--r--
8179022: Add serialization spec as markdown Reviewed-by: erikj, mchung, rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44726
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
     1
#!/bin/bash -e
44734
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
     2
#
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
     3
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
     5
#
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
     8
# published by the Free Software Foundation.  Oracle designates this
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
     9
# particular file as subject to the "Classpath" exception as provided
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    10
# by Oracle in the LICENSE file that accompanied this code.
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    11
#
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    12
# This code is distributed in the hope that it will be useful, but WITHOUT
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    13
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    14
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    15
# version 2 for more details (a copy is included in the LICENSE file that
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    16
# accompanied this code).
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    17
#
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    18
# You should have received a copy of the GNU General Public License version
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    19
# 2 along with this work; if not, write to the Free Software Foundation,
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    20
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    21
#
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    22
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    23
# or visit www.oracle.com if you need additional information or have any
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    24
# questions.
70bbd6884287 8179022: Add serialization spec as markdown
ihse
parents: 44726
diff changeset
    25
#
44726
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    26
# 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
    27
# 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
    28
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    29
TMPDIR=`mktemp -d -t graphvizbundle-XXXX`
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    30
trap "rm -rf \"$TMPDIR\"" EXIT
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    31
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    32
ORIG_DIR=`pwd`
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    33
cd "$TMPDIR"
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    34
GRAPHVIZ_VERSION=2.38.0-1
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    35
PACKAGE_VERSION=1.1
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    36
TARGET_PLATFORM=linux_x64
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    37
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
    38
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
    39
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
    40
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
    41
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
    42
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    43
mkdir graphviz
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    44
cd graphviz
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    45
for rpm in ../*.rpm; do
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    46
  rpm2cpio $rpm | cpio --extract --make-directories
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    47
done
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    48
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    49
cat > dot << EOF
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    50
#!/bin/bash
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    51
# Get an absolute path to this script
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    52
this_script_dir=\`dirname \$0\`
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    53
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
    54
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
    55
exec \$this_script_dir/usr/bin/dot "\$@"
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    56
EOF
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    57
chmod +x dot
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    58
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
    59
# create config file
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    60
./dot -c
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    61
tar -cvzf ../$BUNDLE_NAME *
04aa2c065f5c 8176785: Add build support to generate PNG file from .dot file
ihse
parents:
diff changeset
    62
cp ../$BUNDLE_NAME "$ORIG_DIR"