1#!/bin/bash
2#
3# Copyright (c) 2012, 2020, 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.
9#
10# This code is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13# version 2 for more details (a copy is included in the LICENSE file that
14# accompanied this code).
15#
16# You should have received a copy of the GNU General Public License version
17# 2 along with this work; if not, write to the Free Software Foundation,
18# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19#
20# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21# or visit www.oracle.com if you need additional information or have any
22# questions.
23#
24
25# This script is processed by configure before it's usable. It is run from
26# the root of the build directory.
27
28
29##########################################################################################
30# Substitutions from autoconf
31
32export LEGACY_BUILD_DIR=@OPENJDK_TARGET_OS@-@OPENJDK_TARGET_CPU_LEGACY@
33
34export OPENJDK_BUILD_OS_ENV="@OPENJDK_BUILD_OS_ENV@"
35export OPENJDK_TARGET_OS="@OPENJDK_TARGET_OS@"
36export OPENJDK_TARGET_CPU="@OPENJDK_TARGET_CPU@"
37export DEBUG_LEVEL="@DEBUG_LEVEL@"
38
39export AWK="@AWK@"
40export BASH="@BASH@"
41export CAT="@CAT@"
42export CMP="@CMP@"
43export CP="@CP@"
44export CUT="@CUT@"
45export DIFF="@DIFF@"
46export DUMPBIN="@DUMPBIN@"
47export EXPR="@EXPR@"
48export FILE="@FILE@"
49export FIND="@FIND@"
50export GREP="@GREP@"
51export GUNZIP="@GUNZIP@"
52export LDD="@LDD@"
53export LN="@LN@"
54export MKDIR="@MKDIR@"
55export MV="@MV@"
56export NM="@GNM@"
57export OBJDUMP="@OBJDUMP@"
58export OTOOL="@OTOOL@"
59export PRINTF="@PRINTF@"
60export READELF="@READELF@"
61export RM="@RM@"
62export SED="@SED@"
63export SORT="@SORT@"
64export STAT="@STAT@"
65export STRIP="@STRIP@ @STRIPFLAGS@"
66export TAR="@TAR@"
67export TEE="@TEE@"
68export UNIQ="@UNIQ@"
69export UNARCHIVE="@UNZIP@ -q -o"
70
71export TOPDIR="@TOPDIR@"
72export OUTPUTDIR="@OUTPUTDIR@"
73
74if [ "@COMPILE_TYPE@" != "cross" ]; then
75  export JAVAP="@FIXPATH@ $OUTPUTDIR/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
76  export JIMAGE="@FIXPATH@ $OUTPUTDIR/jdk/bin/jimage"
77  export JMOD="@FIXPATH@ $OUTPUTDIR/jdk/bin/jmod"
78elif [ "@CREATE_BUILDJDK@" = "true" ]; then
79  export JAVAP="@FIXPATH@ $OUTPUTDIR/buildjdk/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
80  export JIMAGE="@FIXPATH@ $OUTPUTDIR/buildjdk/jdk/bin/jimage"
81  export JMOD="@FIXPATH@ $OUTPUTDIR/buildjdk/jdk/bin/jmod"
82else
83  export JAVAP="@FIXPATH@ @BUILD_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
84  export JIMAGE="@FIXPATH@ @BUILD_JDK@/bin/jimage"
85  export JMOD="@FIXPATH@ @BUILD_JDK@/bin/jmod"
86fi
87
88if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
89  if [[ $OPENJDK_BUILD_OS_ENV =~ ^windows.wsl ]]; then
90    export WSLENV=PATH/l
91  fi
92  export PATH="$PATH:@TOOLCHAIN_PATH@"
93fi
94
95export HOTSPOT_BUILD_TIME="@HOTSPOT_BUILD_TIME@"
96export USE_PRECOMPILED_HEADER="@USE_PRECOMPILED_HEADER@"
97
98# Now locate the main script and run it.
99REAL_COMPARE_SCRIPT="$TOPDIR/make/scripts/compare.sh"
100if [ ! -e "$REAL_COMPARE_SCRIPT" ]; then
101  echo "Error: Cannot locate compare script, it should have been in $REAL_COMPARE_SCRIPT"
102  exit 1
103fi
104
105# Rotate logs
106$RM $OUTPUTDIR/compare.log.old 2> /dev/null
107$MV $OUTPUTDIR/compare.log $OUTPUTDIR/compare.log.old 2> /dev/null
108
109export SCRIPT_DIR="$( cd "$( dirname "$0" )" > /dev/null && pwd )"
110
111$BASH $TOPDIR/make/scripts/logger.sh $OUTPUTDIR/compare.log $BASH "$REAL_COMPARE_SCRIPT" "$@"
112