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