7074397: Build infrastructure changes (makefile re-write)

New makefiles transition, old and new living side by side for now.

Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
Co-authored-by: Torbjorn Granat <torbjorn.granat@oracle.com>
Co-authored-by: Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
Reviewed-by: ohair, jjg, dholmes, ohrstrom, erikj, ihse, tgranat, ykantser
This commit is contained in:
Fredrik Ohstrom 2012-04-10 08:18:28 -07:00 committed by Kelly O'Hair
parent a1f493478a
commit c41339543f
37 changed files with 27593 additions and 0 deletions

@ -0,0 +1,26 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Generated Makefile @DATE_WHEN_CONFIGURED@
SPEC:=@OUTPUT_ROOT@/spec.gmk
include @SRC_ROOT@/common/makefiles/Makefile

@ -0,0 +1,26 @@
#!/bin/sh
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
autoconf configure.ac > configure
rm -rf config.status config.log autom4te.cache

1531
common/autoconf/build-aux/config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

1658
common/autoconf/build-aux/config.sub vendored Normal file

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
#!/bin/sh
echo >&2 "No suitable 'install' command found.'"
echo >&2 "If automake is installed, running 'automake -fa'"
echo >&2 "(and ignoring the errors) might produce one."
exit 1

@ -0,0 +1,155 @@
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
#
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
# this or PKG_CHECK_MODULES is called, or make sure to call
# PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
# _PKG_SHORT_ERRORS_SUPPORTED
# -----------------------------
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])# _PKG_SHORT_ERRORS_SUPPORTED
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND])
#
#
# Note that if there is a possibility the first call to
# PKG_CHECK_MODULES might not happen, you should be sure to include an
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
#
#
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
ifelse([$4], , [AC_MSG_ERROR(dnl
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT
])],
[AC_MSG_RESULT([no])
$4])
elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
[$4])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
ifelse([$3], , :, [$3])
fi[]dnl
])# PKG_CHECK_MODULES

@ -0,0 +1,66 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# This is a configuration example using builddeps
# that are downloaded from an ftp server.
# This is how you use it:
#configure --with-builddeps-server=ftp://builddeps.server/adir \
# --with-builddeps-conf=..../builddeps.conf.example
# --with-builddeps-dir=/localdisk/mybuilddeps
# Translate a configuration triplet/quadruplet into something
# known by this configuration file.
# If no rewrite was found, then rewritten_host=${host}
REWRITE_i686_pc_linux_gnu=i686-unknown-linux-gnu
REWRITE_i386_pc_solaris2_10=i686-sun-solaris2_10
# The needed cups builddeps are host independent header files.
# I.e. they need not be part of the devkit.
builddep_cups=lib/cups_1_3_9.zip
builddep_cups_CFLAGS=-I${depdir}
# The devkit is the cross compiler tools and sys-roots
# for the build platform.
builddep_devkit=sdk/sdk-${rewritten_build}-20110921.tar.gz
# The freetype dependency is partyl host dependent.
# It is stored inside the sys-root.
builddep_freetype2=sdk/sdk-${rewritten_build}-20110921.tar.gz
builddep_freetype2_CFLAGS=-I${depdir}/${rewritten_host}/sys-root/usr/include/freetype2
builddep_freetype2_LIBS=-lfreetype
# There are many other build dependencies, but they are implicitly
# found inside the devkit sys-root.
# The boot jdk runs on the build system and is used to compile and run
# Java build tools and of course, the bootstrap javac.
builddep_bootjdk_BUILD_i386_pc_solaris2=java/jdk-7u2-fcs-bin-b13-solaris-i586-17_nov_2011.zip
builddep_bootjdk_BUILD_x86_64_pc_solaris2=java/jdk-7u2-fcs-bin-b13-solaris-x64-17_nov_2011.zip
builddep_bootjdk_BUILD_i686_unknown_linux_gnu=java/jdk-7u2-fcs-bin-b13-linux-i586-17_nov_2011.zip
builddep_bootjdk_BUILD_x86_64_unknown_linux_gnu=java/jdk-7u2-fcs-bin-b13-linux-x64-17_nov_2011.zip
builddep_bootjdk_BUILD_sparc_solaris2=java/jdk-7u2-fcs-bin-b13-solaris-sparc-17_nov_2011.zip
builddep_bootjdk_BUILD_sparcv9_solaris2=java/jdk-7u2-fcs-bin-b13-solaris-sparcv9-17_nov_2011.zip
builddep_bootjdk_BUILD_i386_pc_windows=java/jdk-7u2-fcs-bin-b13-windows-i586-17_nov_2011.zip
builddep_bootjdk_BUILD_x86_64_pc_windows=java/jdk-7u2-fcs-bin-b13-windows-x64-17_nov_2011.zip
builddep_bootjdk_ROOT=${depdir}/jdk7_02/jdk1.7.0_02

@ -0,0 +1,43 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# This is a configuration example using an nfs-mount /java
# it will use the builddeps directly from the nfs mounted directory.
# This is how you use it:
#configure --with-builddeps-conf=..../builddeps.conf.nfs.example
REWRITE_i686_pc_linux_gnu=i686-unknown-linux-gnu
REWRITE_i386_pc_solaris2_10=i686-sun-solaris2_10
DEVTOOLS=/java/devtools
builddep_cups=${DEVTOOLS}/linux/cups/include
builddep_cups_CFLAGS=-I${depdir}
JDK_ROOT=/java/re/jdk/7u4/latest/binaries
builddep_bootjdk_BUILD_i386_pc_solaris2=${JDK_ROOT}/solaris-i586
builddep_bootjdk_BUILD_x86_64_pc_solaris2=${JDK_ROOT}/solaris-amd64
builddep_bootjdk_BUILD_i686_unknown_linux_gnu=${JDK_ROOT}/linux-i586
builddep_bootjdk_BUILD_x86_64_unknown_linux_gnu=${JDK_ROOT}/linux-amd64
builddep_bootjdk_ROOT=

@ -0,0 +1,231 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
AC_DEFUN([BDEPS_SCAN_FOR_BUILDDEPS],
[
define(LIST_OF_BUILD_DEPENDENCIES,)
if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
if test "x$with_builddeps_conf" != x; then
AC_MSG_CHECKING([for supplied builddeps configuration file])
builddepsfile=$with_builddeps_conf
if test -s $builddepsfile; then
. $builddepsfile
AC_MSG_RESULT([loaded!])
else
AC_ERROR([The given builddeps conf file $with_builddeps_conf could not be loaded!])
fi
else
AC_MSG_CHECKING([for builddeps.conf files in sources...])
builddepsfile=`mktemp`
touch $builddepsfile
# Put all found confs into a single file.
find ${SRC_ROOT} -name builddeps.conf -exec cat \{\} \; >> $builddepsfile
# Source the file to acquire the variables
if test -s $builddepsfile; then
. $builddepsfile
AC_MSG_RESULT([found at least one!])
else
AC_ERROR([Could not find any builddeps.conf at all!])
fi
fi
# Create build and host names that use _ instead of "-" and ".".
# This is necessary to use them in variable names.
build_var=`echo ${build} | tr '-' '_' | tr '.' '_'`
host_var=`echo ${host} | tr '-' '_' | tr '.' '_'`
# Extract rewrite information for build and host
eval rewritten_build=\${REWRITE_${build_var}}
if test "x$rewritten_build" = x; then
rewritten_build=${build}
echo Build stays the same $rewritten_build
else
echo Rewriting build for builddeps into $rewritten_build
fi
eval rewritten_host=\${REWRITE_${host_var}}
if test "x$rewritten_host" = x; then
rewritten_host=${host}
echo Host stays the same $rewritten_host
else
echo Rewriting host for builddeps into $rewritten_host
fi
rewritten_build_var=`echo ${rewritten_build} | tr '-' '_' | tr '.' '_'`
rewritten_host_var=`echo ${rewritten_host} | tr '-' '_' | tr '.' '_'`
fi
AC_CHECK_PROGS(BDEPS_UNZIP, [7z unzip])
if test "x$BDEPS_UNZIP" = x7z; then
BDEPS_UNZIP="7z x"
fi
AC_CHECK_PROGS(BDEPS_FTP, [wget lftp ftp])
])
AC_DEFUN([BDEPS_FTPGET],
[
# $1 is the ftp://abuilddeps.server.com/libs/cups.zip
# $2 is the local file name for the downloaded file.
VALID_TOOL=no
if test "x$BDEPS_FTP" = xwget; then
VALID_TOOL=yes
wget -O $2 $1
fi
if test "x$BDEPS_FTP" = xlftp; then
VALID_TOOL=yes
lftp -c "get $1 -o $2"
fi
if test "x$BDEPS_FTP" = xftp; then
VALID_TOOL=yes
FTPSERVER=`echo $1 | cut -f 3 -d '/'`
FTPPATH=`echo $1 | cut -f 4- -d '/'`
FTPUSERPWD=${FTPSERVER%%@*}
if test "x$FTPSERVER" != "x$FTPUSERPWD"; then
FTPUSER=${userpwd%%:*}
FTPPWD=${userpwd#*@}
FTPSERVER=${FTPSERVER#*@}
else
FTPUSER=ftp
FTPPWD=ftp
fi
# the "pass" command does not work on some
# ftp clients (read ftp.exe) but if it works,
# passive mode is better!
(\
echo "user $FTPUSER $FTPPWD" ;\
echo "pass" ;\
echo "bin" ;\
echo "get $FTPPATH $2" ;\
) | ftp -in $FTPSERVER
fi
if test "x$VALID_TOOL" != xyes; then
AC_ERROR([I do not know how to use the tool: $BDEPS_FTP])
fi
])
AC_DEFUN([BDEPS_CHECK_MODULE],
[
define([LIST_OF_BUILD_DEPENDENCIES],LIST_OF_BUILD_DEPENDENCIES[$2=$3'\n'])
if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
# Source the builddeps file again, to make sure it uses the latest variables!
. $builddepsfile
# Look for a host and build machine specific resource!
eval resource=\${builddep_$2_BUILD_${rewritten_build_var}_HOST_${rewritten_host_var}}
if test "x$resource" = x; then
# Ok, lets instead look for a host specific resource
eval resource=\${builddep_$2_HOST_${rewritten_host_var}}
fi
if test "x$resource" = x; then
# Ok, lets instead look for a build specific resource
eval resource=\${builddep_$2_BUILD_${rewritten_build_var}}
fi
if test "x$resource" = x; then
# Ok, lets instead look for a generic resource
# (The $2 comes from M4 and not the shell, thus no need for eval here.)
resource=${builddep_$2}
fi
if test "x$resource" != x; then
AC_MSG_NOTICE([Using builddeps $resource for $2])
# If the resource in the builddeps.conf file is an existing directory,
# for example /java/linux/cups
if test -d ${resource}; then
depdir=${resource}
else
BDEPS_FETCH($2, $resource, $with_builddeps_server, $with_builddeps_dir, depdir)
fi
# Source the builddeps file again, because in the previous command, the depdir
# was updated to point at the current build dependency install directory.
. $builddepsfile
# Now extract variables from the builddeps.conf files.
theroot=${builddep_$2_ROOT}
thecflags=${builddep_$2_CFLAGS}
thelibs=${builddep_$2_LIBS}
if test "x$depdir" = x; then
AC_ERROR([Could not download build dependency $2])
fi
$1=$depdir
if test "x$theroot" != x; then
$1="$theroot"
fi
if test "x$thecflags" != x; then
$1_CFLAGS="$thecflags"
fi
if test "x$thelibs" != x; then
$1_LIBS="$thelibs"
fi
m4_default([$4], [:])
m4_ifvaln([$5], [else $5])
fi
m4_ifvaln([$5], [else $5])
fi
])
AC_DEFUN([BDEPS_FETCH],
[
# $1 is for example mymodule
# $2 is for example libs/general/libmymod_1_2_3.zip
# $3 is for example ftp://mybuilddeps.myserver.com/builddeps
# $4 is for example /localhome/builddeps
# $5 is the name of the variable into which we store the depdir, eg MYMOD
# Will download ftp://mybuilddeps.myserver.com/builddeps/libs/general/libmymod_1_2_3.zip and
# unzip into the directory: /localhome/builddeps/libmymod_1_2_3
filename=`basename $2`
filebase=`echo $filename | sed 's/\.[[^\.]]*$//'`
filebase=${filename%%.*}
extension=${filename#*.}
installdir=$4/$filebase
if test ! -f $installdir/$filename.unpacked; then
AC_MSG_NOTICE([Downloading build dependency $1 from $3/$2 and installing into $installdir])
if test ! -d $installdir; then
mkdir -p $installdir
fi
if test ! -d $installdir; then
AC_ERROR([Could not create directory $installdir])
fi
tmpfile=`mktemp $installdir/$1.XXXXXXXXX`
touch $tmpfile
if test ! -f $tmpfile; then
AC_ERROR([Could not create files in directory $installdir])
fi
BDEPS_FTPGET([$3/$2] , [$tmpfile])
mv $tmpfile $installdir/$filename
if test ! -s $installdir/$filename; then
AC_ERROR([Could not download $3/$2])
fi
case "$extension" in
zip) echo "Unzipping $installdir/$filename..."
(cd $installdir ; rm -f $installdir/$filename.unpacked ; $BDEPS_UNZIP $installdir/$filename > /dev/null && touch $installdir/$filename.unpacked)
;;
tar.gz) echo "Untaring $installdir/$filename..."
(cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked)
;;
tgz) echo "Untaring $installdir/$filename..."
(cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked)
;;
*) AC_ERROR([Cannot handle build depency archive with extension $extension])
;;
esac
fi
if test -f $installdir/$filename.unpacked; then
$5=$installdir
fi
])

@ -0,0 +1,28 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
LAUNCHER_NAME=java
PRODUCT_NAME="Java(TM)"
PRODUCT_SUFFIX="SE Runtime Environment"
JDK_RC_PLATFORM_NAME="Platform SE"
COMPANY_NAME="Oracle Corporation"

@ -0,0 +1,49 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#define PACKAGE_NAME "openjdk"
#define PACKAGE_TARNAME "openjdk"
#define PACKAGE_VERSION "version-0.1"
#define PACKAGE_STRING "openjdk version-0.1"
#define PACKAGE_BUGREPORT "build-infra-dev@openjdk.java.net"
#define PACKAGE_URL ""
#define STDC_HEADERS
#define HAVE_SYS_TYPES_H
#define HAVE_SYS_STAT_H
#define HAVE_STDLIB_H
#define HAVE_STRING_H
#define HAVE_MEMORY_H
#define HAVE_STRINGS_H
#define HAVE_INTTYPES_H
#define HAVE_STDINT_H
#define HAVE_UNISTD_H
#define SIZEOF_INT_P 8
#define HAVE_CUPS_CUPS_H
#define HAVE_CUPS_PPD_H
#define HAVE_LIBJPEG
#define HAVE_LIBGIF
#define HAVE_LIBZ
#define HAVE_LIBM
#define HAVE_ALTZONE

16395
common/autoconf/configure vendored Normal file

File diff suppressed because it is too large Load Diff

2651
common/autoconf/configure.ac Normal file

File diff suppressed because it is too large Load Diff

103
common/autoconf/cores.m4 Normal file

