Path: blob/master/make/devkit/createAutoconfBundle.sh
40914 views
#!/bin/bash -e1#2# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4#5# This code is free software; you can redistribute it and/or modify it6# under the terms of the GNU General Public License version 2 only, as7# published by the Free Software Foundation. Oracle designates this8# particular file as subject to the "Classpath" exception as provided9# by Oracle in the LICENSE file that accompanied this code.10#11# This code is distributed in the hope that it will be useful, but WITHOUT12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License14# version 2 for more details (a copy is included in the LICENSE file that15# accompanied this code).16#17# You should have received a copy of the GNU General Public License version18# 2 along with this work; if not, write to the Free Software Foundation,19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.20#21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA22# or visit www.oracle.com if you need additional information or have any23# questions.24#2526# Create a bundle in the current directory, containing what's needed to run27# the 'autoconf' program by the OpenJDK build.2829# Autoconf depends on m4, so download and build that first.30AUTOCONF_VERSION=2.6931M4_VERSION=1.4.183233PACKAGE_VERSION=1.0.134TARGET_PLATFORM=linux_x8635MODULE_NAME=autoconf-$TARGET_PLATFORM-$AUTOCONF_VERSION+$PACKAGE_VERSION36BUNDLE_NAME=$MODULE_NAME.tar.gz3738TMPDIR=`mktemp -d -t autoconfbundle-XXXX`39trap "rm -rf \"$TMPDIR\"" EXIT4041ORIG_DIR=`pwd`42cd $TMPDIR43OUTPUT_DIR=$TMPDIR/$MODULE_NAME44mkdir -p $OUTPUT_DIR/usr4546# Download and build m44748if test "x$TARGET_PLATFORM" = xcygwin_x64; then49# On cygwin 64-bit, just copy the cygwin .exe file50mkdir -p $OUTPUT_DIR/usr/bin51cp /usr/bin/m4 $OUTPUT_DIR/usr/bin52elif test "x$TARGET_PLATFORM" = xcygwin_x86; then53# On cygwin 32-bit, just copy the cygwin .exe file54mkdir -p $OUTPUT_DIR/usr/bin55cp /usr/bin/m4 $OUTPUT_DIR/usr/bin56elif test "x$TARGET_PLATFORM" = xlinux_x64; then57M4_VERSION=1.4.13-558wget http://yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64/getPackage/m4-$M4_VERSION.el6.x86_64.rpm59cd $OUTPUT_DIR60rpm2cpio ../m4-$M4_VERSION.el6.x86_64.rpm | cpio -d -i61elif test "x$TARGET_PLATFORM" = xlinux_x86; then62M4_VERSION=1.4.13-563wget http://yum.oracle.com/repo/OracleLinux/OL6/latest/i386/getPackage/m4-$M4_VERSION.el6.i686.rpm64cd $OUTPUT_DIR65rpm2cpio ../m4-$M4_VERSION.el6.i686.rpm | cpio -d -i66else67wget https://ftp.gnu.org/gnu/m4/m4-$M4_VERSION.tar.gz68tar xzf m4-$M4_VERSION.tar.gz69cd m4-$M4_VERSION70./configure --prefix=$OUTPUT_DIR/usr71make72make install73cd ..74fi7576# Download and build autoconf7778wget https://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION.tar.gz79tar xzf autoconf-$AUTOCONF_VERSION.tar.gz80cd autoconf-$AUTOCONF_VERSION81./configure --prefix=$OUTPUT_DIR/usr M4=$OUTPUT_DIR/usr/bin/m482make83make install84cd ..8586perl -pi -e "s!$OUTPUT_DIR/!./!" $OUTPUT_DIR/usr/bin/auto* $OUTPUT_DIR/usr/share/autoconf/autom4te.cfg87cp $OUTPUT_DIR/usr/share/autoconf/autom4te.cfg $OUTPUT_DIR/autom4te.cfg8889cat > $OUTPUT_DIR/autoconf << EOF90#!/bin/bash91# Get an absolute path to this script92this_script_dir=\`dirname \$0\`93this_script_dir=\`cd \$this_script_dir > /dev/null && pwd\`9495export M4="\$this_script_dir/usr/bin/m4"96export AUTOM4TE="\$this_script_dir/usr/bin/autom4te"97export AUTOCONF="\$this_script_dir/usr/bin/autoconf"98export AUTOHEADER="\$this_script_dir/usr/bin/autoheader"99export AC_MACRODIR="\$this_script_dir/usr/share/autoconf"100export autom4te_perllibdir="\$this_script_dir/usr/share/autoconf"101102autom4te_cfg=\$this_script_dir/usr/share/autoconf/autom4te.cfg103cp \$this_script_dir/autom4te.cfg \$autom4te_cfg104105echo 'begin-language: "M4sugar"' >> \$autom4te_cfg106echo "args: --prepend-include '"\$this_script_dir/usr/share/autoconf"'" >> \$autom4te_cfg107echo 'end-language: "M4sugar"' >> \$autom4te_cfg108109exec \$this_script_dir/usr/bin/autoconf "\$@"110EOF111chmod +x $OUTPUT_DIR/autoconf112cd $OUTPUT_DIR113tar -cvzf ../$BUNDLE_NAME *114cd ..115cp $BUNDLE_NAME "$ORIG_DIR"116117118