make/devkit/createAutoconfBundle.sh
author naoto
Tue, 12 Nov 2019 14:05:18 -0800
changeset 59043 1a79b4bfc85a
parent 48743 ba52fa7bbf14
permissions -rw-r--r--
8232860: Error formatting integer values with MessageFormat.format() using HOST provider Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48743
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
     1
#!/bin/bash -e
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
     2
#
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
     3
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
     5
#
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
     8
# published by the Free Software Foundation.  Oracle designates this
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
     9
# particular file as subject to the "Classpath" exception as provided
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    10
# by Oracle in the LICENSE file that accompanied this code.
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    11
#
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    12
# This code is distributed in the hope that it will be useful, but WITHOUT
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    13
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    14
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    15
# version 2 for more details (a copy is included in the LICENSE file that
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    16
# accompanied this code).
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    17
#
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    18
# You should have received a copy of the GNU General Public License version
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    19
# 2 along with this work; if not, write to the Free Software Foundation,
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    20
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    21
#
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    22
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    23
# or visit www.oracle.com if you need additional information or have any
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    24
# questions.
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    25
#
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    26
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    27
# Create a bundle in the current directory, containing what's needed to run
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    28
# the 'autoconf' program by the OpenJDK build.
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    29
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    30
# Autoconf depends on m4, so download and build that first.
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    31
AUTOCONF_VERSION=2.69
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    32
M4_VERSION=1.4.18
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    33
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    34
PACKAGE_VERSION=1.0.1
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    35
TARGET_PLATFORM=linux_x86
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    36
MODULE_NAME=autoconf-$TARGET_PLATFORM-$AUTOCONF_VERSION+$PACKAGE_VERSION
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    37
BUNDLE_NAME=$MODULE_NAME.tar.gz
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    38
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    39
TMPDIR=`mktemp -d -t autoconfbundle-XXXX`
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    40
trap "rm -rf \"$TMPDIR\"" EXIT
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    41
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    42
ORIG_DIR=`pwd`
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    43
cd $TMPDIR
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    44
OUTPUT_DIR=$TMPDIR/$MODULE_NAME
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    45
mkdir -p $OUTPUT_DIR/usr
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    46
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    47
# Download and build m4
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    48
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    49
if test "x$TARGET_PLATFORM" = xcygwin_x64; then
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    50
  # On cygwin 64-bit, just copy the cygwin .exe file
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    51
  mkdir -p $OUTPUT_DIR/usr/bin
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    52
  cp /usr/bin/m4 $OUTPUT_DIR/usr/bin
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    53
elif test "x$TARGET_PLATFORM" = xcygwin_x86; then
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    54
  # On cygwin 32-bit, just copy the cygwin .exe file
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    55
  mkdir -p $OUTPUT_DIR/usr/bin
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    56
  cp /usr/bin/m4 $OUTPUT_DIR/usr/bin
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    57
elif test "x$TARGET_PLATFORM" = xlinux_x64; then
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    58
  M4_VERSION=1.4.13-5
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    59
  wget http://yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64/getPackage/m4-$M4_VERSION.el6.x86_64.rpm
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    60
  cd $OUTPUT_DIR
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    61
  rpm2cpio ../m4-$M4_VERSION.el6.x86_64.rpm | cpio -d -i
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    62
elif test "x$TARGET_PLATFORM" = xlinux_x86; then
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    63
  M4_VERSION=1.4.13-5
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    64
  wget http://yum.oracle.com/repo/OracleLinux/OL6/latest/i386/getPackage/m4-$M4_VERSION.el6.i686.rpm
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    65
  cd $OUTPUT_DIR
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    66
  rpm2cpio ../m4-$M4_VERSION.el6.i686.rpm | cpio -d -i
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    67
else
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    68
  wget https://ftp.gnu.org/gnu/m4/m4-$M4_VERSION.tar.gz
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    69
  tar xzf m4-$M4_VERSION.tar.gz
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    70
  cd m4-$M4_VERSION
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    71
  ./configure --prefix=$OUTPUT_DIR/usr
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    72
  make
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    73
  make install
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    74
  cd ..
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    75
fi
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    76
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    77
# Download and build autoconf
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    78
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    79
wget https://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.gz
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    80
tar xzf autoconf-$AUTOCONF_VERSION.tar.gz
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    81
cd autoconf-$AUTOCONF_VERSION
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    82
./configure --prefix=$OUTPUT_DIR/usr M4=$OUTPUT_DIR/usr/bin/m4
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    83
make
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    84
make install
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    85
cd ..
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    86
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    87
perl -pi -e "s!$OUTPUT_DIR/!./!" $OUTPUT_DIR/usr/bin/auto* $OUTPUT_DIR/usr/share/autoconf/autom4te.cfg
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    88
cp $OUTPUT_DIR/usr/share/autoconf/autom4te.cfg $OUTPUT_DIR/autom4te.cfg
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    89
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    90
cat > $OUTPUT_DIR/autoconf << EOF
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    91
#!/bin/bash
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    92
# Get an absolute path to this script
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    93
this_script_dir=\`dirname \$0\`
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    94
this_script_dir=\`cd \$this_script_dir > /dev/null && pwd\`
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    95
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    96
export M4="\$this_script_dir/usr/bin/m4"
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    97
export AUTOM4TE="\$this_script_dir/usr/bin/autom4te"
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    98
export AUTOCONF="\$this_script_dir/usr/bin/autoconf"
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
    99
export AUTOHEADER="\$this_script_dir/usr/bin/autoheader"
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   100
export AC_MACRODIR="\$this_script_dir/usr/share/autoconf"
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   101
export autom4te_perllibdir="\$this_script_dir/usr/share/autoconf"
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   102
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   103
autom4te_cfg=\$this_script_dir/usr/share/autoconf/autom4te.cfg
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   104
cp \$this_script_dir/autom4te.cfg \$autom4te_cfg
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   105
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   106
echo 'begin-language: "M4sugar"' >> \$autom4te_cfg
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   107
echo "args: --prepend-include '"\$this_script_dir/usr/share/autoconf"'" >> \$autom4te_cfg
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   108
echo 'end-language: "M4sugar"' >> \$autom4te_cfg
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   109
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   110
exec \$this_script_dir/usr/bin/autoconf "\$@"
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   111
EOF
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   112
chmod +x $OUTPUT_DIR/autoconf
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   113
cd $OUTPUT_DIR
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   114
tar -cvzf ../$BUNDLE_NAME *
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   115
cd ..
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents:
diff changeset
   116
cp $BUNDLE_NAME "$ORIG_DIR"