@ -0,0 +1,103 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
AC_DEFUN([CHECK_CORES],
[
AC_MSG_CHECKING([for number of cores])
NUM_CORES=1
FOUND_CORES=no
if test -f /proc/cpuinfo; then
# Looks like a Linux system
NUM_CORES=`cat /proc/cpuinfo | grep -c processor`
FOUND_CORES=yes
fi
if test -x /usr/sbin/psrinfo; then
# Looks like a Solaris system
NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
FOUND_CORES=yes
fi
if test -x /usr/sbin/system_profiler; then
# Looks like a MacOSX system
NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk '{print [$]5}'`
FOUND_CORES=yes
fi
if test "x$build_os" = xwindows; then
NUM_CORES=4
fi
# For c/c++ code we run twice as many concurrent build
# jobs than we have cores, otherwise we will stall on io.
CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2`
if test "x$FOUND_CORES" = xyes; then
AC_MSG_RESULT([$NUM_CORES])
else
AC_MSG_RESULT([could not detect number of cores, defaulting to 1!])
fi
])
AC_DEFUN([CHECK_MEMORY_SIZE],
[
AC_MSG_CHECKING([for memory size])
# Default to 1024MB
MEMORY_SIZE=1024
FOUND_MEM=no
if test -f /proc/cpuinfo; then
# Looks like a Linux system
MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'`
MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
FOUND_MEM=yes
fi
if test -x /usr/sbin/prtconf; then
# Looks like a Solaris system
MEMORY_SIZE=`/usr/sbin/prtconf | grep "Memory size" | awk '{ print [$]3 }'`
FOUND_MEM=yes
fi
if test -x /usr/sbin/system_profiler; then
# Looks like a MacOSX system
MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk '{print [$]2}'`
MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
FOUND_MEM=yes
fi
if test "x$build_os" = xwindows; then
MEMORY_SIZE=`systeminfo | grep 'Total Physical Memory:' | awk '{ print [$]4 }' | sed 's/,//'`
FOUND_MEM=yes
fi
if test "x$FOUND_MEM" = xyes; then
AC_MSG_RESULT([$MEMORY_SIZE MB])
else
AC_MSG_RESULT([could not detect memory size defaulting to 1024MB!])
fi
])

110
common/autoconf/help.m4 Normal file

@ -0,0 +1,110 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
function help_on_build_dependency {
# Print a helpful message on how to acquire the necessary build dependency.
# $1 is the help tag: freetyp2, cups, pulse, alsa etc
MISSING_DEPENDENCY=$1
PKGHANDLER_COMMAND=
AC_CHECK_PROGS(PKGHANDLER, apt-get yum port pkgutil pkgadd)
case $PKGHANDLER in
apt-get)
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
pkgutil_help $MISSING_DEPENDENCY ;;
pkgadd)
pkgadd_help $MISSING_DEPENDENCY ;;
* )
break ;;
esac
if test "x$PKGHANDLER_COMMAND" != x; then
HELP_MSG="Try running '$PKGHANDLER_COMMAND'."
fi
}
function apt_help {
case $1 in
devkit)
PKGHANDLER_COMMAND="sudo apt-get install build-essential" ;;
openjdk)
PKGHANDLER_COMMAND="sudo apt-get install openjdk-7-jdk" ;;
alsa)
PKGHANDLER_COMMAND="sudo apt-get install libasound2-dev" ;;
cups)
PKGHANDLER_COMMAND="sudo apt-get install libcups2-dev" ;;
freetype2)
PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;;
pulse)
PKGHANDLER_COMMAND="sudo apt-get install libpulse-dev" ;;
x11)
PKGHANDLER_COMMAND="sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev" ;;
ccache)
PKGHANDLER_COMMAND="sudo apt-get install ccache" ;;
* )
break ;;
esac
}
function yum_help {
case $1 in
devkit)
PKGHANDLER_COMMAND="sudo yum groupinstall \"Development Tools\"" ;;
openjdk)
PKGHANDLER_COMMAND="sudo yum install java-1.7.0-openjdk" ;;
alsa)
PKGHANDLER_COMMAND="sudo yum install alsa-lib-devel" ;;
cups)
PKGHANDLER_COMMAND="sudo yum install cups-devel" ;;
freetype2)
PKGHANDLER_COMMAND="sudo yum install freetype2-devel" ;;
pulse)
PKGHANDLER_COMMAND="sudo yum install pulseaudio-libs-devel" ;;
x11)
PKGHANDLER_COMMAND="sudo yum install libXtst-devel" ;;
ccache)
PKGHANDLER_COMMAND="sudo yum install ccache" ;;
* )
break ;;
esac
}
function port_help {
PKGHANDLER_COMMAND=""
}
function pkgutil_help {
PKGHANDLER_COMMAND=""
}
function pkgadd_help {
PKGHANDLER_COMMAND=""
}

517
common/autoconf/platform.m4 Normal file

@ -0,0 +1,517 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
AC_DEFUN([CHECK_FIND_DELETE],
[
# Test if find supports -delete
AC_MSG_CHECKING([if find supports -delete])
FIND_DELETE="-delete"
DELETEDIR=`mktemp -d tmp.XXXXXXXXXX` || (echo Could not create temporary directory!; exit $?)
echo Hejsan > $DELETEDIR/TestIfFindSupportsDelete
TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
if test -f $DELETEDIR/TestIfFindSupportsDelete; then
# No, it does not.
rm $DELETEDIR/TestIfFindSupportsDelete
FIND_DELETE="-exec rm \{\} \+"
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
rmdir $DELETEDIR
])
AC_DEFUN([CHECK_NONEMPTY],
[
# Test that variable $1 is not empty.
if test "" = "[$]$1"; then AC_ERROR(Could not find translit($1,A-Z,a-z) !); fi
])
AC_DEFUN([ADD_JVM_ARG_IF_OK],
[
# Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
# If so, then append $1 to $2
FOUND_WARN=`$3 $1 -version 2>&1 | grep -i warn`
FOUND_VERSION=`$3 $1 -version 2>&1 | grep " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
$2="[$]$2 $1"
fi
])
AC_DEFUN([WHICHCMD],
[
# Translate "gcc -E" into "`which gcc` -E" ie
# extract the full path to the binary and at the
# same time maintain any arguments passed to it.
# The command MUST exist in the path, or else!
tmp="[$]$1"
car="${tmp%% *}"
tmp="[$]$1 EOL"
cdr="${tmp#* }"
# On windows we want paths without spaces.
if test "x$BUILD_OS" = "xwindows"; then
WHICHCMD_SPACESAFE(car)
else
# "which" is not portable, but is used here
# because we know that the command exists!
car=`which $car`
fi
if test "x$cdr" != xEOL; then
$1="$car ${cdr% *}"
else
$1="$car"
fi
])
AC_DEFUN([SPACESAFE],
[
# Fail with message $2 if var $1 contains a path with no spaces in it.
# Unless on Windows, where we can rewrite the path.
HAS_SPACE=`echo "[$]$1" | grep " "`
if test "x$HAS_SPACE" != x; then
if test "x$BUILD_OS" = "xwindows"; then
$1=`$CYGPATH -s -m -a "[$]$1"`
$1=`$CYGPATH -u "[$]$1"`
else
AC_ERROR([You cannot have spaces in $2! "[$]$1"])
fi
fi
])
AC_DEFUN([WHICHCMD_SPACESAFE],
[
# Translate long cygdrive or C:\sdfsf path
# into a short mixed mode path that has no
# spaces in it.
tmp="[$]$1"
if test "x$BUILD_OS" = "xwindows"; then
tmp=`$CYGPATH -u "[$]$1"`
tmp=`which "$tmp"`
# If file exists with .exe appended, that's the real filename
# and cygpath needs that to convert to short style path.
if test -f "${tmp}.exe"; then
tmp="${tmp}.exe"
elif test -f "${tmp}.cmd"; then
tmp="${tmp}.cmd"
fi
# Convert to C:/ mixed style path without spaces.
tmp=`$CYGPATH -s -m "$tmp"`
fi
$1="$tmp"
])
AC_DEFUN([REMOVE_SYMBOLIC_LINKS],
[
if test "x$BUILD_OS" != xwindows; then
# Follow a chain of symbolic links. Use readlink
# where it exists, else fall back to horribly
# complicated shell code.
AC_PATH_PROG(READLINK, readlink)
if test "x$READLINK_TESTED" != yes; then
# On MacOSX there is a readlink tool with a different
# purpose than the GNU readlink tool. Check the found readlink.
ISGNU=`$READLINK --help 2>&1 | grep GNU`
if test "x$ISGNU" = x; then
# A readlink that we do not know how to use.
# Are there other non-GNU readlinks out there?
READLINK_TESTED=yes
READLINK=
fi
fi
if test "x$READLINK" != x; then
$1=`$READLINK -f [$]$1`
else
STARTDIR=$PWD
COUNTER=0
DIR=`dirname [$]$1`
FIL=`basename [$]$1`
while test $COUNTER -lt 20; do
ISLINK=`ls -l $DIR/$FIL | grep '\->' | sed -e 's/.*-> \(.*\)/\1/'`
if test "x$ISLINK" == x; then
# This is not a symbolic link! We are done!
break
fi
# The link might be relative! We have to use cd to travel safely.
cd $DIR
cd `dirname $ISLINK`
DIR=`pwd`
FIL=`basename $ISLINK`
let COUNTER=COUNTER+1
done
cd $STARTDIR
$1=$DIR/$FIL
fi
fi
])
AC_DEFUN([TESTFOR_PROG_CCACHE],
[
AC_ARG_ENABLE([ccache],
[AS_HELP_STRING([--disable-ccache],
[use ccache to speed up recompilations @<:@enabled@:>@])],
[ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
if test "x$ENABLE_CCACHE" = xyes; then
AC_PATH_PROG(CCACHE, ccache)
else
AC_MSG_CHECKING([for ccache])
AC_MSG_RESULT([explicitly disabled])
CCACHE=
fi
AC_SUBST(CCACHE)
AC_ARG_WITH([ccache-dir],
[AS_HELP_STRING([--with-ccache-dir],
[where to store ccache files @<:@~/.ccache@:>@])])
if test "x$with_ccache_dir" != x; then
# When using a non home ccache directory, assume the use is to share ccache files
# with other users. Thus change the umask.
SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
fi
CCACHE_FOUND=""
if test "x$CCACHE" != x; then
SETUP_CCACHE_USAGE
fi
])
AC_DEFUN([SETUP_CCACHE_USAGE],
[
if test "x$CCACHE" != x; then
CCACHE_FOUND="true"
# Only use ccache if it is 3.1.4 or later, which supports
# precompiled headers.
AC_MSG_CHECKING([if ccache supports precompiled headers])
HAS_GOOD_CCACHE=`($CCACHE --version | head -n 1 | grep -E 3.1.@<:@456789@:>@) 2> /dev/null`
if test "x$HAS_GOOD_CCACHE" = x; then
AC_MSG_RESULT([no, disabling ccache])
CCACHE=
else
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
PUSHED_FLAGS="$CXXFLAGS"
CXXFLAGS="-fpch-preprocess $CXXFLAGS"
AC_TRY_COMPILE([], [], [CC_KNOWS_CCACHE_TRICK=yes], [CC_KNOWS_CCACHE_TRICK=no])
CXXFLAGS="$PUSHED_FLAGS"
if test "x$CC_KNOWS_CCACHE_TRICK" = xyes; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no, disabling ccaching of precompiled headers])
CCACHE=
fi
fi
fi
if test "x$CCACHE" != x; then
CCACHE_SLOPPINESS=time_macros
CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS $CCACHE"
CCACHE_FLAGS=-fpch-preprocess
if test "x$SET_CCACHE_DIR" != x; then
mkdir -p $CCACHE_DIR > /dev/null 2>&1
chmod a+rwxs $CCACHE_DIR > /dev/null 2>&1
fi
fi
])
AC_DEFUN([EXTRACT_HOST_AND_BUILD_AND_LEGACY_VARS],
[
# Expects $host_os $host_cpu $build_os and $build_cpu
# and $with_data_model to have been setup!
#
# Translate the standard triplet(quadruplet) definition
# of the host/build system into
# HOST_OS=aix,bsd,hpux,linux,macosx,solaris,windows
# HOST_OS_FAMILY=bsd,gnu,sysv,win32,wince
# HOST_OS_API=posix,winapi
#
# HOST_CPU=ia32,x64,sparc,sparcv9,arm,arm64,ppc,ppc64
# HOST_CPU_ARCH=x86,sparc,pcc,arm
# HOST_CPU_BITS=32,64
# HOST_CPU_ENDIAN=big,little
#
# The same values are setup for BUILD_...
#
# And the legacy variables, for controlling the old makefiles.
# LEGACY_HOST_CPU1=i586,amd64,sparc,sparcv9,arm,arm64...
# LEGACY_HOST_CPU2=i386,amd64,sparc,sparcv9,arm,arm64...
# LEGACY_HOST_CPU3=sparcv9,amd64 (but only on solaris)
# LEGACY_HOST_OS_API=solaris,windows
#
# We also copy the autoconf trip/quadruplet
# verbatim to HOST and BUILD
AC_SUBST(HOST, ${host})
AC_SUBST(BUILD, ${build})
EXTRACT_VARS_FROM_OS_TO(HOST,$host_os)
EXTRACT_VARS_FROM_CPU_TO(HOST,$host_cpu)
EXTRACT_VARS_FROM_OS_TO(BUILD,$build_os)
EXTRACT_VARS_FROM_CPU_TO(BUILD,$build_cpu)
if test "x$HOST_OS" != xsolaris; then
LEGACY_HOST_CPU3=""
LEGACY_BUILD_CPU3=""
fi
])
AC_DEFUN([EXTRACT_VARS_FROM_OS_TO],
[
EXTRACT_VARS_FROM_OS($2)
$1_OS="$VAR_OS"
$1_OS_FAMILY="$VAR_OS_FAMILY"
$1_OS_API="$VAR_OS_API"
AC_SUBST($1_OS)
AC_SUBST($1_OS_FAMILY)
AC_SUBST($1_OS_API)
if test "x$$1_OS_API" = xposix; then
LEGACY_$1_OS_API="solaris"
fi
if test "x$$1_OS_API" = xwinapi; then
LEGACY_$1_OS_API="windows"
fi
AC_SUBST(LEGACY_$1_OS_API)
])
AC_DEFUN([EXTRACT_VARS_FROM_CPU_TO],
[
EXTRACT_VARS_FROM_CPU($2)
$1_CPU="$VAR_CPU"
$1_CPU_ARCH="$VAR_CPU_ARCH"
$1_CPU_BITS="$VAR_CPU_BITS"
$1_CPU_ENDIAN="$VAR_CPU_ENDIAN"
AC_SUBST($1_CPU)
AC_SUBST($1_CPU_ARCH)
AC_SUBST($1_CPU_BITS)
AC_SUBST($1_CPU_ENDIAN)
# Also store the legacy naming of the cpu.
# Ie i586 and amd64 instead of ia32 and x64
LEGACY_$1_CPU1="$VAR_LEGACY_CPU"
AC_SUBST(LEGACY_$1_CPU1)
# And the second legacy naming of the cpu.
# Ie i386 and amd64 instead of ia32 and x64.
LEGACY_$1_CPU2="$LEGACY_$1_CPU1"
if test "x$LEGACY_$1_CPU1" = xi586; then
LEGACY_$1_CPU2=i386
fi
AC_SUBST(LEGACY_$1_CPU2)
# And the third legacy naming of the cpu.
# Ie only amd64 or sparcv9, used for the ISA_DIR on Solaris.
LEGACY_$1_CPU3=""
if test "x$$1_CPU" = xx64; then
LEGACY_$1_CPU3=amd64
fi
if test "x$$1_CPU" = xsparcv9; then
LEGACY_$1_CPU3=sparvc9
fi
AC_SUBST(LEGACY_$1_CPU3)
])
AC_DEFUN([EXTRACT_VARS_FROM_CPU],
[
# First argument is the cpu name from the trip/quad
case "$1" in
x86_64)
VAR_CPU=x64
VAR_CPU_ARCH=x86
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
VAR_LEGACY_CPU=amd64
;;
i?86)
VAR_CPU=ia32
VAR_CPU_ARCH=x86
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
VAR_LEGACY_CPU=i586
;;
alpha*)
VAR_CPU=alpha
VAR_CPU_ARCH=alpha
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
VAR_LEGACY_CPU=alpha
;;
arm*)
VAR_CPU=arm
VAR_CPU_ARCH=arm
VAR_CPU_BITS=3264
VAR_CPU_ENDIAN=big
VAR_LEGACY_CPU=arm
;;
mips)
VAR_CPU=mips
VAR_CPU_ARCH=mips
VAR_CPU_BITS=woot
VAR_CPU_ENDIAN=woot
VAR_LEGACY_CPU=mips
;;
mipsel)
VAR_CPU=mipsel
VAR_CPU_ARCH=mips
VAR_CPU_BITS=woot
VAR_CPU_ENDIAN=woot
VAR_LEGACY_CPU=mipsel
;;
powerpc)
VAR_CPU=ppc
VAR_CPU_ARCH=ppc
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
VAR_LEGACY_CPU=ppc
;;
powerpc64)
VAR_CPU=ppc64
VAR_CPU_ARCH=ppc
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=32
VAR_LEGACY_CPU=ppc64
;;
sparc)
VAR_CPU=sparc
VAR_CPU_ARCH=sparc
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
VAR_LEGACY_CPU=sparc
;;
sparc64)
VAR_CPU=sparcv9
VAR_CPU_ARCH=sparc
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
VAR_LEGACY_CPU=sparc_sparcv9
;;
s390)
VAR_CPU=s390
VAR_CPU_ARCH=s390
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=woot
VAR_LEGACY_CPU=s390
VAR_LEGACY_CPU=s390
;;
s390x)
VAR_CPU=s390x
VAR_CPU_ARCH=s390
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=woot
VAR_LEGACY_CPU=s390x
;;
*)
AC_ERROR([unsupported cpu $1])
;;
esac
# Workaround cygwin not knowing about 64 bit.
if test "x$VAR_OS" = "xwindows"; then
if test "x$PROCESSOR_IDENTIFIER" != "x"; then
PROC_ARCH=`echo $PROCESSOR_IDENTIFIER | $CUT -f1 -d' '`
case "$PROC_ARCH" in
intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64)
VAR_CPU=x64
VAR_CPU_BITS=64
VAR_LEGACY_CPU=amd64
;;
esac
fi
fi
if test "x$VAR_CPU_ARCH" = "xx86"; then
if test "x$with_data_model" = "x64"; then
VAR_CPU=x64
VAR_CPU_BITS=64
VAR_LEGACY_CPU=amd64
fi
if test "x$with_data_model" = "x32"; then
VAR_CPU=ia32
VAR_CPU_BITS=32
VAR_LEGACY_CPU=i586
fi
fi
])
AC_DEFUN([EXTRACT_VARS_FROM_OS],
[
case "$1" in
*linux*)
VAR_OS=linux
VAR_OS_API=posix
VAR_OS_FAMILY=gnu
;;
*solaris*)
VAR_OS=solaris
VAR_OS_API=posix
VAR_OS_FAMILY=sysv
;;
*darwin*)
VAR_OS=macosx
VAR_OS_API=posix
VAR_OS_FAMILY=bsd
;;
*bsd*)
VAR_OS=bsd
VAR_OS_API=posix
VAR_OS_FAMILY=bsd
;;
*cygwin*|*windows*)
VAR_OS=windows
VAR_OS_API=winapi
VAR_OS_FAMILY=windows
;;
*)
AC_MSG_ERROR([unsupported host operating system $1])
;;
esac
])
AC_DEFUN([CHECK_COMPILER_VERSION],
[
# Test the compilers that their versions are new enough.
# AC_MSG_CHECKING([version of GCC])
gcc_ver=`${CC} -dumpversion`
gcc_major_ver=`echo ${gcc_ver}|cut -d'.' -f1`
gcc_minor_ver=`echo ${gcc_ver}|cut -d'.' -f2`
# AM_CONDITIONAL(GCC_OLD, test ! ${gcc_major_ver} -ge 4 -a ${gcc_minor_ver} -ge 3)
# AC_MSG_RESULT([${gcc_ver} (major version ${gcc_major_ver}, minor version ${gcc_minor_ver})])
])
# Fixes paths on windows hosts to be mixed mode short.
AC_DEFUN([WIN_FIX_PATH],
[
if test "x$BUILD_OS" = "xwindows"; then
AC_PATH_PROG(CYGPATH, cygpath)
tmp="[$]$1"
# Convert to C:/ mixed style path without spaces.
tmp=`$CYGPATH -s -m "$tmp"`
$1="$tmp"
fi
])

588
common/autoconf/spec.gmk.in Normal file

