1
1
#! /bin/bash -e
2
2
#
3
- # Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3
+ # Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
4
4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
5
#
6
6
# This code is free software; you can redistribute it and/or modify it
25
25
#
26
26
27
27
# Create a bundle in the current directory, containing what's needed to run
28
- # the 'autoconf' program by the OpenJDK build.
28
+ # the 'autoconf' program by the OpenJDK build. To override TARGET_PLATFORM
29
+ # just set the variable before running this script.
29
30
30
31
# Autoconf depends on m4, so download and build that first.
31
32
AUTOCONF_VERSION=2.69
32
33
M4_VERSION=1.4.18
33
34
34
35
PACKAGE_VERSION=1.0.1
35
- TARGET_PLATFORM=linux_x86
36
+ case ` uname -s` in
37
+ Darwin)
38
+ os=macosx
39
+ ;;
40
+ Linux)
41
+ os=linux
42
+ ;;
43
+ CYGWIN* )
44
+ os=cygwin
45
+ ;;
46
+ esac
47
+ case ` uname -m` in
48
+ arm64|aarch64)
49
+ arch=aarch64
50
+ ;;
51
+ amd64|x86_64|x64)
52
+ arch=x64
53
+ ;;
54
+ esac
55
+ TARGET_PLATFORM=${TARGET_PLATFORM:= " ${os} _${arch} " }
56
+
36
57
MODULE_NAME=autoconf-$TARGET_PLATFORM -$AUTOCONF_VERSION +$PACKAGE_VERSION
37
58
BUNDLE_NAME=$MODULE_NAME .tar.gz
38
59
39
- TMPDIR= ` mktemp -d -t autoconfbundle-XXXX `
40
- trap " rm -rf \" $TMPDIR \" " EXIT
60
+ SCRIPT_DIR= " $( cd " $( dirname $0 ) " > /dev/null && pwd ) "
61
+ OUTPUT_ROOT= " ${SCRIPT_DIR} /../../build/autoconf "
41
62
42
- ORIG_DIR=` pwd`
43
- cd $TMPDIR
44
- OUTPUT_DIR=$TMPDIR /$MODULE_NAME
45
- mkdir -p $OUTPUT_DIR /usr
63
+ cd $OUTPUT_ROOT
64
+ IMAGE_DIR=$OUTPUT_ROOT /$MODULE_NAME
65
+ mkdir -p $IMAGE_DIR /usr
46
66
47
67
# Download and build m4
48
68
49
69
if test " x$TARGET_PLATFORM " = xcygwin_x64; then
50
70
# 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
71
+ mkdir -p $IMAGE_DIR /usr/bin
72
+ cp /usr/bin/m4 $IMAGE_DIR /usr/bin
53
73
elif test " x$TARGET_PLATFORM " = xcygwin_x86; then
54
74
# 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
75
+ mkdir -p $IMAGE_DIR /usr/bin
76
+ cp /usr/bin/m4 $IMAGE_DIR /usr/bin
57
77
elif test " x$TARGET_PLATFORM " = xlinux_x64; then
58
78
M4_VERSION=1.4.13-5
59
79
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
80
+ cd $IMAGE_DIR
81
+ rpm2cpio $OUTPUT_ROOT /m4-$M4_VERSION .el6.x86_64.rpm | cpio -d -i
62
82
elif test " x$TARGET_PLATFORM " = xlinux_x86; then
63
83
M4_VERSION=1.4.13-5
64
84
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
85
+ cd $IMAGE_DIR
86
+ rpm2cpio $OUTPUT_ROOT /m4-$M4_VERSION .el6.i686.rpm | cpio -d -i
67
87
else
68
88
wget https://ftp.gnu.org/gnu/m4/m4-$M4_VERSION .tar.gz
69
89
tar xzf m4-$M4_VERSION .tar.gz
70
90
cd m4-$M4_VERSION
71
- ./configure --prefix=$OUTPUT_DIR /usr
91
+ ./configure --prefix=$IMAGE_DIR /usr CFLAGS= " -w -Wno-everything "
72
92
make
73
93
make install
74
94
cd ..
79
99
wget https://ftp.gnu.org/gnu/autoconf/autoconf-$AUTOCONF_VERSION .tar.gz
80
100
tar xzf autoconf-$AUTOCONF_VERSION .tar.gz
81
101
cd autoconf-$AUTOCONF_VERSION
82
- ./configure --prefix=$OUTPUT_DIR /usr M4=$OUTPUT_DIR /usr/bin/m4
102
+ ./configure --prefix=$IMAGE_DIR /usr M4=$IMAGE_DIR /usr/bin/m4
83
103
make
84
104
make install
85
105
cd ..
86
106
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
107
+ perl -pi -e " s!$IMAGE_DIR /!./!" $IMAGE_DIR /usr/bin/auto* $IMAGE_DIR /usr/share/autoconf/autom4te.cfg
89
108
90
- cat > $OUTPUT_DIR /autoconf << EOF
109
+ cat > $IMAGE_DIR /autoconf << EOF
91
110
#!/bin/bash
92
111
# Get an absolute path to this script
93
112
this_script_dir=\` dirname \$ 0\`
@@ -100,17 +119,10 @@ export AUTOHEADER="\$this_script_dir/usr/bin/autoheader"
100
119
export AC_MACRODIR="\$ this_script_dir/usr/share/autoconf"
101
120
export autom4te_perllibdir="\$ this_script_dir/usr/share/autoconf"
102
121
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
122
+ PREPEND_INCLUDE="--prepend-include \$ this_script_dir/usr/share/autoconf"
109
123
110
- exec \$ this_script_dir/usr/bin/autoconf "\$ @"
124
+ exec \$ this_script_dir/usr/bin/autoconf \$ PREPEND_INCLUDE "\$ @"
111
125
EOF
112
- chmod +x $OUTPUT_DIR /autoconf
113
- cd $OUTPUT_DIR
114
- tar -cvzf ../$BUNDLE_NAME *
115
- cd ..
116
- cp $BUNDLE_NAME " $ORIG_DIR "
126
+ chmod +x $IMAGE_DIR /autoconf
127
+ cd $IMAGE_DIR
128
+ tar -cvzf $OUTPUT_ROOT /$BUNDLE_NAME *
0 commit comments