@ -0,0 +1,588 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Configured @DATE_WHEN_CONFIGURED@ to build for a @HOST@ system,
# using ./configure @CONFIGURE_COMMAND_LINE@
# When calling macros, the spaces between arguments are
# often semantically important! Sometimes we need to subst
# spaces and commas, therefore we need the following macros.
X:=
SPACE:=$(X) $(X)
COMMA:=,
HASH:=\#
SQUOTE:='
#'
DQUOTE:="
#"
define NEWLINE:=
endef
# Pass along the verbosity setting.
ifeq (,$(findstring VERBOSE=,$(MAKE)))
MAKE:=$(MAKE) $(VERBOSE) VERBOSE="$(VERBOSE)"
endif
# No implicit variables or rules!
ifeq (,$(findstring -R,$(MAKE)))
MAKE:=$(MAKE) -R
endif
# Specify where the spec file is.
ifeq (,$(findstring SPEC=,$(MAKE)))
MAKE:=$(MAKE) SPEC=@SPEC@
endif
# Specify where the common include directory for makefiles is.
ifeq (,$(findstring -I @SRC_ROOT@/common/makefiles,$(MAKE)))
MAKE:=$(MAKE) -I @SRC_ROOT@/common/makefiles
endif
# A self-referential reference to this file.
SPEC:=@SPEC@
# The built jdk will run in this host system.
HOST:=@HOST@
HOST_OS:=@HOST_OS@
HOST_OS_FAMILY:=@HOST_OS_FAMILY@
HOST_OS_API:=@HOST_OS_API@
HOST_CPU:=@HOST_CPU@
HOST_CPU_ARCH:=@HOST_CPU_ARCH@
HOST_CPU_BITS:=@HOST_CPU_BITS@
HOST_CPU_ENDIAN:=@HOST_CPU_ENDIAN@
# We are building on this build system.
# When not cross-compiling, it is the same as the host.
BUILD:=@BUILD@
BUILD_OS:=@BUILD_OS@
BUILD_OS_FAMILY:=@BUILD_OS_FAMILY@
BUILD_OS_API:=@BUILD_OS_API@
BUILD_CPU:=@BUILD_CPU@
BUILD_CPU_ARCH:=@BUILD_CPU_ARCH@
BUILD_CPU_BITS:=@BUILD_CPU_BITS@
BUILD_CPU_ENDIAN:=@BUILD_CPU_ENDIAN@
# Old name for HOST_OS (aix,bsd,hpux,linux,macosx,solaris,windows etc)
PLATFORM:=@HOST_OS@
# Old name for HOST_CPU, uses i586 and amd64, instead of ia32 and x64.
ARCH:=@LEGACY_HOST_CPU1@
# Yet another name for arch used for an extra subdir below the jvm lib.
# Uses i386 and amd64, instead of ia32 and x64.
LIBARCH:=@LEGACY_HOST_CPU2@
# Use to switch between solaris and windows subdirs in the jdk.
LEGACY_HOST_OS_API:=@LEGACY_HOST_OS_API@
# 32 or 64 bit
ARCH_DATA_MODEL:=@HOST_CPU_BITS@
# Legacy setting for building for a 64 bit machine.
# If yes then this expands to _LP64:=1
@LP64@
ENDIAN:=@HOST_CPU_ENDIAN@
@SET_OPENJDK@
JIGSAW:=@JIGSAW@
LIBM:=-lm
# colon or semicolon
PATH_SEP:=@PATH_SEP@
# Set special env variables, to be passed to external tools.
# Used for cygwin setups.
@SETUPDEVENV@
# The sys root where standard headers and libraries are found.
# Usually not needed since the configure script should have
# taken it into account already when setting CFLAGS et al.
SYS_ROOT:=@SYS_ROOT@
# Paths to the source code
SRC_ROOT:=@SRC_ROOT@
ADD_SRC_ROOT:=@ADD_SRC_ROOT@
OVERRIDE_SRC_ROOT:=@OVERRIDE_SRC_ROOT@
TOPDIR:=@SRC_ROOT@
OUTPUT_ROOT:=@OUTPUT_ROOT@
JDK_MAKE_SHARED_DIR:=@JDK_TOPDIR@/makefiles/common/shared
JDK_TOPDIR:=@JDK_TOPDIR@
LANGTOOLS_TOPDIR:=@LANGTOOLS_TOPDIR@
CORBA_TOPDIR:=@CORBA_TOPDIR@
JAXP_TOPDIR:=@JAXP_TOPDIR@
JAXWS_TOPDIR:=@JAXWS_TOPDIR@
HOTSPOT_TOPDIR:=@HOTSPOT_TOPDIR@
COPYRIGHT_YEAR:=@COPYRIGHT_YEAR@
# Information gathered from the version.numbers file.
JDK_MAJOR_VERSION:=@JDK_MAJOR_VERSION@
JDK_MINOR_VERSION:=@JDK_MINOR_VERSION@
JDK_MICRO_VERSION:=@JDK_MICRO_VERSION@
JDK_UPDATE_VERSION:=@JDK_UPDATE_VERSION@
JDK_BUILD_NUMBER:=@JDK_BUILD_NUMBER@
MILESTONE:=@MILESTONE@
LAUNCHER_NAME:=@LAUNCHER_NAME@
PRODUCT_NAME:=@PRODUCT_NAME@
PRODUCT_SUFFIX:=@PRODUCT_SUFFIX@
JDK_RC_PLATFORM_NAME:=@JDK_RC_PLATFORM_NAME@
COMPANY_NAME:=@COMPANY_NAME@
# Different version strings generated from the above information.
JDK_VERSION:=@JDK_VERSION@
RUNTIME_NAME:=@RUNTIME_NAME@
FULL_VERSION:=@FULL_VERSION@
JRE_RELEASE_VERSION:=@FULL_VERSION@
RELEASE:=@RELEASE@
COOKED_BUILD_NUMBER:=@COOKED_BUILD_NUMBER@
# How to compile the code: release, fastdebug or slowdebug
DEBUG_LEVEL:=@DEBUG_LEVEL@
# This is the JDK variant to build.
# The JDK variant is a name for a specific set of modules to be compiled for the JDK.
JDK_VARIANT:=@JDK_VARIANT@
# Legacy defines controlling the JDK variant embedded.
@JAVASE_EMBEDDED@
@MINIMIZE_RAM_USAGE@
# Should we compile support for running with a graphical UI? (ie headful)
# Should we compile support for running without? (ie headless)
SUPPORT_HEADFUL:=@SUPPORT_HEADFUL@
SUPPORT_HEADLESS:=@SUPPORT_HEADLESS@
# Legacy defines controlled by the SUPPORT_HEADLESS and SUPPORT_HEADFUL options.
@BUILD_HEADLESS@
@BUILD_HEADLESS_ONLY@
# These are the libjvms that we want to build.
# The java launcher uses the default.
# The other can be selected by specifying -client -server -kernel -zero or -zeroshark
# on the java launcher command line.
DEFAULT_JVM_VARIANT:=@DEFAULT_JVM_VARIANT@
JVM_VARIANTS:=@JVM_VARIANTS@
JVM_VARIANT_SERVER:=@JVM_VARIANT_SERVER@
JVM_VARIANT_CLIENT:=@JVM_VARIANT_CLIENT@
JVM_VARIANT_KERNEL:=@JVM_VARIANT_KERNEL@
JVM_VARIANT_ZERO:=@JVM_VARIANT_ZERO@
JVM_VARIANT_ZEROSHARK:=@JVM_VARIANT_ZEROSHARK@
# Legacy setting: OPT or DBG
VARIANT:=@VARIANT@
# Legacy setting: true or false
FASTDEBUG:=@FASTDEBUG@
# Legacy setting: debugging the class files?
DEBUG_CLASSFILES:=@DEBUG_CLASSFILES@
# Legacy setting: -debug or -fastdebug
BUILD_VARIANT_RELEASE:=@BUILD_VARIANT_RELEASE@
LANGTOOLS_OUTPUTDIR:=@OUTPUT_ROOT@/langtools
LANGTOOLS_DIST:=@OUTPUT_ROOT@/langtools/dist
LANGTOOLS_MAKE_ARGS:=@LANGTOOLS_MAKE_ARGS@
CORBA_OUTPUTDIR:=@OUTPUT_ROOT@/corba
CORBA_DIST:=@OUTPUT_ROOT@/corba/dist
CORBA_MAKE_ARGS:=@CORBA_MAKE_ARGS@
JAXP_OUTPUTDIR:=@OUTPUT_ROOT@/jaxp
JAXP_DIST:=@OUTPUT_ROOT@/jaxp/dist
JAXP_MAKE_ARGS:=@JAXP_MAKE_ARGS@
JAXWS_OUTPUTDIR:=@OUTPUT_ROOT@/jaxws
JAXWS_DIST:=@OUTPUT_ROOT@/jaxws/dist
JAXWS_MAKE_ARGS:=@JAXWS_MAKE_ARGS@
HOTSPOT_OUTPUTDIR:=@OUTPUT_ROOT@/hotspot
HOTSPOT_DIST:=@OUTPUT_ROOT@/hotspot/dist
HOTSPOT_MAKE_ARGS:=@HOTSPOT_MAKE_ARGS@
# This where a working jvm is built.
# You can run $(JDK_OUTPUTDIR)/bin/java
# Though the layout of the contents of $(JDK_OUTPUTDIR) is not
# yet the same as a default installation.
HOTSPOT_IMPORT_PATH:=@OUTPUT_ROOT@/hotspot/dist
JDK_OUTPUTDIR:=@OUTPUT_ROOT@/jdk
JDK_MAKE_ARGS:=@JDK_MAKE_ARGS@
# When you run "make install" it will create the standardized
# layout for the jdk and the jre inside the images subdir.
# Then it will copy the contents of the jdk into the installation
# directory.
IMAGES_OUTPUTDIR:=@OUTPUT_ROOT@/images
IMAGES_MAKE_ARGS:=@IMAGES_MAKE_ARGS@
# Legacy variables used by Release.gmk
JDK_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2sdk-image
JRE_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2re-image
# Can be /sparcv9 or /amd64 on Solaris
ISA_DIR:=@LEGACY_HOST_CPU3@
BINDIR:=$(JDK_OUTPUTDIR)/bin$(ISA_DIR)
# The boot jdk to use
ALT_BOOTDIR:=@BOOT_JDK@
BOOT_JDK:=@BOOT_JDK@
BOOT_JDK_JVMARGS:=@BOOT_JDK_JVMARGS@
BOOT_JAVAC_ARGS:=@BOOT_JAVAC_ARGS@
BOOT_RTJAR:=@BOOT_RTJAR@
BOOT_TOOLSJAR:=@BOOT_TOOLSJAR@
# When compiling Java source to be run by the boot jdk
# use these extra flags, eg -source 6 -target 6
BOOT_JDK_SOURCETARGET:=@BOOT_JDK_SOURCETARGET@
# Information about the build system
NUM_CORES:=@NUM_CORES@
# This is used from the libjvm build for C/C++ code.
HOTSPOT_BUILD_JOBS:=@CONCURRENT_BUILD_JOBS@
# This is used from the jdk build for C/C++ code.
PARALLEL_COMPILE_JOBS:=@CONCURRENT_BUILD_JOBS@
# Store javac server synchronization files here, and
# the javac server log files.
JAVAC_SERVERS:=@JAVAC_SERVERS@
# Should we use a javac server or not? The javac server gives
# an enormous performance improvement since it reduces the
# startup costs of javac and reuses as much as possible of intermediate
# compilation work. But if we want to compile with a non-Java
# javac compiler, like gcj. Then we cannot use javac server and
# this variable is set to false.
JAVAC_USE_REMOTE:=@JAVAC_USE_REMOTE@
# We can block the Javac server to never use more cores than this.
# This is not for performance reasons, but for memory usage, since each
# core requires its own JavaCompiler. We might have 64 cores and 4GB
# of memory, 64 JavaCompilers will currently not fit in a 3GB heap.
# Since there is no sharing of data between the JavaCompilers.
JAVAC_SERVER_CORES:=@JAVAC_SERVER_CORES@
# Should we use dependency tracking between Java packages? true or false.
JAVAC_USE_DEPS:=@JAVAC_USE_DEPS@
# We can invoke javac: SINGLE_THREADED_BATCH or MULTI_CORE_CONCURRENT
JAVAC_USE_MODE:=@JAVAC_USE_MODE@
# The OpenJDK makefiles should be changed to using the standard
# configure output ..._CFLAGS and ..._LIBS. In the meantime we
# extract the information here.
FREETYPE2_LIB_PATH:=@FREETYPE2_LIB_PATH@
FREETYPE2_LIBS:=@FREETYPE2_LIBS@
FREETYPE2_CFLAGS:=@FREETYPE2_CFLAGS@
USING_SYSTEM_FT_LIB=@USING_SYSTEM_FT_LIB@
ALT_CUPS_HEADERS_PATH:=$(patsubst -I%,%,$(filter -I%,@CUPS_CFLAGS@))
CUPS_CFLAGS:=@CUPS_CFLAGS@
PACKAGE_PATH=@PACKAGE_PATH@
CACERTS_FILE:=$(SRC_ROOT)/jdk/src/share/lib/security/cacerts
#CACERTS_INT=$(CLOSED_SHARE_SRC)/lib/security/cacerts.internal
#MOZILLA_HEADERS_PATH:=
# Necessary additional compiler flags to compile X11
X_CFLAGS:=@X_CFLAGS@
X_LIBS:=@X_LIBS@
OPENWIN_HOME:=@OPENWIN_HOME@
# There are two types: CC or CL
# CC is gcc and others behaving reasonably similar.
# CL is cl.exe only.
COMPILER_TYPE:=@COMPILER_TYPE@
CC_OUT_OPTION:=@CC_OUT_OPTION@
EXE_OUT_OPTION:=@EXE_OUT_OPTION@
LD_OUT_OPTION:=@LD_OUT_OPTION@
AR_OUT_OPTION:=@AR_OUT_OPTION@
# Flags used for overriding the default opt setting for a C/C++ source file.
C_O_FLAG_HI:=@C_O_FLAG_HI@
C_O_FLAG_NORM:=@C_O_FLAG_NORM@
C_O_FLAG_NONE:=@C_O_FLAG_NONE@
CXX_O_FLAG_HI:=@CXX_O_FLAG_HI@
CXX_O_FLAG_NORM:=@CXX_O_FLAG_NORM@
CXX_O_FLAG_NONE:=@CXX_O_FLAG_NONE@
# Tools that potentially need to be cross compilation aware.
CC:=@UNCYGDRIVE@ @CCACHE@ @CC@
# CFLAGS used to compile the jdk native libraries (C-code)
CFLAGS_JDKLIB:=@CFLAGS_JDKLIB@
CXXFLAGS_JDKLIB:=@CXXFLAGS_JDKLIB@
# CFLAGS used to compile the jdk native launchers (C-code)
CFLAGS_JDKEXE:=@CFLAGS_JDKEXE@
CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@
CXX:=@UNCYGDRIVE@ @CCACHE@ @CXX@
#CXXFLAGS:=@CXXFLAGS@
OBJC:=@CCACHE@ @OBJC@
#OBJCFLAGS:=@OBJCFLAGS@
CPP:=@UNCYGDRIVE@ @CPP@
#CPPFLAGS:=@CPPFLAGS@
# The linker can be gcc or ld on posix systems, or link.exe on winapi systems.
LD:=@UNCYGDRIVE@ @LD@
# LDFLAGS used to link the jdk native libraries (C-code)
LDFLAGS_JDKLIB:=@LDFLAGS_JDKLIB@
LDFLAGS_JDKLIB_SUFFIX:=@LDFLAGS_JDKLIB_SUFFIX@
# On some platforms the linker cannot be used to create executables, thus
# the need for a separate LDEXE command.
LDEXE:=@UNCYGDRIVE@ @LDEXE@
# LDFLAGS used to link the jdk native launchers (C-code)
LDFLAGS_JDKEXE:=@LDFLAGS_JDKEXE@
LDFLAGS_JDKEXE_SUFFIX:=@LDFLAGS_JDKEXE_SUFFIX@
# Sometimes a different linker is needed for c++ libs
LDCXX:=@UNCYGDRIVE@ @LDCXX@
# The flags for linking libstdc++ linker.
LIBCXX:=@LIBCXX@
# Sometimes a different linker is needed for c++ executables
LDEXECXX:=@UNCYGDRIVE@ @LDEXECXX@
# If cross compiling, then define CROSS_COMPILE_ARCH:=cpu_name here.
@DEFINE_CROSS_COMPILE_ARCH@
# The HOSTCC should really be named BUILDCC, ie build executable for
# the build platform. Same as CC when not cross compiling.
HOSTCC:=@HOSTCC@
HOSTCXX:=@HOSTCXX@
# And of course, the jdk spells HOSTCC as NIO_CC/HOST_CC
HOST_CC:=@HOSTCC@
NIO_CC:=@HOSTCC@
AS:=@AS@
ASFLAGS:=@ASFLAGS@
# AR is used to create a static library (is ar in posix, lib.exe in winapi)
AR:=@UNCYGDRIVE@ @AR@
ARFLAGS:=@ARFLAGS@
NM:=@NM@
STRIP:=@STRIP@
MCS:=@MCS@
# Command to create a shared library
SHARED_LIBRARY_FLAGS:=@SHARED_LIBRARY_FLAGS@
# Options to linker to specify a mapfile.
# (Note absence of := assignment, because we do not want to evaluate the macro body here)
SET_SHARED_LIBRARY_MAPFILE=@SET_SHARED_LIBRARY_MAPFILE@
# Options to linker to specify the library name.
# (Note absence of := assignment, because we do not want to evaluate the macro body here)
SET_SHARED_LIBRARY_NAME=@SET_SHARED_LIBRARY_NAME@
# Set origin using the linker, ie use the relative path to the dependent library to find the dependees.
# (Note absence of := assignment, because we do not want to evaluate the macro body here)
SET_SHARED_LIBRARY_ORIGIN=@SET_SHARED_LIBRARY_ORIGIN@
# Different OS:es have different ways of naming shared libraries.
# The SHARED_LIBRARY macro takes "verify" as and argument and returns:
# "libverify.so" or "libverify.dylib" or "verify.dll" depending on platform.
# (Note absence of := assignment, because we do not want to evaluate the macro body here)
SHARED_LIBRARY=@SHARED_LIBRARY@
STATIC_LIBRARY=@STATIC_LIBRARY@
LIBRARY_PREFIX:=@LIBRARY_PREFIX@
SHARED_LIBRARY_SUFFIX:=@SHARED_LIBRARY_SUFFIX@
STATIC_LIBRARY_SUFFIX:=@STATIC_LIBRARY_SUFFIX@
EXE_SUFFIX:=@EXE_SUFFIX@
OBJ_SUFFIX:=@OBJ_SUFFIX@
JAVA_FLAGS:=@BOOT_JDK_JVMARGS@
JAVA=@UNCYGDRIVE@ @JAVA@ $(JAVA_FLAGS)
JAVAC:=@UNCYGDRIVE@ @JAVAC@
JAVAC_FLAGS:=@JAVAC_FLAGS@
JAVAH:=@UNCYGDRIVE@ @JAVAH@
JAR:=@UNCYGDRIVE@ @JAR@
RMIC:=@UNCYGDRIVE@ @RMIC@
BOOT_JAR_CMD:=@UNCYGDRIVE@ @JAR@
BOOT_JAR_JFLAGS:=
# Base flags for RC
# Guarding this against resetting value. Legacy make files include spec multiple
# times.
ifndef RC_FLAGS
RC_FLAGS:=@RC_FLAGS@
endif
# A specific java binary with specific options can be used to run
# the long running background javac server and other long running tasks.
SERVER_JAVA:=@UNCYGDRIVE@ @SERVER_JAVA@
# Tools adhering to a minimal and common standard of posix compliance.
AWK:=@AWK@
CAT:=@CAT@
CCACHE:=@CCACHE@
# CD is going away, but remains to cater for legacy makefiles.
CD:=cd
CHMOD:=@CHMOD@
CP:=@CP@
CPIO:=@CPIO@
CUT:=@CUT@
DATE:=@DATE@
DF:=@DF@
DIFF:=@DIFF@
FIND:=@FIND@
FIND_DELETE:=@FIND_DELETE@
ECHO:=@ECHO@
EGREP:=@EGREP@
FGREP:=@FGREP@
GREP:=@GREP@
HEAD:=@HEAD@
LS:=@LS@
LN:=@LN@
MKDIR:=@MKDIR@
MV:=@MV@
NAWK:=@NAWK@
PRINTF:=@PRINTF@
PWD:=@THEPWDCMD@
RM:=@RM@
SED:=@SED@
SH:=@SH@
SORT:=@SORT@
TAR:=@TAR@
TAIL:=@TAIL@
TEE:=@TEE@
TR:=@TR@
TOUCH:=@TOUCH@
WC:=@WC@
XARGS:=@XARGS@
ZIPEXE:=@ZIP@
ZIP:=@ZIP@
UNZIP:=@UNZIP@
MT:=@UNCYGDRIVE@ @MT@
RC:=@UNCYGDRIVE@ @RC@
DUMPBIN:=@UNCYGDRIVE@ @DUMPBIN@
CYGPATH:=@CYGPATH@
LDD:=@LDD@
OTOOL:=@OTOOL@
READELF:=@READELF@
EXPR:=@EXPR@
FILE:=@FILE@
UNCYGDRIVE:=@UNCYGDRIVE@
# Where the build output is stored for your convenience.
BUILD_LOG:=@BUILD_LOG@
BUILD_LOG_WRAPPER:=@BUILD_LOG_WRAPPER@
# Build setup
ENABLE_DOCS:=@ENABLE_DOCS@
GENERATE_DOCS:=@ENABLE_DOCS@
DISABLE_NIMBUS:=@DISABLE_NIMBUS@
USE_EXTERNAL_LIBJPEG:=@USE_EXTERNAL_LIBJPEG@
USE_EXTERNAL_LIBGIF:=@USE_EXTERNAL_LIBGIF@
USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@
CHECK_FOR_VCINSTALLDIR=@CHECK_FOR_VCINSTALLDIR@
MSVCRNN_DLL:=@MSVCR100DLL@
# ADD_SRCS takes a single argument with source roots
# and appends any corresponding source roots found
# below --with-add-source-root and below
# --with-override-source-root. It is the responsibility
# of the next macro to get rid of superfluous files.
ADD_SRCS=$1
ifneq (,$(ADD_SRC_ROOT))
# Append wildcard rule to pickup any matching source roots found below ADD_SRC_ROOT
ADD_SRCS+=$(wildcard $(subst $(SRC_ROOT),$(ADD_SRC_ROOT),$1))
endif
ifneq (,$(OVERRIDE_SRC_ROOT))
# Append wildcard rule to pickup any matching source roots found below OVERRIDE_SRC_ROOT
ADD_SRCS+=$(wildcard $(subst $(SRC_ROOT),$(OVERRIDE_SRC_ROOT),$1))
endif
# OVR_SRCS creates a filter expression to filter out sources in
# the original source directory that lie inside directories below
# --with-override-source-root.
# Use := here since we want to scan for these files here. To avoid recomputation later.
# We cannot do the scan in configure, since that would force us to rerun configure when
# we add overridden sources.
ifneq (,$(OVERRIDE_SRC_ROOT))
OVR_SRCS:=$(addsuffix %,$(subst $(OVERRIDE_SRC_ROOT),$(SRC_ROOT),$(sort $(dir $(shell $(FIND) $(OVERRIDE_SRC_ROOT) -type f)))))
else
OVR_SRCS:=
endif
####################################################
#
# INSTALLATION
#
# Common prefix for all installed files. Defaults to /usr/local,
# but /opt/myjdk is another common version.
INSTALL_PREFIX=@prefix@
# Directories containing architecture-dependent files should be relative to exec_prefix
INSTALL_EXECPREFIX=@exec_prefix@
# java,javac,javah,javap etc are installed here.
INSTALL_BINDIR=@bindir@
# Read only architecture-independent data
INSTALL_DATADIR=@datadir@
# Root of above.
INSTALL_DATAROOTDIR=@datarootdir@
# Doc files, other than info and man.
INSTALL_DOCDIR=@docdir@
# Html documentation
INSTALL_HTMLDIR=@htmldir@
# Installing C header files, JNI headers for example.
INSTALL_INCLUDEDIR=@includedir@
# Installing library files....
INSTALL_INCLUDEDIR=@libdir@
# Executables that other programs run.
INSTALL_LIBEXECDIR=@libexecdir@
# Locale-dependent but architecture-independent data, such as message catalogs.
INSTALL_LOCALEDIR=@localedir@
# Modifiable single-machine data
INSTALL_LOCALSTATEDIR=@localstatedir@
# Man pages
INSTALL_MANDIR=@mandir@
# Modifiable architecture-independent data.
INSTALL_SHAREDSTATEDIR=@sharedstatedir@
# Read-only single-machine data
INSTALL_SYSCONFDIR=@sysconfdir@
####################################################
#
# Misc
#
# Control wether Hotspot runs Queens test after building
TEST_IN_BUILD=@TEST_IN_BUILD@

@ -0,0 +1,36 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
JDK_MAJOR_VERSION=1
JDK_MINOR_VERSION=8
JDK_MICRO_VERSION=0
JDK_UPDATE_VERSION=
JDK_BUILD_NUMBER=
MILESTONE=internal
LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK
PRODUCT_SUFFIX="Runtime Environment"
JDK_RC_PLATFORM_NAME=Platform
COMPANY_NAME=N/A

283
common/bin/compareimage.sh Normal file

@ -0,0 +1,283 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# MANUAL
#
# ./common/bin/compareimages.sh old_jdk_image new_jdk_image
#
# Compare the directory structure.
# Compare the filenames in the directories.
# Compare the contents of the zip archives
# Compare the contents of the jar archives
# Compare the native libraries
# Compare the native executables
# Compare the remaining files
#
# ./common/bin/compareimages.sh old_jdk_image new_jdk_image [zips jars libs execs other]
#
# Compare only the selected subset of the images.
#
# ./common/bin/compareimages.sh old_jdk_image new_jdk_image CodePointIM.jar
#
# Compare only the CodePointIM.jar file
# Can be used to compare zips, libraries and executables.
#
if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" == "x" ]; then
echo "./common/bin/compareimages.sh old_jdk_image new_jdk_image"
echo ""
echo "Compare the directory structure."
echo "Compare the filenames in the directories."
echo "Compare the contents of the zip archives"
echo "Compare the contents of the jar archives"
echo "Compare the native libraries"
echo "Compare the native executables"
echo "Compare the remaining files"
echo ""
echo "./common/bin/compareimages.sh old_jdk_image new_jdk_image [zips jars libs execs other]"
echo ""
echo "Compare only the selected subset of the images."
echo ""
echo "./common/bin/compareimages.sh old_jdk_image new_jdk_image CodePointIM.jar"
echo ""
echo "Compare only the CodePointIM.jar file"
echo "Can be used to compare zips, libraries and executables."
exit 10
fi
OLD="$1"
NEW="$2"
CMD="$3"
DIFF_RESULT=0
CMP_ZIPS=false
CMP_JARS=false
CMP_LIBS=false
CMP_EXECS=false
CMP_OTHER=false
FILTER="cat"
if [ -n "$CMD" ]; then
case "$CMD" in
zips)
CMP_ZIPS=true
;;
jars)
CMP_JARS=true
;;
libs)
CMP_LIBS=true
;;
execs)
CMP_EXECS=true
;;
other)
CMP_OTHER=true
;;
*)
CMP_ZIPS=true
CMP_JARS=true
CMP_LIBS=true
CMP_EXECS=true
CMP_OTHER=true
FILTER="grep $3"
;;
esac
else
CMP_ZIPS=true
CMP_JARS=true
CMP_LIBS=true
CMP_EXECS=true
CMP_OTHER=true
fi
DIFFJARZIP=`dirname $0`/diffjarzip.sh
DIFFLIB=`dirname $0`/difflib.sh
DIFFEXEC=`dirname $0`/diffexec.sh
export COMPARE_ROOT=/tmp/cimages
mkdir -p $COMPARE_ROOT
# Load the correct exception list.
case "`uname -s`" in
Linux)
. `dirname $0`/exception_list_linux
;;
esac
echo
echo Comparing $OLD to $NEW
echo
(cd $OLD && find . -type d | sort > $COMPARE_ROOT/from_dirs)
(cd $NEW && find . -type d | sort > $COMPARE_ROOT/to_dirs)
echo -n Directory structure...
if diff $COMPARE_ROOT/from_dirs $COMPARE_ROOT/to_dirs > /dev/null; then
echo Identical!
else
echo Differences found.
DIFF_RESULT=1
# Differences in directories found.
ONLY_OLD=$(diff $COMPARE_ROOT/from_dirs $COMPARE_ROOT/to_dirs | grep '<')
if [ "$ONLY_OLD" ]; then
echo Only in $OLD
echo $ONLY_OLD | sed 's|< ./|\t|g' | sed 's/ /\n/g'
fi
# Differences in directories found.
ONLY_NEW=$(diff $COMPARE_ROOT/from_dirs $COMPARE_ROOT/to_dirs | grep '>')
if [ "$ONLY_NEW" ]; then
echo Only in $NEW
echo $ONLY_NEW | sed 's|> ./|\t|g' | sed 's/ /\n/g'
fi
fi
(cd $OLD && find . -type f | sort > $COMPARE_ROOT/from_files)
(cd $NEW && find . -type f | sort > $COMPARE_ROOT/to_files)
echo -n File names...
if diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files > /dev/null; then
echo Identical!
else
echo Differences found.
DIFF_RESULT=1
# Differences in directories found.
ONLY_OLD=$(diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files | grep '<')
if [ "$ONLY_OLD" ]; then
echo Only in $OLD
echo $ONLY_OLD | sed 's|< ./|\t|g' | sed 's/ /\n/g'
fi
# Differences in directories found.
ONLY_NEW=$(diff $COMPARE_ROOT/from_files $COMPARE_ROOT/to_files | grep '>')
if [ "$ONLY_NEW" ]; then
echo Only in $NEW
echo $ONLY_NEW | sed 's|> ./|\t|g' | sed 's/ /\n/g'
fi
fi
if [ "x$CMP_ZIPS" == "xtrue" ]; then
ZIPS=$(cd $OLD && find . -type f -name "*.zip" | sort | $FILTER)
if [ -n "$ZIPS" ]; then
echo Zip files...
for f in $ZIPS
do
$DIFFJARZIP $OLD/$f $NEW/$f $OLD $NEW
if [ "$?" != "0" ]; then
DIFF_RESULT=1
fi
done
fi
fi
if [ "x$CMP_JARS" == "xtrue" ]; then
JARS=$(cd $OLD && find . -type f -name "*.jar" | sort | $FILTER)
if [ -n "$JARS" ]; then
echo Jar files...
for f in $JARS
do
DIFFJAR_OUTPUT=`$DIFFJARZIP $OLD/$f $NEW/$f $OLD $NEW`
DIFFJAR_RESULT=$?
if [ "$DIFFJAR_RESULT" != "0" ]; then
for diff in $LIST_DIFF_JAR; do
DIFFJAR_OUTPUT=`echo "$DIFFJAR_OUTPUT" | grep -v "$diff"`
done
if [ "`echo "$DIFFJAR_OUTPUT" | grep -v "Differing files in"`" != "" ]; then
DIFF_RESULT=1
echo "$DIFFJAR_OUTPUT"
fi
fi
done
fi
fi
if [ "x$FILTER" != "xcat" ]; then
VIEW=view
else
VIEW=
fi
if [ "x$CMP_LIBS" == "xtrue" ]; then
LIBS=$(cd $OLD && find . -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' | sort | $FILTER)
if [ -n "$LIBS" ]; then
echo Libraries...
for f in $LIBS
do
DIFFLIB_OUTPUT=`$DIFFLIB $OLD/$f $NEW/$f $OLD $NEW $VIEW`
DIFFLIB_RESULT=$?
if [ "$DIFFLIB_RESULT" = "0" ]; then
:
#echo "OK: $DIFFLIB_OUTPUT"
elif [ "$DIFFLIB_RESULT" = "2" ] && [[ "$LIST_DIFF_SIZE $LIST_DIFF_BYTE" == *"${f:2}"* ]]; then
:
#echo "OK: $DIFFLIB_OUTPUT"
elif [ "$DIFFLIB_RESULT" = "1" ] && [[ "$LIST_DIFF_BYTE" == *"${f:2}"* ]]; then
:
#echo "OK: $DIFFLIB_OUTPUT"
else
echo "$DIFFLIB_OUTPUT"
DIFF_RESULT=1
fi
done
fi
fi
if [ "x$CMP_EXECS" == "xtrue" ]; then
if [ $OSTYPE == "cygwin" ]; then
EXECS=$(cd $OLD && find . -type f -name '*.exe' | sort | $FILTER)
else
EXECS=$(cd $OLD && find . -type f -perm -100 \! \( -name '*.so' -o -name '*.dylib' -o -name '*.dll' \) | sort | $FILTER)
fi
if [ -n "$EXECS" ]; then
echo Executables...
for f in $EXECS
do
DIFFEXEC_OUTPUT=`$DIFFEXEC $OLD/$f $NEW/$f $OLD $NEW $VIEW`
DIFFEXEC_RESULT=$?
if [ "$DIFFEXEC_RESULT" = "0" ]; then
:
#echo "OK: $DIFFEXEC_OUTPUT"
elif [ "$DIFFEXEC_RESULT" = "2" ] && [[ "$LIST_DIFF_SIZE $LIST_DIFF_BYTE" == *"${f:2}"* ]]; then
:
#echo "OK: $DIFFEXEC_OUTPUT"
elif [ "$DIFFEXEC_RESULT" = "1" ] && [[ "$LIST_DIFF_BYTE" == *"${f:2}"* ]]; then
:
#echo "OK: $DIFFEXEC_OUTPUT"
else
echo "$DIFFEXEC_OUTPUT"
DIFF_RESULT=1
fi
done
fi
fi
exit $DIFF_RESULT

150
common/bin/diffexec.sh Normal file

@ -0,0 +1,150 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
if [ $# -lt 2 ]
then
echo "Diff two executables. Return codes:"
echo "0 - no diff"
echo "1 - Identical symbols AND size, BUT not bytewise identical"
echo "2 - Identical symbols BUT NEW size"
echo "3 - Differences, content BUT SAME size"
echo "4 - Differences, content AND size"
echo "10 - Could not perform diff"
echo "Use 'quiet' to disable any output."
echo "Syntax: $0 file1 file2 [quiet]"
exit 10
fi
if [ ! -f $1 ]
then
echo $1 does not exist
exit 10
fi
if [ ! -f $2 ]
then
echo $2 does not exist
exit 10
fi
if [ "`uname`" == "SunOS" ]; then
NM=gnm
STAT=gstat
elif [ $OSTYPE == "cygwin" ]; then
NM="$VS100COMNTOOLS/../../VC/bin/amd64/dumpbin.exe"
NM_ARGS=/exports
STAT=stat
else
NM=nm
STAT=stat
fi
# Should the differences be viewed?
VIEW=
# You can do export DIFF=meld to view
# any differences using meld instead.
if [ -n "$DIFF" ]; then
DIFF="$DIFF"
else
DIFF=diff
fi
OLD=$(cd $(dirname $1) && pwd)/$(basename $1)
NEW=$(cd $(dirname $2) && pwd)/$(basename $2)
OLD_SIZE=$($STAT -c%s "$OLD")
NEW_SIZE=$($STAT -c%s "$NEW")
if [ $# -gt 3 ]
then
ROOT1=$(cd $3 && pwd)
ROOT2=$(cd $4 && pwd)
OLD_NAME=$(echo $OLD | sed "s|$ROOT1/||")
NEW_NAME=$(echo $NEW | sed "s|$ROOT2/||")
if [ "x$5" == "xview" ]; then VIEW=view; fi
else
ROOT1=$(dirname $OLD)/
ROOT2=$(dirname $NEW)/
OLD_NAME=$OLD
NEW_NAME=$NEW
if [ "x$3" == "xview" ]; then VIEW=view; fi
fi
if cmp $OLD $NEW > /dev/null
then
# The files were bytewise identical.
echo Identical: $OLD_NAME
exit 0
fi
OLD_SYMBOLS=$COMPARE_ROOT/$OLD_NAME.old
NEW_SYMBOLS=$COMPARE_ROOT/$NEW_NAME.new
mkdir -p $(dirname $OLD_SYMBOLS)
mkdir -p $(dirname $NEW_SYMBOLS)
if [ $OSTYPE == "cygwin" ]; then
"$NM" $NM_ARGS $OLD | grep " = " > $OLD_SYMBOLS
"$NM" $NM_ARGS $NEW | grep " = " > $NEW_SYMBOLS
"$NM" $NM_ARGS $OLD > $OLD_SYMBOLS.full
"$NM" $NM_ARGS $NEW > $NEW_SYMBOLS.full
else
# Strip the addresses, just compare the ordering of the symbols.
$NM $OLD | cut -f 2- -d ' ' > $OLD_SYMBOLS
$NM $NEW | cut -f 2- -d ' ' > $NEW_SYMBOLS
# But store the full information for easy diff access.
$NM $OLD > $OLD_SYMBOLS.full
$NM $NEW > $NEW_SYMBOLS.full
fi
DIFFS=$(LANG=C diff $OLD_SYMBOLS $NEW_SYMBOLS)
RESULT=0
if [ -n "$DIFFS" ]; then
if [ $OLD_SIZE -ne $NEW_SIZE ]
then
echo Differences, content AND size : $OLD_NAME
RESULT=4
else
echo Differences, content BUT SAME size: $OLD_NAME
RESULT=3
fi
if [ "x$VIEW" == "xview" ]; then
LANG=C $DIFF $OLD_SYMBOLS $NEW_SYMBOLS
fi
else
if [ $OLD_SIZE -ne $NEW_SIZE ]
then
echo Identical symbols BUT NEW size : $OLD_NAME
RESULT=2
else
echo Identical symbols AND size, BUT not bytewise identical: $OLD_NAME
RESULT=1
fi
fi
exit $RESULT

151
common/bin/diffjarzip.sh Normal file

@ -0,0 +1,151 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Simple tool to diff two jar or zip files. It unpacks the jar/zip files and
# reports if files differs and if files are new or missing.
# Assumes gnu diff.
# There are a few source files that have DOS line endings in the
# jaxp/jaxws source drops, when the sources were added to the repository
# the source files were converted to UNIX line endings.
# For now we ignore these differences.
DIFF_FLAGS="--strip-trailing-cr"
#set -x
if [ $# -lt 2 ]
then
echo "Diff two jar/zip files. Return codes: 0 - no diff, 1 - diff, 2 - couldn't perform diff"
echo "Syntax: $0 old_archive new_archive [old_root new_root]"
exit 2
fi
if [ ! -f $1 ]
then
echo $1 does not exist
exit 2
fi
if [ ! -f $2 ]
then
echo $2 does not exist
exit 2
fi
IGNORES="cat"
OLD=$(cd $(dirname $1) && pwd)/$(basename $1)
NEW=$(cd $(dirname $2) && pwd)/$(basename $2)
if [ $# -gt 3 ]
then
ROOT1=$(cd $3 && pwd)
ROOT2=$(cd $4 && pwd)
OLD_NAME=$(echo $OLD | sed "s|$ROOT1/||")
NEW_NAME=$(echo $NEW | sed "s|$ROOT2/||")
if [ $# == 5 ]; then IGNORES="$5"; fi
else
ROOT1=$(dirname $OLD)/
ROOT2=$(dirname $NEW)/
OLD_NAME=$OLD
NEW_NAME=$NEW
if [ $# == 3 ]; then IGNORES="$3"; fi
fi
if [ "`uname`" == "SunOS" ]; then
DIFF=gdiff
else
DIFF=diff
fi
OLD_SUFFIX="${OLD##*.}"
NEW_SUFFIX="${NEW##*.}"
if [ "$OLD_SUFFIX" != "$NEW_SUFFIX" ]; then
echo The files do not have the same suffix type!
exit 2
fi
if [ "$OLD_SUFFIX" != "zip" ] && [ "$OLD_SUFFIX" != "jar" ]; then
echo The files have to be zip or jar! They are $OLD_SUFFIX
exit 2
fi
UNARCHIVE="unzip -q"
TYPE="$OLD_SUFFIX"
if cmp $OLD $NEW > /dev/null
then
# The files were bytewise identical.
exit 0
fi
# Not quite identical, the might still contain the same data.
# Unpack the jar/zip files in temp dirs
if test "x$COMPARE_ROOT" == "x"; then
COMPARE_ROOT=/tmp/compare_root.$$
REMOVE_COMPARE_ROOT=true
fi
OLD_TEMPDIR=$COMPARE_ROOT/$OLD_NAME.old
NEW_TEMPDIR=$COMPARE_ROOT/$NEW_NAME.new
mkdir -p $OLD_TEMPDIR
mkdir -p $NEW_TEMPDIR
(cd $OLD_TEMPDIR && rm -rf * ; $UNARCHIVE $OLD)
(cd $NEW_TEMPDIR && rm -rf * ; $UNARCHIVE $NEW)
ONLY1=$(LANG=C $DIFF -rq $OLD_TEMPDIR $NEW_TEMPDIR | grep "^Only in $OLD_TEMPDIR")
if [ -n "$ONLY1" ]; then
echo " Only the OLD $OLD_NAME contains:"
LANG=C $DIFF -rq $DIFF_FLAGS $OLD_TEMPDIR $NEW_TEMPDIR | grep "^Only in $OLD_TEMPDIR" \
| sed "s|Only in $OLD_TEMPDIR| |"g | sed 's|: |/|g'
fi
ONLY2=$(LANG=C $DIFF -rq $OLD_TEMPDIR $NEW_TEMPDIR | grep "^Only in $NEW_TEMPDIR")
if [ -n "$ONLY2" ]; then
echo " Only the NEW $NEW_NAME contains:"
LANG=C $DIFF -rq $DIFF_FLAGS $OLD_TEMPDIR $NEW_TEMPDIR | grep "^Only in $NEW_TEMPDIR" \
| sed "s|Only in $NEW_TEMPDIR| |"g | sed 's|: |/|g'
fi
DIFFTEXT=`dirname $0`/difftext.sh
LANG=C $DIFF -rq $DIFF_FLAGS $OLD_TEMPDIR $NEW_TEMPDIR | grep differ | cut -f 2,4 -d ' ' | \
awk "{ print \"$DIFFTEXT \"\$1\" \"\$2 }" > $COMPARE_ROOT/diffing
/bin/bash $COMPARE_ROOT/diffing > $COMPARE_ROOT/diffs
if [ -s "$COMPARE_ROOT/diffs" ]; then
echo " Differing files in $OLD_NAME"
cat $COMPARE_ROOT/diffs | grep differ | $IGNORES | cut -f 2 -d ' ' | \
sed "s|$OLD_TEMPDIR| |g"
fi
# Clean up
if [ "x$REMOVE_COMPARE_ROOT" == xtrue ]; then
rm -rf $REMOVE_COMPARE_ROOT
fi
exit 1

168
common/bin/difflib.sh Normal file

@ -0,0 +1,168 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Simple tool to diff two shared libraries.
# Criterias: two shared libraries are considered equal if:
# the file sizes are the same AND the symbols outputs from the nm command are equal
if [ $# -lt 2 ]
then
echo "Diff two shared libs. Return codes:"
echo "0 - no diff"
echo "1 - Identical symbols AND size, BUT not bytewise identical"
echo "2 - Identical symbols BUT NEW size"
echo "3 - Differences, content BUT SAME size"
echo "4 - Differences, content AND size"
echo "10 - Could not perform diff"
echo "Use 'quiet' to disable any output."
echo "Syntax: $0 file1 file2 [quiet]"
exit 10
fi
if [ ! -f $1 ]
then
echo $1 does not exist
exit 10
fi
if [ ! -f $2 ]
then
echo $2 does not exist
exit 10
fi
if [ "`uname`" == "SunOS" ]; then
NM=gnm
STAT=gstat
elif [ $OSTYPE == "cygwin" ]; then
NM="$VS100COMNTOOLS/../../VC/bin/amd64/dumpbin.exe"
NM_ARGS=/exports
STAT=stat
else
NM=nm
STAT=stat
fi
# Should the differences be viewed?
VIEW=
# You can do export DIFF=meld to view
# any differences using meld instead.
if [ -n "$DIFF" ]; then
DIFF="$DIFF"
else
DIFF=diff
fi
OLD=$(cd $(dirname $1) && pwd)/$(basename $1)
NEW=$(cd $(dirname $2) && pwd)/$(basename $2)
OLD_SIZE=$($STAT -c%s "$OLD")
NEW_SIZE=$($STAT -c%s "$NEW")
if [ $# -gt 3 ]
then
ROOT1=$(cd $3 && pwd)
ROOT2=$(cd $4 && pwd)
OLD_NAME=$(echo $OLD | sed "s|$ROOT1/||")
NEW_NAME=$(echo $NEW | sed "s|$ROOT2/||")
if [ "x$5" == "xview" ]; then VIEW=view; fi
else
ROOT1=$(dirname $OLD)/
ROOT2=$(dirname $NEW)/
OLD_NAME=$OLD
NEW_NAME=$NEW
if [ "x$3" == "xview" ]; then VIEW=view; fi
fi
OLD_SUFFIX="${OLD##*.}"
NEW_SUFFIX="${NEW##*.}"
if [ "$OLD_SUFFIX" != "$NEW_SUFFIX" ]; then
echo The files do not have the same suffix type!
exit 10
fi
if [ "$OLD_SUFFIX" != "so" ] && [ "$OLD_SUFFIX" != "dylib" ] && [ "$OLD_SUFFIX" != "dll" ]; then
echo The files have to be .so, .dylib or .dll! They are $OLD_SUFFIX
exit 10
fi
TYPE="$OLD_SUFFIX"
if cmp $OLD $NEW > /dev/null
then
# The files were bytewise identical.
echo Identical: $OLD_NAME
exit 0
fi
OLD_SYMBOLS=$COMPARE_ROOT/$OLD_NAME.old
NEW_SYMBOLS=$COMPARE_ROOT/$NEW_NAME.new
mkdir -p $(dirname $OLD_SYMBOLS)
mkdir -p $(dirname $NEW_SYMBOLS)
if [ $OSTYPE == "cygwin" ]; then
"$NM" $NM_ARGS $OLD | grep " = " > $OLD_SYMBOLS
"$NM" $NM_ARGS $NEW | grep " = " > $NEW_SYMBOLS
"$NM" $NM_ARGS $OLD > $OLD_SYMBOLS.full
"$NM" $NM_ARGS $NEW > $NEW_SYMBOLS.full
else
# Strip the addresses, just compare the ordering of the symbols.
$NM $OLD | cut -f 2- -d ' ' > $OLD_SYMBOLS
$NM $NEW | cut -f 2- -d ' ' > $NEW_SYMBOLS
# But store the full information for easy diff access.
$NM $OLD > $OLD_SYMBOLS.full
$NM $NEW > $NEW_SYMBOLS.full
fi
DIFFS=$(LANG=C diff $OLD_SYMBOLS $NEW_SYMBOLS)
RESULT=0
if [ -n "$DIFFS" ]; then
if [ $OLD_SIZE -ne $NEW_SIZE ]
then
echo Differences, content AND size : $OLD_NAME
RESULT=4
else
echo Differences, content BUT SAME size: $OLD_NAME
RESULT=3
fi
if [ "x$VIEW" == "xview" ]; then
LANG=C $DIFF $OLD_SYMBOLS $NEW_SYMBOLS
fi
else
if [ $OLD_SIZE -ne $NEW_SIZE ]
then
echo Identical symbols BUT NEW size : $OLD_NAME
RESULT=2
else
echo Identical symbols AND size, BUT not bytewise identical: $OLD_NAME
RESULT=1
fi
fi
exit $RESULT

157
common/bin/difftext.sh Normal file

@ -0,0 +1,157 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# The difftext.sh knows how to compare text files and
# ignore some specific differences.
# When difftext.sh is called, we already know that the
# files differ. But if the tests below trigger, then
# we ignore differences caused by:
#
# Timestamps in Java sources generated by idl2java
# Sorting order and cleanup style in .properties files.
OLD="$1"
NEW="$2"
SUF="${OLD##*.}"
TMP=1
if test "x$SUF" == "xjava"; then
TMP=$(LANG=C diff $OLD $NEW | \
grep '^[<>]' | \
sed '/[<>] \* from.*\.idl/d' | \
sed '/[<>] \*.*201[12].*/d' | \
sed '/\/\/ Generated from input file.*/d' | \
sed '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' | \
sed '/\/\/ java GenerateCharacter.*/d')
fi
if test "x$SUF" == "xproperties"; then
cat $OLD | sed -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
-e 's/\\u0020/\x20/g' \
-e 's/\\u003A/\x3A/g' \
-e 's/\\u006B/\x6B/g' \
-e 's/\\u0075/\x75/g' \
-e 's/\\u00A0/\xA0/g' \
-e 's/\\u00A3/\xA3/g' \
-e 's/\\u00B0/\xB0/g' \
-e 's/\\u00B7/\xB7/g' \
-e 's/\\u00BA/\xBA/g' \
-e 's/\\u00BF/\xBF/g' \
-e 's/\\u00C0/\xC0/g' \
-e 's/\\u00C1/\xC1/g' \
-e 's/\\u00C2/\xC2/g' \
-e 's/\\u00C4/\xC4/g' \
-e 's/\\u00C5/\xC5/g' \
-e 's/\\u00C8/\xC8/g' \
-e 's/\\u00C9/\xC9/g' \
-e 's/\\u00CA/\xCA/g' \
-e 's/\\u00CD/\xCD/g' \
-e 's/\\u00CE/\xCE/g' \
-e 's/\\u00D3/\xD3/g' \
-e 's/\\u00D4/\xD4/g' \
-e 's/\\u00D6/\xD6/g' \
-e 's/\\u00DA/\xDA/g' \
-e 's/\\u00DC/\xDC/g' \
-e 's/\\u00DD/\xDD/g' \
-e 's/\\u00DF/\xDF/g' \
-e 's/\\u00E0/\xE0/g' \
-e 's/\\u00E1/\xE1/g' \
-e 's/\\u00E2/\xE2/g' \
-e 's/\\u00E3/\xE3/g' \
-e 's/\\u00E4/\xE4/g' \
-e 's/\\u00E5/\xE5/g' \
-e 's/\\u00E6/\xE6/g' \
-e 's/\\u00E7/\xE7/g' \
-e 's/\\u00E8/\xE8/g' \
-e 's/\\u00E9/\xE9/g' \
-e 's/\\u00EA/\xEA/g' \
-e 's/\\u00EB/\xEB/g' \
-e 's/\\u00EC/\xEC/g' \
-e 's/\\u00ED/\xED/g' \
-e 's/\\u00EE/\xEE/g' \
-e 's/\\u00EF/\xEF/g' \
-e 's/\\u00F1/\xF1/g' \
-e 's/\\u00F2/\xF2/g' \
-e 's/\\u00F3/\xF3/g' \
-e 's/\\u00F4/\xF4/g' \
-e 's/\\u00F5/\xF5/g' \
-e 's/\\u00F6/\xF6/g' \
-e 's/\\u00F9/\xF9/g' \
-e 's/\\u00FA/\xFA/g' \
-e 's/\\u00FC/\xFC/g' \
-e 's/\\u0020/\x20/g' \
-e 's/\\u003f/\x3f/g' \
-e 's/\\u006f/\x6f/g' \
-e 's/\\u0075/\x75/g' \
-e 's/\\u00a0/\xa0/g' \
-e 's/\\u00a3/\xa3/g' \
-e 's/\\u00b0/\xb0/g' \
-e 's/\\u00ba/\xba/g' \
-e 's/\\u00bf/\xbf/g' \
-e 's/\\u00c1/\xc1/g' \
-e 's/\\u00c4/\xc4/g' \
-e 's/\\u00c5/\xc5/g' \
-e 's/\\u00c8/\xc8/g' \
-e 's/\\u00c9/\xc9/g' \
-e 's/\\u00ca/\xca/g' \
-e 's/\\u00cd/\xcd/g' \
-e 's/\\u00d6/\xd6/g' \
-e 's/\\u00dc/\xdc/g' \
-e 's/\\u00dd/\xdd/g' \
-e 's/\\u00df/\xdf/g' \
-e 's/\\u00e0/\xe0/g' \
-e 's/\\u00e1/\xe1/g' \
-e 's/\\u00e2/\xe2/g' \
-e 's/\\u00e3/\xe3/g' \
-e 's/\\u00e4/\xe4/g' \
-e 's/\\u00e5/\xe5/g' \
-e 's/\\u00e7/\xe7/g' \
-e 's/\\u00e8/\xe8/g' \
-e 's/\\u00e9/\xe9/g' \
-e 's/\\u00ea/\xea/g' \
-e 's/\\u00eb/\xeb/g' \
-e 's/\\u00ec/\xec/g' \
-e 's/\\u00ed/\xed/g' \
-e 's/\\u00ee/\xee/g' \
-e 's/\\u00ef/\xef/g' \
-e 's/\\u00f0/\xf0/g' \
-e 's/\\u00f1/\xf1/g' \
-e 's/\\u00f2/\xf2/g' \
-e 's/\\u00f3/\xf3/g' \
-e 's/\\u00f4/\xf4/g' \
-e 's/\\u00f5/\xf5/g' \
-e 's/\\u00f6/\xf6/g' \
-e 's/\\u00f7/\xf7/g' \
-e 's/\\u00f8/\xf8/g' \
-e 's/\\u00f9/\xf9/g' \
-e 's/\\u00fa/\xfa/g' \
-e 's/\\u00fc/\xfc/g' \
-e 's/\\u00ff/\xff/g' \
| sed -e '/^#/d' -e '/^$/d' \
-e :a -e '/\\$/N; s/\\\n//; ta' \
-e 's/^[ \t]*//;s/[ \t]*$//' \
-e 's/\\=/=/' | LANG=C sort > $OLD.cleaned
TMP=$(LANG=C diff $OLD.cleaned $NEW)
fi
if test -n "$TMP"; then
echo Files $OLD and $NEW differ
fi

@ -0,0 +1,114 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# List of files inside jar archives that are ok if they differ.
LIST_DIFF_JAR="
/sun/misc/Version.class
/sun/tools/jconsole/Version.class
/com/sun/tools/javac/resources/version.class
/com/sun/tools/javah/resources/version.class
/com/sun/tools/javap/resources/version.class
"
# List of binaries that only need to match symbols
LIST_DIFF_SIZE="
jre/lib/amd64/libfontmanager.so
jre/lib/amd64/libjdwp.so
jre/lib/amd64/libt2k.so
bin/unpack200
jre/bin/unpack200
jre/lib/amd64/libjsig.debuginfo
jre/lib/amd64/libsaproc.debuginfo
jre/lib/amd64/server/libjvm.debuginfo
"
# List of binares that need to match both symbols and size
LIST_DIFF_BYTE="
jre/lib/amd64/libdt_socket.so
jre/lib/amd64/libattach.so
jre/lib/amd64/libjaas_unix.so
jre/lib/amd64/libjawt.so
jre/lib/amd64/libjpeg.so
jre/lib/amd64/libjsdt.so
jre/lib/amd64/libjsig.so
jre/lib/amd64/libsaproc.so
jre/lib/amd64/libsctp.so
jre/lib/amd64/libsunec.so
jre/lib/amd64/libunpack.so
jre/lib/amd64/libverify.so
jre/lib/amd64/libzip.so
jre/lib/amd64/server/libjsig.so
jre/lib/amd64/server/libjvm.so
jre/lib/amd64/liblcms.so
demo/jvmti/heapTracker/lib/libheapTracker.so
demo/jvmti/hprof/lib/libhprof.so
demo/jvmti/minst/lib/libminst.so
demo/jvmti/mtrace/lib/libmtrace.so
demo/jvmti/waiters/lib/libwaiters.so
bin/appletviewer
bin/extcheck
bin/idlj
bin/jar
bin/jarsigner
bin/java
bin/javac
bin/javadoc
bin/javah
bin/javap
bin/jcmd
bin/jconsole
bin/jdb
bin/jhat
bin/jinfo
bin/jmap
bin/jps
bin/jrunscript
bin/jsadebugd
bin/jstack
bin/jstat
bin/jstatd
bin/keytool
bin/native2ascii
bin/orbd
bin/pack200
bin/policytool
bin/rmic
bin/rmid
bin/rmiregistry
bin/schemagen
bin/serialver
bin/servertool
bin/tnameserv
bin/wsgen
bin/wsimport
bin/xjc
jre/bin/java
jre/bin/keytool
jre/bin/orbd
jre/bin/pack200
jre/bin/policytool
jre/bin/rmid
jre/bin/rmiregistry
jre/bin/servertool
jre/bin/tnameserv
"

@ -0,0 +1,53 @@
#!/bin/bash
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Must be bash, but that is ok since we are running from cygwin.
# The first argument is the vcvarsall.bat file to run.
# The second argument is the arch arg to give to vcvars.
VCVARSALL="$1"
ARCH_ARG="$2"
# Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment)
# but calculate the difference in Cygwin environment before/after running it and then
# apply the diff.
_vs10varsall=`cygpath -a -m -s "$VCVARSALL"`
_dosvs10varsall=`cygpath -a -w -s $_vs10varsall`
_dosbash=`cygpath -a -w -s \`which bash\`.*`
# generate the set of exported vars before/after the vs10 setup
echo "@echo off" > localdevenvtmp.bat
echo "$_dosbash -c \"export -p\" > localdevenvtmp.export0" >> localdevenvtmp.bat
echo "call $_dosvs10varsall $ARCH_ARG" >> localdevenvtmp.bat
echo "$_dosbash -c \"export -p\" > localdevenvtmp.export1" >> localdevenvtmp.bat
cmd /c localdevenvtmp.bat
# apply the diff (less some non-vs10 vars named by "!")
sort localdevenvtmp.export0 |grep -v "!" > localdevenvtmp.export0.sort
sort localdevenvtmp.export1 |grep -v "!" > localdevenvtmp.export1.sort
comm -1 -3 localdevenvtmp.export0.sort localdevenvtmp.export1.sort > localdevenv.sh
cat localdevenv.sh | sed 's/declare -x /export /g' | sed 's/="/:="/g' | sed 's/\\\\/\\/g' | sed 's/"//g' | \
sed 's/#/\$\(HASH\)/g' > localdevenv.gmk
# cleanup
rm -f localdevenvtmp*

@ -0,0 +1,41 @@
#!/bin/sh
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
if [ -x /usr/bin/ggrep ] ; then
# Gnu grep on Solaris
# (reference configure and build/solaris-i586-clientANDserver-release/spec.gmk
GREP=/usr/bin/ggrep
else
GREP=grep
fi
#
EXP="Note: Some input files use or override a deprecated API."
EXP="${EXP}|Note: Recompile with -Xlint:deprecation for details."
EXP="${EXP}|Note: Some input files use unchecked or unsafe operations."
EXP="${EXP}|Note: Recompile with -Xlint:unchecked for details."
EXP="${EXP}| warning"
EXP="${EXP}|uses or overrides a deprecated API."
EXP="${EXP}|uses unchecked or unsafe operations."
#
${GREP} --line-buffered -v -E "${EXP}"

46
common/bin/logger.sh Normal file

@ -0,0 +1,46 @@
#!/bin/sh
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Usage: ./logger.sh theloggfile acommand arg1 arg2
#
# Execute acommand with args, in such a way that
# both stdout and stderr from acommand are appended to
# theloggfile.
#
# Preserve stdout and stderr, so that the stdout
# from logger.sh is the same from acommand and equally
# for stderr.
#
# Propagate the result code from acommand so that
# ./logger.sh exits with the same result code.
# Create a temporary directory to store the result code from
# the wrapped command.
RCDIR=`mktemp -d tmp.XXXXXX` || exit $?
trap "rm -rf '$RCDIR'" EXIT
LOGFILE=$1
shift
(exec 3>&1 ; ("$@" 2>&1 1>&3; echo $? > $RCDIR/rc) | tee -a $LOGFILE 1>&2 ; exec 3>&-) | tee -a $LOGFILE
exit `cat $RCDIR/rc`

@ -0,0 +1,114 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
PREFIXES=-pkgPrefix CORBA org.omg \
-pkgPrefix CosNaming org.omg \
-pkgPrefix CosTransactions org.omg \
-pkgPrefix CosTSInteroperation org.omg \
-pkgPrefix DynamicAny org.omg \
-pkgPrefix Dynamic org.omg \
-pkgPrefix IOP org.omg \
-pkgPrefix Messaging org.omg \
-pkgPrefix PortableInterceptor org.omg \
-pkgPrefix PortableServer org.omg \
-pkgPrefix activation com.sun.corba.se.spi \
-pkgPrefix GIOP com.sun.corba.se \
-pkgPrefix PortableActivationIDL com.sun.corba.se \
-pkgPrefix messages com.sun.corba.se
define add_idl_package
# param 1 = MYPACKAGE
# param 2 = src root
# param 3 = gensrc root
# param 4 = source idl to compile
# param 5 = target idl package
# param 6 = delete these files that were output from the idlj
# param 7 = idls that match these patterns should be compiled with -oldImplBase
# param 8 = the idlj command
# Save the generated java files to a temporary directory so
# that we can find them and create proper dependencies.
# After that, we move them to the real gensrc target dir.
$4_TMPDIR:=tmp___$(subst /,_,$(patsubst $2/%,%,$4))___
ifneq ($$(filter $7,$4),)
$4_OLDIMPLBASE:=-oldImplBase
$4_OLDIMPLBASE_MSG:=with -oldImplBase
endif
$5 : $4
mkdir -p $3/$$($4_TMPDIR)
rm -rf $3/$$($4_TMPDIR)
mkdir -p $(dir $5)
echo Compiling IDL $(patsubst $2/%,%,$4)
$8 -td $3/$$($4_TMPDIR) \
-i $2/org/omg/CORBA \
-i $2/org/omg/PortableInterceptor \
-i $2/org/omg/PortableServer \
-D CORBA3 -corba 3.0 \
-fall \
$$($4_OLDIMPLBASE) \
$(PREFIXES) \
$4
rm -f $$(addprefix $3/$$($4_TMPDIR)/,$6)
cp -rp $3/$$($4_TMPDIR)/* $3
(cd $3/$$($4_TMPDIR); find . -type f | sed 's!\./!$3/!g' | awk '{ print $$$$1 ": $4" }' > $5)
rm -rf $3/$$($4_TMPDIR)
endef
define SetupIdlCompilation
# param 1 is for example BUILD_IDLS
# param 2,3,4,5,6,7,8 are named args.
# IDLJ,SRC,BIN,INCLUDES,EXCLUDES,OLDIMPLBASES,DELETES
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
# Remove any relative addressing in the paths.
$1_SRC := $$(abspath $$($1_SRC))
$1_BIN := $$(abspath $$($1_BIN))
# Find all existing java files and existing class files.
$$(shell mkdir -p $$($1_SRC) $$($1_BIN))
$1_SRCS := $$(shell find $$($1_SRC) -name "*.idl")
$1_BINS := $$(shell find $$($1_BIN) -name "*.java")
# Prepend the source/bin path to the filter expressions.
$1_SRC_INCLUDES := $$(addprefix $$($1_SRC)/,$$($1_INCLUDES))
$1_SRC_EXCLUDES := $$(addprefix $$($1_SRC)/,$$($1_EXCLUDES))
$1_BIN_INCLUDES := $$(addprefix $$($1_BIN)/,$$($1_INCLUDES))
$1_BIN_EXCLUDES := $$(addprefix $$($1_BIN)/,$$($1_EXCLUDES))
$1_OLDIMPLBASES := $$(addprefix $$($1_SRC)/,$$($1_OLDIMPLBASES))
# Now remove unwanted java/class files.
$1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
$1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
$1_BINS := $$(filter $$($1_BIN_INCLUDES),$$($1_BINS))
$1_BINS := $$(filter-out $$($1_BIN_EXCLUDES),$$($1_BINS))
$1 := $$(sort $$(patsubst $$($1_SRC)/%.idl,$$($1_BIN)/%.idl.d,$$($1_SRCS)))
# Now create the dependencies for each idl target.
$$(foreach p,$$($1),$$(eval $$(call add_idl_package,$1,$$($1_SRC),$$($1_BIN),$$(patsubst $$($1_BIN)/%.idl.d,$$($1_SRC)/%.idl,$$p),$$p,$$($1_DELETES),$$($1_OLDIMPLBASES),$$($1_IDLJ))))
endef
.SUFFIXES: .java .class .package

@ -0,0 +1,887 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# The complexity of this makefile is not the fault of make, but the fault
# of javac and javah. The basic problems are:
#
# 1) Compiling a single Java source file unpredictably generates anything
# between zero (0!) and an infinite number of .class files!
# 2) There is no hint, for which classes javah needs to be run,
# and it happily generates .h files for classes with no native methods.
# 3) javac and javah do not cleanup anything, for example if an internal
# class (potentially with native methods) is removed from a Java source file.
#
# This makefile is a tribute to GNU make. And yes, it was harder to write than it is
# to read. The include/excludes of directories and files are only a temporary measure
# to work around the messy jdk sources that put platform specific code in src/share/classes.
#
# We should move most of the functionality of this makefile into a
# smart javac/javah/javadoc/jar combo tool. sjavac ?
#
# I.e. 1) It always generates a single output, a zip-file from a number of source roots.
# The zip file contains information that enable incremental builds with full
# dependency tracking between packages.
# 2) It automatically generates the right .h files.
# 3) It keeps its house clean.
# *) Generates intermediate files to be used for javadoc generation later.
# and does all the other useful things that this makefile does, such as:
# use all cores for compilation, reuse the running JVM for all compilations,
# and has pubapi dependency tracking to minimize the number of files
# that need to be recompiled during an incremental build.
#
# A zip file, or several zip files combined, can then be converted to a .jar file, or to a .jmod file.
#
# This would make this makefile much much simpler. I.e. make can be used
# for its real purpose, track dependencies and trigger a recompile if a
# dependency has changed.
#
# When you read this source. Remember that $(sort ...) has the side effect
# of removing duplicates. It is actually this side effect that is
# desired whenever sort is used below!
ifeq (,$(_MAKEBASE_GMK))
$(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
endif
FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST
# If compilation of java package fails, then the public api file for that
# package will not be genereated. We add this fallback rule to generate
# an empty pubapi file.
%.api:
if test ! -f $@; then $(MKDIR) -p $(@D); $(TOUCH) $@; fi
define SetupJavaCompiler
# param 1 is for example BOOT_JAVAC or NEW_JAVAC
# This is the name later used to decide which java compiler to use.
# param 2-9 are named args.
# JVM:=The jvm used to run the javac/javah command
# JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
# JAVAH:=The javah jar and bootstrap classpath changes, or just bin/javah if JVM is left out
# FLAGS:=Flags to be supplied to javac
# MODE:=SINGLE_THREADED_BATCH (primarily for old javac) or MULTI_CORE_CONCURRENT
# only for MULTI_CORE_CONCURRENT are the options below relevant:
# SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
# SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
# USE_DEPS:=true means use -XDdeps,-XDpubapi and -XDnativeapi to track java dependencies
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
ifeq ($$($1_MODE),MULTI_CORE_CONCURRENT)
ifneq (,$$($1_SERVER_DIR))
# A javac server has been requested.
# The port file contains the tcp/ip on which the server listens
# and the cookie necessary to talk to the server.
$1_JAVAC_PORTFILE:=$$($1_SERVER_DIR)/$1.port
ifeq ($$($1_SERVER_JVM),)
# You can use a different JVM to run the background javac server.
# But if not set, it defaults to the same JVM that is used to start
# the javac command.
$1_SERVER_JVM:=$$($1_JVM)
endif
# Set the $1_REMOTE to spawn a background javac server.
$1_REMOTE:=-XDserver:portfile=$$($1_JAVAC_PORTFILE),poolsize=$(JAVAC_SERVER_CORES),javac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_JAVAC))))
endif
endif
endef
define SetupArchive
# param 1 is for example ARCHIVE_MYPACKAGE
# param 2 are the dependecies
# param 3,4,5,6,7,8,9 are named args.
# SRCS:=List of directories in where to find files to add to archive
# SUFFIXES:=File suffixes to include in jar
# INCLUDES:=List of directories/packages in SRCS that should be included
# EXCLUDES:=List of directories/packages in SRCS that should be excluded
# EXCLUDE_FILES:=List of files in SRCS that should be excluded
# EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match.
# JAR:=Jar file to create
# MANIFEST:=Optional manifest file template.
# JARMAIN:=Optional main class to add to manifest
# SETUP:=The Java(h) compiler setup, needed to run javah.
# HEADERS:=Directory to put headers in
# SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically
# added to the archive.
# EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$(if $(10),$1_$(strip $(10)))
$(if $(11),$1_$(strip $(11)))
$(if $(12),$1_$(strip $(12)))
$(if $(13),$1_$(strip $(13)))
$(if $(14),$1_$(strip $(14)))
$1_JVM := $$($$($1_SETUP)_JVM)
$1_JAVAH := $$($$($1_SETUP)_JAVAH)
$1_JARMAIN:=$(strip $$($1_JARMAIN))
$1_JARNAME:=$$(notdir $$($1_JAR))
$1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest
$1_DELETESS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletess
$1_DELETES_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletes
$1_PUBAPI_NOTIFICATIONS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_pubapi_notifications
$1_NATIVEAPI_NOTIFICATIONS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native_notifications
$1_NATIVEAPI_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native
$1_BIN:=$$(dir $$($1_JAR))
ifeq (,$$($1_SUFFIXES))
# No suffix was set, default to classes.
$1_SUFFIXES:=.class
endif
# Convert suffixes to a find expression
$1_FIND_PATTERNS:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES))
ifneq (,$$($1_INCLUDES))
$1_GREP_INCLUDES:=| $(GREP) $$(foreach src,$$($1_SRCS),$$(addprefix -e$(SPACE)$$(src)/,$$($1_INCLUDES)))
endif
ifneq (,$$($1_EXCLUDES)$$($1_EXCLUDE_FILES))
$1_GREP_EXCLUDES:=| $(GREP) -v $$(foreach src,$$($1_SRCS),$$(addprefix -e$(SPACE)$$(src)/,$$($1_EXCLUDES) $$($1_EXCLUDE_FILES)))
endif
# Utility macros, to make the shell script receipt somewhat easier to dechipher.
# The capture contents macro finds all files (matching the patterns, typically
# .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar.
$1_CAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),(($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) $$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > $$(src)/_the.$$($1_JARNAME)_contents) && )
# The capture metainf macro finds all files below the META-INF directory that are newer than the jar-file.
ifeq (,$$($1_SKIP_METAINF))
$1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) && )
endif
# The capture deletes macro finds all deleted files and concatenates them. The resulting file
# tells us what to remove from the jar-file.
$1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) &&)
# The capture pubapi notifications scans for pubapi change notifications. If such notifications are
# found, then we will build the classes leading up to the jar again, to take into account the new timestamps
# on the changed pubapi files.
$1_CAPTURE_PUBAPI_NOTIFICATIONS=$$(foreach src,$$($1_SRCS),\
(cd $$(src) && \
$(FIND) . -name _the.package.api.notify -exec dirname \{\} \; >> $$($1_PUBAPI_NOTIFICATIONS_FILE) ; \
true) &&)
# The capture nativeapi macro scans for native api change notificiations. If such notifications are
# found, then we will run javah on the changed classes. It also collects all classes with native methods
# to be used to find out which classes no longer has native methods, to trigger deletion of those .h files.
$1_CAPTURE_NATIVEAPI=$$(foreach src,$$($1_SRCS),\
(cd $$(src) && \
$(FIND) . -name _the.package.native.notify | $(SED) 's/package.native.notify/package.native/' | \
$(XARGS) $(CAT) | $(GREP) '^TYPE ' | $(SED) 's/.*TYPE //' >> $$($1_NATIVEAPI_NOTIFICATIONS_FILE) ; \
$(FIND) . -name _the.package.native -exec $(CAT) \{\} \; | $(SED) -n 's/^TYPE //p' >> $$($1_NATIVEAPI_FILE) ; \
true) &&)
# The update contents macro updates the jar file with the previously capture contents.
$1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
(cd $$(src) && \
if [ -s _the.$$($1_JARNAME)_contents ]; then \
$(ECHO) " updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
$(JAR) uf $$@ @_the.$$($1_JARNAME)_contents; \
fi) &&)
# The s-variants of the above macros are used when the jar is created from scratch.
$1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
(($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) $$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > $$(src)/_the.$$($1_JARNAME)_contents) && )
ifeq (,$$($1_SKIP_METAINF))
$1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS),\
($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents) && )
endif
$1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
(cd $$(src) && $(JAR) uf $$@ @$$(src)/_the.$$($1_JARNAME)_contents) &&)
# The TOUCH macro is used to make sure all timestamps are identical for package files and the pubapi files.
# If we do not do this, we get random recompilations, the next time we run make, since the order of package building is random,
# ie independent of package --dependes on-> public api of another package. This is of course
# due to the fact that Java source often (always?) has circular dependencies. (Thus there is no correct order
# to compile packages, and we can just as well do them in a random order. Which we do.)
$1_TOUCH_API_FILES=$$(foreach src,$$($1_SRCS),\
($(FIND) $$(src) -name _the.package.api -exec $(TOUCH) -r $$($1_JAR) \{\} \; ; true) && \
($(FIND) $$(src) -name _the.package -exec $(TOUCH) -r $$($1_JAR) \{\} \; ; true) &&)
# Use a slightly shorter name for logging, but with enough path to identify this jar.
$1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
# Here is the rule that creates/updates the jar file.
$$($1_JAR) : $2
$(MKDIR) -p $$($1_BIN)
if [ -n "$$($1_MANIFEST)" ]; then \
$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
-e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" $$($1_MANIFEST) > $$($1_MANIFEST_FILE); \
else \
$(RM) $$($1_MANIFEST_FILE) && $(TOUCH) $$($1_MANIFEST_FILE); \
fi
$(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE)
if [ -n "$$($1_EXTRA_MANIFEST_ATTR)" ]; then \
$(ECHO) "$$($1_EXTRA_MANIFEST_ATTR)" >> $$($1_MANIFEST_FILE); \
fi
+if [ -s $$@ ]; then \
$(RM) -r $$($1_PUBAPI_NOTIFICATIONS_FILE) && \
$$($1_CAPTURE_PUBAPI_NOTIFICATIONS) \
if [ -s $$($1_PUBAPI_NOTIFICATIONS_FILE) ]; then \
$(ECHO) Public api change detected in: && \
$(CAT) $$($1_PUBAPI_NOTIFICATIONS_FILE) | $(TR) '/' '.' | $(SED) 's|^..||g' | $(SED) 's|\.$$$$||g' | $(AWK) '{print " "$$$$1}' && \
$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.api.notify $(FIND_DELETE); true) &&) \
$(MAKE) -f $(word 1,$(MAKEFILE_LIST)) $$($1_JAR) ; \
else \
$(ECHO) Modifying $$($1_NAME) && \
$$($1_CAPTURE_CONTENTS) \
$$($1_CAPTURE_METAINF) \
$(RM) $$($1_DELETES_FILE) && \
$$($1_CAPTURE_DELETES) \
$(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) && \
if [ -s $$($1_DELETESS_FILE) ]; then \
$(ECHO) " deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \
$(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
fi && \
$$($1_UPDATE_CONTENTS) true && \
$$($1_TOUCH_API_FILES) true && \
$(RM) -r $$($1_NATIVEAPI_NOTIFICATIONS_FILE) $$($1_NATIVEAPI_FILE) && \
$$($1_CAPTURE_NATIVEAPI) true && \
if [ "x$$($1_JAVAH)" != "x" ] && [ -s $$($1_NATIVEAPI_NOTIFICATIONS_FILE) ]; then \
$(ECHO) Native api change detected in: && $(CAT) $$($1_NATIVEAPI_NOTIFICATIONS_FILE) && \
$$($1_JVM) $$($1_JAVAH) "-Xbootclasspath/p:$$($1_JAR)" -d $$($1_HEADERS) @$$($1_NATIVEAPI_NOTIFICATIONS_FILE) ; \
fi && \
$(TOUCH) $$($1_NATIVEAPI_FILE)_prev ; \
($(GREP) -xvf $$($1_NATIVEAPI_FILE) $$($1_NATIVEAPI_FILE)_prev > $$($1_NATIVEAPI_FILE)_deleted; true) && \
$(CP) $$($1_NATIVEAPI_FILE) $$($1_NATIVEAPI_FILE)_prev && \
if [ -s $$($1_NATIVEAPI_FILE)_deleted ]; then \
$(ECHO) Native methods dropped from classes: && $(CAT) $$($1_NATIVEAPI_FILE)_deleted && \
$(RM) `$(CAT) $$($1_NATIVEAPI_FILE)_deleted | $(SED) -e 's|\.|_|g' -e 's|.*|$$($1_HEADERS)/&.h $$($1_HEADERS)/&_*|'` ; \
fi && \
$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.api.notify $(FIND_DELETE); true) &&) true ; \
fi ; \
else \
$(ECHO) Creating $$($1_NAME) && $(JAR) cfm $$@ $$($1_MANIFEST_FILE) && \
$$($1_SCAPTURE_CONTENTS) \
$$($1_SCAPTURE_METAINF) \
$$($1_SUPDATE_CONTENTS) \
$$($1_TOUCH_API_FILES) true && \
$(RM) -r $$($1_NATIVEAPI_NOTIFICATIONS_FILE) $$($1_NATIVEAPI_FILE) && \
$$($1_CAPTURE_NATIVEAPI) true && \
if [ "x$$($1_JAVAH)" != "x" ] && [ -s $$($1_NATIVEAPI_FILE) ]; then \
$(ECHO) Generating native api headers for `$(CAT) $$($1_NATIVEAPI_FILE) | $(WC) -l` classes && \
$(RM) $$($1_HEADERS)/*.h && \
$$($1_JVM) $$($1_JAVAH) "-Xbootclasspath/p:$$($1_JAR)" -d $$($1_HEADERS) @$$($1_NATIVEAPI_FILE) && \
$(CP) $$($1_NATIVEAPI_FILE) $$($1_NATIVEAPI_FILE)_prev ; \
fi && \
$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name "*.notify" $(FIND_DELETE); true) &&) true ; \
fi;
endef
define append_to
$(ECHO) "$1" >> $2
endef
define SetupZipArchive
# param 1 is for example ZIP_MYSOURCE
# param 2,3,4,5,6,7,8,9 are named args.
# SRC,ZIP,INCLUDES,EXCLUDES,EXCLUDE_FILES
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
# Find all files in the source tree.
$1_ALL_SRCS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f -a ! -name "_the.*"))
ifneq ($$($1_INCLUDES),)
$1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
$1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
$1_ALL_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS))
endif
ifneq ($$($1_EXCLUDES),)
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
$1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
endif
# Use a slightly shorter name for logging, but with enough path to identify this zip.
$1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
# Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
# I.e. the zip -i and -x options should match the filtering done in the makefile.
# Explicitly excluded files can be given with absolute path. The patsubst solution
# isn't perfect but the likelyhood of an absolute path to match something in a src
# dir is very small.
$$($1_ZIP) : $$($1_ALL_SRCS)
$(MKDIR) -p $$(@D)
$(ECHO) Updating $$($1_NAME)
$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES)))) ;) true
$(TOUCH) $$@
endef
define add_file_to_copy
# param 1 = BUILD_MYPACKAGE
# parma 2 = The source file to copy.
$2_TARGET:=$2
# Remove the source prefix.
$$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
# Now we can setup the depency that will trigger the copying.
$$($1_BIN)$$($2_TARGET) : $2
$(MKDIR) -p $$(@D)
$(CP) $$< $$@
$(CHMOD) -f ug+w $$@
# And do not forget this target
$1_ALL_COPY_TARGETS += $$($1_BIN)$$($2_TARGET)
endef
# This macro is used only for properties files that are to be
# copied over to the classes directory in cleaned form:
# Previously this was inconsistently done in different repositories.
# This is the new clean standard.
define add_file_to_copy_and_clean
# param 1 = BUILD_MYPACKAGE
# parma 2 = The source file to copy and clean.
$2_TARGET:=$2
# Remove the source prefix.
$$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
# Now we can setup the depency that will trigger the copying.
$$($1_BIN)$$($2_TARGET) : $2
$(MKDIR) -p $$(@D)
$(ECHO) Cleaning $$($2_TARGET)
$(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
| $(SED) \
-e 's/\\u0020/\x20/g' \
-e 's/\\u003A/\x3A/g' \
-e 's/\\u006B/\x6B/g' \
-e 's/\\u0075/\x75/g' \
-e 's/\\u00A0/\xA0/g' \
-e 's/\\u00A3/\xA3/g' \
-e 's/\\u00B0/\xB0/g' \
-e 's/\\u00B7/\xB7/g' \
-e 's/\\u00BA/\xBA/g' \
-e 's/\\u00BF/\xBF/g' \
-e 's/\\u00C0/\xC0/g' \
-e 's/\\u00C1/\xC1/g' \
-e 's/\\u00C2/\xC2/g' \
-e 's/\\u00C4/\xC4/g' \
-e 's/\\u00C5/\xC5/g' \
-e 's/\\u00C8/\xC8/g' \
-e 's/\\u00C9/\xC9/g' \
-e 's/\\u00CA/\xCA/g' \
-e 's/\\u00CD/\xCD/g' \
-e 's/\\u00CE/\xCE/g' \
-e 's/\\u00D3/\xD3/g' \
-e 's/\\u00D4/\xD4/g' \
-e 's/\\u00D6/\xD6/g' \
-e 's/\\u00DA/\xDA/g' \
-e 's/\\u00DC/\xDC/g' \
-e 's/\\u00DD/\xDD/g' \
-e 's/\\u00DF/\xDF/g' \
-e 's/\\u00E0/\xE0/g' \
-e 's/\\u00E1/\xE1/g' \
-e 's/\\u00E2/\xE2/g' \
-e 's/\\u00E3/\xE3/g' \
-e 's/\\u00E4/\xE4/g' \
-e 's/\\u00E5/\xE5/g' \
-e 's/\\u00E6/\xE6/g' \
-e 's/\\u00E7/\xE7/g' \
-e 's/\\u00E8/\xE8/g' \
-e 's/\\u00E9/\xE9/g' \
-e 's/\\u00EA/\xEA/g' \
-e 's/\\u00EB/\xEB/g' \
-e 's/\\u00EC/\xEC/g' \
-e 's/\\u00ED/\xED/g' \
-e 's/\\u00EE/\xEE/g' \
-e 's/\\u00EF/\xEF/g' \
-e 's/\\u00F1/\xF1/g' \
-e 's/\\u00F2/\xF2/g' \
-e 's/\\u00F3/\xF3/g' \
-e 's/\\u00F4/\xF4/g' \
-e 's/\\u00F5/\xF5/g' \
-e 's/\\u00F6/\xF6/g' \
-e 's/\\u00F9/\xF9/g' \
-e 's/\\u00FA/\xFA/g' \
-e 's/\\u00FC/\xFC/g' \
-e 's/\\u0020/\x20/g' \
-e 's/\\u003f/\x3f/g' \
-e 's/\\u006f/\x6f/g' \
-e 's/\\u0075/\x75/g' \
-e 's/\\u00a0/\xa0/g' \
-e 's/\\u00a3/\xa3/g' \
-e 's/\\u00b0/\xb0/g' \
-e 's/\\u00ba/\xba/g' \
-e 's/\\u00bf/\xbf/g' \
-e 's/\\u00c1/\xc1/g' \
-e 's/\\u00c4/\xc4/g' \
-e 's/\\u00c5/\xc5/g' \
-e 's/\\u00c8/\xc8/g' \
-e 's/\\u00c9/\xc9/g' \
-e 's/\\u00ca/\xca/g' \
-e 's/\\u00cd/\xcd/g' \
-e 's/\\u00d6/\xd6/g' \
-e 's/\\u00dc/\xdc/g' \
-e 's/\\u00dd/\xdd/g' \
-e 's/\\u00df/\xdf/g' \
-e 's/\\u00e0/\xe0/g' \
-e 's/\\u00e1/\xe1/g' \
-e 's/\\u00e2/\xe2/g' \
-e 's/\\u00e3/\xe3/g' \
-e 's/\\u00e4/\xe4/g' \
-e 's/\\u00e5/\xe5/g' \
-e 's/\\u00e7/\xe7/g' \
-e 's/\\u00e8/\xe8/g' \
-e 's/\\u00e9/\xe9/g' \
-e 's/\\u00ea/\xea/g' \
-e 's/\\u00eb/\xeb/g' \
-e 's/\\u00ec/\xec/g' \
-e 's/\\u00ed/\xed/g' \
-e 's/\\u00ee/\xee/g' \
-e 's/\\u00ef/\xef/g' \
-e 's/\\u00f0/\xf0/g' \
-e 's/\\u00f1/\xf1/g' \
-e 's/\\u00f2/\xf2/g' \
-e 's/\\u00f3/\xf3/g' \
-e 's/\\u00f4/\xf4/g' \
-e 's/\\u00f5/\xf5/g' \
-e 's/\\u00f6/\xf6/g' \
-e 's/\\u00f7/\xf7/g' \
-e 's/\\u00f8/\xf8/g' \
-e 's/\\u00f9/\xf9/g' \
-e 's/\\u00fa/\xfa/g' \
-e 's/\\u00fc/\xfc/g' \
-e 's/\\u00ff/\xff/g' \
| $(SED) -e '/^#/d' -e '/^$$$$/d' \
-e :a -e '/\\$$$$/N; s/\\\n//; ta' \
-e 's/^[ \t]*//;s/[ \t]*$$$$//' \
-e 's/\\=/=/' | LANG=C sort > $$@
$(CHMOD) -f ug+w $$@
# And do not forget this target
$1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($2_TARGET)
endef
define add_java_package
# param 1 = BUILD_MYPACKAGE
# param 2 = the package target file (_the.package)
# param 3 = src roots, all of them, separated with space
# param 4 = bin root
# param 5 = include these dependecies
# param 6 = not used
# param 7 = if non-empty, then use -Xdeps and -Xpubapi
# param 8 = xremote configuration, or empty.
# param 9 = javac command
# param 10 = javac flags
# param 11 = exclude these files!
# param 12 = only include these files!
# param 13 = javah command
# param 14 = override src roots to be passed into -sourcepath, ugly ugly ugly, do not use this!
# it is only here to workaround ugly things in the source code in the jdk that ought
# to be fixed instead!
ifdef $2_USED_BY
$$(error Attempting to add the package $2 from $3 which is already added with sources from $$($2_USED_BY))
endif
$2_USED_BY:=$3
# Remove the _the.package file to get the target bin dir for the classes in this package.
$2_PACKAGE_BDIR:=$(dir $2)
# The source roots separated with a path separator (: or ; depending on os)
# (The patsubst is necessary to trim away unnecessary spaces.)
ifneq ($(14),)
$2_SRCROOTSC:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$(14))))
else
$2_SRCROOTSC:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$3)))
endif
# Suffix the package path to the src roots, to get a list of all possible source locations
# for this package.
$2_PACKAGE_SDIRS:=$$(foreach i,$3,$$(subst $4,$$i,$$($2_PACKAGE_BDIR)))
# Use wildcard in all potential source locations to find the actual sources.
$2_PACKAGE_SRCS:=$$(filter-out $(11),$$(wildcard $$(addsuffix *.java,$$($2_PACKAGE_SDIRS))))
ifneq ($(12),)
# Filter on include file filter if set.
$2_PACKAGE_SRCS:=$$(filter $(12),$$($2_PACKAGE_SRCS))
endif
# Generate a proper package name from the file name.
$2_PACKAGE:=$(patsubst .%.,%,$(subst /,.,$(subst $4,,$(dir $2))))
# Use a javac server for this package?
$2_REMOTE:=$8
# Include previously generated information about what classes are output by this package
# and what sources were used for the compile.
-include $$($2_PACKAGE_BDIR)_the.package.d
# Include the notify, file, that exists if the package has been compiled during a previous make round.
# I.e. we are now dealing with a compile triggered by a pubapi change.
-include $$($2_PACKAGE_BDIR)_the.package.notify
# If the notify file existed, then $$($2_NOTIFIED) will be equal to true.
# Use this information to block dependency tracking for this package.
# This is necessary to cut the circular dependency chains that are so common in Java sources.
ifneq ($$($2_NOTIFIED),true)
# No need to block, since this package has not yet been recompiled.
# Thus include previously generated dependency information. (if it exists)
-include $$($2_PACKAGE_BDIR)_the.package.dddd
# else
# $$(info WAS NOTIFIED $2)
endif
# Should we create proper dependencies between packages?
ifneq ($7,)
# The flag: -XDpubapi:file=foo,package=mypack,notify writes a file foo that contains a
# database of the public api of the classes supplied on the command line and are
# inside the package mypack. If foo already exists, javac will only write to foo,
# if there is a change in the pubapi. I.e. we can use the timestamp of this file
# for triggering dependencies. "notify" means create a "file" suffixed with notify
# if the pubapi really changed.
$2_PUBAPI=-XDpubapi=file=$$($2_PACKAGE_BDIR)_the.package.api,notify,package=$$($2_PACKAGE)
# The flag: -XDnativeapi:file=foo,package=mypack,notify works similar to pubabi, but
# instead tracks native methods. This file can be used to trigger dependencies for
# native compilations.
$2_NATIVEAPI=-XDnativeapi=file=$$($2_PACKAGE_BDIR)_the.package.native,notify,package=$$($2_PACKAGE)
# The flag -XDdeps:file=foo.deps,groupon=package writes a foo.deps file containing packages dependencies:
# java.net : java.io java.lang
# I.e. the classes in .net depend on the public apis of java.io and java.lang
# The dependencies can be grouped on classes instead (groupon=class)
# java.net.Bar : java.io.Socket java.lang.String
$2_DEPS:=-XDdeps=file=$$($2_PACKAGE_BDIR)_the.package.deps,groupon=package
# The next command rewrites the deps output from javac into a proper makefile dependency.
# The dependencies are always to an .api file generated by the pubapi option above.
# This is necessary since java package dependencies are almost always circular.
$2_APPEND_DEPS:=($(CAT) $$($2_PACKAGE_BDIR)_the.package.deps | $(TR) '.' '/' | $(AWK) '{ print "$4/" $$$$3 }' | sort > $$($2_PACKAGE_BDIR)_the.package.ddd && $(GREP) -f $$($2_PACKAGE_BDIR)_the.package.ddd $5 | $(AWK) '{ print "$(dir $2)_the.package : " $$$$1 "_the.package.api" }' > $$($2_PACKAGE_BDIR)_the.package.dddd ; true)
else
# If not using dependencies, use $2 as fallback to trigger regeneration of javah header files.
# This will generate a surplus of header files, but this does not hurt compilation.
$2_NATIVEAPICHANGE_TRIGGER:=$2
$2_FETCH_NATIVEAPICHANGE_CLASSES:=$(CAT) $$($2_PACKAGE_BDIR)_the.package.now|$(GREP) -v '\$$$$'|$(SED) -e 's|$4/||g'|$(SED) 's|.class||g'| $(TR) '/' '.'
endif
# The _the.package file is dependent on the java files inside the package.
# Fill the _the.package file with a list of the java files and compile them
# to class files.
$2 : $$($2_PACKAGE_SRCS)
$(MKDIR) -p $$($2_PACKAGE_BDIR)
$(RM) $2.tmp
$$(call ListPathsSafely,$2_PACKAGE_SRCS,\n, >> $2.tmp)
$(ECHO) $$($2_PACKAGE_BDIR)*.class | $(GREP) -v \*.class | $(TR) ' ' '\n' > $$($2_PACKAGE_BDIR)_the.package.prev
$(RM) $$($2_PACKAGE_BDIR)*.class $$($2_PACKAGE_BDIR)*.notify $$($2_PACKAGE_BDIR)*.deleted
$(ECHO) Compiling `$(WC) $2.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files in package $(patsubst $4/%/,%,$(dir $2.tmp))
$9 $$($2_REMOTE) $$($2_DEPS) $$($2_PUBAPI) $$($2_NATIVEAPI) $(10) -implicit:none -sourcepath "$$($2_SRCROOTSC)" -d $4 @$2.tmp
$(ECHO) $$($2_PACKAGE_BDIR)*.class | $(GREP) -v \*.class | $(TR) ' ' '\n' > $$($2_PACKAGE_BDIR)_the.package.now
($(GREP) -xvf $$($2_PACKAGE_BDIR)_the.package.now $$($2_PACKAGE_BDIR)_the.package.prev > $$($2_PACKAGE_BDIR)_the.package.deleted;true)
$(ECHO) $1_CLASSES += `$(CAT) $$($2_PACKAGE_BDIR)_the.package.now` | \
$(SED) 's/\$$$$/\$$$$\$$$$/g' > $$($2_PACKAGE_BDIR)_the.package.d
$(ECHO) $1_JAVAS += $$($2_PACKAGE_SRCS) >> $$($2_PACKAGE_BDIR)_the.package.d
$(ECHO) $2_NOTIFIED:=true > $$($2_PACKAGE_BDIR)_the.package.notify
$$($2_APPEND_DEPS)
$$($2_COPY_FILES)
$(MV) -f $2.tmp $2
endef
define remove_string
$2 := $$(subst $1,,$$($2))
endef
define replace_space_with_pathsep
$1:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$2)))
endef
define SetupJavaCompilation
# param 1 is for example BUILD_MYPACKAGE
# param 2,3,4,5,6,7,8 are named args.
# SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC
# JVM:=path to ..bin/java
# ADD_JAVAC_FLAGS:=javac flags to append to the default ones.
# SRC:=one or more directories to search for sources
# BIN:=store classes here
# INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
# EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
# COPY:=.prp means copy all prp files to the corresponding package in BIN.
# CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN.
# COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo
# SRCZIP:=Create a src.zip based on the found sources and copied files.
# INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
# EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
# "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
# JAVAC_SOURCE_PATH_UGLY_OVERRIDE:=Don't use this. This forces an explicit -sourcepath to javac.
# Its only here until we cleanup some nasty source code pasta in the jdk.
# HEADERS:=path to directory where all generated c-headers are written.
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$(if $(10),$1_$(strip $(10)))
$(if $(11),$1_$(strip $(11)))
$(if $(12),$1_$(strip $(12)))
$(if $(13),$1_$(strip $(13)))
$(if $(14),$1_$(strip $(14)))
# Extract the info from the java compiler setup.
$1_MODE := $$($$($1_SETUP)_MODE)
ifneq (SINGLE_THREADED_BATCH,$$($1_MODE))
ifneq (MULTI_CORE_CONCURRENT,$$($1_MODE))
$$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP))
endif
endif
$1_USE_DEPS := $$($$($1_SETUP)_USE_DEPS)
$1_REMOTE := $$($$($1_SETUP)_REMOTE)
$1_JVM := $$($$($1_SETUP)_JVM)
$1_JAVAC := $$($$($1_SETUP)_JAVAC)
$1_JAVAH := $$($$($1_SETUP)_JAVAH)
$1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
ifeq (,$$($1_HEADERS))
$1_HEADERS := $$($1_BIN)
endif
# Handle addons and overrides.
$1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
# Make sure the dirs exist.
$$(shell $(MKDIR) -p $$($1_SRC) $$($1_BIN))
# Find all files in the source trees.
$1_ALL_SRCS := $$(filter-out $(OVR_SRCS),$$(foreach i,$$($1_SRC),$$(shell $(FIND) $$i -type f)))
# Extract the java files.
ifneq ($$($1_EXCLUDE_FILES),)
$1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES))
endif
$1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$(filter %.java,$$($1_ALL_SRCS)))
ifneq ($$($1_INCLUDE_FILES),)
$1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
$1_SRCS := $$(filter $$($1_INCLUDE_FILES), $$($1_SRCS))
endif
$1_PKGS := $$(sort $$(dir $$($1_SRCS)))
# Remove the source root from each found path.
$$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$1_PKGS)))
$1_PKGS := $$(sort $$($1_PKGS))
# There can be only a single bin dir root, no need to foreach over the roots.
$1_BINS := $$(shell $(FIND) $$($1_BIN) -name "*.class")
# Now we have a list of all java files to compile: $$($1_SRCS)
# and we have a list of all existing class files: $$($1_BINS)
# Prepend the source/bin path to the filter expressions.
ifneq ($$($1_INCLUDES),)
$1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
$1_PKG_INCLUDES := $$(addprefix /,$$(addsuffix /%,$$($1_INCLUDES)))
$1_BIN_INCLUDES := $$(addprefix $$($1_BIN)/,$$(addsuffix /%,$$($1_INCLUDES)))
$1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
$1_PKGS := $$(filter $$($1_PKG_INCLUDES),$$($1_PKGS))
$1_BINS := $$(filter $$($1_BIN_INCLUDES),$$($1_BINS))
endif
ifneq ($$($1_EXCLUDES),)
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
$1_PKG_EXCLUDES := $$(addprefix /,$$(addsuffix /%,$$($1_EXCLUDES)))
$1_BIN_EXCLUDES := $$(addprefix $$($1_BIN)/,$$(addsuffix /%,$$($1_EXCLUDES)))
$1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
$1_PKGS := $$(filter-out $$($1_PKG_EXCLUDES),$$($1_PKGS))
$1_BINS := $$(filter-out $$($1_BIN_EXCLUDES),$$($1_BINS))
endif
# Find all files to be copied from source to bin.
ifneq (,$$($1_COPY))
# Rewrite list of patterns into a find statement.
$1_COPY_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_COPY))
# Search for all files to be copied.
$1_ALL_COPIES := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_COPY_PATTERN) \) -a -type f))
# Copy these explicitly
$1_ALL_COPIES += $$($1_COPY_FILES)
# Copy must also respect filters.
ifneq (,$$($1_INCLUDES))
$1_ALL_COPIES := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_COPIES))
endif
ifneq (,$$($1_EXCLUDES))
$1_ALL_COPIES := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_COPIES))
endif
ifneq (,$$($1_EXCLUDE_FILES))
$1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES))
endif
# All files below META-INF are always copied.
$1_ALL_COPIES += $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i/META-INF -type f 2> /dev/null))
ifneq (,$$($1_ALL_COPIES))
# Yep, there are files to be copied!
$1_ALL_COPY_TARGETS:=
$$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
# Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
endif
endif
# Find all property files to be copied and cleaned from source to bin.
ifneq (,$$($1_CLEAN))
# Rewrite list of patterns into a find statement.
$1_CLEAN_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_CLEAN))
# Search for all files to be copied.
$1_ALL_CLEANS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_CLEAN_PATTERN) \) -a -type f))
# Copy and clean must also respect filters.
ifneq (,$$($1_INCLUDES))
$1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS))
endif
ifneq (,$$($1_EXCLUDES))
$1_ALL_CLEANS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_CLEANS))
endif
ifneq (,$$($1_EXCLUDE_FILES))
$1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_CLEANS))
endif
ifneq (,$$($1_ALL_CLEANS))
# Yep, there are files to be copied and cleaned!
$1_ALL_COPY_CLEAN_TARGETS:=
$$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_copy_and_clean,$1,$$i)))
# Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
endif
endif
# Find all the directories that contain java sources, each directory
# corresponds to a package because we expect the source
# code to be organized in this standardized way!
$1_SDIRS := $$(sort $$(dir $$($1_SRCS)))
# Now prefix each package with the bin root.
$1_BDIRS := $$(foreach i,$$($1_PKGS),$$(addprefix $$($1_BIN),$$i))
# Now create a list of the packages that are about to compile. This list is
# later used to filter out dependencies that point outside of this set.
$$(shell $(RM) $$($1_BIN)/_the.list_of_packages)
$$(eval $$(call ListPathsSafelyNow,$1_BDIRS,\n, >> $$($1_BIN)/_the.list_of_packages))
ifeq ($$($1_MODE),SINGLE_THREADED_BATCH)
# Ok, we will feed all the found java files into a single javac invocation.
# There can be no dependency checking, nor incremental builds. It is
# the best we can do with the old javac. If the javac supports a javac server
# then we can use the javac server.
# We can depend on this target file to trigger a regeneration of all the sources
$1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.batch
# Prep the source paths.
ifneq ($$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE),)
$$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE)))
else
$$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC)))
endif
# Create a sed expression to remove the source roots and to replace / with .
# and remove .java at the end.
$1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
# Here is the batch rules that depends on all the sources.
$$($1_BIN)/_the.batch: $$($1_SRCS)
$(MKDIR) -p $$(@D)
$(RM) $$($1_BIN)/_the.batch $$($1_BIN)/_the.batch.tmp
$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
$(ECHO) Compiling `$(WC) $$($1_BIN)/_the.batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files in batch $1
($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) -implicit:none -sourcepath "$$($1_SRCROOTSC)" -d $$($1_BIN) @$$($1_BIN)/_the.batch.tmp && \
$$(if $$($1_JAVAH),\
$(CAT) $$($1_BIN)/_the.batch.tmp | $(XARGS) $(GREP) -E "[[:space:]]native[[:space:]]|@GenerateNativeHeader" |\
$(GREP) -v '*' | $(GREP) -v '//' | $(CUT) -f 1 -d ':' | $(SORT) -u |\
$(SED) $$($1_REWRITE_INTO_CLASSES) > $$($1_BIN)/_the.batch.natives && \
if test -s $$($1_BIN)/_the.batch.natives; then \
$$($1_JVM) $$($1_JAVAH) "-Xbootclasspath/p:$$($1_BIN)" -d $$($1_HEADERS) @$$($1_BIN)/_the.batch.natives ; \
fi &&) \
$(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch)
else
# Ok, we have a modern javac server running!
# Since a single Java file can generate zero to an infinity number of .class files
# the exact number and names of the .class files will only be known after the compile.
# Thus after the compile, a list of the generated classes will be stored in _the.package.d
# which is included by the makefile during the next compile. These .d files will
# add the generated class names to the BUILD_MYPACKAGE_CLASSES variable and used java file names
# to the BUILD_MYPACKAGE_JAVAS variable.
$1_CLASSES :=
$1_JAVAS :=
# Create a file in each package that represents the package dependency.
# This file (_the.package) will also contain a list of the source files
# to be compiled for this package.
$1 := $$(sort $$(patsubst %,%_the.package,$$($1_BDIRS)))
# Now call add_java_package for each package to create the dependencies.
$$(foreach p,$$($1),$$(eval $$(call add_java_package,$1,$$p,$$($1_SRC),$$($1_BIN),$$($1_BIN)/_the.list_of_packages,NOTUSED,$$($1_USE_DEPS),$$($1_REMOTE),$$($1_JVM) $$($1_JAVAC),$$($1_FLAGS),$$($1_EXCLUDE_FILES_PATTERN) $(OVR_SRCS),$$($1_INCLUDE_FILES),$$($1_JVM) $$($1_JAVAH),$$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE))))
# All dependencies are setup, now we only need to depend on $1 (aka $(BUILD_MYPACKAGE))
# and they will automatically be built!
# Now add on any files to copy targets
$1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1)
# Remove the set of found classes from the set of all previously known classes
# and the remainder is the set of missing classes.
$1_MISSING_CLASSES:=$$(filter-out $$($1_BINS),$$($1_CLASSES))
$1_PKGS_MISSING_CLASSES:=$$(sort $$(dir $$($1_MISSING_CLASSES)))
# Remove the set of found java files from the set of all previously known java files
# the remainder is Java files that have gone missing.
$1_MISSING_JAVAS:=$$(filter-out $$($1_SRCS),$$($1_JAVAS))
$1_PKGS_MISSING_JAVAS:=$$(sort $$(dir $$($1_MISSING_JAVAS)))
# Remove each source root from the found paths.
$$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$1_PKGS_MISSING_JAVAS)))
# Finally remove duplicates and prefix with the binary path instead.
$1_PKGS_MISSING_JAVAS:= $$(addprefix $$($1_BIN),$$(sort $$($1_PKGS_MISSING_JAVAS)))
# Remove the set of all theoretical classes from the set of found classes.
# the remainder is the set of superfluous classes.
$1_SUPERFLUOUS_CLASSES:=$$(sort $$(filter-out $$($1_CLASSES),$$($1_BINS)))
$1_PKGS_SUPERFLUOUS_CLASSES:=$$(sort $$(dir $$($1_SUPERFLUOUS_CLASSES)))
# Now delete the _the.package files inside the problematic dirs.
# This will force a rebuild of these packages!
$1_FOO:=$$(sort $$($1_PKGS_MISSING_CLASSES) \
$$($1_PKGS_SUPERFLUOUS_CLASSES) \
$$($1_PKGS_MISSING_JAVAS))
# ifneq (,$$($1_FOO))
# $$(info MESSED UP PACKAGES $$($1_FOO))
# endif
$$(shell $(RM) $$(addsuffix _the.package,$$(sort $$($1_PKGS_MISSING_CLASSES) \
$$($1_PKGS_SUPERFLUOUS_CLASSES) \
$$($1_PKGS_MISSING_JAVAS))))
# Normal makefile dependencies based on timestamps will detect the normal use case
# when Java files are simply added or modified.
endif
ifneq (,$$($1_JAR))
ifeq (,$$($1_SUFFIXES))
$1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
endif
# A jar file was specified. Set it up.
$$(eval $$(call SetupArchive,ARCHIVE_$1,$$($1),\
SRCS:=$$($1_BIN),\
SUFFIXES:=$$($1_SUFFIXES),\
EXCLUDE:=$$($1_EXCLUDES),\
INCLUDES:=$$($1_INCLUDES),\
EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS),\
JAR:=$$($1_JAR),\
JARMAIN:=$$($1_JARMAIN),\
MANIFEST:=$$($1_MANIFEST),\
EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR),\
HEADERS:=$$($1_HEADERS),\
SETUP:=$$($1_SETUP)))
endif
ifneq (,$$($1_SRCZIP))
# A srczip file was specified. Set it up.
$$(eval $$(call SetupZipArchive,ARCHIVE_$1,\
SRC:=$$($1_SRC),\
ZIP:=$$($1_SRCZIP),\
INCLUDES:=$$($1_INCLUDES),\
EXCLUDES:=$$($1_EXCLUDES),\
EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
endif
endef

@ -0,0 +1,327 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################
#
# Check that GNU make and cygwin are recent enough.
# Setup common utility functions.
#
################################################################
ifndef _MAKEBASE_GMK
_MAKEBASE_GMK := 1
ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
$(error This version of GNU Make is too low ($(MAKE_VERSION)). Please upgrade to 3.81 or newer.)
endif
endif
ifneq (,$(CYGPATH))
# Cygwin styff, if needed but most is going to be
# done in configure!
ifeq (yes,$(CHECK_FOR_VCINSTALLDIR))
ifeq (,$(VCINSTALLDIR))
$(info Could not find compiler paths!)
$(info You probably configured the build from within a)
$(info VS command prompt, but you are not using such a)
$(info prompt right now.)
$(info If you instead run configure from a plain cygwin shell, it)
$(info will attempt to setup VS for you! Please try that.)
$(error Giving up for now.)
endif
endif
endif
# The build times report is turned off by setting REPORT_BUILD_TIMES to nothing.
# This is necessary for the target clean which will erase the
# directories where the buildtimes are stored.
REPORT_BUILD_TIMES=1
# Store the build times in this directory.
BUILDTIMESDIR=$(OUTPUT_ROOT)/tmp/buildtimes
# Record starting time for build of a sub repository.
define RecordStartTime
$(MKDIR) -p $(BUILDTIMESDIR)
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable
endef
# Indicate that we started to build a sub repository and record starting time.
define MakeStart
$(call RecordStartTime,$1)
$(BUILD_LOG_WRAPPER) $(PRINTF) "\n\n%s\n%s\n##### %-60.60s #####\n%s\n\n" \
"########################################################################" \
"########################################################################" \
"Entering $1 for target(s) $2" \
"########################################################################"
endef
# Record ending time and calculate the difference and store it in a
# easy to read format. Handles builds that cross midnight. Expects
# that a build will never take 24 hours or more.
define RecordEndTime
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable
$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \
$(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
> $(BUILDTIMESDIR)/build_time_diff_$1
endef
# Indicate that we are done.
# Record ending time and print out the total time it took to build.
define MakeFinish
$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,$1),)
$(BUILD_LOG_WRAPPER) $(PRINTF) "%s\n##### %-60.60s #####\n%s\n##### %-60.60s #####\n%s\n\n" \
"########################################################################" \
"Leaving $1 for target(s) $2" \
"########################################################################" \
$(if $(REPORT_BUILD_TIMES),"Build time `$(CAT) $(BUILDTIMESDIR)/build_time_diff_$1` for target(s) $2","") \
"########################################################################"
endef
# Find all build_time_* files and print their contents in a list sorted
# on the name of the sub repository.
define ReportBuildTimes
$(BUILD_LOG_WRAPPER) $(PRINTF) -- "-- Build times ----------\nTarget %s\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
"$1" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
"`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | $(XARGS) $(CAT) | $(SORT) -k 2`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
endef
define ResetTimers
$$(shell $(MKDIR) -p $(BUILDTIMESDIR) && $(RM) $(BUILDTIMESDIR)/build_time_*)
endef
define StartTimer
$(call RecordStartTime,TOTAL)
endef
define StopTimer
$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),)
endef
# If the variable that you want to send to stdout for piping into a file or otherwise,
# is potentially long, for example the a list of file paths, eg a list of all package directories.
# Then you need to use ListPathsSafely, which optimistically splits the output into several shell
# calls as well as use compression on recurrent file paths segments, to get around the potential
# command line length problem that exists in cygwin and other shells.
compress_pre:=$(strip $(shell cat $(SRC_ROOT)/common/makefiles/compress.pre))
compress_post:=$(strip $(shell cat $(SRC_ROOT)/common/makefiles/compress.post))
compress_paths=$(compress_pre)\
$(subst $(SRC_ROOT),X97,\
$(subst $(OUTPUT_ROOT),X98,\
$(subst X,X00,\
$(subst $(SPACE),\n,$(strip $1)))))\
$(compress_post)
decompress_paths=sed -f $(SRC_ROOT)/common/makefiles/uncompress.sed -e 's|X99|\\n|g' \
-e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(SRC_ROOT)|g' \
-e 's|X00|X|g' | tr '\n' '$2'
define ListPathsSafely_If
$(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(wordlist $3,$4,$($1)))))
endef
define ListPathsSafely_Printf
$(if $(strip $($1_LPS$4)),printf -- "$(strip $($1_LPS$4))\n" | $(decompress_paths) $3)
endef
# Receipt example:
# rm -f thepaths
# $(call ListPathsSafely,THEPATHS,\n, >> thepaths)
# The \n argument means translate spaces into \n
# if instead , , (a space) is supplied, then spaces remain spaces.
define ListPathsSafely
$(if $(word 10001,$($1)),$(error Cannot list safely more than 10000 paths. $1 has $(words $($1)) paths!))
$(call ListPathsSafely_If,$1,$2,1,250)
$(call ListPathsSafely_If,$1,$2,251,500)
$(call ListPathsSafely_If,$1,$2,501,750)
$(call ListPathsSafely_If,$1,$2,751,1000)
$(call ListPathsSafely_If,$1,$2,1001,1250)
$(call ListPathsSafely_If,$1,$2,1251,1500)
$(call ListPathsSafely_If,$1,$2,1501,1750)
$(call ListPathsSafely_If,$1,$2,1751,2000)
$(call ListPathsSafely_If,$1,$2,2001,2250)
$(call ListPathsSafely_If,$1,$2,2251,2500)
$(call ListPathsSafely_If,$1,$2,2501,2750)
$(call ListPathsSafely_If,$1,$2,2751,3000)
$(call ListPathsSafely_If,$1,$2,3001,3250)
$(call ListPathsSafely_If,$1,$2,3251,3500)
$(call ListPathsSafely_If,$1,$2,3501,3750)
$(call ListPathsSafely_If,$1,$2,3751,4000)
$(call ListPathsSafely_If,$1,$2,4001,4250)
$(call ListPathsSafely_If,$1,$2,4251,4500)
$(call ListPathsSafely_If,$1,$2,4501,4750)
$(call ListPathsSafely_If,$1,$2,4751,5000)
$(call ListPathsSafely_If,$1,$2,5001,5250)
$(call ListPathsSafely_If,$1,$2,5251,5500)
$(call ListPathsSafely_If,$1,$2,5501,5750)
$(call ListPathsSafely_If,$1,$2,5751,6000)
$(call ListPathsSafely_If,$1,$2,6001,6250)
$(call ListPathsSafely_If,$1,$2,6251,6500)
$(call ListPathsSafely_If,$1,$2,6501,6750)
$(call ListPathsSafely_If,$1,$2,6751,7000)
$(call ListPathsSafely_If,$1,$2,7001,7250)
$(call ListPathsSafely_If,$1,$2,7251,7500)
$(call ListPathsSafely_If,$1,$2,7501,7750)
$(call ListPathsSafely_If,$1,$2,7751,8000)
$(call ListPathsSafely_If,$1,$2,8001,8250)
$(call ListPathsSafely_If,$1,$2,8251,8500)
$(call ListPathsSafely_If,$1,$2,8501,8750)
$(call ListPathsSafely_If,$1,$2,8751,9000)
$(call ListPathsSafely_If,$1,$2,9001,9250)
$(call ListPathsSafely_If,$1,$2,9251,9500)
$(call ListPathsSafely_If,$1,$2,9501,9750)
$(call ListPathsSafely_If,$1,$2,9751,10000)
$(call ListPathsSafely_Printf,$1,$2,$3,1)
$(call ListPathsSafely_Printf,$1,$2,$3,251)
$(call ListPathsSafely_Printf,$1,$2,$3,501)
$(call ListPathsSafely_Printf,$1,$2,$3,751)
$(call ListPathsSafely_Printf,$1,$2,$3,1001)
$(call ListPathsSafely_Printf,$1,$2,$3,1251)
$(call ListPathsSafely_Printf,$1,$2,$3,1501)
$(call ListPathsSafely_Printf,$1,$2,$3,1751)
$(call ListPathsSafely_Printf,$1,$2,$3,2001)
$(call ListPathsSafely_Printf,$1,$2,$3,2251)
$(call ListPathsSafely_Printf,$1,$2,$3,2501)
$(call ListPathsSafely_Printf,$1,$2,$3,2751)
$(call ListPathsSafely_Printf,$1,$2,$3,3001)
$(call ListPathsSafely_Printf,$1,$2,$3,3251)
$(call ListPathsSafely_Printf,$1,$2,$3,3501)
$(call ListPathsSafely_Printf,$1,$2,$3,3751)
$(call ListPathsSafely_Printf,$1,$2,$3,4001)
$(call ListPathsSafely_Printf,$1,$2,$3,4251)
$(call ListPathsSafely_Printf,$1,$2,$3,4501)
$(call ListPathsSafely_Printf,$1,$2,$3,4751)
$(call ListPathsSafely_Printf,$1,$2,$3,5001)
$(call ListPathsSafely_Printf,$1,$2,$3,5251)
$(call ListPathsSafely_Printf,$1,$2,$3,5501)
$(call ListPathsSafely_Printf,$1,$2,$3,5751)
$(call ListPathsSafely_Printf,$1,$2,$3,6001)
$(call ListPathsSafely_Printf,$1,$2,$3,6251)
$(call ListPathsSafely_Printf,$1,$2,$3,6501)
$(call ListPathsSafely_Printf,$1,$2,$3,6751)
$(call ListPathsSafely_Printf,$1,$2,$3,7001)
$(call ListPathsSafely_Printf,$1,$2,$3,7251)
$(call ListPathsSafely_Printf,$1,$2,$3,7501)
$(call ListPathsSafely_Printf,$1,$2,$3,7751)
$(call ListPathsSafely_Printf,$1,$2,$3,8001)
$(call ListPathsSafely_Printf,$1,$2,$3,8251)
$(call ListPathsSafely_Printf,$1,$2,$3,8501)
$(call ListPathsSafely_Printf,$1,$2,$3,8751)
$(call ListPathsSafely_Printf,$1,$2,$3,9001)
$(call ListPathsSafely_Printf,$1,$2,$3,9251)
$(call ListPathsSafely_Printf,$1,$2,$3,9501)
$(call ListPathsSafely_Printf,$1,$2,$3,9751)
endef
define ListPathsSafelyNow_IfPrintf
ifneq (,$$(word $4,$$($1)))
$$(eval $1_LPS$4:=$$(call compress_paths,$$(wordlist $4,$5,$$($1))))
$$(shell printf -- "$$(strip $$($1_LPS$4))\n" | $(decompress_paths) $3)
endif
endef
# And an non-receipt version:
define ListPathsSafelyNow
ifneq (,$$(word 10001,$$($1)))
$$(error Cannot list safely more than 10000 paths. $1 has $$(words $$($1)) paths!)
endif
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1,250)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,251,500)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,501,750)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,751,1000)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1001,1250)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1251,1500)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1501,1750)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1751,2000)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2001,2250)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2251,2500)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2501,2750)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2751,3000)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3001,3250)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3251,3500)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3501,3750)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3751,4000)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4001,4250)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4251,4500)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4501,4750)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4751,5000)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5001,5250)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5251,5500)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5501,5750)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5751,6000)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6001,6250)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6251,6500)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6501,6750)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6751,7000)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7001,7250)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7251,7500)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7501,7750)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7751,8000)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8001,8250)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8251,8500)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8501,8750)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8751,9000)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9001,9250)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9251,9500)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9501,9750)
$(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9751,10000)
endef
endif # _MAKEBASE_GMK

176
common/makefiles/Makefile Normal file

@ -0,0 +1,176 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Default to sane output from make.
# Override with empty string to get insane amount of output.
# Override with -d to get even more insane amount of debugging output.
# Override with "-d -p" to get it all.
VERBOSE=-s
# Find all environment or command line variables that begin with ALT.
list_alt_overrides_with_origins = $(filter ALT_%=environment ALT_%=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))
list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
ifneq ($(list_alt_overrides),)
$(info You have set the following ALT_ variables:)
$(foreach var,$(list_alt_overrides), $(info $(var)=$($(var))))
$(error Using ALT_ variables is deprecated! Please clean your environment!)
endif
# The spec.gmk file contains the variables extracted by the configure script.
# It is usually set with SPEC=....spec.gmk on the make command line.
# However if you simply type make from the openjdk source root, it will go looking
# for a spec file, if only one is found, use it. If more than one is found,
# complain. If none is found, request the user to run configure!
SPEC ?= $(wildcard $(CURDIR)/../../build/*/spec.gmk)
ifeq ($(words $(SPEC)),0)
$(error You must run configure!)
endif
ifneq ($(words $(SPEC)),1)
ifeq ($(MAKECMDGOALS),all-conf)
SPECS:=$(shell echo $(SPEC) | sed -e 's|$(CURDIR)/build/||g' -e 's|/spec.gmk|\\n|g' -e 's| ||g')
allconf:
@echo Building configurations:
@printf "$(SPECS)"
@$(foreach s,$(SPEC),($(MAKE) SPEC=$s $(VERBOSE) VERBOSE=$(VERBOSE) images) &&) true
@echo Done building configurations:
@printf "$(SPECS)"
.PHONY: all-conf
else
$(error Since you have more than one output dir configured under build, \
you have to either run make from the output dir of your choice \
or specify run "make SPEC=build/.../spec.gmk" or run all the build configurations \
using "make all-conf")
endif
else
# Now load the spec
-include $(SPEC)
# Load the vital tools for all the makefiles.
-include $(SRC_ROOT)/common/makefiles/MakeBase.gmk
# Remove any build.log from a previous run
ifneq (,$(BUILD_LOG))
$(shell $(RM) $(BUILD_LOG))
endif
# Remove any javac server logs and port files. This
# prevents a new make run to reuse the previous servers.
ifneq (,$(JAVAC_SERVERS))
$(shell mkdir -p $(JAVAC_SERVERS) && rm -rf $(JAVAC_SERVERS)/*)
endif
# Reset the build timers.
$(eval $(call ResetTimers))
# Clean out any notifications from the previous build.
$(shell find $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE))
all: jdk
@$(call StopTimer)
@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
langtools: start-timer
@$(call MakeStart,langtools,all)
@($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(LANGTOOLS_MAKE_ARGS))
@$(call MakeFinish,langtools,all)
corba: langtools
@$(call MakeStart,corba,all)
@($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS))
@$(call MakeFinish,corba,all)
jaxp: langtools
@$(call MakeStart,jaxp,all)
@($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS))
@$(call MakeFinish,jaxp,all)
jaxws: langtools jaxp
@$(call MakeStart,jaxws,all)
@($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS))
@$(call MakeFinish,jaxws,all)
hotspot: langtools
@$(call MakeStart,hotspot,all)
@($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS))
@$(call MakeFinish,hotspot,all)
jdk: langtools corba jaxp jaxws hotspot
@$(call MakeStart,jdk,all)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(JDK_MAKE_ARGS))
@$(call MakeFinish,jdk,all)
images install packages: start-timer jdk langtools corba jaxp jaxws hotspot
@$(call MakeStart,jdk-images,$@)
@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(JDK_MAKE_ARGS) $@)
@$(call MakeFinish,jdk-images,$@)
@$(call StopTimer)
@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
start-timer:
@$(call StartTimer)
.PHONY: jdk hotspot jaxws jaxp corba langtools install images packages start-timer
# Remove everything, except the output from configure.
clean:
@(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v Makefile | grep -v config.status | grep -v config.log | grep -v config.h | grep -v configure-arguments | grep -v "localdevenv.*" | grep -v uncygdrive.exe`)
@$(ECHO) Cleaned everything except the build configuration.
.PHONY: clean
# Remove everything, you have to rerun configure.
dist-clean:
@$(RM) -r $(OUTPUT_ROOT)
@$(ECHO) Cleaned everything, you will have to re-run configure.
.PHONY: dist-clean
clean-jdk:
@(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v Makefile | grep -v config.status | grep -v config.log | grep -v config.h | grep -v configure-arguments | \
grep -v langtools | grep -v corba | grep -v jaxp | grep -v jaxws | grep -v hotspot`)
@$(ECHO) "Cleaned jdk build artifacts (but not langtools,corba,jaxp,jaxws,hotspot nor the build configuration)"
.PHONY: clean
help:
$(info )
$(info Typical make commands:)
$(info make)
$(info make VERBOSE= # print all commands)
$(info make VERBOSE="-d -p" # debug make as well)
$(info make all-conf # build images for all configurations)
$(info make clean # remove build artifacts)
$(info make dist-clean # you have to rerun configure)
# $(info make test # run tests)
$(info make images # create the jdk and jre images)
$(info make install # install the jdk image)
# $(info make modules # EXPERIMENTAL: Migrate JDK into a modularized form!)
$(info make packages # create zips and other packages)
# $(info make eclipse_workspace # Create an Eclipse workspace)
# $(info make netbeans_workspace # Create a NetBeans workspace)
# $(info make vs_workspace # Create a Visual Studio workspace)
.PHONY: help
endif

@ -0,0 +1,277 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# When you read this source. Remember that $(sort ...) has the side effect
# of removing duplicates. It is actually this side effect that is
# desired whenever sort is used below!
ifeq (,$(_MAKEBASE_GMK))
$(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
endif
ifeq ($(COMPILER_TYPE),CC)
COMPILING_MSG=echo Compiling $1
LINKING_MSG=echo Linking $1
LINKING_EXE_MSG=echo Linking executable $1
ARCHIVING_MSG=echo Archiving $1
else
COMPILING_MSG=
LINKING_MSG=
LINKING_EXE_MSG=
ARCHIVING_MSG=
endif
define add_native_source
# param 1 = BUILD_MYPACKAGE
# parma 2 = the source file name (..../alfa.c or .../beta.cpp)
# param 3 = the bin dir that stores all .o (.obj) and .d files.
# param 4 = the c flags to the compiler
# param 5 = the c compiler
# param 6 = the c++ flags to the compiler
# param 7 = the c++ compiler
ifneq (,$$(filter %.c,$2))
# Compile as a C file
$1_$2_FLAGS=$4
$1_$2_COMP=$5
else
# Compile as a C++ file
$1_$2_FLAGS=$6
$1_$2_COMP=$7
endif
# Generate the .o (.obj) file name and place it in the bin dir.
$1_$2_OBJ:=$3/$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(notdir $2)))
# Only continue if this object file hasn't been processed already. This lets the first found
# source file override any other with the same name.
ifeq (,$$(findstring $$($1_$2_OBJ),$$($1_OBJS_SO_FAR)))
$1_OBJS_SO_FAR+=$$($1_$2_OBJ)
# And this is the dependency file for this obj file.
$1_$2_DEP:=$$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ))
# Include previously generated dependency information. (if it exists)
-include $$($1_$2_DEP)
ifeq ($(COMPILER_TYPE),CL)
$1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \
-Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ))
endif
$$($1_$2_OBJ) : $2
ifeq ($(COMPILER_TYPE),CC)
$$(call COMPILING_MSG,$$(notdir $2))
$$($1_$2_COMP) $$($1_$2_FLAGS) -MMD -MF $$($1_$2_DEP) -c $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
endif
ifeq ($(COMPILER_TYPE),CL)
$$(call COMPILING_MSG,$$(notdir $2))
$$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEBUG_OUT_FLAGS) -c $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
endif
endif
endef
define SetupNativeCompilation
# param 1 is for example BUILD_MYPACKAGE
# param 2,3,4,5,6,7,8 are named args.
# SRC one or more directory roots to scan for C/C++ files.
# LANG C or C++
# CFLAGS the compiler flags to be used, used both for C and C++.
# CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS.
# LDFLAGS the linker flags to be used, used both for C and C++.
# LDFLAGS_SUFFIX the linker flags to be added last on the commandline
# typically the libraries linked to.
# ARFLAGS the archiver flags to be used
# BIN the directory where we store the object files
# LIB the resulting library file
# EXE the resulting exec file
# INCLUDES only pick source from these directories
# EXCLUDES do not pick source from these directories
# INCLUDE_FILES only compile exactly these files!
# EXCLUDE_FILES with these names
# VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
# RC_FLAGS flags for RC.
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$(if $(10),$1_$(strip $(10)))
$(if $(11),$1_$(strip $(11)))
$(if $(12),$1_$(strip $(12)))
$(if $(13),$1_$(strip $(13)))
$(if $(14),$1_$(strip $(14)))
$(if $(15),$1_$(strip $(15)))
$(if $(16),$1_$(strip $(16)))
$(if $(17),$1_$(strip $(17)))
$(if $(18),$1_$(strip $(18)))
$(if $(19),$1_$(strip $(19)))
$(if $(20),$1_$(strip $(20)))
ifeq (,$$($1_LANG))
$$(error You have to specify LANG for native compilation $1)
endif
ifeq (C,$$($1_LANG))
$1_LD:=$(LD)
$1_LDEXE:=$(LDEXE)
else
ifeq (C++,$$($1_LANG))
$1_LD:=$(LDCXX)
$1_LDEXE:=$(LDEXECXX)
else
$$(error Unknown native language $$($1_LANG) for $1)
endif
endif
# Make sure the dirs exist.
$$(shell $(MKDIR) -p $$($1_SRC) $$($1_BIN) $$(dir $$($1_LIB)) $$(dir $$($1_EXE)))
# Find all files in the source trees. Sort to remove duplicates.
$1_ALL_SRCS := $$(sort $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f)))
# Extract the C/C++ files.
$1_EXCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_EXCLUDE_FILES)))
$1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
ifneq ($$($1_EXCLUDE_FILES),)
$1_EXCLUDE_FILES:=$$(addprefix %,$$($1_EXCLUDE_FILES))
endif
$1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter %.c %.cpp,$$($1_ALL_SRCS)))
ifneq (,$$(strip $$($1_INCLUDE_FILES)))
$1_SRCS := $$(filter $$($1_INCLUDE_FILES),$$($1_SRCS))
endif
ifeq (,$$($1_SRCS))
$$(error No sources found for $1 when looking inside the dirs $$($1_SRC))
endif
# There can be only a single bin dir root, no need to foreach over the roots.
$1_BINS := $$(wildcard $$($1_BIN)/*$(OBJ_SUFFIX))
# Now we have a list of all c/c++ files to compile: $$($1_SRCS)
# and we have a list of all existing object files: $$($1_BINS)
# Prepend the source/bin path to the filter expressions. Then do the filtering.
ifneq ($$($1_INCLUDES),)
$1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
$1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
endif
ifneq ($$($1_EXCLUDES),)
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
$1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
endif
# Calculate the expected output from compiling the sources (sort to remove duplicates. Also provides
# a reproducable order on the input files to the linker).
$1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_BIN)/,$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(notdir $$($1_SRCS))))))
$1 := $$($1_EXPECTED_OBJS)
# Are there too many object files on disk? Perhaps because some source file was removed?
$1_SUPERFLOUS_OBJS:=$$(sort $$(filter-out $$($1_EXPECTED_OBJS),$$($1_BINS)))
# Clean out the superfluous object files.
$$(shell $(RM) -f $$($1_SUPERFLUOUS_OBJS))
# Pickup extra HOST_OS_API and/or PLATFORM dependent variables for CFLAGS.
$1_EXTRA_CFLAGS:=$$($1_CFLAGS_$(HOST_OS_API)) $$($1_CFLAGS_$(PLATFORM))
ifneq ($(DEBUG_LEVEL),release)
# Pickup extra debug dependent variables for CFLAGS
$1_EXTRA_CFLAGS+=$$($1_CFLAGS_debug)
$1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(HOST_OS_API)_debug)
$1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(PLATFORM)_debug)
else
$1_EXTRA_CFLAGS+=$$($1_CFLAGS_release)
$1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(HOST_OS_API)_release)
$1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(PLATFORM)_release)
endif
# Pickup extra HOST_OS_API and/or PLATFORM dependent variables for CXXFLAGS.
$1_EXTRA_CXXFLAGS:=$$($1_CXXFLAGS_$(HOST_OS_API)) $$($1_CXXFLAGS_$(PLATFORM))
ifneq ($(DEBUG_LEVEL),release)
# Pickup extra debug dependent variables for CXXFLAGS
$1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_debug)
$1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(HOST_OS_API)_debug)
$1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(PLATFORM)_debug)
else
$1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_release)
$1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(HOST_OS_API)_release)
$1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(PLATFORM)_release)
endif
ifeq ($$($1_CXXFLAGS),)
$1_CXXFLAGS:=$$($1_CFLAGS)
endif
ifeq ($$(strip $$($1_EXTRA_CXXFLAGS)),)
$1_EXTRA_CXXFLAGS:=$$($1_EXTRA_CFLAGS)
endif
# Now create a list of the packages that are about to compile. Used when sending source
# in a batch to the compiler.
$$(shell $(RM) $$($1_BIN)/_the.list_of_sources)
$$(eval $$(call ListPathsSafelyNow,$1_SRCS,\n, >> $$($1_BIN)/_the.list_of_sources))
# Now call add_native_source for each source file we are going to compile.
$$(foreach p,$$($1_SRCS),\
$$(eval $$(call add_native_source,$1,$$p,$$($1_BIN),\
$$($1_CFLAGS) $$($1_EXTRA_CFLAGS),$(CC),\
$$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS),$(CXX))))
# On windows we need to create a resource file
ifeq ($(HOST_OS_API), winapi)
ifneq (,$$($1_VERSIONINFO_RESOURCE))
ifneq (,$$($1_LIB))
ifeq (dynamic,$$(patsubst %$(SHARED_LIBRARY_SUFFIX),dynamic,$$($1_LIB)))
$1_RES:=$$(patsubst %$(SHARED_LIBRARY_SUFFIX),%.res,$$($1_LIB))
else
$1_RES:=$$(patsubst %$(STATIC_LIBRARY_SUFFIX),%.res,$$($1_LIB))
endif
endif
ifneq (,$$($1_EXE))
$1_RES:=$$(patsubst %$(EXE_SUFFIX),%.res,$$($1_EXE))
endif
$$($1_RES): $$($1_VERSIONINFO_RESOURCE)
$(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE)
endif
endif
# Pickup extra HOST_OS_API dependent variables (posix or winapi) and
# (linux,solaris,windows,bsd) for LDFLAGS and LDFLAGS_SUFFIX
$1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(HOST_OS_API)) $$($1_LDFLAGS_$(PLATFORM))
$1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(HOST_OS_API)) $$($1_LDFLAGS_SUFFIX_$(PLATFORM))
ifneq (,$$($1_LIB))
ifeq (dynamic,$$(patsubst %$(SHARED_LIBRARY_SUFFIX),dynamic,$$($1_LIB)))
# Generating a dynamic library.
$1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$(notdir $$($1_LIB)))
$$($1_LIB) : $$($1_EXPECTED_OBJS) $$($1_RES)
$$(call LINKING_MSG,$$(notdir $$($1_LIB)))
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$($1_LIB) \
$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
else
# Generating a static library, ie object file archive.
$$($1_LIB) : $$($1_EXPECTED_OBJS) $$($1_RES)
$$(call ARCHIVING_MSG,$$(notdir $$($1_LIB)))
$(AR) $$($1_AR_FLAGS) $(AR_OUT_OPTION)$$($1_LIB) $$($1_EXPECTED_OBJS) \
$$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
endif
endif
ifneq (,$$($1_EXE))
# A executable binary has been specified, setup the target for it.
$$($1_EXE) : $$($1_EXPECTED_OBJS) $$($1_RES)
$$(call LINKING_EXE_MSG,$$(notdir $$($1_EXE)))
$$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_EXE) \
$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
endif
endef

@ -0,0 +1,103 @@
#
# Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
define SetupRMICompilation
# param 1 is a name for a variable to depend on.
# param 2 and up are named args.
# CLASSES:=List of classes to generate stubs for
# CLASSES_DIR:=Directory where to look for classes
# STUB_CLASSES_DIR:=Directory in where to put stub classes
# RUN_V11:=Set to run rmic with -v1.1
# RUN_V12:=Set to run rmic with -v1.2
# RUN_IIOP:=Set to run rmic with -iiop
# RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage
# KEEP_GENERATED:=Set to keep generated sources around
$(if $2,$1_$(strip $2))
$(if $3,$1_$(strip $3))
$(if $4,$1_$(strip $4))
$(if $5,$1_$(strip $5))
$(if $6,$1_$(strip $6))
$(if $7,$1_$(strip $7))
$(if $8,$1_$(strip $8))
$(if $9,$1_$(strip $9))
$1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/$1_rmic
$1_CLASSES_SLASH := $$(subst .,/,$$($1_CLASSES))
$1_CLASS_FILES := $$(addprefix $$($1_CLASSES_DIR)/,$$(addsuffix .class,$$($1_CLASSES_SLASH)))
$1_STUB_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Stub.class,$$($1_CLASSES_SLASH)))
$1_TARGETS := $$($1_STUB_FILES)
$1_ARGS :=
ifneq (,$$($1_RUN_V11))
$1_SKEL_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Skel.class,$$($1_CLASSES_SLASH)))
$1_TARGETS += $$($1_SKEL_FILES)
$1_ARGS += -v1.1
endif
ifneq (,$$($1_RUN_V12))
$1_ARGS += -v1.2
endif
$1_TIE_BASE_FILES := $$(foreach f,$$($1_CLASSES_SLASH),$$(dir $$f)_$$(notdir $$f))
$1_TIE_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/org/omg/stub/,$$(addsuffix _Tie.class,$$($1_TIE_BASE_FILES)))
$1_TIE_STDPKG_FILES := $$(addprefix $$($1_STUB_CLASSES_DIR)/,$$(addsuffix _Tie.class,$$($1_TIE_BASE_FILES)))
ifneq (,$$($1_RUN_IIOP))
$1_TARGETS += $$($1_TIE_FILES)
$1_ARGS += -iiop
endif
ifneq (,$$($1_RUN_IIOP_STDPKG))
$1_TARGETS += $$($1_TIE_STDPKG_FILES)
$1_ARGS2 := -iiop -standardPackage
endif
ifneq (,$$($1_KEEP_GENERATED))
$1_ARGS += -keepgenerated
$1_TARGETS += $$(subst .class,.java,$$($1_TARGETS))
endif
$1_DOLLAR_SAFE_CLASSES := $$(subst $$$$,\$$$$,$$($1_CLASSES))
$$($1_TARGETS): $$($1_DEP_FILE) $$($1_CLASS_FILES)
$$($1_DEP_FILE): $$($1_CLASS_FILES)
$(MKDIR) -p $$($1_STUB_CLASSES_DIR)
if [ "x$$($1_ARGS)" != "x" ]; then \
$(ECHO) Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES) &&\
$(RMIC) $$($1_ARGS) -classpath "$$($1_CLASSES_DIR)" \
-d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES);\
fi;
if [ "x$$($1_ARGS2)" != "x" ]; then \
$(ECHO) Running rmic $$($1_ARGS2) for $$($1_DOLLAR_SAFE_CLASSES) &&\
$(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \
-d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES);\
fi;
$1 := $$($1_TARGETS)
# By marking as secondary, this "touch" file doesn't need to be touched and will never exist.
.SECONDARY: $$($1_DEP_FILE)
endef

@ -0,0 +1 @@
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

@ -0,0 +1 @@
$(subst com,X01,$(subst org,X02,$(subst sun,X03,$(subst java,X04,$(subst javax,X05,$(subst sun/io,X06,$(subst com/sun,X07,$(subst java/io,X08,$(subst org/omg,X09,$(subst org/w3c,X10,$(subst org/xml,X11,$(subst sun/awt,X12,$(subst sun/net,X13,$(subst sun/nio,X14,$(subst sun/rmi,X15,$(subst java/awt,X16,$(subst java/net,X17,$(subst java/nio,X18,$(subst java/rmi,X19,$(subst META-INF,X20,$(subst sun/font,X21,$(subst sun/misc,X22,$(subst sun/text,X23,$(subst sun/util,X24,$(subst java/lang,X25,$(subst java/math,X26,$(subst java/text,X27,$(subst java/util,X28,$(subst javax/jws,X29,$(subst javax/net,X30,$(subst javax/rmi,X31,$(subst javax/xml,X32,$(subst sun/corba,X33,$(subst sun/print,X34,$(subst sun/swing,X35,$(subst java/beans,X36,$(subst javax/lang,X37,$(subst sun/applet,X38,$(subst sun/java2d,X39,$(subst java/applet,X40,$(subst javax/print,X41,$(subst javax/sound,X42,$(subst javax/swing,X43,$(subst javax/tools,X44,$(subst jdk/classes,X45,$(subst org/relaxng,X46,$(subst sun/reflect,X47,$(subst javax/crypto,X48,$(subst javax/naming,X49,$(subst jaxp/classes,X50,$(subst sun/security,X51,$(subst corba/classes,X52,$(subst java/security,X53,$(subst javax/imageio,X54,$(subst jdk/btclasses,X55,$(subst javax/activity,X56,$(subst javax/security,X57,$(subst jdk/newclasses,X58,$(subst sun/instrument,X59,$(subst sun/management,X60,$(subst corba/btclasses,X61,$(subst jdk/democlasses,X62,$(subst javax/activation,X63,$(subst javax/annotation,X64,$(subst javax/management,X65,$(subst javax/transaction,X66,$(subst jaxws/jaf_classes,X67,$(subst langtools/classes,X68,$(subst META-INF/services,X69,$(subst jdk/newdemoclasses,X70,$(subst javax/accessibility,X71,$(subst jaxws/jaxws_classes,X72,

@ -0,0 +1,72 @@
s|X01|com|g
s|X02|org|g
s|X03|sun|g
s|X04|java|g
s|X05|javax|g
s|X06|sun/io|g
s|X07|com/sun|g
s|X08|java/io|g
s|X09|org/omg|g
s|X10|org/w3c|g
s|X11|org/xml|g
s|X12|sun/awt|g
s|X13|sun/net|g
s|X14|sun/nio|g
s|X15|sun/rmi|g
s|X16|java/awt|g
s|X17|java/net|g
s|X18|java/nio|g
s|X19|java/rmi|g
s|X20|META-INF|g
s|X21|sun/font|g
s|X22|sun/misc|g
s|X23|sun/text|g
s|X24|sun/util|g
s|X25|java/lang|g
s|X26|java/math|g
s|X27|java/text|g
s|X28|java/util|g
s|X29|javax/jws|g
s|X30|javax/net|g
s|X31|javax/rmi|g
s|X32|javax/xml|g
s|X33|sun/corba|g
s|X34|sun/print|g
s|X35|sun/swing|g
s|X36|java/beans|g
s|X37|javax/lang|g
s|X38|sun/applet|g
s|X39|sun/java2d|g
s|X40|java/applet|g
s|X41|javax/print|g
s|X42|javax/sound|g
s|X43|javax/swing|g
s|X44|javax/tools|g
s|X45|jdk/classes|g
s|X46|org/relaxng|g
s|X47|sun/reflect|g
s|X48|javax/crypto|g
s|X49|javax/naming|g
s|X50|jaxp/classes|g
s|X51|sun/security|g
s|X52|corba/classes|g
s|X53|java/security|g
s|X54|javax/imageio|g
s|X55|jdk/btclasses|g
s|X56|javax/activity|g
s|X57|javax/security|g
s|X58|jdk/newclasses|g
s|X59|sun/instrument|g
s|X60|sun/management|g
s|X61|corba/btclasses|g
s|X62|jdk/democlasses|g
s|X63|javax/activation|g
s|X64|javax/annotation|g
s|X65|javax/management|g
s|X66|javax/transaction|g
s|X67|jaxws/jaf_classes|g
s|X68|langtools/classes|g
s|X69|META-INF/services|g
s|X70|jdk/newdemoclasses|g
s|X71|javax/accessibility|g
s|X72|jaxws/jaxws_classes|g

254
common/src/uncygdrive.c Normal file

@ -0,0 +1,254 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <Windows.h>
#include <io.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
/*
* Test if pos points to /cygdrive/_/ where _ can
* be any character.
*/
int is_cygdrive_here(int pos, char *in, int len)
{
// Length of /cygdrive/c/ is 12
if (pos+12 > len) return 0;
if (in[pos+11]=='/' &&
in[pos+9]=='/' &&
in[pos+8]=='e' &&
in[pos+7]=='v' &&
in[pos+6]=='i' &&
in[pos+5]=='r' &&
in[pos+4]=='d' &&
in[pos+3]=='g' &&
in[pos+2]=='y' &&
in[pos+1]=='c' &&
in[pos+0]=='/') {
return 1;
}
return 0;
}
/*
* Replace /cygdrive/_/ with _:/
* Works in place since drive letter is always
* shorter than /cygdrive/
*/
char *replace_cygdrive(char *in)
{
int len = strlen(in);
char *out = malloc(len+1);
int i,j;
if (len < 12) {
strcpy(out, in);
return out;
}
for (i = 0, j = 0; i<len;) {
if (is_cygdrive_here(i, in, len)) {
out[j++] = in[i+10];
out[j++] = ':';
i+=11;
} else {
out[j] = in[i];
i++;
j++;
}
}
out[j] = 0;
return out;
}
void append(char **b, size_t *bl, size_t *u, char *add, size_t addlen)
{
while ( (addlen+*u+1) > *bl) {
*bl *= 2;
*b = realloc(*b, *bl);
}
memcpy(*b+*u, add, addlen);
*u += addlen;
}
/*
* Creates a new string from in where the first occurance of sub is
* replaced by rep.
*/
char *replace_substring(char *in, char *sub, char *rep)
{
int in_len = strlen(in);
int sub_len = strlen(sub);
int rep_len = strlen(rep);
char *out = malloc(in_len - sub_len + rep_len + 1);
char *p;
if (!(p = strstr(in, sub))) {
// If sub isn't a substring of in, just return in.
return in;
}
// Copy characters from beginning of in to start of sub.
strncpy(out, in, p - in);
out[p - in] = '\0';
sprintf(out + (p - in), "%s%s", rep, p + sub_len);
return out;
}
char *files_to_delete[1024];
int num_files_to_delete = 0;
char *fix_at_file(char *in)
{
char *tmpdir;
char name[2048];
char *atname;
char *buffer;
size_t buflen=65536;
size_t used=0;
size_t len;
int rc;
FILE *atout;
FILE *atin;
char block[2048];
size_t blocklen;
char *fixed;
atin = fopen(in+1, "r");
if (atin == NULL) {
fprintf(stderr, "Could not read at file %s\n", in+1);
exit(-1);
}
tmpdir = getenv("TMP");
if (tmpdir == NULL) {
tmpdir = "c:/cygwin/tmp";
}
_snprintf(name, sizeof(name), "%s\\atfile_XXXXXX", tmpdir);
rc = _mktemp_s(name, strlen(name)+1);
if (rc) {
fprintf(stderr, "Could not create temporary file name for at file!\n");
exit(-1);
}
atout = fopen(name, "w");
if (atout == NULL) {
fprintf(stderr, "Could open temporary file for writing! %s\n", name);
exit(-1);
}
buffer = malloc(buflen);
while((blocklen = fread(block,1,sizeof(block),atin)) > 0) {
append(&buffer, &buflen, &used, block, blocklen);
}
buffer[used] = 0;
fixed = replace_cygdrive(buffer);
fwrite(fixed, strlen(fixed), 1, atout);
fclose(atin);
fclose(atout);
free(fixed);
free(buffer);
files_to_delete[num_files_to_delete] = malloc(strlen(name)+1);
strcpy(files_to_delete[num_files_to_delete], name);
num_files_to_delete++;
atname = malloc(strlen(name)+2);
atname[0] = '@';
strcpy(atname+1, name);
return atname;
}
int main(int argc, char **argv)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
unsigned short rc;
char *new_at_file;
char *old_at_file;
char *line;
int i;
DWORD exitCode;
if (argc<2) {
fprintf(stderr, "Usage: uncygdrive.exe /cygdrive/c/WINDOWS/notepad.exe /cygdrive/c/x/test.txt");
exit(0);
}
line = replace_cygdrive(strstr(GetCommandLine(), argv[1]));
for (i=1; i<argc; ++i) {
if (argv[i][0] == '@') {
// Found at-file! Fix it!
old_at_file = replace_cygdrive(argv[i]);
new_at_file = fix_at_file(old_at_file);
line = replace_substring(line, old_at_file, new_at_file);
}
}
if (getenv("DEBUG_UNCYGDRIVE") != NULL) {
fprintf(stderr, "uncygdrive >%s<\n", line);
}
ZeroMemory(&si,sizeof(si));
si.cb=sizeof(si);
ZeroMemory(&pi,sizeof(pi));
rc = CreateProcess(NULL,
line,
0,
0,
TRUE,
0,
0,
0,
&si,
&pi);
if(!rc)
{
//Could not start process;
fprintf(stderr, "Could not start process!\n");
exit(-1);
}
WaitForSingleObject(pi.hProcess,INFINITE);
GetExitCodeProcess(pi.hProcess,&exitCode);
if (getenv("DEBUG_UNCYGDRIVE") != NULL) {
for (i=0; i<num_files_to_delete; ++i) {
fprintf(stderr, "Not deleting temporary uncygdrive file %s\n",
files_to_delete[i]);
}
}
else {
for (i=0; i<num_files_to_delete; ++i) {
remove(files_to_delete[i]);
}
}
exit(exitCode);
}