undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com Patches, unit tests, benchmarks, whitepaper, and outreach briefs. Public domain — no copyright claimed. Use freely.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
466
make/Bundles.gmk
Normal file
466
make/Bundles.gmk
Normal file
|
|
@ -0,0 +1,466 @@
|
|||
#
|
||||
# Copyright (c) 2016, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include MakeIO.gmk
|
||||
|
||||
PRODUCT_TARGETS :=
|
||||
LEGACY_TARGETS :=
|
||||
TEST_TARGETS :=
|
||||
DOCS_TARGETS :=
|
||||
|
||||
# On Windows tar frequently complains that "file changed as we read it" for
|
||||
# some random source files. This seems to be cause by anti virus scanners and
|
||||
# is most likely safe to ignore. When it happens, tar returns '1'.
|
||||
ifeq ($(call isBuildOs, windows), true)
|
||||
TAR_IGNORE_EXIT_VALUE := || test "$$$$?" = "1"
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# BUNDLE : Name of bundle to create
|
||||
# FILES : Files in BASE_DIRS to add to bundle
|
||||
# SPECIAL_INCLUDES : List of directories inside BASE_DIRS to look for additional
|
||||
# files in. These files will not get proper dependency handling. Use when
|
||||
# files or directories may contain spaces.
|
||||
# BASE_DIRS : Base directories for the root dir in the bundle.
|
||||
# SUBDIR : Optional name of root dir in bundle.
|
||||
# OUTPUTDIR : Optionally override output dir
|
||||
SetupBundleFile = $(NamedParamsMacroTemplate)
|
||||
define SetupBundleFileBody
|
||||
|
||||
$$(foreach d, $$($1_BASE_DIRS), \
|
||||
$$(eval $1_$$d_RELATIVE_FILES := $$$$(patsubst $$d/%, %, \
|
||||
$$$$(filter $$d/%, $$$$($1_FILES)))) \
|
||||
$$(eval $1_$$d_LIST_FILE := \
|
||||
$(SUPPORT_OUTPUTDIR)/bundles/_$1_$$$$(subst /,_,$$$$(patsubst $(OUTPUTDIR)/%,%,$$d)_files)) \
|
||||
)
|
||||
|
||||
ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), )
|
||||
$1_TYPE := tar.gz
|
||||
else ifneq ($$(filter %.zip, $$($1_BUNDLE_NAME)), )
|
||||
$1_TYPE := zip
|
||||
else
|
||||
$$(error Unknown bundle type $$($1_BUNDLE_NAME))
|
||||
endif
|
||||
|
||||
$$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
|
||||
|
||||
$$(call SetIfEmpty, $1_OUTPUTDIR, $$(BUNDLES_OUTPUTDIR))
|
||||
|
||||
$$($1_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
|
||||
$$(call MakeTargetDir)
|
||||
$$(call LogWarn, Creating $$($1_BUNDLE_NAME))
|
||||
# If any of the files contain a space in the file name, FindFiles
|
||||
# will have replaced it with ?. Tar does not accept that so need to
|
||||
# switch it back.
|
||||
$$(foreach d, $$($1_BASE_DIRS), \
|
||||
$$(eval $$(call ListPathsSafely, \
|
||||
$1_$$d_RELATIVE_FILES, $$($1_$$d_LIST_FILE))) \
|
||||
$$(CAT) $$($1_$$d_LIST_FILE) | $$(TR) '?' ' ' > $$($1_$$d_LIST_FILE).tmp \
|
||||
&& $(MV) $$($1_$$d_LIST_FILE).tmp $$($1_$$d_LIST_FILE) $$(NEWLINE) \
|
||||
)
|
||||
ifneq ($$($1_SPECIAL_INCLUDES), )
|
||||
$$(foreach i, $$($1_SPECIAL_INCLUDES), \
|
||||
$$(foreach d, $$($1_BASE_DIRS), \
|
||||
($(CD) $$d && $(FIND) $$i >> $$($1_$$d_LIST_FILE)) ; ))
|
||||
endif
|
||||
ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO), .-zip-false)
|
||||
# If no subdir is specified, zip can be done directly from BASE_DIRS.
|
||||
$$(foreach d, $$($1_BASE_DIRS), \
|
||||
( $(CD) $$d \
|
||||
&& $(ZIPEXE) -qru $$@ . -i@$$($1_$$d_LIST_FILE) \
|
||||
|| test "$$$$?" = "12" )$$(NEWLINE))
|
||||
else ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO)-$$(words $$($1_BASE_DIRS)), \
|
||||
.-tar.gz-false-1)
|
||||
# If no subdir is specified and only one BASE_DIR, tar.gz can be done
|
||||
# directly from BASE_DIR.
|
||||
$(CD) $$($1_BASE_DIRS) \
|
||||
&& ( $(TAR) cf - \
|
||||
-$(TAR_INCLUDE_PARAM) $$($1_$$($1_BASE_DIRS)_LIST_FILE) \
|
||||
$(TAR_IGNORE_EXIT_VALUE) ) \
|
||||
| $(GZIP) > $$@
|
||||
else ifeq ($$($1_TYPE)-$(TAR_SUPPORTS_TRANSFORM)-$$($1_UNZIP_DEBUGINFO)-$$(words $$($1_BASE_DIRS)), \
|
||||
tar.gz-true-false-1)
|
||||
# If only one BASE_DIR, but with a SUBDIR set, tar.gz can use the
|
||||
# transform option to create bundle directly from the BASE_DIR.
|
||||
$(CD) $$($1_BASE_DIRS) \
|
||||
&& ( $(TAR) cf - \
|
||||
-$(TAR_INCLUDE_PARAM) $$($1_$$($1_BASE_DIRS)_LIST_FILE) \
|
||||
$$(if $$($1_SUBDIR), --transform 's|^|$$($1_SUBDIR)/|S') \
|
||||
$(TAR_IGNORE_EXIT_VALUE) ) \
|
||||
| $(GZIP) > $$@
|
||||
else
|
||||
# In all other cases, need to copy all files into a temporary location
|
||||
# before creation bundle.
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
|
||||
$(MKDIR) -p $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
|
||||
$$(foreach d, $$($1_BASE_DIRS), \
|
||||
( $(CD) $$d \
|
||||
&& $(TAR) cf - -$(TAR_INCLUDE_PARAM) $$($1_$$d_LIST_FILE) \
|
||||
$(TAR_IGNORE_EXIT_VALUE) ) \
|
||||
| ( $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) && $(TAR) xf - )$$(NEWLINE) )
|
||||
# Unzip any zipped debuginfo files
|
||||
ifeq ($$($1_UNZIP_DEBUGINFO), true)
|
||||
for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.diz"`; do \
|
||||
$(CD) $$$${f%/*} && $(UNZIP) -q $$$${f} && $(RM) $$$${f}; \
|
||||
done
|
||||
endif
|
||||
ifeq ($$($1_TYPE), tar.gz)
|
||||
$(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && \
|
||||
( $(TAR) cf - \
|
||||
$$(if $$($1_SUBDIR), $$($1_SUBDIR), .) $(TAR_IGNORE_EXIT_VALUE) ) \
|
||||
| $(GZIP) > $$@
|
||||
else ifeq ($$($1_TYPE), zip)
|
||||
$(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIPEXE) -qr $$@ .
|
||||
endif
|
||||
endif
|
||||
|
||||
$1 += $$($1_OUTPUTDIR)/$$($1_BUNDLE_NAME)
|
||||
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
|
||||
# On Macosx, we bundle up the macosx specific images which already have the
|
||||
# correct base directories.
|
||||
ifeq ($(call isTargetOs, macosx)+$(DEBUG_LEVEL), true+release)
|
||||
JDK_IMAGE_DIR := $(JDK_MACOSX_BUNDLE_DIR)
|
||||
JRE_IMAGE_DIR := $(JRE_MACOSX_BUNDLE_DIR)
|
||||
JDK_IMAGE_HOMEDIR := $(JDK_MACOSX_CONTENTS_DIR)/Home
|
||||
JRE_IMAGE_HOMEDIR := $(JRE_MACOSX_CONTENTS_DIR)/Home
|
||||
JDK_BUNDLE_SUBDIR :=
|
||||
JRE_BUNDLE_SUBDIR :=
|
||||
# In certain situations, the JDK_IMAGE_DIR points to an image without the
|
||||
# the symbols and demos. If so, the symobls and demos can be found in a
|
||||
# separate image. These variables allow for overriding from a custom makefile.
|
||||
JDK_SYMBOLS_IMAGE_DIR ?= $(JDK_IMAGE_DIR)
|
||||
JDK_DEMOS_IMAGE_DIR ?= $(JDK_IMAGE_DIR)
|
||||
JDK_DEMOS_IMAGE_HOMEDIR ?= $(JDK_DEMOS_IMAGE_DIR)/$(JDK_MACOSX_CONTENTS_SUBDIR)/Home
|
||||
else
|
||||
JDK_IMAGE_HOMEDIR := $(JDK_IMAGE_DIR)
|
||||
JRE_IMAGE_HOMEDIR := $(JRE_IMAGE_DIR)
|
||||
JDK_BUNDLE_SUBDIR := jdk-$(VERSION_NUMBER)
|
||||
JRE_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)
|
||||
STATIC_JDK_BUNDLE_SUBDIR := static-jdk-$(VERSION_NUMBER)
|
||||
ifneq ($(DEBUG_LEVEL), release)
|
||||
JDK_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
|
||||
JRE_BUNDLE_SUBDIR := $(JRE_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
|
||||
STATIC_JDK_BUNDLE_SUBDIR := $(STATIC_JDK_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
|
||||
endif
|
||||
# In certain situations, the JDK_IMAGE_DIR points to an image without the
|
||||
# the symbols and demos. If so, the symobls and demos can be found in a
|
||||
# separate image. These variables allow for overriding from a custom makefile.
|
||||
JDK_SYMBOLS_IMAGE_DIR ?= $(JDK_IMAGE_DIR)
|
||||
JDK_DEMOS_IMAGE_DIR ?= $(JDK_IMAGE_DIR)
|
||||
JDK_DEMOS_IMAGE_HOMEDIR ?= $(JDK_DEMOS_IMAGE_DIR)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
ifneq ($(filter product-bundles% legacy-bundles, $(MAKECMDGOALS)), )
|
||||
|
||||
# There may be files with spaces in the names, so use ShellFindFiles explicitly.
|
||||
ALL_JDK_FILES := $(call ShellFindFiles, $(JDK_IMAGE_DIR))
|
||||
ifneq ($(JDK_IMAGE_DIR), $(JDK_DEMOS_IMAGE_DIR))
|
||||
ALL_JDK_DEMOS_FILES := $(call ShellFindFiles, $(JDK_DEMOS_IMAGE_DIR))
|
||||
else
|
||||
ALL_JDK_DEMOS_FILES := $(ALL_JDK_FILES)
|
||||
endif
|
||||
|
||||
JDK_BUNDLE_FILES := \
|
||||
$(filter-out \
|
||||
$(JDK_EXTRA_EXCLUDES) \
|
||||
$(JDK_IMAGE_HOMEDIR)/demo/% \
|
||||
, \
|
||||
$(ALL_JDK_FILES) \
|
||||
)
|
||||
|
||||
JDK_SYMBOLS_BUNDLE_FILES := $(call FindFiles, $(SYMBOLS_IMAGE_DIR))
|
||||
|
||||
TEST_DEMOS_BUNDLE_FILES := $(filter $(JDK_DEMOS_IMAGE_HOMEDIR)/demo/%, \
|
||||
$(ALL_JDK_DEMOS_FILES))
|
||||
|
||||
ALL_JRE_FILES := $(call ShellFindFiles, $(JRE_IMAGE_DIR))
|
||||
|
||||
JRE_BUNDLE_FILES := $(ALL_JRE_FILES)
|
||||
|
||||
ifeq ($(MACOSX_CODESIGN_MODE), hardened)
|
||||
# Macosx release build and code signing available.
|
||||
|
||||
############################################################################
|
||||
# JDK bundle
|
||||
$(eval $(call SetupCopyFiles, CREATE_JDK_BUNDLE_DIR_SIGNED, \
|
||||
SRC := $(JDK_IMAGE_DIR), \
|
||||
FILES := $(JDK_BUNDLE_FILES), \
|
||||
DEST := $(JDK_MACOSX_BUNDLE_DIR_SIGNED), \
|
||||
))
|
||||
|
||||
JDK_SIGNED_CODE_RESOURCES := \
|
||||
$(JDK_MACOSX_BUNDLE_DIR_SIGNED)/$(JDK_MACOSX_CONTENTS_SUBDIR)/_CodeSignature/CodeResources
|
||||
|
||||
$(JDK_SIGNED_CODE_RESOURCES): $(CREATE_JDK_BUNDLE_DIR_SIGNED)
|
||||
$(call LogWarn, Signing $(JDK_BUNDLE_NAME))
|
||||
$(CODESIGN) -s "$(MACOSX_CODESIGN_IDENTITY)" \
|
||||
--timestamp --options runtime --deep --force \
|
||||
$(JDK_MACOSX_BUNDLE_DIR_SIGNED)/$(JDK_MACOSX_BUNDLE_TOP_SUBDIR) $(LOG_DEBUG)
|
||||
$(TOUCH) $@
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_JDK_BUNDLE, \
|
||||
BUNDLE_NAME := $(JDK_BUNDLE_NAME), \
|
||||
FILES := \
|
||||
$(CREATE_JDK_BUNDLE_DIR_SIGNED) \
|
||||
$(JDK_SIGNED_CODE_RESOURCES), \
|
||||
BASE_DIRS := $(JDK_MACOSX_BUNDLE_DIR_SIGNED), \
|
||||
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
||||
))
|
||||
|
||||
PRODUCT_TARGETS += $(BUILD_JDK_BUNDLE)
|
||||
|
||||
############################################################################
|
||||
# JRE bundle
|
||||
$(eval $(call SetupCopyFiles, CREATE_JRE_BUNDLE_DIR_SIGNED, \
|
||||
SRC := $(JRE_IMAGE_DIR), \
|
||||
FILES := $(JRE_BUNDLE_FILES), \
|
||||
DEST := $(JRE_MACOSX_BUNDLE_DIR_SIGNED), \
|
||||
))
|
||||
|
||||
JRE_SIGNED_CODE_RESOURCES := \
|
||||
$(JRE_MACOSX_BUNDLE_DIR_SIGNED)/$(JRE_MACOSX_CONTENTS_SUBDIR)/_CodeSignature/CodeResources
|
||||
|
||||
$(JRE_SIGNED_CODE_RESOURCES): $(CREATE_JRE_BUNDLE_DIR_SIGNED)
|
||||
$(call LogWarn, Signing $(JRE_BUNDLE_NAME))
|
||||
$(CODESIGN) -s "$(MACOSX_CODESIGN_IDENTITY)" \
|
||||
--timestamp --options runtime --deep --force \
|
||||
$(JRE_MACOSX_BUNDLE_DIR_SIGNED)/$(JRE_MACOSX_BUNDLE_TOP_SUBDIR) $(LOG_DEBUG)
|
||||
$(TOUCH) $@
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_JRE_BUNDLE, \
|
||||
BUNDLE_NAME := $(JRE_BUNDLE_NAME), \
|
||||
FILES := \
|
||||
$(CREATE_JRE_BUNDLE_DIR_SIGNED) \
|
||||
$(JRE_SIGNED_CODE_RESOURCES), \
|
||||
BASE_DIRS := $(JRE_MACOSX_BUNDLE_DIR_SIGNED), \
|
||||
SUBDIR := $(JRE_BUNDLE_SUBDIR), \
|
||||
))
|
||||
|
||||
LEGACY_TARGETS += $(BUILD_JRE_BUNDLE)
|
||||
else
|
||||
# Not a Macosx release build or code signing not available.
|
||||
$(eval $(call SetupBundleFile, BUILD_JDK_BUNDLE, \
|
||||
BUNDLE_NAME := $(JDK_BUNDLE_NAME), \
|
||||
FILES := $(JDK_BUNDLE_FILES), \
|
||||
SPECIAL_INCLUDES := $(JDK_SPECIAL_INCLUDES), \
|
||||
BASE_DIRS := $(JDK_IMAGE_DIR), \
|
||||
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
||||
))
|
||||
|
||||
PRODUCT_TARGETS += $(BUILD_JDK_BUNDLE)
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_JRE_BUNDLE, \
|
||||
BUNDLE_NAME := $(JRE_BUNDLE_NAME), \
|
||||
FILES := $(JRE_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(JRE_IMAGE_DIR), \
|
||||
SUBDIR := $(JRE_BUNDLE_SUBDIR), \
|
||||
))
|
||||
|
||||
LEGACY_TARGETS += $(BUILD_JRE_BUNDLE)
|
||||
endif
|
||||
|
||||
ifeq ($(COPY_DEBUG_SYMBOLS), true)
|
||||
$(eval $(call SetupBundleFile, BUILD_JDK_SYMBOLS_BUNDLE, \
|
||||
BUNDLE_NAME := $(JDK_SYMBOLS_BUNDLE_NAME), \
|
||||
FILES := $(JDK_SYMBOLS_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(SYMBOLS_IMAGE_DIR), \
|
||||
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
||||
UNZIP_DEBUGINFO := true, \
|
||||
))
|
||||
|
||||
PRODUCT_TARGETS += $(BUILD_JDK_SYMBOLS_BUNDLE)
|
||||
endif
|
||||
|
||||
# The demo bundle is only created to support client tests. Ideally it should
|
||||
# be built with the main test bundle, but since the prerequisites match
|
||||
# better with the product build, it makes more sense to keep it there for now.
|
||||
$(eval $(call SetupBundleFile, BUILD_TEST_DEMOS_BUNDLE, \
|
||||
BUNDLE_NAME := $(TEST_DEMOS_BUNDLE_NAME), \
|
||||
FILES := $(TEST_DEMOS_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(JDK_DEMOS_IMAGE_DIR), \
|
||||
SUBDIR := $(JDK_BUNDLE_SUBDIR), \
|
||||
))
|
||||
|
||||
PRODUCT_TARGETS += $(BUILD_TEST_DEMOS_BUNDLE)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
ifneq ($(filter test-bundles, $(MAKECMDGOALS)), )
|
||||
TEST_BUNDLE_FILES := $(call FindFiles, $(TEST_IMAGE_DIR))
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \
|
||||
BUNDLE_NAME := $(TEST_BUNDLE_NAME), \
|
||||
FILES := $(TEST_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(TEST_IMAGE_DIR), \
|
||||
))
|
||||
|
||||
TEST_TARGETS += $(BUILD_TEST_BUNDLE)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
ifneq ($(filter docs-jdk-bundles, $(MAKECMDGOALS)), )
|
||||
DOCS_JDK_BUNDLE_FILES := $(call FindFiles, $(DOCS_JDK_IMAGE_DIR))
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_DOCS_JDK_BUNDLE, \
|
||||
BUNDLE_NAME := $(DOCS_JDK_BUNDLE_NAME), \
|
||||
FILES := $(DOCS_JDK_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(DOCS_JDK_IMAGE_DIR), \
|
||||
SUBDIR := docs, \
|
||||
))
|
||||
|
||||
DOCS_JDK_TARGETS += $(BUILD_DOCS_JDK_BUNDLE)
|
||||
endif
|
||||
|
||||
ifneq ($(filter docs-javase-bundles, $(MAKECMDGOALS)), )
|
||||
DOCS_JAVASE_BUNDLE_FILES := $(call FindFiles, $(DOCS_JAVASE_IMAGE_DIR))
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_DOCS_JAVASE_BUNDLE, \
|
||||
BUNDLE_NAME := $(DOCS_JAVASE_BUNDLE_NAME), \
|
||||
FILES := $(DOCS_JAVASE_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(DOCS_JAVASE_IMAGE_DIR), \
|
||||
SUBDIR := docs-javase, \
|
||||
))
|
||||
|
||||
DOCS_JAVASE_TARGETS += $(BUILD_DOCS_JAVASE_BUNDLE)
|
||||
endif
|
||||
|
||||
ifneq ($(filter docs-reference-bundles, $(MAKECMDGOALS)), )
|
||||
DOCS_REFERENCE_BUNDLE_FILES := $(call FindFiles, $(DOCS_REFERENCE_IMAGE_DIR))
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_DOCS_REFERENCE_BUNDLE, \
|
||||
BUNDLE_NAME := $(DOCS_REFERENCE_BUNDLE_NAME), \
|
||||
FILES := $(DOCS_REFERENCE_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(DOCS_REFERENCE_IMAGE_DIR), \
|
||||
SUBDIR := docs-reference, \
|
||||
))
|
||||
|
||||
DOCS_REFERENCE_TARGETS += $(BUILD_DOCS_REFERENCE_BUNDLE)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
ifneq ($(filter jcov-bundles, $(MAKECMDGOALS)), )
|
||||
JCOV_BUNDLE_FILES := $(call FindFiles, $(JCOV_IMAGE_DIR))
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_JCOV_BUNDLE, \
|
||||
BUNDLE_NAME := $(JCOV_BUNDLE_NAME), \
|
||||
FILES := $(JCOV_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(JCOV_IMAGE_DIR), \
|
||||
SUBDIR := jdk-$(VERSION_NUMBER), \
|
||||
))
|
||||
|
||||
JCOV_TARGETS += $(BUILD_JCOV_BUNDLE)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
ifneq ($(filter static-libs-bundles, $(MAKECMDGOALS)), )
|
||||
STATIC_LIBS_BUNDLE_FILES := $(call FindFiles, $(STATIC_LIBS_IMAGE_DIR))
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS)-$(DEBUG_LEVEL), macosx-release)
|
||||
STATIC_LIBS_BUNDLE_SUBDIR := $(JDK_MACOSX_CONTENTS_SUBDIR)/Home
|
||||
else
|
||||
STATIC_LIBS_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)
|
||||
endif
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_STATIC_LIBS_BUNDLE, \
|
||||
BUNDLE_NAME := $(STATIC_LIBS_BUNDLE_NAME), \
|
||||
FILES := $(STATIC_LIBS_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(STATIC_LIBS_IMAGE_DIR), \
|
||||
SUBDIR := $(STATIC_LIBS_BUNDLE_SUBDIR), \
|
||||
))
|
||||
|
||||
STATIC_LIBS_TARGETS += $(BUILD_STATIC_LIBS_BUNDLE)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
ifneq ($(filter static-libs-graal-bundles, $(MAKECMDGOALS)), )
|
||||
STATIC_LIBS_GRAAL_BUNDLE_FILES := $(call FindFiles, $(STATIC_LIBS_GRAAL_IMAGE_DIR))
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS)-$(DEBUG_LEVEL), macosx-release)
|
||||
STATIC_LIBS_GRAAL_BUNDLE_SUBDIR := $(JDK_MACOSX_CONTENTS_SUBDIR)/Home
|
||||
else
|
||||
STATIC_LIBS_GRAAL_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)
|
||||
endif
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_STATIC_LIBS_GRAAL_BUNDLE, \
|
||||
BUNDLE_NAME := $(STATIC_LIBS_GRAAL_BUNDLE_NAME), \
|
||||
FILES := $(STATIC_LIBS_GRAAL_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(STATIC_LIBS_GRAAL_IMAGE_DIR), \
|
||||
SUBDIR := $(STATIC_LIBS_GRAAL_BUNDLE_SUBDIR), \
|
||||
))
|
||||
|
||||
STATIC_LIBS_GRAAL_TARGETS += $(BUILD_STATIC_LIBS_GRAAL_BUNDLE)
|
||||
endif
|
||||
|
||||
#################################################################################
|
||||
|
||||
ifneq ($(filter static-jdk-bundles, $(MAKECMDGOALS)), )
|
||||
STATIC_JDK_BUNDLE_FILES := $(call FindFiles, $(STATIC_JDK_IMAGE_DIR))
|
||||
|
||||
$(eval $(call SetupBundleFile, BUILD_STATIC_JDK_BUNDLE, \
|
||||
BUNDLE_NAME := $(STATIC_JDK_BUNDLE_NAME), \
|
||||
FILES := $(STATIC_JDK_BUNDLE_FILES), \
|
||||
BASE_DIRS := $(STATIC_JDK_IMAGE_DIR), \
|
||||
SUBDIR := $(STATIC_JDK_BUNDLE_SUBDIR), \
|
||||
))
|
||||
|
||||
STATIC_JDK_TARGETS += $(BUILD_STATIC_JDK_BUNDLE)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
product-bundles: $(PRODUCT_TARGETS)
|
||||
legacy-bundles: $(LEGACY_TARGETS)
|
||||
test-bundles: $(TEST_TARGETS)
|
||||
docs-jdk-bundles: $(DOCS_JDK_TARGETS)
|
||||
docs-javase-bundles: $(DOCS_JAVASE_TARGETS)
|
||||
docs-reference-bundles: $(DOCS_REFERENCE_TARGETS)
|
||||
static-libs-bundles: $(STATIC_LIBS_TARGETS)
|
||||
static-libs-graal-bundles: $(STATIC_LIBS_GRAAL_TARGETS)
|
||||
static-jdk-bundles: $(STATIC_JDK_TARGETS)
|
||||
jcov-bundles: $(JCOV_TARGETS)
|
||||
|
||||
.PHONY: product-bundles test-bundles \
|
||||
docs-jdk-bundles docs-javase-bundles docs-reference-bundles \
|
||||
static-libs-bundles static-libs-graal-bundles static-jdk-bundles jcov-bundles
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
54
make/CompileCommands.gmk
Normal file
54
make/CompileCommands.gmk
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#
|
||||
# Copyright (c) 2018, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
# When FIXPATH is set, let it process the file to make sure all paths are usable
|
||||
# by system native tools. The FIXPATH tool assumes arguments preceded by an @
|
||||
# character points to a text file containing further arguments (similar to a
|
||||
# linker). It replaces any such arguments with a different temporary filename,
|
||||
# whose contents has been processed to make any paths native. To obtain a
|
||||
# properly processed compile_commands.json, FIXPATH is then made to invoke an
|
||||
# AWK script with the unprocessed json file as the only argument, prepended with
|
||||
# an @ character. The AWK script simply copies the contents of this processed
|
||||
# file.
|
||||
#
|
||||
# The sed command encloses the fragments inside brackets and removes the final
|
||||
# trailing comma.
|
||||
$(OUTPUTDIR)/compile_commands.json: $(wildcard $(MAKESUPPORT_OUTPUTDIR)/compile-commands/*.json)
|
||||
$(call LogWarn, Updating compile_commands.json)
|
||||
$(RM) $@
|
||||
$(FIND) $(MAKESUPPORT_OUTPUTDIR)/compile-commands/ -name \*.json | \
|
||||
$(SORT) | $(XARGS) $(CAT) >> $@.tmp
|
||||
$(SED) -e '1s/^/[\$(NEWLINE)/' -e '$(DOLLAR)s/,\s\{0,\}$(DOLLAR)/\$(NEWLINE)]/' $@.tmp > $@
|
||||
$(RM) $@.tmp
|
||||
|
||||
TARGETS += $(OUTPUTDIR)/compile_commands.json
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
265
make/CompileDemos.gmk
Normal file
265
make/CompileDemos.gmk
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# Build demos for the JDK into $(SUPPORT_OUTPUTDIR)/demos/image.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include JavaCompilation.gmk
|
||||
include TextFileProcessing.gmk
|
||||
include ZipArchive.gmk
|
||||
|
||||
# Prepare the find cache.
|
||||
DEMO_SRC_DIRS += $(TOPDIR)/src/demo
|
||||
|
||||
$(call FillFindCache, $(DEMO_SRC_DIRS))
|
||||
|
||||
# Append demo goals to this variable.
|
||||
TARGETS =
|
||||
|
||||
# The demo structure and contents should really be cleaned up.
|
||||
# Now every other demo has its own quirks where to put the
|
||||
# READMEs and other files.
|
||||
|
||||
DEMO_SHARE_SRC := $(TOPDIR)/src/demo/share
|
||||
|
||||
DEMO_MANIFEST := $(SUPPORT_OUTPUTDIR)/demos/java-main-manifest.mf
|
||||
|
||||
# This rule will be depended on due to the MANIFEST line in SetupBuildDemo
|
||||
# and SetupBuildJvmtiDemo.
|
||||
$(eval $(call SetupTextFileProcessing, BUILD_JAVA_MANIFEST, \
|
||||
SOURCE_FILES := $(TOPDIR)/make/data/mainmanifest/manifest.mf.template, \
|
||||
OUTPUT_FILE := $(DEMO_MANIFEST), \
|
||||
REPLACEMENTS := \
|
||||
@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION) ; \
|
||||
@@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
|
||||
@@COMPANY_NAME@@ => $(COMPANY_NAME) , \
|
||||
))
|
||||
|
||||
################################################################################
|
||||
# Build normal demos.
|
||||
|
||||
COPY_TO_JAR := .html .txt .properties .js .gif .jpg .theme .data .opt .c .h \
|
||||
.png .ttf .xyz .obj README COPYRIGHT
|
||||
|
||||
COPY_TO_IMAGE := *.html *.txt *.png *.xml README*
|
||||
|
||||
# Setup make rules for building a demo.
|
||||
#
|
||||
# Parameter 1 is the name of the rule. This name is used as variable prefix,
|
||||
# and the targets generated are listed in a variable by that name.
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# DEMO_SUBDIR The name of the subdir of the demo, below the demo top dir.
|
||||
# EXTRA_SRC_DIR Additional source directory.
|
||||
# SRC_SUB_DIR Optional subdir to locate source code in
|
||||
# SRC_DIR Alternative source directory to use for the demos.
|
||||
# EXCLUDE_FILES Exclude file list
|
||||
# JAR_NAME Base name of jar file. Defaults to $1.
|
||||
# MAIN_CLASS The main class for the jar. Defaults to $1.
|
||||
# EXTRA_COPY_TO_JAR Additional files to copy to jar (as patterns)
|
||||
# EXTRA_COPY_TO_IMAGE Additional files to copy to images (as wildcards)
|
||||
# EXTRA_MANIFEST_ATTR Extra manifest attribute
|
||||
# SKIP_COMPILATION Skip Java compilation iff true
|
||||
# DISABLED_WARNINGS Additional disabled warnings
|
||||
SetupBuildDemo = $(NamedParamsMacroTemplate)
|
||||
define SetupBuildDemoBody
|
||||
ifeq ($$($1_SRC_DIR), )
|
||||
$1_SRC_DIR := $(DEMO_SHARE_SRC)
|
||||
endif
|
||||
|
||||
$1_SRC_BASE := $$($1_SRC_DIR)/$$($1_DEMO_SUBDIR)/$1
|
||||
|
||||
# In some demos the source is found in a subdir
|
||||
ifneq ($$($1_SRC_SUB_DIR), )
|
||||
$1_MAIN_SRC := $$($1_SRC_BASE)/$$($1_SRC_SUB_DIR)
|
||||
else
|
||||
# for almost all
|
||||
$1_MAIN_SRC := $$($1_SRC_BASE)
|
||||
endif
|
||||
|
||||
# Default is to use demo name as jar file name.
|
||||
ifeq ($$($1_JAR_NAME), )
|
||||
$1_JAR_NAME := $1
|
||||
endif
|
||||
|
||||
# Default is to use demo name as jar main class.
|
||||
ifeq ($$($1_MAIN_CLASS), )
|
||||
$1_MAIN_CLASS := $1
|
||||
else ifeq ($$($1_MAIN_CLASS), NONE)
|
||||
$1_MAIN_CLASS :=
|
||||
$1_EXTRA_MANIFEST_ATTR += Main-Class: \n
|
||||
endif
|
||||
|
||||
ifneq ($$($1_SKIP_COMPILATION), true)
|
||||
$$(eval $$(call SetupJavaCompilation, BUILD_DEMO_$1, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
|
||||
SRC := $$($1_MAIN_SRC) $$($1_EXTRA_SRC_DIR), \
|
||||
BIN := $(SUPPORT_OUTPUTDIR)/demos/classes/$$($1_DEMO_SUBDIR)/$1, \
|
||||
COPY := $(COPY_TO_JAR) $$($1_EXTRA_COPY_TO_JAR), \
|
||||
JAR := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1/$$($1_JAR_NAME).jar, \
|
||||
JARMAIN := $$($1_MAIN_CLASS), \
|
||||
MANIFEST := $(DEMO_MANIFEST), \
|
||||
EXTRA_MANIFEST_ATTR := $$($1_EXTRA_MANIFEST_ATTR), \
|
||||
EXCLUDE_FILES := $$($1_EXCLUDE_FILES), \
|
||||
DISABLED_WARNINGS := $$($1_DISABLED_WARNINGS), \
|
||||
))
|
||||
|
||||
$1 += $$(BUILD_DEMO_$1)
|
||||
|
||||
$$(eval $$(call SetupZipArchive, ZIP_SRC_DEMO_$1, \
|
||||
SRC := $$($1_MAIN_SRC) $$($1_EXTRA_SRC_DIR), \
|
||||
ZIP := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1/src.zip, \
|
||||
EXCLUDE_FILES := $$($1_EXCLUDE_FILES), \
|
||||
))
|
||||
|
||||
$1 += $$(ZIP_SRC_DEMO_$1)
|
||||
endif
|
||||
|
||||
# Copy files. Sort is needed to remove duplicates.
|
||||
$1_COPY_FILES := $$(sort $$(wildcard $$(addprefix $$($1_SRC_BASE)/, \
|
||||
$(COPY_TO_IMAGE) $$($1_EXTRA_COPY_TO_IMAGE))))
|
||||
$$(eval $$(call SetupCopyFiles, COPY_DEMO_$1, \
|
||||
SRC := $$($1_SRC_BASE), \
|
||||
DEST := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1, \
|
||||
FILES := $$($1_COPY_FILES), \
|
||||
))
|
||||
|
||||
$1 += $$(COPY_DEMO_$1)
|
||||
|
||||
TARGETS += $$($1)
|
||||
endef
|
||||
|
||||
CODEPOINT_SERVICE := java.awt.im.spi.InputMethodDescriptor
|
||||
CODEPOINT_METAINF_SERVICE_FILE := \
|
||||
$(SUPPORT_OUTPUTDIR)/demos/classes/jfc/CodePointIM/META-INF/services/$(CODEPOINT_SERVICE)
|
||||
|
||||
$(eval $(call SetupBuildDemo, CodePointIM, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
EXTRA_COPY_TO_JAR := $(CODEPOINT_SERVICE), \
|
||||
))
|
||||
|
||||
# We also need to copy the CODEPOINT_SERVICE file to the META-INF/services
|
||||
# location, and make sure the jar depends on that file to get it included.
|
||||
$(CODEPOINT_METAINF_SERVICE_FILE): $(DEMO_SHARE_SRC)/jfc/CodePointIM/$(CODEPOINT_SERVICE)
|
||||
$(call install-file)
|
||||
|
||||
$(BUILD_DEMO_CodePointIM_JAR): $(CODEPOINT_METAINF_SERVICE_FILE)
|
||||
|
||||
$(eval $(call SetupBuildDemo, FileChooserDemo, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
DISABLED_WARNINGS := rawtypes deprecation unchecked this-escape, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupBuildDemo, SwingSet2, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
EXTRA_COPY_TO_JAR := .java, \
|
||||
EXTRA_MANIFEST_ATTR := SplashScreen-Image: resources/images/splash.png, \
|
||||
DISABLED_WARNINGS := rawtypes deprecation unchecked static serial cast this-escape, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupBuildDemo, Font2DTest, \
|
||||
DISABLED_WARNINGS := rawtypes deprecation unchecked serial cast this-escape dangling-doc-comments, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupBuildDemo, J2Ddemo, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
MAIN_CLASS := java2d.J2Ddemo, \
|
||||
DISABLED_WARNINGS := rawtypes deprecation unchecked cast lossy-conversions this-escape, \
|
||||
JAR_NAME := J2Ddemo, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupBuildDemo, Metalworks, \
|
||||
DISABLED_WARNINGS := rawtypes unchecked this-escape, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupBuildDemo, Notepad, \
|
||||
DISABLED_WARNINGS := rawtypes this-escape, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupBuildDemo, Stylepad, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
DISABLED_WARNINGS := rawtypes unchecked this-escape, \
|
||||
EXTRA_SRC_DIR := $(DEMO_SHARE_SRC)/jfc/Notepad, \
|
||||
EXCLUDE_FILES := $(DEMO_SHARE_SRC)/jfc/Notepad/README.txt, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupBuildDemo, SampleTree, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupBuildDemo, TableExample, \
|
||||
DISABLED_WARNINGS := rawtypes unchecked deprecation this-escape dangling-doc-comments, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupBuildDemo, TransparentRuler, \
|
||||
DISABLED_WARNINGS := this-escape, \
|
||||
DEMO_SUBDIR := jfc, \
|
||||
MAIN_CLASS := transparentruler.Ruler, \
|
||||
))
|
||||
|
||||
################################################################################
|
||||
# Copy html and README files.
|
||||
|
||||
$(SUPPORT_OUTPUTDIR)/demos/image/README: $(DEMO_SHARE_SRC)/README
|
||||
$(call install-file)
|
||||
|
||||
TARGETS += $(SUPPORT_OUTPUTDIR)/demos/image/README
|
||||
|
||||
################################################################################
|
||||
# Copy netbeans project files.
|
||||
|
||||
$(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/%
|
||||
$(call install-file)
|
||||
$(CHMOD) -f ug+w $@
|
||||
|
||||
TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
|
||||
$(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \
|
||||
$(call FindFiles, $(DEMO_SHARE_SRC)/nbproject))
|
||||
|
||||
################################################################################
|
||||
|
||||
ifneq ($(filter images, $(MAKECMDGOALS)), )
|
||||
$(eval $(call SetupCopyFiles, COPY_TO_TEST_IMAGE, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
|
||||
DEST := $(TEST_IMAGE_DIR)/jdk/demos, \
|
||||
FILES := $(call FindFiles, $(SUPPORT_OUTPUTDIR)/demos/image), \
|
||||
))
|
||||
|
||||
IMAGES_TARGETS := $(COPY_TO_TEST_IMAGE)
|
||||
endif
|
||||
|
||||
images: $(IMAGES_TARGETS)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
154
make/CompileInterimLangtools.gmk
Normal file
154
make/CompileInterimLangtools.gmk
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
#
|
||||
# Copyright (c) 2014, 2026, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include JavaCompilation.gmk
|
||||
include Modules.gmk
|
||||
|
||||
################################################################################
|
||||
# Generate interim versions of the module-info.java files for the interim
|
||||
# langtools modules. Each interim module has ".interim" added as suffix to the
|
||||
# original module name.
|
||||
|
||||
INTERIM_MODULEINFO_PATTERN := \
|
||||
$(foreach m, $(INTERIM_LANGTOOLS_BASE_MODULES), -e 's/$m\([,; ]\)/$m.interim\1/g')
|
||||
|
||||
$(BUILDTOOLS_OUTPUTDIR)/gensrc/%.interim/module-info.java: \
|
||||
$(TOPDIR)/src/%/share/classes/module-info.java
|
||||
$(call LogInfo, Generating module-info.java for $*.interim)
|
||||
$(call MakeDir, $(@D))
|
||||
$(SED) $(INTERIM_MODULEINFO_PATTERN) $< > $@
|
||||
|
||||
TARGETS += $(patsubst %, $(BUILDTOOLS_OUTPUTDIR)/gensrc/%/module-info.java, \
|
||||
$(INTERIM_LANGTOOLS_MODULES))
|
||||
|
||||
################################################################################
|
||||
# Generate interim versions of the ToolProvider.java files for the interim
|
||||
# langtools modules, which will allow to load javac from the interim
|
||||
# jdk.compiler.
|
||||
|
||||
INTERIM_TOOL_PROVIDER_PATTERN := \
|
||||
$(foreach m, $(INTERIM_LANGTOOLS_BASE_MODULES), -e 's/"$m"/"$m.interim"/g')
|
||||
|
||||
$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.compiler.interim/javax/tools/ToolProvider.java: \
|
||||
$(TOPDIR)/src/java.compiler/share/classes/javax/tools/ToolProvider.java
|
||||
$(call LogInfo, Generating ToolProvider.java for java.compiler.interim)
|
||||
$(call MakeDir, $(@D))
|
||||
$(SED) $(INTERIM_TOOL_PROVIDER_PATTERN) $< > $@
|
||||
|
||||
java.compiler.interim_EXTRA_FILES := \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.compiler.interim/javax/tools/ToolProvider.java
|
||||
|
||||
TARGETS += $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.compiler.interim/javax/tools/ToolProvider.java
|
||||
|
||||
################################################################################
|
||||
# Create a hybrid PreviewFeature.java that combines constants
|
||||
# from the current sources, as those can be used in javac APIs, and from the
|
||||
# bootstrap JDK, as those can be used from bootstrap JDK classfiles.
|
||||
|
||||
$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/javac/PreviewFeature.java: \
|
||||
$(TOPDIR)/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java
|
||||
$(call LogInfo, Generating $@)
|
||||
$(JAVA) $(TOPDIR)/make/langtools/tools/previewfeature/SetupPreviewFeature.java \
|
||||
$(TOPDIR)/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java \
|
||||
$@
|
||||
|
||||
|
||||
TARGETS += $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/javac/PreviewFeature.java
|
||||
|
||||
################################################################################
|
||||
# Setup the rules to build interim langtools, which is compiled by the boot
|
||||
# javac and can be run on the boot jdk. This will be used to compile the rest of
|
||||
# the product. Each module is compiled separately because a multi module setup
|
||||
# would require the source files to be copied into directories named after the
|
||||
# actual interim modules.
|
||||
|
||||
# Param 1 - Name of module to compile
|
||||
define SetupInterimModule
|
||||
$$(eval $$(call SetupJavaCompilation, BUILD_$1.interim, \
|
||||
COMPILER := bootjdk, \
|
||||
TARGET_RELEASE := $$(TARGET_RELEASE_BOOTJDK), \
|
||||
SRC := $(BUILDTOOLS_OUTPUTDIR)/gensrc/$1.interim \
|
||||
$$(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$1) \
|
||||
$(TOPDIR)/src/$1/share/classes, \
|
||||
EXCLUDES := sun, \
|
||||
EXCLUDE_FILES := $(TOPDIR)/src/$1/share/classes/module-info.java \
|
||||
$(TOPDIR)/src/$1/share/classes/javax/tools/ToolProvider.java \
|
||||
$(TOPDIR)/src/$1/share/classes/com/sun/tools/javac/launcher/Main.java \
|
||||
$(TOPDIR)/src/$1/share/classes/com/sun/tools/javac/launcher/MemoryClassLoader.java \
|
||||
$(TOPDIR)/src/$1/share/classes/com/sun/tools/javac/launcher/MemoryContext.java \
|
||||
$(TOPDIR)/src/$1/share/classes/com/sun/tools/javac/launcher/MemoryModuleFinder.java \
|
||||
$(TOPDIR)/src/$1/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java \
|
||||
Standard.java, \
|
||||
EXCLUDE_PATTERNS := -files, \
|
||||
EXTRA_FILES := $(BUILDTOOLS_OUTPUTDIR)/gensrc/$1.interim/module-info.java \
|
||||
$($1.interim_EXTRA_FILES), \
|
||||
COPY := .gif .png .xml .css .svg .js .js.template .txt .woff .woff2 javax.tools.JavaCompilerTool, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules/$1.interim, \
|
||||
DISABLED_WARNINGS := module options, \
|
||||
JAVAC_FLAGS := \
|
||||
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
|
||||
$$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
|
||||
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
|
||||
--add-exports java.base/jdk.internal.javac=java.compiler.interim \
|
||||
--add-exports java.base/jdk.internal.javac=jdk.compiler.interim \
|
||||
--add-exports jdk.internal.opt/jdk.internal.opt=jdk.compiler.interim \
|
||||
--add-exports jdk.internal.opt/jdk.internal.opt=jdk.javadoc.interim, \
|
||||
))
|
||||
|
||||
$1_DEPS_INTERIM := $$(addsuffix .interim, $$(filter \
|
||||
$$(INTERIM_LANGTOOLS_BASE_MODULES), $$(call FindTransitiveDepsForModule, $1)))
|
||||
|
||||
$$(BUILD_$1.interim): $$(foreach d, $$($1_DEPS_INTERIM), $$(BUILD_$$d)) \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/javac/PreviewFeature.java
|
||||
|
||||
TARGETS += $$(BUILD_$1.interim)
|
||||
endef
|
||||
|
||||
$(foreach m, $(INTERIM_LANGTOOLS_BASE_MODULES), \
|
||||
$(eval $(call SetupInterimModule,$m)) \
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Setup the compilation of the javac server build tool. Technically, this is not
|
||||
# really "interim" langtools, but just like it, it is needed henceforth for all
|
||||
# java compilation using the interim compiler.
|
||||
$(eval $(call SetupJavaCompilation, BUILD_JAVAC_SERVER, \
|
||||
COMPILER := bootjdk, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \
|
||||
SRC := $(TOPDIR)/make/langtools/tools, \
|
||||
INCLUDES := javacserver, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_javacserver_classes, \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_JAVAC_SERVER)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
160
make/CompileJavaModules.gmk
Normal file
160
make/CompileJavaModules.gmk
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
#
|
||||
# Copyright (c) 2014, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include JavaCompilation.gmk
|
||||
include Modules.gmk
|
||||
|
||||
################################################################################
|
||||
# If this is an imported module that has prebuilt classes, only compile
|
||||
# module-info.java.
|
||||
ifneq ($(IMPORT_MODULES_CLASSES), )
|
||||
IMPORT_MODULE_DIR := $(IMPORT_MODULES_CLASSES)/$(MODULE)
|
||||
ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
|
||||
$(MODULE)_INCLUDE_FILES := module-info.java
|
||||
endif
|
||||
else
|
||||
IMPORT_MODULE_DIR :=
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Setup the compilation for the module
|
||||
#
|
||||
MODULE_SRC_DIRS := $(call FindModuleSrcDirs, $(MODULE))
|
||||
|
||||
# The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
|
||||
# JDK_FILTER at the make command line, only a subset of the JDK java files will
|
||||
# be recompiled. If multiple paths are separated by comma, convert that into a
|
||||
# space separated list.
|
||||
JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
|
||||
ifeq ($(JDK_FILTER), )
|
||||
FAIL_NO_SRC := true
|
||||
else
|
||||
# When using JDK_FILTER, most module java compilations will end up finding
|
||||
# no source files. Don't let that fail the build.
|
||||
FAIL_NO_SRC := false
|
||||
endif
|
||||
|
||||
# Get the complete module source path.
|
||||
MODULESOURCEPATH := $(call GetModuleSrcPath)
|
||||
|
||||
# Add imported modules to the modulepath
|
||||
MODULEPATH := $(call PathList, $(IMPORT_MODULES_CLASSES))
|
||||
|
||||
################################################################################
|
||||
# Copy zh_HK properties files from zh_TW (needed by some modules)
|
||||
|
||||
$(JDK_OUTPUTDIR)/modules/%_zh_HK.properties: $(JDK_OUTPUTDIR)/modules/%_zh_TW.properties
|
||||
$(install-file)
|
||||
|
||||
CreateHkTargets = \
|
||||
$(call FilterExcludedTranslations, \
|
||||
$(patsubst $(TOPDIR)/src/%, $(JDK_OUTPUTDIR)/modules/%, \
|
||||
$(subst /share/classes,, \
|
||||
$(subst _zh_TW,_zh_HK, $(filter %_zh_TW.properties, $1)) \
|
||||
) \
|
||||
), \
|
||||
.properties \
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Include module specific build settings
|
||||
|
||||
THIS_SNIPPET := $(call GetModuleSnippetName, Java)
|
||||
|
||||
ifneq ($(wildcard $(THIS_SNIPPET)), )
|
||||
include MakeSnippetStart.gmk
|
||||
|
||||
include $(THIS_SNIPPET)
|
||||
|
||||
include MakeSnippetEnd.gmk
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Setup the main compilation
|
||||
|
||||
$(eval $(call SetupJavaCompilation, $(MODULE), \
|
||||
SMALL_JAVA := false, \
|
||||
MODULE := $(MODULE), \
|
||||
SRC := $(wildcard $(MODULE_SRC_DIRS)), \
|
||||
INCLUDES := $(JDK_USER_DEFINED_FILTER), \
|
||||
FAIL_NO_SRC := $(FAIL_NO_SRC), \
|
||||
BIN := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules), \
|
||||
HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
|
||||
CREATE_API_DIGEST := true, \
|
||||
CLEAN := $(CLEAN), \
|
||||
CLEAN_FILES := $(CLEAN_FILES), \
|
||||
COPY := $(COPY), \
|
||||
DISABLED_WARNINGS := $(DISABLED_WARNINGS_java), \
|
||||
EXCLUDES := $(EXCLUDES), \
|
||||
EXCLUDE_FILES := $(EXCLUDE_FILES), \
|
||||
EXCLUDE_PATTERNS := -files, \
|
||||
KEEP_ALL_TRANSLATIONS := $(KEEP_ALL_TRANSLATIONS), \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE), \
|
||||
JAVAC_FLAGS := \
|
||||
$(DOCLINT) \
|
||||
$(JAVAC_FLAGS) \
|
||||
--module-source-path $(MODULESOURCEPATH) \
|
||||
--module-path $(MODULEPATH) \
|
||||
--system none, \
|
||||
))
|
||||
|
||||
TARGETS += $($(MODULE))
|
||||
|
||||
# Declare dependencies between java compilations of different modules.
|
||||
# Since the other modules are declared in different invocations of this file,
|
||||
# use the macro to find the correct target file to depend on.
|
||||
# Only the javac compilation actually depends on other modules so limit
|
||||
# dependency declaration to that by using the *_MODFILELIST variable.
|
||||
$($(MODULE)_MODFILELIST): $(foreach d, $(call FindDepsForModule, $(MODULE)), \
|
||||
$(call SetupJavaCompilationApiTarget, $d, \
|
||||
$(if $($d_BIN), $($d_BIN), $(JDK_OUTPUTDIR)/modules/$d)))
|
||||
|
||||
################################################################################
|
||||
# If this is an imported module, copy the pre built classes and resources into
|
||||
# the modules output dir
|
||||
|
||||
ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
|
||||
$(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \
|
||||
$(call FindFiles, $(IMPORT_MODULE_DIR))
|
||||
$(call MakeDir, $(@D))
|
||||
# Do not delete marker and build meta data files
|
||||
$(RM) -r $(filter-out $(@D)/_%, $(wildcard $(@D)/*))
|
||||
$(CP) -R $(IMPORT_MODULE_DIR)/* $(@D)/
|
||||
$(TOUCH) $@
|
||||
|
||||
TARGETS += $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker
|
||||
|
||||
# Add this dependency to avoid a race between compiling module-info.java and
|
||||
# importing the classes.
|
||||
$($(MODULE)_COMPILE_TARGET): $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
65
make/CompileModuleTools.gmk
Normal file
65
make/CompileModuleTools.gmk
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#
|
||||
# Copyright (c) 2013, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include JavaCompilation.gmk
|
||||
|
||||
TOOLS_CLASSES_DIR := $(BUILDTOOLS_OUTPUTDIR)/tools_jigsaw_classes
|
||||
|
||||
# When using an external BUILDJDK, make it possible to shortcut building of
|
||||
# these tools using the BUILD_JAVAC instead of having to build the complete
|
||||
# exploded image first.
|
||||
ifeq ($(EXTERNAL_BUILDJDK), true)
|
||||
COMPILER := buildjdk
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK)
|
||||
else
|
||||
COMPILER := interim
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED)
|
||||
endif
|
||||
|
||||
$(eval $(call SetupJavaCompilation, BUILD_JIGSAW_TOOLS, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE), \
|
||||
COMPILER := $(COMPILER), \
|
||||
SRC := $(TOPDIR)/make/jdk/src/classes, \
|
||||
INCLUDES := build/tools/deps \
|
||||
build/tools/docs \
|
||||
build/tools/jigsaw, \
|
||||
COPY := .properties .html, \
|
||||
BIN := $(TOOLS_CLASSES_DIR), \
|
||||
DISABLED_WARNINGS := fallthrough, \
|
||||
JAVAC_FLAGS := \
|
||||
--add-modules jdk.jdeps \
|
||||
--add-exports java.base/jdk.internal.module=ALL-UNNAMED \
|
||||
--add-exports jdk.jdeps/com.sun.tools.jdeps=ALL-UNNAMED, \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_JIGSAW_TOOLS)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
49
make/CompileToolsHotspot.gmk
Normal file
49
make/CompileToolsHotspot.gmk
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#
|
||||
# Copyright (c) 2016, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include JavaCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# Build tools needed for the JFR source code generation
|
||||
|
||||
HOTSPOT_TOOLS_SRCDIR := $(TOPDIR)/make/src/classes
|
||||
|
||||
HOTSPOT_TOOLS_OUTPUTDIR := $(BUILDTOOLS_OUTPUTDIR)/buildtools/hotspot_tools_classes
|
||||
|
||||
$(eval $(call SetupJavaCompilation, BUILD_TOOLS_HOTSPOT, \
|
||||
COMPILER := bootjdk, \
|
||||
SRC := $(HOTSPOT_TOOLS_SRCDIR), \
|
||||
BIN := $(HOTSPOT_TOOLS_OUTPUTDIR), \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_TOOLS_HOTSPOT)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
158
make/CompileToolsJdk.gmk
Normal file
158
make/CompileToolsJdk.gmk
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include JavaCompilation.gmk
|
||||
include TextFileProcessing.gmk
|
||||
|
||||
# Use += to be able to add to this from a custom extension
|
||||
BUILD_TOOLS_SRC_DIRS += \
|
||||
$(TOPDIR)/make/jdk/src/classes \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/interim_tzdb_classes \
|
||||
#
|
||||
|
||||
$(eval $(call SetupJavaCompilation, BUILD_TOOLS_JDK, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \
|
||||
SRC := $(BUILD_TOOLS_SRC_DIRS), \
|
||||
EXCLUDES := \
|
||||
build/tools/classlist \
|
||||
build/tools/deps \
|
||||
build/tools/docs \
|
||||
build/tools/jigsaw \
|
||||
build/tools/depend, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
|
||||
DISABLED_WARNINGS := dangling-doc-comments options, \
|
||||
JAVAC_FLAGS := \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.text=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.security.util=ALL-UNNAMED \
|
||||
--add-exports jdk.internal.opt/jdk.internal.opt=jdk.compiler.interim \
|
||||
--add-exports jdk.internal.opt/jdk.internal.opt=jdk.javadoc.interim, \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_TOOLS_JDK)
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_NIMBUS_TEMPLATES, \
|
||||
SRC := $(TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus, \
|
||||
DEST := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources, \
|
||||
FILES := $(wildcard $(TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template), \
|
||||
))
|
||||
|
||||
TARGETS += $(COPY_NIMBUS_TEMPLATES)
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_CLDRCONVERTER_PROPERTIES, \
|
||||
SRC := $(TOPDIR)/make/jdk/src/classes/build/tools/cldrconverter, \
|
||||
DEST := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/cldrconverter, \
|
||||
FILES := $(wildcard $(TOPDIR)/make/jdk/src/classes/build/tools/cldrconverter/*.properties), \
|
||||
))
|
||||
|
||||
TARGETS += $(COPY_CLDRCONVERTER_PROPERTIES)
|
||||
|
||||
################################################################################
|
||||
|
||||
$(eval $(call SetupJavaCompilation, COMPILE_DEPEND, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \
|
||||
SRC := $(TOPDIR)/make/jdk/src/classes, \
|
||||
INCLUDES := build/tools/depend, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/depend, \
|
||||
DISABLED_WARNINGS := options, \
|
||||
JAVAC_FLAGS := \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
|
||||
--add-exports jdk.internal.opt/jdk.internal.opt=jdk.compiler.interim \
|
||||
--add-exports jdk.internal.opt/jdk.internal.opt=jdk.javadoc.interim, \
|
||||
))
|
||||
|
||||
DEPEND_SERVICE_PROVIDER := $(BUILDTOOLS_OUTPUTDIR)/depend/META-INF/services/com.sun.source.util.Plugin
|
||||
|
||||
$(DEPEND_SERVICE_PROVIDER):
|
||||
$(call MakeDir, $(BUILDTOOLS_OUTPUTDIR)/depend/META-INF/services)
|
||||
$(ECHO) build.tools.depend.Depend > $@
|
||||
|
||||
TARGETS += $(COMPILE_DEPEND) $(DEPEND_SERVICE_PROVIDER)
|
||||
|
||||
################################################################################
|
||||
|
||||
# To be able to call the javascript filter when generating man pages using
|
||||
# pandoc, we need to create this executable wrapper script.
|
||||
ifeq ($(ENABLE_PANDOC), true)
|
||||
# PANDOC_TROFF_MANPAGE_FILTER is duplicated for export in ToolsJdk.gmk.
|
||||
PANDOC_TROFF_MANPAGE_FILTER := \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/manpages/pandoc-troff-manpage-filter
|
||||
PANDOC_TROFF_MANPAGE_FILTER_SETUP := \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/manpages/_pandoc_troff_manpage_filter_setup.marker
|
||||
|
||||
# Create a usable instance of the wrapper script that calls the pandoc filter
|
||||
# (which is written in javascript).
|
||||
$(eval $(call SetupTextFileProcessing, CREATE_PANDOC_TROFF_MANPAGE_FILTER, \
|
||||
SOURCE_FILES := $(TOPDIR)/make/scripts/pandoc-troff-manpage-filter.sh.template, \
|
||||
OUTPUT_FILE := $(PANDOC_TROFF_MANPAGE_FILTER), \
|
||||
REPLACEMENTS := \
|
||||
@@JAVA_SMALL@@ => $(JAVA_SMALL) ; \
|
||||
@@BUILDTOOLS_OUTPUTDIR@@ => $(BUILDTOOLS_OUTPUTDIR) ; \
|
||||
))
|
||||
|
||||
# Created script must be made executable
|
||||
$(PANDOC_TROFF_MANPAGE_FILTER_SETUP): $(CREATE_PANDOC_TROFF_MANPAGE_FILTER)
|
||||
$(CHMOD) a+rx $(PANDOC_TROFF_MANPAGE_FILTER)
|
||||
$(TOUCH) $@
|
||||
|
||||
TARGETS += $(PANDOC_TROFF_MANPAGE_FILTER_SETUP)
|
||||
|
||||
# PANDOC_HTML_MANPAGE_FILTER is duplicated for export in ToolsJdk.gmk.
|
||||
PANDOC_HTML_MANPAGE_FILTER := \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/manpages/pandoc-html-manpage-filter
|
||||
PANDOC_HTML_MANPAGE_FILTER_SETUP := \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/manpages/_pandoc_html_manpage_filter_setup.marker
|
||||
|
||||
# Create a usable instance of the wrapper script that calls the pandoc filter
|
||||
# (which is written in javascript).
|
||||
$(eval $(call SetupTextFileProcessing, CREATE_PANDOC_HTML_MANPAGE_FILTER, \
|
||||
SOURCE_FILES := $(TOPDIR)/make/scripts/pandoc-html-manpage-filter.sh.template, \
|
||||
OUTPUT_FILE := $(PANDOC_HTML_MANPAGE_FILTER), \
|
||||
REPLACEMENTS := \
|
||||
@@JAVA_SMALL@@ => $(JAVA_SMALL) ; \
|
||||
@@BUILDTOOLS_OUTPUTDIR@@ => $(BUILDTOOLS_OUTPUTDIR) ; \
|
||||
))
|
||||
|
||||
# Created script must be made executable
|
||||
$(PANDOC_HTML_MANPAGE_FILTER_SETUP): $(CREATE_PANDOC_HTML_MANPAGE_FILTER)
|
||||
$(CHMOD) a+rx $(PANDOC_HTML_MANPAGE_FILTER)
|
||||
$(TOUCH) $@
|
||||
|
||||
TARGETS += $(PANDOC_HTML_MANPAGE_FILTER_SETUP)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
107
make/CopyImportModules.gmk
Normal file
107
make/CopyImportModules.gmk
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#
|
||||
# Copyright (c) 2015, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This makefile is called for every imported module to copy the non class
|
||||
# contents into the exploded jdk image.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
|
||||
LIBS_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_LIBS)))
|
||||
CMDS_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_CMDS)))
|
||||
CONF_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_CONF)))
|
||||
|
||||
$(call FillFindCache, $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR))
|
||||
|
||||
ifneq ($(LIBS_DIR), )
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBS_TO_BIN, \
|
||||
SRC := $(LIBS_DIR), \
|
||||
DEST := $(JDK_OUTPUTDIR)/bin, \
|
||||
FILES := $(filter $(TO_BIN_FILTER), \
|
||||
$(call FindFiles, $(LIBS_DIR))) \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
|
||||
SRC := $(LIBS_DIR), \
|
||||
DEST := $(JDK_OUTPUTDIR)/lib, \
|
||||
FILES := $(filter-out $(TO_BIN_FILTER), \
|
||||
$(call FindFiles, $(LIBS_DIR))) \
|
||||
))
|
||||
TARGETS += $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB)
|
||||
else
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBS, \
|
||||
SRC := $(LIBS_DIR), \
|
||||
DEST := $(JDK_OUTPUTDIR)/lib, \
|
||||
FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call FindFiles, $(LIBS_DIR))), \
|
||||
))
|
||||
|
||||
# Use relative links if the import dir is inside the OUTPUTDIR, otherwise
|
||||
# copy to avoid having automated systems following symlinks when deleting files,
|
||||
# or risk invalidating the build output from external changes.
|
||||
ifeq ($(filter $(OUTPUTDIR)/%, $(LIBS_DIR)), )
|
||||
LINK_MACRO := install-file
|
||||
LOG_ACTION := Copying
|
||||
else
|
||||
LINK_MACRO := link-file-relative
|
||||
LOG_ACTION := Creating symlink
|
||||
endif
|
||||
$(eval $(call SetupCopyFiles, LINK_LIBS, \
|
||||
SRC := $(LIBS_DIR), \
|
||||
DEST := $(JDK_OUTPUTDIR)/lib, \
|
||||
FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(call FindFiles, $(LIBS_DIR))), \
|
||||
MACRO := $(LINK_MACRO), \
|
||||
LOG_ACTION := $(LOG_ACTION), \
|
||||
))
|
||||
TARGETS += $(COPY_LIBS) $(LINK_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(CMDS_DIR), )
|
||||
$(eval $(call SetupCopyFiles, COPY_CMDS, \
|
||||
SRC := $(CMDS_DIR), \
|
||||
DEST := $(JDK_OUTPUTDIR)/bin, \
|
||||
FILES := $(call FindFiles, $(CMDS_DIR)), \
|
||||
))
|
||||
TARGETS += $(COPY_CMDS)
|
||||
endif
|
||||
|
||||
ifneq ($(CONF_DIR), )
|
||||
$(eval $(call SetupCopyFiles, COPY_CONF, \
|
||||
SRC := $(CONF_DIR), \
|
||||
DEST := $(JDK_OUTPUTDIR)/lib, \
|
||||
FILES := $(call FindFiles, $(CONF_DIR)), \
|
||||
))
|
||||
TARGETS += $(COPY_CONF)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
54
make/CopyInterimTZDB.gmk
Normal file
54
make/CopyInterimTZDB.gmk
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#
|
||||
# Copyright (c) 2019, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
|
||||
### TZDB tool needs files from java.time.zone package
|
||||
|
||||
define tzdb_copyfiles
|
||||
$(call MakeTargetDir)
|
||||
$(RM) '$@'
|
||||
$(SED) -e "s/package java.time.zone/package build.tools.tzdb/" \
|
||||
< $(<) > $@
|
||||
endef
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_INTERIM_TZDB, \
|
||||
SRC := $(TOPDIR)/src/java.base/share/classes/java/time/zone, \
|
||||
DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_tzdb_classes/build/tools/tzdb, \
|
||||
FILES := ZoneRules.java ZoneOffsetTransition.java ZoneOffsetTransitionRule.java Ser.java, \
|
||||
MACRO := tzdb_copyfiles, \
|
||||
))
|
||||
|
||||
################################################################################
|
||||
|
||||
all: $(COPY_INTERIM_TZDB)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
66
make/Coverage.gmk
Normal file
66
make/Coverage.gmk
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# Copyright (c) 2018, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
JCOV_INPUT_IMAGE_DIR :=
|
||||
|
||||
ifneq ($(JCOV_INPUT_JDK), )
|
||||
JCOV_INPUT_IMAGE_DIR := $(JCOV_INPUT_JDK)
|
||||
else
|
||||
JCOV_INPUT_IMAGE_DIR := $(JDK_IMAGE_DIR)
|
||||
endif
|
||||
|
||||
JCOV_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/jcov
|
||||
|
||||
#moving instrumented jdk image in and out of jcov_temp because of CODETOOLS-7902299
|
||||
JCOV_TEMP := $(JCOV_SUPPORT_DIR)/temp
|
||||
|
||||
ifneq ($(JCOV_MODULES), )
|
||||
JCOV_MODULES_FILTER := $(foreach m, $(JCOV_MODULES), -include_module $m)
|
||||
endif
|
||||
|
||||
$(JCOV_IMAGE_DIR)/release: $(JCOV_INPUT_IMAGE_DIR)/release
|
||||
$(call LogWarn, Creating instrumented jdk image with JCov)
|
||||
$(call MakeDir, $(JCOV_TEMP) $(IMAGES_OUTPUTDIR))
|
||||
$(RM) -r $(JCOV_IMAGE_DIR) $(JCOV_TEMP)/*
|
||||
$(CP) -r $(JCOV_INPUT_IMAGE_DIR) $(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR)
|
||||
$(call ExecuteWithLog, $(JCOV_SUPPORT_DIR)/run-jcov, \
|
||||
$(JAVA) -Xmx3g -jar $(JCOV_HOME)/lib/jcov.jar JREInstr \
|
||||
-t $(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR)/template.xml \
|
||||
-rt $(JCOV_HOME)/lib/jcov_network_saver.jar \
|
||||
-exclude 'java.lang.Object' \
|
||||
-exclude jdk.test.Main -exclude '**\$Proxy*' \
|
||||
$(JCOV_MODULES_FILTER) $(JCOV_FILTERS) \
|
||||
$(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR))
|
||||
$(MV) $(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR) $(JCOV_IMAGE_DIR)
|
||||
$(RMDIR) $(JCOV_TEMP)
|
||||
|
||||
jcov-image: $(JCOV_IMAGE_DIR)/release
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
279
make/CreateJmods.gmk
Normal file
279
make/CreateJmods.gmk
Normal file
|
|
@ -0,0 +1,279 @@
|
|||
#
|
||||
# Copyright (c) 2014, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include Execute.gmk
|
||||
include Modules.gmk
|
||||
|
||||
ifeq ($(MODULE), )
|
||||
$(error MODULE must be set when calling CreateJmods.gmk)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
|
||||
JMODS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jmods
|
||||
JMOD_FILE := $(MODULE).jmod
|
||||
|
||||
LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
|
||||
CMDS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
|
||||
CONF_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
|
||||
CLASSES_DIR ?= $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
|
||||
INCLUDE_HEADERS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS))))
|
||||
MAN_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
|
||||
|
||||
$(call FillFindCache, \
|
||||
$(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
|
||||
)
|
||||
|
||||
ifneq ($(LIBS_DIR), )
|
||||
DEPS += $(call FindFiles, $(LIBS_DIR))
|
||||
ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+public)
|
||||
# For public debug symbols on Windows, we have to use stripped pdbs and rename them
|
||||
rename_stripped = $(patsubst %.stripped.pdb,%.pdb,$1)
|
||||
LIBS_DIR_FILTERED := $(subst modules_libs,modules_libs_filtered, $(LIBS_DIR))
|
||||
FILES_LIBS := $(filter-out %.pdb, $(call FindFiles, $(LIBS_DIR))) \
|
||||
$(filter %.stripped.pdb, $(call FindFiles, $(LIBS_DIR)))
|
||||
$(eval $(call SetupCopyFiles, COPY_FILTERED_LIBS, \
|
||||
SRC := $(LIBS_DIR), \
|
||||
DEST := $(LIBS_DIR_FILTERED), \
|
||||
FILES := $(FILES_LIBS), \
|
||||
NAME_MACRO := rename_stripped, \
|
||||
))
|
||||
DEPS += $(COPY_FILTERED_LIBS)
|
||||
JMOD_FLAGS += --libs $(LIBS_DIR_FILTERED)
|
||||
else
|
||||
JMOD_FLAGS += --libs $(LIBS_DIR)
|
||||
endif
|
||||
endif
|
||||
ifneq ($(CMDS_DIR), )
|
||||
DEPS += $(call FindFiles, $(CMDS_DIR))
|
||||
ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+public)
|
||||
# For public debug symbols on Windows, we have to use stripped pdbs and rename them
|
||||
rename_stripped = $(patsubst %.stripped.pdb,%.pdb,$1)
|
||||
CMDS_DIR_FILTERED := $(subst modules_cmds,modules_cmds_filtered, $(CMDS_DIR))
|
||||
FILES_CMDS := $(filter-out %.pdb, $(call FindFiles, $(CMDS_DIR))) \
|
||||
$(filter %.stripped.pdb, $(call FindFiles, $(CMDS_DIR)))
|
||||
$(eval $(call SetupCopyFiles, COPY_FILTERED_CMDS, \
|
||||
SRC := $(CMDS_DIR), \
|
||||
DEST := $(CMDS_DIR_FILTERED), \
|
||||
FILES := $(FILES_CMDS), \
|
||||
NAME_MACRO := rename_stripped, \
|
||||
))
|
||||
DEPS += $(COPY_FILTERED_CMDS)
|
||||
JMOD_FLAGS += --cmds $(CMDS_DIR_FILTERED)
|
||||
else
|
||||
JMOD_FLAGS += --cmds $(CMDS_DIR)
|
||||
endif
|
||||
endif
|
||||
ifneq ($(CONF_DIR), )
|
||||
JMOD_FLAGS += --config $(CONF_DIR)
|
||||
DEPS += $(call FindFiles, $(CONF_DIR))
|
||||
endif
|
||||
ifneq ($(CLASSES_DIR), )
|
||||
JMOD_FLAGS += --class-path $(CLASSES_DIR)
|
||||
DEPS += $(call FindFiles, $(CLASSES_DIR))
|
||||
endif
|
||||
ifneq ($(INCLUDE_HEADERS_DIR), )
|
||||
JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR)
|
||||
DEPS += $(call FindFiles, $(INCLUDE_HEADERS_DIR))
|
||||
endif
|
||||
ifneq ($(MAN_DIR), )
|
||||
JMOD_FLAGS += --man-pages $(MAN_DIR)
|
||||
DEPS += $(call FindFiles, $(MAN_DIR))
|
||||
endif
|
||||
|
||||
# If a specific modules_legal dir exists for this module, only pick up files
|
||||
# from there. These files were explicitly filtered or modified in <module>-copy
|
||||
# targets. For the rest, just pick up everything from the source legal dirs.
|
||||
LEGAL_NOTICES := \
|
||||
$(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/common) \
|
||||
$(if $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
|
||||
$(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
|
||||
$(call FindModuleLegalSrcDirs, $(MODULE)) \
|
||||
)
|
||||
|
||||
ifneq ($(strip $(LEGAL_NOTICES)), )
|
||||
LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
|
||||
DEPS += $(call FindFiles, $(LEGAL_NOTICES))
|
||||
|
||||
JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
|
||||
endif
|
||||
|
||||
ifeq ($(filter-out jdk.incubator.%, $(MODULE)), )
|
||||
JMOD_FLAGS += --do-not-resolve-by-default
|
||||
JMOD_FLAGS += --warn-if-resolved=incubating
|
||||
endif
|
||||
|
||||
# Add dependencies on other jmod files. Only java.base needs access to other
|
||||
# jmods.
|
||||
ifeq ($(MODULE), java.base)
|
||||
# When creating a BUILDJDK, we don't need to add hashes to java.base
|
||||
ifneq ($(CREATING_BUILDJDK), true)
|
||||
# When creating interim versions of jmods, skip hashes
|
||||
ifneq ($(INTERIM_JMOD), true)
|
||||
ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules)
|
||||
DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
|
||||
$(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
|
||||
|
||||
EXCLUDE_PATTERN := $(strip $(subst $(SPACE),$$|,$(strip $(ALL_UPGRADEABLE_MODULES))))
|
||||
|
||||
JMOD_FLAGS += --module-path $(JMODS_DIR) \
|
||||
--hash-modules '^(?!$(EXCLUDE_PATTERN)$$)'
|
||||
endif
|
||||
endif
|
||||
else # not java.base
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
# Only java.base needs to include the MSVC*_DLLs. Make sure no other module
|
||||
# tries to include them (typically imported ones).
|
||||
ifneq ($(MSVCR_DLL), )
|
||||
ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCR_DLL))), )
|
||||
JMOD_FLAGS += --exclude '$(notdir $(MSVCR_DLL))'
|
||||
endif
|
||||
endif
|
||||
ifneq ($(VCRUNTIME_1_DLL), )
|
||||
ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(VCRUNTIME_1_DLL))), )
|
||||
JMOD_FLAGS += --exclude '$(notdir $(VCRUNTIME_1_DLL))'
|
||||
endif
|
||||
endif
|
||||
ifneq ($(MSVCP_DLL), )
|
||||
ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCP_DLL))), )
|
||||
JMOD_FLAGS += --exclude '$(notdir $(MSVCP_DLL))'
|
||||
endif
|
||||
endif
|
||||
ifneq ($(UCRT_DLL_DIR), )
|
||||
UCRT_DLL_FILES := $(notdir $(wildcard $(UCRT_DLL_DIR)/*.dll))
|
||||
ifneq ($(wildcard $(LIBS_DIR)/$(firstword $(UCRT_DLL_FILES))), )
|
||||
JMOD_FLAGS += $(patsubst %, --exclude '%', $(UCRT_DLL_FILES))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Include module specific build settings
|
||||
|
||||
THIS_SNIPPET := $(call GetModuleSnippetName, Jmod)
|
||||
|
||||
ifneq ($(wildcard $(THIS_SNIPPET)), )
|
||||
include MakeSnippetStart.gmk
|
||||
|
||||
include $(THIS_SNIPPET)
|
||||
|
||||
include MakeSnippetEnd.gmk
|
||||
endif
|
||||
|
||||
# Set main class
|
||||
ifneq ($(JMOD_FLAGS_main_class), )
|
||||
JMOD_FLAGS += $(JMOD_FLAGS_main_class)
|
||||
endif
|
||||
|
||||
# Changes to the jmod tool itself should also trigger a rebuild of all jmods.
|
||||
# The variable JMOD_CMD could contain an environment variable assignment before
|
||||
# the actual command. Filter that out using wildcard before adding to DEPS.
|
||||
DEPS += $(wildcard $(JMOD_CMD))
|
||||
ifeq ($(EXTERNAL_BUILDJDK), false)
|
||||
DEPS += $(call FindFiles, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
|
||||
endif
|
||||
|
||||
# If creating interim versions of jmods, certain files need to be filtered out
|
||||
# to avoid false incremental rebuilds.
|
||||
ifeq ($(INTERIM_JMOD), true)
|
||||
DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
|
||||
INTERIM_MSG := interim$(SPACE)
|
||||
endif
|
||||
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
ifeq ($(SHIP_DEBUG_SYMBOLS), )
|
||||
JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.pdb,*.map}'
|
||||
else
|
||||
JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.map}'
|
||||
endif
|
||||
else
|
||||
ifeq ($(SHIP_DEBUG_SYMBOLS), )
|
||||
JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM}'
|
||||
else
|
||||
JMOD_FLAGS += --exclude '**{_the.*,_*.marker*}'
|
||||
endif
|
||||
endif
|
||||
|
||||
# Unless we are creating a very large module, use the small tool JVM options
|
||||
JMOD_SMALL_FLAGS :=
|
||||
ifeq ($(findstring $(MODULE), java.base java.desktop jdk.localedata), )
|
||||
JMOD_SMALL_FLAGS += $(JAVA_TOOL_FLAGS_SMALL)
|
||||
endif
|
||||
|
||||
ifeq ($(INTERIM_JMOD), true)
|
||||
# Interim JMODs are not shipped anywhere, so there is no reason
|
||||
# to compress them at all.
|
||||
JMOD_FLAGS += --compress zip-0
|
||||
|
||||
JMOD_TARGET_OS := $(OPENJDK_BUILD_OS)
|
||||
ifeq ($(JMOD_TARGET_OS), macosx)
|
||||
JMOD_TARGET_OS := macos
|
||||
endif
|
||||
|
||||
JMOD_TARGET_CPU := $(OPENJDK_BUILD_CPU)
|
||||
ifeq ($(JMOD_TARGET_CPU), x86_64)
|
||||
JMOD_TARGET_CPU := amd64
|
||||
endif
|
||||
|
||||
JMOD_TARGET_PLATFORM := $(JMOD_TARGET_OS)-$(JMOD_TARGET_CPU)
|
||||
else
|
||||
JMOD_FLAGS += --compress $(JMOD_COMPRESS)
|
||||
JMOD_TARGET_PLATFORM := $(OPENJDK_MODULE_TARGET_PLATFORM)
|
||||
endif
|
||||
|
||||
# Create jmods in the support dir and then move them into place to keep the
|
||||
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
|
||||
$(eval $(call SetupExecute, create_$(JMOD_FILE), \
|
||||
WARN := Creating $(INTERIM_MSG)$(JMOD_FILE), \
|
||||
DEPS := $(DEPS), \
|
||||
OUTPUT_FILE := $(JMODS_DIR)/$(JMOD_FILE), \
|
||||
WORKING_DIR := $(WORKSPACE_ROOT), \
|
||||
SUPPORT_DIR := $(JMODS_SUPPORT_DIR), \
|
||||
PRE_COMMAND := $(RM) $(JMODS_DIR)/$(JMOD_FILE) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
|
||||
COMMAND := $(JMOD) $(JMOD_SMALL_FLAGS) create --module-version $(VERSION_SHORT) \
|
||||
--target-platform '$(JMOD_TARGET_PLATFORM)' \
|
||||
--module-path $(JMODS_DIR) $(JMOD_FLAGS) \
|
||||
--date $(SOURCE_DATE_ISO_8601) \
|
||||
$(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
|
||||
POST_COMMAND := $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
|
||||
))
|
||||
|
||||
TARGETS += $(create_$(JMOD_FILE))
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
810
make/Docs.gmk
Normal file
810
make/Docs.gmk
Normal file
|
|
@ -0,0 +1,810 @@
|
|||
# Copyright (c) 1997, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This file generates all documentation for OpenJDK.
|
||||
#
|
||||
# We will generate API documentation for two different selections of the source
|
||||
# code: "Java SE", which contains just the modules covered by the top-level
|
||||
# module java.se and "JDK", which covers all of Java SE and also all
|
||||
# other available modules that should be documented, including imported modules,
|
||||
# if any.
|
||||
#
|
||||
# We will also generate separate, free-standing specifications from either
|
||||
# markdown or existing html files.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include Execute.gmk
|
||||
include Modules.gmk
|
||||
include ProcessMarkdown.gmk
|
||||
include TextFileProcessing.gmk
|
||||
include ZipArchive.gmk
|
||||
include $(TOPDIR)/make/ModuleTools.gmk
|
||||
include $(TOPDIR)/make/ToolsJdk.gmk
|
||||
|
||||
# This is needed to properly setup DOCS_MODULES.
|
||||
$(eval $(call ReadImportMetaData))
|
||||
|
||||
################################################################################
|
||||
# Javadoc settings
|
||||
|
||||
# Include configuration for URLs in generated javadoc
|
||||
include $(TOPDIR)/make/conf/javadoc.conf
|
||||
|
||||
MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) )
|
||||
|
||||
|
||||
# In order to get a specific ordering it's necessary to specify the total
|
||||
# ordering of tags as the tags are otherwise ordered in order of definition.
|
||||
JAVADOC_TAGS := \
|
||||
-tag 'apiNote:a:API Note:' \
|
||||
-tag 'implSpec:a:Implementation Requirements:' \
|
||||
-tag 'implNote:a:Implementation Note:' \
|
||||
-tag param \
|
||||
-tag return \
|
||||
-tag throws \
|
||||
-taglet build.tools.taglet.JSpec\$$JLS \
|
||||
-taglet build.tools.taglet.JSpec\$$JVMS \
|
||||
-taglet build.tools.taglet.ModuleGraph \
|
||||
-taglet build.tools.taglet.SealedGraph \
|
||||
-taglet build.tools.taglet.ToolGuide \
|
||||
-tag since \
|
||||
-tag serialData \
|
||||
-tag factory \
|
||||
-tag spec \
|
||||
-tag see \
|
||||
-taglet build.tools.taglet.ExtLink \
|
||||
-taglet build.tools.taglet.Incubating \
|
||||
-tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
$(CUSTOM_JAVADOC_TAGS) \
|
||||
#
|
||||
|
||||
# The reference tags must stay stable to allow for comparisons across the
|
||||
# development cycle. If JAVADOC_TAGS needs to change, make sure that
|
||||
# REFERENCE_TAGS remains unchanged, by copying and hardcoding, if necessary.
|
||||
REFERENCE_TAGS := $(JAVADOC_TAGS)
|
||||
|
||||
# Which doclint checks to ignore
|
||||
JAVADOC_DISABLED_DOCLINT_WARNINGS := missing
|
||||
JAVADOC_DISABLED_DOCLINT_PACKAGES := org.w3c.* javax.smartcardio
|
||||
|
||||
# The initial set of options for javadoc
|
||||
# -XDaccessInternalAPI is a temporary workaround, see 8373909
|
||||
JAVADOC_OPTIONS := -use -keywords -notimestamp \
|
||||
-serialwarn -encoding utf-8 -docencoding utf-8 -breakiterator \
|
||||
-splitIndex --system none -javafx --expand-requires transitive \
|
||||
--override-methods=summary \
|
||||
-XDaccessInternalAPI
|
||||
|
||||
# The reference options must stay stable to allow for comparisons across the
|
||||
# development cycle.
|
||||
REFERENCE_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \
|
||||
-serialwarn -encoding utf-8 -breakiterator -splitIndex --system none \
|
||||
-html5 -javafx --expand-requires transitive \
|
||||
-XDaccessInternalAPI
|
||||
|
||||
# Should we add DRAFT stamps to the generated javadoc?
|
||||
ifeq ($(VERSION_IS_GA), true)
|
||||
IS_DRAFT := false
|
||||
else
|
||||
IS_DRAFT := true
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# General text snippets
|
||||
|
||||
FULL_COMPANY_NAME := Oracle and/or its affiliates
|
||||
COMPANY_ADDRESS := 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
|
||||
JAVA_PLATFORM := Java Platform
|
||||
|
||||
ifeq ($(IS_DRAFT), true)
|
||||
DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong>
|
||||
ifeq ($(VERSION_BUILD), )
|
||||
DRAFT_MARKER_TITLE := $(SPACE)[ad-hoc build]
|
||||
else
|
||||
DRAFT_MARKER_TITLE := $(SPACE)[build $(VERSION_BUILD)]
|
||||
endif
|
||||
DRAFT_TEXT := This specification is not final and is subject to change. \
|
||||
Use is subject to <a href="$(LICENSE_URL)">license terms</a>.
|
||||
endif
|
||||
|
||||
# $1 - Relative prefix to COPYRIGHT_URL
|
||||
COPYRIGHT_BOTTOM = \
|
||||
<a href="$(strip $1)$(COPYRIGHT_URL)">Copyright</a> \
|
||||
© 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME), \
|
||||
$(COMPANY_ADDRESS).<br>All rights reserved. \
|
||||
Use is subject to <a href="$(LICENSE_URL)">license terms</a> and the \
|
||||
<a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \
|
||||
$(DRAFT_MARKER_STR) <!-- Version $(VERSION_STRING) -->
|
||||
|
||||
# $1 - Optional "Other Versions" link
|
||||
JAVADOC_BOTTOM = \
|
||||
<a href="$(BUG_SUBMIT_URL)">Report a bug or suggest an enhancement</a><br> \
|
||||
For further API reference and developer documentation see the \
|
||||
<a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \
|
||||
Documentation</a>, which contains more detailed, \
|
||||
developer-targeted descriptions with conceptual overviews, definitions \
|
||||
of terms, workarounds, and working code examples. $1<br> \
|
||||
Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \
|
||||
the US and other countries.<br> \
|
||||
$(call COPYRIGHT_BOTTOM, {@docroot}/../)
|
||||
|
||||
JAVADOC_TOP := \
|
||||
<div style="padding: 6px; text-align: center; font-size: 80%; \
|
||||
font-family: DejaVu Sans, Arial, Helvetica, sans-serif; \
|
||||
font-weight: normal;">$(DRAFT_TEXT)</div>
|
||||
|
||||
################################################################################
|
||||
# JDK javadoc titles/text snippets
|
||||
|
||||
JDK_SHORT_NAME := Java SE $(VERSION_SPECIFICATION) & JDK $(VERSION_SPECIFICATION)
|
||||
JDK_LONG_NAME := Java<sup>®</sup> Platform, Standard Edition \
|
||||
& Java Development Kit
|
||||
|
||||
################################################################################
|
||||
# Java SE javadoc titles/text snippets
|
||||
|
||||
JAVASE_SHORT_NAME := Java SE $(VERSION_SPECIFICATION)
|
||||
JAVASE_LONG_NAME := Java<sup>®</sup> Platform, Standard Edition
|
||||
|
||||
################################################################################
|
||||
# Functions
|
||||
|
||||
# Helper function for creating a svg file from a dot file generated by the
|
||||
# GenGraphs tool for a module.
|
||||
# param 1: SetupJavadocGeneration namespace ($1)
|
||||
# param 2: module name
|
||||
#
|
||||
define setup_module_graph_dot_to_svg
|
||||
$1_$2_DOT_SRC := $$($1_MODULE_GRAPHS_DIR)/$2.dot
|
||||
$1_$2_SVG_TARGET := $$($1_TARGET_DIR)/$2/module-graph.svg
|
||||
|
||||
# For each module needing a graph, create a svg file from the dot file
|
||||
# generated by the GenGraphs tool and store it in the target dir.
|
||||
$$(eval $$(call SetupExecute, module_graphs_svg_$1_$2, \
|
||||
INFO := Running dot for module graphs for $2, \
|
||||
DEPS := $$(module_graphs_dot_$1_TARGET), \
|
||||
OUTPUT_FILE := $$($1_$2_SVG_TARGET), \
|
||||
SUPPORT_DIR := $$($1_MODULE_GRAPHS_DIR), \
|
||||
COMMAND := $$(DOT) -Tsvg -o $$($1_$2_SVG_TARGET) $$($1_$2_DOT_SRC), \
|
||||
))
|
||||
|
||||
$1_GRAPHS_TARGETS += $$($1_$2_SVG_TARGET)
|
||||
endef
|
||||
|
||||
# Helper function for creating a svg file for a class for which the SealedGraph
|
||||
# taglet has generated a dot file. The dot file has a special name which
|
||||
# encodes the module and class the graph belongs to.
|
||||
#
|
||||
# param 1: SetupJavadocGeneration namespace ($1)
|
||||
# param 2: dot file name
|
||||
#
|
||||
define setup_sealed_graph_dot_to_svg
|
||||
$1_$2_DOT_SRC := $$($1_SEALED_GRAPHS_DIR)/$2.dot
|
||||
$1_$2_TARGET_CLASS := $$(word 2, $$(subst _, , $2))
|
||||
$1_$2_SLASHED_NAME := $$(subst .,/, $$($1_$2_TARGET_CLASS))
|
||||
$1_$2_TARGET_MODULE := $$(word 1, $$(subst _, , $2))
|
||||
$1_$2_TARGET_PATH := $$($1_TARGET_DIR)/$$($1_$2_TARGET_MODULE)/$$(dir $$($1_$2_SLASHED_NAME))
|
||||
$1_$2_TARGET_NAME := $$(notdir $$($1_$2_SLASHED_NAME))
|
||||
$1_$2_SVG_TARGET := $$($1_$2_TARGET_PATH)/$$($1_$2_TARGET_NAME)-sealed-graph.svg
|
||||
$$(call MakeDir, $$($1_$2_TARGET_PATH))
|
||||
|
||||
# For each class needing a graph, create a svg file from the dot file
|
||||
# generated by the SealedGraph taglet and store it in the target dir.
|
||||
$$(eval $$(call SetupExecute, sealed_graphs_svg_$1_$2, \
|
||||
INFO := Running dot for sealed graphs for $$($1_$2_TARGET_MODULE)/$$($1_$2_TARGET_CLASS), \
|
||||
DEPS := $$($1_$2_DOT_SRC), \
|
||||
OUTPUT_FILE := $$($1_$2_SVG_TARGET), \
|
||||
SUPPORT_DIR := $$($1_SEALED_GRAPHS_DIR), \
|
||||
COMMAND := $$(DOT) -Tsvg -o $$($1_$2_SVG_TARGET) $$($1_$2_DOT_SRC), \
|
||||
))
|
||||
|
||||
$1_GRAPHS_TARGETS += $$($1_$2_SVG_TARGET)
|
||||
endef
|
||||
|
||||
# Helper function to create the overview.html file to use with the -overview
|
||||
# javadoc option.
|
||||
# Returns the filename as $1_OVERVIEW.
|
||||
#
|
||||
# param 1: SetupJavadocGeneration namespace ($1)
|
||||
define create_overview_file
|
||||
$1_OVERVIEW_TEXT := \
|
||||
<!DOCTYPE html> \
|
||||
<html><head></head><body> \
|
||||
#
|
||||
ifneq ($$($1_GROUPS), )
|
||||
$1_OVERVIEW_TEXT += \
|
||||
<p>This document has \
|
||||
$$(subst 2,two,$$(subst 3,three,$$(words $$($1_GROUPS)))) major sections:</p> \
|
||||
<blockquote><dl> \
|
||||
#
|
||||
$1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \
|
||||
<dt style="margin-top: 8px;">$$($$g_GROUP_NAME)</dt> \
|
||||
<dd style="margin-top: 8px;">$$($$g_GROUP_DESCRIPTION)</dd> \
|
||||
)
|
||||
$1_OVERVIEW_TEXT += \
|
||||
</dl></blockquote> \
|
||||
<p><a href="../specs/index.html">Related documents</a> specify the Java \
|
||||
programming language, the Java Virtual Machine, various protocols and file \
|
||||
formats pertaining to the Java platform, and tools included in the JDK.</p> \
|
||||
#
|
||||
endif
|
||||
$1_OVERVIEW_TEXT += \
|
||||
</body></html> \
|
||||
#
|
||||
|
||||
$1_OVERVIEW := $$(SUPPORT_OUTPUTDIR)/docs/$1-overview.html
|
||||
|
||||
$1_OVERVIEW_VARDEPS_FILE := $$(call DependOnVariable, $1_OVERVIEW_TEXT, \
|
||||
$$($1_OVERVIEW).vardeps)
|
||||
|
||||
$$($1_OVERVIEW): $$($1_OVERVIEW_VARDEPS_FILE)
|
||||
$$(call LogInfo, Creating overview.html for $1)
|
||||
$$(call MakeDir, $$(@D))
|
||||
$$(PRINTF) "%s" '$$($1_OVERVIEW_TEXT)' > $$@
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
# Setup make rules to create an API documentation collection, using javadoc and
|
||||
# other tools if needed.
|
||||
#
|
||||
# Parameter 1 is the name of the rule. This name is used as variable prefix.
|
||||
# Targets generated are returned as $1_JAVADOC_TARGETS and
|
||||
# $1_GRAPHS_TARGETS. Note that the index.html file will work as a "touch
|
||||
# file" for all the magnitude of files that are generated by javadoc.
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# MODULES - Modules to generate javadoc for
|
||||
# GROUPS - Name of the groups to divide the modules into, if any
|
||||
# SHORT_NAME - The short name of this documentation collection
|
||||
# LONG_NAME - The long name of this documentation collection
|
||||
# TARGET_DIR - Where to store the output
|
||||
# OTHER_VERSIONS - URL for other page listing versions
|
||||
#
|
||||
SetupApiDocsGeneration = $(NamedParamsMacroTemplate)
|
||||
define SetupApiDocsGenerationBody
|
||||
|
||||
# Figure out all modules, both specified and transitive indirect exports, that
|
||||
# will be processed by javadoc.
|
||||
$1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
|
||||
$1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
|
||||
|
||||
$1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION)
|
||||
|
||||
ifeq ($$(ENABLE_FULL_DOCS), true)
|
||||
$1_SEALED_GRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-sealed-graphs
|
||||
|
||||
# Tell the ModuleGraph and SealedGraph taglets to generate html links to
|
||||
# soon-to-be-created svg files with module/sealed graphs.
|
||||
$1_JAVA_ARGS += -DenableModuleGraph=true -DsealedDotOutputDir=$$($1_SEALED_GRAPHS_DIR)
|
||||
$$(call MakeDir, $$($1_SEALED_GRAPHS_DIR))
|
||||
endif
|
||||
|
||||
# Start with basic options and tags
|
||||
ifeq ($$($1_OPTIONS), )
|
||||
$1_OPTIONS := $$(JAVADOC_OPTIONS)
|
||||
endif
|
||||
ifeq ($$($1_TAGS), )
|
||||
$1_TAGS := $$(JAVADOC_TAGS)
|
||||
endif
|
||||
$1_OPTIONS += $$($1_TAGS)
|
||||
|
||||
$1_OPTIONS += --module-source-path $$(MODULES_SOURCE_PATH)
|
||||
$1_OPTIONS += --module $$(call CommaList, $$($1_MODULES))
|
||||
|
||||
# Create a string like "-Xdoclint:all,-syntax,-html,..."
|
||||
$1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \
|
||||
$$(JAVADOC_DISABLED_DOCLINT_WARNINGS)))
|
||||
# Ignore the doclint warnings in certain packages
|
||||
$1_OPTIONS += -Xdoclint/package:$$(call CommaList, $$(addprefix -, \
|
||||
$$(JAVADOC_DISABLED_DOCLINT_PACKAGES)))
|
||||
ifeq ($$(JAVA_WARNINGS_AS_ERRORS), true)
|
||||
$1_OPTIONS += -Werror
|
||||
endif
|
||||
|
||||
$1_DOC_TITLE := $$($1_LONG_NAME)<br>Version $$(VERSION_SPECIFICATION) API \
|
||||
Specification
|
||||
$1_WINDOW_TITLE := $$(subst &,&,$$($1_SHORT_NAME))$$(DRAFT_MARKER_TITLE)
|
||||
$1_HEADER_TITLE := <div><strong>$$($1_SHORT_NAME)</strong> \
|
||||
$$(DRAFT_MARKER_STR)</div>
|
||||
ifneq ($$($1_OTHER_VERSIONS), )
|
||||
$1_JAVADOC_BOTTOM := $$(call JAVADOC_BOTTOM, <a href="$$($1_OTHER_VERSIONS)">Other versions.</a>)
|
||||
else
|
||||
$1_JAVADOC_BOTTOM := $$(call JAVADOC_BOTTOM, )
|
||||
endif
|
||||
|
||||
$1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
|
||||
$1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)'
|
||||
$1_OPTIONS += -header '$$($1_HEADER_TITLE)'
|
||||
$1_OPTIONS += -bottom '$$($1_JAVADOC_BOTTOM)'
|
||||
ifeq ($$(IS_DRAFT), true)
|
||||
$1_OPTIONS += -top '$$(JAVADOC_TOP)'
|
||||
endif
|
||||
|
||||
# Do not store debug level options in VARDEPS.
|
||||
ifneq ($$(LOG_LEVEL), trace)
|
||||
$1_LOG_OPTION += -quiet
|
||||
else
|
||||
$1_LOG_OPTION += -verbose
|
||||
endif
|
||||
|
||||
# Generate the overview.html file. This will return the filename in
|
||||
# $1_OVERVIEW.
|
||||
$$(eval $$(call create_overview_file,$1))
|
||||
$1_OPTIONS += -overview $$($1_OVERVIEW)
|
||||
|
||||
# Add summary pages for new/deprecated APIs in recent releases
|
||||
$1_OPTIONS += --since $(call CommaList, \
|
||||
$(filter-out $(VERSION_DOCS_API_SINCE), \
|
||||
$(call sequence, $(VERSION_DOCS_API_SINCE), $(VERSION_FEATURE))))
|
||||
$1_OPTIONS += --since-label "New API since JDK $(VERSION_DOCS_API_SINCE)"
|
||||
|
||||
$$(foreach g, $$($1_GROUPS), \
|
||||
$$(eval $1_OPTIONS += -group "$$($$g_GROUP_NAME)" "$$($$g_GROUP_MODULES)") \
|
||||
)
|
||||
|
||||
ifeq ($$($1_JAVADOC_CMD), )
|
||||
$1_JAVADOC_CMD := $$(JAVA) -Djava.awt.headless=true $$($1_JAVA_ARGS) \
|
||||
$$(NEW_JAVADOC)
|
||||
else
|
||||
$1_OPTIONS += $$(addprefix -J, $$($1_JAVA_ARGS))
|
||||
endif
|
||||
|
||||
$1_VARDEPS := $$($1_JAVA_ARGS) $$($1_OPTIONS) $$(MODULES_SOURCE_PATH) \
|
||||
$$($1_ALL_MODULES) $$($1_JAVADOC_CMD)
|
||||
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
|
||||
$$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
|
||||
|
||||
# Get a list of all files in all the source dirs for all included modules
|
||||
$1_SOURCE_DEPS := $$(call FindFiles, $$(wildcard $$(foreach module, \
|
||||
$$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))
|
||||
|
||||
$$(eval $$(call SetupExecute, javadoc_$1, \
|
||||
WARN := Generating $1 javadoc for $$(words $$($1_ALL_MODULES)) modules, \
|
||||
INFO := Javadoc modules: $$($1_ALL_MODULES), \
|
||||
DEPS := $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) $$($1_SOURCE_DEPS) \
|
||||
$$($1_OVERVIEW), \
|
||||
OUTPUT_DIR := $$($1_TARGET_DIR), \
|
||||
SUPPORT_DIR := $$(SUPPORT_OUTPUTDIR)/docs, \
|
||||
COMMAND := $$($1_JAVADOC_CMD) -d $$($1_TARGET_DIR) $$($1_OPTIONS) \
|
||||
$$($1_LOG_OPTION), \
|
||||
))
|
||||
|
||||
$1_JAVADOC_TARGETS := $$(javadoc_$1_TARGET)
|
||||
|
||||
ifeq ($$(ENABLE_FULL_DOCS), true)
|
||||
# We have asked ModuleGraph to generate links to svg files. Now we must
|
||||
# produce the svg files.
|
||||
|
||||
# Locate which modules has the @moduleGraph tag in their module-info.java
|
||||
$1_MODULES_NEEDING_GRAPH := $$(strip $$(foreach m, $$($1_ALL_MODULES), \
|
||||
$$(if $$(shell $$(GREP) -e @moduleGraph \
|
||||
$$(wildcard $$(addsuffix /module-info.java, \
|
||||
$$(call FindModuleSrcDirs, $$m)))), \
|
||||
$$m) \
|
||||
))
|
||||
|
||||
# First we run the GenGraph tool. It will query the module structure of the
|
||||
# running JVM and output .dot files for all existing modules.
|
||||
MODULE_GRAPHS_PROPS := \
|
||||
$$(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw/javadoc-graphs.properties
|
||||
|
||||
$1_MODULE_GRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-module-graphs
|
||||
|
||||
$$(eval $$(call SetupExecute, module_graphs_dot_$1, \
|
||||
INFO := Generating module graphs for $1 documentation, \
|
||||
DEPS := $$(BUILD_JIGSAW_TOOLS) $$(MODULE_GRAPHS_PROPS), \
|
||||
OUTPUT_DIR := $$($1_MODULE_GRAPHS_DIR), \
|
||||
COMMAND := $$(TOOL_GENGRAPHS) --spec --output $$($1_MODULE_GRAPHS_DIR) \
|
||||
--dot-attributes $$(MODULE_GRAPHS_PROPS), \
|
||||
))
|
||||
|
||||
# For each module needing a graph, create a svg file from the dot file
|
||||
# generated by the GenGraphs tool and store it in the target dir.
|
||||
# They will depend on module_graphs_dot_$1_TARGET, and will be added to
|
||||
# $1_GRAPHS_TARGETS.
|
||||
$$(foreach m, $$($1_MODULES_NEEDING_GRAPH), \
|
||||
$$(eval $$(call setup_module_graph_dot_to_svg,$1,$$m)) \
|
||||
)
|
||||
|
||||
# We have asked SealedGraph to generate dot files and links to svg files.
|
||||
# Now we must produce the svg files from the dot files.
|
||||
|
||||
# Get a list of classes for which SealedGraph has generated dot files
|
||||
$1_SEALED_CLASSES := $$(patsubst %.dot,%,$$(patsubst \
|
||||
$$($1_SEALED_GRAPHS_DIR)/%,%, \
|
||||
$$(wildcard $$($1_SEALED_GRAPHS_DIR)/*.dot)))
|
||||
|
||||
# For each class needing a graph, create a svg file from the dot file
|
||||
# generated by the SealedGraph taglet and store it in the target dir.
|
||||
# They will will be added to $1_GRAPHS_TARGETS.
|
||||
$$(foreach c, $$($1_SEALED_CLASSES), \
|
||||
$$(eval $$(call setup_sealed_graph_dot_to_svg,$1,$$c)) \
|
||||
)
|
||||
endif
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
# Setup generation of the JDK API documentation (javadoc + graphs)
|
||||
|
||||
# Define the groups of the JDK API documentation
|
||||
JavaSE_GROUP_NAME := Java SE
|
||||
JavaSE_GROUP_MODULES := $(call ColonList, $(sort java.se \
|
||||
$(call FindTransitiveIndirectDepsForModules, java.se)))
|
||||
JavaSE_GROUP_DESCRIPTION := \
|
||||
The Java Platform, Standard Edition (Java SE) APIs define the core Java \
|
||||
platform for general-purpose computing. These APIs are in modules whose \
|
||||
names start with {@code java}. \
|
||||
#
|
||||
JDK_GROUPS += JavaSE
|
||||
|
||||
JDK_GROUP_NAME := JDK
|
||||
JDK_GROUP_MODULES := jdk.*
|
||||
JDK_GROUP_DESCRIPTION := \
|
||||
The Java Development Kit (JDK) APIs are specific to the JDK and will not \
|
||||
necessarily be available in all implementations of the Java SE Platform. \
|
||||
These APIs are in modules whose names start with {@code jdk}. \
|
||||
#
|
||||
JDK_GROUPS += JDK
|
||||
|
||||
# If we are importing JavaFX, we need a JavaFX group. In an ideal world, this
|
||||
# would have been abstracted away to a more proper generic handling of imported
|
||||
# modules.
|
||||
ifneq ($(findstring javafx., $(IMPORTED_MODULES)), )
|
||||
JavaFX_GROUP_NAME := JavaFX
|
||||
JavaFX_GROUP_MODULES := javafx.*
|
||||
JavaFX_GROUP_DESCRIPTION := \
|
||||
The JavaFX APIs define a set of user-interface controls, graphics, \
|
||||
media, and web packages for developing rich client applications. These \
|
||||
APIs are in modules whose names start with {@code javafx}. \
|
||||
#
|
||||
JDK_GROUPS += JavaFX
|
||||
endif
|
||||
|
||||
# All modules to have docs generated by docs-jdk-api target
|
||||
JDK_MODULES := $(sort $(filter-out $(MODULES_FILTER), $(DOCS_MODULES)))
|
||||
|
||||
$(eval $(call SetupApiDocsGeneration, JDK_API, \
|
||||
MODULES := $(JDK_MODULES), \
|
||||
GROUPS := $(JDK_GROUPS), \
|
||||
SHORT_NAME := $(JDK_SHORT_NAME), \
|
||||
LONG_NAME := $(JDK_LONG_NAME), \
|
||||
TARGET_DIR := $(DOCS_OUTPUTDIR)/api, \
|
||||
OTHER_VERSIONS := $(OTHER_JDK_VERSIONS_URL), \
|
||||
))
|
||||
|
||||
# Targets generated are returned in JDK_API_JAVADOC_TARGETS and
|
||||
# JDK_API_GRAPHS_TARGETS.
|
||||
|
||||
################################################################################
|
||||
# Setup generation of the Java SE API documentation (javadoc + graphs)
|
||||
|
||||
# The Java SE module scope is just java.se and its transitive indirect
|
||||
# exports.
|
||||
JAVASE_MODULES := java.se
|
||||
|
||||
$(eval $(call SetupApiDocsGeneration, JAVASE_API, \
|
||||
MODULES := $(JAVASE_MODULES), \
|
||||
SHORT_NAME := $(JAVASE_SHORT_NAME), \
|
||||
LONG_NAME := $(JAVASE_LONG_NAME), \
|
||||
TARGET_DIR := $(DOCS_JAVASE_IMAGE_DIR)/api, \
|
||||
))
|
||||
|
||||
# Targets generated are returned in JAVASE_API_JAVADOC_TARGETS and
|
||||
# JAVASE_API_GRAPHS_TARGETS.
|
||||
|
||||
################################################################################
|
||||
# Setup generation of the reference Java SE API documentation (javadoc + graphs)
|
||||
|
||||
# The reference javadoc is just the same as javase, but using the BootJDK javadoc
|
||||
# and a stable set of javadoc options. Typically it is used for generating
|
||||
# diffs between the reference javadoc and a javadoc bundle of a specific build
|
||||
# generated in the same way.
|
||||
|
||||
$(eval $(call SetupApiDocsGeneration, REFERENCE_API, \
|
||||
MODULES := $(JAVASE_MODULES), \
|
||||
SHORT_NAME := $(JAVASE_SHORT_NAME), \
|
||||
LONG_NAME := $(JAVASE_LONG_NAME), \
|
||||
TARGET_DIR := $(DOCS_REFERENCE_IMAGE_DIR)/api, \
|
||||
JAVADOC_CMD := $(DOCS_REFERENCE_JAVADOC), \
|
||||
OPTIONS := $(REFERENCE_OPTIONS), \
|
||||
TAGS := $(REFERENCE_TAGS), \
|
||||
))
|
||||
|
||||
# Targets generated are returned in REFERENCE_API_JAVADOC_TARGETS and
|
||||
# REFERENCE_API_GRAPHS_TARGETS.
|
||||
|
||||
################################################################################
|
||||
|
||||
# Use this variable to control which spec files are included in the output.
|
||||
# Format: space-delimited list of names, including at most one '%' as a
|
||||
# wildcard. Spec source files match if their filename or any enclosing folder
|
||||
# name matches one of the items in SPEC_FILTER.
|
||||
ifeq ($(SPEC_FILTER), )
|
||||
SPEC_FILTER := %
|
||||
endif
|
||||
|
||||
ApplySpecFilter = \
|
||||
$(strip $(foreach file, $(1), \
|
||||
$(eval searchkeys := $(subst /, ,$(subst $(WORKSPACE_ROOT),,$(file)))) \
|
||||
$(if $(filter $(SPEC_FILTER), $(searchkeys)), \
|
||||
$(file) \
|
||||
) \
|
||||
))
|
||||
|
||||
# Copy the global resources, including the top-level redirect index.html
|
||||
GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources
|
||||
$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
|
||||
SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
|
||||
FILES := $(call ApplySpecFilter, $(call FindFiles, $(GLOBAL_SPECS_RESOURCES_DIR))), \
|
||||
DEST := $(DOCS_OUTPUTDIR), \
|
||||
))
|
||||
JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
|
||||
|
||||
# Copy the legal notices distributed with the docs bundle
|
||||
$(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \
|
||||
SRC := $(TOPDIR)/src/jdk.javadoc/share/legal, \
|
||||
FILES := $(call ApplySpecFilter, $(wildcard $(TOPDIR)/src/jdk.javadoc/share/legal/*)), \
|
||||
DEST := $(DOCS_OUTPUTDIR)/legal, \
|
||||
))
|
||||
JDK_INDEX_TARGETS += $(COPY_DOCS_LEGAL_NOTICES)
|
||||
|
||||
################################################################################
|
||||
# Copy JDK specs files
|
||||
|
||||
# For all non html/md files in $module/share/specs directories, copy them
|
||||
# unmodified
|
||||
|
||||
ALL_MODULES := $(call FindAllModules)
|
||||
COPY_SPEC_FILTER := %.gif %.jpg %.mib %.css
|
||||
|
||||
$(foreach m, $(ALL_MODULES), \
|
||||
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
|
||||
$(foreach d, $(SPECS_$m), \
|
||||
$(if $(call ApplySpecFilter, $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d))), \
|
||||
$(eval $(call SetupCopyFiles, COPY_$m, \
|
||||
SRC := $d, \
|
||||
FILES := $(call ApplySpecFilter, $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d))), \
|
||||
DEST := $(DOCS_OUTPUTDIR)/specs/, \
|
||||
)) \
|
||||
$(eval JDK_SPECS_TARGETS += $(COPY_$m)) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
# Create copyright footer variables. We need different variables for different
|
||||
# relative paths to the copyright.html file. The number 0-2 below represent how
|
||||
# many extra directory levels down below the specs dir the specs html file is
|
||||
# located.
|
||||
SPECS_BOTTOM = <footer class="legal-footer"><hr/>$(COPYRIGHT_BOTTOM)</footer>
|
||||
# The legal dir is one ../ below the specs dir, so start with one ../.
|
||||
specs_bottom_rel_path := ../
|
||||
$(foreach n, 0 1 2, \
|
||||
$(eval SPECS_BOTTOM_$n := $(call SPECS_BOTTOM,$(specs_bottom_rel_path))) \
|
||||
$(eval specs_bottom_rel_path := $(specs_bottom_rel_path)../) \
|
||||
)
|
||||
|
||||
SPECS_TOP := $(if $(filter true, $(IS_DRAFT)), <header class="draft-header" role="banner">$(DRAFT_TEXT)</header>)
|
||||
|
||||
# For all html files in $module/share/specs directories, copy and add the
|
||||
# copyright footer.
|
||||
|
||||
$(foreach m, $(ALL_MODULES), \
|
||||
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
|
||||
$(foreach d, $(SPECS_$m), \
|
||||
$(foreach f, $(call ApplySpecFilter, $(filter %.html, $(call FindFiles, $d))), \
|
||||
$(eval $m_$f_NOF_SUBDIRS := $(words $(subst /, $(SPACE), $(subst $d, , $(dir $f))))) \
|
||||
$(eval $m_$f_NAME := PROCESS_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \
|
||||
$(eval $(call SetupTextFileProcessing, $($m_$f_NAME), \
|
||||
SOURCE_FILES := $f, \
|
||||
SOURCE_BASE_DIR := $d, \
|
||||
OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \
|
||||
REPLACEMENTS := \
|
||||
<body> => <body>$(SPECS_TOP) ; \
|
||||
</body> => $(SPECS_BOTTOM_$($m_$f_NOF_SUBDIRS))</body>, \
|
||||
)) \
|
||||
$(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
ifeq ($(ENABLE_PANDOC), true)
|
||||
# For all markdown files in $module/share/specs directories, convert them to
|
||||
# html, if we have pandoc (otherwise we'll just skip this).
|
||||
|
||||
GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css
|
||||
# Unset the following to suppress the link to the tool guides
|
||||
NAV_LINK_GUIDES := --nav-link-guides
|
||||
HEADER_RIGHT_SIDE_INFO := <strong>$(subst &,&,$(JDK_SHORT_NAME))</strong>$(DRAFT_MARKER_STR)
|
||||
|
||||
$(foreach m, $(ALL_MODULES), \
|
||||
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
|
||||
$(foreach d, $(SPECS_$m), \
|
||||
$(foreach f, $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, $d))), \
|
||||
$(eval $m_$f_NOF_SUBDIRS := $(words $(subst /, $(SPACE), $(subst $d, , $(dir $f))))) \
|
||||
$(eval $m_$f_NAME := SPECS_TO_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \
|
||||
$(eval $(call SetupProcessMarkdown, $($m_$f_NAME), \
|
||||
SRC := $d, \
|
||||
FILES := $f, \
|
||||
DEST := $(DOCS_OUTPUTDIR)/specs/, \
|
||||
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
|
||||
OPTIONS := -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_$($m_$f_NOF_SUBDIRS))', \
|
||||
REPLACEMENTS := \
|
||||
@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION) ; \
|
||||
@@VERSION_STRING@@ => $(VERSION_STRING), \
|
||||
POST_PROCESS := $(TOOL_FIXUPPANDOC) --insert-nav --nav-right-info '$(HEADER_RIGHT_SIDE_INFO)' \
|
||||
--nav-subdirs $($m_$f_NOF_SUBDIRS) $(NAV_LINK_GUIDES), \
|
||||
)) \
|
||||
$(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
# For all markdown files in $module/share/man directories, convert them to
|
||||
# html.
|
||||
|
||||
# Create dynamic man pages from markdown using pandoc. We need
|
||||
# PANDOC_HTML_MANPAGE_FILTER, a wrapper around
|
||||
# PANDOC_HTML_MANPAGE_FILTER_JAVASCRIPT. This is created by buildtools-jdk.
|
||||
|
||||
# We should also depend on the source code for the filter
|
||||
PANDOC_HTML_MANPAGE_FILTER_SOURCE := $(call FindFiles, \
|
||||
$(TOPDIR)/make/jdk/src/classes/build/tools/pandocfilter)
|
||||
|
||||
$(foreach m, $(ALL_MODULES), \
|
||||
$(eval MAN_$m := $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, \
|
||||
$(call FindModuleManDirsForDocs, $m))))) \
|
||||
$(if $(MAN_$m), \
|
||||
$(eval $(call SetupProcessMarkdown, MAN_TO_HTML_$m, \
|
||||
FILES := $(MAN_$m), \
|
||||
DEST := $(DOCS_OUTPUTDIR)/specs/man, \
|
||||
FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \
|
||||
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
|
||||
REPLACEMENTS := \
|
||||
@@COPYRIGHT_YEAR@@ => $(COPYRIGHT_YEAR) ; \
|
||||
@@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
|
||||
@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION), \
|
||||
OPTIONS := --toc -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_1)', \
|
||||
POST_PROCESS := $(TOOL_FIXUPPANDOC) --insert-nav --nav-right-info '$(HEADER_RIGHT_SIDE_INFO)' \
|
||||
--nav-subdirs 1 --nav-link-guides, \
|
||||
EXTRA_DEPS := $(PANDOC_HTML_MANPAGE_FILTER) \
|
||||
$(PANDOC_HTML_MANPAGE_FILTER_SOURCE), \
|
||||
)) \
|
||||
$(eval JDK_SPECS_TARGETS += $(MAN_TO_HTML_$m)) \
|
||||
) \
|
||||
)
|
||||
|
||||
# The html generated from markdown also needs the css file
|
||||
JDK_SPECS_TARGETS += $(COPY_GLOBAL_RESOURCES)
|
||||
endif
|
||||
|
||||
# Special treatment for generated documentation
|
||||
|
||||
SPEC_HEADER_BLOCK := \
|
||||
<header id="title-block-header"> \
|
||||
<div class="navbar"> \
|
||||
<div>$(HEADER_RIGHT_SIDE_INFO)</div> \
|
||||
<nav><ul><li><a href="PATH_TO_SPECS/../api/index.html">API</a> \
|
||||
<li><a href="PATH_TO_SPECS/index.html">OTHER SPECIFICATIONS</a> \
|
||||
<li><a href="PATH_TO_SPECS/man/index.html">TOOL GUIDES</a></ul></nav> \
|
||||
</div> \
|
||||
</header>
|
||||
|
||||
JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
|
||||
ifneq ($(call ApplySpecFilter, $(JDWP_PROTOCOL)), )
|
||||
JDWP_HEADER_BLOCK := $(subst PATH_TO_SPECS,..,$(SPEC_HEADER_BLOCK))
|
||||
$(eval $(call SetupTextFileProcessing, PROCESS_JDWP_PROTOCOL, \
|
||||
SOURCE_FILES := $(JDWP_PROTOCOL), \
|
||||
OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/jdwp, \
|
||||
REPLACEMENTS := \
|
||||
<style> => <link rel="stylesheet" href="../../resources/jdk-default.css"/><style> ; \
|
||||
<body> => <body>$(SPECS_TOP)$(JDWP_HEADER_BLOCK) ; \
|
||||
</body> => $(SPECS_BOTTOM_1)</body>, \
|
||||
))
|
||||
JDK_SPECS_TARGETS += $(PROCESS_JDWP_PROTOCOL)
|
||||
endif
|
||||
|
||||
# Get jvmti.html from the main jvm variant (all variants' jvmti.html are identical).
|
||||
JVMTI_HTML ?= $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html
|
||||
ifneq ($(call ApplySpecFilter, $(JVMTI_HTML)), )
|
||||
JVMTI_HEADER_BLOCK := $(subst PATH_TO_SPECS,.,$(SPEC_HEADER_BLOCK))
|
||||
$(eval $(call SetupTextFileProcessing, PROCESS_JVMTI_HTML, \
|
||||
SOURCE_FILES := $(JVMTI_HTML), \
|
||||
OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \
|
||||
REPLACEMENTS := \
|
||||
<style> => <link rel="stylesheet" href="../resources/jdk-default.css"/><style> ; \
|
||||
<body> => <body>$(SPECS_TOP)$(JVMTI_HEADER_BLOCK) ; \
|
||||
</body> => $(SPECS_BOTTOM_0)</body>, \
|
||||
))
|
||||
JDK_SPECS_TARGETS += $(PROCESS_JVMTI_HTML)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Optional target which bundles all generated javadocs into a zip archive.
|
||||
|
||||
JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
|
||||
JAVADOC_ZIP_FILE := $(OUTPUTDIR)/bundles/$(JAVADOC_ZIP_NAME)
|
||||
|
||||
$(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \
|
||||
SRC := $(DOCS_OUTPUTDIR), \
|
||||
ZIP := $(JAVADOC_ZIP_FILE), \
|
||||
EXTRA_DEPS := $(JDK_API_JAVADOC_TARGETS) $(JDK_API_GRAPHS_TARGETS) \
|
||||
$(JDK_SPECS_TARGETS), \
|
||||
))
|
||||
|
||||
ZIP_TARGETS += $(BUILD_JAVADOC_ZIP)
|
||||
|
||||
################################################################################
|
||||
# Bundles all generated specs into a zip archive, skipping javadocs.
|
||||
|
||||
SPECS_ZIP_NAME := jdk-$(VERSION_STRING)-specs.zip
|
||||
SPECS_ZIP_FILE := $(OUTPUTDIR)/bundles/$(SPECS_ZIP_NAME)
|
||||
|
||||
$(eval $(call SetupZipArchive, BUILD_SPECS_ZIP, \
|
||||
SRC := $(DOCS_OUTPUTDIR), \
|
||||
ZIP := $(SPECS_ZIP_FILE), \
|
||||
EXTRA_DEPS := $(JDK_SPECS_TARGETS), \
|
||||
))
|
||||
|
||||
SPECS_ZIP_TARGETS += $(BUILD_SPECS_ZIP)
|
||||
|
||||
################################################################################
|
||||
|
||||
docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) $(JDK_API_CUSTOM_TARGETS)
|
||||
|
||||
docs-jdk-api-graphs: $(JDK_API_GRAPHS_TARGETS)
|
||||
|
||||
docs-javase-api-javadoc: $(JAVASE_API_JAVADOC_TARGETS) $(JAVASE_API_CUSTOM_TARGETS)
|
||||
|
||||
docs-javase-api-graphs: $(JAVASE_API_GRAPHS_TARGETS)
|
||||
|
||||
docs-reference-api-javadoc: $(REFERENCE_API_JAVADOC_TARGETS) $(REFERENCE_API_CUSTOM_TARGETS)
|
||||
|
||||
docs-reference-api-graphs: $(REFERENCE_API_GRAPHS_TARGETS)
|
||||
|
||||
docs-jdk-specs: $(JDK_SPECS_TARGETS)
|
||||
|
||||
docs-jdk-index: $(JDK_INDEX_TARGETS)
|
||||
|
||||
docs-zip: $(ZIP_TARGETS)
|
||||
|
||||
docs-specs-zip: $(SPECS_ZIP_TARGETS)
|
||||
|
||||
all: docs-jdk-api-javadoc docs-jdk-api-graphs docs-javase-api-javadoc \
|
||||
docs-javase-api-graphs docs-reference-api-javadoc \
|
||||
docs-reference-api-graphs docs-jdk-specs docs-jdk-index docs-zip \
|
||||
docs-specs-zip
|
||||
|
||||
.PHONY: docs-jdk-api-javadoc docs-jdk-api-graphs \
|
||||
docs-javase-api-javadoc docs-javase-api-graphs \
|
||||
docs-reference-api-javadoc docs-reference-api-graphs docs-jdk-specs \
|
||||
docs-jdk-index docs-zip docs-specs-zip
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
145
make/Doctor.gmk
Normal file
145
make/Doctor.gmk
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
#
|
||||
# Copyright (c) 2022, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# Help user diagnose possible errors and problems with the build environment.
|
||||
################################################################################
|
||||
|
||||
prologue:
|
||||
$(ECHO)
|
||||
$(ECHO) '"make doctor" will help you analyze your build environment. It can highlight'
|
||||
$(ECHO) 'certain well-known problems, but it can never find all possible errors.'
|
||||
|
||||
TARGETS += prologue
|
||||
|
||||
check-git: prologue
|
||||
$(ECHO)
|
||||
$(ECHO) '* Verifying that configure has picked up git...'
|
||||
ifeq ($(GIT), )
|
||||
$(ECHO) 'WARNING: "git" is not present. This will disable several checks.'
|
||||
$(ECHO) '! Correct by installing git and verifying that it is in the PATH'
|
||||
endif
|
||||
|
||||
TARGETS += check-git
|
||||
|
||||
ifneq ($(GIT), )
|
||||
AUTOCRLF := $(shell $(GIT) config core.autocrlf)
|
||||
endif
|
||||
|
||||
check-autocrlf: check-git
|
||||
ifneq ($(GIT), )
|
||||
ifeq ($(call isBuildOs, windows), true)
|
||||
$(ECHO)
|
||||
$(ECHO) '* Verifying git core.autocrlf value...'
|
||||
ifneq ($(AUTOCRLF), false)
|
||||
$(ECHO) 'WARNING: core.autocrlf is not "false". HIGH RISK of build failure!'
|
||||
$(ECHO) '! Correct by running 'git config --global core.autocrlf false' and re-cloning the repo'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
TARGETS += check-autocrlf
|
||||
|
||||
check-configure-warnings: check-autocrlf
|
||||
$(ECHO)
|
||||
$(ECHO) '* Checking for warnings from configure...'
|
||||
warning_output=`$(GREP) -e "^\* Memory limit:" -A 300 $(OUTPUTDIR)/configure.log | $(TAIL) -n +3 | $(SED) -e '$(DOLLAR){/^$(DOLLAR)/d;}'` && \
|
||||
if test -n "$$warning_output" ; then \
|
||||
$(ECHO) ' ---' ; \
|
||||
$(GREP) -e "^\* Memory limit:" -A 300 $(OUTPUTDIR)/configure.log | $(TAIL) -n +3 | $(SED) -e '$(DOLLAR){/^$(DOLLAR)/d;}' ; \
|
||||
$(ECHO) ' ---' ; \
|
||||
$(ECHO) '! Inspect the warnings, fix any problems, and re-run configure' ; \
|
||||
fi
|
||||
|
||||
TARGETS += check-configure-warnings
|
||||
|
||||
ifneq ($(GIT), )
|
||||
# This might have been set by custom component
|
||||
UNTRACKED_FILES ?= $(shell $(GIT) status --porcelain --ignored | $(CUT) -c 4-)
|
||||
endif
|
||||
|
||||
check-core-files: check-configure-warnings
|
||||
ifneq ($(GIT), )
|
||||
$(ECHO)
|
||||
$(ECHO) '* Checking for left-over core files...'
|
||||
core_files_found=`echo "$(UNTRACKED_FILES)" | $(TR) ' ' '\n' | $(GREP) core` && \
|
||||
if test -n "$$core_files_found" ; then \
|
||||
$(ECHO) 'Found these potential core files. They might interfere with the build process:' ; \
|
||||
$(ECHO) ' ---' ; \
|
||||
$(ECHO) $$core_files_found | $(TR) ' ' '\n'; \
|
||||
$(ECHO) ' ---' ; \
|
||||
$(ECHO) '! Remove left-over core files' ; \
|
||||
fi || : # do nothing if grep returns non-0 value
|
||||
endif
|
||||
|
||||
TARGETS += check-core-files
|
||||
|
||||
check-bad-file-names: check-core-files
|
||||
ifneq ($(GIT), )
|
||||
$(ECHO)
|
||||
$(ECHO) '* Checking for untracked files with illegal names...'
|
||||
core_files_found=`echo "$(UNTRACKED_FILES)" | $(TR) ' ' '\n' | $(GREP) '#'` && \
|
||||
if test -n "$$core_files_found" ; then \
|
||||
$(ECHO) 'Found these files with illegal names. They *will* cause build failures:' ; \
|
||||
$(ECHO) ' ---' ; \
|
||||
$(ECHO) $$core_files_found | $(TR) ' ' '\n'; \
|
||||
$(ECHO) ' ---' ; \
|
||||
$(ECHO) '! Remove all files with '#' in their name from the JDK source tree' ; \
|
||||
fi || : # do nothing if grep returns non-0 value
|
||||
endif
|
||||
|
||||
TARGETS += check-bad-file-names
|
||||
|
||||
epilogue: check-bad-file-names
|
||||
$(ECHO)
|
||||
$(ECHO) '* If all else fails, try removing the entire build directory and re-creating'
|
||||
$(ECHO) 'the same configuration using:'
|
||||
$(ECHO) ' ---' ; \
|
||||
$(ECHO) configure_command_line=\$$\(make print-configuration\)
|
||||
$(ECHO) make dist-clean
|
||||
$(ECHO) bash configure \$$configure_command_line
|
||||
$(ECHO) ' ---' ; \
|
||||
$(ECHO)
|
||||
$(ECHO) '* The build README (doc/building.md) is a great source of information,'
|
||||
$(ECHO) 'especially the chapter "Fixing Unexpected Build Failures". Check it out!'
|
||||
$(ECHO)
|
||||
$(ECHO) '* If you still need assistance please contact build-dev@openjdk.org.'
|
||||
$(ECHO)
|
||||
|
||||
TARGETS += epilogue
|
||||
|
||||
################################################################################
|
||||
|
||||
doctor: $(TARGETS)
|
||||
|
||||
all: doctor
|
||||
|
||||
.PHONY: doctor $(TARGETS)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
48
make/ExplodedImageOptimize.gmk
Normal file
48
make/ExplodedImageOptimize.gmk
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#
|
||||
# Copyright (c) 2016, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# Runs a tool on the exploded image to improve performance
|
||||
################################################################################
|
||||
|
||||
include Execute.gmk
|
||||
include $(TOPDIR)/make/ModuleTools.gmk
|
||||
|
||||
ALL_MODULEINFO_CLASSES := $(wildcard $(JDK_OUTPUTDIR)/modules/*/module-info.class)
|
||||
|
||||
$(eval $(call SetupExecute, optimize_image, \
|
||||
WARN := Optimizing the exploded image, \
|
||||
DEPS := $(ALL_MODULEINFO_CLASSES) $(BUILD_JIGSAW_CLASSES), \
|
||||
OUTPUT_DIR := $(JDK_OUTPUTDIR), \
|
||||
COMMAND := $(TOOL_ADD_PACKAGES_ATTRIBUTE) $(JDK_OUTPUTDIR), \
|
||||
))
|
||||
|
||||
TARGETS := $(optimize_image_TARGET)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
38
make/GenerateFindTests.gmk
Normal file
38
make/GenerateFindTests.gmk
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#
|
||||
# Copyright (c) 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This makefile is a thin wrapper around FindTests.gmk, just to make FindTest
|
||||
# fill the cache.
|
||||
################################################################################
|
||||
|
||||
GENERATE_FIND_TESTS_FILE := true
|
||||
include FindTests.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
160
make/GenerateLinkOptData.gmk
Normal file
160
make/GenerateLinkOptData.gmk
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
#
|
||||
# Copyright (c) 2016, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# Generate classlist
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include JavaCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# Create a jar with our generator class. Using a jar is intentional since it
|
||||
# will load more classes
|
||||
|
||||
$(eval $(call SetupJavaCompilation, CLASSLIST_JAR, \
|
||||
SMALL_JAVA := false, \
|
||||
SRC := $(TOPDIR)/make/jdk/src/classes, \
|
||||
INCLUDES := build/tools/classlist, \
|
||||
DISABLED_WARNINGS := dangling-doc-comments, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/classlist_classes, \
|
||||
JAR := $(SUPPORT_OUTPUTDIR)/classlist.jar, \
|
||||
))
|
||||
|
||||
TARGETS += $(CLASSLIST_JAR)
|
||||
|
||||
################################################################################
|
||||
|
||||
LINK_OPT_DIR := $(SUPPORT_OUTPUTDIR)/link_opt
|
||||
CLASSLIST_FILE := $(LINK_OPT_DIR)/classlist
|
||||
JLI_TRACE_FILE := $(LINK_OPT_DIR)/default_jli_trace.txt
|
||||
|
||||
# If an external buildjdk has been supplied, we don't build a separate interim
|
||||
# image, so just use the external build jdk instead.
|
||||
ifeq ($(EXTERNAL_BUILDJDK), true)
|
||||
INTERIM_IMAGE_DIR := $(BUILD_JDK)
|
||||
endif
|
||||
|
||||
# To make the classlist deterministic:
|
||||
# - The classlist can be influenced by locale. Always set it to en/US.
|
||||
# - Concurrency in the core libraries can cause constant pool resolution
|
||||
# to be non-deterministic. Since the benefits of resolved CP references in the
|
||||
# default classlist is minimal, let's filter out the '@cp' lines until we can
|
||||
# find a proper solution.
|
||||
CLASSLIST_FILE_VM_OPTS = \
|
||||
-Duser.language=en -Duser.country=US
|
||||
|
||||
# Save the stderr output of the command and print it along with stdout in case
|
||||
# something goes wrong.
|
||||
# The classlists must be generated with -Xint to avoid non-determinism
|
||||
# introduced by JIT compiled code
|
||||
$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST_JAR)
|
||||
$(call MakeDir, $(LINK_OPT_DIR))
|
||||
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
|
||||
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE)))
|
||||
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.raw \
|
||||
$(CLASSLIST_FILE_VM_OPTS) \
|
||||
-Xint \
|
||||
-Xlog:aot=off \
|
||||
-Xlog:cds=off \
|
||||
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
||||
build.tools.classlist.HelloClasslist $(LOG_DEBUG)
|
||||
$(GREP) -v HelloClasslist $@.raw > $@.interim
|
||||
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -Xshare:dump \
|
||||
-Xlog:aot=off \
|
||||
-Xlog:cds=off \
|
||||
-XX:SharedClassListFile=$@.interim -XX:SharedArchiveFile=$@.jsa \
|
||||
-Xmx128M -Xms128M $(LOG_INFO)
|
||||
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.raw.2 \
|
||||
-XX:SharedClassListFile=$@.interim -XX:SharedArchiveFile=$@.jsa \
|
||||
-Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \
|
||||
$(CLASSLIST_FILE_VM_OPTS) \
|
||||
-Xint \
|
||||
--module-path $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
||||
-Xlog:aot=off \
|
||||
-Xlog:cds=off \
|
||||
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
||||
build.tools.classlist.HelloClasslist \
|
||||
2> $(LINK_OPT_DIR)/stderr > $(JLI_TRACE_FILE) \
|
||||
|| ( \
|
||||
exitcode=$$? ; \
|
||||
$(ECHO) "ERROR: Failed to generate link optimization data." \
|
||||
"This is likely a problem with the newly built JVM/JDK." ; \
|
||||
$(CAT) $(LINK_OPT_DIR)/stderr $(JLI_TRACE_FILE) ; \
|
||||
exit $$exitcode \
|
||||
)
|
||||
$(GREP) -v HelloClasslist $@.raw.2 > $@.raw.3
|
||||
$(GREP) -v @cp $@.raw.3 > $@.raw.4
|
||||
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java \
|
||||
-Xlog:aot=off \
|
||||
-Xlog:cds=off \
|
||||
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
||||
build.tools.classlist.SortClasslist $@.raw.4 > $@
|
||||
|
||||
# The jli trace is created by the same recipe as classlist. By declaring these
|
||||
# dependencies, make will correctly rebuild both jli trace and classlist
|
||||
# incrementally using the single recipe above.
|
||||
$(CLASSLIST_FILE): $(JLI_TRACE_FILE)
|
||||
$(JLI_TRACE_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST_JAR)
|
||||
|
||||
TARGETS += $(CLASSLIST_FILE) $(JLI_TRACE_FILE)
|
||||
|
||||
# Copy the classlist file into java.base libs
|
||||
$(eval $(call SetupCopyFiles, COPY_CLASSLIST, \
|
||||
FILES := $(CLASSLIST_FILE), \
|
||||
DEST := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
|
||||
))
|
||||
|
||||
TARGETS += $(COPY_CLASSLIST)
|
||||
|
||||
# In case of shipping public debug symbols on windows, there is another temporary
|
||||
# location from where jmods are compiled - need to deploy classlist there, too.
|
||||
ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+public)
|
||||
$(eval $(call SetupCopyFiles, COPY_CLASSLIST_TO_FILTERED, \
|
||||
FILES := $(CLASSLIST_FILE), \
|
||||
DEST := $(SUPPORT_OUTPUTDIR)/modules_libs_filtered/java.base, \
|
||||
))
|
||||
|
||||
TARGETS += $(COPY_CLASSLIST_TO_FILTERED)
|
||||
endif
|
||||
|
||||
# Copy the default_jli_trace.txt file into jdk.jlink
|
||||
$(eval $(call SetupCopyFiles, COPY_JLI_TRACE, \
|
||||
FILES := $(JLI_TRACE_FILE), \
|
||||
DEST := $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jlink/internal/plugins, \
|
||||
))
|
||||
|
||||
# Because of the single recipe for jli trace and classlist above, the
|
||||
# COPY_JLI_TRACE rule needs to explicitly add the classlist file as a
|
||||
# prerequisite.
|
||||
$(COPY_JLI_TRACE): $(CLASSLIST_FILE)
|
||||
|
||||
TARGETS += $(COPY_JLI_TRACE)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
55
make/GenerateModuleSummary.gmk
Normal file
55
make/GenerateModuleSummary.gmk
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#
|
||||
# Copyright (c) 2014, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include $(TOPDIR)/make/ModuleTools.gmk
|
||||
|
||||
GENGRAPHS_DIR := $(IMAGES_OUTPUTDIR)/gengraphs
|
||||
SPEC_DOTFILES_DIR := $(GENGRAPHS_DIR)/spec-dotfiles
|
||||
TOOLS_MODULE_SRCDIR := $(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw
|
||||
|
||||
$(GENGRAPHS_DIR)/jdk.dot: $(BUILD_JIGSAW_TOOLS)
|
||||
$(call MakeTargetDir)
|
||||
$(TOOL_GENGRAPHS) --output $(GENGRAPHS_DIR)
|
||||
|
||||
$(SPEC_DOTFILES_DIR)/java.se.dot: $(BUILD_JIGSAW_TOOLS)
|
||||
$(call MakeTargetDir)
|
||||
$(TOOL_GENGRAPHS) --spec --output $(SPEC_DOTFILES_DIR)
|
||||
|
||||
$(GENGRAPHS_DIR)/technology-summary.html: $(TOOLS_MODULE_SRCDIR)/technology-summary.html
|
||||
$(install-file)
|
||||
|
||||
$(GENGRAPHS_DIR)/module-summary.html: $(BUILD_JIGSAW_TOOLS) $(GENGRAPHS_DIR)/technology-summary.html
|
||||
$(call MakeTargetDir)
|
||||
$(TOOL_MODULESUMMARY) -o $@ --module-path $(IMAGES_OUTPUTDIR)/jmods
|
||||
|
||||
all: $(GENGRAPHS_DIR)/jdk.dot $(GENGRAPHS_DIR)/module-summary.html $(SPEC_DOTFILES_DIR)/java.se.dot
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
138
make/Global.gmk
Normal file
138
make/Global.gmk
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
#
|
||||
# Copyright (c) 2012, 2025, 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.
|
||||
#
|
||||
|
||||
###
|
||||
### Global targets for printing help etc.
|
||||
###
|
||||
|
||||
# Helper macro to allow $(info) to properly print strings beginning with spaces.
|
||||
_ :=
|
||||
|
||||
help:
|
||||
$(info )
|
||||
$(info OpenJDK Makefile help)
|
||||
$(info =====================)
|
||||
$(info )
|
||||
$(info Common make targets)
|
||||
$(info $(_) make [default] # Compile all modules and create a runnable "exploded")
|
||||
$(info $(_) # image (alias for jdk or exploded-image))
|
||||
$(info $(_) make all # Create all images: product, test, docs)
|
||||
$(info $(_) # (alias for all-images))
|
||||
$(info $(_) make images # Create a complete jdk image)
|
||||
$(info $(_) # (alias for product-images))
|
||||
$(info $(_) make <name>-image # Build just the image for any of: )
|
||||
$(info $(_) # jdk, test, docs, symbols, legacy-jre, static-libs)
|
||||
$(info $(_) make <phase> # Build the specified phase and everything it depends on)
|
||||
$(info $(_) # (gensrc, java, copy, libs, launchers, gendata))
|
||||
$(info $(_) make *-only # Applies to most targets and disables building the)
|
||||
$(info $(_) # dependencies for that target. This is faster but may)
|
||||
$(info $(_) # result in incorrect build results!)
|
||||
$(info $(_) make docs # Create all docs)
|
||||
$(info $(_) make docs-jdk-api # Create just JDK javadocs)
|
||||
$(info $(_) make bootcycle-images # Build images twice, second time with newly built JDK)
|
||||
$(info $(_) make check # Run basic testing (currently tier1))
|
||||
$(info $(_) make test-<test> # Run test, e.g. test-tier1)
|
||||
$(info $(_) make test TEST=<t> # Run test(s) given by TEST specification)
|
||||
$(info $(_) make exploded-test TEST=<t> # Run test(s) on the exploded image instead of)
|
||||
$(info $(_) # the full jdk image)
|
||||
$(info )
|
||||
$(info Targets for troubleshooting)
|
||||
$(info $(_) make help # Give some help on using make)
|
||||
$(info $(_) make doctor # Diagnose build environment problems)
|
||||
$(info $(_) make reconfigure # Rerun configure with the same arguments as last time)
|
||||
$(info )
|
||||
$(info Targets for cleaning)
|
||||
$(info $(_) make clean # Remove all files generated by make, but not those)
|
||||
$(info $(_) # generated by configure)
|
||||
$(info $(_) make dist-clean # Remove all files, including configuration)
|
||||
$(info $(_) make clean-<outputdir> # Remove the subdir in the output dir with the name)
|
||||
$(info $(_) make clean-<phase> # Remove all build results related to a certain build)
|
||||
$(info $(_) # phase (gensrc, java, libs, launchers))
|
||||
$(info $(_) make clean-<module> # Remove all build results related to a certain module)
|
||||
$(info $(_) make clean-<module>-<phase> # Remove all build results related to a certain)
|
||||
$(info $(_) # module and phase)
|
||||
$(info )
|
||||
$(info Targets for Hotspot)
|
||||
$(info $(_) make hotspot # Build all of hotspot)
|
||||
$(info $(_) make hotspot-<variant> # Build just the specified jvm variant)
|
||||
$(info $(_) make hotspot-gensrc # Only build the gensrc part of hotspot)
|
||||
$(info $(_) make hotspot-<variant>-<phase> # Build the specified phase for the variant)
|
||||
$(info )
|
||||
$(info Targets for specific modules)
|
||||
$(info $(_) make <module> # Build <module> and everything it depends on)
|
||||
$(info $(_) make <module>-<phase> # Compile the specified phase for the specified module)
|
||||
$(info $(_) # and everything it depends on)
|
||||
$(info $(_) # (gensrc, java, copy, libs, launchers, gendata))
|
||||
$(info )
|
||||
$(info Make control variables)
|
||||
$(info $(_) CONF=<selector> # Select which configuration(s) to build)
|
||||
$(info $(_) CONF= # Select all configurations (note, assignment is empty))
|
||||
$(info $(_) CONF_NAME=<string> # Select the configuration with the name <string>)
|
||||
$(info $(_) SPEC=<spec file> # Build the configuration given by the spec file)
|
||||
$(info $(_) LOG=<loglevel> # Change the log level from warn to <loglevel>)
|
||||
$(info $(_) # Available log levels are:)
|
||||
$(info $(_) # 'warn' (default), 'info', 'debug' and 'trace')
|
||||
$(info $(_) # To see executed command lines, use LOG=debug)
|
||||
$(info $(_) JOBS=<n> # Run <n> parallel make jobs)
|
||||
$(info $(_) # Note that -jN does not work as expected!)
|
||||
$(info $(_) TEST_JOBS=<n> # Run <n> parallel test jobs)
|
||||
$(info $(_) CONF_CHECK=<method> # What to do if spec file is out of date)
|
||||
$(info $(_) # method is 'auto', 'ignore' or 'fail' (default))
|
||||
$(info $(_) TEST="test1 ..." # Use the given test descriptor(s) for testing, e.g.)
|
||||
$(info $(_) # make test TEST="jdk_lang gtest:all")
|
||||
$(info $(_) TEST_DEPS="dependency1 ..." # Specify additional dependencies for running tests, e.g docs-jdk)
|
||||
$(info $(_) JTREG="OPT1=x;OPT2=y" # Control the JTREG test harness, use 'make test-only JTREG=help' to list)
|
||||
$(info $(_) GTEST="OPT1=x;OPT2=y" # Control the GTEST test harness, use 'make test-only GTEST=help' to list)
|
||||
$(info $(_) MICRO="OPT1=x;OPT2=y" # Control the MICRO test harness, use 'make test-only MICRO=help' to list)
|
||||
$(info $(_) TEST_OPTS="OPT1=x;..." # Generic control of all test harnesses)
|
||||
$(info $(_) TEST_VM_OPTS="ARG ..." # Same as setting TEST_OPTS to VM_OPTIONS="ARG ...")
|
||||
$(info $(_) ALLOW="FOO,BAR" # Do not warn that FOO and BAR are non-control variables)
|
||||
$(info )
|
||||
$(if $(all_confs), $(info Available configurations in $(build_dir):) $(foreach var,$(all_confs),$(info * $(var))), \
|
||||
$(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration.))
|
||||
# We need a dummy rule otherwise make will complain
|
||||
@true
|
||||
|
||||
print-configurations:
|
||||
$(foreach var, $(all_confs), $(info $(var)))
|
||||
# We need a dummy rule otherwise make will complain
|
||||
@true
|
||||
|
||||
test-prebuilt:
|
||||
@( cd $(TOPDIR) && \
|
||||
$(MAKE) --no-print-directory -r -R -I make/common/ -f make/RunTestsPrebuilt.gmk \
|
||||
test-prebuilt CUSTOM_MAKE_DIR=$(CUSTOM_MAKE_DIR) TEST="$(TEST)" )
|
||||
|
||||
test-prebuilt-with-exit-code:
|
||||
@( cd $(TOPDIR) && \
|
||||
$(MAKE) --no-print-directory -r -R -I make/common/ -f make/RunTestsPrebuilt.gmk \
|
||||
test-prebuilt-with-exit-code CUSTOM_MAKE_DIR=$(CUSTOM_MAKE_DIR) TEST="$(TEST)" )
|
||||
|
||||
# Alias for backwards compatibility
|
||||
run-test-prebuilt: test-prebuilt
|
||||
|
||||
ALL_GLOBAL_TARGETS := help print-configurations test-prebuilt run-test-prebuilt
|
||||
|
||||
.PHONY: $(ALL_GLOBAL_TARGETS)
|
||||
52
make/GraalBuilderImage.gmk
Normal file
52
make/GraalBuilderImage.gmk
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#
|
||||
# Copyright (c) 2020, Red Hat Inc.
|
||||
# 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This makefile creates a jdk image overlaid with statically linked core
|
||||
# libraries.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_JDK_IMG, \
|
||||
SRC := $(JDK_IMAGE_DIR)/, \
|
||||
DEST := $(GRAAL_BUILDER_IMAGE_DIR)/, \
|
||||
FILES := $(call FindFiles, $(JDK_IMAGE_DIR)/), \
|
||||
))
|
||||
TARGETS += $(COPY_JDK_IMG)
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_STATIC_LIBS, \
|
||||
SRC := $(STATIC_LIBS_GRAAL_IMAGE_DIR)/lib, \
|
||||
DEST := $(GRAAL_BUILDER_IMAGE_DIR)/lib, \
|
||||
FILES := $(filter %$(STATIC_LIBRARY_SUFFIX), \
|
||||
$(call FindFiles, $(STATIC_LIBS_GRAAL_IMAGE_DIR)/lib)), \
|
||||
))
|
||||
TARGETS += $(COPY_STATIC_LIBS)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
204
make/Hsdis.gmk
Normal file
204
make/Hsdis.gmk
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
#
|
||||
# Copyright (c) 2020, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This makefile compiles and installs the hsdis library
|
||||
################################################################################
|
||||
|
||||
include JdkNativeCompilation.gmk
|
||||
|
||||
HSDIS_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/hsdis
|
||||
REAL_HSDIS_NAME := hsdis-$(OPENJDK_TARGET_CPU_LEGACY_LIB)$(SHARED_LIBRARY_SUFFIX)
|
||||
BUILT_HSDIS_LIB := $(HSDIS_OUTPUT_DIR)/$(REAL_HSDIS_NAME)
|
||||
|
||||
HSDIS_LINK_TYPE := C
|
||||
|
||||
ifeq ($(HSDIS_BACKEND), capstone)
|
||||
ifeq ($(call isTargetCpuArch, x86), true)
|
||||
CAPSTONE_ARCH := CS_ARCH_X86
|
||||
CAPSTONE_MODE := CS_MODE_$(OPENJDK_TARGET_CPU_BITS)
|
||||
else ifeq ($(call isTargetCpuArch, aarch64), true)
|
||||
CAPSTONE_ARCH := CS_ARCH_$(CAPSTONE_ARCH_AARCH64_NAME)
|
||||
CAPSTONE_MODE := CS_MODE_ARM
|
||||
else
|
||||
$(error No support for Capstone on this platform)
|
||||
endif
|
||||
|
||||
HSDIS_CFLAGS += -DCAPSTONE_ARCH=$(CAPSTONE_ARCH) \
|
||||
-DCAPSTONE_MODE=$(CAPSTONE_MODE)
|
||||
endif
|
||||
|
||||
ifeq ($(HSDIS_BACKEND), llvm)
|
||||
# Use C++ instead of C
|
||||
HSDIS_LINK_TYPE := C++
|
||||
|
||||
ifeq ($(call isTargetOs, linux), true)
|
||||
LLVM_OS := pc-linux-gnu
|
||||
else ifeq ($(call isTargetOs, macosx), true)
|
||||
LLVM_OS := apple-darwin
|
||||
else ifeq ($(call isTargetOs, windows), true)
|
||||
LLVM_OS := pc-windows-msvc
|
||||
else
|
||||
$(error No support for LLVM on this platform)
|
||||
endif
|
||||
|
||||
HSDIS_CFLAGS += -DLLVM_DEFAULT_TRIPLET='"$(OPENJDK_TARGET_CPU)-$(LLVM_OS)"'
|
||||
endif
|
||||
|
||||
ifeq ($(HSDIS_BACKEND), binutils)
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
# On windows, we need to "fake" a completely different toolchain using gcc
|
||||
# instead of the normal microsoft toolchain. This is quite hacky...
|
||||
|
||||
MINGW_BASE := x86_64-w64-mingw32
|
||||
|
||||
MINGW_SYSROOT = $(shell $(MINGW_BASE)-gcc -print-sysroot)
|
||||
ifeq ($(wildcard $(MINGW_SYSROOT)), )
|
||||
# Use fallback path
|
||||
MINGW_SYSROOT := /usr/$(MINGW_BASE)
|
||||
ifeq ($(wildcard $(MINGW_SYSROOT)), )
|
||||
$(error mingw sysroot not found)
|
||||
endif
|
||||
endif
|
||||
|
||||
BUILD_HSDIS_CC := $(MINGW_BASE)-gcc
|
||||
BUILD_HSDIS_LD := $(MINGW_BASE)-ld
|
||||
BUILD_HSDIS_OBJCOPY := $(MINGW_BASE)-objcopy
|
||||
BUILD_HSDIS_SYSROOT_CFLAGS := --sysroot=$(MINGW_SYSROOT)
|
||||
BUILD_HSDIS_SYSROOT_LDFLAGS := --sysroot=$(MINGW_SYSROOT)
|
||||
|
||||
MINGW_SYSROOT_LIB_PATH := $(MINGW_SYSROOT)/mingw/lib
|
||||
ifeq ($(wildcard $(MINGW_SYSROOT_LIB_PATH)), )
|
||||
# Try without mingw
|
||||
MINGW_SYSROOT_LIB_PATH := $(MINGW_SYSROOT)/lib
|
||||
ifeq ($(wildcard $(MINGW_SYSROOT_LIB_PATH)), )
|
||||
$(error mingw sysroot lib path not found)
|
||||
endif
|
||||
endif
|
||||
|
||||
MINGW_VERSION = $(shell $(MINGW_BASE)-gcc -v 2>&1 | $(GREP) "gcc version" | $(CUT) -d " " -f 3)
|
||||
MINGW_GCC_LIB_PATH := /usr/lib/gcc/$(MINGW_BASE)/$(MINGW_VERSION)
|
||||
ifeq ($(wildcard $(MINGW_GCC_LIB_PATH)), )
|
||||
# Try using only major version number
|
||||
MINGW_VERSION_MAJOR := $(firstword $(subst ., , $(MINGW_VERSION)))
|
||||
MINGW_GCC_LIB_PATH := /usr/lib/gcc/$(MINGW_BASE)/$(MINGW_VERSION_MAJOR)
|
||||
ifeq ($(wildcard $(MINGW_GCC_LIB_PATH)), )
|
||||
$(error mingw gcc lib path not found)
|
||||
endif
|
||||
endif
|
||||
|
||||
TOOLCHAIN_TYPE := gcc
|
||||
OPENJDK_TARGET_OS := linux
|
||||
OPENJDK_TARGET_OS_TYPE := unix
|
||||
GENDEPS_FLAGS := -MMD -MF
|
||||
CFLAGS_DEBUG_SYMBOLS := -g
|
||||
DISABLED_WARNINGS :=
|
||||
DISABLE_WARNING_PREFIX := -Wno-
|
||||
CFLAGS_WARNINGS_ARE_ERRORS := -Werror
|
||||
SHARED_LIBRARY_FLAGS := -shared
|
||||
|
||||
HSDIS_TOOLCHAIN_DEFAULT_CFLAGS := false
|
||||
HSDIS_TOOLCHAIN_DEFAULT_LDFLAGS := false
|
||||
HSDIS_LDFLAGS += -L$(MINGW_GCC_LIB_PATH) -L$(MINGW_SYSROOT_LIB_PATH)
|
||||
MINGW_DLLCRT := $(MINGW_SYSROOT_LIB_PATH)/dllcrt2.o
|
||||
HSDIS_TOOLCHAIN_LIBS := $(MINGW_DLLCRT) -lmingw32 -lgcc -lgcc_eh -lmoldname \
|
||||
-lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32
|
||||
else
|
||||
HSDIS_TOOLCHAIN_LIBS := -ldl
|
||||
endif
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
## Build libhsdis
|
||||
################################################################################
|
||||
|
||||
$(eval $(call SetupJdkLibrary, BUILD_HSDIS, \
|
||||
NAME := hsdis, \
|
||||
LINK_TYPE := $(HSDIS_LINK_TYPE), \
|
||||
SRC := $(TOPDIR)/src/utils/hsdis/$(HSDIS_BACKEND), \
|
||||
EXTRA_HEADER_DIRS := \
|
||||
java.base:include \
|
||||
$(TOPDIR)/src/utils/hsdis, \
|
||||
OUTPUT_DIR := $(HSDIS_OUTPUT_DIR), \
|
||||
OBJECT_DIR := $(HSDIS_OUTPUT_DIR), \
|
||||
DISABLED_WARNINGS_gcc := undef format-nonliteral sign-compare, \
|
||||
DISABLED_WARNINGS_clang := undef format-nonliteral, \
|
||||
DEFAULT_CFLAGS := $(HSDIS_TOOLCHAIN_DEFAULT_CFLAGS), \
|
||||
CFLAGS := $(HSDIS_CFLAGS), \
|
||||
CXXFLAGS := $(HSDIS_CFLAGS), \
|
||||
LD_SET_ORIGIN := false, \
|
||||
DEFAULT_LDFLAGS := $(HSDIS_TOOLCHAIN_DEFAULT_LDFLAGS), \
|
||||
LDFLAGS := $(HSDIS_LDFLAGS) $(SHARED_LIBRARY_FLAGS), \
|
||||
LIBS := $(HSDIS_LIBS) $(HSDIS_TOOLCHAIN_LIBS), \
|
||||
))
|
||||
|
||||
$(BUILT_HSDIS_LIB): $(BUILD_HSDIS_TARGET)
|
||||
$(install-file)
|
||||
|
||||
build: $(BUILD_HSDIS) $(BUILT_HSDIS_LIB)
|
||||
|
||||
TARGETS += build
|
||||
|
||||
ifeq ($(ENABLE_HSDIS_BUNDLING), false)
|
||||
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
JDK_HSDIS_DIR := $(JDK_OUTPUTDIR)/bin
|
||||
IMAGE_HSDIS_DIR := $(JDK_IMAGE_DIR)/bin
|
||||
else
|
||||
JDK_HSDIS_DIR := $(JDK_OUTPUTDIR)/lib
|
||||
IMAGE_HSDIS_DIR := $(JDK_IMAGE_DIR)/lib
|
||||
endif
|
||||
|
||||
|
||||
INSTALLED_HSDIS_JDK := $(JDK_HSDIS_DIR)/$(REAL_HSDIS_NAME)
|
||||
INSTALLED_HSDIS_IMAGE := $(IMAGE_HSDIS_DIR)/$(REAL_HSDIS_NAME)
|
||||
|
||||
$(INSTALLED_HSDIS_JDK): $(BUILT_HSDIS_LIB)
|
||||
ifeq ($(HSDIS_BACKEND), binutils)
|
||||
$(call LogWarn, NOTE: The resulting build might not be redistributable. Seek legal advice before distributing.)
|
||||
endif
|
||||
$(install-file)
|
||||
|
||||
$(INSTALLED_HSDIS_IMAGE): $(BUILT_HSDIS_LIB)
|
||||
$(install-file)
|
||||
|
||||
install: $(INSTALLED_HSDIS_JDK) $(INSTALLED_HSDIS_IMAGE)
|
||||
|
||||
else
|
||||
|
||||
install:
|
||||
$(ECHO) NOTE: make install-hsdis is a no-op with --enable-hsdis-bundling
|
||||
|
||||
endif
|
||||
|
||||
TARGETS += install
|
||||
|
||||
.PHONY: build install
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
329
make/Images.gmk
Normal file
329
make/Images.gmk
Normal file
|
|
@ -0,0 +1,329 @@
|
|||
#
|
||||
# Copyright (c) 2014, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include DebugInfoUtils.gmk
|
||||
include Execute.gmk
|
||||
include Modules.gmk
|
||||
include Utils.gmk
|
||||
|
||||
JDK_TARGETS :=
|
||||
JRE_TARGETS :=
|
||||
|
||||
################################################################################
|
||||
|
||||
# All modules for the current target platform.
|
||||
ALL_MODULES := $(call FindAllModules) $(EXTRA_MODULES)
|
||||
|
||||
$(eval $(call ReadImportMetaData))
|
||||
|
||||
JRE_MODULES += $(filter $(ALL_MODULES), $(BOOT_MODULES) \
|
||||
$(PLATFORM_MODULES) jdk.jdwp.agent)
|
||||
JDK_MODULES += $(ALL_MODULES)
|
||||
|
||||
JRE_MODULES_LIST := $(call CommaList, $(JRE_MODULES))
|
||||
JDK_MODULES_LIST := $(call CommaList, $(JDK_MODULES))
|
||||
|
||||
################################################################################
|
||||
|
||||
BASE_RELEASE_FILE := $(JDK_OUTPUTDIR)/release
|
||||
|
||||
JMODS_DIRS := $(EXTRA_JMODS_DIR) $(IMAGES_OUTPUTDIR)/jmods
|
||||
|
||||
JDK_JMODS := $(foreach m, $(JDK_MODULES), $(firstword $(wildcard $(addsuffix /$m.jmod, $(JMODS_DIRS)))))
|
||||
JRE_JMODS := $(foreach m, $(JRE_MODULES), $(firstword $(wildcard $(addsuffix /$m.jmod, $(JMODS_DIRS)))))
|
||||
|
||||
JLINK_ORDER_RESOURCES := **module-info.class
|
||||
JLINK_JLI_CLASSES :=
|
||||
ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
|
||||
JLINK_ORDER_RESOURCES += @$(SUPPORT_OUTPUTDIR)/link_opt/classlist
|
||||
JLINK_JLI_CLASSES := --generate-jli-classes=@$(SUPPORT_OUTPUTDIR)/link_opt/default_jli_trace.txt
|
||||
endif
|
||||
JLINK_ORDER_RESOURCES += \
|
||||
/java.base/java/** \
|
||||
/java.base/jdk/** \
|
||||
/java.base/sun/** \
|
||||
/java.base/com/** \
|
||||
/jdk.localedata/** \
|
||||
#
|
||||
|
||||
JLINK_TOOL := $(JLINK) -J-Djlink.debug=true \
|
||||
--module-path $(call PathList, $(JMODS_DIRS)) \
|
||||
--endian $(OPENJDK_TARGET_CPU_ENDIAN) \
|
||||
--release-info $(BASE_RELEASE_FILE) \
|
||||
--order-resources=$(call CommaList, $(JLINK_ORDER_RESOURCES)) \
|
||||
--dedup-legal-notices=error-if-not-same-content \
|
||||
$(JLINK_JLI_CLASSES) \
|
||||
#
|
||||
|
||||
JLINK_JRE_EXTRA_OPTS := --no-man-pages --no-header-files --strip-debug
|
||||
|
||||
ifeq ($(JLINK_KEEP_PACKAGED_MODULES), true)
|
||||
JLINK_JDK_EXTRA_OPTS := --keep-packaged-modules $(JDK_IMAGE_DIR)/jmods
|
||||
endif
|
||||
|
||||
JLINK_DISABLE_WARNINGS := | ( $(GREP) -v -e "WARNING: Using incubator module" || test "$$?" = "1" )
|
||||
|
||||
JDK_IMAGE_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk
|
||||
JRE_IMAGE_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre
|
||||
|
||||
ifeq ($(JLINK_PRODUCE_LINKABLE_RUNTIME), true)
|
||||
JLINK_JDK_EXTRA_OPTS += --generate-linkable-runtime
|
||||
endif
|
||||
|
||||
ifneq ($(JLINK_USER_EXTRA_FLAGS), )
|
||||
JLINK_JDK_EXTRA_OPTS += $(JLINK_USER_EXTRA_FLAGS)
|
||||
endif
|
||||
|
||||
$(eval $(call SetupExecute, jlink_jdk, \
|
||||
WARN := Creating jdk image, \
|
||||
DEPS := $(JDK_JMODS) $(BASE_RELEASE_FILE) \
|
||||
$(call DependOnVariable, JDK_MODULES_LIST, $(JDK_IMAGE_SUPPORT_DIR)/_jlink_jdk.vardeps), \
|
||||
OUTPUT_DIR := $(JDK_IMAGE_DIR), \
|
||||
SUPPORT_DIR := $(JDK_IMAGE_SUPPORT_DIR), \
|
||||
PRE_COMMAND := $(RM) -r $(JDK_IMAGE_DIR), \
|
||||
COMMAND := $(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
|
||||
$(JLINK_JDK_EXTRA_OPTS) --output $(JDK_IMAGE_DIR) \
|
||||
$(JLINK_DISABLE_WARNINGS), \
|
||||
))
|
||||
|
||||
JLINK_JDK_TARGETS := $(jlink_jdk)
|
||||
|
||||
$(eval $(call SetupExecute, jlink_jre, \
|
||||
WARN := Creating legacy jre image, \
|
||||
DEPS := $(JRE_JMODS) $(BASE_RELEASE_FILE) \
|
||||
$(call DependOnVariable, JRE_MODULES_LIST, $(JRE_IMAGE_SUPPORT_DIR)/_jlink_jre.vardeps), \
|
||||
OUTPUT_DIR := $(JRE_IMAGE_DIR), \
|
||||
SUPPORT_DIR := $(JRE_IMAGE_SUPPORT_DIR), \
|
||||
PRE_COMMAND := $(RM) -r $(JRE_IMAGE_DIR), \
|
||||
COMMAND := $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
|
||||
$(JLINK_JRE_EXTRA_OPTS) --output $(JRE_IMAGE_DIR), \
|
||||
))
|
||||
|
||||
JLINK_JRE_TARGETS := $(jlink_jre)
|
||||
|
||||
# Optimize CDS shared heap for small heap sizes, which are typically used
|
||||
# for small cloud-based apps that have the most critical start-up requirement.
|
||||
# The trade-off is that when larger heap sizes are used, the shared heap
|
||||
# may need to be relocated at runtime.
|
||||
CDS_DUMP_FLAGS = -Xmx128M -Xms128M
|
||||
|
||||
# Helper function for creating the CDS archives for the JDK and JRE
|
||||
#
|
||||
# Param1 - VM variant (e.g., server, client, zero, ...)
|
||||
# Param2 - _nocoops, _coh, _nocoops_coh, or empty
|
||||
define CreateCDSArchive
|
||||
$1_$2_COOPS_OPTION := $(if $(findstring _nocoops, $2),-XX:-UseCompressedOops)
|
||||
# enable and also explicitly disable coh as needed.
|
||||
ifeq ($(call isTargetCpuBits, 64), true)
|
||||
$1_$2_COH_OPTION := -XX:+UnlockExperimentalVMOptions \
|
||||
$(if $(findstring _coh, $2),-XX:+UseCompactObjectHeaders,-XX:-UseCompactObjectHeaders)
|
||||
endif
|
||||
$1_$2_DUMP_EXTRA_ARG := $$($1_$2_COOPS_OPTION) $$($1_$2_COH_OPTION)
|
||||
$1_$2_DUMP_TYPE := $(if $(findstring _nocoops, $2),-NOCOOPS,)$(if $(findstring _coh, $2),-COH,)
|
||||
|
||||
$1_$2_CDS_DUMP_FLAGS := $(CDS_DUMP_FLAGS) $(if $(filter g1gc, $(JVM_FEATURES_$1)), -XX:+UseG1GC)
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
$1_$2_CDS_ARCHIVE := bin/$1/classes$2.jsa
|
||||
else
|
||||
$1_$2_CDS_ARCHIVE := lib/$1/classes$2.jsa
|
||||
endif
|
||||
|
||||
ifneq ($(COMPARE_BUILD), )
|
||||
DEBUG_CDS_ARCHIVE := true
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG_CDS_ARCHIVE), true)
|
||||
$1_$2_CDS_DUMP_FLAGS += -Xlog:aot+map*=trace:file=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE).cdsmap:none:filesize=0
|
||||
endif
|
||||
|
||||
$$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jdk, \
|
||||
WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jdk image for $1, \
|
||||
INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
|
||||
DEPS := $$(jlink_jdk), \
|
||||
OUTPUT_FILE := $$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
|
||||
SUPPORT_DIR := $$(JDK_IMAGE_SUPPORT_DIR), \
|
||||
COMMAND := $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
|
||||
-XX:SharedArchiveFile=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
|
||||
-$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
|
||||
))
|
||||
|
||||
JDK_TARGETS += $$($1_$2_gen_cds_archive_jdk)
|
||||
|
||||
$$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jre, \
|
||||
WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jre image for $1, \
|
||||
INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
|
||||
DEPS := $$(jlink_jre), \
|
||||
OUTPUT_FILE := $$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
|
||||
SUPPORT_DIR := $$(JRE_IMAGE_SUPPORT_DIR), \
|
||||
COMMAND := $$(FIXPATH) $$(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
|
||||
-XX:SharedArchiveFile=$$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
|
||||
-$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
|
||||
))
|
||||
|
||||
JRE_TARGETS += $$($1_$2_gen_cds_archive_jre)
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_CDS_ARCHIVE), true)
|
||||
$(foreach v, $(JVM_VARIANTS), \
|
||||
$(eval $(call CreateCDSArchive,$v,)) \
|
||||
)
|
||||
|
||||
ifeq ($(call isTargetCpuBits, 64), true)
|
||||
$(foreach v, $(JVM_VARIANTS), \
|
||||
$(eval $(call CreateCDSArchive,$v,_nocoops)) \
|
||||
)
|
||||
ifeq ($(BUILD_CDS_ARCHIVE_COH), true)
|
||||
$(foreach v, $(JVM_VARIANTS), \
|
||||
$(eval $(call CreateCDSArchive,$v,_coh)) \
|
||||
)
|
||||
$(foreach v, $(JVM_VARIANTS), \
|
||||
$(eval $(call CreateCDSArchive,$v,_nocoops_coh)) \
|
||||
)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# src.zip
|
||||
|
||||
$(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
|
||||
$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
|
||||
$(install-file)
|
||||
|
||||
JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
|
||||
|
||||
################################################################################
|
||||
# /demo dir
|
||||
# Avoid doing the expensive find unless called with "jdk" as target.
|
||||
ifneq ($(filter jdk, $(MAKECMDGOALS)), )
|
||||
|
||||
DEMO_FILES := \
|
||||
$(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
|
||||
$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
|
||||
-type f -a ! \( -name "_the*" -o -name "javac_state" \) ) \
|
||||
)
|
||||
|
||||
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
|
||||
ifeq ($(call isTargetOs, macosx), true)
|
||||
DEMO_FILES := $(call not-containing, .dSYM, $(DEMO_FILES))
|
||||
else
|
||||
DEMO_FILES := $(filter-out %.debuginfo %.pdb %.map, $(DEMO_FILES))
|
||||
endif
|
||||
endif
|
||||
|
||||
$(eval $(call SetupCopyFiles, JDK_COPY_DEMOS, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
|
||||
DEST := $(JDK_IMAGE_DIR)/demo, \
|
||||
FILES := $(DEMO_FILES), \
|
||||
))
|
||||
|
||||
JDK_TARGETS += $(JDK_COPY_DEMOS)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Code coverage data files
|
||||
|
||||
ifeq ($(GCOV_ENABLED), true)
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_GCOV_GCNO, \
|
||||
SRC := $(OUTPUTDIR), \
|
||||
DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
|
||||
FILES := $(call FindFiles, $(HOTSPOT_OUTPUTDIR) \
|
||||
$(SUPPORT_OUTPUTDIR)/native, *.gcno) \
|
||||
))
|
||||
|
||||
SYMBOLS_TARGETS += $(COPY_GCOV_GCNO)
|
||||
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Debug symbols
|
||||
# Since debug symbols are not included in the jmod files, they need to be copied
|
||||
# in manually after generating the images.
|
||||
|
||||
# These variables are read by SetupCopyDebuginfo
|
||||
ALL_JDK_MODULES := $(JDK_MODULES)
|
||||
ALL_JRE_MODULES := $(sort $(JRE_MODULES), $(foreach m, $(JRE_MODULES), \
|
||||
$(call FindTransitiveDepsForModule, $m)))
|
||||
ALL_SYMBOLS_MODULES := $(JDK_MODULES)
|
||||
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
LIBS_TARGET_SUBDIR := bin
|
||||
else
|
||||
LIBS_TARGET_SUBDIR := lib
|
||||
endif
|
||||
CMDS_TARGET_SUBDIR := bin
|
||||
|
||||
# Copy debug info files into symbols bundle.
|
||||
# In case of Windows and --with-external-symbols-in-bundles=public, take care to remove *.stripped.pdb files
|
||||
SetupCopyDebuginfo = \
|
||||
$(foreach m, $(ALL_$1_MODULES), \
|
||||
$(eval dbgfiles := $(call FindDebuginfoFiles, $(SUPPORT_OUTPUTDIR)/modules_libs/$m)) \
|
||||
$(eval dbgfiles := $(if $(filter true+public,$(call isTargetOs,windows)+$(SHIP_DEBUG_SYMBOLS)), \
|
||||
$(filter-out %.stripped.pdb,$(dbgfiles)),$(dbgfiles)) \
|
||||
) \
|
||||
$(eval $(call SetupCopyFiles, COPY_$1_LIBS_DEBUGINFO_$m, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$m, \
|
||||
DEST := $($1_IMAGE_DIR)/$(LIBS_TARGET_SUBDIR), \
|
||||
FILES := $(dbgfiles), \
|
||||
)) \
|
||||
$(eval $1_TARGETS += $$(COPY_$1_LIBS_DEBUGINFO_$m)) \
|
||||
$(eval dbgfiles := $(call FindDebuginfoFiles, $(SUPPORT_OUTPUTDIR)/modules_cmds/$m)) \
|
||||
$(eval dbgfiles := $(if $(filter true+public,$(call isTargetOs,windows)+$(SHIP_DEBUG_SYMBOLS)), \
|
||||
$(filter-out %.stripped.pdb,$(dbgfiles)),$(dbgfiles)) \
|
||||
) \
|
||||
$(eval $(call SetupCopyFiles, COPY_$1_CMDS_DEBUGINFO_$m, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds/$m, \
|
||||
DEST := $($1_IMAGE_DIR)/$(CMDS_TARGET_SUBDIR), \
|
||||
FILES := $(dbgfiles), \
|
||||
)) \
|
||||
$(eval $1_TARGETS += $$(COPY_$1_CMDS_DEBUGINFO_$m)) \
|
||||
)
|
||||
|
||||
# No space before argument to avoid having to put $(strip ) everywhere in implementation above.
|
||||
$(call SetupCopyDebuginfo,SYMBOLS)
|
||||
|
||||
################################################################################
|
||||
|
||||
$(JRE_TARGETS): $(JLINK_JRE_TARGETS)
|
||||
$(JDK_TARGETS): $(JLINK_JDK_TARGETS)
|
||||
|
||||
jdk: $(JLINK_JDK_TARGETS) $(JDK_TARGETS)
|
||||
jre: $(JLINK_JRE_TARGETS) $(JRE_TARGETS)
|
||||
symbols: $(SYMBOLS_TARGETS)
|
||||
|
||||
all: jdk jre symbols
|
||||
|
||||
.PHONY: jdk jre symbols
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
215
make/Init.gmk
Normal file
215
make/Init.gmk
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
#
|
||||
# Copyright (c) 2012, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# Init.gmk sits between PreInit.gmk and Main.gmk when bootstrapping the build.
|
||||
# It is called from PreInit.gmk, and its main responsibility is to launch
|
||||
# Main.gmk with the proper make and the proper make arguments.
|
||||
# PreMain.gmk has provided us with a proper SPEC. This allows us to use the
|
||||
# value of $(MAKE) for all further make calls.
|
||||
################################################################################
|
||||
|
||||
# Our helper functions.
|
||||
include $(TOPDIR)/make/InitSupport.gmk
|
||||
include LogUtils.gmk
|
||||
|
||||
# Inclusion of this pseudo-target will cause make to execute this file
|
||||
# serially, regardless of -j.
|
||||
.NOTPARALLEL:
|
||||
|
||||
# Parse COMPARE_BUILD (for makefile development)
|
||||
$(eval $(call ParseCompareBuild))
|
||||
|
||||
# Setup reproducible build environment
|
||||
$(eval $(call SetupReproducibleBuild))
|
||||
|
||||
# If no LOG= was given on command line, but we have a non-standard default
|
||||
# value, use that instead and re-parse log level.
|
||||
ifeq ($(LOG), )
|
||||
ifneq ($(DEFAULT_LOG), )
|
||||
override LOG := $(DEFAULT_LOG)
|
||||
$(eval $(call ParseLogLevel))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(LOG_NOFILE), true)
|
||||
# Disable build log if LOG=[level,]nofile was given
|
||||
override BUILD_LOG_PIPE :=
|
||||
override BUILD_LOG_PIPE_SIMPLE :=
|
||||
endif
|
||||
|
||||
ifeq ($(filter dist-clean, $(SEQUENTIAL_TARGETS)), dist-clean)
|
||||
# We can't have a log file if we're about to remove it.
|
||||
override BUILD_LOG_PIPE :=
|
||||
override BUILD_LOG_PIPE_SIMPLE :=
|
||||
endif
|
||||
|
||||
ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
|
||||
OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
|
||||
endif
|
||||
|
||||
##############################################################################
|
||||
# Init targets. These are handled fully, here and now.
|
||||
##############################################################################
|
||||
|
||||
print-modules:
|
||||
( cd $(TOPDIR) && \
|
||||
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
||||
NO_RECIPES=true print-modules )
|
||||
|
||||
print-targets:
|
||||
( cd $(TOPDIR) && \
|
||||
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
||||
NO_RECIPES=true print-targets )
|
||||
|
||||
print-tests:
|
||||
( cd $(TOPDIR) && \
|
||||
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
||||
NO_RECIPES=true print-tests )
|
||||
|
||||
print-configuration:
|
||||
$(ECHO) $(CONFIGURE_COMMAND_LINE)
|
||||
|
||||
reconfigure:
|
||||
ifneq ($(REAL_CONFIGURE_COMMAND_EXEC_FULL), )
|
||||
$(ECHO) "Re-running configure using original command line '$(REAL_CONFIGURE_COMMAND_EXEC_SHORT) $(REAL_CONFIGURE_COMMAND_LINE)'"
|
||||
$(eval RECONFIGURE_COMMAND := $(REAL_CONFIGURE_COMMAND_EXEC_FULL) $(REAL_CONFIGURE_COMMAND_LINE))
|
||||
else ifneq ($(CONFIGURE_COMMAND_LINE), )
|
||||
$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
|
||||
$(eval RECONFIGURE_COMMAND := $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE))
|
||||
else
|
||||
$(ECHO) "Re-running configure using default settings"
|
||||
$(eval RECONFIGURE_COMMAND := $(BASH) $(TOPDIR)/configure)
|
||||
endif
|
||||
( cd $(CONFIGURE_START_DIR) && PATH="$(ORIGINAL_PATH)" AUTOCONF="$(AUTOCONF)" \
|
||||
CUSTOM_ROOT="$(CUSTOM_ROOT)" \
|
||||
CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
|
||||
$(RECONFIGURE_COMMAND) )
|
||||
|
||||
# Create files that are needed to run most targets in Main.gmk
|
||||
create-make-helpers:
|
||||
( cd $(TOPDIR) && \
|
||||
$(MAKE) $(MAKE_ARGS) -j 1 -f make/GenerateFindTests.gmk \
|
||||
$(USER_MAKE_VARS) )
|
||||
( cd $(TOPDIR) && \
|
||||
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
||||
UPDATE_MODULE_DEPS=true NO_RECIPES=true \
|
||||
create-main-targets-include )
|
||||
|
||||
.PHONY: print-modules print-targets print-tests print-configuration \
|
||||
reconfigure create-make-helpers
|
||||
|
||||
##############################################################################
|
||||
# The main target. This will delegate all other targets into Main.gmk.
|
||||
##############################################################################
|
||||
|
||||
MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE)
|
||||
# If building the default target, add what they are to the description.
|
||||
DESCRIPTION_TARGETS := $(strip $(MAIN_TARGETS))
|
||||
ifeq ($(DESCRIPTION_TARGETS), default)
|
||||
DESCRIPTION_TARGETS += ($(DEFAULT_MAKE_TARGET))
|
||||
endif
|
||||
TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
|
||||
'$(strip $(DESCRIPTION_TARGETS))' in configuration '$(CONF_NAME)'
|
||||
|
||||
# MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
|
||||
# We need to clear it of the init-specific variables. The user-specified
|
||||
# variables are explicitly propagated using $(USER_MAKE_VARS).
|
||||
main: MAKEOVERRIDES :=
|
||||
|
||||
main: $(INIT_TARGETS) create-make-helpers
|
||||
ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
|
||||
$(call RotateLogFiles)
|
||||
$(ECHO) "Building $(TARGET_DESCRIPTION)" $(BUILD_LOG_PIPE_SIMPLE)
|
||||
ifneq ($(SEQUENTIAL_TARGETS), )
|
||||
# Don't touch build output dir since we might be cleaning. That
|
||||
# means no log pipe.
|
||||
( cd $(TOPDIR) && \
|
||||
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
||||
$(SEQUENTIAL_TARGETS) )
|
||||
# We might have cleaned away essential files, recreate them.
|
||||
( cd $(TOPDIR) && \
|
||||
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk create-make-helpers )
|
||||
endif
|
||||
ifneq ($(PARALLEL_TARGETS), )
|
||||
$(call PrepareFailureLogs)
|
||||
$(call StartGlobalTimer)
|
||||
$(call PrepareJavacServer)
|
||||
# JOBS will only be empty for a bootcycle-images recursive call
|
||||
# or if specified via a make argument directly. In those cases
|
||||
# treat it as NOT using jobs at all.
|
||||
( cd $(TOPDIR) && \
|
||||
$(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
|
||||
$(if $(JOBS), -j $(JOBS)) \
|
||||
-f make/Main.gmk $(USER_MAKE_VARS) \
|
||||
$(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
|
||||
( exitcode=$$? && \
|
||||
$(ECHO) "" $(BUILD_LOG_PIPE_SIMPLE) && \
|
||||
$(ECHO) "ERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode)" \
|
||||
$(BUILD_LOG_PIPE_SIMPLE) && \
|
||||
cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
|
||||
on-failure ; \
|
||||
exit $$exitcode ) )
|
||||
$(call CleanupJavacServer)
|
||||
$(call StopGlobalTimer)
|
||||
$(call ReportBuildTimes)
|
||||
endif
|
||||
if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
|
||||
exit 1 ; \
|
||||
fi
|
||||
$(ECHO) "Finished building $(TARGET_DESCRIPTION)" $(BUILD_LOG_PIPE_SIMPLE)
|
||||
$(call ReportProfileTimes)
|
||||
endif
|
||||
|
||||
on-failure:
|
||||
$(call CleanupJavacServer)
|
||||
$(call StopGlobalTimer)
|
||||
$(call ReportBuildTimes)
|
||||
$(call PrintFailureReports)
|
||||
$(call PrintBuildLogFailures)
|
||||
$(call ReportProfileTimes)
|
||||
$(ECHO) "HELP: Run 'make doctor' to diagnose build problems."
|
||||
$(ECHO) ""
|
||||
ifneq ($(COMPARE_BUILD), )
|
||||
$(call CleanupCompareBuild)
|
||||
endif
|
||||
|
||||
# Support targets for COMPARE_BUILD, used for makefile development
|
||||
pre-compare-build:
|
||||
$(call WaitForJavacServerFinish)
|
||||
$(call PrepareCompareBuild)
|
||||
|
||||
post-compare-build:
|
||||
$(call WaitForJavacServerFinish)
|
||||
$(call CleanupCompareBuild)
|
||||
$(call CompareBuildDoComparison)
|
||||
|
||||
.PHONY: main on-failure pre-compare-build post-compare-build
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
327
make/InitSupport.gmk
Normal file
327
make/InitSupport.gmk
Normal file
|
|
@ -0,0 +1,327 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
# This file contains helper functions for Init.gmk.
|
||||
################################################################################
|
||||
|
||||
# Define basic logging setup
|
||||
BUILD_LOG := $(OUTPUTDIR)/build.log
|
||||
BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log
|
||||
|
||||
BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait
|
||||
# Use this for simple echo/printf commands that are never expected to print
|
||||
# to stderr.
|
||||
BUILD_LOG_PIPE_SIMPLE := | $(TEE) -a $(BUILD_LOG)
|
||||
|
||||
# Setup the build environment to match the requested specification on
|
||||
# level of reproducible builds
|
||||
define SetupReproducibleBuild
|
||||
ifeq ($$(SOURCE_DATE), updated)
|
||||
# For static values of SOURCE_DATE (not "updated"), these are set in spec.gmk
|
||||
export SOURCE_DATE_EPOCH := $$(shell $$(DATE) +"%s")
|
||||
export SOURCE_DATE_ISO_8601 := $$(call EpochToISO8601, $$(SOURCE_DATE_EPOCH))
|
||||
endif
|
||||
endef
|
||||
|
||||
# Parse COMPARE_BUILD into COMPARE_BUILD_*
|
||||
# Syntax: COMPARE_BUILD=CONF=<configure options>:PATCH=<patch file>:
|
||||
# MAKE=<make targets>:COMP_OPTS=<compare script options>:
|
||||
# COMP_DIR=<compare script base dir>|<default>:
|
||||
# FAIL=<bool>
|
||||
# If neither CONF or PATCH is given, assume <default> means CONF if it
|
||||
# begins with "--", otherwise assume it means PATCH.
|
||||
# MAKE and COMP_OPTS can only be used with CONF and/or PATCH specified.
|
||||
# If any value contains "+", it will be replaced by space.
|
||||
# FAIL can be set to false to have the return value of compare be ignored.
|
||||
define ParseCompareBuild
|
||||
ifneq ($$(COMPARE_BUILD), )
|
||||
COMPARE_BUILD_OUTPUTDIR := $(WORKSPACE_ROOT)/build/compare-build/$(CONF_NAME)
|
||||
COMPARE_BUILD_FAIL := true
|
||||
|
||||
ifneq ($$(findstring :, $$(COMPARE_BUILD)), )
|
||||
$$(foreach part, $$(subst :, , $$(COMPARE_BUILD)), \
|
||||
$$(if $$(filter PATCH=%, $$(part)), \
|
||||
$$(eval COMPARE_BUILD_PATCH = $$(strip $$(patsubst PATCH=%, %, $$(part)))) \
|
||||
) \
|
||||
$$(if $$(filter CONF=%, $$(part)), \
|
||||
$$(eval COMPARE_BUILD_CONF = $$(strip $$(subst +, , $$(patsubst CONF=%, %, $$(part))))) \
|
||||
) \
|
||||
$$(if $$(filter MAKE=%, $$(part)), \
|
||||
$$(eval COMPARE_BUILD_MAKE = $$(strip $$(subst +, , $$(patsubst MAKE=%, %, $$(part))))) \
|
||||
) \
|
||||
$$(if $$(filter COMP_OPTS=%, $$(part)), \
|
||||
$$(eval COMPARE_BUILD_COMP_OPTS = $$(strip $$(subst +, , $$(patsubst COMP_OPTS=%, %, $$(part))))) \
|
||||
) \
|
||||
$$(if $$(filter COMP_DIR=%, $$(part)), \
|
||||
$$(eval COMPARE_BUILD_COMP_DIR = $$(strip $$(subst +, , $$(patsubst COMP_DIR=%, %, $$(part))))) \
|
||||
) \
|
||||
$$(if $$(filter FAIL=%, $$(part)), \
|
||||
$$(eval COMPARE_BUILD_FAIL = $$(strip $$(subst +, , $$(patsubst FAIL=%, %, $$(part))))) \
|
||||
) \
|
||||
$$(if $$(filter NODRYRUN=%, $$(part)), \
|
||||
$$(eval COMPARE_BUILD_NODRYRUN = $$(strip $$(subst +, , $$(patsubst NODRYRUN=%, %, $$(part))))) \
|
||||
) \
|
||||
)
|
||||
else
|
||||
# Separate handling for single field case, to allow for spaces in values.
|
||||
ifneq ($$(filter PATCH=%, $$(COMPARE_BUILD)), )
|
||||
COMPARE_BUILD_PATCH = $$(strip $$(patsubst PATCH=%, %, $$(COMPARE_BUILD)))
|
||||
else ifneq ($$(filter CONF=%, $$(COMPARE_BUILD)), )
|
||||
COMPARE_BUILD_CONF = $$(strip $$(subst +, , $$(patsubst CONF=%, %, $$(COMPARE_BUILD))))
|
||||
else ifneq ($$(filter --%, $$(COMPARE_BUILD)), )
|
||||
# Assume CONF if value begins with --
|
||||
COMPARE_BUILD_CONF = $$(strip $$(subst +, , $$(COMPARE_BUILD)))
|
||||
else
|
||||
# Otherwise assume patch file
|
||||
COMPARE_BUILD_PATCH = $$(strip $$(COMPARE_BUILD))
|
||||
endif
|
||||
endif
|
||||
ifneq ($$(COMPARE_BUILD_PATCH), )
|
||||
ifneq ($$(wildcard $$(WORKSPACE_ROOT)/$$(COMPARE_BUILD_PATCH)), )
|
||||
# Assume relative path, if file exists
|
||||
COMPARE_BUILD_PATCH := $$(wildcard $$(WORKSPACE_ROOT)/$$(COMPARE_BUILD_PATCH))
|
||||
else ifeq ($$(wildcard $$(COMPARE_BUILD_PATCH)), )
|
||||
$$(error Patch file $$(COMPARE_BUILD_PATCH) does not exist)
|
||||
endif
|
||||
ifneq ($$(COMPARE_BUILD_NODRYRUN), true)
|
||||
PATCH_DRY_RUN := $$(shell cd $$(WORKSPACE_ROOT) && $$(PATCH) --dry-run -p1 < $$(COMPARE_BUILD_PATCH) > /dev/null 2>&1 || $$(ECHO) FAILED)
|
||||
ifeq ($$(PATCH_DRY_RUN), FAILED)
|
||||
$$(error Patch file $$(COMPARE_BUILD_PATCH) does not apply cleanly)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifneq ($$(COMPARE_BUILD_FAIL), true)
|
||||
COMPARE_BUILD_IGNORE_RESULT := || true
|
||||
endif
|
||||
endif
|
||||
endef
|
||||
|
||||
# Prepare for a comparison rebuild
|
||||
define PrepareCompareBuild
|
||||
$(ECHO) "Preparing for comparison rebuild"
|
||||
# Apply patch, if any
|
||||
$(if $(COMPARE_BUILD_PATCH), cd $(WORKSPACE_ROOT) && $(PATCH) -p1 < $(COMPARE_BUILD_PATCH))
|
||||
# Move the first build away temporarily
|
||||
$(RM) -r $(WORKSPACE_ROOT)/build/.compare-build-temp
|
||||
$(MKDIR) -p $(WORKSPACE_ROOT)/build/.compare-build-temp
|
||||
$(MV) $(OUTPUTDIR) $(WORKSPACE_ROOT)/build/.compare-build-temp
|
||||
# Restore an old compare-build, or create a new compare-build directory.
|
||||
if test -d $(COMPARE_BUILD_OUTPUTDIR); then \
|
||||
$(MV) $(COMPARE_BUILD_OUTPUTDIR) $(OUTPUTDIR); \
|
||||
else \
|
||||
$(MKDIR) -p $(OUTPUTDIR); \
|
||||
fi
|
||||
# Re-run configure with the same arguments (and possibly some additional),
|
||||
# must be done after patching.
|
||||
( cd $(CONFIGURE_START_DIR) && PATH="$(ORIGINAL_PATH)" \
|
||||
$(BASH) $(WORKSPACE_ROOT)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF))
|
||||
endef
|
||||
|
||||
# Cleanup after a compare build
|
||||
define CleanupCompareBuild
|
||||
# If running with a COMPARE_BUILD patch, reverse-apply it, but continue
|
||||
# even if that fails (can happen with removed files).
|
||||
$(if $(COMPARE_BUILD_PATCH), cd $(WORKSPACE_ROOT) && $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH) || true)
|
||||
# Move this build away and restore the original build
|
||||
$(MKDIR) -p $(WORKSPACE_ROOT)/build/compare-build
|
||||
$(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR)
|
||||
$(MV) $(WORKSPACE_ROOT)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUTDIR)
|
||||
$(RM) -r $(WORKSPACE_ROOT)/build/.compare-build-temp
|
||||
endef
|
||||
|
||||
# Do the actual comparison of two builds
|
||||
define CompareBuildDoComparison
|
||||
# Compare first and second build. Ignore any error code from compare.sh.
|
||||
$(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)"
|
||||
$(if $(COMPARE_BUILD_COMP_DIR), \
|
||||
+(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh --diffs $(COMPARE_BUILD_COMP_OPTS) \
|
||||
-2dirs $(COMPARE_BUILD_OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) \
|
||||
$(OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) $(COMPARE_BUILD_IGNORE_RESULT)), \
|
||||
+(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh --diffs $(COMPARE_BUILD_COMP_OPTS) \
|
||||
-o $(OUTPUTDIR) $(COMPARE_BUILD_IGNORE_RESULT)) \
|
||||
)
|
||||
endef
|
||||
|
||||
define PrintFailureReports
|
||||
$(if $(filter none, $(LOG_REPORT)), , \
|
||||
$(RM) $(MAKESUPPORT_OUTPUTDIR)/failure-summary.log ; \
|
||||
$(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \
|
||||
( \
|
||||
$(ECHO) "" ; \
|
||||
$(ECHO) "=== Output from failing command(s) repeated here ===" ; \
|
||||
$(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \
|
||||
$(ECHO) "* For target $(notdir $(basename $(logfile))):" ; \
|
||||
$(if $(filter all, $(LOG_REPORT)), \
|
||||
$(GREP) -v -e "^Note: including file:" < $(logfile) || true ; \
|
||||
, \
|
||||
($(GREP) -v -e "^Note: including file:" < $(logfile) || true) | $(HEAD) -n 15 ; \
|
||||
if test `$(WC) -l < $(logfile)` -gt 15; then \
|
||||
$(ECHO) " ... (rest of output omitted)" ; \
|
||||
fi ; \
|
||||
) \
|
||||
) \
|
||||
$(ECHO) "" ; \
|
||||
$(ECHO) "* All command lines available in $(MAKESUPPORT_OUTPUTDIR)/failure-logs." ; \
|
||||
$(ECHO) "=== End of repeated output ===" ; \
|
||||
) >> $(MAKESUPPORT_OUTPUTDIR)/failure-summary.log \
|
||||
) \
|
||||
)
|
||||
endef
|
||||
|
||||
define PrintBuildLogFailures
|
||||
$(if $(filter none, $(LOG_REPORT)), , \
|
||||
if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then \
|
||||
$(ECHO) "" ; \
|
||||
$(ECHO) "=== Make failed targets repeated here ===" ; \
|
||||
$(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \
|
||||
$(ECHO) "=== End of repeated output ===" ; \
|
||||
$(ECHO) "" ; \
|
||||
$(ECHO) "HELP: Try searching the build log for the name of the first failed target." ; \
|
||||
else \
|
||||
$(ECHO) "" ; \
|
||||
$(ECHO) "No indication of failed target found." ; \
|
||||
$(ECHO) "HELP: Try searching the build log for '] Error'." ; \
|
||||
fi >> $(MAKESUPPORT_OUTPUTDIR)/failure-summary.log ; \
|
||||
$(CAT) $(MAKESUPPORT_OUTPUTDIR)/failure-summary.log \
|
||||
)
|
||||
endef
|
||||
|
||||
define RotateLogFiles
|
||||
$(RM) $(BUILD_LOG).old 2> /dev/null && \
|
||||
$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
|
||||
$(if $(findstring true, $(LOG_PROFILE_TIMES_FILE)), \
|
||||
$(RM) $(BUILD_PROFILE_LOG).old 2> /dev/null && \
|
||||
$(MV) $(BUILD_PROFILE_LOG) $(BUILD_PROFILE_LOG).old 2> /dev/null || true \
|
||||
)
|
||||
endef
|
||||
|
||||
# Failure logs are only supported for "parallel" main targets, not the
|
||||
# (trivial) sequential make targets (such as clean and reconfigure),
|
||||
# since the failure-logs directory creation will conflict with clean.
|
||||
# We also make sure the javatmp directory exists, which is needed if a java
|
||||
# process (like javac) is using java.io.tmpdir.
|
||||
define PrepareFailureLogs
|
||||
$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
|
||||
$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
|
||||
$(MKDIR) -p $(JAVA_TMP_DIR)
|
||||
$(RM) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error 2> /dev/null
|
||||
endef
|
||||
|
||||
# Remove any javac server logs and port files. This
|
||||
# prevents a new make run to reuse the previous servers.
|
||||
define PrepareJavacServer
|
||||
$(if $(JAVAC_SERVER_DIR), \
|
||||
$(RM) -r $(JAVAC_SERVER_DIR) 2> /dev/null && \
|
||||
$(MKDIR) -p $(JAVAC_SERVER_DIR) \
|
||||
)
|
||||
endef
|
||||
|
||||
define CleanupJavacServer
|
||||
[ -f $(JAVAC_SERVER_DIR)/server.port ] && $(ECHO) Stopping javac server && \
|
||||
$(TOUCH) $(JAVAC_SERVER_DIR)/server.port.stop; true
|
||||
endef
|
||||
|
||||
ifeq ($(call isBuildOs, windows), true)
|
||||
# On windows we need to synchronize with the javac server to be able to
|
||||
# move or remove the build output directory. Since we have no proper
|
||||
# synchronization process, wait for a while and hope it helps. This is only
|
||||
# used by build comparisons.
|
||||
define WaitForJavacServerFinish
|
||||
$(if $(JAVAC_SERVER_DIR), \
|
||||
sleep 5 \
|
||||
)
|
||||
endef
|
||||
else
|
||||
define WaitForJavacServerFinish
|
||||
endef
|
||||
endif
|
||||
|
||||
##############################################################################
|
||||
# Functions for timers
|
||||
##############################################################################
|
||||
|
||||
# Store the build times in this directory.
|
||||
BUILDTIMESDIR := $(OUTPUTDIR)/make-support/build-times
|
||||
|
||||
# Record starting time for build of a sub repository.
|
||||
define RecordStartTime
|
||||
$(DATE) '+%Y %m %d %H %M %S' | $(AWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) && \
|
||||
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable
|
||||
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' | $(AWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)
|
||||
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)_human_readable
|
||||
$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$(strip $1)` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$(strip $1)` $1 | \
|
||||
$(AWK) '{ 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_$(strip $1)
|
||||
endef
|
||||
|
||||
define StartGlobalTimer
|
||||
$(RM) -r $(BUILDTIMESDIR) 2> /dev/null && \
|
||||
$(MKDIR) -p $(BUILDTIMESDIR) && \
|
||||
$(call RecordStartTime,TOTAL)
|
||||
endef
|
||||
|
||||
define StopGlobalTimer
|
||||
$(call RecordEndTime,TOTAL)
|
||||
endef
|
||||
|
||||
# Find all build_time_* files and print their contents in a list sorted
|
||||
# on the name of the sub repository.
|
||||
define ReportBuildTimes
|
||||
$(PRINTF) $(LOG_INFO) -- \
|
||||
"----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
|
||||
"`$(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`" \
|
||||
$(BUILD_LOG_PIPE_SIMPLE)
|
||||
endef
|
||||
|
||||
define ReportProfileTimes
|
||||
$(if $(findstring true, $(LOG_PROFILE_TIMES_LOG)), \
|
||||
[ ! -f $(BUILD_PROFILE_LOG) ] || \
|
||||
{ $(ECHO) Begin $(notdir $(BUILD_PROFILE_LOG)) && \
|
||||
$(CAT) $(BUILD_PROFILE_LOG) && \
|
||||
$(ECHO) End $(notdir $(BUILD_PROFILE_LOG)); \
|
||||
} \
|
||||
$(BUILD_LOG_PIPE_SIMPLE)
|
||||
)
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
60
make/InterimImage.gmk
Normal file
60
make/InterimImage.gmk
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright (c) 2016, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include Execute.gmk
|
||||
include Modules.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
INTERIM_JLINK_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/interim-image-jlink
|
||||
|
||||
INTERIM_MODULES_LIST := $(call CommaList, $(INTERIM_IMAGE_MODULES))
|
||||
|
||||
JMODS := $(patsubst %, $(INTERIM_JMODS_DIR)/%.jmod, $(INTERIM_IMAGE_MODULES))
|
||||
|
||||
JLINK_TOOL := $(JLINK) -J-Djlink.debug=true \
|
||||
--module-path $(INTERIM_JMODS_DIR) \
|
||||
--endian $(OPENJDK_BUILD_CPU_ENDIAN)
|
||||
|
||||
$(eval $(call SetupExecute, jlink_interim_image, \
|
||||
WARN := Creating interim jimage, \
|
||||
DEPS := $(JMODS) $(call DependOnVariable, INTERIM_MODULES_LIST), \
|
||||
OUTPUT_DIR := $(INTERIM_IMAGE_DIR), \
|
||||
SUPPORT_DIR := $(INTERIM_JLINK_SUPPORT_DIR), \
|
||||
PRE_COMMAND := $(RM) -r $(INTERIM_IMAGE_DIR), \
|
||||
COMMAND := $(JLINK_TOOL) --output $(INTERIM_IMAGE_DIR) \
|
||||
--disable-plugin generate-jli-classes \
|
||||
--add-modules $(INTERIM_MODULES_LIST), \
|
||||
))
|
||||
|
||||
TARGETS += $(jlink_interim_image)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
83
make/JrtfsJar.gmk
Normal file
83
make/JrtfsJar.gmk
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
#
|
||||
# Copyright (c) 2014, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include JarArchive.gmk
|
||||
include JavaCompilation.gmk
|
||||
include TextFileProcessing.gmk
|
||||
|
||||
# This rule will be depended on due to the MANIFEST line
|
||||
$(eval $(call SetupTextFileProcessing, BUILD_JAVA_MANIFEST, \
|
||||
SOURCE_FILES := $(TOPDIR)/make/data/mainmanifest/manifest.mf.template, \
|
||||
OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/java-main-manifest.mf, \
|
||||
REPLACEMENTS := \
|
||||
@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION) ; \
|
||||
@@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
|
||||
@@COMPANY_NAME@@ => $(COMPANY_NAME) , \
|
||||
))
|
||||
|
||||
JIMAGE_PKGS := \
|
||||
jdk/internal/jimage \
|
||||
jdk/internal/jrtfs \
|
||||
#
|
||||
|
||||
# Compile jrt-fs.jar with the interim compiler, as it
|
||||
# ends up in the image, this will ensure reproducible classes
|
||||
$(eval $(call SetupJavaCompilation, BUILD_JRTFS, \
|
||||
COMPILER := interim, \
|
||||
DISABLED_WARNINGS := options, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_JDK8), \
|
||||
SRC := $(TOPDIR)/src/java.base/share/classes, \
|
||||
EXCLUDE_FILES := module-info.java, \
|
||||
INCLUDES := $(JIMAGE_PKGS), \
|
||||
BIN := $(SUPPORT_OUTPUTDIR)/jrtfs_classes, \
|
||||
))
|
||||
|
||||
# Because of the explicit INCLUDES in the compilation setup above, the service provider
|
||||
# file will not be copied unless META-INF/services would also be added to the INCLUDES.
|
||||
# Adding META-INF/services would include all files in that directory when only the one
|
||||
# is needed, which is why this explicit copy is defined instead.
|
||||
$(eval $(call SetupCopyFiles, COPY_JIMAGE_SERVICE_PROVIDER, \
|
||||
SRC := $(TOPDIR)/src/java.base/share/classes, \
|
||||
DEST := $(SUPPORT_OUTPUTDIR)/jrtfs_classes, \
|
||||
FILES := META-INF/services/java.nio.file.spi.FileSystemProvider, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupJarArchive, BUILD_JRTFS_JAR, \
|
||||
DEPENDENCIES := $(BUILD_JRTFS) $(COPY_JIMAGE_SERVICE_PROVIDER), \
|
||||
SRCS := $(SUPPORT_OUTPUTDIR)/jrtfs_classes, \
|
||||
JAR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jrt-fs.jar, \
|
||||
MANIFEST := $(SUPPORT_OUTPUTDIR)/java-main-manifest.mf, \
|
||||
))
|
||||
|
||||
all: $(BUILD_JRTFS_JAR)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
125
make/MacBundles.gmk
Normal file
125
make/MacBundles.gmk
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include TextFileProcessing.gmk
|
||||
|
||||
default: bundles
|
||||
|
||||
# Only macosx has bundles defined.
|
||||
ifeq ($(call isTargetOs, macosx), true)
|
||||
|
||||
bundles: jre-bundle jdk-bundle
|
||||
|
||||
# JDK_MACOSX_CONTENTS_DIR and JRE_MACOSX_CONTENTS_DIR are defined in SPEC.
|
||||
|
||||
MACOSX_PLIST_SRC := $(TOPDIR)/make/data/bundle
|
||||
|
||||
BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_SHORT)
|
||||
BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_STRING)
|
||||
ifeq ($(COMPANY_NAME), N/A)
|
||||
BUNDLE_VENDOR := UNDEFINED
|
||||
else
|
||||
BUNDLE_VENDOR := $(COMPANY_NAME)
|
||||
endif
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_JDK_IMAGE, \
|
||||
SRC := $(JDK_IMAGE_DIR), \
|
||||
DEST := $(JDK_MACOSX_CONTENTS_DIR)/Home, \
|
||||
FILES := $(call FindFiles, $(JDK_IMAGE_DIR)), \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_JRE_IMAGE, \
|
||||
SRC := $(JRE_IMAGE_DIR), \
|
||||
DEST := $(JRE_MACOSX_CONTENTS_DIR)/Home, \
|
||||
FILES := $(call FindFiles, $(JRE_IMAGE_DIR)), \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBJLI_JDK, \
|
||||
FILES := $(JDK_IMAGE_DIR)/lib/libjli.dylib, \
|
||||
DEST := $(JDK_MACOSX_CONTENTS_DIR)/MacOS, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBJLI_JRE, \
|
||||
FILES := $(JRE_IMAGE_DIR)/lib/libjli.dylib, \
|
||||
DEST := $(JRE_MACOSX_CONTENTS_DIR)/MacOS, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTextFileProcessing, BUILD_JDK_PLIST, \
|
||||
SOURCE_FILES := $(MACOSX_PLIST_SRC)/JDK-Info.plist.template, \
|
||||
OUTPUT_FILE := $(JDK_MACOSX_CONTENTS_DIR)/Info.plist, \
|
||||
REPLACEMENTS := \
|
||||
@@ID@@ => $(MACOSX_BUNDLE_ID_BASE).jdk ; \
|
||||
@@NAME@@ => $(BUNDLE_NAME) ; \
|
||||
@@INFO@@ => $(BUNDLE_INFO) ; \
|
||||
@@VERSION@@ => $(VERSION_NUMBER) ; \
|
||||
@@BUILD_VERSION@@ => $(MACOSX_BUNDLE_BUILD_VERSION) ; \
|
||||
@@VENDOR@@ => $(BUNDLE_VENDOR) ; \
|
||||
@@MACOSX_VERSION_MIN@@ => $(MACOSX_VERSION_MIN) , \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTextFileProcessing, BUILD_JRE_PLIST, \
|
||||
SOURCE_FILES := $(MACOSX_PLIST_SRC)/JRE-Info.plist.template, \
|
||||
OUTPUT_FILE := $(JRE_MACOSX_CONTENTS_DIR)/Info.plist, \
|
||||
REPLACEMENTS := \
|
||||
@@ID@@ => $(MACOSX_BUNDLE_ID_BASE).jre ; \
|
||||
@@NAME@@ => $(BUNDLE_NAME) ; \
|
||||
@@INFO@@ => $(BUNDLE_INFO) ; \
|
||||
@@VERSION@@ => $(VERSION_NUMBER) ; \
|
||||
@@BUILD_VERSION@@ => $(BUNDLE_BUILD_VERSION) ; \
|
||||
@@VENDOR@@ => $(BUNDLE_VENDOR) ; \
|
||||
@@MACOSX_VERSION_MIN@@ => $(MACOSX_VERSION_MIN) , \
|
||||
))
|
||||
|
||||
$(SUPPORT_OUTPUTDIR)/images/_jdk_bundle_attribute_set: $(COPY_JDK_IMAGE)
|
||||
$(SETFILE) -a B $(dir $(JDK_MACOSX_CONTENTS_DIR))
|
||||
$(TOUCH) $@
|
||||
|
||||
$(SUPPORT_OUTPUTDIR)/images/_jre_bundle_attribute_set: $(COPY_JRE_IMAGE)
|
||||
$(SETFILE) -a B $(dir $(JRE_MACOSX_CONTENTS_DIR))
|
||||
$(TOUCH) $@
|
||||
|
||||
jdk-bundle: $(COPY_JDK_IMAGE) $(COPY_LIBJLI_JDK) \
|
||||
$(BUILD_JDK_PLIST) $(SUPPORT_OUTPUTDIR)/images/_jdk_bundle_attribute_set
|
||||
|
||||
jre-bundle: $(COPY_JRE_IMAGE) $(COPY_LIBJLI_JRE) \
|
||||
$(BUILD_JRE_PLIST) $(SUPPORT_OUTPUTDIR)/images/_jre_bundle_attribute_set
|
||||
|
||||
else # Not macosx
|
||||
|
||||
bundles:
|
||||
$(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
|
||||
|
||||
endif # macosx
|
||||
|
||||
.PHONY: jdk-bundle jre-bundle bundles
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
1507
make/Main.gmk
Normal file
1507
make/Main.gmk
Normal file
File diff suppressed because it is too large
Load diff
222
make/MainSupport.gmk
Normal file
222
make/MainSupport.gmk
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
# This file contains helper functions for Main.gmk.
|
||||
################################################################################
|
||||
|
||||
# Setup make rules for creating a top-level target.
|
||||
# Parameter 1 is the name of the rule. This name is used as variable prefix.
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# MAKEFILE the makefile to delegate to
|
||||
# TARGET the makefile target
|
||||
# ARGS arguments to the makefile
|
||||
# DEPS the target(s) this new rule depends on
|
||||
# DIR the directory of the makefile (defaults to $(TOPDIR)/make)
|
||||
#
|
||||
SetupTarget = $(NamedParamsMacroTemplate)
|
||||
define SetupTargetBody
|
||||
ifeq ($$($1_DIR), )
|
||||
$1_DIR := $(TOPDIR)/make
|
||||
endif
|
||||
|
||||
$1:
|
||||
+($(CD) $$($1_DIR) && $(MAKE) $(MAKE_ARGS) -f $$($1_MAKEFILE).gmk $$($1_TARGET) $$($1_ARGS))
|
||||
|
||||
ALL_TARGETS += $1
|
||||
|
||||
ifneq ($(DEPS), none)
|
||||
$1: $$($1_DEPS)
|
||||
endif
|
||||
endef
|
||||
|
||||
define CleanDocs
|
||||
@$(PRINTF) "Cleaning docs ..."
|
||||
@$(ECHO) "" $(LOG_DEBUG)
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/docs
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/javadoc
|
||||
$(RM) -r $(IMAGES_OUTPUTDIR)/docs
|
||||
@$(ECHO) " done"
|
||||
endef
|
||||
|
||||
# Cleans the dir given as $1
|
||||
define CleanDir
|
||||
@$(PRINTF) "Cleaning %s build artifacts ..." "$(strip $1)"
|
||||
@$(ECHO) "" $(LOG_DEBUG)
|
||||
($(CD) $(OUTPUTDIR) && $(RM) -r $1)
|
||||
@$(ECHO) " done"
|
||||
endef
|
||||
|
||||
define CleanSupportDir
|
||||
@$(PRINTF) "Cleaning %s build artifacts ..." "$(strip $1)"
|
||||
@$(ECHO) "" $(LOG_DEBUG)
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/$(strip $1)
|
||||
@$(ECHO) " done"
|
||||
endef
|
||||
|
||||
define CleanMakeSupportDir
|
||||
@$(PRINTF) "Cleaning %s make support artifacts ..." "$(strip $1)"
|
||||
@$(ECHO) "" $(LOG_DEBUG)
|
||||
$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/$(strip $1)
|
||||
@$(ECHO) " done"
|
||||
endef
|
||||
|
||||
define CleanTest
|
||||
@$(PRINTF) "Cleaning test %s ..." "$(strip $1)"
|
||||
@$(ECHO) "" $(LOG_DEBUG)
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))
|
||||
# Remove as much of the test directory structure as is empty
|
||||
$(RMDIR) -p $(dir $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))) 2> /dev/null || true
|
||||
@$(ECHO) " done"
|
||||
endef
|
||||
|
||||
define Clean-gensrc
|
||||
@$(PRINTF) "Cleaning gensrc %s..." "$(if $1,for $(strip $1) )"
|
||||
@$(ECHO) "" $(LOG_DEBUG)
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
|
||||
@$(ECHO) " done"
|
||||
endef
|
||||
|
||||
define Clean-java
|
||||
@$(PRINTF) "Cleaning java %s..." "$(if $1,for $(strip $1) )"
|
||||
@$(ECHO) "" $(LOG_DEBUG)
|
||||
$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/special_classes/$(strip $1)
|
||||
$(ECHO) " done"
|
||||
$(PRINTF) "Cleaning headers %s..." "$(if $1,for $(strip $1) )"
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
|
||||
@$(ECHO) " done"
|
||||
endef
|
||||
|
||||
define Clean-native
|
||||
@$(PRINTF) "Cleaning native %s..." "$(if $1,for $(strip $1) )"
|
||||
@$(ECHO) "" $(LOG_DEBUG)
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
|
||||
@$(ECHO) " done"
|
||||
endef
|
||||
|
||||
define Clean-include
|
||||
@$(PRINTF) "Cleaning include %s..." "$(if $1,for $(strip $1) )"
|
||||
@$(ECHO) "" $(LOG_DEBUG)
|
||||
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
|
||||
@$(ECHO) " done"
|
||||
endef
|
||||
|
||||
define CleanModule
|
||||
$(call Clean-gensrc, $1)
|
||||
$(call Clean-java, $1)
|
||||
$(call Clean-native, $1)
|
||||
$(call Clean-include, $1)
|
||||
endef
|
||||
|
||||
define AddTestDependency
|
||||
test-$(strip $1): $2
|
||||
|
||||
exploded-test-$(strip $1): $2
|
||||
|
||||
ifneq ($(filter $(TEST), $1), )
|
||||
TEST_DEPS += $2
|
||||
endif
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
|
||||
PHASE_MAKEDIRS += $(TOPDIR)/make
|
||||
|
||||
# Helper macro for DeclareRecipesForPhase
|
||||
# Declare a recipe for calling the module and phase specific makefile.
|
||||
# If there are multiple makefiles to call, create a rule for each topdir
|
||||
# that contains a makefile with the target $module-$suffix-$repodir,
|
||||
# (i.e: java.base-gensrc-src)
|
||||
# Normally there is only one makefile, and the target will just be
|
||||
# $module-$suffix
|
||||
# Param 1: Name of list to add targets to
|
||||
# Param 2: Module name
|
||||
define DeclareRecipeForModuleMakefile
|
||||
$2-$$($1_TARGET_SUFFIX):
|
||||
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
|
||||
-f ModuleWrapper.gmk -I $$(TOPDIR)/make/common/modules \
|
||||
$$(patsubst %,-I%/modules/$2,$$(PHASE_MAKEDIRS)) \
|
||||
MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX) $$($1_EXTRA_ARGS))
|
||||
|
||||
endef
|
||||
|
||||
# Helper macro for DeclareRecipesForPhase
|
||||
# Param 1: Name of list to add targets to
|
||||
# Param 2: Module name
|
||||
define DeclareRecipesForPhaseAndModule
|
||||
$1_$2_MAKEFILES := $$(strip $$(wildcard \
|
||||
$$(addsuffix /modules/$2/$$($1_FILE_PREFIX).gmk, $$(PHASE_MAKEDIRS))))
|
||||
|
||||
# Only declare recipes if there are makefiles to call
|
||||
ifneq ($$($1_$2_MAKEFILES), )
|
||||
# Add the top dir specific target to target list regardless of if recipe
|
||||
# generation is disabled.
|
||||
ifeq ($$($1_MULTIPLE_MAKEFILES), true)
|
||||
$$(foreach d, $$($1_$2_TOPDIRS), \
|
||||
$$(eval $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $$d)))
|
||||
endif
|
||||
ifeq ($(NO_RECIPES), )
|
||||
$$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2))
|
||||
endif
|
||||
$1 += $2-$$($1_TARGET_SUFFIX)
|
||||
$1_MODULES += $2
|
||||
endif
|
||||
endef
|
||||
|
||||
# Declare recipes for a specific module and build phase if there are makefiles
|
||||
# present for the specific combination.
|
||||
# Param 1: Name of list to add targets to
|
||||
# Named params:
|
||||
# TARGET_SUFFIX : Suffix of target to create for recipe
|
||||
# FILE_PREFIX : File prefix for this build phase
|
||||
# CHECK_MODULES : List of modules to try
|
||||
# MULTIPLE_MAKEFILES : Set to true to handle makefiles for the same module and
|
||||
# phase in multiple repos
|
||||
# EXTRA_ARGS : Add extra make args to each makefile call
|
||||
# Exported variables:
|
||||
# $1_MODULES : All modules that had rules generated
|
||||
# $1_TARGETS : All targets generated
|
||||
define DeclareRecipesForPhase
|
||||
$(foreach i, 2 3 4 5 6 7 8, $(if $(strip $($i)),$(strip $1)_$(strip $($i)))$(NEWLINE))
|
||||
$(if $(9), $(error Internal makefile error: Too many arguments to \
|
||||
DeclareRecipesForPhase, please update MakeHelper.gmk))
|
||||
|
||||
$$(foreach m, $$($(strip $1)_CHECK_MODULES), \
|
||||
$$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m)))
|
||||
|
||||
$(strip $1)_TARGETS := $$($(strip $1))
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
57
make/ModuleTools.gmk
Normal file
57
make/ModuleTools.gmk
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#
|
||||
# Copyright (c) 2013, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
|
||||
include JavaCompilation.gmk
|
||||
|
||||
TOOLS_CLASSES_DIR := $(BUILDTOOLS_OUTPUTDIR)/tools_jigsaw_classes
|
||||
|
||||
# To avoid reevaluating the compilation setup for the tools each time this file
|
||||
# is included, the actual compilation is handled by CompileModuleTools.gmk. The
|
||||
# following trick is used to be able to declare a dependency on the built tools.
|
||||
BUILD_JIGSAW_TOOLS := $(call SetupJavaCompilationCompileTarget, \
|
||||
BUILD_JIGSAW_TOOLS, $(TOOLS_CLASSES_DIR))
|
||||
|
||||
TOOL_GENGRAPHS := $(BUILD_JAVA) -esa -ea -cp $(TOOLS_CLASSES_DIR) \
|
||||
--add-modules jdk.jdeps \
|
||||
--add-exports jdk.jdeps/com.sun.tools.jdeps=ALL-UNNAMED \
|
||||
build.tools.jigsaw.GenGraphs
|
||||
|
||||
TOOL_MODULESUMMARY := $(BUILD_JAVA) -esa -ea -cp $(TOOLS_CLASSES_DIR) \
|
||||
build.tools.jigsaw.ModuleSummary
|
||||
|
||||
TOOL_ADD_PACKAGES_ATTRIBUTE := $(BUILD_JAVA) $(JAVA_FLAGS_SMALL_BUILDJDK) \
|
||||
-cp $(TOOLS_CLASSES_DIR) \
|
||||
--add-exports java.base/jdk.internal.module=ALL-UNNAMED \
|
||||
build.tools.jigsaw.AddPackagesAttribute
|
||||
|
||||
################################################################################
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
146
make/ModuleWrapper.gmk
Normal file
146
make/ModuleWrapper.gmk
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
#
|
||||
# Copyright (c) 2014, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This makefile is called from Main.gmk, through a macro in MakeHelpers.gmk
|
||||
# and wraps calls to makefiles for specific modules and build phases. Having
|
||||
# this wrapper reduces the need for boilerplate code. It also provides
|
||||
# opportunity for automatic copying of files to an interim exploded runnable
|
||||
# image.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include Modules.gmk
|
||||
|
||||
MODULE_SRC := $(TOPDIR)/src/$(MODULE)
|
||||
|
||||
################################################################################
|
||||
# Include module specific build settings
|
||||
|
||||
THIS_SNIPPET := $(call GetModuleSnippetName, $(MAKEFILE_PREFIX))
|
||||
|
||||
ifneq ($(wildcard $(THIS_SNIPPET)), )
|
||||
include MakeSnippetStart.gmk
|
||||
|
||||
# Include the file being wrapped.
|
||||
include $(THIS_SNIPPET)
|
||||
|
||||
include MakeSnippetEnd.gmk
|
||||
endif
|
||||
|
||||
ifeq ($(MAKEFILE_PREFIX), Lib)
|
||||
# We need to keep track of what libraries are generated/needed by this
|
||||
# module. This information is required when doing static linking, to know
|
||||
# which static library files to include. The variable $(MODULE)_INCLUDED_LIBS is
|
||||
# added to for each call to SetupJdkLibrary. The file module-included-libs.txt is then
|
||||
# read in StaticLibs.gmk.
|
||||
ifneq ($($(MODULE)_INCLUDED_LIBS), )
|
||||
LIBLIST := $(SUPPORT_OUTPUTDIR)/modules_static-libs/$(MODULE)/module-included-libs.txt
|
||||
|
||||
$(LIBLIST): $(TARGETS)
|
||||
$(call MakeDir, $(@D))
|
||||
$(ECHO) $($(MODULE)_INCLUDED_LIBS) > $@
|
||||
|
||||
TARGETS += $(LIBLIST)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Setup copy rules from the modules directories to the jdk image directory.
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBS_TO_BIN, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
|
||||
DEST := $(JDK_OUTPUTDIR)/bin, \
|
||||
FILES := $(filter $(TO_BIN_FILTER), \
|
||||
$(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
|
||||
$(TARGETS))), \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
|
||||
DEST := $(JDK_OUTPUTDIR)/lib, \
|
||||
FILES := $(filter-out $(TO_BIN_FILTER), \
|
||||
$(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
|
||||
$(TARGETS))), \
|
||||
))
|
||||
|
||||
else
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
|
||||
DEST := $(JDK_OUTPUTDIR)/lib, \
|
||||
FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), \
|
||||
$(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
|
||||
$(TARGETS))), \
|
||||
))
|
||||
$(eval $(call SetupCopyFiles, LINK_LIBS_TO_LIB, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
|
||||
DEST := $(JDK_OUTPUTDIR)/lib, \
|
||||
FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), \
|
||||
$(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
|
||||
$(TARGETS))), \
|
||||
MACRO := link-file-relative, \
|
||||
LOG_ACTION := Creating symlink, \
|
||||
))
|
||||
endif
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_INCLUDE, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
|
||||
DEST := $(JDK_OUTPUTDIR)/include, \
|
||||
FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)/%, \
|
||||
$(TARGETS)), \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_CMDS, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
|
||||
DEST := $(JDK_OUTPUTDIR)/bin, \
|
||||
FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS)), \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_MAN, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/modules_man/$(MODULE), \
|
||||
DEST := $(JDK_OUTPUTDIR)/man, \
|
||||
FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_man/$(MODULE)/%, $(TARGETS)), \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_CONF, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE), \
|
||||
DEST := $(JDK_OUTPUTDIR)/conf, \
|
||||
FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)/%, \
|
||||
$(TARGETS)), \
|
||||
))
|
||||
|
||||
ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
|
||||
TARGETS := $(filter $(MAKESUPPORT_OUTPUTDIR)/compile-commands/%, $(TARGETS))
|
||||
else
|
||||
TARGETS += $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
|
||||
$(COPY_INCLUDE) $(COPY_CMDS) $(COPY_MAN) $(COPY_CONF) $(LINK_LIBS_TO_LIB)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
225
make/PreInit.gmk
Normal file
225
make/PreInit.gmk
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
#
|
||||
# Copyright (c) 2012, 2026, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# This file is the earliest part of the build bootstrap process (not counting
|
||||
# Makefile that includes it). Its main responsibility is to figure out what
|
||||
# configuration to use and pick up the corresponding SPEC file. It will then
|
||||
# call Init.gmk with this SPEC for further bootstrapping.
|
||||
################################################################################
|
||||
|
||||
# This must be the first rule
|
||||
default:
|
||||
.PHONY: default
|
||||
|
||||
# Inclusion of this pseudo-target will cause make to execute this file
|
||||
# serially, regardless of -j.
|
||||
.NOTPARALLEL:
|
||||
|
||||
IS_PREINIT_ENV := true
|
||||
|
||||
# Include our helper functions.
|
||||
include $(TOPDIR)/make/PreInitSupport.gmk
|
||||
include $(TOPDIR)/make/common/LogUtils.gmk
|
||||
|
||||
# Here are "global" targets, i.e. targets that can be executed without having
|
||||
# a configuration. This will define ALL_GLOBAL_TARGETS.
|
||||
include $(TOPDIR)/make/Global.gmk
|
||||
|
||||
# Targets provided by Init.gmk.
|
||||
ALL_INIT_TARGETS := print-modules print-targets print-configuration \
|
||||
print-tests reconfigure pre-compare-build post-compare-build \
|
||||
create-make-helpers
|
||||
|
||||
# CALLED_TARGETS is the list of targets that the user provided,
|
||||
# or "default" if unspecified.
|
||||
CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
|
||||
|
||||
# Extract non-global targets that require a spec file.
|
||||
CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS))
|
||||
|
||||
# If we have only global targets, or if we are called with -qp (assuming an
|
||||
# external part, e.g. bash completion, is trying to understand our targets),
|
||||
# we will skip SPEC location and the sanity checks.
|
||||
ifeq ($(CALLED_SPEC_TARGETS), )
|
||||
SKIP_SPEC := true
|
||||
endif
|
||||
MFLAGS_SINGLE := $(filter-out --%, $(MFLAGS))
|
||||
ifeq ($(findstring p, $(MFLAGS_SINGLE))$(findstring q, $(MFLAGS_SINGLE)), pq)
|
||||
SKIP_SPEC := true
|
||||
endif
|
||||
|
||||
ifneq ($(SKIP_SPEC), true)
|
||||
|
||||
############################################################################
|
||||
# This is the common case: we have been called from the command line by the
|
||||
# user with a target that should be delegated to Main.gmk, so we need to
|
||||
# figure out a proper SPEC and call Init.gmk with it.
|
||||
############################################################################
|
||||
|
||||
# Basic checks on environment and command line.
|
||||
$(eval $(call CheckControlVariables))
|
||||
$(eval $(call CheckInvalidMakeFlags))
|
||||
|
||||
# Check that CONF_CHECK is valid.
|
||||
$(eval $(call ParseConfCheckOption))
|
||||
|
||||
# Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE,
|
||||
# MAKE_LOG_VARS and MAKE_LOG_FLAGS.
|
||||
$(eval $(call ParseLogLevel))
|
||||
|
||||
# After this SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails).
|
||||
$(eval $(call ParseConfAndSpec))
|
||||
|
||||
# Extract main targets from Main.gmk using the spec(s) provided. In theory,
|
||||
# with multiple specs, we should find the intersection of targets provided
|
||||
# by all specs, but we approximate this by an arbitrary spec from the list.
|
||||
# This will setup ALL_MAIN_TARGETS.
|
||||
$(eval $(call DefineMainTargets, FORCE, $(firstword $(SPECS))))
|
||||
|
||||
# Separate called targets depending on type.
|
||||
INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS))
|
||||
MAIN_TARGETS := $(filter $(ALL_MAIN_TARGETS), $(CALLED_SPEC_TARGETS))
|
||||
SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(MAIN_TARGETS))
|
||||
PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS))
|
||||
|
||||
MAKE_INIT_ARGS := $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -I $(TOPDIR)/make/common
|
||||
|
||||
# The spec files depend on the autoconf source code. This check makes sure
|
||||
# the configuration is up to date after changes to configure.
|
||||
$(SPECS): $(wildcard $(TOPDIR)/make/autoconf/*) \
|
||||
$(if $(CUSTOM_CONFIG_DIR), $(wildcard $(CUSTOM_CONFIG_DIR)/*)) \
|
||||
$(addprefix $(TOPDIR)/make/conf/, version-numbers.conf branding.conf) \
|
||||
$(if $(CUSTOM_CONF_DIR), $(wildcard $(addprefix $(CUSTOM_CONF_DIR)/, \
|
||||
version-numbers.conf branding.conf)))
|
||||
ifeq ($(CONF_CHECK), fail)
|
||||
@echo Error: The configuration is not up to date for \
|
||||
"'$(lastword $(subst /, , $(dir $@)))'."
|
||||
$(call PrintConfCheckFailed)
|
||||
@exit 2
|
||||
else ifeq ($(CONF_CHECK), auto)
|
||||
@echo Note: The configuration is not up to date for \
|
||||
"'$(lastword $(subst /, , $(dir $@)))'."
|
||||
@( cd $(TOPDIR) && \
|
||||
$(MAKE) $(MAKE_INIT_ARGS) -f $(TOPDIR)/make/Init.gmk SPEC=$@ \
|
||||
reconfigure )
|
||||
else ifeq ($(CONF_CHECK), ignore)
|
||||
# Do nothing
|
||||
endif
|
||||
|
||||
# Do not let make delete spec files even if aborted while doing a reconfigure
|
||||
.PRECIOUS: $(SPECS)
|
||||
|
||||
# Unless reconfigure is explicitly called, let all main targets depend on
|
||||
# the spec files to be up to date.
|
||||
ifeq ($(findstring reconfigure, $(INIT_TARGETS)), )
|
||||
$(MAIN_TARGETS): $(SPECS)
|
||||
endif
|
||||
|
||||
make-info:
|
||||
ifneq ($(findstring $(LOG_LEVEL), info debug trace), )
|
||||
$(info Running make as '$(strip $(MAKE) $(MFLAGS) \
|
||||
$(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))')
|
||||
endif
|
||||
|
||||
MAKE_INIT_MAIN_TARGET_ARGS := \
|
||||
USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
|
||||
$(MAKE_LOG_VARS) \
|
||||
INIT_TARGETS="$(INIT_TARGETS)" \
|
||||
SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
|
||||
PARALLEL_TARGETS="$(PARALLEL_TARGETS)"
|
||||
|
||||
# Now the init and main targets will be called, once for each SPEC. The
|
||||
# recipe will be run once for every target specified, but we only want to
|
||||
# execute the recipe a single time, hence the TARGET_DONE with a dummy
|
||||
# command if true.
|
||||
# The COMPARE_BUILD part implements special support for makefile development.
|
||||
$(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info
|
||||
@$(if $(TARGET_DONE), \
|
||||
true \
|
||||
, \
|
||||
( cd $(TOPDIR) && \
|
||||
$(foreach spec, $(SPECS), \
|
||||
$(MAKE) $(MAKE_INIT_ARGS) -j 1 -f $(TOPDIR)/make/Init.gmk \
|
||||
SPEC=$(spec) TOPDIR_ALT=$(TOPDIR) \
|
||||
$(MAKE_INIT_MAIN_TARGET_ARGS) main && \
|
||||
$(if $(and $(COMPARE_BUILD), $(PARALLEL_TARGETS)), \
|
||||
$(MAKE) $(MAKE_INIT_ARGS) -f $(TOPDIR)/make/Init.gmk \
|
||||
SPEC=$(spec) TOPDIR_ALT=$(TOPDIR) \
|
||||
COMPARE_BUILD="$(COMPARE_BUILD)" \
|
||||
pre-compare-build && \
|
||||
$(MAKE) $(MAKE_INIT_ARGS) -j 1 -f $(TOPDIR)/make/Init.gmk \
|
||||
SPEC=$(spec) TOPDIR_ALT=$(TOPDIR) \
|
||||
COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" \
|
||||
$(MAKE_INIT_MAIN_TARGET_ARGS) main && \
|
||||
$(MAKE) $(MAKE_INIT_ARGS) -f $(TOPDIR)/make/Init.gmk \
|
||||
SPEC=$(spec) TOPDIR_ALT=$(TOPDIR) \
|
||||
COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" \
|
||||
post-compare-build && \
|
||||
) \
|
||||
) true ) \
|
||||
$(eval TARGET_DONE=true) \
|
||||
)
|
||||
|
||||
.PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
|
||||
|
||||
else # SKIP_SPEC=true
|
||||
|
||||
############################################################################
|
||||
# We have only global targets, or are called with -pq (from command
|
||||
# completion). In this case we might not even have a configuration at all, but
|
||||
# still need to handle the situation gracefully even if there is no SPEC file.
|
||||
############################################################################
|
||||
|
||||
ifeq ($(wildcard $(SPEC)), )
|
||||
# If we have no SPEC provided, we will just make a "best effort" target list.
|
||||
# First try to grab any available pre-existing main-targets.gmk.
|
||||
main_targets_file := $(firstword $(wildcard $(build_dir)/*/make-support/main-targets.gmk))
|
||||
ifneq ($(main_targets_file), )
|
||||
# Extract the SPEC that corresponds to this main-targets.gmk file.
|
||||
SPEC := $(patsubst %/make-support/main-targets.gmk, %/spec.gmk, $(main_targets_file))
|
||||
else
|
||||
# None found, pick an arbitrary SPEC for which to generate a file
|
||||
SPEC := $(firstword $(all_spec_files))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard $(SPEC)), )
|
||||
$(eval $(call DefineMainTargets, LAZY, $(SPEC)))
|
||||
else
|
||||
# If we have no configurations we can not provide any main targets.
|
||||
ALL_MAIN_TARGETS :=
|
||||
endif
|
||||
|
||||
ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS))
|
||||
|
||||
# Just list all our targets.
|
||||
$(ALL_TARGETS):
|
||||
|
||||
.PHONY: $(ALL_TARGETS)
|
||||
|
||||
endif # $(SKIP_SPEC)!=true
|
||||
|
||||
################################################################################
|
||||
292
make/PreInitSupport.gmk
Normal file
292
make/PreInitSupport.gmk
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Helper functions for PreInit.gmk, the initial part of initialization before
|
||||
# the SPEC file is loaded. Most of these functions provide parsing and setting
|
||||
# up make options from the command-line.
|
||||
################################################################################
|
||||
|
||||
# Include the corresponding closed file, if present.
|
||||
ifneq ($(CUSTOM_MAKE_DIR), )
|
||||
-include $(CUSTOM_MAKE_DIR)/PreInitSupport-pre.gmk
|
||||
endif
|
||||
|
||||
# COMMA is defined in spec.gmk, but that is not included yet
|
||||
COMMA := ,
|
||||
|
||||
# Essential control variables that are handled by PreInit.gmk or Init.gmk
|
||||
INIT_CONTROL_VARIABLES := LOG CONF CONF_NAME SPEC JOBS CONF_CHECK ALLOW \
|
||||
COMPARE_BUILD
|
||||
|
||||
# All known make control variables; these are handled in other makefiles
|
||||
MAKE_CONTROL_VARIABLES += JDK_FILTER SPEC_FILTER \
|
||||
TEST TEST_JOBS JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS TEST_DEPS
|
||||
|
||||
ALL_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) $(MAKE_CONTROL_VARIABLES)
|
||||
|
||||
# Define a simple reverse function.
|
||||
# Should maybe move to MakeBase.gmk, but we can't include that file now.
|
||||
reverse = \
|
||||
$(if $(strip $(1)), $(call reverse, $(wordlist 2, $(words $(1)), $(1)))) \
|
||||
$(firstword $(1))
|
||||
|
||||
# The variable MAKEOVERRIDES contains variable assignments from the command
|
||||
# line, but in reverse order to what the user entered.
|
||||
# The '§' <=> '\ 'dance is needed to keep values with space in them connected.
|
||||
COMMAND_LINE_VARIABLES := $(subst §,\ , $(call reverse, $(subst \ ,§,$(MAKEOVERRIDES))))
|
||||
|
||||
# A list like FOO="val1" BAR="val2" containing all user-supplied make
|
||||
# variables that we should propagate.
|
||||
# The '§' <=> '\ 'dance is needed to keep values with space in them connected.
|
||||
# This explicit propagation is needed to avoid problems with characters that needs
|
||||
# escaping.
|
||||
USER_MAKE_VARS := $(subst §,\ , $(filter-out $(addsuffix =%, $(ALL_CONTROL_VARIABLES)), \
|
||||
$(subst \ ,§,$(MAKEOVERRIDES))))
|
||||
|
||||
# Setup information about available configurations, if any.
|
||||
ifneq ($(CUSTOM_ROOT), )
|
||||
build_dir := $(CUSTOM_ROOT)/build
|
||||
else
|
||||
build_dir := $(TOPDIR)/build
|
||||
endif
|
||||
all_spec_files := $(wildcard $(build_dir)/*/spec.gmk)
|
||||
# Extract the configuration names from the path
|
||||
all_confs := $(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files)))
|
||||
|
||||
# Check for unknown command-line variables
|
||||
define CheckControlVariables
|
||||
command_line_variables := $$(strip $$(foreach var, \
|
||||
$$(subst \ ,_,$$(MAKEOVERRIDES)), \
|
||||
$$(firstword $$(subst =, , $$(var)))))
|
||||
allowed_command_line_variables := $$(strip $$(subst $$(COMMA), , $$(ALLOW)))
|
||||
unknown_command_line_variables := $$(strip \
|
||||
$$(filter-out $$(ALL_CONTROL_VARIABLES) $$(allowed_command_line_variables), \
|
||||
$$(command_line_variables)))
|
||||
ifneq ($$(unknown_command_line_variables), )
|
||||
$$(info Note: Command line contains non-control variables:)
|
||||
$$(foreach var, $$(unknown_command_line_variables), $$(info * $$(var)=$$($$(var))))
|
||||
$$(info Make sure it is not mistyped, and that you intend to override this variable.)
|
||||
$$(info 'make help' will list known control variables.)
|
||||
$$(info )
|
||||
endif
|
||||
endef
|
||||
|
||||
# Check for invalid make flags like -j
|
||||
define CheckInvalidMakeFlags
|
||||
# This is a trick to get this rule to execute before any other rules
|
||||
# MAKEFLAGS only indicate -j if read in a recipe (!)
|
||||
$$(TOPDIR)/make/PreInit.gmk: .FORCE
|
||||
$$(if $$(findstring --jobserver, $$(MAKEFLAGS)), \
|
||||
$$(info Error: 'make -jN' is not supported, use 'make JOBS=N') \
|
||||
$$(error Cannot continue) \
|
||||
)
|
||||
.FORCE:
|
||||
.PHONY: .FORCE
|
||||
endef
|
||||
|
||||
# Check that the CONF_CHECK option is valid and set up handling
|
||||
define ParseConfCheckOption
|
||||
ifeq ($$(CONF_CHECK), )
|
||||
# Default behavior is fail
|
||||
CONF_CHECK := fail
|
||||
else ifneq ($$(filter-out auto fail ignore, $$(CONF_CHECK)), )
|
||||
$$(info Error: CONF_CHECK must be one of: auto, fail or ignore.)
|
||||
$$(error Cannot continue)
|
||||
endif
|
||||
endef
|
||||
|
||||
define ParseConfAndSpec
|
||||
ifneq ($$(origin SPEC), undefined)
|
||||
# We have been given a SPEC, check that it works out properly
|
||||
ifneq ($$(origin CONF), undefined)
|
||||
# We also have a CONF argument. We can't have both.
|
||||
$$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
|
||||
$$(error Cannot continue)
|
||||
endif
|
||||
ifneq ($$(origin CONF_NAME), undefined)
|
||||
# We also have a CONF_NAME argument. We can't have both.
|
||||
$$(info Error: Cannot use CONF_NAME=$$(CONF_NAME) and SPEC=$$(SPEC) at the same time. Choose one.)
|
||||
$$(error Cannot continue)
|
||||
endif
|
||||
ifeq ($$(wildcard $$(SPEC)), )
|
||||
$$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).)
|
||||
$$(error Cannot continue)
|
||||
endif
|
||||
ifeq ($$(filter /%, $$(SPEC)), )
|
||||
# If given with relative path, make it absolute
|
||||
SPECS := $$(CURDIR)/$$(strip $$(SPEC))
|
||||
else
|
||||
SPECS := $$(SPEC)
|
||||
endif
|
||||
|
||||
# For now, unset this SPEC variable.
|
||||
override SPEC :=
|
||||
else
|
||||
# Use spec.gmk files in the build output directory
|
||||
ifeq ($$(all_spec_files), )
|
||||
ifneq ($(CUSTOM_ROOT), )
|
||||
$$(info Error: No configurations found for $$(CUSTOM_ROOT).)
|
||||
else
|
||||
$$(info Error: No configurations found for $$(TOPDIR).)
|
||||
endif
|
||||
$$(info Please run 'bash configure' to create a configuration.)
|
||||
$$(info )
|
||||
$$(error Cannot continue)
|
||||
endif
|
||||
|
||||
ifneq ($$(origin CONF_NAME), undefined)
|
||||
ifneq ($$(origin CONF), undefined)
|
||||
# We also have a CONF argument. We can't have both.
|
||||
$$(info Error: Cannot use CONF=$$(CONF) and CONF_NAME=$$(CONF_NAME) at the same time. Choose one.)
|
||||
$$(error Cannot continue)
|
||||
endif
|
||||
matching_conf := $$(strip $$(filter $$(CONF_NAME), $$(all_confs)))
|
||||
ifeq ($$(matching_conf), )
|
||||
$$(info Error: No configurations found matching CONF_NAME=$$(CONF_NAME).)
|
||||
$$(info Available configurations in $$(build_dir):)
|
||||
$$(foreach var, $$(all_confs), $$(info * $$(var)))
|
||||
$$(error Cannot continue)
|
||||
else ifneq ($$(words $$(matching_conf)), 1)
|
||||
$$(info Error: Matching more than one configuration CONF_NAME=$$(CONF_NAME).)
|
||||
$$(info Available configurations in $$(build_dir):)
|
||||
$$(foreach var, $$(all_confs), $$(info * $$(var)))
|
||||
$$(error Cannot continue)
|
||||
else
|
||||
$$(info Building configuration '$$(matching_conf)' (matching CONF_NAME=$$(CONF_NAME)))
|
||||
endif
|
||||
# Create a SPEC definition. This will contain the path to exactly one spec file.
|
||||
SPECS := $$(build_dir)/$$(matching_conf)/spec.gmk
|
||||
else ifneq ($$(origin CONF), undefined)
|
||||
# User have given a CONF= argument.
|
||||
ifeq ($$(CONF), )
|
||||
# If given CONF=, match all configurations
|
||||
matching_confs := $$(strip $$(all_confs))
|
||||
else
|
||||
# Otherwise select those that contain the given CONF string
|
||||
ifeq ($$(patsubst !%,,$$(CONF)), )
|
||||
# A CONF starting with ! means we should negate the search term
|
||||
matching_confs := $$(strip $$(foreach var, $$(all_confs), \
|
||||
$$(if $$(findstring $$(subst !,,$$(CONF)), $$(var)), ,$$(var))))
|
||||
else
|
||||
matching_confs := $$(strip $$(foreach var, $$(all_confs), \
|
||||
$$(if $$(findstring $$(CONF), $$(var)), $$(var))))
|
||||
endif
|
||||
ifneq ($$(filter $$(CONF), $$(matching_confs)), )
|
||||
ifneq ($$(word 2, $$(matching_confs)), )
|
||||
# Don't repeat this output on make restarts caused by including
|
||||
# generated files.
|
||||
ifeq ($$(MAKE_RESTARTS), )
|
||||
$$(info Using exact match for CONF=$$(CONF) (other matches are possible))
|
||||
endif
|
||||
endif
|
||||
# If we found an exact match, use that
|
||||
matching_confs := $$(CONF)
|
||||
endif
|
||||
endif
|
||||
ifeq ($$(matching_confs), )
|
||||
$$(info Error: No configurations found matching CONF=$$(CONF).)
|
||||
$$(info Available configurations in $$(build_dir):)
|
||||
$$(foreach var, $$(all_confs), $$(info * $$(var)))
|
||||
$$(error Cannot continue)
|
||||
else
|
||||
# Don't repeat this output on make restarts caused by including
|
||||
# generated files.
|
||||
ifeq ($$(MAKE_RESTARTS), )
|
||||
ifeq ($$(words $$(matching_confs)), 1)
|
||||
ifneq ($$(findstring $$(LOG_LEVEL), info debug trace), )
|
||||
$$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
|
||||
endif
|
||||
else
|
||||
$$(info Building these configurations (matching CONF=$$(CONF)):)
|
||||
$$(foreach var, $$(matching_confs), $$(info * $$(var)))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Create a SPEC definition. This will contain the path to one or more spec.gmk files.
|
||||
SPECS := $$(addsuffix /spec.gmk, $$(addprefix $$(build_dir)/, $$(matching_confs)))
|
||||
else
|
||||
# No CONF or SPEC given, check the available configurations
|
||||
ifneq ($$(words $$(all_spec_files)), 1)
|
||||
$$(info Error: No CONF given, but more than one configuration found.)
|
||||
$$(info Available configurations in $$(build_dir):)
|
||||
$$(foreach var, $$(all_confs), $$(info * $$(var)))
|
||||
$$(info Please retry building with CONF=<config pattern> (or SPEC=<spec file>).)
|
||||
$$(info )
|
||||
$$(error Cannot continue)
|
||||
endif
|
||||
|
||||
# We found exactly one configuration, use it
|
||||
SPECS := $$(strip $$(all_spec_files))
|
||||
endif
|
||||
endif
|
||||
endef
|
||||
|
||||
# Extract main targets from Main.gmk using the spec provided in $2.
|
||||
#
|
||||
# Param 1: FORCE = force generation of main-targets.gmk or LAZY = do not force.
|
||||
# Param 2: The SPEC file to use.
|
||||
define DefineMainTargets
|
||||
SPEC_FILE := $(strip $2)
|
||||
|
||||
# We will start by making sure the main-targets.gmk file is removed, if
|
||||
# make has not been restarted. By the -include, we will trigger the
|
||||
# rule for generating the file (which is never there since we removed it),
|
||||
# thus generating it fresh, and make will restart, incrementing the restart
|
||||
# count.
|
||||
main_targets_file := $$(dir $$(SPEC_FILE))make-support/main-targets.gmk
|
||||
|
||||
ifeq ($$(MAKE_RESTARTS), )
|
||||
# Only do this if make has not been restarted, and if we do not force it.
|
||||
ifeq ($(strip $1), FORCE)
|
||||
$$(shell rm -f $$(main_targets_file))
|
||||
endif
|
||||
endif
|
||||
|
||||
$$(main_targets_file):
|
||||
@( cd $$(TOPDIR) && \
|
||||
$$(MAKE) $$(MAKE_LOG_FLAGS) -s -r -R -f $$(TOPDIR)/make/GenerateFindTests.gmk \
|
||||
-I $$(TOPDIR)/make/common SPEC=$$(SPEC_FILE) TOPDIR_ALT=$$(TOPDIR))
|
||||
@( cd $$(TOPDIR) && \
|
||||
$$(MAKE) $$(MAKE_LOG_FLAGS) -s -r -R -f $$(TOPDIR)/make/Main.gmk \
|
||||
-I $$(TOPDIR)/make/common SPEC=$$(SPEC_FILE) TOPDIR_ALT=$$(TOPDIR) \
|
||||
UPDATE_MODULE_DEPS=true NO_RECIPES=true \
|
||||
$$(MAKE_LOG_VARS) \
|
||||
create-main-targets-include )
|
||||
|
||||
# Now include main-targets.gmk. This will define ALL_MAIN_TARGETS.
|
||||
-include $$(main_targets_file)
|
||||
endef
|
||||
|
||||
define PrintConfCheckFailed
|
||||
@echo ' '
|
||||
@echo "Please rerun configure! Easiest way to do this is by running"
|
||||
@echo "'make reconfigure'."
|
||||
@echo "This behavior may also be changed using CONF_CHECK=<ignore|auto>."
|
||||
@echo ' '
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
84
make/ReleaseFile.gmk
Normal file
84
make/ReleaseFile.gmk
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
#
|
||||
# Copyright (c) 2016, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This makefile generates the "release" file into the exploded image. Jlink is
|
||||
# then responsible for using this as the base for release files in each linked
|
||||
# image.
|
||||
################################################################################
|
||||
|
||||
BASE_RELEASE_FILE := $(JDK_OUTPUTDIR)/release
|
||||
|
||||
# Common way to emit a line into the release or info file
|
||||
define info-file-item # name value
|
||||
$(PRINTF) '%s="%s"\n' $1 $2 >> $@
|
||||
endef
|
||||
|
||||
# Param 1 - The file containing the MODULES list
|
||||
define create-info-file
|
||||
$(if $(JDK_ARCH_ABI_PROP_NAME), \
|
||||
$(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
|
||||
$(call info-file-item, "SOURCE", "$(strip $(SOURCE_REVISION))")
|
||||
$(call info-file-item, "IMPLEMENTOR", "$(COMPANY_NAME)")
|
||||
$(if $(VENDOR_VERSION_STRING), \
|
||||
$(call info-file-item, "IMPLEMENTOR_VERSION", "$(VENDOR_VERSION_STRING)"))
|
||||
$(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
|
||||
$(call info-file-item, "JAVA_RUNTIME_VERSION", "$(VERSION_STRING)")
|
||||
$(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
|
||||
$(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
|
||||
$(call info-file-item, "LIBC", "$(RELEASE_FILE_LIBC)")
|
||||
endef
|
||||
|
||||
# Param 1 - The file containing the MODULES list
|
||||
define prepare-info-file
|
||||
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%,%,$@))
|
||||
$(call MakeDir, $(@D))
|
||||
$(RM) $@
|
||||
endef
|
||||
|
||||
define info-file
|
||||
$(call prepare-info-file)
|
||||
$(call create-info-file)
|
||||
endef
|
||||
|
||||
# Create a variable dependency file common for all release info files.
|
||||
INFO_FILE_VARDEPS := $(call DependOnVariable, create-info-file)
|
||||
|
||||
SOURCE_REVISION = $(shell \
|
||||
if [ -f $(SOURCE_REVISION_TRACKER) ] ; then \
|
||||
$(CAT) $(SOURCE_REVISION_TRACKER) ; \
|
||||
fi)
|
||||
|
||||
# The SOURCE_REVISION_TRACKER file may not exist. Only depend on it if it does.
|
||||
$(BASE_RELEASE_FILE): $(INFO_FILE_VARDEPS) $(wildcard $(SOURCE_REVISION_TRACKER))
|
||||
$(info-file)
|
||||
|
||||
TARGETS += $(BASE_RELEASE_FILE)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
1479
make/RunTests.gmk
Normal file
1479
make/RunTests.gmk
Normal file
File diff suppressed because it is too large
Load diff
312
make/RunTestsPrebuilt.gmk
Normal file
312
make/RunTestsPrebuilt.gmk
Normal file
|
|
@ -0,0 +1,312 @@
|
|||
#
|
||||
# Copyright (c) 2017, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Initial bootstrapping, copied and stripped down from Makefile and PreInit.gmk.
|
||||
################################################################################
|
||||
|
||||
IS_PREINIT_ENV := true
|
||||
|
||||
# In Cygwin, the MAKE variable gets prepended with the current directory if the
|
||||
# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe).
|
||||
ifneq ($(findstring :, $(MAKE)), )
|
||||
export MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE)))
|
||||
endif
|
||||
|
||||
# Locate this Makefile
|
||||
ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), )
|
||||
makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST)))
|
||||
else
|
||||
makefile_path := $(lastword $(MAKEFILE_LIST))
|
||||
endif
|
||||
TOPDIR := $(strip $(patsubst %/make/, %, $(dir $(makefile_path))))
|
||||
|
||||
################################################################################
|
||||
# Functions
|
||||
################################################################################
|
||||
|
||||
# Setup a required or optional variable, and/or check that it is properly
|
||||
# given.
|
||||
# Note: No spaces are allowed around the arguments.
|
||||
#
|
||||
# $1: The name of the variable
|
||||
# $2: The default value, if any, or OPTIONAL (do not provide a default but
|
||||
# do not exit if it is missing)
|
||||
# $3: If NO_CHECK, disable checking for target file/directory existence
|
||||
# If MKDIR, create the default directory
|
||||
define SetupVariable
|
||||
ifeq ($$($1), )
|
||||
ifeq ($2, )
|
||||
$$(info Error: Prebuilt variable $1 is missing, needed for test-prebuilt)
|
||||
$$(error Cannot continue.)
|
||||
else ifeq ($2, OPTIONAL)
|
||||
ifneq ($$(findstring $$(LOG), info debug trace), )
|
||||
$$(info Prebuilt variable $1 is not provided)
|
||||
endif
|
||||
else
|
||||
ifneq ($$(findstring $$(LOG), info debug trace), )
|
||||
$$(info Prebuilt variable $1=$2 (default value))
|
||||
endif
|
||||
$1 := $2
|
||||
endif
|
||||
else
|
||||
ifneq ($$(findstring $$(LOG), info debug trace), )
|
||||
$$(info Prebuilt variable $1=$$($1))
|
||||
endif
|
||||
endif
|
||||
# If $1 has a value (is not optional), and $3 is not set (to NO_CHECK),
|
||||
# and if wildcard is empty, then complain that the file is missing.
|
||||
ifeq ($3, MKDIR)
|
||||
ifneq ($$(findstring $$(LOG), info debug trace), )
|
||||
$$(info Creating directory for $1)
|
||||
endif
|
||||
$$(shell mkdir -p $$($1))
|
||||
else ifneq ($3, NO_CHECK)
|
||||
ifeq ($$(strip $$(if $$($1), , OPTIONAL) $$(wildcard $$($1))), )
|
||||
$$(info Error: Prebuilt variable $1 points to missing file/directory:)
|
||||
$$(info '$$($1)')
|
||||
$$(error Cannot continue.)
|
||||
endif
|
||||
endif
|
||||
endef
|
||||
|
||||
# Create an ephemeral spec file
|
||||
#
|
||||
# $1: The output file name
|
||||
# $2..$N: The lines to output to the file
|
||||
define CreateNewSpec
|
||||
$(if $(strip $(33)), \
|
||||
$(error Internal makefile error: \
|
||||
Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \
|
||||
) \
|
||||
$(shell $(RM) $1) \
|
||||
$(foreach i, $(call sequence, 2, 32), \
|
||||
$(if $(strip $($i)), \
|
||||
$(call AppendFile, $(strip $($i)), $1) \
|
||||
) \
|
||||
)
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
# Check input and setup basic buildsystem support
|
||||
################################################################################
|
||||
|
||||
# Verify that user has given correct additional input.
|
||||
|
||||
# These variables are absolutely necessary
|
||||
$(eval $(call SetupVariable,OUTPUTDIR,$(TOPDIR)/build/run-test-prebuilt,MKDIR))
|
||||
$(eval $(call SetupVariable,BOOT_JDK))
|
||||
$(eval $(call SetupVariable,JT_HOME))
|
||||
|
||||
# These can have default values based on the ones above
|
||||
$(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk))
|
||||
$(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test))
|
||||
$(eval $(call SetupVariable,SYMBOLS_IMAGE_DIR,$(OUTPUTDIR)/images/symbols,NO_CHECK))
|
||||
$(eval $(call SetupVariable,JTREG_JDK,$(BOOT_JDK)))
|
||||
|
||||
# Provide default values for tools that we need
|
||||
$(eval $(call SetupVariable,MAKE,make,NO_CHECK))
|
||||
$(eval $(call SetupVariable,BASH,bash,NO_CHECK))
|
||||
|
||||
# Check optional variables
|
||||
$(eval $(call SetupVariable,JIB_JAR,OPTIONAL))
|
||||
|
||||
# Now that we have verified that we have the required variables available, we
|
||||
# can include the prebuilt spec file ourselves, without an ephemeral spec
|
||||
# wrapper. This is required so we can include MakeBase which is needed for
|
||||
# CreateNewSpec.
|
||||
include $(TOPDIR)/make/PreInitSupport.gmk
|
||||
include $(TOPDIR)/make/common/LogUtils.gmk
|
||||
|
||||
$(eval $(call CheckInvalidMakeFlags))
|
||||
$(eval $(call ParseLogLevel))
|
||||
|
||||
SPEC := $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk
|
||||
include $(SPEC)
|
||||
include $(TOPDIR)/make/common/MakeBase.gmk
|
||||
|
||||
################################################################################
|
||||
# Determine what platform we're running on
|
||||
################################################################################
|
||||
UNAME := uname
|
||||
|
||||
# Get OS name from uname (Cygwin inexplicably adds _NT-x.x)
|
||||
UNAME_OS := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
|
||||
|
||||
ifeq ($(UNAME_OS), CYGWIN)
|
||||
OPENJDK_TARGET_OS := windows
|
||||
OPENJDK_TARGET_OS_TYPE := windows
|
||||
OPENJDK_TARGET_OS_ENV := windows.cygwin
|
||||
else ifeq ($(UNAME_OS), MINGW64)
|
||||
OPENJDK_TARGET_OS := windows
|
||||
OPENJDK_TARGET_OS_TYPE := windows
|
||||
OPENJDK_TARGET_OS_ENV := windows.msys2
|
||||
else
|
||||
OPENJDK_TARGET_OS_TYPE := unix
|
||||
ifeq ($(UNAME_OS), Linux)
|
||||
OPENJDK_TARGET_OS := linux
|
||||
else ifeq ($(UNAME_OS), Darwin)
|
||||
OPENJDK_TARGET_OS := macosx
|
||||
else
|
||||
OPENJDK_TARGET_OS := $(UNAME_OS)
|
||||
endif
|
||||
OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS)
|
||||
endif
|
||||
|
||||
# Sanity check env detection
|
||||
$(info Detected target OS, type and env: [$(OPENJDK_TARGET_OS)] [$(OPENJDK_TARGET_OS_TYPE)] [$(OPENJDK_TARGET_OS_ENV)])
|
||||
|
||||
# Assume little endian unless otherwise specified
|
||||
OPENJDK_TARGET_CPU_ENDIAN := little
|
||||
|
||||
UNAME_CPU := $(shell $(UNAME) -m)
|
||||
ifeq ($(UNAME_CPU), i686)
|
||||
OPENJDK_TARGET_CPU := x86
|
||||
OPENJDK_TARGET_CPU_BITS := 32
|
||||
else
|
||||
# Assume all others are 64-bit. We use the same CPU name as uname for
|
||||
# at least x86_64 and aarch64.
|
||||
OPENJDK_TARGET_CPU := $(UNAME_CPU)
|
||||
OPENJDK_TARGET_CPU_BITS := 64
|
||||
endif
|
||||
|
||||
OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU)
|
||||
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
|
||||
OPENJDK_TARGET_CPU_ARCH := x86
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
FIXPATH_BASE := $(BASH) $(TOPDIR)/make/scripts/fixpath.sh
|
||||
FIXPATH := $(FIXPATH_BASE) exec
|
||||
else
|
||||
FIXPATH_BASE :=
|
||||
FIXPATH :=
|
||||
endif
|
||||
|
||||
# Check number of cores and memory in MB
|
||||
ifeq ($(OPENJDK_TARGET_OS), linux)
|
||||
NUM_CORES := $(shell $(CAT) /proc/cpuinfo | $(GREP) -c processor)
|
||||
MEMORY_SIZE := $(shell \
|
||||
$(EXPR) `$(CAT) /proc/meminfo | $(GREP) MemTotal | $(AWK) '{print $$2}'` / 1024 \
|
||||
)
|
||||
else ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
|
||||
MEMORY_SIZE := $(shell $(EXPR) `/usr/sbin/sysctl -n hw.memsize` / 1024 / 1024)
|
||||
else ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
NUM_CORES := $(NUMBER_OF_PROCESSORS)
|
||||
MEMORY_SIZE := $(shell \
|
||||
$(EXPR) `powershell -Command \
|
||||
"(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory" \
|
||||
| $(SED) 's/\\r//g' ` / 1024 / 1024 \
|
||||
)
|
||||
endif
|
||||
ifeq ($(NUM_CORES), )
|
||||
$(warn Could not find number of CPUs, assuming 1)
|
||||
NUM_CORES := 1
|
||||
endif
|
||||
ifeq ($(MEMORY_SIZE), )
|
||||
$(warn Could not find memory size, assuming 1024 MB)
|
||||
MEMORY_SIZE := 1024
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard $(JDK_IMAGE_DIR)/template.xml), )
|
||||
TEST_OPTS_JCOV := true
|
||||
JCOV_IMAGE_DIR := $(JDK_IMAGE_DIR)
|
||||
else
|
||||
TEST_OPTS_JCOV := false
|
||||
JCOV_IMAGE_DIR :=
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Generate the ephemeral spec file
|
||||
################################################################################
|
||||
|
||||
# Now we can include additional custom support.
|
||||
# This might define CUSTOM_NEW_SPEC_LINE
|
||||
ifneq ($(CUSTOM_MAKE_DIR), )
|
||||
include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt-pre.gmk
|
||||
endif
|
||||
|
||||
NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk
|
||||
|
||||
$(call CreateNewSpec, $(NEW_SPEC), \
|
||||
# Generated file -- do not edit!, \
|
||||
SPEC := $(NEW_SPEC), \
|
||||
TOPDIR := $(TOPDIR), \
|
||||
OUTPUTDIR := $(OUTPUTDIR), \
|
||||
BOOT_JDK := $(BOOT_JDK), \
|
||||
JTREG_JDK := $(JTREG_JDK), \
|
||||
JT_HOME := $(JT_HOME), \
|
||||
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \
|
||||
JCOV_IMAGE_DIR := $(JCOV_IMAGE_DIR), \
|
||||
TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \
|
||||
SYMBOLS_IMAGE_DIR := $(SYMBOLS_IMAGE_DIR), \
|
||||
MAKE := $(MAKE), \
|
||||
BASH := $(BASH), \
|
||||
JIB_JAR := $(JIB_JAR), \
|
||||
FIXPATH_BASE := $(FIXPATH_BASE), \
|
||||
FIXPATH := $(FIXPATH), \
|
||||
OPENJDK_TARGET_OS := $(OPENJDK_TARGET_OS), \
|
||||
OPENJDK_TARGET_OS_TYPE := $(OPENJDK_TARGET_OS_TYPE), \
|
||||
OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS_ENV), \
|
||||
OPENJDK_TARGET_CPU := $(OPENJDK_TARGET_CPU), \
|
||||
OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU_ARCH), \
|
||||
OPENJDK_TARGET_CPU_BITS := $(OPENJDK_TARGET_CPU_BITS), \
|
||||
OPENJDK_TARGET_CPU_ENDIAN := $(OPENJDK_TARGET_CPU_ENDIAN), \
|
||||
NUM_CORES := $(NUM_CORES), \
|
||||
MEMORY_SIZE := $(MEMORY_SIZE), \
|
||||
include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \
|
||||
TEST_OPTS_JCOV := $(TEST_OPTS_JCOV), \
|
||||
$(CUSTOM_NEW_SPEC_LINE), \
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# The run-test-prebuilt target
|
||||
################################################################################
|
||||
|
||||
SPEC := $(NEW_SPEC)
|
||||
|
||||
default: all
|
||||
|
||||
test-prebuilt:
|
||||
# Need to make sure the failure logs output dir exists since
|
||||
# ExecuteWithLog is called in RunTests.gmk. The PrepareFailureLogs macro
|
||||
# is unfortunately not available at this point.
|
||||
$(call MakeDir, $(MAKESUPPORT_OUTPUTDIR)/failure-logs)
|
||||
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error
|
||||
# We need to fill the FindTest cache before entering RunTests.gmk.
|
||||
@cd $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) SPEC=$(SPEC) \
|
||||
-f GenerateFindTests.gmk
|
||||
@cd $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
|
||||
TEST="$(TEST)"
|
||||
|
||||
test-prebuilt-with-exit-code: test-prebuilt
|
||||
@if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
|
||||
exit 1 ; \
|
||||
fi
|
||||
|
||||
all: test-prebuilt
|
||||
|
||||
.PHONY: default all test-prebuilt
|
||||
194
make/RunTestsPrebuiltSpec.gmk
Normal file
194
make/RunTestsPrebuiltSpec.gmk
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
#
|
||||
# Copyright (c) 2017, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Fake minimalistic spec file for RunTestsPrebuilt.gmk.
|
||||
################################################################################
|
||||
|
||||
# Make sure all shell commands are executed with the C locale
|
||||
export LC_ALL := C
|
||||
|
||||
define VerifyVariable
|
||||
ifeq ($$($1), )
|
||||
$$(info Error: Variable $1 is missing, needed by RunTestPrebuiltSpec.gmk)
|
||||
$$(error Cannot continue.)
|
||||
else
|
||||
ifneq ($$(findstring $$(LOG_LEVEL), debug trace), )
|
||||
$$(info Prebuilt variable $1=$$($1))
|
||||
endif
|
||||
endif
|
||||
endef
|
||||
|
||||
# It is the responsibility of the file including us to have set these up.
|
||||
# Verify that this is correct.
|
||||
$(eval $(call VerifyVariable,SPEC))
|
||||
$(eval $(call VerifyVariable,TOPDIR))
|
||||
$(eval $(call VerifyVariable,OUTPUTDIR))
|
||||
$(eval $(call VerifyVariable,BOOT_JDK))
|
||||
$(eval $(call VerifyVariable,JT_HOME))
|
||||
$(eval $(call VerifyVariable,JDK_IMAGE_DIR))
|
||||
$(eval $(call VerifyVariable,TEST_IMAGE_DIR))
|
||||
$(eval $(call VerifyVariable,MAKE))
|
||||
$(eval $(call VerifyVariable,BASH))
|
||||
|
||||
################################################################################
|
||||
# The "human readable" name of this configuration
|
||||
CONF_NAME := run-test-prebuilt
|
||||
|
||||
# Number of parallel jobs to use for compilation
|
||||
JOBS ?= $(NUM_CORES)
|
||||
TEST_JOBS ?= 0
|
||||
|
||||
# Use hard-coded values for java flags (one size, fits all!)
|
||||
JAVA_FLAGS := -Duser.language=en -Duser.country=US
|
||||
JAVA_FLAGS_BIG := -Xms64M -Xmx2048M
|
||||
JAVA_FLAGS_SMALL := -XX:+UseSerialGC -Xms32M -Xmx512M -XX:TieredStopAtLevel=1
|
||||
BUILDJDK_JAVA_FLAGS_SMALL := -Xms32M -Xmx512M -XX:TieredStopAtLevel=1
|
||||
BUILD_JAVA_FLAGS := $(JAVA_FLAGS_BIG)
|
||||
|
||||
################################################################################
|
||||
# Hard-coded values copied from spec.gmk.in.
|
||||
X :=
|
||||
SPACE := $(X) $(X)
|
||||
COMMA := ,
|
||||
MAKE_ARGS = $(MAKE_LOG_FLAGS) -r -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \
|
||||
MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" LOG_LEVEL=$(LOG_LEVEL)
|
||||
BASH_ARGS := -o pipefail -e
|
||||
SHELL := $(BASH) $(BASH_ARGS)
|
||||
|
||||
################################################################################
|
||||
# Set some reasonable defaults for features
|
||||
DEBUG_LEVEL := release
|
||||
HOTSPOT_DEBUG_LEVEL := release
|
||||
BUILD_FAILURE_HANDLER := true
|
||||
|
||||
################################################################################
|
||||
# Alias some paths (that should not really be used) to our JDK image under test.
|
||||
SUPPORT_OUTPUTDIR := $(OUTPUTDIR)/support
|
||||
BUILDTOOLS_OUTPUTDIR := $(OUTPUTDIR)/buildtools
|
||||
HOTSPOT_OUTPUTDIR := $(OUTPUTDIR)/hotspot
|
||||
JDK_OUTPUTDIR := $(OUTPUTDIR)/jdk
|
||||
IMAGES_OUTPUTDIR := $(OUTPUTDIR)/images
|
||||
BUNDLES_OUTPUTDIR := $(OUTPUTDIR)/bundles
|
||||
TESTMAKE_OUTPUTDIR := $(OUTPUTDIR)/test-make
|
||||
MAKESUPPORT_OUTPUTDIR := $(OUTPUTDIR)/make-support
|
||||
BUILDJDK_OUTPUTDIR := $(OUTPUTDIR)/buildjdk
|
||||
|
||||
JRE_IMAGE_DIR := $(JDK_IMAGE_DIR)
|
||||
|
||||
################################################################################
|
||||
# Assume build platform is same as target platform
|
||||
OPENJDK_BUILD_OS := $(OPENJDK_TARGET_OS)
|
||||
OPENJDK_BUILD_OS_TYPE := $(OPENJDK_TARGET_OS_TYPE)
|
||||
OPENJDK_BUILD_OS_ENV := $(OPENJDK_TARGET_OS_ENV)
|
||||
|
||||
OPENJDK_BUILD_CPU := $(OPENJDK_TARGET_CPU)
|
||||
OPENJDK_BUILD_CPU_ARCH := $(OPENJDK_TARGET_CPU_ARCH)
|
||||
OPENJDK_BUILD_CPU_BITS := $(OPENJDK_TARGET_CPU_BITS)
|
||||
OPENJDK_BUILD_CPU_ENDIAN := $(OPENJDK_TARGET_CPU_ENDIAN)
|
||||
|
||||
################################################################################
|
||||
# Java executable definitions
|
||||
JAVA_CMD := $(BOOT_JDK)/bin/java
|
||||
JAVAC_CMD := $(BOOT_JDK)/bin/javac
|
||||
JAR_CMD := $(BOOT_JDK)/bin/jar
|
||||
JLINK_CMD := $(JDK_OUTPUTDIR)/bin/jlink
|
||||
JMOD_CMD := $(JDK_OUTPUTDIR)/bin/jmod
|
||||
|
||||
JAVA := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
|
||||
JAVA_SMALL := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
|
||||
JAVAC := $(FIXPATH) $(JAVAC_CMD)
|
||||
JAR := $(FIXPATH) $(JAR_CMD)
|
||||
JLINK := $(FIXPATH) $(JLINK_CMD)
|
||||
JMOD := $(FIXPATH) $(JMOD_CMD)
|
||||
|
||||
JTREG_JAVA := $(FIXPATH) $(JTREG_JDK)/bin/java $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
|
||||
|
||||
BUILD_JAVA := $(JDK_IMAGE_DIR)/bin/JAVA
|
||||
################################################################################
|
||||
# Some common tools. Assume most common name and no path.
|
||||
AWK := awk
|
||||
BASENAME := basename
|
||||
CAT := cat
|
||||
CD := cd
|
||||
CHMOD := chmod
|
||||
CP := cp
|
||||
CUT := cut
|
||||
DATE := date
|
||||
DIFF := diff
|
||||
DIRNAME := dirname
|
||||
FIND := find
|
||||
FIND_DELETE := -delete
|
||||
ECHO := echo
|
||||
EGREP := grep -E
|
||||
FGREP := grep -F
|
||||
GREP := grep
|
||||
GZIP := gzip
|
||||
HEAD := head
|
||||
LS := ls
|
||||
LN := ln
|
||||
MIG := mig
|
||||
MKDIR := mkdir
|
||||
MV := mv
|
||||
NICE := nice
|
||||
PATCH := patch
|
||||
PRINTF := printf
|
||||
RM := rm -f
|
||||
RMDIR := rmdir
|
||||
SED := sed
|
||||
SH := sh
|
||||
SORT := sort
|
||||
TAR := tar
|
||||
TAIL := tail
|
||||
TEE := tee
|
||||
TR := tr
|
||||
TOUCH := touch
|
||||
WC := wc
|
||||
XARGS := xargs
|
||||
ZIPEXE := zip
|
||||
UNZIP := unzip
|
||||
EXPR := expr
|
||||
FILE := file
|
||||
ULIMIT := ulimit
|
||||
|
||||
ifeq ($(OPENJDK_BUILD_OS), windows)
|
||||
PATHTOOL := cygpath
|
||||
endif
|
||||
|
||||
# These settings are needed to run testing with jvmti agent
|
||||
ifeq ($(OPENJDK_BUILD_OS), linux)
|
||||
LIBRARY_PREFIX := lib
|
||||
SHARED_LIBRARY_SUFFIX := .so
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_BUILD_OS), windows)
|
||||
LIBRARY_PREFIX :=
|
||||
SHARED_LIBRARY_SUFFIX := .dll
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_BUILD_OS), macosx)
|
||||
LIBRARY_PREFIX := lib
|
||||
SHARED_LIBRARY_SUFFIX := .dylib
|
||||
endif
|
||||
167
make/SourceRevision.gmk
Normal file
167
make/SourceRevision.gmk
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
#
|
||||
# Copyright (c) 2016, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# Keep track of what source revision is used to create the build, by creating
|
||||
# a tracker file in the output directory. This tracker file is included in the
|
||||
# source image, and can be used to recreate the source revision used.
|
||||
#
|
||||
# We're either building directly from an SCM repository, and if so, use the
|
||||
# current revision from that SCM. Otherwise, we are building from a source
|
||||
# bundle. As a part of creating this source bundle, the current SCM revisions of
|
||||
# all repos will be stored in a file in the top dir, which is then used when
|
||||
# creating the tracker file.
|
||||
################################################################################
|
||||
|
||||
STORED_SOURCE_REVISION := $(TOPDIR)/.src-rev
|
||||
|
||||
# Locate all sourcecode repositories included in the forest, as absolute paths
|
||||
FindAllReposAbs = \
|
||||
$(strip $(sort $(dir $(filter-out $(TOPDIR)/build/%, $(wildcard \
|
||||
$(addprefix $(TOPDIR)/, .git */.git */*/.git */*/*/.git */*/*/*/.git) \
|
||||
)))))
|
||||
|
||||
# Locate all sourcecode repositories included in the forest, as relative paths
|
||||
FindAllReposRel = \
|
||||
$(strip $(subst $(TOPDIR)/,.,$(patsubst $(TOPDIR)/%/, %, $(FindAllReposAbs))))
|
||||
|
||||
USE_SCM := false
|
||||
ifneq ($(and $(GIT), $(wildcard $(TOPDIR)/.git)), )
|
||||
USE_SCM := true
|
||||
SCM_DIR := .git
|
||||
ID_COMMAND := $(PRINTF) "git:%s%s\n" \
|
||||
"$$($(GIT) log -n1 --format=%H | cut -c1-12)" \
|
||||
"$$(if test -n "$$($(GIT) status --porcelain)"; then $(PRINTF) '+'; fi)"
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SCM), true)
|
||||
|
||||
# Verify that the entire forest is consistent
|
||||
$(foreach repo, $(call FindAllReposRel), \
|
||||
$(if $(wildcard $(TOPDIR)/$(repo)/$(SCM_DIR)), , \
|
||||
$(error Inconsistent revision control: $(repo) is missing $(SCM_DIR) directory)) \
|
||||
)
|
||||
|
||||
# Replace "." with "_top" and "/" with "-"
|
||||
MakeFilenameFromRepo = \
|
||||
$(strip $(subst .,top, $(subst /,-, $1)))
|
||||
|
||||
##############################################################################
|
||||
# SetupGetRevisionForRepo defines a make rule for creating a file containing
|
||||
# the name of the repository and the output of the scm command for that
|
||||
# repository.
|
||||
#
|
||||
# Argument 1 is the relative path to the repository from the top dir.
|
||||
#
|
||||
SetupGetRevisionForRepo = $(NamedParamsMacroTemplate)
|
||||
define SetupGetRevisionForRepoBody
|
||||
$1_REPO_PATH := $$(TOPDIR)/$$(strip $1)
|
||||
$1_FILENAME := $$(call MakeFilenameFromRepo, $1)
|
||||
|
||||
$$(SUPPORT_OUTPUTDIR)/src-rev/$$($1_FILENAME): FRC
|
||||
$$(call MakeDir, $$(@D))
|
||||
$$(ECHO) $$(strip $1):`$$(CD) $$($1_REPO_PATH) && $$(ID_COMMAND)` > $$@
|
||||
|
||||
REPO_REVISIONS += $$(SUPPORT_OUTPUTDIR)/src-rev/$$($1_FILENAME)
|
||||
endef
|
||||
|
||||
# Setup rules for all repos. This makes sure all the "git log" calls are made
|
||||
# in parallel.
|
||||
$(foreach repo, $(call FindAllReposRel), \
|
||||
$(eval $(call SetupGetRevisionForRepo, $(repo))) \
|
||||
)
|
||||
|
||||
# Create a complete source revision output file from all repos
|
||||
# Param 1: The output file
|
||||
define CreateSourceRevisionFile
|
||||
$1: $$(REPO_REVISIONS)
|
||||
$$(call MakeDir, $$(@D))
|
||||
$$(ECHO) `$$(CAT) $$(REPO_REVISIONS)` > $$@.tmp
|
||||
if [ ! -f $$@ ] || [ "`$$(CAT) $$@`" != "`$$(CAT) $$@.tmp`" ]; then \
|
||||
$$(MV) $$@.tmp $$@ ; \
|
||||
else \
|
||||
$$(RM) $$@.tmp ; \
|
||||
fi
|
||||
endef
|
||||
|
||||
$(eval $(call CreateSourceRevisionFile, $(STORED_SOURCE_REVISION)))
|
||||
|
||||
scm-store-source-revision: $(STORED_SOURCE_REVISION)
|
||||
|
||||
$(eval $(call CreateSourceRevisionFile, $(SOURCE_REVISION_TRACKER)))
|
||||
|
||||
scm-create-source-revision-tracker: $(SOURCE_REVISION_TRACKER)
|
||||
|
||||
STORE_SOURCE_REVISION_TARGET := scm-store-source-revision
|
||||
CREATE_SOURCE_REVISION_TRACKER_TARGET := scm-create-source-revision-tracker
|
||||
|
||||
.PHONY: scm-store-source-revision scm-create-source-revision-tracker
|
||||
|
||||
else
|
||||
# Not using any SCM
|
||||
|
||||
ifneq ($(wildcard $(STORED_SOURCE_REVISION)), )
|
||||
# We have a stored source revision (.src-rev)
|
||||
|
||||
src-store-source-revision:
|
||||
$(call LogInfo, No SCM configuration present$(COMMA) not updating .src-rev)
|
||||
|
||||
$(SOURCE_REVISION_TRACKER): $(STORED_SOURCE_REVISION)
|
||||
$(install-file)
|
||||
|
||||
src-create-source-revision-tracker: $(SOURCE_REVISION_TRACKER)
|
||||
else
|
||||
# We don't have a stored source revision. Can't do anything, really.
|
||||
|
||||
src-store-source-revision:
|
||||
$(call LogWarn, Error: No SCM configuration present$(COMMA) cannot create .src-rev)
|
||||
exit 2
|
||||
|
||||
src-create-source-revision-tracker:
|
||||
$(call LogWarn, Warning: No SCM configuration present and no .src-rev)
|
||||
endif
|
||||
|
||||
STORE_SOURCE_REVISION_TARGET := src-store-source-revision
|
||||
CREATE_SOURCE_REVISION_TRACKER_TARGET := src-create-source-revision-tracker
|
||||
|
||||
.PHONY: src-store-source-revision src-create-source-revision-tracker
|
||||
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
store-source-revision: $(STORE_SOURCE_REVISION_TARGET)
|
||||
|
||||
create-source-revision-tracker: $(CREATE_SOURCE_REVISION_TRACKER_TARGET)
|
||||
|
||||
FRC: # Force target
|
||||
|
||||
.PHONY: store-source-revision create-source-revision-tracker
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
311
make/StaticLibs.gmk
Normal file
311
make/StaticLibs.gmk
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
#
|
||||
# Copyright (c) 2024, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include DebugInfoUtils.gmk
|
||||
include Modules.gmk
|
||||
include modules/LauncherCommon.gmk
|
||||
include Execute.gmk
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Create the static java launcher
|
||||
#
|
||||
################################################################################
|
||||
|
||||
STATIC_JDK_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/static-jdk
|
||||
STATIC_LAUNCHER_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/static-native/launcher
|
||||
HOTSPOT_STATIC_LIB_PATH := $(HOTSPOT_OUTPUTDIR)/*/libjvm/objs/static
|
||||
|
||||
ifneq ($(word 2, $(wildcard $(HOTSPOT_STATIC_LIB_PATH))), )
|
||||
$(error Cannot perform static linking when building more than one JVM library)
|
||||
endif
|
||||
|
||||
# Find all modules with static libraries
|
||||
STATIC_LIB_MODULES := $(sort $(patsubst $(SUPPORT_OUTPUTDIR)/modules_static-libs/%, \
|
||||
%, $(wildcard $(SUPPORT_OUTPUTDIR)/modules_static-libs/*)))
|
||||
|
||||
# Filter out known broken libraries. This is a temporary measure until
|
||||
# proper support for these libraries can be provided.
|
||||
ifeq ($(call isTargetOs, linux), true)
|
||||
# libsplashscreen has a name conflict with libawt in the function
|
||||
# BitmapToYXBandedRectangles, so we exclude it for now.
|
||||
BROKEN_STATIC_LIBS += splashscreen
|
||||
else ifeq ($(call isTargetOs, macosx), true)
|
||||
# libosxsecurity has a name conflict with libosxapp in the function
|
||||
# JavaStringToNSString, so we exclude it for now.
|
||||
BROKEN_STATIC_LIBS += osxsecurity
|
||||
else ifeq ($(call isTargetOs, windows), true)
|
||||
# libsplashscreen has a name conflict with libawt in the function
|
||||
# BitmapToYXBandedRectangles, so we exclude it for now.
|
||||
BROKEN_STATIC_LIBS += splashscreen
|
||||
# libsspi_bridge has name conflicts with sunmscapi
|
||||
BROKEN_STATIC_LIBS += sspi_bridge
|
||||
# dt_shmem define jdwpTransport_OnLoad which conflict with dt_socket
|
||||
BROKEN_STATIC_LIBS += dt_shmem
|
||||
else ifeq ($(call isTargetOs, aix), true)
|
||||
# libsplashscreen has a name conflict with libawt in the function
|
||||
# BitmapToYXBandedRectangles, so we exclude it for now.
|
||||
BROKEN_STATIC_LIBS += splashscreen
|
||||
endif
|
||||
|
||||
$(foreach module, $(STATIC_LIB_MODULES), \
|
||||
$(eval LIBS_$(module) := $(filter-out $(BROKEN_STATIC_LIBS), $(shell cat \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_static-libs/$(module)/module-included-libs.txt))) \
|
||||
)
|
||||
|
||||
STATIC_LIB_FILES := $(foreach module, $(STATIC_LIB_MODULES), \
|
||||
$(foreach lib, $(LIBS_$(module)), \
|
||||
$(SUPPORT_OUTPUTDIR)/native/$(module)/lib$(lib)/static/$(LIBRARY_PREFIX)$(lib)$(STATIC_LIBRARY_SUFFIX)))
|
||||
|
||||
# Add Hotspot
|
||||
STATIC_LIB_FILES += $(wildcard $(HOTSPOT_STATIC_LIB_PATH)/$(LIBRARY_PREFIX)jvm$(STATIC_LIBRARY_SUFFIX))
|
||||
|
||||
# Figure out what external libraries are required to link these static JDK
|
||||
# libraries.
|
||||
LIB_FLAGS_FILES := $(addsuffix .lib-flags.txt, $(STATIC_LIB_FILES))
|
||||
|
||||
# Gather the lib flags from all individual libraries. There are many duplicates,
|
||||
# so sort and just keep unique instances. On macOS, a common pattern is
|
||||
# "-framework FooFramework", so we must make sure we keep the two words together.
|
||||
EXTERNAL_LIBS := $(strip $(shell $(CAT) $(LIB_FLAGS_FILES) | \
|
||||
$(SED) -e 's/-framework /-framework_/g' | $(TR) ' ' '\n' | $(SORT) -u | \
|
||||
$(SED) -e 's/-framework_/-framework /g'))
|
||||
|
||||
ifeq ($(call isTargetOs, macosx), true)
|
||||
STATIC_LIBS := $(addprefix -force_load$(SPACE), $(STATIC_LIB_FILES))
|
||||
else ifeq ($(call isTargetOs, linux), true)
|
||||
STATIC_LIBS := -Wl,--export-dynamic -Wl,--whole-archive $(STATIC_LIB_FILES) -Wl,--no-whole-archive
|
||||
else ifeq ($(call isTargetOs, windows), true)
|
||||
STATIC_LIBS := $(addprefix -wholearchive:, $(STATIC_LIB_FILES))
|
||||
else ifeq ($(call isTargetOs, aix), true)
|
||||
# on AIX we have to generate export files for all static libs, because we have no whole-archive linker flag
|
||||
$(foreach lib, $(STATIC_LIB_FILES), \
|
||||
$(eval $(call SetupExecute, generate_export_list_$(notdir $(lib)), \
|
||||
INFO := Generating export list for $(notdir $(lib)), \
|
||||
DEPS := $(lib), \
|
||||
OUTPUT_FILE := $(lib).exp, \
|
||||
COMMAND := $(AR) $(ARFLAGS) -w $(lib) | $(GREP) -v '^\.' | $(AWK) '{print $$1}' | $(SORT) -u > $(lib).exp, \
|
||||
)) \
|
||||
$(eval STATIC_LIB_EXPORT_FILES += $(lib).exp) \
|
||||
)
|
||||
STATIC_LIBS := -Wl,-bexpfull $(STATIC_LIB_FILES) $(addprefix -Wl$(COMMA)-bE:, $(STATIC_LIB_EXPORT_FILES))
|
||||
ifeq ($(DEBUG_LEVEL), slowdebug)
|
||||
STATIC_LIBS += -Wl,-bbigtoc
|
||||
endif
|
||||
else
|
||||
$(error Unsupported platform)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Build the java static launcher
|
||||
################################################################################
|
||||
$(eval $(call SetupBuildLauncher, java, \
|
||||
ENABLE_ARG_FILES := true, \
|
||||
EXPAND_CLASSPATH_WILDCARDS := true, \
|
||||
EXTRA_RCFLAGS := $(JAVA_RCFLAGS), \
|
||||
VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
|
||||
OPTIMIZATION := HIGH, \
|
||||
MACOSX_PRIVILEGED := true, \
|
||||
STATIC_LAUNCHER := true, \
|
||||
CFLAGS := -DSTATIC_BUILD, \
|
||||
LDFLAGS := $(LDFLAGS_STATIC_JDK), \
|
||||
LIBS := $(STATIC_LIBS) $(EXTERNAL_LIBS), \
|
||||
LINK_TYPE := C++, \
|
||||
OUTPUT_DIR := $(STATIC_LAUNCHER_OUTPUT_DIR), \
|
||||
OBJECT_DIR := $(STATIC_LAUNCHER_OUTPUT_DIR), \
|
||||
))
|
||||
|
||||
$(java): $(STATIC_LIB_FILES)
|
||||
ifeq ($(call isTargetOs, aix), true)
|
||||
$(java): $(STATIC_LIB_EXPORT_FILES)
|
||||
endif
|
||||
|
||||
TARGETS += $(java)
|
||||
|
||||
JAVA_LAUNCHER := $(BUILD_LAUNCHER_java_TARGET)
|
||||
|
||||
static-launchers: $(java)
|
||||
|
||||
################################################################################
|
||||
# Build relaunchers (thin wrappers calling the java binary) for all other
|
||||
# JDK launchers.
|
||||
################################################################################
|
||||
|
||||
RELAUNCHER_SRC := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/launcher
|
||||
|
||||
# $1: The module name
|
||||
# $2: The launcher name
|
||||
define SetupRelauncher
|
||||
$1_$2_LAUNCHER_ARGS_LINE := $$(call ReadFile, $$(SUPPORT_OUTPUTDIR)/static-native/relaunchers/$1/$2-relauncher-arguments.txt)
|
||||
# Restore |||| with space
|
||||
$1_$2_LAUNCHER_ARGS := '{ $$(subst ||||,$(SPACE),$$(strip $$(foreach a, $$($1_$2_LAUNCHER_ARGS_LINE), "-J$$a"$$(COMMA) )) ) }'
|
||||
|
||||
$$(eval $$(call SetupJdkExecutable, BUILD_relauncher_$2, \
|
||||
NAME := $2, \
|
||||
EXTRA_FILES := $$(RELAUNCHER_SRC)/relauncher.c, \
|
||||
CFLAGS := -DLAUNCHER_ARGS=$$($1_$2_LAUNCHER_ARGS), \
|
||||
LIBS_windows := shlwapi.lib, \
|
||||
OUTPUT_DIR := $$(STATIC_LAUNCHER_OUTPUT_DIR), \
|
||||
OBJECT_DIR := $$(STATIC_LAUNCHER_OUTPUT_DIR)/relaunchers/$2, \
|
||||
))
|
||||
|
||||
TARGETS += $$(BUILD_relauncher_$2)
|
||||
|
||||
RELAUNCHERS += $$(BUILD_relauncher_$2_TARGET)
|
||||
static-launchers: $$(BUILD_relauncher_$2)
|
||||
endef
|
||||
|
||||
# Find all modules with launchers
|
||||
LAUNCHER_MODULES := $(sort $(patsubst $(SUPPORT_OUTPUTDIR)/modules_static-launchers/%, \
|
||||
%, $(wildcard $(SUPPORT_OUTPUTDIR)/modules_static-launchers/*)))
|
||||
|
||||
# Find launchers for each module
|
||||
$(foreach module, $(LAUNCHER_MODULES), \
|
||||
$(eval LAUNCHERS_$(module) := $(if $(wildcard \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_static-launchers/$(module)/module-included-launchers.txt), \
|
||||
$(shell cat \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_static-launchers/$(module)/module-included-launchers.txt))) \
|
||||
)
|
||||
|
||||
# For all launchers (except java and javaw), setup a relauncher build
|
||||
$(foreach module, $(LAUNCHER_MODULES), \
|
||||
$(foreach launcher, $(filter-out java javaw, $(LAUNCHERS_$(module))), \
|
||||
$(eval $(call SetupRelauncher,$(module),$(launcher)))))
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Create the static-jdk image with the statically built java launcher
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Until we get proper support in jlink for generating an image with static
|
||||
# builds, we need to create the image ourselves. We base it on a normal
|
||||
# dynamically linked JDK image.
|
||||
|
||||
# All these files/dirs should be copied as-is
|
||||
JDK_IMAGE_COPY_FILES := $(addprefix $(JDK_IMAGE_DIR)/, conf demo include jmods \
|
||||
legal man/man1/java.1 release README)
|
||||
|
||||
# We need to copy some files from lib, but not the dynamic libraries themselves
|
||||
ALL_LIB_FILES := $(call FindFiles, $(JDK_IMAGE_DIR)/lib)
|
||||
|
||||
# Remove all dynamic libraries from the list
|
||||
JDK_IMAGE_COPY_LIB_FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(ALL_LIB_FILES))
|
||||
# Remove all debug files from the list
|
||||
ifeq ($(call isTargetOs, macosx), true)
|
||||
JDK_IMAGE_COPY_LIB_FILES := $(call not-containing, .dSYM, $(JDK_IMAGE_COPY_LIB_FILES))
|
||||
else
|
||||
JDK_IMAGE_COPY_LIB_FILES := $(filter-out %.debuginfo %.pdb %.map, $(JDK_IMAGE_COPY_LIB_FILES))
|
||||
endif
|
||||
|
||||
static-jdk-info:
|
||||
$(call LogWarn, Creating static-jdk image)
|
||||
|
||||
$(eval $(call SetupCopyFiles, copy-from-jdk-image, \
|
||||
SRC := $(JDK_IMAGE_DIR), \
|
||||
DEST := $(STATIC_JDK_IMAGE_DIR), \
|
||||
FILES := $(call FindFiles, $(JDK_IMAGE_COPY_FILES)) \
|
||||
$(JDK_IMAGE_COPY_LIB_FILES), \
|
||||
))
|
||||
|
||||
TARGETS += $(copy-from-jdk-image)
|
||||
|
||||
$(copy-from-jdk-image): | static-jdk-info
|
||||
|
||||
$(eval $(call SetupCopyFiles, copy-static-launchers, \
|
||||
FILES := $(JAVA_LAUNCHER) $(RELAUNCHERS), \
|
||||
DEST := $(STATIC_JDK_IMAGE_DIR)/bin, \
|
||||
))
|
||||
|
||||
TARGETS += $(copy-static-launchers)
|
||||
|
||||
$(eval $(call SetupCopyFiles, copy-static-launchers-debuginfo, \
|
||||
SRC := $(STATIC_LAUNCHER_OUTPUT_DIR), \
|
||||
DEST := $(STATIC_JDK_IMAGE_DIR)/bin, \
|
||||
FILES := $(call FindDebuginfoFiles, $(STATIC_LAUNCHER_OUTPUT_DIR)), \
|
||||
))
|
||||
|
||||
TARGETS += $(copy-static-launchers-debuginfo)
|
||||
|
||||
# Copy the microsoft runtime libraries on windows
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
# Chmod to avoid permission issues if bundles are unpacked on unix platforms.
|
||||
# Use separate macro calls in case the source files are not in the same
|
||||
# directory.
|
||||
$(eval $(call SetupCopyFiles, copy-windows-msvcr, \
|
||||
DEST := $(STATIC_JDK_IMAGE_DIR)/bin, \
|
||||
FILES := $(MSVCR_DLL), \
|
||||
MACRO := copy-and-chmod-executable, \
|
||||
))
|
||||
|
||||
TARGETS += $(copy-windows-msvcr)
|
||||
|
||||
$(eval $(call SetupCopyFiles, copy-windows-vcruntime, \
|
||||
DEST := $(STATIC_JDK_IMAGE_DIR)/bin, \
|
||||
FILES := $(VCRUNTIME_1_DLL), \
|
||||
MACRO := copy-and-chmod-executable, \
|
||||
))
|
||||
|
||||
TARGETS += $(copy-windows-vcruntime)
|
||||
|
||||
$(eval $(call SetupCopyFiles, copy-windows-msvcp, \
|
||||
DEST := $(STATIC_JDK_IMAGE_DIR)/bin, \
|
||||
FILES := $(MSVCP_DLL), \
|
||||
MACRO := copy-and-chmod-executable, \
|
||||
))
|
||||
|
||||
TARGETS += $(copy-windows-msvcp)
|
||||
|
||||
copy-windows-libs := $(copy-windows-msvcr) $(copy-windows-vcruntime) $(copy-windows-msvcp)
|
||||
|
||||
ifneq ($(UCRT_DLL_DIR), )
|
||||
$(eval $(call SetupCopyFiles, copy-windows-ucrt, \
|
||||
DEST := $(STATIC_JDK_IMAGE_DIR)/bin, \
|
||||
SRC := $(UCRT_DLL_DIR), \
|
||||
FILES := $(wildcard $(UCRT_DLL_DIR)/*.dll), \
|
||||
MACRO := copy-and-chmod-executable, \
|
||||
))
|
||||
|
||||
TARGETS += $(copy-windows-ucrt)
|
||||
|
||||
copy-windows-libs += $(copy-windows-ucrt)
|
||||
endif
|
||||
endif
|
||||
|
||||
static-jdk-image: $(copy-from-jdk-image) $(copy-static-launchers) \
|
||||
$(copy-static-launchers-debuginfo) $(copy-windows-libs)
|
||||
|
||||
TARGETS += static-jdk-image
|
||||
|
||||
.PHONY: static-launchers static-jdk-image
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
77
make/StaticLibsImage.gmk
Normal file
77
make/StaticLibsImage.gmk
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#
|
||||
# Copyright (c) 2019, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This makefile creates an image of the optional static versions of certain JDK
|
||||
# libraries.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include Modules.gmk
|
||||
|
||||
ALL_MODULES = $(call FindAllModules)
|
||||
|
||||
################################################################################
|
||||
|
||||
ifneq ($(filter static-libs-image, $(MAKECMDGOALS)), )
|
||||
IMAGE_DEST_DIR = $(STATIC_LIBS_IMAGE_DIR)/lib
|
||||
else ifneq ($(filter static-libs-graal-image, $(MAKECMDGOALS)), )
|
||||
IMAGE_DEST_DIR = $(STATIC_LIBS_GRAAL_IMAGE_DIR)/lib
|
||||
endif
|
||||
|
||||
# Copy JDK static libs to the image.
|
||||
$(foreach m, $(ALL_MODULES), \
|
||||
$(eval $(call SetupCopyFiles, COPY_STATIC_LIBS_$m, \
|
||||
FLATTEN := true, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR)/native/$m, \
|
||||
DEST := $(IMAGE_DEST_DIR), \
|
||||
FILES := $(filter %$(STATIC_LIBRARY_SUFFIX), \
|
||||
$(call FindFiles, $(SUPPORT_OUTPUTDIR)/native/$m/*/static)), \
|
||||
)) \
|
||||
$(eval TARGETS += $$(COPY_STATIC_LIBS_$m)) \
|
||||
$(eval STATIC_LIBS_TARGETS += $$(COPY_STATIC_LIBS_$m)) \
|
||||
)
|
||||
|
||||
ifneq ($(filter static-libs-image, $(MAKECMDGOALS)), )
|
||||
# Copy libjvm static library to the image.
|
||||
$(foreach v, $(JVM_VARIANTS), \
|
||||
$(eval $(call SetupCopyFiles, COPY_STATIC_LIBS_$v, \
|
||||
SRC := $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/objs/static, \
|
||||
DEST := $(IMAGE_DEST_DIR)/$v, \
|
||||
FILES := $(wildcard $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/objs/static/*$(STATIC_LIBRARY_SUFFIX)), \
|
||||
)) \
|
||||
$(eval TARGETS += $$(COPY_STATIC_LIBS_$v)) \
|
||||
$(eval HOTSPOT_VARIANT_STATIC_LIBS_TARGETS += $$(COPY_STATIC_LIBS_$v)) \
|
||||
)
|
||||
endif
|
||||
|
||||
static-libs-image: $(HOTSPOT_VARIANT_STATIC_LIBS_TARGETS) $(STATIC_LIBS_TARGETS)
|
||||
static-libs-graal-image: $(STATIC_LIBS_TARGETS)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
55
make/TestImage.gmk
Normal file
55
make/TestImage.gmk
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#
|
||||
# Copyright (c) 2017, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
BUILD_INFO_PROPERTIES := $(TEST_IMAGE_DIR)/build-info.properties
|
||||
|
||||
$(BUILD_INFO_PROPERTIES):
|
||||
$(call MakeTargetDir)
|
||||
$(ECHO) "# Build info properties for JDK tests" > $@
|
||||
$(ECHO) 'build.workspace.root=$(call FixPath, $(WORKSPACE_ROOT))' >> $@
|
||||
$(ECHO) 'build.output.root=$(call FixPath, $(OUTPUTDIR))' >> $@
|
||||
|
||||
README := $(TEST_IMAGE_DIR)/Readme.txt
|
||||
|
||||
$(README):
|
||||
$(call MakeTargetDir)
|
||||
$(ECHO) > $@ 'JDK test image'
|
||||
|
||||
TARGETS += $(BUILD_INFO_PROPERTIES) $(README)
|
||||
|
||||
################################################################################
|
||||
|
||||
prepare-test-image: $(TARGETS)
|
||||
all: prepare-test-image
|
||||
|
||||
.PHONY: prepare-test-image
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
50
make/ToolsHotspot.gmk
Normal file
50
make/ToolsHotspot.gmk
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#
|
||||
# Copyright (c) 2020, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
|
||||
include JavaCompilation.gmk
|
||||
|
||||
HOTSPOT_TOOLS_OUTPUTDIR := $(BUILDTOOLS_OUTPUTDIR)/buildtools/hotspot_tools_classes
|
||||
|
||||
################################################################################
|
||||
# To avoid reevaluating the compilation setup for the tools each time this file
|
||||
# is included, the actual compilation is handled by CompileToolsHotspot.gmk. The
|
||||
# following trick is used to be able to declare a dependency on the built tools.
|
||||
BUILD_TOOLS_HOTSPOT := $(call SetupJavaCompilationCompileTarget, \
|
||||
BUILD_TOOLS_HOTSPOT, $(HOTSPOT_TOOLS_OUTPUTDIR))
|
||||
|
||||
################################################################################
|
||||
|
||||
TOOL_JFR_GEN := $(JAVA_SMALL) -cp $(HOTSPOT_TOOLS_OUTPUTDIR) \
|
||||
build.tools.jfr.GenerateJfrFiles
|
||||
|
||||
################################################################################
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
146
make/ToolsJdk.gmk
Normal file
146
make/ToolsJdk.gmk
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
|
||||
include JavaCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# To avoid reevaluating the compilation setup for the tools each time this file
|
||||
# is included, the actual compilation is handled by CompileTools.gmk. The
|
||||
# following trick is used to be able to declare a dependency on the built tools.
|
||||
BUILD_TOOLS_JDK := $(call SetupJavaCompilationCompileTarget, \
|
||||
BUILD_TOOLS_JDK, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes)
|
||||
|
||||
################################################################################
|
||||
|
||||
TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
build.tools.compilefontconfig.CompileFontConfig
|
||||
|
||||
TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.generatecharacter.GenerateCharacter
|
||||
|
||||
TOOL_CHARACTERNAME = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.generatecharacter.CharacterName
|
||||
|
||||
TOOL_DTDBUILDER = $(JAVA_SMALL) -Ddtd_home=$(TOPDIR)/src/java.desktop/share/data/dtdbuilder \
|
||||
-Djava.awt.headless=true \
|
||||
-cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.dtdbuilder.DTDBuilder
|
||||
|
||||
TOOL_GENERATEBREAKITERATORDATA = $(JAVA_SMALL) \
|
||||
-cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.generatebreakiteratordata.GenerateBreakIteratorData
|
||||
|
||||
TOOL_GENERATECURRENCYDATA = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.generatecurrencydata.GenerateCurrencyData
|
||||
|
||||
TOOL_TZDB = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.tzdb.TzdbZoneRulesCompiler
|
||||
|
||||
TOOL_BLOCKED_CERTS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
--add-exports java.base/sun.security.util=ALL-UNNAMED \
|
||||
build.tools.blockedcertsconverter.BlockedCertsConverter
|
||||
|
||||
TOOL_MAKEJAVASECURITY = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.makejavasecurity.MakeJavaSecurity
|
||||
|
||||
TOOL_GENERATECACERTS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
-Dkeystore.pkcs12.certProtectionAlgorithm=NONE \
|
||||
-Dkeystore.pkcs12.macAlgorithm=NONE \
|
||||
build.tools.generatecacerts.GenerateCacerts
|
||||
|
||||
TOOL_GENERATEEXTRAPROPERTIES = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.generateextraproperties.GenerateExtraProperties
|
||||
|
||||
TOOL_GENERATECASEFOLDING = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.generatecharacter.GenerateCaseFolding
|
||||
|
||||
TOOL_MAKEZIPREPRODUCIBLE = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.makezipreproducible.MakeZipReproducible
|
||||
|
||||
# TODO: There are references to the jdwpgen.jar in jdk/make/netbeans/jdwpgen/build.xml
|
||||
# and nbproject/project.properties in the same dir. Needs to be looked at.
|
||||
TOOL_JDWPGEN = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.jdwpgen.Main
|
||||
|
||||
# TODO: Lots of files in jdk/make/tools/CharsetMapping dir
|
||||
TOOL_CHARSETMAPPING = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.charsetmapping.Main $(LOG_INFO)
|
||||
|
||||
TOOL_SPP = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.spp.Spp
|
||||
|
||||
# Nimbus is used somewhere in the swing build.
|
||||
TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.generatenimbus.Generator
|
||||
|
||||
TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.x11wrappergen.WrapperGenerator
|
||||
|
||||
TOOL_AWT_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.icondata.awt.ToBin
|
||||
|
||||
TOOL_OSX_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.icondata.osxapp.ToBin
|
||||
|
||||
TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.cldrconverter.CLDRConverter
|
||||
|
||||
TOOL_INTPOLY = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.intpoly.FieldGen
|
||||
|
||||
TOOL_GENERATELSREQUIVMAPS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.generatelsrequivmaps.EquivMapsGenerator
|
||||
|
||||
TOOL_GENMODULEINFOSOURCE = $(JAVA_SMALL) $(INTERIM_LANGTOOLS_BOOTCLASSPATH) \
|
||||
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes) \
|
||||
build.tools.module.GenModuleInfoSource
|
||||
|
||||
TOOL_GENCLASSLOADERMAP = $(JAVA_SMALL) $(INTERIM_LANGTOOLS_BOOTCLASSPATH) \
|
||||
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes) \
|
||||
build.tools.module.GenModuleLoaderMap
|
||||
|
||||
TOOL_PUBLICSUFFIXLIST = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.publicsuffixlist.GeneratePublicSuffixList
|
||||
|
||||
TOOL_FIXUPPANDOC = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.fixuppandoc.Main
|
||||
|
||||
TOOL_VARHANDLEGUARDMETHODGENERATOR = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
build.tools.methodhandle.VarHandleGuardMethodGenerator
|
||||
|
||||
################################################################################
|
||||
|
||||
# Executable javascript filter for man page generation using pandoc.
|
||||
|
||||
PANDOC_TROFF_MANPAGE_FILTER := $(BUILDTOOLS_OUTPUTDIR)/manpages/pandoc-troff-manpage-filter
|
||||
PANDOC_HTML_MANPAGE_FILTER := $(BUILDTOOLS_OUTPUTDIR)/manpages/pandoc-html-manpage-filter
|
||||
|
||||
################################################################################
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
48
make/ToolsLangtools.gmk
Normal file
48
make/ToolsLangtools.gmk
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#
|
||||
# Copyright (c) 2014, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include JavaCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# Setup the compilation of the properties compilation tool. You can depend
|
||||
# upon $(BUILD_TOOLS_LANGTOOLS) to trigger a compilation of the tools.
|
||||
$(eval $(call SetupJavaCompilation, BUILD_TOOLS_LANGTOOLS, \
|
||||
COMPILER := bootjdk, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \
|
||||
SRC := $(TOPDIR)/make/langtools/tools, \
|
||||
INCLUDES := compileproperties flagsgenerator propertiesparser, \
|
||||
COPY := .properties, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes, \
|
||||
))
|
||||
|
||||
all: $(BUILD_TOOLS_LANGTOOLS)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
55
make/UpdateBuildDocs.gmk
Normal file
55
make/UpdateBuildDocs.gmk
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#
|
||||
# Copyright (c) 2017, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This makefile updates the generated build html documentation.
|
||||
################################################################################
|
||||
|
||||
include ProcessMarkdown.gmk
|
||||
|
||||
ifeq ($(ENABLE_PANDOC), false)
|
||||
$(info No pandoc executable was detected by configure)
|
||||
$(error Cannot continue)
|
||||
endif
|
||||
|
||||
GLOBAL_SPECS_DEFAULT_CSS_FILE := $(TOPDIR)/make/data/docs-resources/resources/jdk-default.css
|
||||
|
||||
################################################################################
|
||||
|
||||
DOCS_DIR := $(TOPDIR)/doc
|
||||
|
||||
$(eval $(call SetupProcessMarkdown, md_docs, \
|
||||
FILES := $(call FindFiles, $(DOCS_DIR), *.md), \
|
||||
DEST := $(DOCS_DIR), \
|
||||
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
|
||||
OPTIONS := --toc, \
|
||||
))
|
||||
TARGETS += $(md_docs)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
146
make/UpdateSleefSource.gmk
Normal file
146
make/UpdateSleefSource.gmk
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
#
|
||||
# Copyright (c) 2024, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This file is responsible for updating the generated sleef source code files
|
||||
# that are checked in to the JDK repo, and that are actually used when building.
|
||||
# This target needs to be re-run every time the source code of libsleef is
|
||||
# updated from upstream.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include Execute.gmk
|
||||
|
||||
ifneq ($(COMPILE_TYPE), cross)
|
||||
$(error Only cross-compilation of libsleef is currently supported)
|
||||
endif
|
||||
|
||||
ifeq ($(CMAKE), )
|
||||
$(error CMake not found. Please install cmake and rerun configure)
|
||||
endif
|
||||
|
||||
ifneq ($(OPENJDK_BUILD_OS), linux)
|
||||
$(error This target is only supported on linux)
|
||||
endif
|
||||
|
||||
SLEEF_SUPPORT_DIR := $(MAKESUPPORT_OUTPUTDIR)/sleef
|
||||
SLEEF_SOURCE_BASE_DIR := $(TOPDIR)/src/jdk.incubator.vector/linux/native/libsleef
|
||||
SLEEF_SOURCE_DIR := $(SLEEF_SOURCE_BASE_DIR)/upstream
|
||||
SLEEF_TARGET_DIR := $(SLEEF_SOURCE_BASE_DIR)/generated
|
||||
SLEEF_NATIVE_BUILD_DIR := $(SLEEF_SUPPORT_DIR)/native
|
||||
SLEEF_CROSS_BUILD_DIR := $(SLEEF_SUPPORT_DIR)/cross
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_CPU), aarch64)
|
||||
CROSS_COMPILATION_FILENAMES := sleefinline_advsimd.h sleefinline_sve.h
|
||||
EXTRA_CROSS_OPTIONS := -DSLEEF_ENFORCE_SVE=TRUE
|
||||
else ifeq ($(OPENJDK_TARGET_CPU), riscv64)
|
||||
CROSS_COMPILATION_FILENAMES := sleefinline_rvvm1.h
|
||||
EXTRA_CROSS_OPTIONS := -DSLEEF_ENFORCE_RVVM1=TRUE
|
||||
else
|
||||
$(error Unsupported platform)
|
||||
endif
|
||||
CROSS_COMPILATION_SRC_FILES := $(addprefix $(SLEEF_CROSS_BUILD_DIR)/include/, \
|
||||
$(CROSS_COMPILATION_FILENAMES))
|
||||
|
||||
ifeq ($(TOOLCHAIN_TYPE), clang)
|
||||
SLEEF_TOOLCHAIN_TYPE := llvm
|
||||
else
|
||||
SLEEF_TOOLCHAIN_TYPE := $(TOOLCHAIN_TYPE)
|
||||
endif
|
||||
|
||||
SLEEF_CMAKE_FILE := toolchains/$(OPENJDK_TARGET_CPU)-$(SLEEF_TOOLCHAIN_TYPE).cmake
|
||||
|
||||
# We need to run CMake twice, first using it to configure the build, and then
|
||||
# to actually build; and we need to do this twice, once for a native build
|
||||
# and once for the cross-compilation build.
|
||||
|
||||
$(eval $(call SetupExecute, sleef_native_config, \
|
||||
INFO := Configuring native sleef build, \
|
||||
OUTPUT_DIR := $(SLEEF_NATIVE_BUILD_DIR), \
|
||||
WORKING_DIR := $(SLEEF_SOURCE_DIR), \
|
||||
COMMAND := $(CMAKE) -S . -B $(SLEEF_NATIVE_BUILD_DIR), \
|
||||
))
|
||||
|
||||
TARGETS := $(sleef_native_config)
|
||||
|
||||
$(eval $(call SetupExecute, sleef_native_build, \
|
||||
INFO := Building native sleef, \
|
||||
DEPS := $(sleef_native_config), \
|
||||
OUTPUT_DIR := $(SLEEF_NATIVE_BUILD_DIR), \
|
||||
WORKING_DIR := $(SLEEF_SOURCE_DIR), \
|
||||
COMMAND := $(CMAKE) --build $(SLEEF_NATIVE_BUILD_DIR) -j, \
|
||||
))
|
||||
|
||||
TARGETS := $(sleef_native_build)
|
||||
|
||||
$(eval $(call SetupExecute, sleef_cross_config, \
|
||||
INFO := Configuring cross-compiling sleef build, \
|
||||
DEPS := $(sleef_native_build), \
|
||||
OUTPUT_DIR := $(SLEEF_CROSS_BUILD_DIR), \
|
||||
WORKING_DIR := $(SLEEF_SOURCE_DIR), \
|
||||
COMMAND := $(CMAKE) -S . -B $(SLEEF_CROSS_BUILD_DIR) \
|
||||
-DCMAKE_C_COMPILER=$(CC) \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$(SLEEF_CMAKE_FILE) \
|
||||
-DNATIVE_BUILD_DIR=$(SLEEF_NATIVE_BUILD_DIR) \
|
||||
-DSLEEF_BUILD_INLINE_HEADERS=TRUE \
|
||||
$(EXTRA_CROSS_OPTIONS), \
|
||||
))
|
||||
|
||||
TARGETS := $(sleef_cross_config)
|
||||
|
||||
$(eval $(call SetupExecute, sleef_cross_build, \
|
||||
INFO := Building cross-compiling sleef, \
|
||||
DEPS := $(sleef_cross_config), \
|
||||
OUTPUT_DIR := $(SLEEF_NATIVE_BUILD_DIR), \
|
||||
WORKING_DIR := $(SLEEF_SOURCE_DIR), \
|
||||
COMMAND := $(CMAKE) --build $(SLEEF_CROSS_BUILD_DIR) -j, \
|
||||
))
|
||||
|
||||
TARGETS := $(sleef_cross_build)
|
||||
|
||||
$(CROSS_COMPILATION_SRC_FILES): $(sleef_cross_build)
|
||||
|
||||
# Finally, copy the generated files (and one needed static file) into our
|
||||
# target directory.
|
||||
|
||||
$(eval $(call SetupCopyFiles, copy_static_sleef_source, \
|
||||
FILES := $(SLEEF_SOURCE_DIR)/src/common/misc.h, \
|
||||
DEST := $(SLEEF_TARGET_DIR), \
|
||||
))
|
||||
|
||||
TARGETS := $(copy_static_sleef_source)
|
||||
|
||||
$(eval $(call SetupCopyFiles, copy_generated_sleef_source, \
|
||||
FILES := $(CROSS_COMPILATION_SRC_FILES), \
|
||||
DEST := $(SLEEF_TARGET_DIR), \
|
||||
))
|
||||
|
||||
TARGETS := $(copy_generated_sleef_source)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
107
make/UpdateX11Wrappers.gmk
Normal file
107
make/UpdateX11Wrappers.gmk
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#
|
||||
# Copyright (c) 2012, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This file is responsible for extracting the x11 native struct offsets to
|
||||
# the xawt Java library. The tool needs to be run on the os/arch that
|
||||
# will host the final jvm, thus the tool cannot be used when cross compiling.
|
||||
#
|
||||
# Two versions of the generated offset file, sizes-32.txt and sizes-64.txt are
|
||||
# committed into the source code repository. These are the ones used in
|
||||
# GensrcX11Wrappers.gmk to generate the Java code during the build.
|
||||
################################################################################
|
||||
|
||||
include Execute.gmk
|
||||
include JdkNativeCompilation.gmk
|
||||
include $(TOPDIR)/make/ToolsJdk.gmk
|
||||
|
||||
ifeq ($(COMPILE_TYPE), cross)
|
||||
$(error It is not possible to update the x11wrappers when cross-compiling)
|
||||
endif
|
||||
|
||||
BITS := $(OPENJDK_TARGET_CPU_BITS)
|
||||
|
||||
X11WRAPPERS_OUTPUT := $(SUPPORT_OUTPUTDIR)/x11wrappers
|
||||
GENERATOR_SOURCE_FILE := $(X11WRAPPERS_OUTPUT)/src/data_generator.c
|
||||
|
||||
GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/src/java.desktop/unix/data/x11wrappergen
|
||||
WRAPPER_OUTPUT_FILE := $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt
|
||||
|
||||
# Generate the C code for the program that will output the offset file.
|
||||
$(eval $(call SetupExecute, gensrc_generator, \
|
||||
INFO := Generating X11 wrapper data generator source code, \
|
||||
DEPS := $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BUILD_TOOLS_JDK), \
|
||||
OUTPUT_FILE := $(GENERATOR_SOURCE_FILE), \
|
||||
COMMAND := $(TOOL_WRAPPERGENERATOR) gen_c_source $(GENERATOR_SOURCE_FILE) \
|
||||
$(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BITS), \
|
||||
))
|
||||
|
||||
DATA_GENERATOR_INCLUDES := \
|
||||
-I$(TOPDIR)/src/hotspot/share/include \
|
||||
-I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
|
||||
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
|
||||
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
|
||||
-I$(TOPDIR)/src/java.base/share/native/libjava \
|
||||
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
|
||||
-I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
|
||||
-I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
|
||||
-I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
|
||||
#
|
||||
|
||||
################################################################################
|
||||
## Build data_generator
|
||||
################################################################################
|
||||
|
||||
# Compile the generated C code into an executable.
|
||||
$(eval $(call SetupJdkExecutable, BUILD_DATA_GENERATOR, \
|
||||
NAME := data_generator, \
|
||||
EXTRA_FILES := $(GENERATOR_SOURCE_FILE), \
|
||||
CFLAGS := $(X_CFLAGS) $(DATA_GENERATOR_INCLUDES), \
|
||||
LIBS := $(X_LIBS), \
|
||||
OUTPUT_DIR := $(X11WRAPPERS_OUTPUT)/bin, \
|
||||
OBJECT_DIR := $(X11WRAPPERS_OUTPUT)/objs, \
|
||||
))
|
||||
|
||||
# Run the executable to create the data file.
|
||||
$(eval $(call SetupExecute, run_wrappergen, \
|
||||
INFO := Generating X11 wrapper data files, \
|
||||
DEPS := $(BUILD_DATA_GENERATOR), \
|
||||
OUTPUT_FILE := $(WRAPPER_OUTPUT_FILE), \
|
||||
SUPPORT_DIR := $(X11WRAPPERS_OUTPUT)/run-wrapper, \
|
||||
COMMAND := $(BUILD_DATA_GENERATOR_TARGET) | $(SORT) > $(WRAPPER_OUTPUT_FILE), \
|
||||
))
|
||||
|
||||
wrapper-information: $(run_wrappergen)
|
||||
$(ECHO) IMPORTANT: If you update the X11 wrapper data files, they most certainly
|
||||
$(ECHO) need to be updated for both 32 and 64 bit platforms. You have now
|
||||
$(ECHO) updated them for $(BITS) bit platforms only.
|
||||
|
||||
TARGETS += $(run_wrappergen) wrapper-information
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
103
make/ZipSecurity.gmk
Normal file
103
make/ZipSecurity.gmk
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
#
|
||||
# Copyright (c) 2014, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include ZipArchive.gmk
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# sec-bin.zip is used by builds where the corresponding sources are not available
|
||||
#
|
||||
$(eval $(call SetupZipArchive, BUILD_SEC_BIN_ZIP, \
|
||||
SRC := $(JDK_OUTPUTDIR), \
|
||||
INCLUDES := \
|
||||
modules/java.base/javax/crypto \
|
||||
modules/java.base/javax/crypto/spec \
|
||||
modules/java.base/sun/security/internal/interfaces \
|
||||
modules/java.base/sun/security/internal/spec \
|
||||
modules/java.base/com/sun/crypto/provider \
|
||||
modules/jdk.crypto.mscapi/sun/security/mscapi \
|
||||
modules/jdk.crypto.cryptoki/sun/security/pkcs11 \
|
||||
modules/jdk.crypto.cryptoki/sun/security/pkcs11/wrapper \
|
||||
modules/java.base/javax/net \
|
||||
modules/java.base/javax/security/cert \
|
||||
modules/java.base/com/sun/net/ssl \
|
||||
modules/java.base/com/sun/security/cert \
|
||||
modules/java.base/sun/net/www/protocol/https \
|
||||
modules/java.base/sun/security/pkcs12 \
|
||||
modules/java.base/sun/security/ssl \
|
||||
modules/java.security.jgss/sun/security/krb5 \
|
||||
modules/java.security.jgss/sun/security/krb5/internal \
|
||||
modules/java.security.jgss/sun/security/krb5/internal/ccache \
|
||||
modules/java.security.jgss/sun/security/krb5/internal/crypto \
|
||||
modules/java.security.jgss/sun/security/krb5/internal/ktab \
|
||||
modules/java.security.jgss/sun/security/krb5/internal/rcache \
|
||||
modules/java.security.jgss/sun/security/krb5/internal/util, \
|
||||
INCLUDE_FILES := modules/java.security.jgss/sun/security/jgss/spi/GSSContextSpi.class, \
|
||||
EXCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
|
||||
ZIP := $(IMAGES_OUTPUTDIR)/sec-bin.zip, \
|
||||
))
|
||||
|
||||
TARGETS += $(IMAGES_OUTPUTDIR)/sec-bin.zip
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Windows specific binary security packages.
|
||||
#
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
# sec-windows-bin.zip is used by builds where the corresponding sources are not available
|
||||
$(eval $(call SetupZipArchive, BUILD_SEC_WINDOWS_BIN_ZIP, \
|
||||
SRC := $(JDK_OUTPUTDIR), \
|
||||
INCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
|
||||
ZIP := $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip, \
|
||||
))
|
||||
|
||||
TARGETS += $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip
|
||||
|
||||
# JGSS files contain the native Kerberos library
|
||||
ifeq ($(call isTargetCpu, x86_64), true)
|
||||
JGSS_ZIP_NAME = jgss-windows-x64-bin.zip
|
||||
else
|
||||
JGSS_ZIP_NAME = jgss-windows-i586-bin.zip
|
||||
endif
|
||||
|
||||
$(eval $(call SetupZipArchive, BUILD_JGSS_BIN_ZIP, \
|
||||
SRC := $(SUPPORT_OUTPUTDIR), \
|
||||
INCLUDE_FILES := modules_libs/java.security.jgss/w2k_lsa_auth.dll \
|
||||
modules_libs/java.security.jgss/w2k_lsa_auth.dll.diz \
|
||||
modules_libs/java.security.jgss/w2k_lsa_auth.dll.map \
|
||||
modules_libs/java.security.jgss/w2k_lsa_auth.dll.pdb, \
|
||||
ZIP := $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME), \
|
||||
))
|
||||
|
||||
TARGETS += $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
99
make/ZipSource.gmk
Normal file
99
make/ZipSource.gmk
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
#
|
||||
# Copyright (c) 2014, 2025, 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 MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include Modules.gmk
|
||||
include ZipArchive.gmk
|
||||
|
||||
SRC_ZIP_WORK_DIR := $(SUPPORT_OUTPUTDIR)/src
|
||||
$(if $(filter $(TOPDIR)/%, $(SUPPORT_OUTPUTDIR)), $(eval SRC_ZIP_BASE := $(TOPDIR)), $(eval SRC_ZIP_BASE := $(SUPPORT_OUTPUTDIR)))
|
||||
|
||||
################################################################################
|
||||
# Create the directory structure for src.zip using symlinks.
|
||||
# <module>/<package>/<file>.java
|
||||
|
||||
ALL_MODULES := $(FindAllModules)
|
||||
|
||||
# Generate the src dirs in the first make invocation and then call this makefile
|
||||
# again to create src.zip.
|
||||
$(foreach m, $(ALL_MODULES), \
|
||||
$(foreach d, $(call FindModuleSrcDirs, $m), \
|
||||
$(eval $d_TARGET := $(SRC_ZIP_WORK_DIR)/$(patsubst $(TOPDIR)/%,%,$(patsubst $(SUPPORT_OUTPUTDIR)/%,%,$d))/$m) \
|
||||
$(if $(SRC_GENERATED), , \
|
||||
$(eval $$($d_TARGET): $d ; \
|
||||
$$(if $(filter $(SRC_ZIP_BASE)/%, $d), $$(link-file-relative), $$(link-file-absolute)) \
|
||||
) \
|
||||
) \
|
||||
$(eval SRC_ZIP_SRCS += $$($d_TARGET)) \
|
||||
$(eval SRC_ZIP_SRCS_$m += $$($d_TARGET)) \
|
||||
) \
|
||||
)
|
||||
|
||||
TARGETS += $(SRC_ZIP_SRCS)
|
||||
|
||||
################################################################################
|
||||
# Only evaluate the creation of src.zip in a sub make call when the symlinked
|
||||
# src directory structure has been generated.
|
||||
ifeq ($(SRC_GENERATED), true)
|
||||
|
||||
# Rewrite the EXCLUDE_TRANSLATIONS locales as exclude patters for java files
|
||||
TRANSLATIONS_PATTERN := $(addprefix %_, $(addsuffix .java, $(EXCLUDE_TRANSLATIONS)))
|
||||
|
||||
# Add excludes for translations for all modules except jdk.localedata
|
||||
$(foreach s, $(SRC_ZIP_SRCS), \
|
||||
$(if $(filter $(notdir $s), jdk.localedata), , \
|
||||
$(eval BUILD_SRC_ZIP_EXCLUDE_PATTERNS_$(dir $s) := $$(TRANSLATIONS_PATTERN)) \
|
||||
) \
|
||||
)
|
||||
|
||||
$(eval $(call SetupZipArchive, BUILD_SRC_ZIP, \
|
||||
SRC := $(dir $(SRC_ZIP_SRCS)), \
|
||||
INCLUDES := $(SRC_ZIP_INCLUDES), \
|
||||
INCLUDE_FILES := $(SRC_ZIP_INCLUDE_FILES), \
|
||||
EXCLUDES := $(SRC_ZIP_EXCLUDES), \
|
||||
EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \
|
||||
SUFFIXES := .java, \
|
||||
ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \
|
||||
FOLLOW_SYMLINKS := true, \
|
||||
))
|
||||
|
||||
do-zip: $(BUILD_SRC_ZIP)
|
||||
|
||||
.PHONY: do-zip
|
||||
endif
|
||||
|
||||
zip: $(SRC_ZIP_SRCS)
|
||||
+$(MAKE) $(MAKE_ARGS) -f ZipSource.gmk do-zip SRC_GENERATED=true
|
||||
|
||||
TARGETS += zip
|
||||
|
||||
.PHONY: zip
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
27
make/autoconf/Makefile.template
Normal file
27
make/autoconf/Makefile.template
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2024, 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 Makefile was generated by configure @DATE_WHEN_CONFIGURED@
|
||||
# GENERATED FILE, DO NOT EDIT
|
||||
SPEC := @OUTPUTDIR@/spec.gmk
|
||||
include @WORKSPACE_ROOT@/Makefile
|
||||
645
make/autoconf/basic.m4
Normal file
645
make/autoconf/basic.m4
Normal file
|
|
@ -0,0 +1,645 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
m4_include([basic_tools.m4])
|
||||
m4_include([basic_windows.m4])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([BASIC_INIT],
|
||||
[
|
||||
# Save the original command line. This is passed to us by the wrapper configure script.
|
||||
AC_SUBST(CONFIGURE_COMMAND_LINE)
|
||||
# We might have the original command line if the wrapper was called by some
|
||||
# other script.
|
||||
AC_SUBST(REAL_CONFIGURE_COMMAND_EXEC_SHORT)
|
||||
AC_SUBST(REAL_CONFIGURE_COMMAND_EXEC_FULL)
|
||||
AC_SUBST(REAL_CONFIGURE_COMMAND_LINE)
|
||||
# AUTOCONF might be set in the environment by the user. Preserve for "make reconfigure".
|
||||
AC_SUBST(AUTOCONF)
|
||||
# Save the path variable before it gets changed
|
||||
ORIGINAL_PATH="$PATH"
|
||||
AC_SUBST(ORIGINAL_PATH)
|
||||
DATE_WHEN_CONFIGURED=`date`
|
||||
AC_SUBST(DATE_WHEN_CONFIGURED)
|
||||
AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check that there are no unprocessed overridden variables left.
|
||||
# If so, they are an incorrect argument and we will exit with an error.
|
||||
AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN],
|
||||
[
|
||||
if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then
|
||||
# Replace the separating ! with spaces before presenting for end user.
|
||||
unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ }
|
||||
AC_MSG_WARN([The following variables might be unknown to configure: $unknown_variables])
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
|
||||
# Make sure to only use tools set up in BASIC_SETUP_FUNDAMENTAL_TOOLS.
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
|
||||
[
|
||||
# Save the current directory this script was started from
|
||||
CONFIGURE_START_DIR="$PWD"
|
||||
|
||||
# We might need to rewrite ORIGINAL_PATH, if it includes "#", to quote them
|
||||
# for make. We couldn't do this when we retrieved ORIGINAL_PATH, since SED
|
||||
# was not available at that time.
|
||||
REWRITTEN_PATH=`$ECHO "$ORIGINAL_PATH" | $SED -e 's/#/\\\\#/g'`
|
||||
if test "x$REWRITTEN_PATH" != "x$ORIGINAL_PATH"; then
|
||||
ORIGINAL_PATH="$REWRITTEN_PATH"
|
||||
AC_MSG_NOTICE([Rewriting ORIGINAL_PATH to $REWRITTEN_PATH])
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86 && test "x$with_jvm_variants" != xzero; then
|
||||
AC_MSG_ERROR([32-bit x86 builds are not supported])
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
|
||||
BASIC_SETUP_PATHS_WINDOWS
|
||||
fi
|
||||
|
||||
# We get the top-level directory from the supporting wrappers.
|
||||
BASIC_WINDOWS_VERIFY_DIR($TOPDIR, source)
|
||||
orig_topdir="$TOPDIR"
|
||||
UTIL_FIXUP_PATH(TOPDIR)
|
||||
AC_MSG_CHECKING([for top-level directory])
|
||||
AC_MSG_RESULT([$TOPDIR])
|
||||
if test "x$TOPDIR" != "x$orig_topdir"; then
|
||||
AC_MSG_WARN([Your top dir was originally represented as $orig_topdir,])
|
||||
AC_MSG_WARN([but after rewriting it became $TOPDIR.])
|
||||
AC_MSG_WARN([This typically means you have characters like space in the path, which can cause all kind of trouble.])
|
||||
fi
|
||||
AC_SUBST(TOPDIR)
|
||||
|
||||
if test "x$CUSTOM_ROOT" != x; then
|
||||
BASIC_WINDOWS_VERIFY_DIR($CUSTOM_ROOT, custom root)
|
||||
UTIL_FIXUP_PATH(CUSTOM_ROOT)
|
||||
WORKSPACE_ROOT="${CUSTOM_ROOT}"
|
||||
else
|
||||
WORKSPACE_ROOT="${TOPDIR}"
|
||||
fi
|
||||
AC_SUBST(WORKSPACE_ROOT)
|
||||
|
||||
UTIL_FIXUP_PATH(CONFIGURE_START_DIR)
|
||||
AC_SUBST(CONFIGURE_START_DIR)
|
||||
|
||||
# Locate the directory of this script.
|
||||
AUTOCONF_DIR=$TOPDIR/make/autoconf
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup what kind of build environment type we have (CI or local developer)
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_BUILD_ENV],
|
||||
[
|
||||
if test "x$CI" = "xtrue"; then
|
||||
DEFAULT_BUILD_ENV="ci"
|
||||
AC_MSG_NOTICE([CI environment variable set to $CI])
|
||||
else
|
||||
DEFAULT_BUILD_ENV="dev"
|
||||
fi
|
||||
|
||||
UTIL_ARG_WITH(NAME: build-env, TYPE: literal,
|
||||
RESULT: BUILD_ENV,
|
||||
VALID_VALUES: [auto dev ci], DEFAULT: auto,
|
||||
CHECKING_MSG: [for build environment type],
|
||||
DESC: [select build environment type (affects certain default values)],
|
||||
IF_AUTO: [
|
||||
RESULT=$DEFAULT_BUILD_ENV
|
||||
]
|
||||
)
|
||||
AC_SUBST(BUILD_ENV)
|
||||
|
||||
AC_MSG_CHECKING([for locale to use])
|
||||
if test "x$LOCALE" != x; then
|
||||
# Check if we actually have C.UTF-8; if so, use it
|
||||
if $LOCALE -a | $GREP -q -E "^C\.(utf8|UTF-8)$"; then
|
||||
LOCALE_USED=C.UTF-8
|
||||
AC_MSG_RESULT([C.UTF-8 (recommended)])
|
||||
elif $LOCALE -a | $GREP -q -E "^en_US\.(utf8|UTF-8)$"; then
|
||||
LOCALE_USED=en_US.UTF-8
|
||||
AC_MSG_RESULT([en_US.UTF-8 (acceptable fallback)])
|
||||
else
|
||||
# As a fallback, check if users locale is UTF-8. USER_LOCALE was saved
|
||||
# by the wrapper configure script before autconf messed up LC_ALL.
|
||||
if $ECHO $USER_LOCALE | $GREP -q -E "\.(utf8|UTF-8)$"; then
|
||||
LOCALE_USED=$USER_LOCALE
|
||||
AC_MSG_RESULT([$USER_LOCALE (untested fallback)])
|
||||
AC_MSG_WARN([Could not find C.UTF-8 or en_US.UTF-8 locale. This is not supported, and the build might fail unexpectedly.])
|
||||
else
|
||||
AC_MSG_RESULT([no UTF-8 locale found])
|
||||
AC_MSG_WARN([No UTF-8 locale found. This is not supported. Proceeding with the C locale, but the build might fail unexpectedly.])
|
||||
LOCALE_USED=C
|
||||
fi
|
||||
AC_MSG_NOTICE([The recommended locale is C.UTF-8, but en_US.UTF-8 is also accepted.])
|
||||
fi
|
||||
else
|
||||
LOCALE_USED=C.UTF-8
|
||||
AC_MSG_RESULT([C.UTF-8 (default)])
|
||||
AC_MSG_WARN([locale command not not found, using C.UTF-8 locale])
|
||||
fi
|
||||
|
||||
export LC_ALL=$LOCALE_USED
|
||||
AC_SUBST(LOCALE_USED)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Evaluates platform specific overrides for devkit variables.
|
||||
# $1: Name of variable
|
||||
AC_DEFUN([BASIC_EVAL_DEVKIT_VARIABLE],
|
||||
[
|
||||
if test "x[$]$1" = x; then
|
||||
eval $1="\${$1_${OPENJDK_TARGET_CPU}}"
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Evaluates platform specific overrides for build devkit variables.
|
||||
# $1: Name of variable
|
||||
AC_DEFUN([BASIC_EVAL_BUILD_DEVKIT_VARIABLE],
|
||||
[
|
||||
if test "x[$]$1" = x; then
|
||||
eval $1="\${$1_${OPENJDK_BUILD_CPU}}"
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN([BASIC_SETUP_XCODE_SYSROOT],
|
||||
[
|
||||
AC_MSG_CHECKING([for sdk name])
|
||||
AC_ARG_WITH([sdk-name], [AS_HELP_STRING([--with-sdk-name],
|
||||
[use the Xcode platform SDK of the given name. @<:@macosx@:>@])],
|
||||
[SDK_NAME=$with_sdk_name]
|
||||
)
|
||||
if test "x$SDK_NAME" = x; then
|
||||
SDK_NAME=macosx
|
||||
fi
|
||||
AC_MSG_RESULT([$SDK_NAME])
|
||||
|
||||
if test "x$DEVKIT_ROOT" != x; then
|
||||
# We need to use xcodebuild from the devkit, if provided
|
||||
UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild, $DEVKIT_TOOLCHAIN_PATH)
|
||||
if test "x$XCODEBUILD" = x; then
|
||||
AC_MSG_ERROR([No xcodebuild tool found in the provided devkit])
|
||||
fi
|
||||
XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1`
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_ERROR([The xcodebuild tool in the devkit reports an error: $XCODEBUILD_OUTPUT])
|
||||
fi
|
||||
else
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(XCODEBUILD, xcodebuild)
|
||||
if test "x$XCODEBUILD" != x; then
|
||||
XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1`
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_WARN([Ignoring the located xcodebuild tool $XCODEBUILD due to an error: $XCODEBUILD_OUTPUT])
|
||||
XCODEBUILD=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$SYSROOT" != x; then
|
||||
if ! test -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
|
||||
AC_MSG_ERROR([Invalid sysroot, framework headers not found])
|
||||
fi
|
||||
if test "x$with_sdk_name" != x; then
|
||||
AC_MSG_WARN([--with-sdk-name will be ignored since a sysroot or devkit is provided])
|
||||
fi
|
||||
AC_MSG_NOTICE([Setting sysroot from devkit or --with-sysroot])
|
||||
else
|
||||
if test "x$XCODEBUILD" != x; then
|
||||
SYSROOT=`"$XCODEBUILD" -sdk "$SDK_NAME" -version | $GREP '^Path: ' | $SED 's/Path: //'`
|
||||
if test "x$SYSROOT" = x; then
|
||||
AC_MSG_ERROR([No sysroot found for SDK $SDK_NAME from xcodebuild. Check your Xcode installation.])
|
||||
fi
|
||||
if ! test -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
|
||||
AC_MSG_ERROR([Unable to find required framework headers, provide a path to an SDK via --with-sysroot or --with-sdk-name and be sure Xcode is installed properly])
|
||||
fi
|
||||
AC_MSG_NOTICE([Setting sysroot from xcodebuild with SDK $SDK_NAME])
|
||||
else
|
||||
UTIL_LOOKUP_PROGS(XCRUN, xcrun)
|
||||
if test "x$XCRUN" != x; then
|
||||
XCRUN_SDK_PATH=`"$XCRUN" --show-sdk-path -sdk "$SDK_NAME"`
|
||||
fi
|
||||
|
||||
if test "x$XCRUN_SDK_PATH" != x && test -f "$XCRUN_SDK_PATH/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
|
||||
AC_MSG_NOTICE([Setting sysroot from xcrun with SDK $SDK_NAME])
|
||||
SYSROOT="$XCRUN_SDK_PATH"
|
||||
elif test -f /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h; then
|
||||
AC_MSG_WARN([No devkit provided and no xcodebuild found. Proceeding using system headers.])
|
||||
if test "x$with_sdk_name" != x; then
|
||||
AC_MSG_WARN([--with-sdk-name will be ignored since no xcodebuild could be found])
|
||||
fi
|
||||
else
|
||||
AC_MSG_NOTICE([No devkit provided, no xcodebuild tool and no system headers found in the system.])
|
||||
AC_MSG_NOTICE([Check that Xcode is properly installed, or set a devkit with --with-devkit,])
|
||||
AC_MSG_NOTICE([or override SDK selection using --with-sysroot or --with-sdk-name.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
|
||||
[
|
||||
AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
|
||||
[use this devkit for compilers, tools and resources])])
|
||||
|
||||
if test "x$with_devkit" = xyes; then
|
||||
AC_MSG_ERROR([--with-devkit must have a value])
|
||||
elif test "x$with_devkit" != x && test "x$with_devkit" != xno; then
|
||||
UTIL_FIXUP_PATH([with_devkit])
|
||||
DEVKIT_ROOT="$with_devkit"
|
||||
# Check for a meta data info file in the root of the devkit
|
||||
if test -f "$DEVKIT_ROOT/devkit.info"; then
|
||||
. $DEVKIT_ROOT/devkit.info
|
||||
# This potentially sets the following:
|
||||
# A descriptive name of the devkit
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_NAME])
|
||||
# Corresponds to --with-extra-path
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_EXTRA_PATH])
|
||||
# Corresponds to --with-toolchain-path
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_TOOLCHAIN_PATH])
|
||||
# Corresponds to --with-sysroot
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_SYSROOT])
|
||||
|
||||
# Identifies the Visual Studio version in the devkit
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_VERSION])
|
||||
# The Visual Studio include environment variable
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_INCLUDE])
|
||||
# The Visual Studio lib environment variable
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB])
|
||||
# Corresponds to --with-msvcr-dll
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL])
|
||||
# Corresponds to --with-vcruntime-1-dll
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VCRUNTIME_1_DLL])
|
||||
# Corresponds to --with-msvcp-dll
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL])
|
||||
# Corresponds to --with-ucrt-dll-dir
|
||||
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_UCRT_DLL_DIR])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for devkit])
|
||||
if test "x$DEVKIT_NAME" != x; then
|
||||
AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT])
|
||||
else
|
||||
AC_MSG_RESULT([$DEVKIT_ROOT])
|
||||
fi
|
||||
|
||||
UTIL_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH)
|
||||
|
||||
# Fallback default of just /bin if DEVKIT_PATH is not defined
|
||||
if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
|
||||
DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
|
||||
fi
|
||||
UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH)
|
||||
|
||||
# If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
|
||||
# places for backwards compatibility.
|
||||
if test "x$DEVKIT_SYSROOT" != x; then
|
||||
SYSROOT="$DEVKIT_SYSROOT"
|
||||
elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
|
||||
SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
|
||||
elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
|
||||
SYSROOT="$DEVKIT_ROOT/$host/sys-root"
|
||||
fi
|
||||
|
||||
if test "x$DEVKIT_ROOT" != x; then
|
||||
DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib"
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64"
|
||||
fi
|
||||
AC_SUBST(DEVKIT_LIB_DIR)
|
||||
fi
|
||||
fi
|
||||
|
||||
# You can force the sysroot if the sysroot encoded into the compiler tools
|
||||
# is not correct.
|
||||
AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot],
|
||||
[use this directory as sysroot])],
|
||||
[SYSROOT=$with_sysroot]
|
||||
)
|
||||
|
||||
AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path],
|
||||
[prepend these directories when searching for toolchain binaries (compilers etc)])],
|
||||
[UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)]
|
||||
)
|
||||
|
||||
AC_ARG_WITH([xcode-path], [AS_HELP_STRING([--with-xcode-path],
|
||||
[set up toolchain on Mac OS using a path to an Xcode installation])])
|
||||
|
||||
UTIL_DEPRECATED_ARG_WITH(sys-root)
|
||||
|
||||
AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
|
||||
[Point to a nonstandard Visual Studio installation location on Windows by
|
||||
specifying any existing directory 2 or 3 levels below the installation
|
||||
root.])]
|
||||
)
|
||||
|
||||
if test "x$with_xcode_path" != x; then
|
||||
if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
|
||||
UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],
|
||||
$with_xcode_path/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$with_xcode_path/Contents/Developer/usr/bin)
|
||||
else
|
||||
AC_MSG_WARN([Option --with-xcode-path is only valid on Mac OS, ignoring.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for toolchain path])
|
||||
AC_MSG_RESULT([$TOOLCHAIN_PATH])
|
||||
AC_SUBST(TOOLCHAIN_PATH)
|
||||
|
||||
AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path],
|
||||
[prepend these directories to the default path])],
|
||||
[UTIL_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
|
||||
)
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
|
||||
BASIC_SETUP_XCODE_SYSROOT
|
||||
fi
|
||||
|
||||
# Prepend the extra path to the global path
|
||||
UTIL_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
|
||||
|
||||
UTIL_FIXUP_PATH([SYSROOT])
|
||||
|
||||
AC_MSG_CHECKING([for sysroot])
|
||||
AC_MSG_RESULT([$SYSROOT])
|
||||
AC_SUBST(SYSROOT)
|
||||
|
||||
AC_MSG_CHECKING([for extra path])
|
||||
AC_MSG_RESULT([$EXTRA_PATH])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
|
||||
[
|
||||
|
||||
AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
|
||||
[use this as the name of the configuration @<:@generated from important configuration options@:>@])],
|
||||
[ CONF_NAME=${with_conf_name} ])
|
||||
|
||||
# Test from where we are running configure, in or outside of src root.
|
||||
if test "x$OPENJDK_BUILD_OS" = xwindows || test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
|
||||
# These systems have case insensitive paths, so convert them to lower case.
|
||||
[ cmp_configure_start_dir=`$ECHO $CONFIGURE_START_DIR | $TR '[:upper:]' '[:lower:]'` ]
|
||||
[ cmp_topdir=`$ECHO $TOPDIR | $TR '[:upper:]' '[:lower:]'` ]
|
||||
[ cmp_custom_root=`$ECHO $CUSTOM_ROOT | $TR '[:upper:]' '[:lower:]'` ]
|
||||
else
|
||||
cmp_configure_start_dir="$CONFIGURE_START_DIR"
|
||||
cmp_topdir="$TOPDIR"
|
||||
cmp_custom_root="$CUSTOM_ROOT"
|
||||
fi
|
||||
AC_MSG_CHECKING([where to store configuration])
|
||||
if test "x$cmp_configure_start_dir" = "x$cmp_topdir" \
|
||||
|| test "x$cmp_configure_start_dir" = "x$cmp_custom_root" \
|
||||
|| test "x$cmp_configure_start_dir" = "x$cmp_topdir/make/autoconf" \
|
||||
|| test "x$cmp_configure_start_dir" = "x$cmp_topdir/make" ; then
|
||||
# We are running configure from the src root.
|
||||
# Create a default ./build/target-variant-debuglevel output root.
|
||||
if test "x${CONF_NAME}" = x; then
|
||||
AC_MSG_RESULT([in default location])
|
||||
CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JVM_VARIANTS_WITH_AND}-${DEBUG_LEVEL}"
|
||||
else
|
||||
AC_MSG_RESULT([in build directory with custom name])
|
||||
fi
|
||||
|
||||
OUTPUTDIR="${WORKSPACE_ROOT}/build/${CONF_NAME}"
|
||||
$MKDIR -p "$OUTPUTDIR"
|
||||
if test ! -d "$OUTPUTDIR"; then
|
||||
AC_MSG_ERROR([Could not create build directory $OUTPUTDIR])
|
||||
fi
|
||||
else
|
||||
# We are running configure from outside of the src dir.
|
||||
# Then use the current directory as output dir!
|
||||
# If configuration is situated in normal build directory, just use the build
|
||||
# directory name as configuration name, otherwise use the complete path.
|
||||
if test "x${CONF_NAME}" = x; then
|
||||
[ if [[ "$cmp_configure_start_dir" =~ ^${cmp_topdir}/build/[^/]+$ ||
|
||||
"$cmp_configure_start_dir" =~ ^${cmp_custom_root}/build/[^/]+$ ]]; then ]
|
||||
CONF_NAME="${CONFIGURE_START_DIR##*/}"
|
||||
else
|
||||
CONF_NAME="$CONFIGURE_START_DIR"
|
||||
fi
|
||||
fi
|
||||
OUTPUTDIR="$CONFIGURE_START_DIR"
|
||||
AC_MSG_RESULT([in current directory])
|
||||
|
||||
# WARNING: This might be a bad thing to do. You need to be sure you want to
|
||||
# have a configuration in this directory. Do some sanity checks!
|
||||
|
||||
if test ! -e "$OUTPUTDIR/spec.gmk" && test ! -e "$OUTPUTDIR/configure-support/generated-configure.sh"; then
|
||||
# If we have a spec.gmk or configure-support/generated-configure.sh,
|
||||
# we have run here before and we are OK. Otherwise, check for other files
|
||||
files_present=`$LS $OUTPUTDIR`
|
||||
# Configure has already touched config.log and confdefs.h in the current dir when this check
|
||||
# is performed.
|
||||
filtered_files=`$ECHO "$files_present" \
|
||||
| $SED -e 's/config.log//g' \
|
||||
-e 's/configure.log//g' \
|
||||
-e 's/confdefs.h//g' \
|
||||
-e 's/configure-support//g' \
|
||||
-e 's/ //g' \
|
||||
| $TR -d '\n'`
|
||||
if test "x$filtered_files" != x; then
|
||||
AC_MSG_NOTICE([Current directory is $CONFIGURE_START_DIR.])
|
||||
AC_MSG_NOTICE([Since this is not the source root, configure will output the configuration here])
|
||||
AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).])
|
||||
AC_MSG_NOTICE([However, this directory is not empty, additionally to some allowed files])
|
||||
AC_MSG_NOTICE([it contains $filtered_files.])
|
||||
AC_MSG_NOTICE([This is not allowed, since it could seriously mess up just about everything.])
|
||||
AC_MSG_NOTICE([Try 'cd $TOPDIR' and restart configure])
|
||||
AC_MSG_NOTICE([(or create a new empty directory and cd to it).])
|
||||
AC_MSG_ERROR([Will not continue creating configuration in $CONFIGURE_START_DIR])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_MSG_CHECKING([what configuration name to use])
|
||||
AC_MSG_RESULT([$CONF_NAME])
|
||||
|
||||
BASIC_WINDOWS_VERIFY_DIR($OUTPUTDIR, output)
|
||||
UTIL_FIXUP_PATH(OUTPUTDIR)
|
||||
|
||||
CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support"
|
||||
$MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
|
||||
|
||||
SPEC="$OUTPUTDIR/spec.gmk"
|
||||
AC_SUBST(SPEC)
|
||||
AC_SUBST(CONF_NAME)
|
||||
AC_SUBST(OUTPUTDIR)
|
||||
AC_SUBST(CONFIGURESUPPORT_OUTPUTDIR)
|
||||
|
||||
# The spec.gmk file contains all variables for the make system.
|
||||
AC_CONFIG_FILES([$OUTPUTDIR/spec.gmk:$AUTOCONF_DIR/spec.gmk.template])
|
||||
# The bootcycle-spec.gmk file contains support for boot cycle builds.
|
||||
AC_CONFIG_FILES([$OUTPUTDIR/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.template])
|
||||
# The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling.
|
||||
AC_CONFIG_FILES([$OUTPUTDIR/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.template])
|
||||
# The compare.sh is used to compare the build output to other builds.
|
||||
AC_CONFIG_FILES([$OUTPUTDIR/compare.sh:$AUTOCONF_DIR/compare.sh.template])
|
||||
# The generated Makefile knows where the spec.gmk is and where the source is.
|
||||
# You can run make from the OUTPUTDIR, or from the top-level Makefile
|
||||
# which will look for generated configurations
|
||||
AC_CONFIG_FILES([$OUTPUTDIR/Makefile:$AUTOCONF_DIR/Makefile.template])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if build directory is on local disk. If not possible to determine,
|
||||
# we prefer to claim it's local.
|
||||
# Argument 1: directory to test
|
||||
# Argument 2: what to do if it is on local disk
|
||||
# Argument 3: what to do otherwise (remote disk or failure)
|
||||
AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
|
||||
[
|
||||
# df -l lists only local disks; if the given directory is not found then
|
||||
# a non-zero exit code is given
|
||||
if test "x$DF" = x; then
|
||||
# No df here, say it's local
|
||||
$2
|
||||
else
|
||||
# JDK-8189619
|
||||
# df on AIX does not understand -l. On modern AIXes it understands "-T local" which
|
||||
# is the same. On older AIXes we just continue to live with a "not local build" warning.
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
if $DF -T local > /dev/null 2>&1; then
|
||||
DF_LOCAL_ONLY_OPTION='-T local'
|
||||
else # AIX may use GNU-utils instead
|
||||
DF_LOCAL_ONLY_OPTION='-l'
|
||||
fi
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1"; then
|
||||
# In WSL1, we can only build on a drvfs file system (that is, a mounted real Windows drive)
|
||||
DF_LOCAL_ONLY_OPTION='-t drvfs'
|
||||
else
|
||||
DF_LOCAL_ONLY_OPTION='-l'
|
||||
fi
|
||||
if $DF $DF_LOCAL_ONLY_OPTION $1 > /dev/null 2>&1; then
|
||||
$2
|
||||
else
|
||||
$3
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check that source files have basic read permissions set. This might
|
||||
# not be the case in cygwin in certain conditions.
|
||||
AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
|
||||
[
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
# The choice of file here is somewhat arbitrary, it just needs to be there
|
||||
# in the source tree when configure runs
|
||||
file_to_test="$TOPDIR/Makefile"
|
||||
if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
|
||||
AC_MSG_ERROR([Bad file permissions on src files. This is usually caused by cloning the repositories with non cygwin tools in a directory not created in cygwin.])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
|
||||
[
|
||||
AC_MSG_CHECKING([if build directory is on local disk])
|
||||
BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUTDIR,
|
||||
[OUTPUT_DIR_IS_LOCAL="yes"],
|
||||
[OUTPUT_DIR_IS_LOCAL="no"])
|
||||
AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
|
||||
|
||||
BASIC_CHECK_SRC_PERMS
|
||||
|
||||
# Before generating output files, test if they exist. If they do, this is a reconfigure.
|
||||
# Since we can't properly handle the dependencies for this, warn the user about the situation
|
||||
if test -e $OUTPUTDIR/spec.gmk; then
|
||||
IS_RECONFIGURE=yes
|
||||
else
|
||||
IS_RECONFIGURE=no
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Default make target
|
||||
#
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_MAKE_TARGET],
|
||||
[
|
||||
AC_ARG_WITH(default-make-target, [AS_HELP_STRING([--with-default-make-target],
|
||||
[set the default make target @<:@exploded-image@:>@])])
|
||||
if test "x$with_default_make_target" = "x" \
|
||||
|| test "x$with_default_make_target" = "xyes"; then
|
||||
DEFAULT_MAKE_TARGET="exploded-image"
|
||||
elif test "x$with_default_make_target" = "xno"; then
|
||||
AC_MSG_ERROR([--without-default-make-target is not a valid option])
|
||||
else
|
||||
DEFAULT_MAKE_TARGET="$with_default_make_target"
|
||||
fi
|
||||
|
||||
AC_SUBST(DEFAULT_MAKE_TARGET)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup the default value for LOG=
|
||||
#
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_LOG],
|
||||
[
|
||||
AC_ARG_WITH(log, [AS_HELP_STRING([--with-log],
|
||||
[[default value for make LOG argument [warn]]])])
|
||||
AC_MSG_CHECKING([for default LOG value])
|
||||
if test "x$with_log" = x; then
|
||||
DEFAULT_LOG=""
|
||||
else
|
||||
# Syntax for valid LOG options is a bit too complex for it to be worth
|
||||
# implementing a test for correctness in configure. Just accept it.
|
||||
DEFAULT_LOG=$with_log
|
||||
fi
|
||||
AC_MSG_RESULT([$DEFAULT_LOG])
|
||||
AC_SUBST(DEFAULT_LOG)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Code to run after AC_OUTPUT
|
||||
AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
|
||||
[
|
||||
# Try to move config.log (generated by autoconf) to the configure-support directory.
|
||||
if test -e ./config.log; then
|
||||
$MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
|
||||
fi
|
||||
|
||||
# Rotate our log file (configure.log)
|
||||
if test -e "$OUTPUTDIR/configure.log.old"; then
|
||||
$RM -f "$OUTPUTDIR/configure.log.old"
|
||||
fi
|
||||
if test -e "$OUTPUTDIR/configure.log"; then
|
||||
$MV -f "$OUTPUTDIR/configure.log" "$OUTPUTDIR/configure.log.old" 2> /dev/null
|
||||
fi
|
||||
|
||||
# Move configure.log from current directory to the build output root
|
||||
if test -e ./configure.log; then
|
||||
$MV -f ./configure.log "$OUTPUTDIR/configure.log" 2> /dev/null
|
||||
fi
|
||||
|
||||
# Make the compare script executable
|
||||
$CHMOD +x $OUTPUTDIR/compare.sh
|
||||
])
|
||||
480
make/autoconf/basic_tools.m4
Normal file
480
make/autoconf/basic_tools.m4
Normal file
|
|
@ -0,0 +1,480 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2026, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# It is recommended to use exactly this version of pandoc, especially for
|
||||
# re-generating checked in html files
|
||||
RECOMMENDED_PANDOC_VERSION=2.19.2
|
||||
|
||||
################################################################################
|
||||
# Setup the most fundamental tools, used for setting up build platform and
|
||||
# path handling.
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
|
||||
[
|
||||
# Bootstrapping: These tools are needed by UTIL_LOOKUP_PROGS
|
||||
AC_PATH_PROGS(BASENAME, basename)
|
||||
UTIL_CHECK_NONEMPTY(BASENAME)
|
||||
AC_PATH_PROGS(DIRNAME, dirname)
|
||||
UTIL_CHECK_NONEMPTY(DIRNAME)
|
||||
AC_PATH_PROGS(FILE, file)
|
||||
UTIL_CHECK_NONEMPTY(FILE)
|
||||
AC_PATH_PROGS(LDD, ldd)
|
||||
|
||||
# Required tools
|
||||
UTIL_REQUIRE_PROGS(ECHO, echo)
|
||||
UTIL_REQUIRE_PROGS(TR, tr)
|
||||
UTIL_REQUIRE_PROGS(UNAME, uname)
|
||||
UTIL_REQUIRE_PROGS(WC, wc)
|
||||
|
||||
# Required tools with some special treatment
|
||||
UTIL_REQUIRE_SPECIAL(GREP, [AC_PROG_GREP])
|
||||
UTIL_REQUIRE_SPECIAL(EGREP, [AC_PROG_EGREP])
|
||||
UTIL_REQUIRE_SPECIAL(SED, [AC_PROG_SED])
|
||||
|
||||
# Tools only needed on some platforms
|
||||
UTIL_LOOKUP_PROGS(LOCALE, locale)
|
||||
UTIL_LOOKUP_PROGS(PATHTOOL, cygpath wslpath)
|
||||
UTIL_LOOKUP_PROGS(CMD, cmd.exe, $PATH:/cygdrive/c/windows/system32:/mnt/c/windows/system32:/c/windows/system32)
|
||||
UTIL_LOOKUP_PROGS(LSB_RELEASE, lsb_release)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup further tools that should be resolved early but after setting up
|
||||
# build platform and path handling.
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_TOOLS],
|
||||
[
|
||||
# Required tools
|
||||
UTIL_REQUIRE_PROGS(BASH, bash)
|
||||
UTIL_REQUIRE_PROGS(CAT, cat)
|
||||
UTIL_REQUIRE_PROGS(CHMOD, chmod)
|
||||
UTIL_REQUIRE_PROGS(CP, cp)
|
||||
UTIL_REQUIRE_PROGS(CUT, cut)
|
||||
UTIL_REQUIRE_PROGS(DATE, date)
|
||||
UTIL_REQUIRE_PROGS(DIFF, gdiff diff)
|
||||
UTIL_REQUIRE_PROGS(EXPR, expr)
|
||||
UTIL_REQUIRE_PROGS(FIND, find)
|
||||
UTIL_REQUIRE_PROGS(GUNZIP, gunzip)
|
||||
UTIL_REQUIRE_PROGS(GZIP, pigz gzip)
|
||||
UTIL_REQUIRE_PROGS(HEAD, head)
|
||||
UTIL_REQUIRE_PROGS(LN, ln)
|
||||
UTIL_REQUIRE_PROGS(LS, ls)
|
||||
# gmkdir is known to be safe for concurrent invocations with -p flag.
|
||||
UTIL_REQUIRE_PROGS(MKDIR, gmkdir mkdir)
|
||||
UTIL_REQUIRE_PROGS(MKTEMP, mktemp)
|
||||
UTIL_REQUIRE_PROGS(MV, mv)
|
||||
UTIL_REQUIRE_PROGS(AWK, gawk nawk awk)
|
||||
UTIL_REQUIRE_PROGS(PRINTF, printf)
|
||||
UTIL_REQUIRE_PROGS(RM, rm)
|
||||
UTIL_REQUIRE_PROGS(RMDIR, rmdir)
|
||||
UTIL_REQUIRE_PROGS(SH, sh)
|
||||
UTIL_REQUIRE_PROGS(SORT, sort)
|
||||
UTIL_REQUIRE_PROGS(TAIL, tail)
|
||||
UTIL_REQUIRE_PROGS(TAR, gtar tar)
|
||||
UTIL_REQUIRE_PROGS(TEE, tee)
|
||||
UTIL_REQUIRE_PROGS(TOUCH, touch)
|
||||
UTIL_REQUIRE_PROGS(XARGS, xargs)
|
||||
|
||||
# Required tools with some special treatment
|
||||
UTIL_REQUIRE_SPECIAL(FGREP, [AC_PROG_FGREP])
|
||||
|
||||
# Optional tools, we can do without them
|
||||
UTIL_LOOKUP_PROGS(CMAKE, cmake)
|
||||
UTIL_LOOKUP_PROGS(DF, df)
|
||||
UTIL_LOOKUP_PROGS(GIT, git)
|
||||
UTIL_LOOKUP_PROGS(NICE, nice)
|
||||
UTIL_LOOKUP_PROGS(READLINK, greadlink readlink)
|
||||
UTIL_LOOKUP_PROGS(WHOAMI, whoami)
|
||||
|
||||
# For compare.sh only
|
||||
UTIL_LOOKUP_PROGS(CMP, cmp)
|
||||
UTIL_LOOKUP_PROGS(UNIQ, uniq)
|
||||
|
||||
# Always force rm.
|
||||
RM="$RM -f"
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if we have found a usable version of make
|
||||
# $1: the path to a potential make binary (or empty)
|
||||
# $2: the description on how we found this
|
||||
AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
|
||||
[
|
||||
MAKE_CANDIDATE="$1"
|
||||
DESCRIPTION="$2"
|
||||
|
||||
# On Cygwin, we require a newer version of make than on other platforms
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
MAKE_VERSION_EXPR="-e 4\."
|
||||
MAKE_REQUIRED_VERSION="4.0"
|
||||
else
|
||||
MAKE_VERSION_EXPR="-e 3\.8[[12]] -e 4\."
|
||||
MAKE_REQUIRED_VERSION="3.81"
|
||||
fi
|
||||
|
||||
if test "x$MAKE_CANDIDATE" != x; then
|
||||
AC_MSG_NOTICE([Testing potential make at $MAKE_CANDIDATE, found using $DESCRIPTION])
|
||||
MAKE_VERSION_STRING=`$MAKE_CANDIDATE --version | $HEAD -n 1`
|
||||
IS_GNU_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP 'GNU Make'`
|
||||
if test "x$IS_GNU_MAKE" = x; then
|
||||
AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.])
|
||||
else
|
||||
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP $MAKE_VERSION_EXPR`
|
||||
if test "x$IS_MODERN_MAKE" = x; then
|
||||
AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version $MAKE_REQUIRED_VERSION or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
|
||||
else
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
MAKE_EXPECTED_ENV='cygwin'
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then
|
||||
MAKE_EXPECTED_ENV='msys'
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1" || test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then
|
||||
if test "x$OPENJDK_BUILD_CPU" = "xaarch64"; then
|
||||
MAKE_EXPECTED_ENV='aarch64-.*-linux-gnu'
|
||||
else
|
||||
MAKE_EXPECTED_ENV='x86_64-.*-linux-gnu'
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Unknown Windows environment])
|
||||
fi
|
||||
MAKE_BUILT_FOR=`$MAKE_CANDIDATE --version | $GREP -i 'built for'`
|
||||
IS_MAKE_CORRECT_ENV=`$ECHO $MAKE_BUILT_FOR | $GREP $MAKE_EXPECTED_ENV`
|
||||
else
|
||||
# Not relevant for non-Windows
|
||||
IS_MAKE_CORRECT_ENV=true
|
||||
fi
|
||||
if test "x$IS_MAKE_CORRECT_ENV" = x; then
|
||||
AC_MSG_NOTICE([Found GNU make version $MAKE_VERSION_STRING at $MAKE_CANDIDATE, but it is not for $MAKE_EXPECTED_ENV (it says: $MAKE_BUILT_FOR). Ignoring.])
|
||||
else
|
||||
FOUND_MAKE=$MAKE_CANDIDATE
|
||||
UTIL_FIXUP_EXECUTABLE(FOUND_MAKE)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN([BASIC_CHECK_MAKE_OUTPUT_SYNC],
|
||||
[
|
||||
# Check if make supports the output sync option and if so, setup using it.
|
||||
UTIL_ARG_WITH(NAME: output-sync, TYPE: literal,
|
||||
VALID_VALUES: [none recurse line target], DEFAULT: none,
|
||||
OPTIONAL: true, ENABLED_DEFAULT: true,
|
||||
ENABLED_RESULT: OUTPUT_SYNC_SUPPORTED,
|
||||
CHECKING_MSG: [for make --output-sync value],
|
||||
DESC: [set make --output-sync type if supported by make],
|
||||
CHECK_AVAILABLE:
|
||||
[
|
||||
AC_MSG_CHECKING([if make --output-sync is supported])
|
||||
if ! $MAKE --version -O > /dev/null 2>&1; then
|
||||
AC_MSG_RESULT([no])
|
||||
AVAILABLE=false
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
]
|
||||
)
|
||||
AC_SUBST(OUTPUT_SYNC_SUPPORTED)
|
||||
AC_SUBST(OUTPUT_SYNC)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Goes looking for a usable version of GNU make.
|
||||
AC_DEFUN([BASIC_CHECK_GNU_MAKE],
|
||||
[
|
||||
UTIL_SETUP_TOOL(MAKE,
|
||||
[
|
||||
# Try our hardest to locate a correct version of GNU make
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(CHECK_GMAKE, gmake)
|
||||
BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH])
|
||||
|
||||
if test "x$FOUND_MAKE" = x; then
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(CHECK_MAKE, make)
|
||||
BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH])
|
||||
fi
|
||||
|
||||
if test "x$FOUND_MAKE" = x; then
|
||||
AC_MSG_ERROR([Cannot find GNU make $MAKE_REQUIRED_VERSION or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.])
|
||||
fi
|
||||
],[
|
||||
# If MAKE was set by user, verify the version
|
||||
BASIC_CHECK_MAKE_VERSION("$MAKE", [user supplied MAKE=$MAKE])
|
||||
if test "x$FOUND_MAKE" = x; then
|
||||
AC_MSG_ERROR([The specified make (by MAKE=$MAKE) is not GNU make $MAKE_REQUIRED_VERSION or newer.])
|
||||
fi
|
||||
])
|
||||
|
||||
MAKE=$FOUND_MAKE
|
||||
AC_SUBST(MAKE)
|
||||
AC_MSG_NOTICE([Using GNU make at $FOUND_MAKE (version: $MAKE_VERSION_STRING)])
|
||||
|
||||
BASIC_CHECK_MAKE_OUTPUT_SYNC
|
||||
])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN([BASIC_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
|
||||
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
|
||||
# AIX 'find' is buggy if called with '-exec {} \+' and an empty file list
|
||||
FIND_DELETE="-print | $XARGS $RM"
|
||||
else
|
||||
FIND_DELETE="-exec $RM \{\} \+"
|
||||
fi
|
||||
AC_MSG_RESULT([no])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
$RMDIR $DELETEDIR
|
||||
AC_SUBST(FIND_DELETE)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN([BASIC_CHECK_TAR],
|
||||
[
|
||||
# Test which kind of tar was found
|
||||
if test "x$($TAR --version | $GREP "GNU tar")" != "x"; then
|
||||
TAR_TYPE="gnu"
|
||||
elif test "x$($TAR --version | $GREP "bsdtar")" != "x"; then
|
||||
TAR_TYPE="bsd"
|
||||
elif test "x$($TAR -v | $GREP "bsdtar")" != "x"; then
|
||||
TAR_TYPE="bsd"
|
||||
elif test "x$($TAR --version | $GREP "busybox")" != "x"; then
|
||||
TAR_TYPE="busybox"
|
||||
elif test "x$OPENJDK_BUILD_OS" = "xaix"; then
|
||||
TAR_TYPE="aix"
|
||||
fi
|
||||
AC_MSG_CHECKING([what type of tar was found])
|
||||
AC_MSG_RESULT([$TAR_TYPE])
|
||||
|
||||
if test "x$TAR_TYPE" = "xgnu"; then
|
||||
TAR_INCLUDE_PARAM="T"
|
||||
TAR_SUPPORTS_TRANSFORM="true"
|
||||
elif test "x$TAR_TYPE" = "xaix"; then
|
||||
# -L InputList of aix tar: name of file listing the files and directories
|
||||
# that need to be archived or extracted
|
||||
TAR_INCLUDE_PARAM="L"
|
||||
TAR_SUPPORTS_TRANSFORM="false"
|
||||
elif test "x$TAR_TYPE" = "xbusybox"; then
|
||||
TAR_INCLUDE_PARAM="T"
|
||||
TAR_SUPPORTS_TRANSFORM="false"
|
||||
else
|
||||
TAR_INCLUDE_PARAM="I"
|
||||
TAR_SUPPORTS_TRANSFORM="false"
|
||||
fi
|
||||
AC_SUBST(TAR_TYPE)
|
||||
AC_SUBST(TAR_INCLUDE_PARAM)
|
||||
AC_SUBST(TAR_SUPPORTS_TRANSFORM)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN([BASIC_CHECK_GREP],
|
||||
[
|
||||
# Test that grep supports -Fx with a list of pattern which includes null pattern.
|
||||
# This is a problem for the grep resident on AIX.
|
||||
AC_MSG_CHECKING([that grep ($GREP) -Fx handles empty lines in the pattern list correctly])
|
||||
# Multiple subsequent spaces..
|
||||
STACK_SPACES='aaa bbb ccc'
|
||||
# ..converted to subsequent newlines, causes STACK_LIST to be a list with some empty
|
||||
# patterns in it.
|
||||
STACK_LIST=${STACK_SPACES// /$'\n'}
|
||||
NEEDLE_SPACES='ccc bbb aaa'
|
||||
NEEDLE_LIST=${NEEDLE_SPACES// /$'\n'}
|
||||
RESULT="$($GREP -Fvx "$STACK_LIST" <<< "$NEEDLE_LIST")"
|
||||
if test "x$RESULT" == "x"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
|
||||
ADDINFO="Please make sure you use GNU grep, usually found at /opt/freeware/bin."
|
||||
fi
|
||||
AC_MSG_ERROR([grep does not handle -Fx correctly. ${ADDINFO}])
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
|
||||
[
|
||||
BASIC_CHECK_GNU_MAKE
|
||||
|
||||
BASIC_CHECK_FIND_DELETE
|
||||
BASIC_CHECK_TAR
|
||||
BASIC_CHECK_GREP
|
||||
BASIC_SETUP_PANDOC
|
||||
|
||||
# These tools might not be installed by default,
|
||||
# need hint on how to install them.
|
||||
UTIL_REQUIRE_PROGS(UNZIP, unzip)
|
||||
# Since zip uses "ZIP" as a environment variable for passing options, we need
|
||||
# to name our variable differently, hence ZIPEXE.
|
||||
UTIL_REQUIRE_PROGS(ZIPEXE, zip)
|
||||
|
||||
# Non-required basic tools
|
||||
|
||||
UTIL_LOOKUP_PROGS(READELF, greadelf readelf)
|
||||
UTIL_LOOKUP_PROGS(DOT, dot)
|
||||
UTIL_LOOKUP_PROGS(STAT, stat)
|
||||
UTIL_LOOKUP_PROGS(TIME, time)
|
||||
UTIL_LOOKUP_PROGS(FLOCK, flock)
|
||||
# Dtrace is usually found in /usr/sbin, but that directory may not
|
||||
# be in the user path.
|
||||
UTIL_LOOKUP_PROGS(DTRACE, dtrace, $PATH:/usr/sbin)
|
||||
UTIL_LOOKUP_PROGS(PATCH, gpatch patch)
|
||||
# Check if it's GNU time
|
||||
[ IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU [Tt]ime'` ]
|
||||
if test "x$IS_GNU_TIME" != x; then
|
||||
IS_GNU_TIME=yes
|
||||
else
|
||||
IS_GNU_TIME=no
|
||||
fi
|
||||
AC_SUBST(IS_GNU_TIME)
|
||||
|
||||
# Check if it's a GNU date compatible version
|
||||
AC_MSG_CHECKING([if date is a GNU compatible version])
|
||||
check_date=`$DATE --version 2>&1 | $GREP "GNU\|BusyBox\|uutils"`
|
||||
if test "x$check_date" != x; then
|
||||
AC_MSG_RESULT([yes])
|
||||
IS_GNU_DATE=yes
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
# Likely at the AIX provided version of the date utility here, which is not compatible
|
||||
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
|
||||
AC_MSG_ERROR([gnu date from AIX toolbox is required])
|
||||
fi
|
||||
IS_GNU_DATE=no
|
||||
fi
|
||||
AC_SUBST(IS_GNU_DATE)
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
|
||||
UTIL_REQUIRE_PROGS(DSYMUTIL, dsymutil)
|
||||
AC_MSG_CHECKING([if dsymutil supports --reproducer option])
|
||||
if $DSYMUTIL --help | $GREP -q '\--reproducer '; then
|
||||
AC_MSG_RESULT([yes])
|
||||
# --reproducer option is supported
|
||||
# set "--reproducer Off" to prevent unnecessary temporary
|
||||
# directories creation
|
||||
DSYMUTIL="$DSYMUTIL --reproducer Off"
|
||||
else
|
||||
# --reproducer option isn't supported
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
UTIL_REQUIRE_PROGS(MIG, mig)
|
||||
UTIL_REQUIRE_PROGS(XATTR, xattr)
|
||||
UTIL_LOOKUP_PROGS(CODESIGN, codesign)
|
||||
UTIL_REQUIRE_PROGS(SETFILE, SetFile)
|
||||
fi
|
||||
if ! test "x$OPENJDK_TARGET_OS" = "xwindows"; then
|
||||
UTIL_REQUIRE_PROGS(ULIMIT, ulimit)
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check for support for specific options in bash
|
||||
AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS],
|
||||
[
|
||||
# Check bash version
|
||||
# Extra [ ] to stop m4 mangling
|
||||
[ BASH_VER=`$BASH --version | $SED -n -e 's/^.*bash.*ersion *\([0-9.]*\).*$/\1/ p'` ]
|
||||
AC_MSG_CHECKING([bash version])
|
||||
AC_MSG_RESULT([$BASH_VER])
|
||||
|
||||
BASH_MAJOR=`$ECHO $BASH_VER | $CUT -d . -f 1`
|
||||
BASH_MINOR=`$ECHO $BASH_VER | $CUT -d . -f 2`
|
||||
if test $BASH_MAJOR -lt 3 || (test $BASH_MAJOR -eq 3 && test $BASH_MINOR -lt 2); then
|
||||
AC_MSG_ERROR([bash version 3.2 or better is required])
|
||||
fi
|
||||
|
||||
# Test if bash supports pipefail.
|
||||
AC_MSG_CHECKING([if bash supports pipefail])
|
||||
if ${BASH} -c 'set -o pipefail'; then
|
||||
BASH_ARGS="$BASH_ARGS -o pipefail"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if bash supports errexit (-e)])
|
||||
if ${BASH} -e -c 'true'; then
|
||||
BASH_ARGS="$BASH_ARGS -e"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_SUBST(BASH_ARGS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Setup Pandoc
|
||||
#
|
||||
AC_DEFUN_ONCE([BASIC_SETUP_PANDOC],
|
||||
[
|
||||
UTIL_LOOKUP_PROGS(PANDOC, pandoc)
|
||||
|
||||
if test "x$PANDOC" != x; then
|
||||
AC_MSG_CHECKING([for pandoc version])
|
||||
PANDOC_VERSION=`$PANDOC --version 2>&1 | $TR -d '\r' | $HEAD -1 | $CUT -d " " -f 2`
|
||||
AC_MSG_RESULT([$PANDOC_VERSION])
|
||||
|
||||
if test "x$PANDOC_VERSION" != x$RECOMMENDED_PANDOC_VERSION; then
|
||||
AC_MSG_WARN([pandoc is version $PANDOC_VERSION, not the recommended version $RECOMMENDED_PANDOC_VERSION])
|
||||
fi
|
||||
|
||||
PANDOC_MARKDOWN_FLAG="markdown"
|
||||
AC_MSG_CHECKING([if the pandoc smart extension needs to be disabled for markdown])
|
||||
if $PANDOC --list-extensions | $GREP -q '+smart'; then
|
||||
AC_MSG_RESULT([yes])
|
||||
PANDOC_MARKDOWN_FLAG="$PANDOC_MARKDOWN_FLAG-smart"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if the pandoc tex_math_dollars extension needs to be disabled for markdown])
|
||||
if $PANDOC --list-extensions | $GREP -q '+tex_math_dollars'; then
|
||||
AC_MSG_RESULT([yes])
|
||||
PANDOC_MARKDOWN_FLAG="$PANDOC_MARKDOWN_FLAG-tex_math_dollars"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
ENABLE_PANDOC="true"
|
||||
else
|
||||
ENABLE_PANDOC="false"
|
||||
fi
|
||||
|
||||
AC_SUBST(ENABLE_PANDOC)
|
||||
AC_SUBST(PANDOC_MARKDOWN_FLAG)
|
||||
])
|
||||
235
make/autoconf/basic_windows.m4
Normal file
235
make/autoconf/basic_windows.m4
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
|
||||
AC_DEFUN([BASIC_SETUP_PATHS_WINDOWS],
|
||||
[
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
# Clarify if it is wsl1 or wsl2, and use that as OS_ENV from this point forward
|
||||
$PATHTOOL -w / > /dev/null 2>&1
|
||||
if test $? -ne 0; then
|
||||
# Without Windows access to our root, it's definitely WSL1
|
||||
OPENJDK_BUILD_OS_ENV=windows.wsl1
|
||||
else
|
||||
# This test is not guaranteed, but there is no documented way of
|
||||
# distinguishing between WSL1 and WSL2.
|
||||
# Check whether "Hyper-V" appears in /proc/interrupts because WSL2 runs on Hyper-V.
|
||||
$GREP -q Hyper-V /proc/interrupts
|
||||
if test $? -eq 0; then
|
||||
OPENJDK_BUILD_OS_ENV=windows.wsl2
|
||||
else
|
||||
OPENJDK_BUILD_OS_ENV=windows.wsl1
|
||||
fi
|
||||
fi
|
||||
# This is a bit silly since we really don't have a target env as such,
|
||||
# but do it to keep consistency.
|
||||
OPENJDK_TARGET_OS_ENV=$OPENJDK_BUILD_OS_ENV
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then
|
||||
# Must be done prior to calling any commands to avoid mangling of command line
|
||||
export MSYS2_ARG_CONV_EXCL="*"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([Windows environment type])
|
||||
WINENV_VENDOR=${OPENJDK_BUILD_OS_ENV#windows.}
|
||||
AC_MSG_RESULT([$WINENV_VENDOR])
|
||||
|
||||
if test "x$WINENV_VENDOR" = x; then
|
||||
AC_MSG_ERROR([Unknown Windows environment. Neither cygwin, msys2, wsl1 nor wsl2 was detected.])
|
||||
fi
|
||||
|
||||
if test "x$PATHTOOL" = x; then
|
||||
AC_MSG_ERROR([Incorrect $WINENV_VENDOR installation. Neither cygpath nor wslpath was found])
|
||||
fi
|
||||
|
||||
if test "x$CMD" = x; then
|
||||
AC_MSG_ERROR([Incorrect Windows/$WINENV_VENDOR setup. Could not locate cmd.exe])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([$WINENV_VENDOR drive prefix])
|
||||
WINENV_PREFIX=`$PATHTOOL -u c:/ | $SED -e 's!/c/!!'`
|
||||
AC_MSG_RESULT(['$WINENV_PREFIX'])
|
||||
AC_SUBST(WINENV_PREFIX)
|
||||
|
||||
AC_MSG_CHECKING([$WINENV_VENDOR root directory as Windows path])
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" != "xwindows.wsl1"; then
|
||||
WINENV_ROOT=`$PATHTOOL -w / 2> /dev/null`
|
||||
# msys2 has a trailing backslash; strip it
|
||||
WINENV_ROOT=${WINENV_ROOT%\\}
|
||||
else
|
||||
WINENV_ROOT='[[unavailable]]'
|
||||
fi
|
||||
AC_MSG_RESULT(['$WINENV_ROOT'])
|
||||
AC_SUBST(WINENV_ROOT)
|
||||
|
||||
AC_MSG_CHECKING([$WINENV_VENDOR temp directory])
|
||||
WINENV_TEMP_DIR=$($PATHTOOL -u $($CMD /q /c echo %TEMP% 2> /dev/null) | $TR -d '\r\n')
|
||||
AC_MSG_RESULT([$WINENV_TEMP_DIR])
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then
|
||||
# Don't trust the current directory for WSL2, but change to an OK temp dir
|
||||
cd "$WINENV_TEMP_DIR"
|
||||
# Bring along confdefs.h or autoconf gets all confused
|
||||
cp "$CONFIGURE_START_DIR/confdefs.h" "$WINENV_TEMP_DIR"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([$WINENV_VENDOR release])
|
||||
WINENV_UNAME_RELEASE=`$UNAME -r`
|
||||
AC_MSG_RESULT([$WINENV_UNAME_RELEASE])
|
||||
|
||||
AC_MSG_CHECKING([$WINENV_VENDOR version])
|
||||
WINENV_UNAME_VERSION=`$UNAME -v`
|
||||
AC_MSG_RESULT([$WINENV_UNAME_VERSION])
|
||||
|
||||
WINENV_VERSION="$WINENV_UNAME_RELEASE, $WINENV_UNAME_VERSION"
|
||||
|
||||
AC_MSG_CHECKING([Windows version])
|
||||
|
||||
# We must change directory to one guaranteed to work, otherwise WSL1
|
||||
# can complain (since it does not have a WINENV_ROOT so it can't access
|
||||
# unix-style paths from Windows.
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
[ WINDOWS_VERSION=`cd $WINENV_TEMP_DIR && $CMD /c ver | $EGREP -o '([0-9]+\.)+[0-9]+'` ]
|
||||
AC_MSG_RESULT([$WINDOWS_VERSION])
|
||||
|
||||
# Additional handling per specific env
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
[ CYGWIN_VERSION_OLD=`$ECHO $WINENV_UNAME_RELEASE | $GREP -e '^1\.[0-6]'` ]
|
||||
if test "x$CYGWIN_VERSION_OLD" != x; then
|
||||
AC_MSG_NOTICE([Your cygwin is too old. You are running $CYGWIN_RELEASE, but at least cygwin 1.7 is required. Please upgrade.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
if test "x$LDD" = x; then
|
||||
AC_MSG_ERROR([ldd is missing, which is needed on cygwin])
|
||||
fi
|
||||
WINENV_MARKER_DLL=cygwin1.dll
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then
|
||||
if test "x$LDD" = x; then
|
||||
AC_MSG_ERROR([ldd is missing, which is needed on msys2])
|
||||
fi
|
||||
WINENV_MARKER_DLL=msys-2.0.dll
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1" || test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then
|
||||
AC_MSG_CHECKING([wsl distribution])
|
||||
WSL_DISTRIBUTION=`$LSB_RELEASE -d | sed 's/Description:\t//'`
|
||||
AC_MSG_RESULT([$WSL_DISTRIBUTION])
|
||||
|
||||
WINENV_VERSION="$WINENV_VERSION ($WSL_DISTRIBUTION)"
|
||||
|
||||
# Tell WSL to automatically translate the PATH variable
|
||||
export WSLENV=PATH/l
|
||||
fi
|
||||
|
||||
# Chicken and egg: FIXPATH is needed for UTIL_FIXUP_PATH to work. So for the
|
||||
# first run we use the auto-detect abilities of fixpath.sh.
|
||||
FIXPATH_DIR="$TOPDIR/make/scripts"
|
||||
FIXPATH="$BASH $FIXPATH_DIR/fixpath.sh exec"
|
||||
FIXPATH_BASE="$BASH $FIXPATH_DIR/fixpath.sh"
|
||||
FIXPATH_SAVED_PATH="$PATH"
|
||||
UTIL_FIXUP_PATH(FIXPATH_DIR)
|
||||
|
||||
# Now we can use FIXPATH_DIR to rewrite path to fixpath.sh properly.
|
||||
if test "x$WINENV_PREFIX" = x; then
|
||||
# On msys the prefix is empty, but we need to pass something to have the
|
||||
# fixpath.sh options parser happy.
|
||||
WINENV_PREFIX_ARG="NONE"
|
||||
else
|
||||
WINENV_PREFIX_ARG="$WINENV_PREFIX"
|
||||
fi
|
||||
FIXPATH_ARGS="-e $PATHTOOL -p $WINENV_PREFIX_ARG -r ${WINENV_ROOT//\\/\\\\} -t $WINENV_TEMP_DIR -c $CMD"
|
||||
FIXPATH_BASE="$BASH $FIXPATH_DIR/fixpath.sh $FIXPATH_ARGS"
|
||||
FIXPATH="$FIXPATH_BASE exec"
|
||||
|
||||
AC_SUBST(FIXPATH_BASE)
|
||||
AC_SUBST(FIXPATH)
|
||||
|
||||
SRC_ROOT_LENGTH=`$ECHO "$TOPDIR" | $WC -m`
|
||||
if test $SRC_ROOT_LENGTH -gt 100; then
|
||||
AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported])
|
||||
fi
|
||||
|
||||
# Test if windows or unix "find" is first in path.
|
||||
AC_MSG_CHECKING([what kind of 'find' is first on the PATH])
|
||||
FIND_BINARY_OUTPUT=`find --version 2>&1`
|
||||
if test "x`echo $FIND_BINARY_OUTPUT | $GREP GNU`" != x; then
|
||||
AC_MSG_RESULT([unix style])
|
||||
elif test "x`echo $FIND_BINARY_OUTPUT | $GREP FIND`" != x; then
|
||||
AC_MSG_RESULT([Windows])
|
||||
AC_MSG_NOTICE([Your path contains Windows tools (C:\Windows\system32) before your unix tools.])
|
||||
AC_MSG_NOTICE([This will not work. Please correct and make sure /usr/bin (or similar) is first in path.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
else
|
||||
AC_MSG_RESULT([unknown])
|
||||
AC_MSG_WARN([It seems that your find utility is non-standard.])
|
||||
fi
|
||||
|
||||
if test "x$GIT" != x && test -e $TOPDIR/.git; then
|
||||
git_autocrlf=`$GIT config core.autocrlf`
|
||||
if test "x$git_autocrlf" != x && test "x$git_autocrlf" != "xfalse"; then
|
||||
AC_MSG_NOTICE([Your git configuration does not set core.autocrlf to false.])
|
||||
AC_MSG_NOTICE([If you checked out this code using that setting, the build WILL fail.])
|
||||
AC_MSG_NOTICE([To correct, run "git config --global core.autocrlf false" and re-clone the repo.])
|
||||
AC_MSG_WARN([Code is potentially incorrectly cloned. HIGH RISK of build failure!])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
# Verify that the directory is usable on Windows
|
||||
AC_DEFUN([BASIC_WINDOWS_VERIFY_DIR],
|
||||
[
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1"; then
|
||||
OUTPUTDIR_WIN=`$FIXPATH_BASE print $1`
|
||||
if test "x$OUTPUTDIR_WIN" = x; then
|
||||
AC_MSG_NOTICE([For wsl1, the $2 dir must be located on a Windows drive. Please see doc/building.md for details.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
# Create fixpath wrapper
|
||||
AC_DEFUN([BASIC_WINDOWS_FINALIZE_FIXPATH],
|
||||
[
|
||||
if test "x$OPENJDK_BUILD_OS" = xwindows; then
|
||||
FIXPATH_CMDLINE=". $TOPDIR/make/scripts/fixpath.sh -e $PATHTOOL \
|
||||
-p $WINENV_PREFIX_ARG -r ${WINENV_ROOT//\\/\\\\} -t $WINENV_TEMP_DIR \
|
||||
-c $CMD"
|
||||
$ECHO > $OUTPUTDIR/fixpath '#!/bin/bash'
|
||||
$ECHO >> $OUTPUTDIR/fixpath export PATH='"[$]PATH:'$PATH'"'
|
||||
$ECHO >> $OUTPUTDIR/fixpath $FIXPATH_CMDLINE '"[$]@"'
|
||||
$CHMOD +x $OUTPUTDIR/fixpath
|
||||
FIXPATH_BASE="$OUTPUTDIR/fixpath"
|
||||
FIXPATH="$FIXPATH_BASE exec"
|
||||
fi
|
||||
])
|
||||
|
||||
# Platform-specific finalization
|
||||
AC_DEFUN([BASIC_WINDOWS_FINALIZE],
|
||||
[
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then
|
||||
# Change back from temp dir
|
||||
cd $CONFIGURE_START_DIR
|
||||
fi
|
||||
])
|
||||
618
make/autoconf/boot-jdk.m4
Normal file
618
make/autoconf/boot-jdk.m4
Normal file
|
|
@ -0,0 +1,618 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# This file handles detection of the Boot JDK. The Boot JDK detection
|
||||
# process has been developed as a response to solve a complex real-world
|
||||
# problem. Initially, it was simple, but it has grown as platform after
|
||||
# platform, idiosyncrasy after idiosyncrasy has been supported.
|
||||
#
|
||||
# The basic idea is this:
|
||||
# 1) You need an acceptable *) JDK to use as a Boot JDK
|
||||
# 2) There are several ways to locate a JDK, that are mostly platform
|
||||
# dependent **)
|
||||
# 3) You can have multiple JDKs installed
|
||||
# 4) If possible, configure should try to dig out an acceptable JDK
|
||||
# automatically, without having to resort to command-line options
|
||||
#
|
||||
# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with
|
||||
# javac) and not a JRE, etc.
|
||||
#
|
||||
# **) On Windows we typically use a well-known path.
|
||||
# On MacOSX we typically use the tool java_home.
|
||||
# On Linux we typically find javac in the $PATH, and then follow a
|
||||
# chain of symlinks that often ends up in a real JDK.
|
||||
#
|
||||
# This leads to the code where we check in different ways to locate a
|
||||
# JDK, and if one is found, check if it is acceptable. If not, we print
|
||||
# our reasons for rejecting it (useful when debugging non-working
|
||||
# configure situations) and continue checking the next one.
|
||||
################################################################################
|
||||
|
||||
# Execute the check given as argument, and verify the result
|
||||
# If the Boot JDK was previously found, do nothing
|
||||
# $1 A command line (typically autoconf macro) to execute
|
||||
AC_DEFUN([BOOTJDK_DO_CHECK],
|
||||
[
|
||||
if test "x$BOOT_JDK_FOUND" = xno; then
|
||||
# Now execute the test
|
||||
$1
|
||||
|
||||
# If previous step claimed to have found a JDK, check it to see if it seems to be valid.
|
||||
if test "x$BOOT_JDK_FOUND" = xmaybe; then
|
||||
# Do we have a bin/java?
|
||||
if test ! -x "$BOOT_JDK/bin/java" && test ! -x "$BOOT_JDK/bin/java.exe"; then
|
||||
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring])
|
||||
BOOT_JDK_FOUND=no
|
||||
else
|
||||
# Do we have a bin/javac?
|
||||
if test ! -x "$BOOT_JDK/bin/javac" && test ! -x "$BOOT_JDK/bin/javac.exe"; then
|
||||
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring])
|
||||
AC_MSG_NOTICE([(This might be an JRE instead of an JDK)])
|
||||
BOOT_JDK_FOUND=no
|
||||
else
|
||||
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
|
||||
java_to_test="$BOOT_JDK/bin/java"
|
||||
UTIL_FIXUP_EXECUTABLE(java_to_test)
|
||||
BOOT_JDK_VERSION_OUTPUT=`$java_to_test $USER_BOOT_JDK_OPTIONS -version 2>&1`
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
[ BOOT_JDK_VERSION=`echo $BOOT_JDK_VERSION_OUTPUT | $AWK '/version "[0-9a-zA-Z\._\-]+"/ {print $ 0; exit;}'` ]
|
||||
|
||||
if [ [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ]; then
|
||||
AC_MSG_NOTICE([You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead.])
|
||||
AC_MSG_NOTICE([Java reports: "$BOOT_JDK_VERSION".])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
if [ [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ]; then
|
||||
AC_MSG_NOTICE([The specified --with-boot-jdk-jvmargs is invalid for the tested java])
|
||||
AC_MSG_NOTICE([Error message: "$BOOT_JDK_VERSION".])
|
||||
AC_MSG_NOTICE([Please fix arguments, or point to an explicit boot JDK which accept these arguments])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
# Extra M4 quote needed to protect [] in grep expression.
|
||||
[FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION \
|
||||
| $EGREP "\"(${DEFAULT_ACCEPTABLE_BOOT_VERSIONS// /|})([\.+-].*)?\""`]
|
||||
|
||||
if test "x$BOOT_JDK_VERSION" = x; then
|
||||
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is not a working JDK; ignoring])
|
||||
AC_MSG_NOTICE([Output from java -version was: $BOOT_JDK_VERSION_OUTPUT])
|
||||
BOOT_JDK_FOUND=no
|
||||
elif test "x$FOUND_CORRECT_VERSION" = x; then
|
||||
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
|
||||
AC_MSG_NOTICE([(Your Boot JDK version must be one of: $DEFAULT_ACCEPTABLE_BOOT_VERSIONS)])
|
||||
BOOT_JDK_FOUND=no
|
||||
else
|
||||
# We're done! :-)
|
||||
BOOT_JDK_FOUND=yes
|
||||
UTIL_FIXUP_PATH(BOOT_JDK)
|
||||
AC_MSG_CHECKING([for Boot JDK])
|
||||
AC_MSG_RESULT([$BOOT_JDK])
|
||||
AC_MSG_CHECKING([Boot JDK version])
|
||||
BOOT_JDK_VERSION=`$java_to_test $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR -d '\r'`
|
||||
# This is not a no-op; it will portably convert newline to space
|
||||
BOOT_JDK_VERSION=`$ECHO $BOOT_JDK_VERSION`
|
||||
AC_MSG_RESULT([$BOOT_JDK_VERSION])
|
||||
fi # end check jdk version
|
||||
fi # end check javac
|
||||
fi # end check java
|
||||
fi # end check boot jdk found
|
||||
fi
|
||||
])
|
||||
|
||||
# Test: Is bootjdk explicitly set by command line arguments?
|
||||
AC_DEFUN([BOOTJDK_CHECK_ARGUMENTS],
|
||||
[
|
||||
if test "x$with_boot_jdk" != x; then
|
||||
BOOT_JDK_ARG="$with_boot_jdk"
|
||||
UTIL_FIXUP_PATH(BOOT_JDK_ARG)
|
||||
if test -d "$BOOT_JDK_ARG"; then
|
||||
BOOT_JDK=$BOOT_JDK_ARG
|
||||
BOOT_JDK_FOUND=maybe
|
||||
elif test -f "$BOOT_JDK_ARG"; then
|
||||
case "$BOOT_JDK_ARG" in
|
||||
*.tar.gz )
|
||||
BOOT_JDK_SUPPORT_DIR=$CONFIGURESUPPORT_OUTPUTDIR/boot-jdk
|
||||
$RM -rf $BOOT_JDK_SUPPORT_DIR
|
||||
$MKDIR -p $BOOT_JDK_SUPPORT_DIR
|
||||
$GUNZIP -c $BOOT_JDK_ARG | $TAR xf - -C $BOOT_JDK_SUPPORT_DIR
|
||||
|
||||
# Try to find javac to determine BOOT_JDK path
|
||||
BOOT_JDK_JAVAC_PATH=`$FIND $BOOT_JDK_SUPPORT_DIR | $GREP "/bin/javac"`
|
||||
if test "x$BOOT_JDK_JAVAC_PATH" != x; then
|
||||
BOOT_JDK_FOUND=maybe
|
||||
BOOT_JDK=$($DIRNAME $($DIRNAME $BOOT_JDK_JAVAC_PATH))
|
||||
else
|
||||
BOOT_JDK_FOUND=no
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
BOOT_JDK_FOUND=no
|
||||
;;
|
||||
esac
|
||||
else
|
||||
BOOT_JDK_FOUND=no
|
||||
fi
|
||||
AC_MSG_NOTICE([Found potential Boot JDK using configure arguments])
|
||||
fi
|
||||
])
|
||||
|
||||
# Test: Is $JAVA_HOME set?
|
||||
AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME],
|
||||
[
|
||||
if test "x$JAVA_HOME" != x; then
|
||||
JAVA_HOME_PROCESSED="$JAVA_HOME"
|
||||
UTIL_FIXUP_PATH(JAVA_HOME_PROCESSED, NOFAIL)
|
||||
if test "x$JAVA_HOME_PROCESSED" = x || test ! -d "$JAVA_HOME_PROCESSED"; then
|
||||
AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!])
|
||||
else
|
||||
# Aha, the user has set a JAVA_HOME
|
||||
# let us use that as the Boot JDK.
|
||||
BOOT_JDK="$JAVA_HOME_PROCESSED"
|
||||
BOOT_JDK_FOUND=maybe
|
||||
AC_MSG_NOTICE([Found potential Boot JDK using JAVA_HOME])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
|
||||
AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK],
|
||||
[
|
||||
UTIL_LOOKUP_PROGS(JAVAC_CHECK, javac)
|
||||
UTIL_GET_EXECUTABLE(JAVAC_CHECK) # Will setup JAVAC_CHECK_EXECUTABLE
|
||||
UTIL_LOOKUP_PROGS(JAVA_CHECK, java)
|
||||
UTIL_GET_EXECUTABLE(JAVA_CHECK) # Will setup JAVA_CHECK_EXECUTABLE
|
||||
BINARY="$JAVAC_CHECK_EXECUTABLE"
|
||||
if test "x$JAVAC_CHECK_EXECUTABLE" = x; then
|
||||
BINARY="$JAVA_CHECK_EXECUTABLE"
|
||||
fi
|
||||
if test "x$BINARY" != x; then
|
||||
# So there is a java(c) binary, it might be part of a JDK.
|
||||
# Lets find the JDK/JRE directory by following symbolic links.
|
||||
# Linux/GNU systems often have links from /usr/bin/java to
|
||||
# /etc/alternatives/java to the real JDK binary.
|
||||
UTIL_REMOVE_SYMBOLIC_LINKS(BINARY)
|
||||
BOOT_JDK=`dirname "$BINARY"`
|
||||
BOOT_JDK=`cd "$BOOT_JDK/.."; pwd`
|
||||
if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
|
||||
# Looks like we found ourselves an JDK
|
||||
BOOT_JDK_FOUND=maybe
|
||||
AC_MSG_NOTICE([Found potential Boot JDK using java(c) in PATH])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
|
||||
# $1: Argument to the java_home binary (optional)
|
||||
AC_DEFUN([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME],
|
||||
[
|
||||
if test -x /usr/libexec/java_home; then
|
||||
BOOT_JDK=`/usr/libexec/java_home $1`
|
||||
BOOT_JDK_FOUND=maybe
|
||||
AC_MSG_NOTICE([Found potential Boot JDK using /usr/libexec/java_home $1])
|
||||
fi
|
||||
])
|
||||
|
||||
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
|
||||
AC_DEFUN([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR],
|
||||
[
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
# First check at user selected default
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME()])
|
||||
# If that did not work out (e.g. too old), try explicit versions instead
|
||||
for ver in $DEFAULT_ACCEPTABLE_BOOT_VERSIONS ; do
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v $ver])])
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
# Look for a jdk in the given path. If there are multiple, try to select the newest.
|
||||
# If found, set BOOT_JDK and BOOT_JDK_FOUND.
|
||||
# $1 = Path to directory containing jdk installations.
|
||||
# $2 = String to append to the found JDK directory to get the proper JDK home
|
||||
AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY],
|
||||
[
|
||||
BOOT_JDK_PREFIX="$1"
|
||||
BOOT_JDK_SUFFIX="$2"
|
||||
ALL_JDKS_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $SORT -r`
|
||||
if test "x$ALL_JDKS_FOUND" != x; then
|
||||
for JDK_TO_TRY in $ALL_JDKS_FOUND ; do
|
||||
BOOTJDK_DO_CHECK([
|
||||
BOOT_JDK="${BOOT_JDK_PREFIX}/${JDK_TO_TRY}${BOOT_JDK_SUFFIX}"
|
||||
if test -d "$BOOT_JDK"; then
|
||||
BOOT_JDK_FOUND=maybe
|
||||
AC_MSG_NOTICE([Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX/$JDK_TO_TRY)])
|
||||
fi
|
||||
])
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
# Call BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY, but use the given
|
||||
# environmental variable as base for where to look.
|
||||
# $1 Name of an environmal variable, assumed to point to the Program Files directory.
|
||||
AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY],
|
||||
[
|
||||
if test "x[$]$1" != x; then
|
||||
VIRTUAL_DIR="[$]$1/Java"
|
||||
UTIL_FIXUP_PATH(VIRTUAL_DIR, NOFAIL)
|
||||
if test "x$VIRTUAL_DIR" != x; then
|
||||
BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY($VIRTUAL_DIR)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
# Test: Is there a JDK installed in default, well-known locations?
|
||||
AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS],
|
||||
[
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramW6432])])
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMW6432])])
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMFILES])])
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramFiles])])
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/cygdrive/c/Program Files/Java])])
|
||||
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/Library/Java/JavaVirtualMachines],[/Contents/Home])])
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/System/Library/Java/JavaVirtualMachines],[/Contents/Home])])
|
||||
elif test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/usr/lib/jvm])])
|
||||
fi
|
||||
])
|
||||
|
||||
# Check that a command-line tool in the Boot JDK is correct
|
||||
# $1 = name of variable to assign
|
||||
# $2 = name of binary
|
||||
AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK],
|
||||
[
|
||||
# Use user overridden value if available, otherwise locate tool in the Boot JDK.
|
||||
UTIL_REQUIRE_SPECIAL($1,
|
||||
[
|
||||
AC_MSG_CHECKING([for $2 [[Boot JDK]]])
|
||||
$1=$BOOT_JDK/bin/$2
|
||||
if test ! -x [$]$1 && test ! -x [$]$1.exe; then
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitly setting --with-boot-jdk])
|
||||
AC_MSG_ERROR([Could not find $2 in the Boot JDK])
|
||||
fi
|
||||
AC_MSG_RESULT(\[$]BOOT_JDK/bin/$2)
|
||||
UTIL_FIXUP_EXECUTABLE($1)
|
||||
AC_SUBST($1)
|
||||
])
|
||||
])
|
||||
|
||||
# Setup CLASSPATH environment variable
|
||||
AC_DEFUN([BOOTJDK_SETUP_CLASSPATH],
|
||||
[
|
||||
AC_ARG_WITH([classpath], [AS_HELP_STRING([--with-classpath],
|
||||
[Optional classpath to set as CLASSPATH to all Java invocations @<:@none@:>@])])
|
||||
|
||||
if test "x$CLASSPATH" != x; then
|
||||
AC_MSG_WARN([CLASSPATH is set in the environment. This will be ignored. Use --with-classpath instead.])
|
||||
fi
|
||||
|
||||
CLASSPATH=
|
||||
|
||||
if test "x$with_classpath" != x && test "x$with_classpath" != xyes &&
|
||||
test "x$with_classpath" != xno ; then
|
||||
CLASSPATH="$with_classpath"
|
||||
AC_MSG_CHECKING([for classpath to use for all Java invocations])
|
||||
AC_MSG_RESULT([$CLASSPATH])
|
||||
fi
|
||||
|
||||
AC_SUBST(CLASSPATH)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# We need a Boot JDK to bootstrap the build.
|
||||
#
|
||||
|
||||
AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
|
||||
[
|
||||
BOOT_JDK_FOUND=no
|
||||
AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk],
|
||||
[path to Boot JDK (used to bootstrap build) @<:@probed@:>@])])
|
||||
|
||||
AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs],
|
||||
[specify additional arguments to be passed to Boot JDK tools @<:@none@:>@])])
|
||||
|
||||
USER_BOOT_JDK_OPTIONS="$with_boot_jdk_jvmargs"
|
||||
|
||||
# We look for the Boot JDK through various means, going from more certain to
|
||||
# more of a guess-work. After each test, BOOT_JDK_FOUND is set to "yes" if
|
||||
# we detected something (if so, the path to the jdk is in BOOT_JDK). But we
|
||||
# must check if this is indeed valid; otherwise we'll continue looking.
|
||||
|
||||
# Test: Is bootjdk explicitly set by command line arguments?
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_ARGUMENTS])
|
||||
if test "x$with_boot_jdk" != x && test "x$BOOT_JDK_FOUND" = xno; then
|
||||
# Having specified an argument which is incorrect will produce an instant failure;
|
||||
# we should not go on looking
|
||||
AC_MSG_ERROR([The path given by --with-boot-jdk does not contain a valid Boot JDK])
|
||||
fi
|
||||
|
||||
# Test: Is $JAVA_HOME set?
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_HOME])
|
||||
|
||||
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR])
|
||||
|
||||
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK])
|
||||
|
||||
# Test: Is there a JDK installed in default, well-known locations?
|
||||
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS])
|
||||
|
||||
# If we haven't found anything yet, we've truly lost. Give up.
|
||||
if test "x$BOOT_JDK_FOUND" = xno; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([openjdk])
|
||||
AC_MSG_NOTICE([Could not find a valid Boot JDK. $HELP_MSG])
|
||||
AC_MSG_NOTICE([This might be fixed by explicitly setting --with-boot-jdk])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
AC_SUBST(BOOT_JDK)
|
||||
|
||||
# Setup tools from the Boot JDK.
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, javadoc)
|
||||
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar)
|
||||
|
||||
# Finally, set some other options...
|
||||
|
||||
# Determine if the boot jdk jar supports the --date option
|
||||
if $JAR --help 2>&1 | $GREP -q -e "--date=TIMESTAMP"; then
|
||||
BOOT_JDK_JAR_SUPPORTS_DATE=true
|
||||
else
|
||||
BOOT_JDK_JAR_SUPPORTS_DATE=false
|
||||
fi
|
||||
AC_MSG_CHECKING([if Boot JDK jar supports --date=TIMESTAMP])
|
||||
AC_MSG_RESULT([$BOOT_JDK_JAR_SUPPORTS_DATE])
|
||||
AC_SUBST(BOOT_JDK_JAR_SUPPORTS_DATE)
|
||||
|
||||
# When compiling code to be executed by the Boot JDK, force compatibility with the
|
||||
# oldest supported bootjdk.
|
||||
OLDEST_BOOT_JDK_VERSION=`$ECHO $DEFAULT_ACCEPTABLE_BOOT_VERSIONS \
|
||||
| $TR " " "\n" | $SORT -n | $HEAD -n1`
|
||||
AC_SUBST(OLDEST_BOOT_JDK_VERSION)
|
||||
|
||||
# Check if the boot jdk is 32 or 64 bit
|
||||
if $JAVA -version 2>&1 | $GREP -q "64-Bit"; then
|
||||
BOOT_JDK_BITS="64"
|
||||
else
|
||||
BOOT_JDK_BITS="32"
|
||||
fi
|
||||
AC_MSG_CHECKING([if Boot JDK is 32 or 64 bits])
|
||||
AC_MSG_RESULT([$BOOT_JDK_BITS])
|
||||
|
||||
BOOTJDK_SETUP_CLASSPATH
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
|
||||
[
|
||||
##############################################################################
|
||||
#
|
||||
# Specify jvm options for anything that is run with the Boot JDK.
|
||||
# Not all JVM:s accept the same arguments on the command line.
|
||||
#
|
||||
AC_MSG_CHECKING([flags for boot jdk java command] )
|
||||
|
||||
# Force en-US environment
|
||||
UTIL_ADD_JVM_ARG_IF_OK([-Duser.language=en -Duser.country=US],boot_jdk_jvmargs,[$JAVA])
|
||||
|
||||
UTIL_ADD_JVM_ARG_IF_OK([-Xlog:all=off:stdout],boot_jdk_jvmargs,[$JAVA])
|
||||
UTIL_ADD_JVM_ARG_IF_OK([-Xlog:all=warning:stderr],boot_jdk_jvmargs,[$JAVA])
|
||||
|
||||
# Finally append user provided options to allow them to override.
|
||||
UTIL_ADD_JVM_ARG_IF_OK([$USER_BOOT_JDK_OPTIONS],boot_jdk_jvmargs,[$JAVA])
|
||||
|
||||
AC_MSG_RESULT([$boot_jdk_jvmargs])
|
||||
|
||||
# For now, general JAVA_FLAGS are the same as the boot jdk jvmargs
|
||||
JAVA_FLAGS=$boot_jdk_jvmargs
|
||||
AC_SUBST(JAVA_FLAGS)
|
||||
|
||||
AC_MSG_CHECKING([flags for boot jdk java command for big workloads])
|
||||
|
||||
# Starting amount of heap memory.
|
||||
UTIL_ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs_big,[$JAVA])
|
||||
BOOTCYCLE_JVM_ARGS_BIG=-Xms64M
|
||||
|
||||
# Maximum amount of heap memory.
|
||||
JVM_HEAP_LIMIT_32="768"
|
||||
# Running a 64 bit JVM allows for and requires a bigger heap
|
||||
JVM_HEAP_LIMIT_64="2048"
|
||||
JVM_HEAP_LIMIT_GLOBAL=`expr $MEMORY_SIZE / 2`
|
||||
if test "$JVM_HEAP_LIMIT_GLOBAL" -lt "$JVM_HEAP_LIMIT_32"; then
|
||||
JVM_HEAP_LIMIT_32=$JVM_HEAP_LIMIT_GLOBAL
|
||||
fi
|
||||
if test "$JVM_HEAP_LIMIT_GLOBAL" -lt "$JVM_HEAP_LIMIT_64"; then
|
||||
JVM_HEAP_LIMIT_64=$JVM_HEAP_LIMIT_GLOBAL
|
||||
fi
|
||||
if test "$JVM_HEAP_LIMIT_GLOBAL" -lt "512"; then
|
||||
JVM_HEAP_LIMIT_32=512
|
||||
JVM_HEAP_LIMIT_64=512
|
||||
fi
|
||||
|
||||
if test "x$BOOT_JDK_BITS" = "x32"; then
|
||||
JVM_MAX_HEAP=$JVM_HEAP_LIMIT_32
|
||||
else
|
||||
JVM_MAX_HEAP=$JVM_HEAP_LIMIT_64
|
||||
fi
|
||||
UTIL_ADD_JVM_ARG_IF_OK([-Xmx${JVM_MAX_HEAP}M],boot_jdk_jvmargs_big,[$JAVA])
|
||||
|
||||
AC_MSG_RESULT([$boot_jdk_jvmargs_big])
|
||||
|
||||
JAVA_FLAGS_BIG=$boot_jdk_jvmargs_big
|
||||
AC_SUBST(JAVA_FLAGS_BIG)
|
||||
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
|
||||
BOOTCYCLE_MAX_HEAP=$JVM_HEAP_LIMIT_32
|
||||
else
|
||||
BOOTCYCLE_MAX_HEAP=$JVM_HEAP_LIMIT_64
|
||||
fi
|
||||
BOOTCYCLE_JVM_ARGS_BIG="$BOOTCYCLE_JVM_ARGS_BIG -Xmx${BOOTCYCLE_MAX_HEAP}M"
|
||||
AC_MSG_CHECKING([flags for bootcycle boot jdk java command for big workloads])
|
||||
AC_MSG_RESULT([$BOOTCYCLE_JVM_ARGS_BIG])
|
||||
AC_SUBST(BOOTCYCLE_JVM_ARGS_BIG)
|
||||
|
||||
AC_MSG_CHECKING([flags for boot jdk java command for small workloads])
|
||||
|
||||
# Use serial gc for small short lived tools if possible
|
||||
UTIL_ADD_JVM_ARG_IF_OK([-XX:+UseSerialGC],boot_jdk_jvmargs_small,[$JAVA])
|
||||
UTIL_ADD_JVM_ARG_IF_OK([-Xms32M],boot_jdk_jvmargs_small,[$JAVA])
|
||||
UTIL_ADD_JVM_ARG_IF_OK([-Xmx512M],boot_jdk_jvmargs_small,[$JAVA])
|
||||
UTIL_ADD_JVM_ARG_IF_OK([-XX:TieredStopAtLevel=1],boot_jdk_jvmargs_small,[$JAVA])
|
||||
|
||||
AC_MSG_RESULT([$boot_jdk_jvmargs_small])
|
||||
|
||||
JAVA_FLAGS_SMALL=$boot_jdk_jvmargs_small
|
||||
AC_SUBST(JAVA_FLAGS_SMALL)
|
||||
|
||||
# Don't presuppose SerialGC is present in the buildjdk. Also, we cannot test
|
||||
# the buildjdk, but on the other hand we know what it will support.
|
||||
BUILD_JAVA_FLAGS_SMALL="-Xms32M -Xmx512M -XX:TieredStopAtLevel=1"
|
||||
AC_SUBST(BUILD_JAVA_FLAGS_SMALL)
|
||||
|
||||
JAVA_TOOL_FLAGS_SMALL=""
|
||||
for f in $JAVA_FLAGS_SMALL; do
|
||||
JAVA_TOOL_FLAGS_SMALL="$JAVA_TOOL_FLAGS_SMALL -J$f"
|
||||
done
|
||||
AC_SUBST(JAVA_TOOL_FLAGS_SMALL)
|
||||
])
|
||||
|
||||
# BUILD_JDK: the location of the latest JDK that can run
|
||||
# on the host system and supports the target class file version
|
||||
# generated in this JDK build. This variable should only be
|
||||
# used after the launchers are built.
|
||||
#
|
||||
|
||||
# Execute the check given as argument, and verify the result.
|
||||
# If the JDK was previously found, do nothing.
|
||||
# $1 A command line (typically autoconf macro) to execute
|
||||
AC_DEFUN([BOOTJDK_CHECK_BUILD_JDK],
|
||||
[
|
||||
if test "x$BUILD_JDK_FOUND" = xno; then
|
||||
# Execute the test
|
||||
$1
|
||||
|
||||
# If previous step claimed to have found a JDK, check it to see if it seems to be valid.
|
||||
if test "x$BUILD_JDK_FOUND" = xmaybe; then
|
||||
# Do we have a bin/java?
|
||||
if test ! -x "$BUILD_JDK/bin/java"; then
|
||||
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/java; ignoring])
|
||||
BUILD_JDK_FOUND=no
|
||||
elif test ! -x "$BUILD_JDK/bin/jlink"; then
|
||||
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/jlink; ignoring])
|
||||
BUILD_JDK_FOUND=no
|
||||
elif test ! -x "$BUILD_JDK/bin/jmod"; then
|
||||
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/jmod; ignoring])
|
||||
BUILD_JDK_FOUND=no
|
||||
elif test ! -x "$BUILD_JDK/bin/javac"; then
|
||||
# Do we have a bin/javac?
|
||||
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/javac; ignoring])
|
||||
AC_MSG_NOTICE([(This might be a JRE instead of an JDK)])
|
||||
BUILD_JDK_FOUND=no
|
||||
else
|
||||
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
[ BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $AWK '/version "[0-9a-zA-Z\._\-]+"/ {print $ 0; exit;}'` ]
|
||||
|
||||
# Extra M4 quote needed to protect [] in grep expression.
|
||||
[FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP "\"$VERSION_FEATURE([\.+-].*)?\""`]
|
||||
if test "x$FOUND_CORRECT_VERSION" = x; then
|
||||
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring])
|
||||
AC_MSG_NOTICE([(Your Build JDK must be version $VERSION_FEATURE)])
|
||||
BUILD_JDK_FOUND=no
|
||||
else
|
||||
# We're done!
|
||||
BUILD_JDK_FOUND=yes
|
||||
UTIL_FIXUP_PATH(BUILD_JDK)
|
||||
AC_MSG_CHECKING([for Build JDK])
|
||||
AC_MSG_RESULT([$BUILD_JDK])
|
||||
AC_MSG_CHECKING([Build JDK version])
|
||||
BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
|
||||
AC_MSG_RESULT([$BUILD_JDK_VERSION])
|
||||
fi # end check jdk version
|
||||
fi # end check java
|
||||
fi # end check build jdk found
|
||||
fi
|
||||
])
|
||||
|
||||
# By default the BUILD_JDK is the JDK_OUTPUTDIR. If the target architecture
|
||||
# is different than the host system doing the build (e.g. cross-compilation),
|
||||
# a special BUILD_JDK is built as part of the build process. An external
|
||||
# prebuilt BUILD_JDK can also be supplied.
|
||||
AC_DEFUN([BOOTJDK_SETUP_BUILD_JDK],
|
||||
[
|
||||
AC_ARG_WITH(build-jdk, [AS_HELP_STRING([--with-build-jdk],
|
||||
[path to JDK of same version as is being built@<:@the newly built JDK@:>@])])
|
||||
|
||||
EXTERNAL_BUILDJDK_PATH=""
|
||||
if test "x$with_build_jdk" != "x"; then
|
||||
BUILD_JDK_FOUND=no
|
||||
BOOTJDK_CHECK_BUILD_JDK([
|
||||
if test "x$with_build_jdk" != x; then
|
||||
BUILD_JDK=$with_build_jdk
|
||||
BUILD_JDK_FOUND=maybe
|
||||
AC_MSG_NOTICE([Found potential Build JDK using configure arguments])
|
||||
fi
|
||||
])
|
||||
if test "x$BUILD_JDK_FOUND" != "xyes"; then
|
||||
AC_MSG_CHECKING([for Build JDK])
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Could not find a suitable Build JDK])
|
||||
fi
|
||||
EXTERNAL_BUILDJDK_PATH="$BUILD_JDK"
|
||||
fi
|
||||
|
||||
AC_SUBST(EXTERNAL_BUILDJDK_PATH)
|
||||
])
|
||||
|
||||
# The docs-reference JDK is used to run javadoc for the docs-reference targets.
|
||||
# If not set, the reference docs will be built using the interim javadoc.
|
||||
AC_DEFUN([BOOTJDK_SETUP_DOCS_REFERENCE_JDK],
|
||||
[
|
||||
AC_ARG_WITH(docs-reference-jdk, [AS_HELP_STRING([--with-docs-reference-jdk],
|
||||
[path to JDK to use for building the reference documentation])])
|
||||
|
||||
AC_MSG_CHECKING([for docs-reference JDK])
|
||||
if test "x$with_docs_reference_jdk" != "x"; then
|
||||
DOCS_REFERENCE_JDK="$with_docs_reference_jdk"
|
||||
AC_MSG_RESULT([$DOCS_REFERENCE_JDK])
|
||||
DOCS_REFERENCE_JAVADOC="$DOCS_REFERENCE_JDK/bin/javadoc"
|
||||
if test ! -x "$DOCS_REFERENCE_JAVADOC"; then
|
||||
AC_MSG_ERROR([docs-reference JDK found at $DOCS_REFERENCE_JDK did not contain bin/javadoc])
|
||||
fi
|
||||
UTIL_FIXUP_EXECUTABLE(DOCS_REFERENCE_JAVADOC)
|
||||
else
|
||||
AC_MSG_RESULT([no, using interim javadoc for the docs-reference targets])
|
||||
# By leaving this empty, Docs.gmk will revert to the default interim javadoc
|
||||
DOCS_REFERENCE_JAVADOC=
|
||||
fi
|
||||
|
||||
AC_SUBST(DOCS_REFERENCE_JAVADOC)
|
||||
])
|
||||
46
make/autoconf/bootcycle-spec.gmk.template
Normal file
46
make/autoconf/bootcycle-spec.gmk.template
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
# Support for building boot cycle builds
|
||||
|
||||
# First include the real base spec.gmk file
|
||||
include @SPEC@
|
||||
|
||||
# Override specific values to do a boot cycle build
|
||||
|
||||
# Use a different Boot JDK
|
||||
BOOT_JDK := $(JDK_IMAGE_DIR)
|
||||
|
||||
# The bootcycle build has a different output directory
|
||||
OLD_OUTPUTDIR := @OUTPUTDIR@
|
||||
OUTPUTDIR := $(OLD_OUTPUTDIR)/bootcycle-build
|
||||
# No spaces in patsubst to avoid leading space in variable
|
||||
JAVAC_SERVER_DIR := $(patsubst $(OLD_OUTPUTDIR)%,$(OUTPUTDIR)%,$(JAVAC_SERVER_DIR))
|
||||
|
||||
JAVA_CMD := $(FIXPATH) $(BOOT_JDK)/bin/java
|
||||
JAVAC_CMD := $(FIXPATH) $(BOOT_JDK)/bin/javac
|
||||
JAR_CMD := $(FIXPATH) $(BOOT_JDK)/bin/jar
|
||||
# The bootcycle JVM arguments may differ from the original boot jdk.
|
||||
JAVA_FLAGS_BIG := @BOOTCYCLE_JVM_ARGS_BIG@
|
||||
1837
make/autoconf/build-aux/autoconf-config.guess
Normal file
1837
make/autoconf/build-aux/autoconf-config.guess
Normal file
File diff suppressed because it is too large
Load diff
1997
make/autoconf/build-aux/autoconf-config.sub
Normal file
1997
make/autoconf/build-aux/autoconf-config.sub
Normal file
File diff suppressed because it is too large
Load diff
106
make/autoconf/build-aux/config.guess
vendored
Normal file
106
make/autoconf/build-aux/config.guess
vendored
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2021, Azul Systems, Inc. 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 wrapper for the config.guess from autoconf. The latter does not
|
||||
# properly detect 64 bit systems on all platforms. Instead of patching the
|
||||
# autoconf system (which might easily get lost in a future update), we wrap it
|
||||
# and fix the broken property, if needed.
|
||||
|
||||
DIR=`dirname $0`
|
||||
OUT=`. $DIR/autoconf-config.guess 2> /dev/null`
|
||||
|
||||
# Handle some cases that autoconf-config.guess is not capable of
|
||||
if [ "x$OUT" = x ]; then
|
||||
if [ `uname -s` = Linux ]; then
|
||||
# Test and fix little endian MIPS.
|
||||
if [ `uname -m` = mipsel ]; then
|
||||
OUT=mipsel-unknown-linux-gnu
|
||||
fi
|
||||
# Test and fix cygwin machine arch .x86_64
|
||||
elif [[ `uname -s` = CYGWIN* ]]; then
|
||||
if [ `uname -m` = ".x86_64" ]; then
|
||||
OUT=x86_64-unknown-cygwin
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$OUT" = x ]; then
|
||||
# Run autoconf-config.guess again to get the error message.
|
||||
. $DIR/autoconf-config.guess > /dev/null
|
||||
else
|
||||
printf "guessed by custom config.guess... " >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Test and fix cygwin/msys CPUs
|
||||
echo $OUT | grep -e "-pc-cygwin" > /dev/null 2> /dev/null
|
||||
if test $? != 0; then
|
||||
echo $OUT | grep -e "-pc-mingw" > /dev/null 2> /dev/null
|
||||
fi
|
||||
if test $? = 0; then
|
||||
case `echo $PROCESSOR_IDENTIFIER | cut -f1 -d' '` in
|
||||
intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64)
|
||||
REAL_CPU=x86_64
|
||||
OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
|
||||
;;
|
||||
ARMv8)
|
||||
REAL_CPU=aarch64
|
||||
OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Test and fix wsl
|
||||
echo $OUT | grep '\(unknown\|pc\)-linux-gnu' > /dev/null 2> /dev/null
|
||||
if test $? = 0; then
|
||||
uname -r | grep -i microsoft > /dev/null 2> /dev/null
|
||||
if test $? = 0; then
|
||||
OUT=`echo $OUT | sed -e 's/\(unknown\|pc\)-linux-gnu/pc-wsl/'`
|
||||
fi
|
||||
fi
|
||||
|
||||
# Test and fix architecture string on AIX
|
||||
# On AIX 'config.guess' returns 'powerpc' as architecture but 'powerpc' is
|
||||
# implicitly handled as 32-bit architecture in 'platform.m4' so we check
|
||||
# for the kernel mode rewrite it to 'powerpc64' if we'Re running in 64-bit mode.
|
||||
# The check could also be done with `/usr/sbin/prtconf | grep "Kernel Type" | grep "64-bit"`
|
||||
echo $OUT | grep powerpc-ibm-aix > /dev/null 2> /dev/null
|
||||
if test $? = 0; then
|
||||
if [ -x /bin/getconf ] ; then
|
||||
KERNEL_BITMODE=`getconf KERNEL_BITMODE`
|
||||
if [ "$KERNEL_BITMODE" = "32" ]; then
|
||||
KERNEL_BITMODE=""
|
||||
fi
|
||||
fi
|
||||
OUT=powerpc$KERNEL_BITMODE`echo $OUT | sed -e 's/[^-]*//'`
|
||||
fi
|
||||
|
||||
# Test and fix cpu on Macosx when C preprocessor is not on the path
|
||||
echo $OUT | grep i386-apple-darwin > /dev/null 2> /dev/null
|
||||
if test $? = 0; then
|
||||
REAL_CPU=`uname -m`
|
||||
OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
|
||||
fi
|
||||
|
||||
echo $OUT
|
||||
55
make/autoconf/build-aux/config.sub
vendored
Normal file
55
make/autoconf/build-aux/config.sub
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2014, 2023, 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 wrapper for the config.guess from autoconf. The latter
|
||||
# does not know about all of our platforms. Instead of patching the
|
||||
# autoconf system (which might easily get lost in a future update), we
|
||||
# wrap it and fix the broken property, if needed.
|
||||
|
||||
DIR=`dirname $0`
|
||||
|
||||
# Allow wsl
|
||||
if echo $* | grep pc-wsl >/dev/null ; then
|
||||
echo $*
|
||||
exit
|
||||
fi
|
||||
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
- ) # Use stdin as input.
|
||||
sub_args="$sub_args $1"
|
||||
shift; break ;;
|
||||
* )
|
||||
sub_args="$sub_args $1"
|
||||
shift; ;;
|
||||
esac
|
||||
done
|
||||
|
||||
result=`. $DIR/autoconf-config.sub $sub_args "$@"`
|
||||
exitcode=$?
|
||||
|
||||
echo $result
|
||||
exit $exitcode
|
||||
28
make/autoconf/build-aux/install.sh
Normal file
28
make/autoconf/build-aux/install.sh
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2017, 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.
|
||||
#
|
||||
|
||||
# This file is empty on purpose. It's a placeholder which is required by
|
||||
# autoconf, but it serves no purpose for us.
|
||||
181
make/autoconf/build-aux/pkg.m4
Normal file
181
make/autoconf/build-aux/pkg.m4
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
|
||||
#
|
||||
# Copyright (c) 2012, 2024, 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.
|
||||
#
|
||||
|
||||
#
|
||||
# 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
|
||||
387
make/autoconf/build-performance.m4
Normal file
387
make/autoconf/build-performance.m4
Normal file
|
|
@ -0,0 +1,387 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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([BPERF_CHECK_CORES],
|
||||
[
|
||||
AC_MSG_CHECKING([for number of cores])
|
||||
|
||||
if test -f /proc/cpuinfo; then
|
||||
# Looks like a Linux (or cygwin) system
|
||||
NUM_CORES=`cat /proc/cpuinfo | grep -cw processor`
|
||||
if test "$NUM_CORES" -eq "0"; then
|
||||
NUM_CORES=`cat /proc/cpuinfo | grep -c ^CPU`
|
||||
fi
|
||||
elif test -x /usr/sbin/sysctl; then
|
||||
# Looks like a MacOSX system
|
||||
NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
|
||||
elif test "x$OPENJDK_BUILD_OS" = xaix ; then
|
||||
NUM_CORES=`lparstat -m 2> /dev/null | $GREP -o "lcpu=[[0-9]]*" | $CUT -d "=" -f 2`
|
||||
elif test -n "$NUMBER_OF_PROCESSORS"; then
|
||||
# On windows, look in the env
|
||||
NUM_CORES=$NUMBER_OF_PROCESSORS
|
||||
fi
|
||||
|
||||
if test "$NUM_CORES" -eq "0"; then
|
||||
NUM_CORES=1
|
||||
AC_MSG_RESULT([could not detect number of cores, defaulting to 1])
|
||||
AC_MSG_WARN([This will disable all parallelism from build!])
|
||||
else
|
||||
AC_MSG_RESULT([$NUM_CORES])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
|
||||
[
|
||||
AC_MSG_CHECKING([for memory size])
|
||||
# Default to 1024 MB
|
||||
MEMORY_SIZE=1024
|
||||
FOUND_MEM=no
|
||||
|
||||
if test -f /proc/meminfo; then
|
||||
# Looks like a Linux (or cygwin) system
|
||||
MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'`
|
||||
MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
|
||||
FOUND_MEM=yes
|
||||
elif test -x /usr/sbin/prtconf; then
|
||||
# Looks like an AIX system
|
||||
MEMORY_SIZE=`/usr/sbin/prtconf 2> /dev/null | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
|
||||
FOUND_MEM=yes
|
||||
elif test -x /usr/sbin/sysctl; then
|
||||
# Looks like a MacOSX system
|
||||
MEMORY_SIZE=`/usr/sbin/sysctl -n hw.memsize`
|
||||
MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
|
||||
FOUND_MEM=yes
|
||||
elif test "x$OPENJDK_BUILD_OS" = xwindows; then
|
||||
# Windows, but without cygwin
|
||||
MEMORY_SIZE=`powershell -Command \
|
||||
"(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory" | $SED 's/\\r//g' `
|
||||
MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
|
||||
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 $MEMORY_SIZE MB])
|
||||
AC_MSG_WARN([This might seriously impact build performance!])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([BPERF_SETUP_BUILD_CORES],
|
||||
[
|
||||
# How many cores do we have on this build system?
|
||||
AC_ARG_WITH(num-cores, [AS_HELP_STRING([--with-num-cores],
|
||||
[number of cores in the build system, e.g. --with-num-cores=8 @<:@probed@:>@])])
|
||||
if test "x$with_num_cores" = x; then
|
||||
# The number of cores were not specified, try to probe them.
|
||||
BPERF_CHECK_CORES
|
||||
else
|
||||
NUM_CORES=$with_num_cores
|
||||
fi
|
||||
AC_SUBST(NUM_CORES)
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([BPERF_SETUP_BUILD_MEMORY],
|
||||
[
|
||||
# How much memory do we have on this build system?
|
||||
AC_ARG_WITH(memory-size, [AS_HELP_STRING([--with-memory-size],
|
||||
[memory (in MB) available in the build system, e.g. --with-memory-size=1024 @<:@probed@:>@])])
|
||||
if test "x$with_memory_size" = x; then
|
||||
# The memory size was not specified, try to probe it.
|
||||
BPERF_CHECK_MEMORY_SIZE
|
||||
else
|
||||
MEMORY_SIZE=$with_memory_size
|
||||
fi
|
||||
AC_SUBST(MEMORY_SIZE)
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([BPERF_SETUP_BUILD_JOBS],
|
||||
[
|
||||
# Provide a decent default number of parallel jobs for make depending on
|
||||
# number of cores, amount of memory and machine architecture.
|
||||
AC_ARG_WITH(jobs, [AS_HELP_STRING([--with-jobs],
|
||||
[number of parallel jobs to let make run @<:@calculated based on cores and memory@:>@])])
|
||||
if test "x$with_jobs" = x; then
|
||||
# Number of jobs was not specified, calculate.
|
||||
AC_MSG_CHECKING([for appropriate number of jobs to run in parallel])
|
||||
# Approximate memory in GB.
|
||||
memory_gb=`expr $MEMORY_SIZE / 1024`
|
||||
# Pick the lowest of memory in gb and number of cores.
|
||||
if test "$memory_gb" -lt "$NUM_CORES"; then
|
||||
JOBS="$memory_gb"
|
||||
else
|
||||
JOBS="$NUM_CORES"
|
||||
fi
|
||||
if test "$JOBS" -eq "0"; then
|
||||
JOBS=1
|
||||
fi
|
||||
AC_MSG_RESULT([$JOBS])
|
||||
else
|
||||
JOBS=$with_jobs
|
||||
fi
|
||||
AC_SUBST(JOBS)
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([BPERF_SETUP_TEST_JOBS],
|
||||
[
|
||||
# The number of test jobs will be chosen automatically if TEST_JOBS is 0
|
||||
AC_ARG_WITH(test-jobs, [AS_HELP_STRING([--with-test-jobs],
|
||||
[number of parallel tests jobs to run @<:@based on build jobs@:>@])])
|
||||
if test "x$with_test_jobs" = x; then
|
||||
TEST_JOBS=0
|
||||
else
|
||||
TEST_JOBS=$with_test_jobs
|
||||
fi
|
||||
AC_SUBST(TEST_JOBS)
|
||||
])
|
||||
|
||||
AC_DEFUN([BPERF_SETUP_CCACHE],
|
||||
[
|
||||
# Check if ccache is available
|
||||
CCACHE_AVAILABLE=true
|
||||
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(CCACHE, ccache)
|
||||
|
||||
AC_MSG_CHECKING([if ccache is available])
|
||||
if test "x$TOOLCHAIN_TYPE" != "xgcc" && test "x$TOOLCHAIN_TYPE" != "xclang"; then
|
||||
AC_MSG_RESULT([no, not supported for toolchain type $TOOLCHAIN_TYPE])
|
||||
CCACHE_AVAILABLE=false
|
||||
elif test "x$CCACHE" = "x"; then
|
||||
AC_MSG_RESULT([no, ccache binary missing or not executable])
|
||||
CCACHE_AVAILABLE=false
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
|
||||
CCACHE_STATUS=""
|
||||
UTIL_ARG_ENABLE(NAME: ccache, DEFAULT: false, AVAILABLE: $CCACHE_AVAILABLE,
|
||||
DESC: [enable using ccache to speed up recompilations],
|
||||
CHECKING_MSG: [if ccache is enabled],
|
||||
IF_ENABLED: [
|
||||
CCACHE_VERSION=[`$CCACHE --version | head -n1 | $SED 's/[A-Za-z ]*//'`]
|
||||
CCACHE_STATUS="Active ($CCACHE_VERSION)"
|
||||
],
|
||||
IF_DISABLED: [
|
||||
CCACHE=""
|
||||
])
|
||||
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"
|
||||
if test "x$CCACHE" = x; then
|
||||
AC_MSG_WARN([--with-ccache-dir has no meaning when ccache is not enabled])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$CCACHE" != x; then
|
||||
BPERF_SETUP_CCACHE_USAGE
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([BPERF_SETUP_CCACHE_USAGE],
|
||||
[
|
||||
if test "x$CCACHE" != x; then
|
||||
if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
|
||||
HAS_BAD_CCACHE=[`$ECHO $CCACHE_VERSION | \
|
||||
$GREP -e '^1\.' -e '^2\.' -e '^3\.0\.' -e '^3\.1\.'`]
|
||||
if test "x$HAS_BAD_CCACHE" != "x"; then
|
||||
AC_MSG_ERROR([On macosx, ccache 3.2 or later is required, found $CCACHE_VERSION])
|
||||
fi
|
||||
fi
|
||||
if test "x$USE_PRECOMPILED_HEADER" = "xtrue"; then
|
||||
HAS_BAD_CCACHE=[`$ECHO $CCACHE_VERSION | \
|
||||
$GREP -e '^1.*' -e '^2.*' -e '^3\.0.*' -e '^3\.1\.[0123]$'`]
|
||||
if test "x$HAS_BAD_CCACHE" != "x"; then
|
||||
AC_MSG_ERROR([Precompiled headers requires ccache 3.1.4 or later, found $CCACHE_VERSION])
|
||||
fi
|
||||
AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
|
||||
CCACHE_PRECOMP_FLAG="-fpch-preprocess"
|
||||
PUSHED_FLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CCACHE_PRECOMP_FLAG $CXXFLAGS"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [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])
|
||||
CFLAGS_CCACHE="$CCACHE_PRECOMP_FLAG"
|
||||
AC_SUBST(CFLAGS_CCACHE)
|
||||
CCACHE_SLOPPINESS=pch_defines,time_macros
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Cannot use ccache with precompiled headers without compiler support for $CCACHE_PRECOMP_FLAG])
|
||||
fi
|
||||
fi
|
||||
|
||||
# The CCACHE_BASEDIR needs to end with '/' as ccache will otherwise think
|
||||
# directories next to it, that have the base dir name as a prefix, are sub
|
||||
# directories of CCACHE_BASEDIR.
|
||||
CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR \
|
||||
CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS CCACHE_BASEDIR=$WORKSPACE_ROOT/ $CCACHE"
|
||||
|
||||
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
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Runs icecc-create-env once and prints the error if it fails
|
||||
#
|
||||
# $1: arguments to icecc-create-env
|
||||
# $2: log file
|
||||
#
|
||||
AC_DEFUN([BPERF_RUN_ICECC_CREATE_ENV],
|
||||
[
|
||||
( cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
|
||||
&& ${ICECC_CREATE_ENV} $1 > $2 2>&1 )
|
||||
if test "$?" != "0"; then
|
||||
AC_MSG_NOTICE([icecc-create-env output:])
|
||||
cat $2
|
||||
AC_MSG_ERROR([Failed to create icecc compiler environment])
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Optionally enable distributed compilation of native code using icecc/icecream
|
||||
#
|
||||
AC_DEFUN([BPERF_SETUP_ICECC],
|
||||
[
|
||||
UTIL_ARG_ENABLE(NAME: icecc, DEFAULT: false, RESULT: ENABLE_ICECC,
|
||||
DESC: [enable distributed compilation of native code using icecc/icecream])
|
||||
|
||||
if test "x$ENABLE_ICECC" = "xtrue"; then
|
||||
UTIL_REQUIRE_PROGS(ICECC_CMD, icecc)
|
||||
old_path="$PATH"
|
||||
|
||||
# Look for icecc-create-env in some known places
|
||||
PATH="$PATH:/usr/lib/icecc:/usr/lib64/icecc"
|
||||
UTIL_REQUIRE_PROGS(ICECC_CREATE_ENV, icecc-create-env)
|
||||
# Use icecc-create-env to create a minimal compilation environment that can
|
||||
# be sent to the other hosts in the icecream cluster.
|
||||
icecc_create_env_log="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/icecc_create_env.log"
|
||||
${MKDIR} -p ${CONFIGURESUPPORT_OUTPUTDIR}/icecc
|
||||
# Older versions of icecc does not have the --gcc parameter
|
||||
if ${ICECC_CREATE_ENV} | $GREP -q -e --gcc; then
|
||||
icecc_gcc_arg="--gcc"
|
||||
fi
|
||||
if test "x${TOOLCHAIN_TYPE}" = "xgcc"; then
|
||||
BPERF_RUN_ICECC_CREATE_ENV([${icecc_gcc_arg} ${CC} ${CXX}], \
|
||||
${icecc_create_env_log})
|
||||
elif test "x$TOOLCHAIN_TYPE" = "xclang"; then
|
||||
# For clang, the icecc compilerwrapper is needed. It usually resides next
|
||||
# to icecc-create-env.
|
||||
UTIL_REQUIRE_PROGS(ICECC_WRAPPER, compilerwrapper)
|
||||
BPERF_RUN_ICECC_CREATE_ENV([--clang ${CC} ${ICECC_WRAPPER}], ${icecc_create_env_log})
|
||||
else
|
||||
AC_MSG_ERROR([Can only create icecc compiler packages for toolchain types gcc and clang])
|
||||
fi
|
||||
PATH="$old_path"
|
||||
# The bundle with the compiler gets a name based on checksums. Parse log file
|
||||
# to find it.
|
||||
ICECC_ENV_BUNDLE_BASENAME="`${SED} -n '/^creating/s/creating //p' ${icecc_create_env_log}`"
|
||||
ICECC_ENV_BUNDLE="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/${ICECC_ENV_BUNDLE_BASENAME}"
|
||||
if test ! -f ${ICECC_ENV_BUNDLE}; then
|
||||
AC_MSG_ERROR([icecc-create-env did not produce an environment ${ICECC_ENV_BUNDLE}])
|
||||
fi
|
||||
AC_MSG_CHECKING([for icecc build environment for target compiler])
|
||||
AC_MSG_RESULT([${ICECC_ENV_BUNDLE}])
|
||||
ICECC="ICECC_VERSION=${ICECC_ENV_BUNDLE} ICECC_CC=${CC} ICECC_CXX=${CXX} ${ICECC_CMD}"
|
||||
|
||||
if test "x${COMPILE_TYPE}" = "xcross"; then
|
||||
# If cross compiling, create a separate env package for the build compiler
|
||||
# Assume "gcc" or "cc" is gcc and "clang" is clang. Otherwise bail.
|
||||
icecc_create_env_log_build="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/icecc_create_env_build.log"
|
||||
if test "x${BUILD_CC##*/}" = "xgcc" || test "x${BUILD_CC##*/}" = "xcc"; then
|
||||
BPERF_RUN_ICECC_CREATE_ENV([${icecc_gcc_arg} ${BUILD_CC} ${BUILD_CXX}], \
|
||||
${icecc_create_env_log_build})
|
||||
elif test "x${BUILD_CC##*/}" = "xclang"; then
|
||||
BPERF_RUN_ICECC_CREATE_ENV([--clang ${BUILD_CC} ${ICECC_WRAPPER}], ${icecc_create_env_log_build})
|
||||
else
|
||||
AC_MSG_ERROR([Cannot create icecc compiler package for ${BUILD_CC}])
|
||||
fi
|
||||
ICECC_ENV_BUNDLE_BASENAME="`${SED} -n '/^creating/s/creating //p' ${icecc_create_env_log_build}`"
|
||||
ICECC_ENV_BUNDLE="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/${ICECC_ENV_BUNDLE_BASENAME}"
|
||||
if test ! -f ${ICECC_ENV_BUNDLE}; then
|
||||
AC_MSG_ERROR([icecc-create-env did not produce an environment ${ICECC_ENV_BUNDLE}])
|
||||
fi
|
||||
AC_MSG_CHECKING([for icecc build environment for build compiler])
|
||||
AC_MSG_RESULT([${ICECC_ENV_BUNDLE}])
|
||||
BUILD_ICECC="ICECC_VERSION=${ICECC_ENV_BUNDLE} ICECC_CC=${BUILD_CC} \
|
||||
ICECC_CXX=${BUILD_CXX} ${ICECC_CMD}"
|
||||
else
|
||||
BUILD_ICECC="${ICECC}"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(ICECC)
|
||||
AC_SUBST(BUILD_ICECC)
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
|
||||
[
|
||||
# Are precompiled headers available?
|
||||
PRECOMPILED_HEADERS_AVAILABLE=true
|
||||
AC_MSG_CHECKING([if precompiled headers are available])
|
||||
if test "x$ICECC" != "x"; then
|
||||
AC_MSG_RESULT([no, does not work effectively with icecc])
|
||||
PRECOMPILED_HEADERS_AVAILABLE=false
|
||||
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
# Check that the compiler actually supports precomp headers.
|
||||
echo "int alfa();" > conftest.h
|
||||
$CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
|
||||
if test ! -f conftest.hpp.gch; then
|
||||
PRECOMPILED_HEADERS_AVAILABLE=false
|
||||
AC_MSG_RESULT([no, gcc fails to compile properly with -x c++-header])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
$RM conftest.h conftest.hpp.gch
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
|
||||
UTIL_ARG_ENABLE(NAME: precompiled-headers, DEFAULT: auto,
|
||||
RESULT: USE_PRECOMPILED_HEADER, AVAILABLE: $PRECOMPILED_HEADERS_AVAILABLE,
|
||||
DESC: [enable using precompiled headers when compiling C++])
|
||||
AC_SUBST(USE_PRECOMPILED_HEADER)
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN_ONCE([BPERF_SETUP_JAVAC_SERVER],
|
||||
[
|
||||
UTIL_ARG_ENABLE(NAME: javac-server, DEFAULT: true,
|
||||
RESULT: ENABLE_JAVAC_SERVER,
|
||||
DESC: [enable javac server],
|
||||
CHECKING_MSG: [whether to use javac server])
|
||||
AC_SUBST(ENABLE_JAVAC_SERVER)
|
||||
])
|
||||
110
make/autoconf/buildjdk-spec.gmk.template
Normal file
110
make/autoconf/buildjdk-spec.gmk.template
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
#
|
||||
# Copyright (c) 2015, 2025, 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.
|
||||
#
|
||||
|
||||
# This spec file is used to compile a BUILD_JDK while cross compiling. The
|
||||
# BUILD_JDK runs on the build/host platform and is of the same version as
|
||||
# the main build.
|
||||
|
||||
# First include the real base spec.gmk file
|
||||
include @SPEC@
|
||||
|
||||
CC := @BUILD_CC@
|
||||
CXX := @BUILD_CXX@
|
||||
# Ideally this should be probed by configure but that is tricky to implement,
|
||||
# and this should work in most cases.
|
||||
CPP := @BUILD_CC@ -E
|
||||
LD := @BUILD_LD@
|
||||
LDCXX := @BUILD_LDCXX@
|
||||
AS := @BUILD_AS@
|
||||
NM := @BUILD_NM@
|
||||
AR := @BUILD_AR@
|
||||
LIB := @BUILD_LIB@
|
||||
OBJCOPY := @BUILD_OBJCOPY@
|
||||
STRIP := @BUILD_STRIP@
|
||||
SYSROOT_CFLAGS := @BUILD_SYSROOT_CFLAGS@
|
||||
SYSROOT_LDFLAGS := @BUILD_SYSROOT_LDFLAGS@
|
||||
|
||||
# These directories should not be moved to BUILDJDK_OUTPUTDIR
|
||||
HOTSPOT_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(HOTSPOT_OUTPUTDIR))
|
||||
BUILDTOOLS_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(BUILDTOOLS_OUTPUTDIR))
|
||||
SUPPORT_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(SUPPORT_OUTPUTDIR))
|
||||
JDK_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(JDK_OUTPUTDIR))
|
||||
IMAGES_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(IMAGES_OUTPUTDIR))
|
||||
|
||||
OPENJDK_BUILD_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
|
||||
OPENJDK_BUILD_CPU_LEGACY_LIB := @OPENJDK_BUILD_CPU_LEGACY_LIB@
|
||||
OPENJDK_BUILD_LIBC := @OPENJDK_BUILD_LIBC@
|
||||
OPENJDK_TARGET_CPU := @OPENJDK_BUILD_CPU@
|
||||
OPENJDK_TARGET_CPU_ARCH := @OPENJDK_BUILD_CPU_ARCH@
|
||||
OPENJDK_TARGET_CPU_BITS := @OPENJDK_BUILD_CPU_BITS@
|
||||
OPENJDK_TARGET_CPU_ENDIAN := @OPENJDK_BUILD_CPU_ENDIAN@
|
||||
OPENJDK_TARGET_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
|
||||
OPENJDK_TARGET_LIBC := @OPENJDK_BUILD_LIBC@
|
||||
OPENJDK_TARGET_OS_INCLUDE_SUBDIR := @OPENJDK_BUILD_OS_INCLUDE_SUBDIR@
|
||||
|
||||
HOTSPOT_TARGET_OS := @HOTSPOT_BUILD_OS@
|
||||
HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_BUILD_OS_TYPE@
|
||||
HOTSPOT_TARGET_CPU := @HOTSPOT_BUILD_CPU@
|
||||
HOTSPOT_TARGET_CPU_ARCH := @HOTSPOT_BUILD_CPU_ARCH@
|
||||
HOTSPOT_TARGET_CPU_DEFINE := @HOTSPOT_BUILD_CPU_DEFINE@
|
||||
HOTSPOT_TARGET_LIBC := @HOTSPOT_BUILD_LIBC@
|
||||
|
||||
CFLAGS_JDKLIB := @OPENJDK_BUILD_CFLAGS_JDKLIB@
|
||||
CXXFLAGS_JDKLIB := @OPENJDK_BUILD_CXXFLAGS_JDKLIB@
|
||||
LDFLAGS_JDKLIB := @OPENJDK_BUILD_LDFLAGS_JDKLIB@
|
||||
CFLAGS_JDKEXE := @OPENJDK_BUILD_CFLAGS_JDKEXE@
|
||||
CXXFLAGS_JDKEXE := @OPENJDK_BUILD_CXXFLAGS_JDKEXE@
|
||||
LDFLAGS_JDKEXE := @OPENJDK_BUILD_LDFLAGS_JDKEXE@
|
||||
|
||||
JVM_CFLAGS := @OPENJDK_BUILD_JVM_CFLAGS@
|
||||
JVM_LDFLAGS := @OPENJDK_BUILD_JVM_LDFLAGS@
|
||||
JVM_ASFLAGS := @OPENJDK_BUILD_JVM_ASFLAGS@
|
||||
JVM_LIBS := @OPENJDK_BUILD_JVM_LIBS@
|
||||
|
||||
FDLIBM_CFLAGS := @OPENJDK_BUILD_FDLIBM_CFLAGS@
|
||||
|
||||
INTERIM_LANGTOOLS_ARGS := $(subst $(OUTPUTDIR),$(BUILDJDK_OUTPUTDIR),$(INTERIM_LANGTOOLS_ARGS))
|
||||
|
||||
# The compiler for the build platform is likely not warning compatible with the official
|
||||
# compiler.
|
||||
WARNINGS_AS_ERRORS := false
|
||||
DISABLE_WARNING_PREFIX := @BUILD_CC_DISABLE_WARNING_PREFIX@
|
||||
|
||||
# Save speed and disk space by not enabling debug symbols for the buildjdk
|
||||
ENABLE_DEBUG_SYMBOLS := false
|
||||
|
||||
JVM_VARIANTS := server
|
||||
JVM_VARIANT_MAIN := server
|
||||
JVM_FEATURES_server := cds compiler1 compiler2 g1gc serialgc
|
||||
|
||||
# Some users still set EXTRA_*FLAGS on the make command line. Must
|
||||
# make sure to override that when building buildjdk.
|
||||
override EXTRA_CFLAGS :=
|
||||
override EXTRA_CXXFLAGS :=
|
||||
override EXTRA_LDFLAGS :=
|
||||
|
||||
# hsdis is not needed
|
||||
HSDIS_BACKEND := none
|
||||
ENABLE_HSDIS_BUNDLING := false
|
||||
113
make/autoconf/compare.sh.template
Normal file
113
make/autoconf/compare.sh.template
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2012, 2025, 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 script is processed by configure before it's usable. It is run from
|
||||
# the root of the build directory.
|
||||
|
||||
|
||||
################################################################################
|
||||
# Substitutions from autoconf
|
||||
|
||||
export LEGACY_BUILD_DIR=@OPENJDK_TARGET_OS@-@OPENJDK_TARGET_CPU_LEGACY@
|
||||
|
||||
export OPENJDK_BUILD_OS_ENV="@OPENJDK_BUILD_OS_ENV@"
|
||||
export OPENJDK_TARGET_OS="@OPENJDK_TARGET_OS@"
|
||||
export OPENJDK_TARGET_CPU="@OPENJDK_TARGET_CPU@"
|
||||
export DEBUG_LEVEL="@DEBUG_LEVEL@"
|
||||
|
||||
export AWK="@AWK@"
|
||||
export BASH="@BASH@"
|
||||
export CAT="@CAT@"
|
||||
export CMP="@CMP@"
|
||||
export CODESIGN="@CODESIGN@"
|
||||
export CP="@CP@"
|
||||
export CUT="@CUT@"
|
||||
export DIFF="@DIFF@"
|
||||
export DUMPBIN="@DUMPBIN@"
|
||||
export ECHO="@ECHO@"
|
||||
export EXPR="@EXPR@"
|
||||
export FILE="@FILE@"
|
||||
export FIND="@FIND@"
|
||||
export GREP="@GREP@"
|
||||
export GUNZIP="@GUNZIP@"
|
||||
export HEAD="@HEAD@"
|
||||
export LDD="@LDD@"
|
||||
export LN="@LN@"
|
||||
export MKDIR="@MKDIR@"
|
||||
export MV="@MV@"
|
||||
export NM="@NM@"
|
||||
export OBJDUMP="@OBJDUMP@"
|
||||
export OTOOL="@OTOOL@"
|
||||
export PRINTF="@PRINTF@"
|
||||
export READELF="@READELF@"
|
||||
export RM="@RM@"
|
||||
export SED="@SED@"
|
||||
export SORT="@SORT@"
|
||||
export STAT="@STAT@"
|
||||
export STRIP="@STRIP@ @STRIPFLAGS@"
|
||||
export TAR="@TAR@"
|
||||
export TEE="@TEE@"
|
||||
export UNIQ="@UNIQ@"
|
||||
export UNARCHIVE="@UNZIP@ -q -o"
|
||||
|
||||
export TOPDIR="@TOPDIR@"
|
||||
export OUTPUTDIR="@OUTPUTDIR@"
|
||||
|
||||
if [ "@COMPILE_TYPE@" != "cross" ]; then
|
||||
export JAVAP="@FIXPATH@ $OUTPUTDIR/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
|
||||
export JIMAGE="@FIXPATH@ $OUTPUTDIR/jdk/bin/jimage"
|
||||
export JMOD="@FIXPATH@ $OUTPUTDIR/jdk/bin/jmod"
|
||||
elif [ "@CREATE_BUILDJDK@" = "true" ]; then
|
||||
export JAVAP="@FIXPATH@ $OUTPUTDIR/buildjdk/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
|
||||
export JIMAGE="@FIXPATH@ $OUTPUTDIR/buildjdk/jdk/bin/jimage"
|
||||
export JMOD="@FIXPATH@ $OUTPUTDIR/buildjdk/jdk/bin/jmod"
|
||||
else
|
||||
export JAVAP="@FIXPATH@ @BUILD_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
|
||||
export JIMAGE="@FIXPATH@ @BUILD_JDK@/bin/jimage"
|
||||
export JMOD="@FIXPATH@ @BUILD_JDK@/bin/jmod"
|
||||
fi
|
||||
|
||||
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
|
||||
if [[ $OPENJDK_BUILD_OS_ENV =~ ^windows.wsl ]]; then
|
||||
export WSLENV=PATH/l
|
||||
fi
|
||||
export PATH="$PATH:@TOOLCHAIN_PATH@"
|
||||
fi
|
||||
|
||||
export USE_PRECOMPILED_HEADER="@USE_PRECOMPILED_HEADER@"
|
||||
|
||||
# Now locate the main script and run it.
|
||||
REAL_COMPARE_SCRIPT="$TOPDIR/make/scripts/compare.sh"
|
||||
if [ ! -e "$REAL_COMPARE_SCRIPT" ]; then
|
||||
echo "Error: Cannot locate compare script, it should have been in $REAL_COMPARE_SCRIPT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Rotate logs
|
||||
$RM $OUTPUTDIR/compare.log.old 2> /dev/null
|
||||
$MV $OUTPUTDIR/compare.log $OUTPUTDIR/compare.log.old 2> /dev/null
|
||||
|
||||
export SCRIPT_DIR="$( cd "$( dirname "$0" )" > /dev/null && pwd )"
|
||||
|
||||
$BASH $TOPDIR/make/scripts/compare-logger.sh $OUTPUTDIR/compare.log $BASH "$REAL_COMPARE_SCRIPT" "$@"
|
||||
384
make/autoconf/configure
vendored
Normal file
384
make/autoconf/configure
vendored
Normal file
|
|
@ -0,0 +1,384 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2012, 2025, 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 test "x$1" != xCHECKME; then
|
||||
echo "ERROR: Calling this wrapper script directly is not supported."
|
||||
echo "Use the 'configure' script in the top-level directory instead."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The next argument is the absolute top-level directory path.
|
||||
# The TOPDIR variable is passed on to configure.ac.
|
||||
TOPDIR="$2"
|
||||
# Remove these two arguments to get to the user supplied arguments
|
||||
shift
|
||||
shift
|
||||
|
||||
if test "x$BASH" = x; then
|
||||
echo "Error: This script must be run using bash." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$TOPDIR" =~ .*[[:space:]]+.* ]]; then
|
||||
echo "Error: Build path containing space character is not supported" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Force autoconf to use bash. This also means we must disable autoconf re-exec.
|
||||
export CONFIG_SHELL=$BASH
|
||||
export _as_can_reexec=no
|
||||
|
||||
# Save user's current locale, but make sure all future shell commands are
|
||||
# executed with the C locale
|
||||
export USER_LOCALE=$LC_ALL
|
||||
export LC_ALL=C
|
||||
|
||||
if test "x$CUSTOM_CONFIG_DIR" != x; then
|
||||
custom_hook=$CUSTOM_CONFIG_DIR/custom-hook.m4
|
||||
if test ! -e $custom_hook; then
|
||||
echo "CUSTOM_CONFIG_DIR ($CUSTOM_CONFIG_DIR) not pointing to a proper custom config dir."
|
||||
echo "Error: Cannot continue" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
CURRENT_DIR=`pwd`
|
||||
if test "x$CURRENT_DIR" = "x$TOPDIR"; then
|
||||
# We are running configure from the src root.
|
||||
# Create '.configure-support' under $TOPDIR/build
|
||||
build_support_dir="$TOPDIR/build/.configure-support"
|
||||
elif test "x$CURRENT_DIR" = "x$CUSTOM_ROOT"; then
|
||||
# We are running configure from the custom root.
|
||||
# Create '.configure-support' under $CUSTOM_ROOT/build
|
||||
build_support_dir="$CUSTOM_ROOT/build/.configure-support"
|
||||
else
|
||||
# We are running configure from outside of the src dir.
|
||||
# Create 'build_support_dir' in the current directory.
|
||||
build_support_dir="$CURRENT_DIR/configure-support"
|
||||
fi
|
||||
|
||||
conf_script_dir="$TOPDIR/make/autoconf"
|
||||
generated_script="$build_support_dir/generated-configure.sh"
|
||||
|
||||
###
|
||||
### Use autoconf to create a runnable configure script, if needed
|
||||
###
|
||||
|
||||
autoconf_missing_help() {
|
||||
APT_GET="`type -p apt-get 2> /dev/null`"
|
||||
YUM="`type -p yum 2> /dev/null`"
|
||||
BREW="`type -p brew 2> /dev/null`"
|
||||
ZYPPER="`type -p zypper 2> /dev/null`"
|
||||
CYGWIN="`type -p cygpath 2> /dev/null`"
|
||||
UNAMEOUT="`uname 2> /dev/null`"
|
||||
|
||||
if test "x$ZYPPER" != x; then
|
||||
PKGHANDLER_COMMAND="sudo zypper install autoconf"
|
||||
elif test "x$APT_GET" != x; then
|
||||
PKGHANDLER_COMMAND="sudo apt-get install autoconf"
|
||||
elif test "x$YUM" != x; then
|
||||
PKGHANDLER_COMMAND="sudo yum install autoconf"
|
||||
elif test "x$BREW" != x; then
|
||||
PKGHANDLER_COMMAND="brew install autoconf"
|
||||
elif test "x$UNAMEOUT" == xAIX; then
|
||||
echo "You might be able to fix this by installing autoconf from the 'AIX Toolbox for Linux Applications' (or compile it from the sources)."
|
||||
elif test "x$CYGWIN" != x; then
|
||||
PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P autoconf )"
|
||||
fi
|
||||
|
||||
if test "x$PKGHANDLER_COMMAND" != x; then
|
||||
echo "You might be able to fix this by running '$PKGHANDLER_COMMAND'."
|
||||
fi
|
||||
}
|
||||
|
||||
generate_configure_script() {
|
||||
if test "x$AUTOCONF" != x; then
|
||||
if test ! -x "$AUTOCONF"; then
|
||||
echo
|
||||
echo "The specified AUTOCONF variable does not point to a valid autoconf executable:"
|
||||
echo "AUTOCONF=$AUTOCONF"
|
||||
echo "Error: Cannot continue" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
AUTOCONF="`type -p autoconf 2> /dev/null`"
|
||||
if test "x$AUTOCONF" = x; then
|
||||
echo
|
||||
echo "Autoconf is not found on the PATH ($PATH), and AUTOCONF is not set."
|
||||
echo "You need autoconf to be able to generate a runnable configure script."
|
||||
autoconf_missing_help
|
||||
echo "Error: Cannot find autoconf" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
autoconf_version=`$AUTOCONF --version | head -1`
|
||||
echo "Using autoconf at ${AUTOCONF} [$autoconf_version]"
|
||||
|
||||
if test "x$CUSTOM_CONFIG_DIR" != x; then
|
||||
# Generate configure script with custom hooks compiled in.
|
||||
custom_patcher='sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|"'
|
||||
custom_script_dir_include="-I$CUSTOM_CONFIG_DIR"
|
||||
else
|
||||
custom_patcher='cat'
|
||||
custom_script_dir_include=""
|
||||
fi
|
||||
|
||||
mkdir -p $build_support_dir
|
||||
# Call autoconf but replace the "magic" variable in configure.ac if requested.
|
||||
|
||||
cat $conf_script_dir/configure.ac | eval $custom_patcher | \
|
||||
${AUTOCONF} -W all $custom_script_dir_include -I$conf_script_dir - \
|
||||
> $generated_script
|
||||
rm -rf autom4te.cache
|
||||
|
||||
# Sanity check
|
||||
if test ! -s $generated_script; then
|
||||
echo "Error: Failed to generate runnable configure script" 1>&2
|
||||
rm -f $generated_script
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
test_generated_up_to_date() {
|
||||
conf_source_files="$conf_script_dir/configure.ac $conf_script_dir/*.m4"
|
||||
if test "x$CUSTOM_CONFIG_DIR" != x; then
|
||||
conf_custom_source_files="$CUSTOM_CONFIG_DIR/*.m4"
|
||||
else
|
||||
conf_custom_source_files=""
|
||||
fi
|
||||
|
||||
for file in $conf_source_files $conf_custom_source_files ; do
|
||||
if test $file -nt $generated_script; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
run_autoconf=false
|
||||
if test "x$1" = xautogen; then
|
||||
# User called us as "configure autogen", so force regeneration
|
||||
run_autoconf=true
|
||||
shift
|
||||
fi
|
||||
|
||||
if test ! -s $generated_script; then
|
||||
# Generated script is missing, so we need to create it
|
||||
echo "Runnable configure script is not present"
|
||||
run_autoconf=true
|
||||
else
|
||||
# File is present, but is it up to date?
|
||||
if test_generated_up_to_date; then
|
||||
echo "Runnable configure script is not up to date"
|
||||
run_autoconf=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$run_autoconf" = xtrue; then
|
||||
echo "Generating runnable configure script at $generated_script"
|
||||
generate_configure_script
|
||||
fi
|
||||
|
||||
# Autoconf calls the configure script recursively sometimes.
|
||||
# Don't start logging twice in that case
|
||||
if test "x$conf_debug_configure" = xtrue; then
|
||||
conf_debug_configure=recursive
|
||||
fi
|
||||
|
||||
###
|
||||
### Process command-line arguments
|
||||
###
|
||||
|
||||
# Returns a shell-escaped version of the argument given.
|
||||
function shell_quote() {
|
||||
if [[ -n "$1" ]]; then
|
||||
# Uses only shell-safe characters? No quoting needed.
|
||||
# '=' is a zsh meta-character, but only in word-initial position.
|
||||
if echo "$1" | grep '^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\.:,%/+=_-]\{1,\}$' > /dev/null \
|
||||
&& ! echo "$1" | grep '^=' > /dev/null; then
|
||||
quoted="$1"
|
||||
else
|
||||
if echo "$1" | grep "[\'!]" > /dev/null; then
|
||||
# csh does history expansion within single quotes, but not
|
||||
# when backslash-escaped!
|
||||
local quoted_quote="'\\''" quoted_exclam="'\\!'"
|
||||
word="${1//\'/${quoted_quote}}"
|
||||
word="${1//\!/${quoted_exclam}}"
|
||||
fi
|
||||
quoted="'$1'"
|
||||
fi
|
||||
echo "$quoted"
|
||||
fi
|
||||
}
|
||||
|
||||
conf_processed_arguments=()
|
||||
conf_quoted_arguments=()
|
||||
conf_openjdk_target=
|
||||
|
||||
for conf_option
|
||||
do
|
||||
|
||||
# Process (and remove) our own extensions that will not be passed to autoconf
|
||||
case $conf_option in
|
||||
--openjdk-target=*)
|
||||
conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'`
|
||||
;;
|
||||
--debug-configure)
|
||||
if test "x$conf_debug_configure" != xrecursive; then
|
||||
conf_debug_configure=true
|
||||
export conf_debug_configure
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option")
|
||||
;;
|
||||
esac
|
||||
|
||||
# Store all variables overridden on the command line
|
||||
case $conf_option in
|
||||
[^-]*=*)
|
||||
# Add name of variable to CONFIGURE_OVERRIDDEN_VARIABLES list inside !...!.
|
||||
conf_env_var=`expr "x$conf_option" : 'x\([^=]*\)='`
|
||||
CONFIGURE_OVERRIDDEN_VARIABLES="$CONFIGURE_OVERRIDDEN_VARIABLES!$conf_env_var!"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Save the arguments, intelligently quoted for CONFIGURE_COMMAND_LINE.
|
||||
case $conf_option in
|
||||
*=*)
|
||||
conf_option_name=`expr "x$conf_option" : 'x\([^=]*\)='`
|
||||
conf_option_name=$(shell_quote "$conf_option_name")
|
||||
conf_option_value=`expr "x$conf_option" : 'x[^=]*=\(.*\)'`
|
||||
conf_option_value=$(shell_quote "$conf_option_value")
|
||||
conf_quoted_arguments=("${conf_quoted_arguments[@]}" "$conf_option_name=$conf_option_value")
|
||||
;;
|
||||
*)
|
||||
conf_quoted_arguments=("${conf_quoted_arguments[@]}" "$(shell_quote "$conf_option")")
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check for certain autoconf options that require extra action
|
||||
case $conf_option in
|
||||
-build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*)
|
||||
conf_build_set=true ;;
|
||||
-target | --target | --targe | --targ | --tar | --ta | --t | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
|
||||
conf_incompatible_crosscompile="$conf_incompatible_crosscompile $conf_option" ;;
|
||||
-host | --host | --hos | --ho | -host=* | --host=* | --hos=* | --ho=*)
|
||||
conf_incompatible_crosscompile="$conf_incompatible_crosscompile $conf_option" ;;
|
||||
-help | --help | --hel | --he | -h)
|
||||
conf_print_help=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Save the quoted command line
|
||||
CONFIGURE_COMMAND_LINE="${conf_quoted_arguments[@]}"
|
||||
|
||||
if test "x$conf_incompatible_crosscompile" != "x"; then
|
||||
if test "x$conf_openjdk_target" != "x"; then
|
||||
echo "Error: --openjdk-target was specified together with"
|
||||
echo "incompatible autoconf cross-compilation flags."
|
||||
echo "You specified: --openjdk-target=$conf_openjdk_target and $conf_incompatible_crosscompile."
|
||||
echo "It is recommended that you only use --openjdk-target."
|
||||
exit 1
|
||||
else
|
||||
echo "Warning: You are using misleading autoconf cross-compilation flag(s)."
|
||||
echo "This is not encouraged as use of such flags during building can"
|
||||
echo "quickly become confusing."
|
||||
echo "It is highly recommended that you use --openjdk-target instead."
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$conf_openjdk_target" != "x"; then
|
||||
conf_processed_arguments=("--host=$conf_openjdk_target" "--target=$conf_openjdk_target" "${conf_processed_arguments[@]}")
|
||||
|
||||
# If --build has been explicitly set don't override that flag with our own
|
||||
if test "x$conf_build_set" != xtrue; then
|
||||
conf_build_platform=`sh $conf_script_dir/build-aux/config.guess`
|
||||
conf_processed_arguments=("--build=$conf_build_platform" "${conf_processed_arguments[@]}")
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make configure exit with error on invalid options as default.
|
||||
# Can be overridden by --disable-option-checking, since we prepend our argument
|
||||
# and later options override earlier.
|
||||
conf_processed_arguments=("--enable-option-checking=fatal" "${conf_processed_arguments[@]}")
|
||||
|
||||
###
|
||||
### Call the configure script
|
||||
###
|
||||
if test "x$conf_debug_configure" != x; then
|
||||
# Turn on shell debug output if requested (initial or recursive)
|
||||
set -x
|
||||
fi
|
||||
|
||||
# Now transfer control to the script generated by autoconf. This is where the
|
||||
# main work is done.
|
||||
RCDIR=`mktemp -dt jdk-build-configure.tmp.XXXXXX` || exit $?
|
||||
trap "rm -rf \"$RCDIR\"" EXIT
|
||||
conf_logfile=./configure.log
|
||||
(exec 3>&1 ; ((. $generated_script "${conf_processed_arguments[@]}" 2>&1 1>&3 ) \
|
||||
; echo $? > "$RCDIR/rc" ) \
|
||||
| tee -a $conf_logfile 1>&2 ; exec 3>&-) | tee -a $conf_logfile
|
||||
|
||||
conf_result_code=`cat "$RCDIR/rc"`
|
||||
###
|
||||
### Post-processing
|
||||
###
|
||||
|
||||
if test $conf_result_code -eq 0; then
|
||||
if test "x$conf_print_help" = xtrue; then
|
||||
cat <<EOT
|
||||
|
||||
Additional (non-autoconf) OpenJDK Options:
|
||||
--openjdk-target=TARGET cross-compile with TARGET as target platform
|
||||
(i.e. the one you will run the resulting binary on).
|
||||
Equivalent to --host=TARGET --target=TARGET
|
||||
--build=<current platform>, or the platform you
|
||||
have provided if you have explicitly passed
|
||||
--build to configure
|
||||
--debug-configure Run the configure script with additional debug
|
||||
logging enabled.
|
||||
|
||||
EOT
|
||||
|
||||
# Print additional help, e.g. a list of toolchains and JVM features.
|
||||
# This must be done by the autoconf script.
|
||||
( CONFIGURE_PRINT_ADDITIONAL_HELP=true . $generated_script PRINTF=printf ECHO=echo )
|
||||
|
||||
cat <<EOT
|
||||
|
||||
Please be aware that, when cross-compiling, the OpenJDK configure script will
|
||||
generally use 'target' where autoconf traditionally uses 'host'.
|
||||
|
||||
Also note that variables must be passed on the command line. Variables in the
|
||||
environment will generally be ignored, unlike traditional autoconf scripts.
|
||||
EOT
|
||||
fi
|
||||
else
|
||||
echo configure exiting with result code $conf_result_code
|
||||
fi
|
||||
|
||||
exit $conf_result_code
|
||||
326
make/autoconf/configure.ac
Normal file
326
make/autoconf/configure.ac
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Includes and boilerplate
|
||||
#
|
||||
################################################################################
|
||||
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT(OpenJDK, openjdk, build-dev@openjdk.org,,https://openjdk.org)
|
||||
|
||||
AC_CONFIG_AUX_DIR([$TOPDIR/make/autoconf/build-aux])
|
||||
m4_include([build-aux/pkg.m4])
|
||||
|
||||
AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK])
|
||||
AC_DEFUN_ONCE([CUSTOM_LATE_HOOK])
|
||||
AC_DEFUN_ONCE([CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK])
|
||||
AC_DEFUN_ONCE([CUSTOM_SUMMARY_AND_WARNINGS_HOOK])
|
||||
|
||||
# This line needs to be here, verbatim, after the dummy hook definitions but
|
||||
# before all includes. It is replaced with custom functionality when building
|
||||
# custom sources.
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Include these first...
|
||||
m4_include([util.m4])
|
||||
# ... then the rest
|
||||
m4_include([basic.m4])
|
||||
m4_include([boot-jdk.m4])
|
||||
m4_include([build-performance.m4])
|
||||
m4_include([flags.m4])
|
||||
m4_include([help.m4])
|
||||
m4_include([hotspot.m4])
|
||||
m4_include([jdk-options.m4])
|
||||
m4_include([jdk-version.m4])
|
||||
m4_include([jvm-features.m4])
|
||||
m4_include([libraries.m4])
|
||||
m4_include([platform.m4])
|
||||
m4_include([source-dirs.m4])
|
||||
m4_include([toolchain.m4])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Initialization / Boot-strapping
|
||||
#
|
||||
# The bootstrapping process needs to solve the "chicken or the egg" problem,
|
||||
# thus it jumps back and forth, each time gaining something needed later on.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# If we are requested to print additional help, do that and then exit.
|
||||
# This must be the very first call.
|
||||
HELP_PRINT_ADDITIONAL_HELP_AND_EXIT
|
||||
|
||||
# Basic initialization that must happen first of all in the normal process.
|
||||
BASIC_INIT
|
||||
BASIC_SETUP_FUNDAMENTAL_TOOLS
|
||||
|
||||
# Now we can determine OpenJDK build and target platforms. This is required to
|
||||
# have early on.
|
||||
PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET
|
||||
|
||||
# Continue setting up basic stuff. Most remaining code require fundamental tools.
|
||||
BASIC_SETUP_PATHS
|
||||
BASIC_SETUP_TOOLS
|
||||
BASIC_SETUP_BUILD_ENV
|
||||
|
||||
# Check if it's a pure open build or if custom sources are to be used.
|
||||
JDKOPT_SETUP_OPEN_OR_CUSTOM
|
||||
|
||||
# These are needed to be able to create a configuration name (and thus the output directory)
|
||||
JDKOPT_SETUP_DEBUG_LEVEL
|
||||
HOTSPOT_SETUP_JVM_VARIANTS
|
||||
|
||||
# With basic setup done, call the custom early hook.
|
||||
CUSTOM_EARLY_HOOK
|
||||
|
||||
# This only needs debug level to be setup
|
||||
JDKOPT_ALLOW_ABSOLUTE_PATHS_IN_OUTPUT
|
||||
|
||||
# Check if we have devkits, extra paths or sysroot set.
|
||||
BASIC_SETUP_DEVKIT
|
||||
|
||||
# To properly create a configuration name, we need to have the OpenJDK target
|
||||
# and options (variants and debug level) parsed.
|
||||
BASIC_SETUP_OUTPUT_DIR
|
||||
# After we have the output dir we can finalize the fixpath wrapper
|
||||
BASIC_WINDOWS_FINALIZE_FIXPATH
|
||||
|
||||
# Must be done before we can call HELP_MSG_MISSING_DEPENDENCY.
|
||||
HELP_SETUP_DEPENDENCY_HELP
|
||||
|
||||
# Setup tools that requires more complex handling, or that is not needed by the configure script.
|
||||
BASIC_SETUP_COMPLEX_TOOLS
|
||||
BASIC_CHECK_BASH_OPTIONS
|
||||
|
||||
# Check if pkg-config is available.
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
# After basic tools have been setup, we can check build os specific details.
|
||||
PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION
|
||||
|
||||
# Misc basic settings
|
||||
BASIC_SETUP_DEFAULT_MAKE_TARGET
|
||||
BASIC_SETUP_DEFAULT_LOG
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Determine OpenJDK variants and version numbers.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# We need build & target for this.
|
||||
JDKOPT_SETUP_JMOD_OPTIONS
|
||||
JDKOPT_SETUP_JLINK_OPTIONS
|
||||
JDKVER_SETUP_JDK_VERSION_NUMBERS
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Setup BootJDK, used to bootstrap the build.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
BOOTJDK_SETUP_BOOT_JDK
|
||||
BOOTJDK_SETUP_BUILD_JDK
|
||||
BOOTJDK_SETUP_DOCS_REFERENCE_JDK
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Determine JDK specific build time options.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
JDKOPT_SETUP_REPRODUCIBLE_BUILD
|
||||
JDKOPT_SETUP_JDK_OPTIONS
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Configure the sources to use. We can add or override individual directories.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
SRCDIRS_SETUP_DIRS
|
||||
SRCDIRS_SETUP_IMPORT_MODULES
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Setup the toolchain (compilers etc), i.e. tools used to compile and process
|
||||
# native code.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# First determine the toolchain type (compiler family)
|
||||
TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE
|
||||
|
||||
# The global flags are needed for configure to be able to run the compilers
|
||||
# correctly.
|
||||
FLAGS_PRE_TOOLCHAIN
|
||||
|
||||
# Then detect the actual binaries needed
|
||||
TOOLCHAIN_PRE_DETECTION
|
||||
TOOLCHAIN_DETECT_TOOLCHAIN_CORE
|
||||
TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA
|
||||
TOOLCHAIN_POST_DETECTION
|
||||
|
||||
# Finally do some processing after the detection phase
|
||||
TOOLCHAIN_SETUP_BUILD_COMPILERS
|
||||
TOOLCHAIN_MISC_CHECKS
|
||||
|
||||
# After toolchain setup, we need to process some flags to be able to continue.
|
||||
FLAGS_POST_TOOLCHAIN
|
||||
|
||||
# Setup the tools needed to test the JDK (JTReg Regression Test Harness,
|
||||
# Java Microbenchmark Harness (JMH) and the Jib dependency tool).
|
||||
LIB_TESTS_SETUP_JTREG
|
||||
LIB_TESTS_SETUP_JMH
|
||||
LIB_TESTS_SETUP_JIB
|
||||
LIB_TESTS_SETUP_TIDY
|
||||
|
||||
# Now we can test some aspects on the target using configure macros.
|
||||
PLATFORM_SETUP_OPENJDK_TARGET_BITS
|
||||
PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS
|
||||
|
||||
# Configure flags for the tools. Need to know if we should build reproducible.
|
||||
FLAGS_SETUP_FLAGS
|
||||
|
||||
# Setup debug symbols (need objcopy from the toolchain for that)
|
||||
JDKOPT_SETUP_DEBUG_SYMBOLS
|
||||
JDKOPT_SETUP_CODE_COVERAGE
|
||||
|
||||
# AddressSanitizer
|
||||
JDKOPT_SETUP_ADDRESS_SANITIZER
|
||||
|
||||
# UndefinedBehaviorSanitizer
|
||||
JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER
|
||||
|
||||
# LeakSanitizer
|
||||
JDKOPT_SETUP_LEAK_SANITIZER
|
||||
|
||||
# Setup static analyzer
|
||||
JDKOPT_SETUP_STATIC_ANALYZER
|
||||
|
||||
# Fallback linker
|
||||
# This needs to go before 'LIB_DETERMINE_DEPENDENCIES'
|
||||
JDKOPT_SETUP_FALLBACK_LINKER
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Check dependencies for external and internal libraries.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIB_DETERMINE_DEPENDENCIES
|
||||
LIB_SETUP_LIBRARIES
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Setup hotspot and JVM features (needs toolchain).
|
||||
#
|
||||
################################################################################
|
||||
|
||||
JVM_FEATURES_PARSE_OPTIONS
|
||||
JVM_FEATURES_SETUP
|
||||
|
||||
HOTSPOT_SETUP_MISC
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# We need to do some final tweaking, when everything else is done.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIB_TESTS_ENABLE_DISABLE_FAILURE_HANDLER
|
||||
LIB_TESTS_ENABLE_DISABLE_JTREG_TEST_THREAD_FACTORY
|
||||
|
||||
JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST
|
||||
JDKOPT_EXCLUDE_TRANSLATIONS
|
||||
JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE
|
||||
JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE_COH
|
||||
JDKOPT_ENABLE_DISABLE_COMPATIBLE_CDS_ALIGNMENT
|
||||
JDKOPT_SETUP_MACOSX_SIGNING
|
||||
JDKOPT_SETUP_SIGNING_HOOK
|
||||
JDKOPT_SETUP_JAVA_WARNINGS
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Configure parts of the build that only affect the build performance,
|
||||
# not the result.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
BPERF_SETUP_BUILD_CORES
|
||||
BPERF_SETUP_BUILD_MEMORY
|
||||
BPERF_SETUP_BUILD_JOBS
|
||||
BPERF_SETUP_TEST_JOBS
|
||||
BPERF_SETUP_JAVAC_SERVER
|
||||
|
||||
# Setup arguments for the boot jdk (after cores and memory have been setup)
|
||||
BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS
|
||||
|
||||
# Setup use of icecc if requested
|
||||
BPERF_SETUP_ICECC
|
||||
|
||||
# Can the C/C++ compiler use precompiled headers?
|
||||
BPERF_SETUP_PRECOMPILED_HEADERS
|
||||
|
||||
# Setup use of ccache, if available
|
||||
BPERF_SETUP_CCACHE
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# And now the finish...
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Check for some common pitfalls
|
||||
BASIC_TEST_USABILITY_ISSUES
|
||||
|
||||
# At the end, call the custom hook. (Dummy macro if no custom sources available)
|
||||
CUSTOM_LATE_HOOK
|
||||
|
||||
# Did user specify any unknown variables?
|
||||
BASIC_CHECK_LEFTOVER_OVERRIDDEN
|
||||
|
||||
# We're messing a bit with internal autoconf variables to put the config.status
|
||||
# in the output directory instead of the current directory.
|
||||
CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status"
|
||||
|
||||
# Create the actual output files. Now the main work of configure is done.
|
||||
BASIC_WINDOWS_FINALIZE
|
||||
AC_OUTPUT
|
||||
|
||||
# After AC_OUTPUT, we need to do final work
|
||||
CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK
|
||||
|
||||
# Finally output some useful information to the user
|
||||
HELP_PRINT_SUMMARY_AND_WARNINGS
|
||||
CUSTOM_SUMMARY_AND_WARNINGS_HOOK
|
||||
HELP_REPEAT_WARNINGS
|
||||
|
||||
# All output is done. Do the post-config output management.
|
||||
BASIC_POST_CONFIG_OUTPUT
|
||||
964
make/autoconf/flags-cflags.m4
Normal file
964
make/autoconf/flags-cflags.m4
Normal file
|
|
@ -0,0 +1,964 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2026, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Setup flags for C/C++ compiler
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# How to compile shared libraries.
|
||||
#
|
||||
AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
|
||||
[
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
# Default works for linux, might work on other platforms as well.
|
||||
SHARED_LIBRARY_FLAGS='-shared'
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
# Linking is different on MacOSX
|
||||
SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0"
|
||||
|
||||
elif test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
# Linking is different on aix
|
||||
SHARED_LIBRARY_FLAGS="-shared -Wl,-bM:SRE -Wl,-bnoentry"
|
||||
|
||||
else
|
||||
# Default works for linux, might work on other platforms as well.
|
||||
SHARED_LIBRARY_FLAGS='-shared'
|
||||
fi
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
SHARED_LIBRARY_FLAGS="-dll"
|
||||
fi
|
||||
|
||||
AC_SUBST(SHARED_LIBRARY_FLAGS)
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
|
||||
[
|
||||
# By default don't set any specific assembler debug
|
||||
# info flags for toolchains unless we know they work.
|
||||
# See JDK-8207057.
|
||||
ASFLAGS_DEBUG_SYMBOLS=""
|
||||
|
||||
# Debug prefix mapping if supported by compiler
|
||||
DEBUG_PREFIX_CFLAGS=
|
||||
|
||||
UTIL_ARG_WITH(NAME: native-debug-symbols-level, TYPE: literal,
|
||||
DEFAULT: [auto], VALID_VALUES: [auto 1 2 3],
|
||||
CHECK_AVAILABLE: [
|
||||
if test x$TOOLCHAIN_TYPE = xmicrosoft; then
|
||||
AVAILABLE=false
|
||||
fi
|
||||
],
|
||||
DESC: [set the native debug symbol level (GCC and Clang only)],
|
||||
DEFAULT_DESC: [toolchain default],
|
||||
IF_AUTO: [
|
||||
RESULT=""
|
||||
])
|
||||
|
||||
# Debug symbols
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
|
||||
# Check if compiler supports -fdebug-prefix-map. If so, use that to make
|
||||
# the debug symbol paths resolve to paths relative to the workspace root.
|
||||
workspace_root_trailing_slash="${WORKSPACE_ROOT%/}/"
|
||||
DEBUG_PREFIX_CFLAGS="-fdebug-prefix-map=${workspace_root_trailing_slash}="
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${DEBUG_PREFIX_CFLAGS}],
|
||||
IF_FALSE: [
|
||||
DEBUG_PREFIX_CFLAGS=
|
||||
],
|
||||
IF_TRUE: [
|
||||
# Add debug prefix map gcc system include paths, as they cause
|
||||
# non-deterministic debug paths depending on gcc path location.
|
||||
DEBUG_PREFIX_MAP_GCC_INCLUDE_PATHS
|
||||
|
||||
# Add debug prefix map for OUTPUTDIR to handle the scenario when
|
||||
# it is not located within WORKSPACE_ROOT
|
||||
outputdir_slash="${OUTPUTDIR%/}/"
|
||||
DEBUG_PREFIX_CFLAGS="$DEBUG_PREFIX_CFLAGS -fdebug-prefix-map=${outputdir_slash}="
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
# Debug info level should follow the debug format to be effective.
|
||||
CFLAGS_DEBUG_SYMBOLS="-gdwarf-4 -g${NATIVE_DEBUG_SYMBOLS_LEVEL}"
|
||||
ASFLAGS_DEBUG_SYMBOLS="-g${NATIVE_DEBUG_SYMBOLS_LEVEL}"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
|
||||
# Check if compiler supports -fdebug-prefix-map. If so, use that to make
|
||||
# the debug symbol paths resolve to paths relative to the workspace root.
|
||||
workspace_root_trailing_slash="${WORKSPACE_ROOT%/}/"
|
||||
DEBUG_PREFIX_CFLAGS="-fdebug-prefix-map=${workspace_root_trailing_slash}="
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${DEBUG_PREFIX_CFLAGS}],
|
||||
IF_FALSE: [
|
||||
DEBUG_PREFIX_CFLAGS=
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
# -gdwarf-4 and -gdwarf-aranges were introduced in clang 5.0
|
||||
GDWARF_FLAGS="-gdwarf-4 -gdwarf-aranges"
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${GDWARF_FLAGS}],
|
||||
IF_FALSE: [GDWARF_FLAGS=""])
|
||||
|
||||
# Debug info level should follow the debug format to be effective.
|
||||
CFLAGS_DEBUG_SYMBOLS="${GDWARF_FLAGS} -g${NATIVE_DEBUG_SYMBOLS_LEVEL}"
|
||||
ASFLAGS_DEBUG_SYMBOLS="-g${NATIVE_DEBUG_SYMBOLS_LEVEL}"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
CFLAGS_DEBUG_SYMBOLS="-Z7"
|
||||
fi
|
||||
|
||||
if test "x$DEBUG_PREFIX_CFLAGS" != x; then
|
||||
CFLAGS_DEBUG_SYMBOLS="$CFLAGS_DEBUG_SYMBOLS $DEBUG_PREFIX_CFLAGS"
|
||||
ASFLAGS_DEBUG_SYMBOLS="$ASFLAGS_DEBUG_SYMBOLS $DEBUG_PREFIX_CFLAGS"
|
||||
fi
|
||||
|
||||
AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
|
||||
AC_SUBST(ASFLAGS_DEBUG_SYMBOLS)
|
||||
])
|
||||
|
||||
# gcc will embed the full system include paths in the debug info
|
||||
# resulting in non-deterministic debug symbol files and thus
|
||||
# non-reproducible native libraries if gcc includes are located
|
||||
# in different paths.
|
||||
# Add -fdebug-prefix-map'ings for root and gcc include paths,
|
||||
# pointing to a common set of folders so that the binaries are deterministic:
|
||||
# root include : /usr/include
|
||||
# gcc include : /usr/local/gcc_include
|
||||
# g++ include : /usr/local/gxx_include
|
||||
AC_DEFUN([DEBUG_PREFIX_MAP_GCC_INCLUDE_PATHS],
|
||||
[
|
||||
# Determine gcc system include paths.
|
||||
# Assume default roots to start with:
|
||||
GCC_ROOT_INCLUDE="/usr/include"
|
||||
|
||||
# Determine is sysroot or devkit specified?
|
||||
if test "x$SYSROOT" != "x"; then
|
||||
GCC_ROOT_INCLUDE="${SYSROOT%/}/usr/include"
|
||||
fi
|
||||
|
||||
# Add root include mapping => /usr/include
|
||||
GCC_INCLUDE_DEBUG_MAP_FLAGS="-fdebug-prefix-map=${GCC_ROOT_INCLUDE}/=/usr/include/"
|
||||
|
||||
# Add gcc system include mapping => /usr/local/gcc_include
|
||||
# Find location of stddef.h using build C compiler
|
||||
GCC_SYSTEM_INCLUDE=`$ECHO "#include <stddef.h>" | \
|
||||
$CC $CFLAGS -v -E - 2>&1 | \
|
||||
$GREP stddef | $TAIL -1 | $TR -s " " | $CUT -d'"' -f2`
|
||||
if test "x$GCC_SYSTEM_INCLUDE" != "x"; then
|
||||
GCC_SYSTEM_INCLUDE=`$DIRNAME $GCC_SYSTEM_INCLUDE`
|
||||
GCC_INCLUDE_DEBUG_MAP_FLAGS="$GCC_INCLUDE_DEBUG_MAP_FLAGS \
|
||||
-fdebug-prefix-map=${GCC_SYSTEM_INCLUDE}/=/usr/local/gcc_include/"
|
||||
fi
|
||||
|
||||
# Add g++ system include mapping => /usr/local/gxx_include
|
||||
# Find location of cstddef using build C++ compiler
|
||||
GXX_SYSTEM_INCLUDE=`$ECHO "#include <cstddef>" | \
|
||||
$CXX $CXXFLAGS -v -E -x c++ - 2>&1 | \
|
||||
$GREP cstddef | $TAIL -1 | $TR -s " " | $CUT -d'"' -f2`
|
||||
if test "x$GXX_SYSTEM_INCLUDE" != "x"; then
|
||||
GXX_SYSTEM_INCLUDE=`$DIRNAME $GXX_SYSTEM_INCLUDE`
|
||||
GCC_INCLUDE_DEBUG_MAP_FLAGS="$GCC_INCLUDE_DEBUG_MAP_FLAGS \
|
||||
-fdebug-prefix-map=${GXX_SYSTEM_INCLUDE}/=/usr/local/gxx_include/"
|
||||
fi
|
||||
|
||||
# Add to debug prefix cflags
|
||||
DEBUG_PREFIX_CFLAGS="$DEBUG_PREFIX_CFLAGS $GCC_INCLUDE_DEBUG_MAP_FLAGS"
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_WARNINGS],
|
||||
[
|
||||
# Set default value.
|
||||
WARNINGS_AS_ERRORS_DEFAULT=true
|
||||
|
||||
UTIL_ARG_ENABLE(NAME: warnings-as-errors, DEFAULT: $WARNINGS_AS_ERRORS_DEFAULT,
|
||||
RESULT: WARNINGS_AS_ERRORS,
|
||||
DEFAULT_DESC: [auto],
|
||||
DESC: [consider native warnings to be an error])
|
||||
AC_SUBST(WARNINGS_AS_ERRORS)
|
||||
|
||||
case "${TOOLCHAIN_TYPE}" in
|
||||
microsoft)
|
||||
DISABLE_WARNING_PREFIX="-wd"
|
||||
BUILD_CC_DISABLE_WARNING_PREFIX="-wd"
|
||||
CFLAGS_WARNINGS_ARE_ERRORS="-WX"
|
||||
|
||||
WARNINGS_ENABLE_ALL_NORMAL="-W3"
|
||||
WARNINGS_ENABLE_ADDITIONAL=""
|
||||
WARNINGS_ENABLE_ADDITIONAL_CXX=""
|
||||
WARNINGS_ENABLE_ADDITIONAL_JVM=""
|
||||
DISABLED_WARNINGS="4800 5105"
|
||||
CFLAGS_CONVERSION_WARNINGS=
|
||||
;;
|
||||
|
||||
gcc)
|
||||
DISABLE_WARNING_PREFIX="-Wno-"
|
||||
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
|
||||
CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
|
||||
|
||||
WARNINGS_ENABLE_ALL_NORMAL="-Wall -Wextra"
|
||||
|
||||
# Additional warnings that are not activated by -Wall and -Wextra
|
||||
WARNINGS_ENABLE_ADDITIONAL="-Wformat=2 \
|
||||
-Winvalid-pch -Wpointer-arith -Wreturn-type \
|
||||
-Wsign-compare -Wtrampolines -Wtype-limits -Wundef -Wuninitialized \
|
||||
-Wunused-const-variable=1 -Wunused-function -Wunused-result \
|
||||
-Wunused-value"
|
||||
WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual -Wreorder"
|
||||
WARNINGS_ENABLE_ADDITIONAL_JVM="-Wzero-as-null-pointer-constant"
|
||||
|
||||
# These warnings will never be turned on, since they generate too many
|
||||
# false positives.
|
||||
DISABLED_WARNINGS="unused-parameter"
|
||||
# gcc10/11 on ppc generate lots of abi warnings about layout of aggregates containing vectors
|
||||
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xppc"; then
|
||||
DISABLED_WARNINGS="$DISABLED_WARNINGS psabi"
|
||||
fi
|
||||
CFLAGS_CONVERSION_WARNINGS="-Wconversion -Wno-float-conversion"
|
||||
;;
|
||||
|
||||
clang)
|
||||
DISABLE_WARNING_PREFIX="-Wno-"
|
||||
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
|
||||
CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
|
||||
|
||||
WARNINGS_ENABLE_ALL_NORMAL="-Wall -Wextra"
|
||||
|
||||
# Additional warnings that are not activated by -Wall and -Wextra
|
||||
WARNINGS_ENABLE_ADDITIONAL="-Wformat=2 \
|
||||
-Wpointer-arith -Wsign-compare -Wreorder \
|
||||
-Wunused-function -Wundef -Wunused-value -Woverloaded-virtual"
|
||||
WARNINGS_ENABLE_ADDITIONAL_CXX=""
|
||||
WARNINGS_ENABLE_ADDITIONAL_JVM="-Wzero-as-null-pointer-constant"
|
||||
|
||||
# These warnings will never be turned on, since they generate too many
|
||||
# false positives.
|
||||
DISABLED_WARNINGS="unknown-warning-option unused-parameter"
|
||||
CFLAGS_CONVERSION_WARNINGS="-Wimplicit-int-conversion"
|
||||
;;
|
||||
esac
|
||||
WARNINGS_ENABLE_ALL="$WARNINGS_ENABLE_ALL_NORMAL $WARNINGS_ENABLE_ADDITIONAL"
|
||||
WARNINGS_ENABLE_ALL_CXX="$WARNINGS_ENABLE_ALL $WARNINGS_ENABLE_ADDITIONAL_CXX"
|
||||
WARNINGS_ENABLE_ALL_JVM="$WARNINGS_ENABLE_ALL_CXX $WARNINGS_ENABLE_ADDITIONAL_JVM"
|
||||
|
||||
AC_SUBST(DISABLE_WARNING_PREFIX)
|
||||
AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
|
||||
AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
|
||||
AC_SUBST(DISABLED_WARNINGS)
|
||||
AC_SUBST(DISABLED_WARNINGS_C)
|
||||
AC_SUBST(DISABLED_WARNINGS_CXX)
|
||||
AC_SUBST(CFLAGS_CONVERSION_WARNINGS)
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS],
|
||||
[
|
||||
# bounds, memory and behavior checking options
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
case $DEBUG_LEVEL in
|
||||
release )
|
||||
# no adjustment
|
||||
;;
|
||||
fastdebug )
|
||||
# no adjustment
|
||||
;;
|
||||
slowdebug )
|
||||
# FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it
|
||||
# gets added conditionally on whether we produce debug symbols or not.
|
||||
# This is most likely not really correct.
|
||||
|
||||
# Add runtime stack smashing and undefined behavior checks.
|
||||
CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
|
||||
CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
|
||||
|
||||
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -fstack-protector-all --param ssp-buffer-size=1"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_OPTIMIZATION],
|
||||
[
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
C_O_FLAG_HIGHEST_JVM="-O3"
|
||||
C_O_FLAG_HIGHEST="-O3"
|
||||
C_O_FLAG_HI="-O3"
|
||||
C_O_FLAG_NORM="-O2"
|
||||
C_O_FLAG_SIZE="-Os"
|
||||
C_O_FLAG_DEBUG="-O0"
|
||||
C_O_FLAG_DEBUG_JVM="-O0"
|
||||
C_O_FLAG_NONE="-O0"
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
C_O_FLAG_LTO="-flto=auto -fuse-linker-plugin -fno-strict-aliasing -fno-fat-lto-objects"
|
||||
else
|
||||
C_O_FLAG_LTO="-flto -fno-strict-aliasing"
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
C_O_FLAG_HIGHEST_JVM="${C_O_FLAG_HIGHEST_JVM} -finline-functions"
|
||||
C_O_FLAG_HIGHEST="${C_O_FLAG_HIGHEST} -finline-functions"
|
||||
C_O_FLAG_HI="${C_O_FLAG_HI} -finline-functions"
|
||||
C_O_FLAG_LTO="${C_O_FLAG_LTO} -ffat-lto-objects"
|
||||
fi
|
||||
|
||||
# -D_FORTIFY_SOURCE=2 hardening option needs optimization (at least -O1) enabled
|
||||
# set for lower O-levels -U_FORTIFY_SOURCE to overwrite previous settings
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux -a "x$DEBUG_LEVEL" = "xfastdebug"; then
|
||||
DISABLE_FORTIFY_CFLAGS="-U_FORTIFY_SOURCE"
|
||||
# ASan doesn't work well with _FORTIFY_SOURCE
|
||||
# See https://github.com/google/sanitizers/wiki/AddressSanitizer#faq
|
||||
if test "x$ASAN_ENABLED" = xyes; then
|
||||
ENABLE_FORTIFY_CFLAGS="${DISABLE_FORTIFY_CFLAGS}"
|
||||
else
|
||||
ENABLE_FORTIFY_CFLAGS="-D_FORTIFY_SOURCE=2"
|
||||
fi
|
||||
C_O_FLAG_HIGHEST_JVM="${C_O_FLAG_HIGHEST_JVM} ${ENABLE_FORTIFY_CFLAGS}"
|
||||
C_O_FLAG_HIGHEST="${C_O_FLAG_HIGHEST} ${ENABLE_FORTIFY_CFLAGS}"
|
||||
C_O_FLAG_HI="${C_O_FLAG_HI} ${ENABLE_FORTIFY_CFLAGS}"
|
||||
C_O_FLAG_NORM="${C_O_FLAG_NORM} ${ENABLE_FORTIFY_CFLAGS}"
|
||||
C_O_FLAG_SIZE="${C_O_FLAG_SIZE} ${DISABLE_FORTIFY_CFLAGS}"
|
||||
C_O_FLAG_DEBUG="${C_O_FLAG_DEBUG} ${DISABLE_FORTIFY_CFLAGS}"
|
||||
C_O_FLAG_DEBUG_JVM="${C_O_FLAG_DEBUG_JVM} ${DISABLE_FORTIFY_CFLAGS}"
|
||||
C_O_FLAG_NONE="${C_O_FLAG_NONE} ${DISABLE_FORTIFY_CFLAGS}"
|
||||
fi
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
|
||||
C_O_FLAG_HIGHEST="-O2"
|
||||
C_O_FLAG_HI="-O1"
|
||||
C_O_FLAG_NORM="-O1"
|
||||
C_O_FLAG_DEBUG="-Od"
|
||||
C_O_FLAG_DEBUG_JVM=""
|
||||
C_O_FLAG_NONE="-Od"
|
||||
C_O_FLAG_SIZE="-O1"
|
||||
C_O_FLAG_LTO="-GL"
|
||||
fi
|
||||
|
||||
# Now copy to C++ flags
|
||||
CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM"
|
||||
CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
|
||||
CXX_O_FLAG_HI="$C_O_FLAG_HI"
|
||||
CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
|
||||
CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG"
|
||||
CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM"
|
||||
CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
|
||||
CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE"
|
||||
CXX_O_FLAG_LTO="$C_O_FLAG_LTO"
|
||||
|
||||
# Adjust optimization flags according to debug level.
|
||||
case $DEBUG_LEVEL in
|
||||
release )
|
||||
# no adjustment
|
||||
;;
|
||||
fastdebug )
|
||||
# Not quite so much optimization
|
||||
C_O_FLAG_HI="$C_O_FLAG_NORM"
|
||||
CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
|
||||
;;
|
||||
slowdebug )
|
||||
# Disable optimization
|
||||
C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM"
|
||||
C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
|
||||
C_O_FLAG_HI="$C_O_FLAG_DEBUG"
|
||||
C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
|
||||
C_O_FLAG_SIZE="$C_O_FLAG_DEBUG"
|
||||
CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM"
|
||||
CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
|
||||
CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
|
||||
CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
|
||||
CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(C_O_FLAG_HIGHEST_JVM)
|
||||
AC_SUBST(C_O_FLAG_HIGHEST)
|
||||
AC_SUBST(C_O_FLAG_HI)
|
||||
AC_SUBST(C_O_FLAG_NORM)
|
||||
AC_SUBST(C_O_FLAG_NONE)
|
||||
AC_SUBST(C_O_FLAG_SIZE)
|
||||
AC_SUBST(C_O_FLAG_LTO)
|
||||
|
||||
AC_SUBST(CXX_O_FLAG_HIGHEST_JVM)
|
||||
AC_SUBST(CXX_O_FLAG_HIGHEST)
|
||||
AC_SUBST(CXX_O_FLAG_HI)
|
||||
AC_SUBST(CXX_O_FLAG_NORM)
|
||||
AC_SUBST(CXX_O_FLAG_NONE)
|
||||
AC_SUBST(CXX_O_FLAG_SIZE)
|
||||
AC_SUBST(CXX_O_FLAG_LTO)
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_CFLAGS],
|
||||
[
|
||||
### CFLAGS
|
||||
|
||||
FLAGS_SETUP_CFLAGS_HELPER
|
||||
|
||||
FLAGS_OS=$OPENJDK_TARGET_OS
|
||||
FLAGS_OS_TYPE=$OPENJDK_TARGET_OS_TYPE
|
||||
FLAGS_CPU=$OPENJDK_TARGET_CPU
|
||||
FLAGS_CPU_ARCH=$OPENJDK_TARGET_CPU_ARCH
|
||||
FLAGS_CPU_BITS=$OPENJDK_TARGET_CPU_BITS
|
||||
FLAGS_CPU_ENDIAN=$OPENJDK_TARGET_CPU_ENDIAN
|
||||
FLAGS_CPU_LEGACY=$OPENJDK_TARGET_CPU_LEGACY
|
||||
FLAGS_CPU_LEGACY_LIB=$OPENJDK_TARGET_CPU_LEGACY_LIB
|
||||
|
||||
FLAGS_SETUP_CFLAGS_CPU_DEP([TARGET])
|
||||
|
||||
# Repeat the check for the BUILD_CC and BUILD_CXX. Need to also reset CFLAGS
|
||||
# since any target specific flags will likely not work with the build compiler.
|
||||
CC_OLD="$CC"
|
||||
CXX_OLD="$CXX"
|
||||
CFLAGS_OLD="$CFLAGS"
|
||||
CXXFLAGS_OLD="$CXXFLAGS"
|
||||
CC="$BUILD_CC"
|
||||
CXX="$BUILD_CXX"
|
||||
CFLAGS=""
|
||||
CXXFLAGS=""
|
||||
|
||||
FLAGS_OS=$OPENJDK_BUILD_OS
|
||||
FLAGS_OS_TYPE=$OPENJDK_BUILD_OS_TYPE
|
||||
FLAGS_CPU=$OPENJDK_BUILD_CPU
|
||||
FLAGS_CPU_ARCH=$OPENJDK_BUILD_CPU_ARCH
|
||||
FLAGS_CPU_BITS=$OPENJDK_BUILD_CPU_BITS
|
||||
FLAGS_CPU_ENDIAN=$OPENJDK_BUILD_CPU_ENDIAN
|
||||
FLAGS_CPU_LEGACY=$OPENJDK_BUILD_CPU_LEGACY
|
||||
FLAGS_CPU_LEGACY_LIB=$OPENJDK_BUILD_CPU_LEGACY_LIB
|
||||
|
||||
FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_], [BUILD_])
|
||||
|
||||
CC="$CC_OLD"
|
||||
CXX="$CXX_OLD"
|
||||
CFLAGS="$CFLAGS_OLD"
|
||||
CXXFLAGS="$CXXFLAGS_OLD"
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# platform independent
|
||||
AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
|
||||
[
|
||||
#### OS DEFINES, these should be independent on toolchain
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
CFLAGS_OS_DEF_JVM="-DLINUX -D_FILE_OFFSET_BITS=64"
|
||||
CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64"
|
||||
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
|
||||
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
|
||||
elif test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
CFLAGS_OS_DEF_JVM="-DAIX -D_LARGE_FILES"
|
||||
CFLAGS_OS_DEF_JDK="-D_LARGE_FILES"
|
||||
elif test "x$OPENJDK_TARGET_OS" = xbsd; then
|
||||
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE"
|
||||
elif test "x$OPENJDK_TARGET_OS" = xwindows; then
|
||||
CFLAGS_OS_DEF_JVM="-D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
|
||||
fi
|
||||
|
||||
CFLAGS_OS_DEF_JDK="$CFLAGS_OS_DEF_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
|
||||
|
||||
#### GLOBAL DEFINES
|
||||
# Set some common defines. These works for all compilers, but assume
|
||||
# -D is universally accepted.
|
||||
|
||||
# Always enable optional macros for VM.
|
||||
ALWAYS_CFLAGS_JVM="-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
|
||||
|
||||
##############################################################################
|
||||
|
||||
# Adjust flags according to debug level.
|
||||
# Setup debug/release defines
|
||||
if test "x$DEBUG_LEVEL" = xrelease; then
|
||||
DEBUG_CFLAGS_JDK="-DNDEBUG"
|
||||
else
|
||||
DEBUG_CFLAGS_JDK="-DDEBUG"
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang ; then
|
||||
INIT_PATTERN_FLAG="-ftrivial-auto-var-init=pattern"
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$INIT_PATTERN_FLAG],
|
||||
IF_TRUE: [
|
||||
DEBUG_CFLAGS_JDK="$DEBUG_CFLAGS_JDK $INIT_PATTERN_FLAG"
|
||||
DEBUG_CFLAGS_JVM="$INIT_PATTERN_FLAG"
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
DEBUG_CFLAGS_JVM="-fpic -mcmodel=large"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$DEBUG_LEVEL" != xrelease; then
|
||||
DEBUG_OPTIONS_FLAGS_JDK="$CFLAGS_DEBUG_OPTIONS"
|
||||
DEBUG_SYMBOLS_CFLAGS_JDK="$CFLAGS_DEBUG_SYMBOLS"
|
||||
fi
|
||||
|
||||
#### TOOLCHAIN DEFINES
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE -D_REENTRANT"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# _WIN32_WINNT=0x0602 means access APIs for Windows 8 and above. See
|
||||
# https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170
|
||||
ALWAYS_DEFINES="-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0602 \
|
||||
-D_CRT_DECLARE_NONSTDC_NAMES -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS"
|
||||
ALWAYS_DEFINES_JDK="$ALWAYS_DEFINES -DWIN32 -DIAL"
|
||||
ALWAYS_DEFINES_JVM="$ALWAYS_DEFINES -DNOMINMAX"
|
||||
fi
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# CFLAGS BASIC
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
# COMMON to gcc and clang
|
||||
TOOLCHAIN_CFLAGS_JVM="-pipe -fno-rtti -fno-exceptions \
|
||||
-fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fstack-protector"
|
||||
TOOLCHAIN_CFLAGS_JDK="-fvisibility=hidden -pipe -fstack-protector"
|
||||
# reduce lib size on linux in link step, this needs also special compile flags
|
||||
# do this on s390x also for libjvm (where serviceability agent is not supported)
|
||||
if test "x$ENABLE_LINKTIME_GC" = xtrue; then
|
||||
TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -ffunction-sections -fdata-sections"
|
||||
if test "x$OPENJDK_TARGET_CPU" = xs390x && test "x$DEBUG_LEVEL" == xrelease; then
|
||||
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -fdata-sections"
|
||||
fi
|
||||
fi
|
||||
# technically NOT for CXX (but since this gives *worse* performance, use
|
||||
# no-strict-aliasing everywhere!)
|
||||
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing"
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
# Restrict the debug information created by Clang to avoid
|
||||
# too big object files and speed the build up a little bit
|
||||
# (see http://llvm.org/bugs/show_bug.cgi?id=7554)
|
||||
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info -fstack-protector"
|
||||
|
||||
# In principle the stack alignment below is cpu- and ABI-dependent and
|
||||
# should agree with values of StackAlignmentInBytes in various
|
||||
# src/hotspot/cpu/*/globalDefinitions_*.hpp files, but this value currently
|
||||
# works for all platforms.
|
||||
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
if test "x$DEBUG_LEVEL" = xrelease; then
|
||||
# Clang does not inline as much as GCC does for functions with "inline" keyword by default.
|
||||
# This causes noticeable slowdown in pause time for G1, and possibly in other areas.
|
||||
# Increasing the inline hint threshold avoids the slowdown for Clang-built JVM.
|
||||
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mllvm -inlinehint-threshold=100000"
|
||||
fi
|
||||
TOOLCHAIN_CFLAGS_JDK="-pipe"
|
||||
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
|
||||
fi
|
||||
|
||||
if test "x$ENABLE_LINKTIME_GC" = xtrue; then
|
||||
TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -ffunction-sections -fdata-sections"
|
||||
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -fdata-sections"
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -ftls-model -fno-math-errno"
|
||||
TOOLCHAIN_CFLAGS_JDK="-ffunction-sections -fsigned-char"
|
||||
fi
|
||||
|
||||
TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -fvisibility=hidden -fstack-protector"
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
TOOLCHAIN_CFLAGS_JVM="-nologo -MD -Zc:preprocessor -Zc:inline -Zc:throwingNew -permissive- -MP"
|
||||
TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:preprocessor -Zc:inline -Zc:throwingNew -permissive- -Zc:wchar_t-"
|
||||
fi
|
||||
|
||||
# Set character encoding in source
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
CHARSET_CFLAGS="-finput-charset=utf-8"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# The -utf-8 option sets both source and execution character sets
|
||||
CHARSET_CFLAGS="-utf-8 -validate-charset"
|
||||
fi
|
||||
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $CHARSET_CFLAGS"
|
||||
TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK $CHARSET_CFLAGS"
|
||||
|
||||
# CFLAGS C language level for JDK sources (hotspot only uses C++)
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
LANGSTD_CFLAGS="-std=c11"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
LANGSTD_CFLAGS="-std:c11"
|
||||
fi
|
||||
TOOLCHAIN_CFLAGS_JDK_CONLY="$LANGSTD_CFLAGS $TOOLCHAIN_CFLAGS_JDK_CONLY"
|
||||
|
||||
# CXXFLAGS C++ language level for all of JDK, including Hotspot.
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
LANGSTD_CXXFLAGS="-std=c++17"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
LANGSTD_CXXFLAGS="-std:c++17"
|
||||
else
|
||||
AC_MSG_ERROR([Cannot enable C++17 for this toolchain])
|
||||
fi
|
||||
TOOLCHAIN_CFLAGS_JDK_CXXONLY="$TOOLCHAIN_CFLAGS_JDK_CXXONLY $LANGSTD_CXXFLAGS"
|
||||
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $LANGSTD_CXXFLAGS"
|
||||
ADLC_LANGSTD_CXXFLAGS="$LANGSTD_CXXFLAGS"
|
||||
|
||||
# CFLAGS WARNINGS STUFF
|
||||
WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL"
|
||||
WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXX"
|
||||
WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_JVM"
|
||||
|
||||
# Set some additional per-OS defines.
|
||||
|
||||
# Additional macosx handling
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
OS_CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=$MACOSX_VERSION_MIN_NODOTS \
|
||||
-mmacosx-version-min=$MACOSX_VERSION_MIN"
|
||||
|
||||
if test -n "$MACOSX_VERSION_MAX"; then
|
||||
OS_CFLAGS="$OS_CFLAGS \
|
||||
-DMAC_OS_X_VERSION_MAX_ALLOWED=$MACOSX_VERSION_MAX_NODOTS"
|
||||
fi
|
||||
fi
|
||||
|
||||
OS_CFLAGS="$OS_CFLAGS -DLIBC=$OPENJDK_TARGET_LIBC"
|
||||
if test "x$OPENJDK_TARGET_LIBC" = xmusl; then
|
||||
OS_CFLAGS="$OS_CFLAGS -DMUSL_LIBC"
|
||||
fi
|
||||
|
||||
# Where does this really belong??
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
PICFLAG="-fPIC"
|
||||
PIEFLAG="-fPIE"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
PICFLAG=""
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
JVM_PICFLAG="-fpic -mcmodel=large"
|
||||
else
|
||||
JVM_PICFLAG="$PICFLAG"
|
||||
fi
|
||||
JDK_PICFLAG="$PICFLAG"
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
# Linking is different on macOS
|
||||
JVM_PICFLAG=""
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
|
||||
# conditionals against.
|
||||
# $2 - Optional prefix for each variable defined.
|
||||
# $3 - Optional prefix for compiler variables (either BUILD_ or nothing).
|
||||
AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
|
||||
[
|
||||
#### CPU DEFINES, these should (in theory) be independent on toolchain
|
||||
|
||||
# Setup target CPU
|
||||
# Setup endianness
|
||||
if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
|
||||
$1_DEFINES_CPU_JVM="-DVM_LITTLE_ENDIAN"
|
||||
$1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN"
|
||||
else
|
||||
$1_DEFINES_CPU_JDK="-D_BIG_ENDIAN"
|
||||
fi
|
||||
|
||||
# setup CPU bit size
|
||||
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DARCH='\"$FLAGS_CPU_LEGACY\"' \
|
||||
-D$FLAGS_CPU_LEGACY"
|
||||
|
||||
if test "x$FLAGS_CPU_BITS" = x64; then
|
||||
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1"
|
||||
$1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1"
|
||||
fi
|
||||
|
||||
# toolchain dependent, per-cpu
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
if test "x$FLAGS_CPU" = xaarch64; then
|
||||
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_ARM64_ -Darm64"
|
||||
elif test "x$FLAGS_CPU" = xx86_64; then
|
||||
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_AMD64_ -Damd64"
|
||||
else
|
||||
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_X86_ -Dx86"
|
||||
fi
|
||||
fi
|
||||
|
||||
# CFLAGS PER CPU
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
# COMMON to gcc and clang
|
||||
AC_MSG_CHECKING([if $1 is x86])
|
||||
if test "x$FLAGS_CPU" = xx86; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_MSG_CHECKING([if control flow protection is enabled by additional compiler flags])
|
||||
if echo "${EXTRA_CFLAGS}${EXTRA_CXXFLAGS}${EXTRA_ASFLAGS}" | ${GREP} -q 'fcf-protection' ; then
|
||||
# cf-protection requires CMOV and thus i686
|
||||
$1_CFLAGS_CPU="-march=i686"
|
||||
AC_MSG_RESULT([yes, forcing ${$1_CFLAGS_CPU}])
|
||||
else
|
||||
# Force compatibility with i586 on 32 bit intel platforms.
|
||||
$1_CFLAGS_CPU="-march=i586"
|
||||
AC_MSG_RESULT([no, forcing ${$1_CFLAGS_CPU}])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
if test "x$FLAGS_CPU" = xaarch64; then
|
||||
# -Wno-psabi to get rid of annoying "note: parameter passing for argument of type '<type> changed in GCC 9.1"
|
||||
$1_CFLAGS_CPU="-Wno-psabi"
|
||||
elif test "x$FLAGS_CPU" = xarm; then
|
||||
# -Wno-psabi to get rid of annoying "note: the mangling of 'va_list' has changed in GCC 4.4"
|
||||
$1_CFLAGS_CPU="-fsigned-char -Wno-psabi $ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS -DJDK_ARCH_ABI_PROP_NAME='\"\$(JDK_ARCH_ABI_PROP_NAME)\"'"
|
||||
$1_CFLAGS_CPU_JVM="-DARM"
|
||||
elif test "x$FLAGS_CPU_ARCH" = xppc; then
|
||||
$1_CFLAGS_CPU_JVM="-mno-multiple -mno-string"
|
||||
if test "x$FLAGS_CPU" = xppc64; then
|
||||
# -mminimal-toc fixes `relocation truncated to fit' error for gcc 4.1.
|
||||
$1_CFLAGS_CPU="-mcpu=power8 -mtune=power8"
|
||||
$1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -mminimal-toc"
|
||||
elif test "x$FLAGS_CPU" = xppc64le; then
|
||||
# Little endian machine uses ELFv2 ABI.
|
||||
# Use Power8 for target cpu, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
||||
# Use Power10 for tuning target, this is supported by gcc >= 10
|
||||
POWER_TUNE_VERSION="-mtune=power10"
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${POWER_TUNE_VERSION}],
|
||||
IF_FALSE: [
|
||||
POWER_TUNE_VERSION="-mtune=power8"
|
||||
]
|
||||
)
|
||||
$1_CFLAGS_CPU="-mcpu=power8 ${POWER_TUNE_VERSION}"
|
||||
$1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2"
|
||||
fi
|
||||
elif test "x$FLAGS_CPU" = xs390x; then
|
||||
$1_CFLAGS_CPU="-mbackchain -march=z10"
|
||||
fi
|
||||
|
||||
if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then
|
||||
# for all archs except arm and ppc, prevent gcc to omit frame pointer
|
||||
$1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
|
||||
fi
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
if test "x$FLAGS_OS" = xlinux; then
|
||||
# ppc test not really needed for clang
|
||||
if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then
|
||||
# for all archs except arm and ppc, prevent gcc to omit frame pointer
|
||||
$1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
|
||||
fi
|
||||
if test "x$FLAGS_CPU" = xppc64le; then
|
||||
# Little endian machine uses ELFv2 ABI.
|
||||
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
||||
$1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=power8 -mtune=power10"
|
||||
fi
|
||||
fi
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
$1_CFLAGS_CPU="-mcpu=pwr8"
|
||||
fi
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
if test "x$FLAGS_CPU" = xx86; then
|
||||
$1_CFLAGS_CPU_JVM="-arch:IA32"
|
||||
elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
||||
if test "x$DEBUG_LEVEL" != xrelease; then
|
||||
# NOTE: This is probably redundant; -homeparams is default on
|
||||
# non-release builds.
|
||||
$1_CFLAGS_CPU_JVM="-homeparams"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
# This flag is required since GCC 6 as undefined behavior in OpenJDK code
|
||||
# runs afoul of the more aggressive versions of this optimization.
|
||||
$1_TOOLCHAIN_CFLAGS="-fno-lifetime-dse"
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
REPRODUCIBLE_CFLAGS="-experimental:deterministic"
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${REPRODUCIBLE_CFLAGS}],
|
||||
PREFIX: $3,
|
||||
IF_FALSE: [
|
||||
REPRODUCIBLE_CFLAGS=
|
||||
]
|
||||
)
|
||||
AC_SUBST(REPRODUCIBLE_CFLAGS)
|
||||
fi
|
||||
|
||||
# Prevent the __FILE__ macro from generating absolute paths into the built
|
||||
# binaries. Depending on toolchain, different mitigations are possible.
|
||||
# * GCC and Clang of new enough versions have -fmacro-prefix-map.
|
||||
# * For most other toolchains, supplying all source files and -I flags as
|
||||
# relative paths fixes the issue.
|
||||
FILE_MACRO_CFLAGS=
|
||||
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
# Check if compiler supports -fmacro-prefix-map. If so, use that to make
|
||||
# the __FILE__ macro resolve to paths relative to the workspace root.
|
||||
workspace_root_trailing_slash="${WORKSPACE_ROOT%/}/"
|
||||
FILE_MACRO_CFLAGS="-fmacro-prefix-map=${workspace_root_trailing_slash}="
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${FILE_MACRO_CFLAGS}],
|
||||
PREFIX: $3,
|
||||
IF_FALSE: [
|
||||
FILE_MACRO_CFLAGS=
|
||||
]
|
||||
)
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# There is a known issue with the pathmap if the mapping is made to the
|
||||
# empty string. Add a minimal string "s" as prefix to work around this.
|
||||
# PATHMAP_FLAGS is also added to LDFLAGS in flags-ldflags.m4.
|
||||
PATHMAP_FLAGS="-pathmap:${WORKSPACE_ROOT}=s"
|
||||
FILE_MACRO_CFLAGS="$PATHMAP_FLAGS"
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${FILE_MACRO_CFLAGS}],
|
||||
PREFIX: $3,
|
||||
IF_FALSE: [
|
||||
PATHMAP_FLAGS=
|
||||
FILE_MACRO_CFLAGS=
|
||||
]
|
||||
)
|
||||
if test "x$FILE_MACRO_CFLAGS" != x; then
|
||||
# Add -pathmap for all VS system include paths using Windows
|
||||
# full Long path name that is generated by the compiler
|
||||
# Not enabled under WSL as there is no easy way to obtain the
|
||||
# Windows full long paths, thus reproducible WSL builds will
|
||||
# depend on building with the same VS toolchain install location.
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" != "xwindows.wsl1" && test "x$OPENJDK_BUILD_OS_ENV" != "xwindows.wsl2"; then
|
||||
for ipath in ${$3SYSROOT_CFLAGS}; do
|
||||
if test "x${ipath:0:2}" == "x-I"; then
|
||||
ipath_path=${ipath#"-I"}
|
||||
UTIL_FIXUP_WIN_LONG_PATH(ipath_path)
|
||||
FILE_MACRO_CFLAGS="$FILE_MACRO_CFLAGS -pathmap:\"$ipath_path\"=vsi"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([how to prevent absolute paths in output])
|
||||
if test "x$FILE_MACRO_CFLAGS" != x; then
|
||||
AC_MSG_RESULT([using compiler options])
|
||||
else
|
||||
AC_MSG_RESULT([using relative paths])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(FILE_MACRO_CFLAGS)
|
||||
|
||||
FLAGS_SETUP_BRANCH_PROTECTION
|
||||
|
||||
if test "x$FLAGS_CPU" = xriscv64; then
|
||||
AC_MSG_CHECKING([if RVV/vector sigcontext supported])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <linux/ptrace.h>],
|
||||
[
|
||||
return (int)sizeof(struct __riscv_v_ext_state);
|
||||
])],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
],
|
||||
[
|
||||
$1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -DNO_RVV_SIGCONTEXT"
|
||||
AC_MSG_RESULT([no])
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
# EXPORT to API
|
||||
CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM \
|
||||
$TOOLCHAIN_CFLAGS_JVM ${$1_TOOLCHAIN_CFLAGS_JVM} \
|
||||
$OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \
|
||||
$WARNING_CFLAGS_JVM $JVM_PICFLAG $FILE_MACRO_CFLAGS \
|
||||
$REPRODUCIBLE_CFLAGS $BRANCH_PROTECTION_CFLAGS"
|
||||
|
||||
CFLAGS_JDK_COMMON="$ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
|
||||
$OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
|
||||
$DEBUG_SYMBOLS_CFLAGS_JDK \
|
||||
$FILE_MACRO_CFLAGS $REPRODUCIBLE_CFLAGS $BRANCH_PROTECTION_CFLAGS"
|
||||
|
||||
# Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
|
||||
# (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might
|
||||
# change in the future.)
|
||||
|
||||
CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY \
|
||||
$WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}"
|
||||
CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY \
|
||||
$TOOLCHAIN_CFLAGS_JDK_CXXONLY \
|
||||
${$1_TOOLCHAIN_CFLAGS_JDK_CXXONLY} \
|
||||
$WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}"
|
||||
|
||||
$1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}"
|
||||
$1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}"
|
||||
|
||||
$2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}"
|
||||
|
||||
$2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK} $PIEFLAG"
|
||||
$2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK} $PIEFLAG"
|
||||
$2CFLAGS_JDKLIB="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK} \
|
||||
$JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
|
||||
$2CXXFLAGS_JDKLIB="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK} \
|
||||
$JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
|
||||
|
||||
AC_SUBST($2JVM_CFLAGS)
|
||||
AC_SUBST($2CFLAGS_JDKLIB)
|
||||
AC_SUBST($2CFLAGS_JDKEXE)
|
||||
AC_SUBST($2CXXFLAGS_JDKLIB)
|
||||
AC_SUBST($2CXXFLAGS_JDKEXE)
|
||||
AC_SUBST($2ADLC_LANGSTD_CXXFLAGS)
|
||||
|
||||
COMPILER_FP_CONTRACT_OFF_FLAG="-ffp-contract=off"
|
||||
# Check that the compiler supports -ffp-contract=off flag
|
||||
# Set FDLIBM_CFLAGS to -ffp-contract=off if it does. Empty
|
||||
# otherwise.
|
||||
# These flags are required for GCC-based builds of
|
||||
# fdlibm with optimization without losing precision.
|
||||
# Notably, -ffp-contract=off needs to be added for GCC >= 4.6.
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_FP_CONTRACT_OFF_FLAG}],
|
||||
PREFIX: $3,
|
||||
IF_TRUE: [$2FDLIBM_CFLAGS=${COMPILER_FP_CONTRACT_OFF_FLAG}],
|
||||
IF_FALSE: [$2FDLIBM_CFLAGS=""])
|
||||
fi
|
||||
AC_SUBST($2FDLIBM_CFLAGS)
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([FLAGS_SETUP_BRANCH_PROTECTION],
|
||||
[
|
||||
# Is branch protection available?
|
||||
BRANCH_PROTECTION_AVAILABLE=false
|
||||
BRANCH_PROTECTION_FLAG="-mbranch-protection=standard"
|
||||
|
||||
if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$BRANCH_PROTECTION_FLAG],
|
||||
IF_TRUE: [BRANCH_PROTECTION_AVAILABLE=true])
|
||||
fi
|
||||
fi
|
||||
|
||||
UTIL_ARG_ENABLE(NAME: branch-protection, DEFAULT: false,
|
||||
RESULT: BRANCH_PROTECTION_ENABLED, AVAILABLE: $BRANCH_PROTECTION_AVAILABLE,
|
||||
DESC: [enable branch protection when compiling C/C++],
|
||||
IF_ENABLED: [BRANCH_PROTECTION_CFLAGS=$BRANCH_PROTECTION_FLAG])
|
||||
])
|
||||
234
make/autoconf/flags-ldflags.m4
Normal file
234
make/autoconf/flags-ldflags.m4
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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([FLAGS_SETUP_LDFLAGS],
|
||||
[
|
||||
FLAGS_SETUP_LDFLAGS_HELPER
|
||||
|
||||
# Setup the target toolchain
|
||||
FLAGS_SETUP_LDFLAGS_CPU_DEP([TARGET])
|
||||
|
||||
# Setup the build toolchain
|
||||
FLAGS_SETUP_LDFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_], [BUILD_])
|
||||
|
||||
AC_SUBST(ADLC_LDFLAGS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
|
||||
# CPU independent LDFLAGS setup, used for both target and build toolchain.
|
||||
AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
|
||||
[
|
||||
# Setup basic LDFLAGS
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
# Add -z,defs, to forbid undefined symbols in object files.
|
||||
# add -z,relro (mark relocations read only) for all libs
|
||||
# add -z,now ("full relro" - more of the Global Offset Table GOT is marked read only)
|
||||
# add --no-as-needed to disable default --as-needed link flag on some GCC toolchains
|
||||
# add --icf=all (Identical Code Folding — merges identical functions)
|
||||
BASIC_LDFLAGS="-Wl,-z,defs -Wl,-z,relro -Wl,-z,now -Wl,--no-as-needed -Wl,--exclude-libs,ALL"
|
||||
|
||||
# Linux : remove unused code+data in link step
|
||||
if test "x$ENABLE_LINKTIME_GC" = xtrue; then
|
||||
if test "x$OPENJDK_TARGET_CPU" = xs390x; then
|
||||
BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,--gc-sections"
|
||||
else
|
||||
BASIC_LDFLAGS_JDK_ONLY="$BASIC_LDFLAGS_JDK_ONLY -Wl,--gc-sections"
|
||||
fi
|
||||
fi
|
||||
|
||||
BASIC_LDFLAGS_JVM_ONLY=""
|
||||
LDFLAGS_LTO="-flto=auto -fuse-linker-plugin -fno-strict-aliasing $DEBUG_PREFIX_CFLAGS"
|
||||
|
||||
LDFLAGS_CXX_PARTIAL_LINKING="$MACHINE_FLAG -r"
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
BASIC_LDFLAGS_JVM_ONLY="-mno-omit-leaf-frame-pointer -mstack-alignment=16 \
|
||||
-fPIC"
|
||||
|
||||
LDFLAGS_LTO="-flto=auto -fuse-linker-plugin -fno-strict-aliasing $DEBUG_PREFIX_CFLAGS"
|
||||
LDFLAGS_CXX_PARTIAL_LINKING="$MACHINE_FLAG -r"
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
# Clang needs the lld linker to work correctly
|
||||
BASIC_LDFLAGS="-fuse-ld=lld -Wl,--exclude-libs,ALL"
|
||||
if test "x$CXX_IS_USER_SUPPLIED" = xfalse && test "x$CC_IS_USER_SUPPLIED" = xfalse; then
|
||||
UTIL_REQUIRE_TOOLCHAIN_PROGS(LLD, lld)
|
||||
fi
|
||||
|
||||
if test "x$ENABLE_LINKTIME_GC" = xtrue; then
|
||||
BASIC_LDFLAGS_JDK_ONLY="$BASIC_LDFLAGS_JDK_ONLY -Wl,--gc-sections"
|
||||
fi
|
||||
fi
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
BASIC_LDFLAGS="-Wl,-b64 -Wl,-brtl -Wl,-bnorwexec -Wl,-blibpath:/usr/lib:lib -Wl,-bnoexpall \
|
||||
-Wl,-bernotok -Wl,-bcdtors:mbr::s -Wl,-bdatapsize:64k -Wl,-btextpsize:64k -Wl,-bstackpsize:64k"
|
||||
BASIC_LDFLAGS_JVM_ONLY="$BASIC_LDFLAGS_JVM_ONLY -Wl,-lC_r -Wl,-bbigtoc"
|
||||
fi
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
BASIC_LDFLAGS="-opt:ref"
|
||||
BASIC_LDFLAGS_JDK_ONLY="-incremental:no"
|
||||
BASIC_LDFLAGS_JVM_ONLY="-opt:icf,8 -subsystem:windows"
|
||||
LDFLAGS_LTO="-LTCG:INCREMENTAL"
|
||||
fi
|
||||
|
||||
if (test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang) \
|
||||
&& test "x$OPENJDK_TARGET_OS" != xaix; then
|
||||
if test -n "$HAS_NOEXECSTACK"; then
|
||||
BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,noexecstack"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Setup OS-dependent LDFLAGS
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
if test x$DEBUG_LEVEL = xrelease; then
|
||||
BASIC_LDFLAGS_JDK_ONLY="$BASIC_LDFLAGS_JDK_ONLY -Wl,-dead_strip"
|
||||
fi
|
||||
# FIXME: We should really generalize SetSharedLibraryOrigin instead.
|
||||
OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
|
||||
OS_LDFLAGS="-mmacosx-version-min=$MACOSX_VERSION_MIN -Wl,-reproducible"
|
||||
fi
|
||||
|
||||
# Setup debug level-dependent LDFLAGS
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
if test x$DEBUG_LEVEL = xrelease; then
|
||||
DEBUGLEVEL_LDFLAGS_JDK_ONLY="$DEBUGLEVEL_LDFLAGS_JDK_ONLY -Wl,-O1"
|
||||
fi
|
||||
fi
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
# We need '-fpic' or '-fpic -mcmodel=large -Wl,-bbigtoc' if the TOC overflows.
|
||||
# Hotspot now overflows its 64K TOC (currently only for debug),
|
||||
# so we build with '-fpic -mcmodel=large -Wl,-bbigtoc'.
|
||||
if test "x$DEBUG_LEVEL" != xrelease; then
|
||||
DEBUGLEVEL_LDFLAGS_JVM_ONLY="$DEBUGLEVEL_LDFLAGS_JVM_ONLY -Wl,-bbigtoc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Setup LDFLAGS for linking executables
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
# Enabling pie on 32 bit builds prevents the JVM from allocating a continuous
|
||||
# java heap.
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" != "x32"; then
|
||||
EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -pie"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
REPRODUCIBLE_LDFLAGS="-experimental:deterministic"
|
||||
FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$REPRODUCIBLE_LDFLAGS],
|
||||
IF_FALSE: [
|
||||
REPRODUCIBLE_LDFLAGS=
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
BASIC_LDFLAGS="$BASIC_LDFLAGS -pdbaltpath:%_PDB%"
|
||||
# PATHMAP_FLAGS is setup in flags-cflags.m4.
|
||||
FILE_MACRO_LDFLAGS="${PATHMAP_FLAGS}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Export some intermediate variables for compatibility
|
||||
LDFLAGS_CXX_JDK="$DEBUGLEVEL_LDFLAGS_JDK_ONLY"
|
||||
AC_SUBST(LDFLAGS_LTO)
|
||||
AC_SUBST(LDFLAGS_CXX_JDK)
|
||||
AC_SUBST(LDFLAGS_CXX_PARTIAL_LINKING)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
|
||||
# conditionals against.
|
||||
# $2 - Optional prefix for each variable defined (OPENJDK_BUILD_ or nothing).
|
||||
# $3 - Optional prefix for toolchain variables (BUILD_ or nothing).
|
||||
AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP],
|
||||
[
|
||||
# Setup CPU-dependent basic LDFLAGS. These can differ between the target and
|
||||
# build toolchain.
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
if test "x${OPENJDK_$1_CPU}" = xx86; then
|
||||
$1_CPU_LDFLAGS_JVM_ONLY="-march=i586"
|
||||
elif test "x$OPENJDK_$1_CPU" = xarm; then
|
||||
$1_CPU_LDFLAGS_JVM_ONLY="${$1_CPU_LDFLAGS_JVM_ONLY} -fsigned-char"
|
||||
$1_CPU_LDFLAGS="$ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS"
|
||||
fi
|
||||
|
||||
# MIPS ABI does not support GNU hash style
|
||||
if test "x${OPENJDK_$1_CPU}" = xmips ||
|
||||
test "x${OPENJDK_$1_CPU}" = xmipsel ||
|
||||
test "x${OPENJDK_$1_CPU}" = xmips64 ||
|
||||
test "x${OPENJDK_$1_CPU}" = xmips64el; then
|
||||
$1_CPU_LDFLAGS="${$1_CPU_LDFLAGS} -Wl,--hash-style=sysv"
|
||||
else
|
||||
$1_CPU_LDFLAGS="${$1_CPU_LDFLAGS} -Wl,--hash-style=gnu"
|
||||
fi
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
if test "x${OPENJDK_$1_CPU_BITS}" = "x32"; then
|
||||
$1_CPU_EXECUTABLE_LDFLAGS="-stack:327680"
|
||||
elif test "x${OPENJDK_$1_CPU_BITS}" = "x64"; then
|
||||
$1_CPU_EXECUTABLE_LDFLAGS="-stack:1048576"
|
||||
fi
|
||||
if test "x${OPENJDK_$1_CPU}" = "xx86"; then
|
||||
$1_CPU_LDFLAGS="-safeseh"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x${$3LD_TYPE}" = "xgold"; then
|
||||
if test x$DEBUG_LEVEL = xrelease; then
|
||||
$1_CPU_LDFLAGS="${$1_CPU_LDFLAGS} -Wl,--icf=all"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Export variables according to old definitions, prefix with $2 if present.
|
||||
LDFLAGS_JDK_COMMON="$BASIC_LDFLAGS $BASIC_LDFLAGS_JDK_ONLY \
|
||||
$OS_LDFLAGS $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}"
|
||||
$2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON \
|
||||
$SHARED_LIBRARY_FLAGS $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
|
||||
$2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \
|
||||
${$1_CPU_EXECUTABLE_LDFLAGS} $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
|
||||
|
||||
$2LDFLAGS_STATIC_JDK="$BASIC_LDFLAGS $OS_LDFLAGS ${$2EXTRA_LDFLAGS} \
|
||||
$REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
|
||||
|
||||
$2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS $OS_LDFLAGS_JVM_ONLY \
|
||||
$DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY \
|
||||
${$1_CPU_LDFLAGS} ${$1_CPU_LDFLAGS_JVM_ONLY} ${$2EXTRA_LDFLAGS} \
|
||||
$REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
|
||||
|
||||
AC_SUBST($2LDFLAGS_JDKLIB)
|
||||
AC_SUBST($2LDFLAGS_JDKEXE)
|
||||
|
||||
AC_SUBST($2LDFLAGS_STATIC_JDK)
|
||||
|
||||
AC_SUBST($2JVM_LDFLAGS)
|
||||
])
|
||||
218
make/autoconf/flags-other.m4
Normal file
218
make/autoconf/flags-other.m4
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Setup flags for other tools than C/C++ compiler
|
||||
#
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_ARFLAGS],
|
||||
[
|
||||
# FIXME: figure out if we should select AR flags depending on OS or toolchain.
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
ARFLAGS="-X64"
|
||||
else
|
||||
ARFLAGS=""
|
||||
fi
|
||||
|
||||
AC_SUBST(ARFLAGS)
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_LIBFLAGS],
|
||||
[
|
||||
# LIB is used to create static libraries on Windows
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
||||
LIBFLAGS="-nodefaultlib:msvcrt"
|
||||
else
|
||||
LIBFLAGS=""
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBFLAGS)
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_STRIPFLAGS],
|
||||
[
|
||||
## Setup strip.
|
||||
if test "x$STRIP" != x; then
|
||||
AC_MSG_CHECKING([how to run strip])
|
||||
|
||||
# Easy cheat: Check strip variant by passing --version as an argument.
|
||||
# Different types of strip have varying command line syntaxes for querying their
|
||||
# version string, and all noisily fail if the provided version option is not
|
||||
# recognised.
|
||||
#
|
||||
# The actual version string or failure to execute strip are hidden by redirection
|
||||
# to config.log with 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
|
||||
|
||||
if $STRIP "--version" 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
|
||||
# strip that comes from the GNU family uses --version
|
||||
# This variant of strip is usually found accompanying gcc and clang
|
||||
STRIPFLAGS="--strip-debug"
|
||||
elif $STRIP "-V" 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
|
||||
# IBM strip that works with AIX binaries only supports -V
|
||||
STRIPFLAGS="-X32_64"
|
||||
else
|
||||
# The only strip variant left is MacOS/Xcode strip, which does not have any
|
||||
# way whatsoever to be identified (lacking even basic help or version options),
|
||||
# so we leave it as the last fallback when all other tests have failed.
|
||||
STRIPFLAGS="-S"
|
||||
fi
|
||||
AC_MSG_RESULT($STRIPFLAGS)
|
||||
fi
|
||||
|
||||
AC_SUBST(STRIPFLAGS)
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_RCFLAGS],
|
||||
[
|
||||
# On Windows, we need to set RC flags.
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
RCFLAGS="-nologo"
|
||||
if test "x$DEBUG_LEVEL" = xrelease; then
|
||||
RCFLAGS="$RCFLAGS -DNDEBUG"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(RCFLAGS)
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_NMFLAGS],
|
||||
[
|
||||
# On AIX, we need to set NM flag -X64 for processing 64bit object files
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
NMFLAGS="-X64"
|
||||
fi
|
||||
|
||||
AC_SUBST(NMFLAGS)
|
||||
])
|
||||
|
||||
# Check whether the compiler supports the Arm C Language Extensions (ACLE)
|
||||
# for SVE. Set SVE_CFLAGS to -march=armv8-a+sve if it does.
|
||||
# ACLE and this flag are required to build the aarch64 SVE related functions
|
||||
# in libvectormath.
|
||||
AC_DEFUN([FLAGS_SETUP_SVE],
|
||||
[
|
||||
AARCH64_SVE_AVAILABLE=false
|
||||
# Apple Silicon does not support SVE; use macOS as a proxy for that check.
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xaarch64" && test "x$OPENJDK_TARGET_OS" = "xlinux"; then
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
# check the compiler and binutils support sve or not
|
||||
AC_MSG_CHECKING([if Arm SVE ACLE is supported])
|
||||
AC_LANG_PUSH([C])
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -march=armv8-a+sve $CFLAGS_WARNINGS_ARE_ERRORS ARG_ARGUMENT"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[
|
||||
#include <arm_sve.h>
|
||||
svfloat64_t a() {}
|
||||
],
|
||||
[
|
||||
svint32_t r = svdup_n_s32(1)
|
||||
])],
|
||||
[
|
||||
AARCH64_SVE_AVAILABLE=true
|
||||
]
|
||||
)
|
||||
CFLAGS="$saved_cflags"
|
||||
AC_LANG_POP([C])
|
||||
AC_MSG_RESULT([$AARCH64_SVE_AVAILABLE])
|
||||
fi
|
||||
fi
|
||||
|
||||
UTIL_ARG_ENABLE(NAME: aarch64-sve, DEFAULT: auto,
|
||||
RESULT: AARCH64_SVE_ENABLED,
|
||||
DESC: [Use SVE when compiling libsleef],
|
||||
AVAILABLE: $AARCH64_SVE_AVAILABLE)
|
||||
SVE_CFLAGS=""
|
||||
if test "x$AARCH64_SVE_ENABLED" = xtrue; then
|
||||
SVE_CFLAGS="-march=armv8-a+sve"
|
||||
# Switching the initialization mode with gcc from 'pattern' to 'zero'
|
||||
# avoids the use of unsupported `__builtin_clear_padding` for variable
|
||||
# length aggregates
|
||||
if test "x$DEBUG_LEVEL" != xrelease && test "x$TOOLCHAIN_TYPE" = xgcc ; then
|
||||
AC_MSG_CHECKING([Switching the initialization mode with gcc from pattern to zero])
|
||||
INIT_ZERO_FLAG="-ftrivial-auto-var-init=zero"
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$INIT_ZERO_FLAG],
|
||||
IF_TRUE: [
|
||||
SVE_CFLAGS="${SVE_CFLAGS} $INIT_ZERO_FLAG"
|
||||
]
|
||||
)
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(SVE_CFLAGS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# platform independent
|
||||
AC_DEFUN([FLAGS_SETUP_ASFLAGS],
|
||||
[
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
# Force preprocessor to run, just to make sure
|
||||
BASIC_ASFLAGS="-x assembler-with-cpp"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
|
||||
BASIC_ASFLAGS="-nologo"
|
||||
else
|
||||
BASIC_ASFLAGS="-nologo -c"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(BASIC_ASFLAGS)
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
JVM_BASIC_ASFLAGS="-mno-omit-leaf-frame-pointer -mstack-alignment=16"
|
||||
|
||||
# Fix linker warning.
|
||||
# Code taken from make/autoconf/flags-cflags.m4 and adapted.
|
||||
JVM_BASIC_ASFLAGS="$JVM_BASIC_ASFLAGS \
|
||||
-DMAC_OS_X_VERSION_MIN_REQUIRED=$MACOSX_VERSION_MIN_NODOTS \
|
||||
-mmacosx-version-min=$MACOSX_VERSION_MIN"
|
||||
|
||||
if test -n "$MACOSX_VERSION_MAX"; then
|
||||
JVM_BASIC_ASFLAGS="$JVM_BASIC_ASFLAGS $OS_CFLAGS \
|
||||
-DMAC_OS_X_VERSION_MAX_ALLOWED=$MACOSX_VERSION_MAX_NODOTS"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
|
||||
# conditionals against.
|
||||
# $2 - Optional prefix for each variable defined.
|
||||
AC_DEFUN([FLAGS_SETUP_ASFLAGS_CPU_DEP],
|
||||
[
|
||||
# Misuse EXTRA_CFLAGS to mimic old behavior
|
||||
$2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS ${$2EXTRA_CFLAGS}"
|
||||
|
||||
if test "x$1" = "xTARGET" && \
|
||||
test "x$TOOLCHAIN_TYPE" = xgcc && \
|
||||
test "x$OPENJDK_TARGET_CPU" = xarm; then
|
||||
$2JVM_ASFLAGS="${$2JVM_ASFLAGS} $ARM_ARCH_TYPE_ASFLAGS $ARM_FLOAT_TYPE_ASFLAGS"
|
||||
fi
|
||||
|
||||
if test "x$BRANCH_PROTECTION_ENABLED" = "xtrue"; then
|
||||
$2JVM_ASFLAGS="${$2JVM_ASFLAGS} $BRANCH_PROTECTION_FLAG"
|
||||
fi
|
||||
|
||||
AC_SUBST($2JVM_ASFLAGS)
|
||||
])
|
||||
497
make/autoconf/flags.m4
Normal file
497
make/autoconf/flags.m4
Normal file
|
|
@ -0,0 +1,497 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
m4_include([flags-cflags.m4])
|
||||
m4_include([flags-ldflags.m4])
|
||||
m4_include([flags-other.m4])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Setup ABI profile (for arm)
|
||||
#
|
||||
AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
|
||||
[
|
||||
AC_ARG_WITH(abi-profile, [AS_HELP_STRING([--with-abi-profile],
|
||||
[specify ABI profile for ARM builds (arm-vfp-sflt,arm-vfp-hflt,arm-sflt, armv5-vfp-sflt,armv6-vfp-hflt,aarch64) @<:@toolchain dependent@:>@ ])])
|
||||
|
||||
if test "x$with_abi_profile" != x; then
|
||||
if test "x$OPENJDK_TARGET_CPU" != xarm && \
|
||||
test "x$OPENJDK_TARGET_CPU" != xaarch64; then
|
||||
AC_MSG_ERROR([--with-abi-profile only available on arm/aarch64])
|
||||
fi
|
||||
|
||||
OPENJDK_TARGET_ABI_PROFILE=$with_abi_profile
|
||||
AC_MSG_CHECKING([for ABI profle])
|
||||
AC_MSG_RESULT([$OPENJDK_TARGET_ABI_PROFILE])
|
||||
|
||||
# --- Arm-sflt CFLAGS and ASFLAGS ---
|
||||
# Armv5te is required for assembler, because pld insn used in arm32 hotspot is only in v5E and above.
|
||||
# However, there is also a GCC bug which generates unaligned strd/ldrd instructions on armv5te:
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82445, and it was fixed in gcc 7.1.
|
||||
# The resulting compromise is to enable v5TE for assembler and let GCC generate code for v5T.
|
||||
if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
|
||||
ARM_FLOAT_TYPE=vfp-sflt
|
||||
ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
|
||||
ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
|
||||
elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-hflt; then
|
||||
ARM_FLOAT_TYPE=vfp-hflt
|
||||
ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
|
||||
ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
|
||||
elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
|
||||
ARM_FLOAT_TYPE=sflt
|
||||
ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
|
||||
ARM_ARCH_TYPE_ASFLAGS='-march=armv5te'
|
||||
elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
|
||||
ARM_FLOAT_TYPE=vfp-sflt
|
||||
ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
|
||||
ARM_ARCH_TYPE_ASFLAGS='-march=armv5te'
|
||||
elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv6-vfp-hflt; then
|
||||
ARM_FLOAT_TYPE=vfp-hflt
|
||||
ARM_ARCH_TYPE_FLAGS='-march=armv6 -marm'
|
||||
ARM_ARCH_TYPE_ASFLAGS='-march=armv6'
|
||||
elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xaarch64; then
|
||||
# No special flags, just need to trigger setting JDK_ARCH_ABI_PROP_NAME
|
||||
ARM_FLOAT_TYPE=
|
||||
ARM_ARCH_TYPE_FLAGS=
|
||||
ARM_ARCH_TYPE_ASFLAGS=
|
||||
else
|
||||
AC_MSG_ERROR([Invalid ABI profile: "$OPENJDK_TARGET_ABI_PROFILE"])
|
||||
fi
|
||||
|
||||
if test "x$ARM_FLOAT_TYPE" = xvfp-sflt; then
|
||||
ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=softfp -mfpu=vfp -DFLOAT_ARCH=-vfp-sflt'
|
||||
ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=softfp -mfpu=vfp"
|
||||
elif test "x$ARM_FLOAT_TYPE" = xvfp-hflt; then
|
||||
ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=hard -mfpu=vfp -DFLOAT_ARCH=-vfp-hflt'
|
||||
ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=hard -mfpu=vfp"
|
||||
elif test "x$ARM_FLOAT_TYPE" = xsflt; then
|
||||
ARM_FLOAT_TYPE_FLAGS='-msoft-float -mfpu=vfp'
|
||||
ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=soft -mfpu=vfp"
|
||||
fi
|
||||
AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags])
|
||||
AC_MSG_RESULT([$ARM_FLOAT_TYPE_FLAGS])
|
||||
AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags for assembler])
|
||||
AC_MSG_RESULT([$ARM_FLOAT_TYPE_ASFLAGS])
|
||||
|
||||
AC_MSG_CHECKING([for arch type flags])
|
||||
AC_MSG_RESULT([$ARM_ARCH_TYPE_FLAGS])
|
||||
AC_MSG_CHECKING([for arch type flags for assembler])
|
||||
AC_MSG_RESULT([$ARM_ARCH_TYPE_ASFLAGS])
|
||||
|
||||
# Now set JDK_ARCH_ABI_PROP_NAME. This is equivalent to the last part of the
|
||||
# autoconf target triplet.
|
||||
[ JDK_ARCH_ABI_PROP_NAME=`$ECHO $OPENJDK_TARGET_AUTOCONF_NAME | $SED -e 's/.*-\([^-]*\)$/\1/'` ]
|
||||
# Sanity check that it is a known ABI.
|
||||
if test "x$JDK_ARCH_ABI_PROP_NAME" != xgnu && \
|
||||
test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabi && \
|
||||
test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabihf; then
|
||||
AC_MSG_WARN([Unknown autoconf target triplet ABI: "$JDK_ARCH_ABI_PROP_NAME"])
|
||||
fi
|
||||
AC_MSG_CHECKING([for ABI property name])
|
||||
AC_MSG_RESULT([$JDK_ARCH_ABI_PROP_NAME])
|
||||
AC_SUBST(JDK_ARCH_ABI_PROP_NAME)
|
||||
fi
|
||||
|
||||
# When building with an abi profile, the name of that profile is appended on the
|
||||
# bundle platform, which is used in bundle names.
|
||||
if test "x$OPENJDK_TARGET_ABI_PROFILE" != x; then
|
||||
OPENJDK_TARGET_BUNDLE_PLATFORM="$OPENJDK_TARGET_OS_BUNDLE-$OPENJDK_TARGET_ABI_PROFILE"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_MACOSX_VERSION],
|
||||
[
|
||||
# Additional macosx handling
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
# The expected format for <version> is either nn.n.n or nn.nn.nn. See
|
||||
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/AvailabilityVersions.h
|
||||
|
||||
# MACOSX_VERSION_MIN specifies the lowest version of macOS that the built
|
||||
# binaries should be compatible with, even if compiled on a newer version
|
||||
# of the OS. It currently has a hard coded value. Setting this also limits
|
||||
# exposure to API changes in header files. Bumping this is likely to
|
||||
# require code changes to build.
|
||||
MACOSX_VERSION_MIN=11.00.00
|
||||
MACOSX_VERSION_MIN_NODOTS=${MACOSX_VERSION_MIN//\./}
|
||||
|
||||
AC_SUBST(MACOSX_VERSION_MIN)
|
||||
|
||||
# Setting --with-macosx-version-max=<version> makes it an error to build or
|
||||
# link to macosx APIs that are newer than the given OS version.
|
||||
AC_ARG_WITH([macosx-version-max], [AS_HELP_STRING([--with-macosx-version-max],
|
||||
[error on use of newer functionality. @<:@macosx@:>@])],
|
||||
[
|
||||
if echo "$with_macosx_version_max" | $GREP -q "^[[0-9]][[0-9]]\.[[0-9]]\.[[0-9]]\$"; then
|
||||
MACOSX_VERSION_MAX=$with_macosx_version_max
|
||||
elif echo "$with_macosx_version_max" | $GREP -q "^[[0-9]][[0-9]]\.[[0-9]][[0-9]]\.[[0-9]][[0-9]]\$"; then
|
||||
MACOSX_VERSION_MAX=$with_macosx_version_max
|
||||
elif test "x$with_macosx_version_max" = "xno"; then
|
||||
# Use build system default
|
||||
MACOSX_VERSION_MAX=
|
||||
else
|
||||
AC_MSG_ERROR([osx version format must be nn.n.n or nn.nn.nn])
|
||||
fi
|
||||
],
|
||||
[MACOSX_VERSION_MAX=]
|
||||
)
|
||||
MACOSX_VERSION_MAX_NODOTS=${MACOSX_VERSION_MAX//\./}
|
||||
|
||||
AC_SUBST(MACOSX_VERSION_MAX)
|
||||
fi
|
||||
])
|
||||
|
||||
# Reset the global CFLAGS/LDFLAGS variables and initialize them with the
|
||||
# corresponding configure arguments instead
|
||||
AC_DEFUN_ONCE([FLAGS_SETUP_USER_SUPPLIED_FLAGS],
|
||||
[
|
||||
if test "x$CFLAGS" != "x"; then
|
||||
AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
|
||||
fi
|
||||
|
||||
if test "x$CXXFLAGS" != "x"; then
|
||||
AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
|
||||
fi
|
||||
|
||||
if test "x$LDFLAGS" != "x"; then
|
||||
AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
|
||||
fi
|
||||
|
||||
if test "x$ASFLAGS" != "x"; then
|
||||
AC_MSG_WARN([Ignoring ASFLAGS($ASFLAGS) found in environment. Use --with-extra-asflags])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
|
||||
[extra flags to be used when compiling jdk c-files])])
|
||||
|
||||
AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
|
||||
[extra flags to be used when compiling jdk c++-files])])
|
||||
|
||||
AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
|
||||
[extra flags to be used when linking jdk])])
|
||||
|
||||
AC_ARG_WITH(extra-asflags, [AS_HELP_STRING([--with-extra-asflags],
|
||||
[extra flags to be passed to the assembler])])
|
||||
|
||||
USER_CFLAGS="$with_extra_cflags"
|
||||
USER_CXXFLAGS="$with_extra_cxxflags"
|
||||
USER_LDFLAGS="$with_extra_ldflags"
|
||||
USER_ASFLAGS="$with_extra_asflags"
|
||||
])
|
||||
|
||||
# Setup the sysroot flags and add them to global CFLAGS and LDFLAGS so
|
||||
# that configure can use them while detecting compilers.
|
||||
# TOOLCHAIN_TYPE is available here.
|
||||
# Param 1 - Optional prefix to all variables. (e.g BUILD_)
|
||||
AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
|
||||
[
|
||||
if test "x[$]$1SYSROOT" != "x"; then
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
$1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
|
||||
$1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
|
||||
# -isysroot has no effect on linux
|
||||
# https://bugs.llvm.org/show_bug.cgi?id=11503
|
||||
$1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
|
||||
$1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
|
||||
if test -d "$DEVKIT_TOOLCHAIN_PATH"; then
|
||||
# In devkits, gcc is not located in the sysroot.
|
||||
# use --gcc-toolchain to let clang find the gcc installation.
|
||||
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS --gcc-toolchain=$DEVKIT_TOOLCHAIN_PATH/.."
|
||||
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS --gcc-toolchain=$DEVKIT_TOOLCHAIN_PATH/.."
|
||||
fi
|
||||
else
|
||||
$1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
|
||||
$1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
# We also need -iframework<path>/System/Library/Frameworks
|
||||
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
|
||||
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
|
||||
if test -d "[$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks" ; then
|
||||
# These always need to be set on macOS 10.X, or we can't find the frameworks embedded in JavaVM.framework
|
||||
# set this here so it doesn't have to be peppered throughout the forest
|
||||
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
|
||||
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For the microsoft toolchain, we need to get the SYSROOT flags from the
|
||||
# Visual Studio environment. Currently we cannot handle this as a separate
|
||||
# build toolchain.
|
||||
if test "x$1" = x && test "x$OPENJDK_BUILD_OS" = "xwindows" \
|
||||
&& test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
|
||||
TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
|
||||
fi
|
||||
|
||||
AC_SUBST($1SYSROOT_CFLAGS)
|
||||
AC_SUBST($1SYSROOT_LDFLAGS)
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
|
||||
[
|
||||
# We should always include user supplied flags
|
||||
FLAGS_SETUP_USER_SUPPLIED_FLAGS
|
||||
|
||||
# The sysroot flags are needed for configure to be able to run the compilers
|
||||
FLAGS_SETUP_SYSROOT_FLAGS
|
||||
|
||||
# For clang/gcc, the flag is only strictly required for reduced builds, but
|
||||
# set it always where possible (x86 and ppc).
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86 &&
|
||||
test "x$OPENJDK_TARGET_CPU" != xx32 ||
|
||||
test "x$OPENJDK_TARGET_CPU_ARCH" = xppc; then
|
||||
MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
|
||||
MACHINE_FLAG="$MACHINE_FLAG -arch arm64"
|
||||
elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
||||
MACHINE_FLAG="$MACHINE_FLAG -arch x86_64"
|
||||
fi
|
||||
fi
|
||||
|
||||
# FIXME: global flags are not used yet...
|
||||
# The "global" flags will *always* be set. Without them, it is not possible to
|
||||
# get a working compilation.
|
||||
GLOBAL_CFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CFLAGS"
|
||||
GLOBAL_CXXFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CXXFLAGS"
|
||||
GLOBAL_LDFLAGS="$MACHINE_FLAG $SYSROOT_LDFLAGS $USER_LDFLAGS"
|
||||
# FIXME: Don't really know how to do with this, but this was the old behavior
|
||||
GLOBAL_CPPFLAGS="$SYSROOT_CFLAGS"
|
||||
|
||||
# FIXME: For compatibility, export this as EXTRA_CFLAGS for now.
|
||||
EXTRA_CFLAGS="$MACHINE_FLAG $USER_CFLAGS"
|
||||
EXTRA_CXXFLAGS="$MACHINE_FLAG $USER_CXXFLAGS"
|
||||
EXTRA_LDFLAGS="$MACHINE_FLAG $USER_LDFLAGS"
|
||||
EXTRA_ASFLAGS="$USER_ASFLAGS"
|
||||
|
||||
AC_SUBST(MACHINE_FLAG)
|
||||
AC_SUBST(EXTRA_CFLAGS)
|
||||
AC_SUBST(EXTRA_CXXFLAGS)
|
||||
AC_SUBST(EXTRA_LDFLAGS)
|
||||
AC_SUBST(EXTRA_ASFLAGS)
|
||||
|
||||
# For autoconf testing to work, the global flags must also be stored in the
|
||||
# "unnamed" CFLAGS etc.
|
||||
CFLAGS="$GLOBAL_CFLAGS"
|
||||
CXXFLAGS="$GLOBAL_CXXFLAGS"
|
||||
LDFLAGS="$GLOBAL_LDFLAGS"
|
||||
CPPFLAGS="$GLOBAL_CPPFLAGS"
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# When autoconf sends both compiler and linker flags to cl.exe at the same
|
||||
# time, linker flags must be last at the command line. Achieve this by
|
||||
# moving them to LIBS.
|
||||
LIBS="$LIBS -link $LDFLAGS"
|
||||
LDFLAGS=""
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
|
||||
[
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
if test "x$OPENJDK_TARGET_CPU" != xaarch64; then
|
||||
AS_NON_ASM_EXTENSION_OPTION=-Ta
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(AS_NON_ASM_EXTENSION_OPTION)
|
||||
|
||||
# Generate make dependency files
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
GENDEPS_FLAGS="-MMD -MF"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
GENDEPS_FLAGS="-MMD -MF"
|
||||
fi
|
||||
AC_SUBST(GENDEPS_FLAGS)
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN],
|
||||
[
|
||||
FLAGS_SETUP_TOOLCHAIN_CONTROL
|
||||
|
||||
if test "x$BUILD_SYSROOT" != x; then
|
||||
FLAGS_SETUP_SYSROOT_FLAGS([BUILD_])
|
||||
else
|
||||
if test "x$COMPILE_TYPE" != "xcross"; then
|
||||
BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
|
||||
BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([FLAGS_SETUP_FLAGS],
|
||||
[
|
||||
FLAGS_SETUP_MACOSX_VERSION
|
||||
FLAGS_SETUP_ABI_PROFILE
|
||||
|
||||
FLAGS_SETUP_SHARED_LIBS
|
||||
FLAGS_SETUP_DEBUG_SYMBOLS
|
||||
FLAGS_SETUP_WARNINGS
|
||||
FLAGS_SETUP_QUALITY_CHECKS
|
||||
FLAGS_SETUP_OPTIMIZATION
|
||||
|
||||
FLAGS_SETUP_CFLAGS
|
||||
FLAGS_SETUP_LDFLAGS
|
||||
|
||||
FLAGS_SETUP_ARFLAGS
|
||||
FLAGS_SETUP_LIBFLAGS
|
||||
FLAGS_SETUP_STRIPFLAGS
|
||||
FLAGS_SETUP_RCFLAGS
|
||||
FLAGS_SETUP_NMFLAGS
|
||||
|
||||
FLAGS_SETUP_SVE
|
||||
FLAGS_SETUP_ASFLAGS
|
||||
FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
|
||||
FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
|
||||
])
|
||||
|
||||
# FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
|
||||
# IF_FALSE: [RUN-IF-FALSE])
|
||||
# ------------------------------------------------------------
|
||||
# Check that the C compiler supports an argument
|
||||
UTIL_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
|
||||
[*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
|
||||
[
|
||||
AC_MSG_CHECKING([if ARG_PREFIX[CC] supports "ARG_ARGUMENT"])
|
||||
supports=yes
|
||||
|
||||
saved_cflags="$CFLAGS"
|
||||
saved_cc="$CC"
|
||||
CFLAGS="$CFLAGS $CFLAGS_WARNINGS_ARE_ERRORS ARG_ARGUMENT"
|
||||
CC="$ARG_PREFIX[CC]"
|
||||
AC_LANG_PUSH([C])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
|
||||
[supports=no])
|
||||
AC_LANG_POP([C])
|
||||
CC="$saved_cc"
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
AC_MSG_RESULT([$supports])
|
||||
if test "x$supports" = "xyes" ; then
|
||||
:
|
||||
ARG_IF_TRUE
|
||||
else
|
||||
:
|
||||
ARG_IF_FALSE
|
||||
fi
|
||||
])
|
||||
|
||||
# FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
|
||||
# IF_FALSE: [RUN-IF-FALSE])
|
||||
# ------------------------------------------------------------
|
||||
# Check that the C++ compiler supports an argument
|
||||
UTIL_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
|
||||
[*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
|
||||
[
|
||||
AC_MSG_CHECKING([if ARG_PREFIX[CXX] supports "ARG_ARGUMENT"])
|
||||
supports=yes
|
||||
|
||||
saved_cxxflags="$CXXFLAGS"
|
||||
saved_cxx="$CXX"
|
||||
CXXFLAGS="$CXXFLAG $CFLAGS_WARNINGS_ARE_ERRORS ARG_ARGUMENT"
|
||||
CXX="$ARG_PREFIX[CXX]"
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
|
||||
[supports=no])
|
||||
AC_LANG_POP([C++])
|
||||
CXX="$saved_cxx"
|
||||
CXXFLAGS="$saved_cxxflags"
|
||||
|
||||
AC_MSG_RESULT([$supports])
|
||||
if test "x$supports" = "xyes" ; then
|
||||
:
|
||||
ARG_IF_TRUE
|
||||
else
|
||||
:
|
||||
ARG_IF_FALSE
|
||||
fi
|
||||
])
|
||||
|
||||
# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
|
||||
# IF_FALSE: [RUN-IF-FALSE])
|
||||
# ------------------------------------------------------------
|
||||
# Check that the C and C++ compilers support an argument
|
||||
UTIL_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
|
||||
[*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
|
||||
[
|
||||
FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: ARG_ARGUMENT,
|
||||
IF_TRUE: [C_COMP_SUPPORTS="yes"],
|
||||
IF_FALSE: [C_COMP_SUPPORTS="no"],
|
||||
PREFIX: ARG_PREFIX)
|
||||
FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: ARG_ARGUMENT,
|
||||
IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
|
||||
IF_FALSE: [CXX_COMP_SUPPORTS="no"],
|
||||
PREFIX: ARG_PREFIX)
|
||||
|
||||
AC_MSG_CHECKING([if both ARG_PREFIX[CC] and ARG_PREFIX[CXX] support "ARG_ARGUMENT"])
|
||||
supports=no
|
||||
if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then
|
||||
supports=yes;
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([$supports])
|
||||
if test "x$supports" = "xyes" ; then
|
||||
:
|
||||
ARG_IF_TRUE
|
||||
else
|
||||
:
|
||||
ARG_IF_FALSE
|
||||
fi
|
||||
])
|
||||
|
||||
# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
|
||||
# IF_FALSE: [RUN-IF-FALSE])
|
||||
# ------------------------------------------------------------
|
||||
# Check that the linker support an argument
|
||||
UTIL_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
|
||||
[*ARGUMENT IF_TRUE IF_FALSE], [$@],
|
||||
[
|
||||
AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
|
||||
supports=yes
|
||||
|
||||
saved_ldflags="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS ARG_ARGUMENT"
|
||||
AC_LANG_PUSH([C])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
|
||||
[], [supports=no])
|
||||
AC_LANG_POP([C])
|
||||
LDFLAGS="$saved_ldflags"
|
||||
|
||||
AC_MSG_RESULT([$supports])
|
||||
if test "x$supports" = "xyes" ; then
|
||||
:
|
||||
ARG_IF_TRUE
|
||||
else
|
||||
:
|
||||
ARG_IF_FALSE
|
||||
fi
|
||||
])
|
||||
392
make/autoconf/help.m4
Normal file
392
make/autoconf/help.m4
Normal file
|
|
@ -0,0 +1,392 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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_ONCE([HELP_SETUP_DEPENDENCY_HELP],
|
||||
[
|
||||
UTIL_LOOKUP_PROGS(PKGHANDLER, zypper apt-get yum brew port pkgutil pkgadd pacman apk)
|
||||
])
|
||||
|
||||
AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
|
||||
[
|
||||
# Print a helpful message on how to acquire the necessary build dependency.
|
||||
# $1 is the help tag: cups, alsa etc
|
||||
MISSING_DEPENDENCY=$1
|
||||
|
||||
if test "x$MISSING_DEPENDENCY" = "xopenjdk"; then
|
||||
HELP_MSG="OpenJDK distributions are available at http://jdk.java.net/."
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
|
||||
cygwin_help $MISSING_DEPENDENCY
|
||||
else
|
||||
PKGHANDLER_COMMAND=
|
||||
|
||||
case $PKGHANDLER in
|
||||
*apt-get)
|
||||
apt_help $MISSING_DEPENDENCY ;;
|
||||
*yum)
|
||||
yum_help $MISSING_DEPENDENCY ;;
|
||||
*brew)
|
||||
brew_help $MISSING_DEPENDENCY ;;
|
||||
*port)
|
||||
port_help $MISSING_DEPENDENCY ;;
|
||||
*pkgutil)
|
||||
pkgutil_help $MISSING_DEPENDENCY ;;
|
||||
*pkgadd)
|
||||
pkgadd_help $MISSING_DEPENDENCY ;;
|
||||
*zypper)
|
||||
zypper_help $MISSING_DEPENDENCY ;;
|
||||
*pacman)
|
||||
pacman_help $MISSING_DEPENDENCY ;;
|
||||
*apk)
|
||||
apk_help $MISSING_DEPENDENCY ;;
|
||||
esac
|
||||
|
||||
if test "x$PKGHANDLER_COMMAND" != x; then
|
||||
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
cygwin_help() {
|
||||
case $1 in
|
||||
unzip)
|
||||
PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P unzip )"
|
||||
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
|
||||
;;
|
||||
zip)
|
||||
PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P zip )"
|
||||
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
|
||||
;;
|
||||
make)
|
||||
PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P make )"
|
||||
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
|
||||
;;
|
||||
i686-w64-mingw32-gcc)
|
||||
PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P gcc-core i686-w64-mingw32-gcc-core mingw64-i686-glib2.0 )"
|
||||
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
|
||||
;;
|
||||
x86_64-w64-mingw32-gcc)
|
||||
PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P gcc-core x86_64-w64-mingw32-gcc-core mingw64-x86_64-glib2.0 )"
|
||||
HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
apt_help() {
|
||||
case $1 in
|
||||
reduced)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install gcc-multilib g++-multilib" ;;
|
||||
devkit)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install build-essential" ;;
|
||||
alsa)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libasound2-dev" ;;
|
||||
cups)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libcups2-dev" ;;
|
||||
fontconfig)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libfontconfig1-dev" ;;
|
||||
freetype)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;;
|
||||
harfbuzz)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libharfbuzz-dev" ;;
|
||||
ffi)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libffi-dev" ;;
|
||||
x11)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev" ;;
|
||||
ccache)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install ccache" ;;
|
||||
dtrace)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install systemtap-sdt-dev" ;;
|
||||
capstone)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libcapstone-dev" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
zypper_help() {
|
||||
case $1 in
|
||||
devkit)
|
||||
PKGHANDLER_COMMAND="sudo zypper install gcc gcc-c++" ;;
|
||||
alsa)
|
||||
PKGHANDLER_COMMAND="sudo zypper install alsa-devel" ;;
|
||||
cups)
|
||||
PKGHANDLER_COMMAND="sudo zypper install cups-devel" ;;
|
||||
fontconfig)
|
||||
PKGHANDLER_COMMAND="sudo zypper install fontconfig-devel" ;;
|
||||
freetype)
|
||||
PKGHANDLER_COMMAND="sudo zypper install freetype-devel" ;;
|
||||
harfbuzz)
|
||||
PKGHANDLER_COMMAND="sudo zypper install harfbuzz-devel" ;;
|
||||
x11)
|
||||
PKGHANDLER_COMMAND="sudo zypper install libX11-devel libXext-devel libXrender-devel libXrandr-devel libXtst-devel libXt-devel libXi-devel" ;;
|
||||
ccache)
|
||||
PKGHANDLER_COMMAND="sudo zypper install ccache" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
yum_help() {
|
||||
case $1 in
|
||||
devkit)
|
||||
PKGHANDLER_COMMAND="sudo yum groupinstall \"Development Tools\"" ;;
|
||||
alsa)
|
||||
PKGHANDLER_COMMAND="sudo yum install alsa-lib-devel" ;;
|
||||
cups)
|
||||
PKGHANDLER_COMMAND="sudo yum install cups-devel" ;;
|
||||
fontconfig)
|
||||
PKGHANDLER_COMMAND="sudo yum install fontconfig-devel" ;;
|
||||
freetype)
|
||||
PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;;
|
||||
harfbuzz)
|
||||
PKGHANDLER_COMMAND="sudo yum install harfbuzz-devel" ;;
|
||||
x11)
|
||||
PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel" ;;
|
||||
ccache)
|
||||
PKGHANDLER_COMMAND="sudo yum install ccache" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
brew_help() {
|
||||
case $1 in
|
||||
freetype)
|
||||
PKGHANDLER_COMMAND="brew install freetype" ;;
|
||||
ccache)
|
||||
PKGHANDLER_COMMAND="brew install ccache" ;;
|
||||
capstone)
|
||||
PKGHANDLER_COMMAND="brew install capstone" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
pacman_help() {
|
||||
case $1 in
|
||||
unzip)
|
||||
PKGHANDLER_COMMAND="sudo pacman -S unzip" ;;
|
||||
zip)
|
||||
PKGHANDLER_COMMAND="sudo pacman -S zip" ;;
|
||||
make)
|
||||
PKGHANDLER_COMMAND="sudo pacman -S make" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
port_help() {
|
||||
PKGHANDLER_COMMAND=""
|
||||
}
|
||||
|
||||
pkgutil_help() {
|
||||
PKGHANDLER_COMMAND=""
|
||||
}
|
||||
|
||||
pkgadd_help() {
|
||||
PKGHANDLER_COMMAND=""
|
||||
}
|
||||
|
||||
apk_help() {
|
||||
case $1 in
|
||||
devkit)
|
||||
PKGHANDLER_COMMAND="sudo apk add alpine-sdk linux-headers" ;;
|
||||
alsa)
|
||||
PKGHANDLER_COMMAND="sudo apk add alsa-lib-dev" ;;
|
||||
cups)
|
||||
PKGHANDLER_COMMAND="sudo apk add cups-dev" ;;
|
||||
fontconfig)
|
||||
PKGHANDLER_COMMAND="sudo apk add fontconfig-dev" ;;
|
||||
freetype)
|
||||
PKGHANDLER_COMMAND="sudo apk add freetype-dev" ;;
|
||||
harfbuzz)
|
||||
PKGHANDLER_COMMAND="sudo apk add harfbuzz-dev" ;;
|
||||
x11)
|
||||
PKGHANDLER_COMMAND="sudo apk add libxtst-dev libxt-dev libxrender-dev libxrandr-dev" ;;
|
||||
ccache)
|
||||
PKGHANDLER_COMMAND="sudo apk add ccache" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# This function will check if we're called from the "configure" wrapper while
|
||||
# printing --help. If so, we will print out additional information that can
|
||||
# only be extracted within the autoconf script, and then exit. This must be
|
||||
# called at the very beginning in configure.ac.
|
||||
AC_DEFUN_ONCE([HELP_PRINT_ADDITIONAL_HELP_AND_EXIT],
|
||||
[
|
||||
if test "x$CONFIGURE_PRINT_ADDITIONAL_HELP" != x; then
|
||||
|
||||
# Print available toolchains
|
||||
$ECHO "The following toolchains are valid as arguments to --with-toolchain-type."
|
||||
$ECHO "Which are available to use depends on the build platform."
|
||||
for toolchain in $VALID_TOOLCHAINS_all; do
|
||||
# Use indirect variable referencing
|
||||
toolchain_var_name=TOOLCHAIN_DESCRIPTION_$toolchain
|
||||
TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
|
||||
$PRINTF " %-22s %s\n" $toolchain "$TOOLCHAIN_DESCRIPTION"
|
||||
done
|
||||
$ECHO ""
|
||||
|
||||
# Print available JVM features
|
||||
$ECHO "The following JVM features are valid as arguments to --with-jvm-features."
|
||||
$ECHO "Which are available to use depends on the environment and JVM variant."
|
||||
m4_foreach(FEATURE, m4_split(jvm_features_valid), [
|
||||
# Create an m4 variable containing the description for FEATURE.
|
||||
m4_define(FEATURE_DESCRIPTION, [jvm_feature_desc_]m4_translit(FEATURE, -, _))
|
||||
$PRINTF " %-22s %s\n" FEATURE "FEATURE_DESCRIPTION"
|
||||
m4_undefine([FEATURE_DESCRIPTION])
|
||||
])
|
||||
|
||||
# And now exit directly
|
||||
exit 0
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
|
||||
[
|
||||
# Finally output some useful information to the user
|
||||
|
||||
$ECHO ""
|
||||
$ECHO "===================================================="
|
||||
if test "x$no_create" != "xyes"; then
|
||||
if test "x$IS_RECONFIGURE" != "xyes"; then
|
||||
$ECHO "A new configuration has been successfully created in"
|
||||
$ECHO "$OUTPUTDIR"
|
||||
else
|
||||
$ECHO "The existing configuration has been successfully updated in"
|
||||
$ECHO "$OUTPUTDIR"
|
||||
fi
|
||||
else
|
||||
if test "x$IS_RECONFIGURE" != "xyes"; then
|
||||
$ECHO "A configuration has been successfully checked but not created"
|
||||
else
|
||||
$ECHO "The existing configuration has been successfully checked in"
|
||||
$ECHO "$OUTPUTDIR"
|
||||
fi
|
||||
fi
|
||||
if test "x$CONFIGURE_COMMAND_LINE" != x; then
|
||||
$ECHO "using configure arguments '$CONFIGURE_COMMAND_LINE'."
|
||||
else
|
||||
$ECHO "using default settings."
|
||||
fi
|
||||
|
||||
if test "x$REAL_CONFIGURE_COMMAND_EXEC_FULL" != x; then
|
||||
$ECHO ""
|
||||
$ECHO "The original configure invocation was '$REAL_CONFIGURE_COMMAND_EXEC_SHORT $REAL_CONFIGURE_COMMAND_LINE'."
|
||||
fi
|
||||
|
||||
$ECHO ""
|
||||
$ECHO "Configuration summary:"
|
||||
$ECHO "* Name: $CONF_NAME"
|
||||
$ECHO "* Debug level: $DEBUG_LEVEL"
|
||||
$ECHO "* HS debug level: $HOTSPOT_DEBUG_LEVEL"
|
||||
$ECHO "* JVM variants: $JVM_VARIANTS"
|
||||
$PRINTF "* JVM features: "
|
||||
|
||||
for variant in $JVM_VARIANTS; do
|
||||
features_var_name=JVM_FEATURES_$variant
|
||||
JVM_FEATURES_FOR_VARIANT=${!features_var_name}
|
||||
$PRINTF "%s: \'%s\' " "$variant" "$JVM_FEATURES_FOR_VARIANT"
|
||||
done
|
||||
$ECHO ""
|
||||
|
||||
$ECHO "* OpenJDK target: OS: $OPENJDK_TARGET_OS, CPU architecture: $OPENJDK_TARGET_CPU_ARCH, address length: $OPENJDK_TARGET_CPU_BITS"
|
||||
$ECHO "* Version string: $VERSION_STRING ($VERSION_SHORT)"
|
||||
|
||||
if test "x$SOURCE_DATE" != xupdated; then
|
||||
source_date_info="$SOURCE_DATE ($SOURCE_DATE_ISO_8601)"
|
||||
else
|
||||
source_date_info="Determined at build time"
|
||||
fi
|
||||
$ECHO "* Source date: $source_date_info"
|
||||
|
||||
$ECHO ""
|
||||
$ECHO "Tools summary:"
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
$ECHO "* Environment: $WINENV_VENDOR version $WINENV_VERSION; windows version $WINDOWS_VERSION; prefix \"$WINENV_PREFIX\"; root \"$WINENV_ROOT\""
|
||||
fi
|
||||
$ECHO "* Boot JDK: $BOOT_JDK_VERSION (at $BOOT_JDK)"
|
||||
$ECHO "* Toolchain: $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)"
|
||||
if test "x$DEVKIT_NAME" != x; then
|
||||
$ECHO "* Devkit: $DEVKIT_NAME ($DEVKIT_ROOT)"
|
||||
elif test "x$DEVKIT_ROOT" != x; then
|
||||
$ECHO "* Devkit: $DEVKIT_ROOT"
|
||||
elif test "x$SYSROOT" != x; then
|
||||
$ECHO "* Sysroot: $SYSROOT"
|
||||
fi
|
||||
$ECHO "* C Compiler: Version $CC_VERSION_NUMBER (at ${CC#"$FIXPATH "})"
|
||||
$ECHO "* C++ Compiler: Version $CXX_VERSION_NUMBER (at ${CXX#"$FIXPATH "})"
|
||||
|
||||
$ECHO ""
|
||||
$ECHO "Build performance summary:"
|
||||
$ECHO "* Build jobs: $JOBS"
|
||||
$ECHO "* Memory limit: $MEMORY_SIZE MB"
|
||||
if test "x$CCACHE_STATUS" != "x"; then
|
||||
$ECHO "* ccache status: $CCACHE_STATUS"
|
||||
fi
|
||||
$ECHO ""
|
||||
|
||||
if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xtrue"; then
|
||||
$ECHO "NOTE: You have requested to build more than one version of the JVM, which"
|
||||
$ECHO "will result in longer build times."
|
||||
$ECHO ""
|
||||
fi
|
||||
|
||||
if test "x$OUTPUT_DIR_IS_LOCAL" != "xyes"; then
|
||||
$ECHO "WARNING: Your build output directory is not on a local disk."
|
||||
$ECHO "This will severely degrade build performance!"
|
||||
$ECHO "It is recommended that you create an output directory on a local disk,"
|
||||
$ECHO "and run the configure script again from that directory."
|
||||
$ECHO ""
|
||||
fi
|
||||
|
||||
if test "x$IS_RECONFIGURE" = "xyes" && test "x$no_create" != "xyes"; then
|
||||
$ECHO "WARNING: The result of this configuration has overridden an older"
|
||||
$ECHO "configuration. You *should* run 'make clean' to make sure you get a"
|
||||
$ECHO "proper build. Failure to do so might result in strange build problems."
|
||||
$ECHO ""
|
||||
fi
|
||||
|
||||
if test "x$IS_RECONFIGURE" != "xyes" && test "x$no_create" = "xyes"; then
|
||||
$ECHO "WARNING: The result of this configuration was not saved."
|
||||
$ECHO "You should run without '--no-create | -n' to create the configuration."
|
||||
$ECHO ""
|
||||
fi
|
||||
|
||||
if test "x$UNSUPPORTED_TOOLCHAIN_VERSION" = "xyes"; then
|
||||
$ECHO "WARNING: The toolchain version used is known to have issues. Please"
|
||||
$ECHO "consider using a supported version unless you know what you are doing."
|
||||
$ECHO ""
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([HELP_REPEAT_WARNINGS],
|
||||
[
|
||||
# Locate config.log.
|
||||
if test -e "$CONFIGURESUPPORT_OUTPUTDIR/config.log"; then
|
||||
CONFIG_LOG_PATH="$CONFIGURESUPPORT_OUTPUTDIR"
|
||||
elif test -e "./config.log"; then
|
||||
CONFIG_LOG_PATH="."
|
||||
fi
|
||||
|
||||
if test -e "$CONFIG_LOG_PATH/config.log"; then
|
||||
$GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" > /dev/null 2>&1
|
||||
if test $? -eq 0; then
|
||||
$ECHO "The following warnings were produced. Repeated here for convenience:"
|
||||
# We must quote sed expression (using []) to stop m4 from eating the [].
|
||||
$GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" | $SED -e [ 's/^configure:[0-9]*: //' ]
|
||||
$ECHO ""
|
||||
fi
|
||||
fi
|
||||
])
|
||||
145
make/autoconf/hotspot.m4
Normal file
145
make/autoconf/hotspot.m4
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
# All valid JVM variants
|
||||
VALID_JVM_VARIANTS="server client minimal core zero custom"
|
||||
|
||||
################################################################################
|
||||
# Check if the specified JVM variant should be built. To be used in shell if
|
||||
# constructs, like this:
|
||||
# if HOTSPOT_CHECK_JVM_VARIANT(server); then
|
||||
#
|
||||
# Only valid to use after HOTSPOT_SETUP_JVM_VARIANTS has setup variants.
|
||||
|
||||
# Definition kept in one line to allow inlining in if statements.
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
AC_DEFUN([HOTSPOT_CHECK_JVM_VARIANT],
|
||||
[ [ [[ " $JVM_VARIANTS " =~ " $1 " ]] ] ])
|
||||
|
||||
################################################################################
|
||||
# Check which variants of the JVM that we want to build. Available variants are:
|
||||
# server: normal interpreter, and a tiered C1/C2 compiler
|
||||
# client: normal interpreter, and C1 (no C2 compiler)
|
||||
# minimal: reduced form of client with optional features stripped out
|
||||
# core: normal interpreter only, no compiler
|
||||
# zero: C++ based interpreter only, no compiler
|
||||
# custom: baseline JVM with no default features
|
||||
#
|
||||
AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS],
|
||||
[
|
||||
AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
|
||||
[JVM variants to build, separated by commas (server client minimal core
|
||||
zero custom) @<:@server@:>@])])
|
||||
|
||||
if test "x$with_jvm_variants" = x; then
|
||||
with_jvm_variants="server"
|
||||
fi
|
||||
JVM_VARIANTS_OPT="$with_jvm_variants"
|
||||
|
||||
# Has the user listed more than one variant?
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
if [ [[ "$JVM_VARIANTS_OPT" =~ "," ]] ]; then
|
||||
BUILDING_MULTIPLE_JVM_VARIANTS=true
|
||||
else
|
||||
BUILDING_MULTIPLE_JVM_VARIANTS=false
|
||||
fi
|
||||
# Replace the commas with AND for use in the build directory name.
|
||||
JVM_VARIANTS_WITH_AND=`$ECHO "$JVM_VARIANTS_OPT" | $SED -e 's/,/AND/g'`
|
||||
|
||||
AC_MSG_CHECKING([which variants of the JVM to build])
|
||||
# JVM_VARIANTS is a space-separated list.
|
||||
# Also use minimal, not minimal1 (which is kept for backwards compatibility).
|
||||
JVM_VARIANTS=`$ECHO $JVM_VARIANTS_OPT | $SED -e 's/,/ /g' -e 's/minimal1/minimal/'`
|
||||
AC_MSG_RESULT([$JVM_VARIANTS])
|
||||
|
||||
# Check that the selected variants are valid
|
||||
UTIL_GET_NON_MATCHING_VALUES(INVALID_VARIANTS, $JVM_VARIANTS, \
|
||||
$VALID_JVM_VARIANTS)
|
||||
if test "x$INVALID_VARIANTS" != x; then
|
||||
AC_MSG_NOTICE([Unknown variant(s) specified: "$INVALID_VARIANTS"])
|
||||
AC_MSG_NOTICE([The available JVM variants are: "$VALID_JVM_VARIANTS"])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
# The "main" variant is the one used by other libs to link against during the
|
||||
# build.
|
||||
if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xtrue"; then
|
||||
MAIN_VARIANT_PRIO_ORDER="server client minimal zero"
|
||||
for variant in $MAIN_VARIANT_PRIO_ORDER; do
|
||||
if HOTSPOT_CHECK_JVM_VARIANT($variant); then
|
||||
JVM_VARIANT_MAIN="$variant"
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
JVM_VARIANT_MAIN="$JVM_VARIANTS"
|
||||
fi
|
||||
|
||||
AC_SUBST(JVM_VARIANTS)
|
||||
AC_SUBST(VALID_JVM_VARIANTS)
|
||||
AC_SUBST(JVM_VARIANT_MAIN)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Misc hotspot setup that does not fit elsewhere.
|
||||
#
|
||||
AC_DEFUN_ONCE([HOTSPOT_SETUP_MISC],
|
||||
[
|
||||
if HOTSPOT_CHECK_JVM_VARIANT(zero); then
|
||||
# zero behaves as a platform and rewrites these values. This is a bit weird.
|
||||
# But when building zero, we never build any other variants so it works.
|
||||
HOTSPOT_TARGET_CPU=zero
|
||||
HOTSPOT_TARGET_CPU_ARCH=zero
|
||||
fi
|
||||
|
||||
|
||||
AC_ARG_WITH([hotspot-build-time], [AS_HELP_STRING([--with-hotspot-build-time],
|
||||
[timestamp to use in hotspot version string, empty means determined at build time @<:@source-date/empty@:>@])])
|
||||
|
||||
AC_MSG_CHECKING([what hotspot build time to use])
|
||||
|
||||
if test "x$with_hotspot_build_time" != x; then
|
||||
HOTSPOT_BUILD_TIME="$with_hotspot_build_time"
|
||||
AC_MSG_RESULT([$HOTSPOT_BUILD_TIME (from --with-hotspot-build-time)])
|
||||
else
|
||||
if test "x$SOURCE_DATE" = xupdated; then
|
||||
HOTSPOT_BUILD_TIME=""
|
||||
AC_MSG_RESULT([determined at build time (default)])
|
||||
else
|
||||
# If we have a fixed value for SOURCE_DATE, use it as default
|
||||
HOTSPOT_BUILD_TIME="$SOURCE_DATE_ISO_8601"
|
||||
AC_MSG_RESULT([$HOTSPOT_BUILD_TIME (from --with-source-date)])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(HOTSPOT_BUILD_TIME)
|
||||
|
||||
|
||||
# Override hotspot cpu definitions for ARM platforms
|
||||
if test "x$OPENJDK_TARGET_CPU" = xarm; then
|
||||
HOTSPOT_TARGET_CPU=arm_32
|
||||
HOTSPOT_TARGET_CPU_DEFINE="ARM32"
|
||||
fi
|
||||
])
|
||||
1096
make/autoconf/jdk-options.m4
Normal file
1096
make/autoconf/jdk-options.m4
Normal file
File diff suppressed because it is too large
Load diff
583
make/autoconf/jdk-version.m4
Normal file
583
make/autoconf/jdk-version.m4
Normal file
|
|
@ -0,0 +1,583 @@
|
|||
#
|
||||
# Copyright (c) 2015, 2024, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Setup version numbers
|
||||
#
|
||||
|
||||
# Verify that a given string represents a valid version number, and assign it
|
||||
# to a variable.
|
||||
|
||||
# Argument 1: the variable to assign to
|
||||
# Argument 2: the value given by the user
|
||||
AC_DEFUN([JDKVER_CHECK_AND_SET_NUMBER],
|
||||
[
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
if [ ! [[ "$2" =~ ^0*([1-9][0-9]*)$|^0*(0)$ ]] ] ; then
|
||||
AC_MSG_ERROR(["$2" is not a valid numerical value for $1])
|
||||
fi
|
||||
# Extract the version number without leading zeros.
|
||||
cleaned_value=${BASH_REMATCH[[1]]}
|
||||
if test "x$cleaned_value" = x; then
|
||||
# Special case for zero
|
||||
cleaned_value=${BASH_REMATCH[[2]]}
|
||||
fi
|
||||
|
||||
if test $cleaned_value -gt 255; then
|
||||
AC_MSG_ERROR([$1 is given as $2. This is greater than 255 which is not allowed.])
|
||||
fi
|
||||
if test "x$cleaned_value" != "x$2"; then
|
||||
AC_MSG_WARN([Value for $1 has been sanitized from '$2' to '$cleaned_value'])
|
||||
fi
|
||||
$1=$cleaned_value
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
|
||||
[
|
||||
# Source the version numbers file
|
||||
. $TOPDIR/make/conf/version-numbers.conf
|
||||
# Source the branding file
|
||||
. $TOPDIR/make/conf/branding.conf
|
||||
|
||||
# Some non-version number information is set in that file
|
||||
AC_SUBST(LAUNCHER_NAME)
|
||||
AC_SUBST(PRODUCT_NAME)
|
||||
AC_SUBST(PRODUCT_SUFFIX)
|
||||
AC_SUBST(JDK_RC_PLATFORM_NAME)
|
||||
AC_SUBST(HOTSPOT_VM_DISTRO)
|
||||
|
||||
# Note: UTIL_ARG_WITH treats empty strings as valid values when OPTIONAL is false!
|
||||
|
||||
# Outer [ ] to quote m4.
|
||||
[ USERNAME=`$ECHO "$USER" | $TR -d -c '[a-z][A-Z][0-9]'` ]
|
||||
|
||||
# $USER may be not defined in dockers, so try to check with $WHOAMI
|
||||
if test "x$USERNAME" = x && test "x$WHOAMI" != x; then
|
||||
[ USERNAME=`$WHOAMI | $TR -d -c '[a-z][A-Z][0-9]'` ]
|
||||
fi
|
||||
|
||||
# Setup username (for use in adhoc version strings etc)
|
||||
UTIL_ARG_WITH(NAME: build-user, TYPE: string,
|
||||
RESULT: USERNAME,
|
||||
DEFAULT: $USERNAME,
|
||||
DESC: [build username to use in version strings],
|
||||
DEFAULT_DESC: [current username, sanitized],
|
||||
CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY])
|
||||
AC_SUBST(USERNAME)
|
||||
|
||||
# Set the JDK RC name
|
||||
# Otherwise calculate from "branding.conf" included above.
|
||||
UTIL_ARG_WITH(NAME: jdk-rc-name, TYPE: string,
|
||||
DEFAULT: $PRODUCT_NAME $JDK_RC_PLATFORM_NAME,
|
||||
DESC: [Set JDK RC name. This is used for FileDescription and ProductName
|
||||
properties of MS Windows binaries.],
|
||||
DEFAULT_DESC: [from branding.conf],
|
||||
CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
|
||||
AC_SUBST(JDK_RC_NAME)
|
||||
|
||||
# The vendor name, if any
|
||||
# Only set COMPANY_NAME if '--with-vendor-name' was used and is not empty.
|
||||
# Otherwise we will use the value from "branding.conf" included above.
|
||||
UTIL_ARG_WITH(NAME: vendor-name, TYPE: string,
|
||||
RESULT: COMPANY_NAME,
|
||||
DEFAULT: $COMPANY_NAME,
|
||||
DESC: [Set vendor name. Among others, used to set the 'java.vendor'
|
||||
and 'java.vm.vendor' system properties.],
|
||||
DEFAULT_DESC: [from branding.conf],
|
||||
CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
|
||||
AC_SUBST(COMPANY_NAME)
|
||||
|
||||
# Set the JDK RC Company name
|
||||
# Otherwise uses the value set for "vendor-name".
|
||||
UTIL_ARG_WITH(NAME: jdk-rc-company-name, TYPE: string,
|
||||
DEFAULT: $COMPANY_NAME,
|
||||
DESC: [Set JDK RC company name. This is used for CompanyName properties of MS Windows binaries.],
|
||||
DEFAULT_DESC: [from branding.conf],
|
||||
CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
|
||||
AC_SUBST(JDK_RC_COMPANY_NAME)
|
||||
|
||||
# The vendor URL, if any
|
||||
# Only set VENDOR_URL if '--with-vendor-url' was used and is not empty.
|
||||
# Otherwise we will use the value from "branding.conf" included above.
|
||||
UTIL_ARG_WITH(NAME: vendor-url, TYPE: string,
|
||||
DEFAULT: $VENDOR_URL,
|
||||
DESC: [Set the 'java.vendor.url' system property],
|
||||
DEFAULT_DESC: [from branding.conf],
|
||||
CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
|
||||
AC_SUBST(VENDOR_URL)
|
||||
|
||||
# The vendor bug URL, if any
|
||||
# Only set VENDOR_URL_BUG if '--with-vendor-bug-url' was used and is not empty.
|
||||
# Otherwise we will use the value from "branding.conf" included above.
|
||||
UTIL_ARG_WITH(NAME: vendor-bug-url, TYPE: string,
|
||||
RESULT: VENDOR_URL_BUG,
|
||||
DEFAULT: $VENDOR_URL_BUG,
|
||||
DESC: [Set the 'java.vendor.url.bug' system property],
|
||||
DEFAULT_DESC: [from branding.conf],
|
||||
CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
|
||||
AC_SUBST(VENDOR_URL_BUG)
|
||||
|
||||
# The vendor VM bug URL, if any
|
||||
# Only set VENDOR_URL_VM_BUG if '--with-vendor-vm-bug-url' was used and is not empty.
|
||||
# Otherwise we will use the value from "branding.conf" included above.
|
||||
UTIL_ARG_WITH(NAME: vendor-vm-bug-url, TYPE: string,
|
||||
RESULT: VENDOR_URL_VM_BUG,
|
||||
DEFAULT: $VENDOR_URL_VM_BUG,
|
||||
DESC: [Sets the bug URL which will be displayed when the VM crashes],
|
||||
DEFAULT_DESC: [from branding.conf],
|
||||
CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
|
||||
AC_SUBST(VENDOR_URL_VM_BUG)
|
||||
|
||||
# Override version from arguments
|
||||
|
||||
# If --with-version-string is set, process it first. It is possible to
|
||||
# override parts with more specific flags, since these are processed later.
|
||||
UTIL_ARG_WITH(NAME: version-string, TYPE: string,
|
||||
DEFAULT: [],
|
||||
DESC: [Set version string],
|
||||
DEFAULT_DESC: [calculated],
|
||||
CHECK_VALUE: [
|
||||
if test "x$RESULT" != x; then
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
if [ [[ $RESULT =~ ^([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?(-([a-zA-Z0-9]+))?(((\+)([0-9]*))?(-([-a-zA-Z0-9.]+))?)?$ ]] ]; then
|
||||
VERSION_FEATURE=${BASH_REMATCH[[1]]}
|
||||
VERSION_INTERIM=${BASH_REMATCH[[3]]}
|
||||
VERSION_UPDATE=${BASH_REMATCH[[5]]}
|
||||
VERSION_PATCH=${BASH_REMATCH[[7]]}
|
||||
VERSION_EXTRA1=${BASH_REMATCH[[9]]}
|
||||
VERSION_EXTRA2=${BASH_REMATCH[[11]]}
|
||||
VERSION_EXTRA3=${BASH_REMATCH[[13]]}
|
||||
VERSION_PRE=${BASH_REMATCH[[15]]}
|
||||
version_plus_separator=${BASH_REMATCH[[18]]}
|
||||
VERSION_BUILD=${BASH_REMATCH[[19]]}
|
||||
VERSION_OPT=${BASH_REMATCH[[21]]}
|
||||
# Unspecified numerical fields are interpreted as 0.
|
||||
if test "x$VERSION_INTERIM" = x; then
|
||||
VERSION_INTERIM=0
|
||||
fi
|
||||
if test "x$VERSION_UPDATE" = x; then
|
||||
VERSION_UPDATE=0
|
||||
fi
|
||||
if test "x$VERSION_PATCH" = x; then
|
||||
VERSION_PATCH=0
|
||||
fi
|
||||
if test "x$VERSION_EXTRA1" = x; then
|
||||
VERSION_EXTRA1=0
|
||||
fi
|
||||
if test "x$VERSION_EXTRA2" = x; then
|
||||
VERSION_EXTRA2=0
|
||||
fi
|
||||
if test "x$VERSION_EXTRA3" = x; then
|
||||
VERSION_EXTRA3=0
|
||||
fi
|
||||
if test "x$version_plus_separator" != x \
|
||||
&& test "x$VERSION_BUILD$VERSION_OPT" = x; then
|
||||
AC_MSG_ERROR([Version string contains + but both 'BUILD' and 'OPT' are missing])
|
||||
fi
|
||||
if test "x$VERSION_BUILD" = x0; then
|
||||
AC_MSG_WARN([Version build 0 is interpreted as no build number])
|
||||
VERSION_BUILD=
|
||||
fi
|
||||
# Stop the version part process from setting default values.
|
||||
# We still allow them to explicitly override though.
|
||||
NO_DEFAULT_VERSION_PARTS=true
|
||||
else
|
||||
FAILURE="--with-version-string fails to parse as a valid version string: $RESULT"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_ARG_WITH(version-pre, [AS_HELP_STRING([--with-version-pre],
|
||||
[Set the base part of the version 'PRE' field (pre-release identifier) @<:@'internal'@:>@])],
|
||||
[with_version_pre_present=true], [with_version_pre_present=false])
|
||||
|
||||
if test "x$with_version_pre_present" = xtrue; then
|
||||
if test "x$with_version_pre" = xyes; then
|
||||
AC_MSG_ERROR([--with-version-pre must have a value])
|
||||
elif test "x$with_version_pre" = xno; then
|
||||
# Interpret --without-* as empty string instead of the literal "no"
|
||||
VERSION_PRE=
|
||||
else
|
||||
# Only [a-zA-Z0-9] is allowed in the VERSION_PRE. Outer [ ] to quote m4.
|
||||
[ VERSION_PRE=`$ECHO "$with_version_pre" | $TR -c -d '[a-zA-Z0-9]'` ]
|
||||
if test "x$VERSION_PRE" != "x$with_version_pre"; then
|
||||
AC_MSG_WARN([--with-version-pre value has been sanitized from '$with_version_pre' to '$VERSION_PRE'])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
|
||||
# Default is to use "internal" as pre
|
||||
VERSION_PRE="internal"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(version-opt, [AS_HELP_STRING([--with-version-opt],
|
||||
[Set version 'OPT' field (build metadata) @<:@<timestamp>.<user>.<dirname>@:>@])],
|
||||
[with_version_opt_present=true], [with_version_opt_present=false])
|
||||
|
||||
if test "x$with_version_opt_present" = xtrue; then
|
||||
if test "x$with_version_opt" = xyes; then
|
||||
AC_MSG_ERROR([--with-version-opt must have a value])
|
||||
elif test "x$with_version_opt" = xno; then
|
||||
# Interpret --without-* as empty string instead of the literal "no"
|
||||
VERSION_OPT=
|
||||
else
|
||||
# Only [-.a-zA-Z0-9] is allowed in the VERSION_OPT. Outer [ ] to quote m4.
|
||||
[ VERSION_OPT=`$ECHO "$with_version_opt" | $TR -c -d '[a-z][A-Z][0-9].-'` ]
|
||||
if test "x$VERSION_OPT" != "x$with_version_opt"; then
|
||||
AC_MSG_WARN([--with-version-opt value has been sanitized from '$with_version_opt' to '$VERSION_OPT'])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
|
||||
# Default is to calculate a string like this:
|
||||
# 'adhoc.<username>.<base dir name>'
|
||||
# Outer [ ] to quote m4.
|
||||
[ basedirname=`$BASENAME "$WORKSPACE_ROOT" | $TR -d -c '[a-z][A-Z][0-9].-'` ]
|
||||
VERSION_OPT="adhoc.$USERNAME.$basedirname"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(version-build, [AS_HELP_STRING([--with-version-build],
|
||||
[Set version 'BUILD' field (build number) @<:@not specified@:>@])],
|
||||
[with_version_build_present=true], [with_version_build_present=false])
|
||||
|
||||
if test "x$with_version_build_present" = xtrue; then
|
||||
if test "x$with_version_build" = xyes; then
|
||||
AC_MSG_ERROR([--with-version-build must have a value])
|
||||
elif test "x$with_version_build" = xno; then
|
||||
# Interpret --without-* as empty string instead of the literal "no"
|
||||
VERSION_BUILD=
|
||||
elif test "x$with_version_build" = x; then
|
||||
VERSION_BUILD=
|
||||
else
|
||||
JDKVER_CHECK_AND_SET_NUMBER(VERSION_BUILD, $with_version_build)
|
||||
if test "x$VERSION_BUILD" = "x0"; then
|
||||
AC_MSG_WARN([--with-version-build=0 is interpreted as --without-version-build])
|
||||
VERSION_BUILD=
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
|
||||
# Default is to not have a build number.
|
||||
VERSION_BUILD=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# Default is to get value from version-numbers.conf
|
||||
if test "x$NO_DEFAULT_VERSION_PARTS" = xtrue; then
|
||||
DEFAULT_VERSION_FEATURE="$VERSION_FEATURE"
|
||||
fi
|
||||
|
||||
UTIL_ARG_WITH(NAME: version-feature, TYPE: string,
|
||||
DEFAULT: $DEFAULT_VERSION_FEATURE,
|
||||
DESC: [Set version 'FEATURE' field (first number)],
|
||||
DEFAULT_DESC: [current source value],
|
||||
CHECK_VALUE: [
|
||||
JDKVER_CHECK_AND_SET_NUMBER(VERSION_FEATURE, $RESULT)
|
||||
])
|
||||
|
||||
AC_ARG_WITH(version-interim, [AS_HELP_STRING([--with-version-interim],
|
||||
[Set version 'INTERIM' field (second number) @<:@current source value@:>@])],
|
||||
[with_version_interim_present=true], [with_version_interim_present=false])
|
||||
|
||||
if test "x$with_version_interim_present" = xtrue; then
|
||||
if test "x$with_version_interim" = xyes; then
|
||||
AC_MSG_ERROR([--with-version-interim must have a value])
|
||||
elif test "x$with_version_interim" = xno; then
|
||||
# Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
|
||||
VERSION_INTERIM=0
|
||||
elif test "x$with_version_interim" = x; then
|
||||
VERSION_INTERIM=0
|
||||
else
|
||||
JDKVER_CHECK_AND_SET_NUMBER(VERSION_INTERIM, $with_version_interim)
|
||||
fi
|
||||
else
|
||||
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
|
||||
# Default is 0, if unspecified
|
||||
VERSION_INTERIM=$DEFAULT_VERSION_INTERIM
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(version-update, [AS_HELP_STRING([--with-version-update],
|
||||
[Set version 'UPDATE' field (third number) @<:@current source value@:>@])],
|
||||
[with_version_update_present=true], [with_version_update_present=false])
|
||||
|
||||
if test "x$with_version_update_present" = xtrue; then
|
||||
if test "x$with_version_update" = xyes; then
|
||||
AC_MSG_ERROR([--with-version-update must have a value])
|
||||
elif test "x$with_version_update" = xno; then
|
||||
# Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
|
||||
VERSION_UPDATE=0
|
||||
elif test "x$with_version_update" = x; then
|
||||
VERSION_UPDATE=0
|
||||
else
|
||||
JDKVER_CHECK_AND_SET_NUMBER(VERSION_UPDATE, $with_version_update)
|
||||
fi
|
||||
else
|
||||
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
|
||||
# Default is 0, if unspecified
|
||||
VERSION_UPDATE=$DEFAULT_VERSION_UPDATE
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(version-patch, [AS_HELP_STRING([--with-version-patch],
|
||||
[Set version 'PATCH' field (fourth number) @<:@not specified@:>@])],
|
||||
[with_version_patch_present=true], [with_version_patch_present=false])
|
||||
|
||||
if test "x$with_version_patch_present" = xtrue; then
|
||||
if test "x$with_version_patch" = xyes; then
|
||||
AC_MSG_ERROR([--with-version-patch must have a value])
|
||||
elif test "x$with_version_patch" = xno; then
|
||||
# Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
|
||||
VERSION_PATCH=0
|
||||
elif test "x$with_version_patch" = x; then
|
||||
VERSION_PATCH=0
|
||||
else
|
||||
JDKVER_CHECK_AND_SET_NUMBER(VERSION_PATCH, $with_version_patch)
|
||||
fi
|
||||
else
|
||||
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
|
||||
# Default is 0, if unspecified
|
||||
VERSION_PATCH=$DEFAULT_VERSION_PATCH
|
||||
fi
|
||||
fi
|
||||
|
||||
# The 1st version extra number, if any
|
||||
AC_ARG_WITH(version-extra1, [AS_HELP_STRING([--with-version-extra1],
|
||||
[Set 1st version extra number @<:@not specified@:>@])],
|
||||
[with_version_extra1_present=true], [with_version_extra1_present=false])
|
||||
|
||||
if test "x$with_version_extra1_present" = xtrue; then
|
||||
if test "x$with_version_extra1" = xyes; then
|
||||
AC_MSG_ERROR([--with-version-extra1 must have a value])
|
||||
elif test "x$with_version_extra1" = xno; then
|
||||
# Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
|
||||
VERSION_EXTRA1=0
|
||||
elif test "x$with_version_extra1" = x; then
|
||||
VERSION_EXTRA1=0
|
||||
else
|
||||
JDKVER_CHECK_AND_SET_NUMBER(VERSION_EXTRA1, $with_version_extra1)
|
||||
fi
|
||||
else
|
||||
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
|
||||
VERSION_EXTRA1=$DEFAULT_VERSION_EXTRA1
|
||||
fi
|
||||
fi
|
||||
|
||||
# The 2nd version extra number, if any
|
||||
AC_ARG_WITH(version-extra2, [AS_HELP_STRING([--with-version-extra2],
|
||||
[Set 2nd version extra number @<:@not specified@:>@])],
|
||||
[with_version_extra2_present=true], [with_version_extra2_present=false])
|
||||
|
||||
if test "x$with_version_extra2_present" = xtrue; then
|
||||
if test "x$with_version_extra2" = xyes; then
|
||||
AC_MSG_ERROR([--with-version-extra2 must have a value])
|
||||
elif test "x$with_version_extra2" = xno; then
|
||||
# Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
|
||||
VERSION_EXTRA2=0
|
||||
elif test "x$with_version_extra2" = x; then
|
||||
VERSION_EXTRA2=0
|
||||
else
|
||||
JDKVER_CHECK_AND_SET_NUMBER(VERSION_EXTRA2, $with_version_extra2)
|
||||
fi
|
||||
else
|
||||
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
|
||||
VERSION_EXTRA2=$DEFAULT_VERSION_EXTRA2
|
||||
fi
|
||||
fi
|
||||
|
||||
# The 3rd version extra number, if any
|
||||
AC_ARG_WITH(version-extra3, [AS_HELP_STRING([--with-version-extra3],
|
||||
[Set 3rd version extra number @<:@not specified@:>@])],
|
||||
[with_version_extra3_present=true], [with_version_extra3_present=false])
|
||||
|
||||
if test "x$with_version_extra3_present" = xtrue; then
|
||||
if test "x$with_version_extra3" = xyes; then
|
||||
AC_MSG_ERROR([--with-version-extra3 must have a value])
|
||||
elif test "x$with_version_extra3" = xno; then
|
||||
# Interpret --without-* as empty string (i.e. 0) instead of the literal "no"
|
||||
VERSION_EXTRA3=0
|
||||
elif test "x$with_version_extra3" = x; then
|
||||
VERSION_EXTRA3=0
|
||||
else
|
||||
JDKVER_CHECK_AND_SET_NUMBER(VERSION_EXTRA3, $with_version_extra3)
|
||||
fi
|
||||
else
|
||||
if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then
|
||||
VERSION_EXTRA3=$DEFAULT_VERSION_EXTRA3
|
||||
fi
|
||||
fi
|
||||
|
||||
# Calculate derived version properties
|
||||
|
||||
# Set VERSION_IS_GA based on if VERSION_PRE has a value
|
||||
if test "x$VERSION_PRE" = x; then
|
||||
VERSION_IS_GA=true
|
||||
else
|
||||
VERSION_IS_GA=false
|
||||
fi
|
||||
|
||||
# VERSION_NUMBER but always with exactly 4 positions, with 0 for empty positions.
|
||||
VERSION_NUMBER_FOUR_POSITIONS=$VERSION_FEATURE.$VERSION_INTERIM.$VERSION_UPDATE.$VERSION_PATCH
|
||||
|
||||
# VERSION_NUMBER but always with all positions, with 0 for empty positions.
|
||||
VERSION_NUMBER_ALL_POSITIONS=$VERSION_NUMBER_FOUR_POSITIONS.$VERSION_EXTRA1.$VERSION_EXTRA2.$VERSION_EXTRA3
|
||||
|
||||
stripped_version_number=$VERSION_NUMBER_ALL_POSITIONS
|
||||
# Strip trailing zeroes from stripped_version_number
|
||||
for i in 1 2 3 4 5 6 ; do stripped_version_number=${stripped_version_number%.0} ; done
|
||||
VERSION_NUMBER=$stripped_version_number
|
||||
|
||||
# A build number of "0" is interpreted as "no build number".
|
||||
if test "x$VERSION_BUILD" = x0; then
|
||||
VERSION_BUILD=
|
||||
fi
|
||||
|
||||
# Compute the complete version string, with additional build information
|
||||
version_with_pre=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
|
||||
if test "x$VERSION_BUILD" != x || \
|
||||
( test "x$VERSION_OPT" != x && test "x$VERSION_PRE" = x ); then
|
||||
# As per JEP 223, if build is set, or if opt is set but not pre,
|
||||
# we need a + separator
|
||||
version_with_build=$version_with_pre+$VERSION_BUILD
|
||||
else
|
||||
version_with_build=$version_with_pre
|
||||
fi
|
||||
VERSION_STRING=$version_with_build${VERSION_OPT:+-$VERSION_OPT}
|
||||
|
||||
# The short version string, just VERSION_NUMBER and PRE, if present.
|
||||
VERSION_SHORT=$VERSION_NUMBER${VERSION_PRE:+-$VERSION_PRE}
|
||||
|
||||
# The version date
|
||||
UTIL_ARG_WITH(NAME: version-date, TYPE: string,
|
||||
DEFAULT: $DEFAULT_VERSION_DATE,
|
||||
DESC: [Set version date],
|
||||
DEFAULT_DESC: [current source value],
|
||||
CHECK_VALUE: [
|
||||
if test "x$RESULT" = x; then
|
||||
FAILURE="--with-version-date cannot be empty"
|
||||
elif [ ! [[ $RESULT =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] ]; then
|
||||
FAILURE="\"$RESULT\" is not a valid version date"
|
||||
fi
|
||||
])
|
||||
|
||||
# The vendor version string, if any
|
||||
# DEFAULT is set to an empty string in the case of --with-vendor-version-string without
|
||||
# any value, which would set VENDOR_VERSION_STRING_ENABLED to true and ultimately also
|
||||
# cause VENDOR_VERSION_STRING to fall back to the value in DEFAULT
|
||||
UTIL_ARG_WITH(NAME: vendor-version-string, TYPE: string,
|
||||
DEFAULT: [],
|
||||
OPTIONAL: true,
|
||||
DESC: [Set vendor version string],
|
||||
DEFAULT_DESC: [not specified])
|
||||
|
||||
if test "x$VENDOR_VERSION_STRING_ENABLED" = xtrue; then
|
||||
if [ ! [[ $VENDOR_VERSION_STRING =~ ^[[:graph:]]*$ ]] ]; then
|
||||
AC_MSG_ERROR([--with--vendor-version-string contains non-graphical characters: $VENDOR_VERSION_STRING])
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set the MACOSX Bundle Name base
|
||||
UTIL_ARG_WITH(NAME: macosx-bundle-name-base, TYPE: string,
|
||||
DEFAULT: $MACOSX_BUNDLE_NAME_BASE,
|
||||
DESC: [Set the MacOSX Bundle Name base. This is the base name for calculating MacOSX Bundle Names.],
|
||||
DEFAULT_DESC: [from branding.conf],
|
||||
CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
|
||||
AC_SUBST(MACOSX_BUNDLE_NAME_BASE)
|
||||
|
||||
# If using the default value, append the VERSION_PRE if there is one
|
||||
# to make it possible to tell official builds apart from developer builds
|
||||
if test "x$VERSION_PRE" != x; then
|
||||
MACOSX_BUNDLE_ID_BASE="$MACOSX_BUNDLE_ID_BASE-$VERSION_PRE"
|
||||
fi
|
||||
|
||||
# Set the MACOSX Bundle ID base
|
||||
UTIL_ARG_WITH(NAME: macosx-bundle-id-base, TYPE: string,
|
||||
DEFAULT: $MACOSX_BUNDLE_ID_BASE,
|
||||
DESC: [Set the MacOSX Bundle ID base. This is the base ID for calculating MacOSX Bundle IDs.],
|
||||
DEFAULT_DESC: [based on branding.conf and VERSION_PRE],
|
||||
CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE])
|
||||
AC_SUBST(MACOSX_BUNDLE_ID_BASE)
|
||||
|
||||
if test "x$VERSION_BUILD" != x; then
|
||||
MACOSX_BUNDLE_BUILD_VERSION="$VERSION_BUILD"
|
||||
else
|
||||
MACOSX_BUNDLE_BUILD_VERSION=0
|
||||
fi
|
||||
|
||||
# If VERSION_OPT consists of only numbers and periods, add it.
|
||||
if [ [[ $VERSION_OPT =~ ^[0-9\.]+$ ]] ]; then
|
||||
MACOSX_BUNDLE_BUILD_VERSION="$MACOSX_BUNDLE_BUILD_VERSION.$VERSION_OPT"
|
||||
fi
|
||||
|
||||
# Set the MACOSX CFBundleVersion field
|
||||
UTIL_ARG_WITH(NAME: macosx-bundle-build-version, TYPE: string,
|
||||
DEFAULT: $MACOSX_BUNDLE_BUILD_VERSION,
|
||||
DESC: [Set the MacOSX Bundle CFBundleVersion field. This key is a machine-readable
|
||||
string composed of one to three period-separated integers and should represent the
|
||||
build version.],
|
||||
DEFAULT_DESC: [the build number],
|
||||
CHECK_VALUE: [
|
||||
if test "x$RESULT" = x; then
|
||||
FAILURE="--with-macosx-bundle-build-version must have a value"
|
||||
elif [ ! [[ $RESULT =~ ^[0-9\.]*$ ]] ]; then
|
||||
FAILURE="--with-macosx-bundle-build-version contains non numbers and periods: $RESULT"
|
||||
fi
|
||||
])
|
||||
AC_SUBST(MACOSX_BUNDLE_BUILD_VERSION)
|
||||
|
||||
# We could define --with flags for these, if really needed
|
||||
VERSION_CLASSFILE_MAJOR="$DEFAULT_VERSION_CLASSFILE_MAJOR"
|
||||
VERSION_CLASSFILE_MINOR="$DEFAULT_VERSION_CLASSFILE_MINOR"
|
||||
VERSION_DOCS_API_SINCE="$DEFAULT_VERSION_DOCS_API_SINCE"
|
||||
JDK_SOURCE_TARGET_VERSION="$DEFAULT_JDK_SOURCE_TARGET_VERSION"
|
||||
|
||||
AC_MSG_CHECKING([for version string])
|
||||
AC_MSG_RESULT([$VERSION_STRING])
|
||||
|
||||
AC_SUBST(VERSION_FEATURE)
|
||||
AC_SUBST(VERSION_INTERIM)
|
||||
AC_SUBST(VERSION_UPDATE)
|
||||
AC_SUBST(VERSION_PATCH)
|
||||
AC_SUBST(VERSION_EXTRA1)
|
||||
AC_SUBST(VERSION_EXTRA2)
|
||||
AC_SUBST(VERSION_EXTRA3)
|
||||
AC_SUBST(VERSION_PRE)
|
||||
AC_SUBST(VERSION_BUILD)
|
||||
AC_SUBST(VERSION_OPT)
|
||||
AC_SUBST(VERSION_NUMBER)
|
||||
AC_SUBST(VERSION_NUMBER_FOUR_POSITIONS)
|
||||
AC_SUBST(VERSION_STRING)
|
||||
AC_SUBST(VERSION_SHORT)
|
||||
AC_SUBST(VERSION_IS_GA)
|
||||
AC_SUBST(VERSION_DATE)
|
||||
AC_SUBST(VENDOR_VERSION_STRING)
|
||||
AC_SUBST(VERSION_CLASSFILE_MAJOR)
|
||||
AC_SUBST(VERSION_CLASSFILE_MINOR)
|
||||
AC_SUBST(VERSION_DOCS_API_SINCE)
|
||||
AC_SUBST(JDK_SOURCE_TARGET_VERSION)
|
||||
])
|
||||
605
make/autoconf/jvm-features.m4
Normal file
605
make/autoconf/jvm-features.m4
Normal file
|
|
@ -0,0 +1,605 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Terminology used in this file:
|
||||
#
|
||||
# Valid features == All possible features that the JVM knows about.
|
||||
# Deprecated features == Previously known features (not considered valid).
|
||||
# Available features == Features that are possible to use in this configuration.
|
||||
# Default features == Features that are on by default in this configuration.
|
||||
# Enabled features == Features requested by the user to be present.
|
||||
# Disabled features == Features excluded from being used by the user.
|
||||
# Active features == The exact set of features to be used for a JVM variant.
|
||||
#
|
||||
# All valid features are considered available, unless listed as unavailable.
|
||||
# All available features will be turned on as default, unless listed in a filter.
|
||||
################################################################################
|
||||
|
||||
# We need these as m4 defines to be able to loop over them using m4 later on.
|
||||
|
||||
# All valid JVM features, regardless of platform
|
||||
m4_define(jvm_features_valid, m4_normalize( \
|
||||
ifdef([custom_jvm_features_valid], custom_jvm_features_valid) \
|
||||
\
|
||||
cds compiler1 compiler2 dtrace epsilongc g1gc jfr jni-check \
|
||||
jvmci jvmti link-time-opt management minimal opt-size parallelgc \
|
||||
serialgc services shenandoahgc vm-structs zero zgc \
|
||||
))
|
||||
|
||||
# Deprecated JVM features (these are ignored, but with a warning)
|
||||
# This list is empty at the moment.
|
||||
m4_define(jvm_features_deprecated, m4_normalize( ))
|
||||
|
||||
# Feature descriptions
|
||||
m4_define(jvm_feature_desc_cds, [enable class data sharing (CDS)])
|
||||
m4_define(jvm_feature_desc_compiler1, [enable hotspot compiler C1])
|
||||
m4_define(jvm_feature_desc_compiler2, [enable hotspot compiler C2])
|
||||
m4_define(jvm_feature_desc_dtrace, [enable dtrace support])
|
||||
m4_define(jvm_feature_desc_epsilongc, [include the epsilon (no-op) garbage collector])
|
||||
m4_define(jvm_feature_desc_g1gc, [include the G1 garbage collector])
|
||||
m4_define(jvm_feature_desc_jfr, [enable JDK Flight Recorder (JFR)])
|
||||
m4_define(jvm_feature_desc_jni_check, [enable -Xcheck:jni support])
|
||||
m4_define(jvm_feature_desc_jvmci, [enable JVM Compiler Interface (JVMCI)])
|
||||
m4_define(jvm_feature_desc_jvmti, [enable Java Virtual Machine Tool Interface (JVM TI)])
|
||||
m4_define(jvm_feature_desc_link_time_opt, [enable link time optimization])
|
||||
m4_define(jvm_feature_desc_management, [enable java.lang.management API support])
|
||||
m4_define(jvm_feature_desc_minimal, [support building variant 'minimal'])
|
||||
m4_define(jvm_feature_desc_opt_size, [optimize the JVM library for size])
|
||||
m4_define(jvm_feature_desc_parallelgc, [include the parallel garbage collector])
|
||||
m4_define(jvm_feature_desc_serialgc, [include the serial garbage collector])
|
||||
m4_define(jvm_feature_desc_services, [enable diagnostic services and client attaching])
|
||||
m4_define(jvm_feature_desc_shenandoahgc, [include the Shenandoah garbage collector])
|
||||
m4_define(jvm_feature_desc_static_build, [build static library instead of dynamic])
|
||||
m4_define(jvm_feature_desc_vm_structs, [export JVM structures to the Serviceablility Agent])
|
||||
m4_define(jvm_feature_desc_zero, [support building variant 'zero'])
|
||||
m4_define(jvm_feature_desc_zgc, [include the Z garbage collector])
|
||||
|
||||
################################################################################
|
||||
# Parse command line options for JVM feature selection. After this function
|
||||
# has run $JVM_FEATURES_ENABLED, $JVM_FEATURES_DISABLED and $JVM_FEATURES_VALID
|
||||
# can be used.
|
||||
#
|
||||
AC_DEFUN_ONCE([JVM_FEATURES_PARSE_OPTIONS],
|
||||
[
|
||||
# Setup shell variables from the m4 lists
|
||||
UTIL_SORT_LIST(JVM_FEATURES_VALID, "jvm_features_valid")
|
||||
UTIL_SORT_LIST(JVM_FEATURES_DEPRECATED, "jvm_features_deprecated")
|
||||
|
||||
# For historical reasons, some jvm features have their own, shorter names.
|
||||
# Keep those as aliases for the --enable-jvm-feature-* style arguments.
|
||||
UTIL_ALIASED_ARG_ENABLE(cds, --enable-jvm-feature-cds)
|
||||
UTIL_ALIASED_ARG_ENABLE(dtrace, --enable-jvm-feature-dtrace)
|
||||
|
||||
# First check for features using the
|
||||
# --with-jvm-features="<[-]feature>[,<[-]feature> ...]" syntax.
|
||||
AC_ARG_WITH([jvm-features], [AS_HELP_STRING([--with-jvm-features],
|
||||
[JVM features to enable (foo) or disable (-foo), separated by comma. Use
|
||||
'--help' to show possible values @<:@none@:>@])])
|
||||
if test "x$with_jvm_features" != x; then
|
||||
# Replace "," with " ".
|
||||
user_jvm_feature_list=${with_jvm_features//,/ }
|
||||
JVM_FEATURES_ENABLED=`$ECHO $user_jvm_feature_list | \
|
||||
$AWK '{ for (i=1; i<=NF; i++) if (!match($i, /^-.*/)) printf("%s ", $i) }'`
|
||||
JVM_FEATURES_DISABLED=`$ECHO $user_jvm_feature_list | \
|
||||
$AWK '{ for (i=1; i<=NF; i++) if (match($i, /^-.*/)) printf("%s ", substr($i, 2))}'`
|
||||
|
||||
# Verify that the user has provided only valid (or deprecated) features
|
||||
UTIL_GET_NON_MATCHING_VALUES(invalid_features, $JVM_FEATURES_ENABLED \
|
||||
$JVM_FEATURES_DISABLED, $JVM_FEATURES_VALID $JVM_FEATURES_DEPRECATED)
|
||||
if test "x$invalid_features" != x; then
|
||||
AC_MSG_NOTICE([Unknown JVM features specified: '$invalid_features'])
|
||||
AC_MSG_NOTICE([The available JVM features are: '$JVM_FEATURES_VALID'])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
# Check if the user has provided deprecated features
|
||||
UTIL_GET_MATCHING_VALUES(deprecated_features, $JVM_FEATURES_ENABLED \
|
||||
$JVM_FEATURES_DISABLED, $JVM_FEATURES_DEPRECATED)
|
||||
if test "x$deprecated_features" != x; then
|
||||
AC_MSG_WARN([Deprecated JVM features specified (will be ignored): '$deprecated_features'])
|
||||
# Filter out deprecated features
|
||||
UTIL_GET_NON_MATCHING_VALUES(JVM_FEATURES_ENABLED, \
|
||||
$JVM_FEATURES_ENABLED, $deprecated_features)
|
||||
UTIL_GET_NON_MATCHING_VALUES(JVM_FEATURES_DISABLED, \
|
||||
$JVM_FEATURES_DISABLED, $deprecated_features)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Then check for features using the "--enable-jvm-feature-<feature>" syntax.
|
||||
# Using m4, loop over all features with the variable FEATURE.
|
||||
m4_foreach(FEATURE, m4_split(jvm_features_valid), [
|
||||
# Create an m4 variable containing a shell variable name (like
|
||||
# "enable_jvm_feature_static_build"), and the description.
|
||||
m4_define(FEATURE_SHELL, [enable_jvm_feature_]m4_translit(FEATURE, -, _))
|
||||
m4_define(FEATURE_DESCRIPTION, [jvm_feature_desc_]m4_translit(FEATURE, -, _))
|
||||
|
||||
AC_ARG_ENABLE(jvm-feature-FEATURE, AS_HELP_STRING(
|
||||
[--enable-jvm-feature-FEATURE], [enable jvm feature 'FEATURE' (FEATURE_DESCRIPTION)]))
|
||||
|
||||
if test "x$FEATURE_SHELL" = xyes; then
|
||||
JVM_FEATURES_ENABLED="$JVM_FEATURES_ENABLED FEATURE"
|
||||
elif test "x$FEATURE_SHELL" = xno; then
|
||||
JVM_FEATURES_DISABLED="$JVM_FEATURES_DISABLED FEATURE"
|
||||
elif test "x$FEATURE_SHELL" != x; then
|
||||
AC_MSG_ERROR([Invalid value for --enable-jvm-feature-FEATURE: '$FEATURE_SHELL'])
|
||||
fi
|
||||
|
||||
m4_undefine([FEATURE_SHELL])
|
||||
m4_undefine([FEATURE_DESCRIPTION])
|
||||
])
|
||||
|
||||
# Likewise, check for deprecated arguments.
|
||||
m4_foreach(FEATURE, m4_split(jvm_features_deprecated), [
|
||||
AC_ARG_ENABLE(jvm-feature-FEATURE, AS_HELP_STRING(
|
||||
[--enable-jvm-feature-FEATURE],
|
||||
[Deprecated. Option is kept for backwards compatibility and is ignored]))
|
||||
|
||||
m4_define(FEATURE_SHELL, [enable_jvm_feature_]m4_translit(FEATURE, -, _))
|
||||
|
||||
if test "x$FEATURE_SHELL" != x; then
|
||||
AC_MSG_WARN([Deprecated JVM feature, will be ignored: --enable-jvm-feature-FEATURE])
|
||||
fi
|
||||
|
||||
m4_undefine([FEATURE_SHELL])
|
||||
])
|
||||
|
||||
# Check if the user has both enabled and disabled a feature
|
||||
UTIL_GET_MATCHING_VALUES(enabled_and_disabled, $JVM_FEATURES_ENABLED, \
|
||||
$JVM_FEATURES_DISABLED)
|
||||
if test "x$enabled_and_disabled" != x; then
|
||||
AC_MSG_NOTICE([These feature are both enabled and disabled: '$enabled_and_disabled'])
|
||||
AC_MSG_NOTICE([This can happen if you mix --with-jvm-features and --enable-jvm-feature-*])
|
||||
AC_MSG_NOTICE([The recommendation is to only use --enable-jvm-feature-*])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
# Clean up lists and announce results to user
|
||||
UTIL_SORT_LIST(JVM_FEATURES_ENABLED, $JVM_FEATURES_ENABLED)
|
||||
AC_MSG_CHECKING([for JVM features enabled by the user])
|
||||
if test "x$JVM_FEATURES_ENABLED" != x; then
|
||||
AC_MSG_RESULT(['$JVM_FEATURES_ENABLED'])
|
||||
else
|
||||
AC_MSG_RESULT([none])
|
||||
fi
|
||||
|
||||
UTIL_SORT_LIST(JVM_FEATURES_DISABLED, $JVM_FEATURES_DISABLED)
|
||||
AC_MSG_CHECKING([for JVM features disabled by the user])
|
||||
if test "x$JVM_FEATURES_DISABLED" != x; then
|
||||
AC_MSG_RESULT(['$JVM_FEATURES_DISABLED'])
|
||||
else
|
||||
AC_MSG_RESULT([none])
|
||||
fi
|
||||
|
||||
# Makefiles use VALID_JVM_FEATURES in check-jvm-feature to verify correctness.
|
||||
VALID_JVM_FEATURES="$JVM_FEATURES_VALID"
|
||||
AC_SUBST(VALID_JVM_FEATURES)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Helper function for the JVM_FEATURES_CHECK_* suite.
|
||||
# The code in the code block should assign 'false' to the variable AVAILABLE
|
||||
# if the feature is not available, and this function will handle everything
|
||||
# else that is needed.
|
||||
#
|
||||
# arg 1: The name of the feature to test
|
||||
# arg 2: The code block to execute
|
||||
#
|
||||
AC_DEFUN([JVM_FEATURES_CHECK_AVAILABILITY],
|
||||
[
|
||||
# Assume that feature is available
|
||||
AVAILABLE=true
|
||||
|
||||
# Execute feature test block
|
||||
$2
|
||||
|
||||
AC_MSG_CHECKING([if JVM feature '$1' is available])
|
||||
if test "x$AVAILABLE" = "xtrue"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
JVM_FEATURES_PLATFORM_UNAVAILABLE="$JVM_FEATURES_PLATFORM_UNAVAILABLE $1"
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if the feature 'cds' is available on this platform.
|
||||
#
|
||||
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_CDS],
|
||||
[
|
||||
JVM_FEATURES_CHECK_AVAILABILITY(cds, [
|
||||
AC_MSG_CHECKING([if platform is supported by CDS])
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
|
||||
AVAILABLE=false
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if the feature 'dtrace' is available on this platform.
|
||||
#
|
||||
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_DTRACE],
|
||||
[
|
||||
JVM_FEATURES_CHECK_AVAILABILITY(dtrace, [
|
||||
AC_MSG_CHECKING([for dtrace tool and platform support])
|
||||
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xppc"; then
|
||||
AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU_ARCH])
|
||||
AVAILABLE=false
|
||||
elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xs390"; then
|
||||
AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU_ARCH])
|
||||
AVAILABLE=false
|
||||
elif test "x$DTRACE" != "x" && test -x "$DTRACE"; then
|
||||
AC_MSG_RESULT([$DTRACE])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AVAILABLE=false
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS([sys/sdt.h], [dtrace_headers_ok=true])
|
||||
if test "x$dtrace_headers_ok" != "xtrue"; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([dtrace])
|
||||
AC_MSG_NOTICE([Cannot enable dtrace with missing dependencies. See above.])
|
||||
AVAILABLE=false
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if the feature 'jvmci' is available on this platform.
|
||||
#
|
||||
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_JVMCI],
|
||||
[
|
||||
JVM_FEATURES_CHECK_AVAILABILITY(jvmci, [
|
||||
AC_MSG_CHECKING([if platform is supported by JVMCI])
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
elif test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
elif test "x$OPENJDK_TARGET_CPU" = "xriscv64"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU])
|
||||
AVAILABLE=false
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if the feature 'shenandoahgc' is available on this platform.
|
||||
#
|
||||
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_SHENANDOAHGC],
|
||||
[
|
||||
JVM_FEATURES_CHECK_AVAILABILITY(shenandoahgc, [
|
||||
AC_MSG_CHECKING([if platform is supported by Shenandoah])
|
||||
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86" || \
|
||||
test "x$OPENJDK_TARGET_CPU" = "xaarch64" || \
|
||||
test "x$OPENJDK_TARGET_CPU" = "xppc64le" || \
|
||||
test "x$OPENJDK_TARGET_CPU" = "xriscv64"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU])
|
||||
AVAILABLE=false
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if the feature 'zgc' is available on this platform.
|
||||
#
|
||||
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_ZGC],
|
||||
[
|
||||
JVM_FEATURES_CHECK_AVAILABILITY(zgc, [
|
||||
AC_MSG_CHECKING([if platform is supported by ZGC])
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
|
||||
if test "x$OPENJDK_TARGET_OS" = "xlinux" || \
|
||||
test "x$OPENJDK_TARGET_OS" = "xwindows" || \
|
||||
test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
|
||||
AVAILABLE=false
|
||||
fi
|
||||
elif test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
|
||||
if test "x$OPENJDK_TARGET_OS" = "xlinux" || \
|
||||
test "x$OPENJDK_TARGET_OS" = "xwindows" || \
|
||||
test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
|
||||
AVAILABLE=false
|
||||
fi
|
||||
elif test "x$OPENJDK_TARGET_CPU" = "xppc64le" || \
|
||||
test "x$OPENJDK_TARGET_CPU" = "xriscv64"; then
|
||||
if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
|
||||
AVAILABLE=false
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
|
||||
AVAILABLE=false
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
|
||||
AC_MSG_CHECKING([if Windows APIs required for ZGC is present])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <windows.h>]],
|
||||
[[struct MEM_EXTENDED_PARAMETER x;]])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no, missing required APIs])
|
||||
AVAILABLE=false
|
||||
]
|
||||
)
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup JVM_FEATURES_PLATFORM_UNAVAILABLE and JVM_FEATURES_PLATFORM_FILTER
|
||||
# to contain those features that are unavailable, or should be off by default,
|
||||
# for this platform, regardless of JVM variant.
|
||||
#
|
||||
AC_DEFUN_ONCE([JVM_FEATURES_PREPARE_PLATFORM],
|
||||
[
|
||||
# The checks below should add unavailable features to
|
||||
# JVM_FEATURES_PLATFORM_UNAVAILABLE.
|
||||
|
||||
JVM_FEATURES_CHECK_CDS
|
||||
JVM_FEATURES_CHECK_DTRACE
|
||||
JVM_FEATURES_CHECK_JVMCI
|
||||
JVM_FEATURES_CHECK_SHENANDOAHGC
|
||||
JVM_FEATURES_CHECK_ZGC
|
||||
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup JVM_FEATURES_VARIANT_UNAVAILABLE and JVM_FEATURES_VARIANT_FILTER
|
||||
# to contain those features that are unavailable, or should be off by default,
|
||||
# for this particular JVM variant.
|
||||
#
|
||||
# arg 1: JVM variant
|
||||
#
|
||||
AC_DEFUN([JVM_FEATURES_PREPARE_VARIANT],
|
||||
[
|
||||
variant=$1
|
||||
|
||||
# Check which features are unavailable for this JVM variant.
|
||||
# This means that is not possible to build these features for this variant.
|
||||
if test "x$variant" = "xminimal"; then
|
||||
JVM_FEATURES_VARIANT_UNAVAILABLE="cds zero"
|
||||
elif test "x$variant" = "xcore"; then
|
||||
JVM_FEATURES_VARIANT_UNAVAILABLE="cds minimal zero"
|
||||
elif test "x$variant" = "xzero"; then
|
||||
JVM_FEATURES_VARIANT_UNAVAILABLE="compiler1 compiler2 \
|
||||
jvmci minimal zgc"
|
||||
else
|
||||
JVM_FEATURES_VARIANT_UNAVAILABLE="minimal zero"
|
||||
fi
|
||||
|
||||
# Check which features should be off by default for this JVM variant.
|
||||
if test "x$variant" = "xclient"; then
|
||||
JVM_FEATURES_VARIANT_FILTER="compiler2 jvmci link-time-opt opt-size"
|
||||
elif test "x$variant" = "xminimal"; then
|
||||
JVM_FEATURES_VARIANT_FILTER="cds compiler2 dtrace epsilongc g1gc \
|
||||
jfr jni-check jvmci jvmti management parallelgc services \
|
||||
shenandoahgc vm-structs zgc"
|
||||
if test "x$OPENJDK_TARGET_CPU" = xarm ; then
|
||||
JVM_FEATURES_VARIANT_FILTER="$JVM_FEATURES_VARIANT_FILTER opt-size"
|
||||
else
|
||||
# Only arm-32 should have link-time-opt enabled as default.
|
||||
JVM_FEATURES_VARIANT_FILTER="$JVM_FEATURES_VARIANT_FILTER \
|
||||
link-time-opt"
|
||||
fi
|
||||
elif test "x$variant" = "xcore"; then
|
||||
JVM_FEATURES_VARIANT_FILTER="compiler1 compiler2 jvmci \
|
||||
link-time-opt opt-size"
|
||||
elif test "x$variant" = "xzero"; then
|
||||
JVM_FEATURES_VARIANT_FILTER="jfr link-time-opt opt-size"
|
||||
else
|
||||
JVM_FEATURES_VARIANT_FILTER="link-time-opt opt-size"
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Calculate the actual set of active JVM features for this JVM variant. Store
|
||||
# the result in JVM_FEATURES_ACTIVE.
|
||||
#
|
||||
# arg 1: JVM variant
|
||||
#
|
||||
AC_DEFUN([JVM_FEATURES_CALCULATE_ACTIVE],
|
||||
[
|
||||
variant=$1
|
||||
|
||||
# The default is set to all valid features except those unavailable or listed
|
||||
# in a filter.
|
||||
if test "x$variant" != xcustom; then
|
||||
UTIL_GET_NON_MATCHING_VALUES(default_for_variant, $JVM_FEATURES_VALID, \
|
||||
$JVM_FEATURES_PLATFORM_UNAVAILABLE $JVM_FEATURES_VARIANT_UNAVAILABLE \
|
||||
$JVM_FEATURES_PLATFORM_FILTER $JVM_FEATURES_VARIANT_FILTER)
|
||||
else
|
||||
# Except for the 'custom' variant, where the default is to start with an
|
||||
# empty set.
|
||||
default_for_variant=""
|
||||
fi
|
||||
|
||||
# Verify that explicitly enabled features are available
|
||||
UTIL_GET_MATCHING_VALUES(enabled_but_unavailable, $JVM_FEATURES_ENABLED, \
|
||||
$JVM_FEATURES_PLATFORM_UNAVAILABLE $JVM_FEATURES_VARIANT_UNAVAILABLE)
|
||||
if test "x$enabled_but_unavailable" != x; then
|
||||
AC_MSG_NOTICE([ERROR: Unavailable JVM features explicitly enabled for '$variant': '$enabled_but_unavailable'])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
# Notify the user if their command line options has no real effect
|
||||
UTIL_GET_MATCHING_VALUES(enabled_but_default, $JVM_FEATURES_ENABLED, \
|
||||
$default_for_variant)
|
||||
if test "x$enabled_but_default" != x; then
|
||||
AC_MSG_NOTICE([Default JVM features explicitly enabled for '$variant': '$enabled_but_default'])
|
||||
fi
|
||||
UTIL_GET_MATCHING_VALUES(disabled_but_unavailable, $JVM_FEATURES_DISABLED, \
|
||||
$JVM_FEATURES_PLATFORM_UNAVAILABLE $JVM_FEATURES_VARIANT_UNAVAILABLE)
|
||||
if test "x$disabled_but_unavailable" != x; then
|
||||
AC_MSG_NOTICE([Unavailable JVM features explicitly disabled for '$variant': '$disabled_but_unavailable'])
|
||||
fi
|
||||
|
||||
# JVM_FEATURES_ACTIVE is the set of all default features and all explicitly
|
||||
# enabled features, with the explicitly disabled features filtered out.
|
||||
UTIL_GET_NON_MATCHING_VALUES(JVM_FEATURES_ACTIVE, $default_for_variant \
|
||||
$JVM_FEATURES_ENABLED, $JVM_FEATURES_DISABLED)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Filter the unsupported feature combinations.
|
||||
# This is called after JVM_FEATURES_ACTIVE are fully populated.
|
||||
#
|
||||
AC_DEFUN([JVM_FEATURES_FILTER_UNSUPPORTED],
|
||||
[
|
||||
# G1 late barrier expansion in C2 is not implemented for some platforms.
|
||||
# Choose not to support G1 in this configuration.
|
||||
if JVM_FEATURES_IS_ACTIVE(compiler2); then
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
|
||||
AC_MSG_NOTICE([G1 cannot be used with C2 on this platform, disabling G1])
|
||||
UTIL_GET_NON_MATCHING_VALUES(JVM_FEATURES_ACTIVE, $JVM_FEATURES_ACTIVE, "g1gc")
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Helper function for JVM_FEATURES_VERIFY. Check if the specified JVM
|
||||
# feature is active. To be used in shell if constructs, like this:
|
||||
# 'if JVM_FEATURES_IS_ACTIVE(jvmti); then'
|
||||
#
|
||||
# Definition kept in one line to allow inlining in if statements.
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
AC_DEFUN([JVM_FEATURES_IS_ACTIVE],
|
||||
[ [ [[ " $JVM_FEATURES_ACTIVE " =~ ' '$1' ' ]] ] ])
|
||||
|
||||
################################################################################
|
||||
# Verify that the resulting set of features is consistent and legal.
|
||||
#
|
||||
# arg 1: JVM variant
|
||||
#
|
||||
AC_DEFUN([JVM_FEATURES_VERIFY],
|
||||
[
|
||||
variant=$1
|
||||
|
||||
if JVM_FEATURES_IS_ACTIVE(jfr) && ! JVM_FEATURES_IS_ACTIVE(services); then
|
||||
AC_MSG_ERROR([Specified JVM feature 'jfr' requires feature 'services' for variant '$variant'])
|
||||
fi
|
||||
|
||||
if JVM_FEATURES_IS_ACTIVE(jvmci) && ! (JVM_FEATURES_IS_ACTIVE(compiler1) || \
|
||||
JVM_FEATURES_IS_ACTIVE(compiler2)); then
|
||||
AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1' for variant '$variant'])
|
||||
fi
|
||||
|
||||
if JVM_FEATURES_IS_ACTIVE(jvmti) && ! JVM_FEATURES_IS_ACTIVE(services); then
|
||||
AC_MSG_ERROR([Specified JVM feature 'jvmti' requires feature 'services' for variant '$variant'])
|
||||
fi
|
||||
|
||||
# For backwards compatibility, disable a feature "globally" if one variant
|
||||
# is missing the feature.
|
||||
if ! JVM_FEATURES_IS_ACTIVE(cds); then
|
||||
ENABLE_CDS="false"
|
||||
fi
|
||||
if ! JVM_FEATURES_IS_ACTIVE(jvmci); then
|
||||
INCLUDE_JVMCI="false"
|
||||
fi
|
||||
if JVM_FEATURES_IS_ACTIVE(compiler2); then
|
||||
INCLUDE_COMPILER2="true"
|
||||
fi
|
||||
|
||||
# Verify that we have at least one gc selected (i.e., feature named "*gc").
|
||||
if ! JVM_FEATURES_IS_ACTIVE(.*gc); then
|
||||
AC_MSG_NOTICE([At least one gc needed for variant '$variant'.])
|
||||
AC_MSG_NOTICE([Specified features: '$JVM_FEATURES_ACTIVE'])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Set up all JVM features for each enabled JVM variant. Requires that
|
||||
# JVM_FEATURES_PARSE_OPTIONS has been called.
|
||||
#
|
||||
AC_DEFUN_ONCE([JVM_FEATURES_SETUP],
|
||||
[
|
||||
# Set up variant-independent factors
|
||||
JVM_FEATURES_PREPARE_PLATFORM
|
||||
|
||||
# For backwards compatibility, tentatively enable these features "globally",
|
||||
# and disable them in JVM_FEATURES_VERIFY if a variant is found that are
|
||||
# missing any of them.
|
||||
ENABLE_CDS="true"
|
||||
INCLUDE_JVMCI="true"
|
||||
INCLUDE_COMPILER2="false"
|
||||
|
||||
for variant in $JVM_VARIANTS; do
|
||||
# Figure out if any features are unavailable, or should be filtered out
|
||||
# by default, for this variant.
|
||||
# Store the result in JVM_FEATURES_VARIANT_UNAVAILABLE and
|
||||
# JVM_FEATURES_VARIANT_FILTER.
|
||||
JVM_FEATURES_PREPARE_VARIANT($variant)
|
||||
|
||||
# Calculate the resulting set of enabled features for this variant.
|
||||
# The result is stored in JVM_FEATURES_ACTIVE.
|
||||
JVM_FEATURES_CALCULATE_ACTIVE($variant)
|
||||
|
||||
# Filter unsupported feature combinations from JVM_FEATURES_ACTIVE.
|
||||
JVM_FEATURES_FILTER_UNSUPPORTED
|
||||
|
||||
# Verify consistency for JVM_FEATURES_ACTIVE.
|
||||
JVM_FEATURES_VERIFY($variant)
|
||||
|
||||
# Keep feature list sorted and free of duplicates
|
||||
UTIL_SORT_LIST(JVM_FEATURES_ACTIVE, $JVM_FEATURES_ACTIVE)
|
||||
AC_MSG_CHECKING([JVM features to use for variant '$variant'])
|
||||
AC_MSG_RESULT(['$JVM_FEATURES_ACTIVE'])
|
||||
|
||||
# Save this as e.g. JVM_FEATURES_server, using indirect variable
|
||||
# referencing.
|
||||
features_var_name=JVM_FEATURES_$variant
|
||||
eval $features_var_name=\"$JVM_FEATURES_ACTIVE\"
|
||||
done
|
||||
|
||||
# Unfortunately AC_SUBST does not work with non-literally named variables,
|
||||
# so list all variants here.
|
||||
AC_SUBST(JVM_FEATURES_server)
|
||||
AC_SUBST(JVM_FEATURES_client)
|
||||
AC_SUBST(JVM_FEATURES_minimal)
|
||||
AC_SUBST(JVM_FEATURES_core)
|
||||
AC_SUBST(JVM_FEATURES_zero)
|
||||
AC_SUBST(JVM_FEATURES_custom)
|
||||
|
||||
AC_SUBST(INCLUDE_JVMCI)
|
||||
AC_SUBST(INCLUDE_COMPILER2)
|
||||
|
||||
])
|
||||
111
make/autoconf/lib-alsa.m4
Normal file
111
make/autoconf/lib-alsa.m4
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2024, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Setup alsa (Advanced Linux Sound Architecture)
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_ALSA],
|
||||
[
|
||||
AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],
|
||||
[specify prefix directory for the alsa package
|
||||
(expecting the libraries under PATH/lib and the headers under PATH/include)])])
|
||||
AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include],
|
||||
[specify directory for the alsa include files])])
|
||||
AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib],
|
||||
[specify directory for the alsa library])])
|
||||
|
||||
if test "x$NEEDS_LIB_ALSA" = xfalse; then
|
||||
if (test "x${with_alsa}" != x && test "x${with_alsa}" != xno) || \
|
||||
(test "x${with_alsa_include}" != x && test "x${with_alsa_include}" != xno) || \
|
||||
(test "x${with_alsa_lib}" != x && test "x${with_alsa_lib}" != xno); then
|
||||
AC_MSG_WARN([[alsa not used, so --with-alsa[-*] is ignored]])
|
||||
fi
|
||||
ALSA_CFLAGS=
|
||||
ALSA_LIBS=
|
||||
else
|
||||
ALSA_FOUND=no
|
||||
|
||||
if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then
|
||||
AC_MSG_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
|
||||
fi
|
||||
|
||||
if test "x${with_alsa}" != x; then
|
||||
ALSA_LIBS="-L${with_alsa}/lib -lasound"
|
||||
ALSA_CFLAGS="-I${with_alsa}/include"
|
||||
ALSA_FOUND=yes
|
||||
fi
|
||||
if test "x${with_alsa_include}" != x; then
|
||||
ALSA_CFLAGS="-I${with_alsa_include}"
|
||||
ALSA_FOUND=yes
|
||||
fi
|
||||
if test "x${with_alsa_lib}" != x; then
|
||||
ALSA_LIBS="-L${with_alsa_lib} -lasound"
|
||||
ALSA_FOUND=yes
|
||||
fi
|
||||
# Do not try pkg-config if we have a sysroot set.
|
||||
if test "x$SYSROOT" = x; then
|
||||
if test "x$ALSA_FOUND" = xno; then
|
||||
PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
|
||||
fi
|
||||
fi
|
||||
if test "x$ALSA_FOUND" = xno; then
|
||||
# If we have sysroot set, and no explicit library location is set,
|
||||
# look at known locations in sysroot.
|
||||
if test "x$SYSROOT" != "x" && test "x${with_alsa_lib}" == x; then
|
||||
if test -f "$SYSROOT/usr/lib64/libasound.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
ALSA_LIBS="-L$SYSROOT/usr/lib64 -lasound"
|
||||
ALSA_FOUND=yes
|
||||
elif test -f "$SYSROOT/usr/lib/libasound.so"; then
|
||||
ALSA_LIBS="-L$SYSROOT/usr/lib -lasound"
|
||||
ALSA_FOUND=yes
|
||||
elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libasound.so"; then
|
||||
ALSA_LIBS="-L$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI -lasound"
|
||||
ALSA_FOUND=yes
|
||||
elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libasound.so"; then
|
||||
ALSA_LIBS="-L$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI -lasound"
|
||||
ALSA_FOUND=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "x$ALSA_FOUND" = xno; then
|
||||
AC_CHECK_HEADERS([alsa/asoundlib.h],
|
||||
[
|
||||
ALSA_FOUND=yes
|
||||
ALSA_CFLAGS=-Iignoreme
|
||||
ALSA_LIBS=-lasound
|
||||
DEFAULT_ALSA=yes
|
||||
],
|
||||
[ALSA_FOUND=no]
|
||||
)
|
||||
fi
|
||||
if test "x$ALSA_FOUND" = xno; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([alsa])
|
||||
AC_MSG_ERROR([Could not find alsa! $HELP_MSG])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(ALSA_CFLAGS)
|
||||
AC_SUBST(ALSA_LIBS)
|
||||
])
|
||||
359
make/autoconf/lib-bundled.m4
Normal file
359
make/autoconf/lib-bundled.m4
Normal file
|
|
@ -0,0 +1,359 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Setup bundled libraries.
|
||||
#
|
||||
# For libjpeg, giflib, libpng, lcms2 and zlib the source is present in the
|
||||
# OpenJDK repository (referred to as "bundled"). Default is to use libjpeg,
|
||||
# giflib, libpng and lcms2 libraries as "bundled". The default for zlib is
|
||||
# to use the bundled zlib on Windows and AIX, otherwise the external ("system")
|
||||
# zlib, if present. However the libs may be replaced by an external ("system")
|
||||
# version by the user.
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_BUNDLED_LIBS],
|
||||
[
|
||||
LIB_SETUP_LIBJPEG
|
||||
LIB_SETUP_GIFLIB
|
||||
LIB_SETUP_LIBPNG
|
||||
LIB_SETUP_ZLIB
|
||||
LIB_SETUP_LCMS
|
||||
LIB_SETUP_HARFBUZZ
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup libjpeg
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_LIBJPEG],
|
||||
[
|
||||
AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
|
||||
[use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
||||
|
||||
AC_MSG_CHECKING([for which libjpeg to use])
|
||||
# default is bundled
|
||||
DEFAULT_LIBJPEG=bundled
|
||||
# if user didn't specify, use DEFAULT_LIBJPEG
|
||||
if test "x${with_libjpeg}" = "x"; then
|
||||
with_libjpeg=${DEFAULT_LIBJPEG}
|
||||
fi
|
||||
AC_MSG_RESULT(${with_libjpeg})
|
||||
|
||||
if test "x${with_libjpeg}" = "xbundled"; then
|
||||
USE_EXTERNAL_LIBJPEG=false
|
||||
LIBJPEG_CFLAGS=""
|
||||
LIBJPEG_LIBS=""
|
||||
elif test "x${with_libjpeg}" = "xsystem"; then
|
||||
PKG_CHECK_MODULES(LIBJPEG, libjpeg, [LIBJPEG_FOUND=yes], [LIBJPEG_FOUND=no])
|
||||
if test "x${LIBJPEG_FOUND}" = "xyes"; then
|
||||
# PKG_CHECK_MODULES will set LIBJPEG_CFLAGS and LIBJPEG_LIBS
|
||||
USE_EXTERNAL_LIBJPEG=true
|
||||
else
|
||||
AC_CHECK_HEADER(jpeglib.h, [],
|
||||
[ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
|
||||
AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
|
||||
[ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
|
||||
|
||||
USE_EXTERNAL_LIBJPEG=true
|
||||
LIBJPEG_CFLAGS=""
|
||||
LIBJPEG_LIBS="-ljpeg"
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
|
||||
fi
|
||||
|
||||
AC_SUBST(USE_EXTERNAL_LIBJPEG)
|
||||
AC_SUBST(LIBJPEG_CFLAGS)
|
||||
AC_SUBST(LIBJPEG_LIBS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup giflib
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
|
||||
[
|
||||
AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
|
||||
[use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
||||
AC_ARG_WITH(giflib-include, [AS_HELP_STRING([--with-giflib-include],
|
||||
[specify directory for the system giflib include files])])
|
||||
AC_ARG_WITH(giflib-lib, [AS_HELP_STRING([--with-giflib-lib],
|
||||
[specify directory for the system giflib library])])
|
||||
|
||||
AC_MSG_CHECKING([for which giflib to use])
|
||||
# default is bundled
|
||||
DEFAULT_GIFLIB=bundled
|
||||
# if user didn't specify, use DEFAULT_GIFLIB
|
||||
if test "x${with_giflib}" = "x"; then
|
||||
with_giflib=${DEFAULT_GIFLIB}
|
||||
fi
|
||||
AC_MSG_RESULT(${with_giflib})
|
||||
|
||||
if test "x${with_giflib}" = "xbundled"; then
|
||||
USE_EXTERNAL_LIBGIF=false
|
||||
GIFLIB_CFLAGS=""
|
||||
GIFLIB_LIBS=""
|
||||
elif test "x${with_giflib}" = "xsystem"; then
|
||||
GIFLIB_H_FOUND=no
|
||||
if test "x${with_giflib_include}" != x; then
|
||||
GIFLIB_CFLAGS="-I${with_giflib_include}"
|
||||
GIFLIB_H_FOUND=yes
|
||||
fi
|
||||
if test "x$GIFLIB_H_FOUND" = xno; then
|
||||
AC_CHECK_HEADER(gif_lib.h,
|
||||
[
|
||||
GIFLIB_CFLAGS=""
|
||||
GIFLIB_H_FOUND=yes
|
||||
])
|
||||
fi
|
||||
if test "x$GIFLIB_H_FOUND" = xno; then
|
||||
AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])
|
||||
fi
|
||||
|
||||
GIFLIB_LIB_FOUND=no
|
||||
if test "x${with_giflib_lib}" != x; then
|
||||
GIFLIB_LIBS="-L${with_giflib_lib} -lgif"
|
||||
GIFLIB_LIB_FOUND=yes
|
||||
fi
|
||||
if test "x$GIFLIB_LIB_FOUND" = xno; then
|
||||
AC_CHECK_LIB(gif, DGifGetCode,
|
||||
[
|
||||
GIFLIB_LIBS="-lgif"
|
||||
GIFLIB_LIB_FOUND=yes
|
||||
])
|
||||
fi
|
||||
if test "x$GIFLIB_LIB_FOUND" = xno; then
|
||||
AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])
|
||||
fi
|
||||
|
||||
USE_EXTERNAL_LIBGIF=true
|
||||
GIFLIB_LIBS=-lgif
|
||||
else
|
||||
AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
|
||||
fi
|
||||
|
||||
AC_SUBST(USE_EXTERNAL_LIBGIF)
|
||||
AC_SUBST(GIFLIB_CFLAGS)
|
||||
AC_SUBST(GIFLIB_LIBS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup libpng
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
|
||||
[
|
||||
AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
|
||||
[use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
||||
|
||||
PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
|
||||
AC_MSG_CHECKING([for which libpng to use])
|
||||
|
||||
# default is bundled
|
||||
DEFAULT_LIBPNG=bundled
|
||||
# if user didn't specify, use DEFAULT_LIBPNG
|
||||
if test "x${with_libpng}" = "x"; then
|
||||
with_libpng=${DEFAULT_LIBPNG}
|
||||
fi
|
||||
|
||||
if test "x${with_libpng}" = "xbundled"; then
|
||||
USE_EXTERNAL_LIBPNG=false
|
||||
PNG_CFLAGS=""
|
||||
PNG_LIBS=""
|
||||
AC_MSG_RESULT([bundled])
|
||||
elif test "x${with_libpng}" = "xsystem"; then
|
||||
if test "x${LIBPNG_FOUND}" = "xyes"; then
|
||||
# PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
|
||||
USE_EXTERNAL_LIBPNG=true
|
||||
AC_MSG_RESULT([system])
|
||||
else
|
||||
AC_MSG_RESULT([system not found])
|
||||
AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
|
||||
fi
|
||||
|
||||
AC_SUBST(USE_EXTERNAL_LIBPNG)
|
||||
AC_SUBST(PNG_CFLAGS)
|
||||
AC_SUBST(PNG_LIBS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup zlib
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_ZLIB],
|
||||
[
|
||||
AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
|
||||
[use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
||||
|
||||
AC_CHECK_LIB(z, compress,
|
||||
[ ZLIB_FOUND=yes ],
|
||||
[ ZLIB_FOUND=no ])
|
||||
|
||||
AC_MSG_CHECKING([for which zlib to use])
|
||||
|
||||
DEFAULT_ZLIB=system
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows -o "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
# On windows and aix default is bundled
|
||||
DEFAULT_ZLIB=bundled
|
||||
elif test "x$OPENJDK_TARGET_OS" = xmacosx -a "x$OPENJDK_TARGET_CPU" = xaarch64; then
|
||||
DEFAULT_ZLIB=bundled
|
||||
fi
|
||||
|
||||
if test "x${ZLIB_FOUND}" != "xyes"; then
|
||||
# If we don't find any system...set default to bundled
|
||||
DEFAULT_ZLIB=bundled
|
||||
fi
|
||||
|
||||
# If user didn't specify, use DEFAULT_ZLIB
|
||||
if test "x${with_zlib}" = "x"; then
|
||||
with_zlib=${DEFAULT_ZLIB}
|
||||
fi
|
||||
|
||||
if test "x${with_zlib}" = "xbundled"; then
|
||||
USE_EXTERNAL_LIBZ=false
|
||||
AC_MSG_RESULT([bundled])
|
||||
elif test "x${with_zlib}" = "xsystem"; then
|
||||
if test "x${ZLIB_FOUND}" = "xyes"; then
|
||||
USE_EXTERNAL_LIBZ=true
|
||||
AC_MSG_RESULT([system])
|
||||
|
||||
if test "x$USE_EXTERNAL_LIBPNG" != "xtrue"; then
|
||||
# If we use bundled libpng, we must verify that we have a proper zlib.
|
||||
# For instance zlib-ng has had issues with inflateValidate().
|
||||
AC_MSG_CHECKING([for system zlib functionality])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([#include "zlib.h"], [
|
||||
#if ZLIB_VERNUM >= 0x1281
|
||||
inflateValidate(NULL, 0);
|
||||
#endif
|
||||
])],
|
||||
[AC_MSG_RESULT([ok])],
|
||||
[
|
||||
AC_MSG_RESULT([not ok])
|
||||
AC_MSG_ERROR([System zlib not working correctly])
|
||||
]
|
||||
)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([system not found])
|
||||
AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
|
||||
fi
|
||||
|
||||
LIBZ_CFLAGS=""
|
||||
LIBZ_LIBS=""
|
||||
if test "x$USE_EXTERNAL_LIBZ" = "xfalse"; then
|
||||
LIBZ_CFLAGS="$LIBZ_CFLAGS -I$TOPDIR/src/java.base/share/native/libzip/zlib"
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx -o "x$OPENJDK_TARGET_OS" = xaix -o "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
LIBZ_CFLAGS="$LIBZ_CFLAGS -DHAVE_UNISTD_H=1 -DHAVE_STDARG_H=1"
|
||||
fi
|
||||
else
|
||||
LIBZ_LIBS="-lz"
|
||||
fi
|
||||
|
||||
AC_SUBST(USE_EXTERNAL_LIBZ)
|
||||
AC_SUBST(LIBZ_CFLAGS)
|
||||
AC_SUBST(LIBZ_LIBS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup lcms (Little CMS)
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_LCMS],
|
||||
[
|
||||
AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
|
||||
[use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
||||
|
||||
AC_MSG_CHECKING([for which lcms to use])
|
||||
|
||||
DEFAULT_LCMS=bundled
|
||||
# If user didn't specify, use DEFAULT_LCMS
|
||||
if test "x${with_lcms}" = "x"; then
|
||||
with_lcms=${DEFAULT_LCMS}
|
||||
fi
|
||||
|
||||
if test "x${with_lcms}" = "xbundled"; then
|
||||
USE_EXTERNAL_LCMS=false
|
||||
LCMS_CFLAGS=""
|
||||
LCMS_LIBS=""
|
||||
AC_MSG_RESULT([bundled])
|
||||
elif test "x${with_lcms}" = "xsystem"; then
|
||||
AC_MSG_RESULT([system])
|
||||
PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no])
|
||||
if test "x${LCMS_FOUND}" = "xyes"; then
|
||||
# PKG_CHECK_MODULES will set LCMS_CFLAGS and LCMS_LIBS
|
||||
USE_EXTERNAL_LCMS=true
|
||||
else
|
||||
AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
|
||||
fi
|
||||
|
||||
AC_SUBST(USE_EXTERNAL_LCMS)
|
||||
AC_SUBST(LCMS_CFLAGS)
|
||||
AC_SUBST(LCMS_LIBS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup harfbuzz
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_HARFBUZZ],
|
||||
[
|
||||
AC_ARG_WITH(harfbuzz, [AS_HELP_STRING([--with-harfbuzz],
|
||||
[use harfbuzz from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
||||
|
||||
AC_MSG_CHECKING([for which harfbuzz to use])
|
||||
|
||||
DEFAULT_HARFBUZZ=bundled
|
||||
# If user didn't specify, use DEFAULT_HARFBUZZ
|
||||
if test "x${with_harfbuzz}" = "x"; then
|
||||
with_harfbuzz=${DEFAULT_HARFBUZZ}
|
||||
fi
|
||||
|
||||
if test "x${with_harfbuzz}" = "xbundled"; then
|
||||
USE_EXTERNAL_HARFBUZZ=false
|
||||
HARFBUZZ_CFLAGS=""
|
||||
HARFBUZZ_LIBS=""
|
||||
AC_MSG_RESULT([bundled])
|
||||
elif test "x${with_harfbuzz}" = "xsystem"; then
|
||||
AC_MSG_RESULT([system])
|
||||
PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz], [HARFBUZZ_FOUND=yes], [HARFBUZZ_FOUND=no])
|
||||
if test "x${HARFBUZZ_FOUND}" = "xyes"; then
|
||||
# PKG_CHECK_MODULES will set HARFBUZZ_CFLAGS and HARFBUZZ_LIBS
|
||||
USE_EXTERNAL_HARFBUZZ=true
|
||||
else
|
||||
HELP_MSG_MISSING_DEPENDENCY([harfbuzz])
|
||||
AC_MSG_ERROR([--with-harfbuzz=system specified, but no harfbuzz found! $HELP_MSG])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Invalid value for --with-harfbuzz: ${with_harfbuzz}, use 'system' or 'bundled'])
|
||||
fi
|
||||
|
||||
AC_SUBST(USE_EXTERNAL_HARFBUZZ)
|
||||
AC_SUBST(HARFBUZZ_CFLAGS)
|
||||
AC_SUBST(HARFBUZZ_LIBS)
|
||||
])
|
||||
93
make/autoconf/lib-cups.m4
Normal file
93
make/autoconf/lib-cups.m4
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2023, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Setup cups (Common Unix Printing System)
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_CUPS],
|
||||
[
|
||||
AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
|
||||
[specify prefix directory for the cups package
|
||||
(expecting the headers under PATH/include)])])
|
||||
AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
|
||||
[specify directory for the cups include files])])
|
||||
|
||||
if test "x$NEEDS_LIB_CUPS" = xfalse; then
|
||||
if (test "x${with_cups}" != x && test "x${with_cups}" != xno) || \
|
||||
(test "x${with_cups_include}" != x && test "x${with_cups_include}" != xno); then
|
||||
AC_MSG_WARN([[cups not used, so --with-cups[-*] is ignored]])
|
||||
fi
|
||||
CUPS_CFLAGS=
|
||||
else
|
||||
CUPS_FOUND=no
|
||||
|
||||
if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno; then
|
||||
AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
|
||||
fi
|
||||
|
||||
if test "x${with_cups}" != x; then
|
||||
AC_MSG_CHECKING([for cups headers])
|
||||
if test -s "${with_cups}/include/cups/cups.h"; then
|
||||
CUPS_CFLAGS="-I${with_cups}/include"
|
||||
CUPS_FOUND=yes
|
||||
AC_MSG_RESULT([$CUPS_FOUND])
|
||||
else
|
||||
AC_MSG_ERROR([Can't find 'include/cups/cups.h' under ${with_cups} given with the --with-cups option.])
|
||||
fi
|
||||
fi
|
||||
if test "x${with_cups_include}" != x; then
|
||||
AC_MSG_CHECKING([for cups headers])
|
||||
if test -s "${with_cups_include}/cups/cups.h"; then
|
||||
CUPS_CFLAGS="-I${with_cups_include}"
|
||||
CUPS_FOUND=yes
|
||||
AC_MSG_RESULT([$CUPS_FOUND])
|
||||
else
|
||||
AC_MSG_ERROR([Can't find 'cups/cups.h' under ${with_cups_include} given with the --with-cups-include option.])
|
||||
fi
|
||||
fi
|
||||
if test "x$CUPS_FOUND" = xno; then
|
||||
# Are the cups headers installed in the default AIX or /usr/include location?
|
||||
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
|
||||
AC_CHECK_HEADERS([/opt/freeware/include/cups/cups.h /opt/freeware/include/cups/ppd.h], [
|
||||
CUPS_FOUND=yes
|
||||
CUPS_CFLAGS="-I/opt/freeware/include"
|
||||
DEFAULT_CUPS=yes
|
||||
])
|
||||
else
|
||||
AC_CHECK_HEADERS([cups/cups.h cups/ppd.h], [
|
||||
CUPS_FOUND=yes
|
||||
CUPS_CFLAGS=
|
||||
DEFAULT_CUPS=yes
|
||||
])
|
||||
fi
|
||||
fi
|
||||
if test "x$CUPS_FOUND" = xno; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([cups])
|
||||
AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(CUPS_CFLAGS)
|
||||
])
|
||||
217
make/autoconf/lib-ffi.m4
Normal file
217
make/autoconf/lib-ffi.m4
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
#
|
||||
# Copyright (c) 2015, 2023, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Setup libffi (Foreign Function Interface)
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_LIBFFI],
|
||||
[
|
||||
UTIL_ARG_ENABLE(NAME: libffi-bundling, DEFAULT: false,
|
||||
RESULT: ENABLE_LIBFFI_BUNDLING,
|
||||
DESC: [enable bundling of libffi.so to make the built JDK runnable on more systems])
|
||||
|
||||
AC_ARG_WITH(libffi, [AS_HELP_STRING([--with-libffi],
|
||||
[specify prefix directory for the libffi package
|
||||
(expecting the libraries under PATH/lib and the headers under PATH/include)])])
|
||||
AC_ARG_WITH(libffi-include, [AS_HELP_STRING([--with-libffi-include],
|
||||
[specify directory for the libffi include files])])
|
||||
AC_ARG_WITH(libffi-lib, [AS_HELP_STRING([--with-libffi-lib],
|
||||
[specify directory for the libffi library])])
|
||||
|
||||
if test "x$NEEDS_LIB_FFI" = xfalse; then
|
||||
if (test "x${with_libffi}" != x && test "x${with_libffi}" != xno) || \
|
||||
(test "x${with_libffi_include}" != x && test "x${with_libffi_include}" != xno) || \
|
||||
(test "x${with_libffi_lib}" != x && test "x${with_libffi_lib}" != xno); then
|
||||
AC_MSG_WARN([[libffi not used, so --with-libffi[-*] is ignored]])
|
||||
fi
|
||||
LIBFFI_CFLAGS=
|
||||
LIBFFI_LIBS=
|
||||
else
|
||||
LIBFFI_FOUND=no
|
||||
|
||||
if test "x${with_libffi}" = xno || test "x${with_libffi_include}" = xno || test "x${with_libffi_lib}" = xno; then
|
||||
AC_MSG_ERROR([It is not possible to disable the use of libffi. Remove the --without-libffi option.])
|
||||
fi
|
||||
|
||||
if test "x${with_libffi}" != x; then
|
||||
LIBFFI_LIB_PATH="${with_libffi}/lib"
|
||||
if test "x${OPENJDK_TARGET_OS}" != "xwindows"; then
|
||||
LIBFFI_LIBS="-L${with_libffi}/lib -lffi"
|
||||
else
|
||||
LIBFFI_LIBS="${with_libffi}/lib/libffi.lib"
|
||||
fi
|
||||
LIBFFI_CFLAGS="-I${with_libffi}/include"
|
||||
LIBFFI_FOUND=yes
|
||||
fi
|
||||
if test "x${with_libffi_include}" != x; then
|
||||
LIBFFI_CFLAGS="-I${with_libffi_include}"
|
||||
LIBFFI_FOUND=yes
|
||||
fi
|
||||
if test "x${with_libffi_lib}" != x; then
|
||||
LIBFFI_LIB_PATH="${with_libffi_lib}"
|
||||
if test "x${OPENJDK_TARGET_OS}" != "xwindows"; then
|
||||
LIBFFI_LIBS="-L${with_libffi_lib} -lffi"
|
||||
else
|
||||
LIBFFI_LIBS="${with_libffi_lib}/libffi.lib"
|
||||
fi
|
||||
LIBFFI_FOUND=yes
|
||||
fi
|
||||
# Do not try pkg-config if we have a sysroot set.
|
||||
if test "x$SYSROOT" = x; then
|
||||
if test "x$LIBFFI_FOUND" = xno; then
|
||||
# Figure out LIBFFI_CFLAGS and LIBFFI_LIBS
|
||||
PKG_CHECK_MODULES([LIBFFI], [libffi], [LIBFFI_FOUND=yes], [LIBFFI_FOUND=no])
|
||||
fi
|
||||
fi
|
||||
if test "x$LIBFFI_FOUND" = xno; then
|
||||
AC_CHECK_HEADERS([ffi.h],
|
||||
[
|
||||
LIBFFI_FOUND=yes
|
||||
LIBFFI_CFLAGS=
|
||||
LIBFFI_LIBS=-lffi
|
||||
],
|
||||
[LIBFFI_FOUND=no]
|
||||
)
|
||||
fi
|
||||
# on macos we need a special case for system's libffi as
|
||||
# headers are located only in sdk in $SYSROOT and in ffi subfolder
|
||||
if test "x$LIBFFI_FOUND" = xno; then
|
||||
if test "x$SYSROOT" != "x"; then
|
||||
AC_CHECK_HEADER([$SYSROOT/usr/include/ffi/ffi.h],
|
||||
[
|
||||
LIBFFI_FOUND=yes
|
||||
LIBFFI_CFLAGS="-I${SYSROOT}/usr/include/ffi"
|
||||
LIBFFI_LIBS=-lffi
|
||||
],
|
||||
[LIBFFI_FOUND=no]
|
||||
)
|
||||
fi
|
||||
fi
|
||||
if test "x$LIBFFI_FOUND" = xno; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([ffi])
|
||||
AC_MSG_ERROR([Could not find libffi! $HELP_MSG])
|
||||
fi
|
||||
|
||||
AC_LANG_PUSH(C)
|
||||
OLD_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $LIBFFI_CFLAGS"
|
||||
OLD_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBFFI_LIBS"
|
||||
|
||||
AC_MSG_CHECKING([if libffi works])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ffi.h>],
|
||||
[
|
||||
ffi_call(NULL, NULL, NULL, NULL);
|
||||
return 0;
|
||||
])],
|
||||
[LIBFFI_WORKS=yes],
|
||||
[LIBFFI_WORKS=no]
|
||||
)
|
||||
AC_MSG_RESULT([$LIBFFI_WORKS])
|
||||
|
||||
if test "x$LIBFFI_WORKS" = xno; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([ffi])
|
||||
AC_MSG_ERROR([Found libffi but could not link and compile with it. $HELP_MSG])
|
||||
fi
|
||||
|
||||
# Check if FFI_GO_CLOSURES is properly defined. On some distributions, notably MacOS AArch64,
|
||||
# ffitarget.h (included from ffi.h) does not explicitly define FFI_GO_CLOSURES. This makes the
|
||||
# further include of ffi.h trigger the "FFI_GO_CLOSURES is undefined" warning, which fails
|
||||
# the build when warnings are fatal.
|
||||
AC_MSG_CHECKING([for FFI_GO_CLOSURES definition])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <ffi.h>
|
||||
#ifndef FFI_GO_CLOSURES
|
||||
#error "FFI_GO_CLOSURES is not defined"
|
||||
#endif
|
||||
][])],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no, defining])
|
||||
LIBFFI_CFLAGS="$LIBFFI_CFLAGS -DFFI_GO_CLOSURES=0"
|
||||
]
|
||||
)
|
||||
|
||||
CFLAGS="$OLD_CFLAGS"
|
||||
LIBS="$OLD_LIBS"
|
||||
AC_LANG_POP(C)
|
||||
|
||||
# Find the libffi.so.X to bundle
|
||||
if test "x${ENABLE_LIBFFI_BUNDLING}" = "xtrue"; then
|
||||
if test "x${OPENJDK_TARGET_OS}" = "xmacosx"; then
|
||||
LIBFFI_LIB_FILE_NAME=libffi.?.dylib
|
||||
elif test "x${OPENJDK_TARGET_OS}" = "xwindows"; then
|
||||
LIBFFI_LIB_FILE_NAME=libffi.dll
|
||||
else
|
||||
LIBFFI_LIB_FILE_NAME=libffi.so.?
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for libffi lib file location])
|
||||
if test "x${LIBFFI_LIB_PATH}" != x; then
|
||||
if test -e ${LIBFFI_LIB_PATH}/${LIBFFI_LIB_FILE_NAME}; then
|
||||
LIBFFI_LIB_FILE="${LIBFFI_LIB_PATH}/${LIBFFI_LIB_FILE_NAME}"
|
||||
else
|
||||
AC_MSG_ERROR([Could not locate ${LIBFFI_LIB_FILE_NAME} for bundling in ${LIBFFI_LIB_PATH}])
|
||||
fi
|
||||
else
|
||||
# If we don't have an explicit path, look in a few obvious places
|
||||
if test "x${OPENJDK_TARGET_CPU}" = "xx86"; then
|
||||
if test -e ${SYSROOT}/usr/lib/${LIBFFI_LIB_FILE_NAME} ; then
|
||||
LIBFFI_LIB_FILE="${SYSROOT}/usr/lib/${LIBFFI_LIB_FILE_NAME}"
|
||||
elif test -e ${SYSROOT}/usr/lib/i386-linux-gnu/${LIBFFI_LIB_FILE_NAME} ; then
|
||||
LIBFFI_LIB_FILE="${SYSROOT}/usr/lib/i386-linux-gnu/${LIBFFI_LIB_FILE_NAME}"
|
||||
else
|
||||
AC_MSG_ERROR([Could not locate ${LIBFFI_LIB_FILE_NAME} for bundling])
|
||||
fi
|
||||
elif test "x${OPENJDK_TARGET_CPU}" = "xx86_64" || test "x${OPENJDK_TARGET_CPU}" = "xaarch64"; then
|
||||
if test -e ${SYSROOT}/usr/lib64/${LIBFFI_LIB_FILE_NAME} ; then
|
||||
LIBFFI_LIB_FILE="${SYSROOT}/usr/lib64/${LIBFFI_LIB_FILE_NAME}"
|
||||
elif test -e ${SYSROOT}/usr/lib/x86_64-linux-gnu/${LIBFFI_LIB_FILE_NAME} ; then
|
||||
LIBFFI_LIB_FILE="${SYSROOT}/usr/lib/x86_64-linux-gnu/${LIBFFI_LIB_FILE_NAME}"
|
||||
else
|
||||
AC_MSG_ERROR([Could not locate ${LIBFFI_LIB_FILE_NAME} for bundling])
|
||||
fi
|
||||
else
|
||||
# Fallback on the default /usr/lib dir
|
||||
if test -e ${SYSROOT}/usr/lib/${LIBFFI_LIB_FILE_NAME} ; then
|
||||
LIBFFI_LIB_FILE="${SYSROOT}/usr/lib/${LIBFFI_LIB_FILE_NAME}"
|
||||
else
|
||||
AC_MSG_ERROR([Could not locate ${LIBFFI_LIB_FILE_NAME} for bundling])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# Make sure the wildcard is evaluated
|
||||
LIBFFI_LIB_FILE="$(ls ${LIBFFI_LIB_FILE})"
|
||||
AC_MSG_RESULT([${LIBFFI_LIB_FILE}])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBFFI_CFLAGS)
|
||||
AC_SUBST(LIBFFI_LIBS)
|
||||
AC_SUBST(ENABLE_LIBFFI_BUNDLING)
|
||||
AC_SUBST(LIBFFI_LIB_FILE)
|
||||
])
|
||||
85
make/autoconf/lib-fontconfig.m4
Normal file
85
make/autoconf/lib-fontconfig.m4
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#
|
||||
# Copyright (c) 2017, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Setup fontconfig
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_FONTCONFIG],
|
||||
[
|
||||
AC_ARG_WITH(fontconfig, [AS_HELP_STRING([--with-fontconfig],
|
||||
[specify prefix directory for the fontconfig package
|
||||
(expecting the headers under PATH/include)])])
|
||||
AC_ARG_WITH(fontconfig-include, [AS_HELP_STRING([--with-fontconfig-include],
|
||||
[specify directory for the fontconfig include files])])
|
||||
|
||||
if test "x$NEEDS_LIB_FONTCONFIG" = xfalse; then
|
||||
if (test "x${with_fontconfig}" != x && test "x${with_fontconfig}" != xno) || \
|
||||
(test "x${with_fontconfig_include}" != x && test "x${with_fontconfig_include}" != xno); then
|
||||
AC_MSG_WARN([[fontconfig not used, so --with-fontconfig[-*] is ignored]])
|
||||
fi
|
||||
FONTCONFIG_CFLAGS=
|
||||
else
|
||||
FONTCONFIG_FOUND=no
|
||||
|
||||
if test "x${with_fontconfig}" = xno || test "x${with_fontconfig_include}" = xno; then
|
||||
AC_MSG_ERROR([It is not possible to disable the use of fontconfig. Remove the --without-fontconfig option.])
|
||||
fi
|
||||
|
||||
if test "x${with_fontconfig}" != x; then
|
||||
AC_MSG_CHECKING([for fontconfig headers])
|
||||
if test -s "${with_fontconfig}/include/fontconfig/fontconfig.h"; then
|
||||
FONTCONFIG_CFLAGS="-I${with_fontconfig}/include"
|
||||
FONTCONFIG_FOUND=yes
|
||||
AC_MSG_RESULT([$FONTCONFIG_FOUND])
|
||||
else
|
||||
AC_MSG_ERROR([Can't find 'include/fontconfig/fontconfig.h' under ${with_fontconfig} given with the --with-fontconfig option.])
|
||||
fi
|
||||
fi
|
||||
if test "x${with_fontconfig_include}" != x; then
|
||||
AC_MSG_CHECKING([for fontconfig headers])
|
||||
if test -s "${with_fontconfig_include}/fontconfig/fontconfig.h"; then
|
||||
FONTCONFIG_CFLAGS="-I${with_fontconfig_include}"
|
||||
FONTCONFIG_FOUND=yes
|
||||
AC_MSG_RESULT([$FONTCONFIG_FOUND])
|
||||
else
|
||||
AC_MSG_ERROR([Can't find 'fontconfig/fontconfig.h' under ${with_fontconfig_include} given with the --with-fontconfig-include option.])
|
||||
fi
|
||||
fi
|
||||
if test "x$FONTCONFIG_FOUND" = xno; then
|
||||
# Are the fontconfig headers installed in the default /usr/include location?
|
||||
AC_CHECK_HEADERS([fontconfig/fontconfig.h], [
|
||||
FONTCONFIG_FOUND=yes
|
||||
FONTCONFIG_CFLAGS=
|
||||
DEFAULT_FONTCONFIG=yes
|
||||
])
|
||||
fi
|
||||
if test "x$FONTCONFIG_FOUND" = xno; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([fontconfig])
|
||||
AC_MSG_ERROR([Could not find fontconfig! $HELP_MSG ])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(FONTCONFIG_CFLAGS)
|
||||
])
|
||||
245
make/autoconf/lib-freetype.m4
Normal file
245
make/autoconf/lib-freetype.m4
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2024, 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 if a potential freeype library match is correct and usable
|
||||
################################################################################
|
||||
AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
|
||||
[
|
||||
POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
|
||||
POTENTIAL_FREETYPE_LIB_PATH="$2"
|
||||
METHOD="$3"
|
||||
|
||||
# Let's start with an optimistic view of the world :-)
|
||||
FOUND_FREETYPE=yes
|
||||
|
||||
# First look for the canonical freetype main include file ft2build.h.
|
||||
if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
|
||||
# Oh no! Let's try in the freetype2 directory.
|
||||
POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
|
||||
if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
|
||||
# Fail.
|
||||
FOUND_FREETYPE=no
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$FOUND_FREETYPE" = "xyes"; then
|
||||
# Include file found, let's continue the sanity check.
|
||||
AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
|
||||
|
||||
FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
|
||||
if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
|
||||
AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
|
||||
FOUND_FREETYPE=no
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$FOUND_FREETYPE" = "xyes"; then
|
||||
FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
|
||||
AC_MSG_CHECKING([for freetype includes])
|
||||
AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
|
||||
FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
|
||||
AC_MSG_CHECKING([for freetype libraries])
|
||||
AC_MSG_RESULT([$FREETYPE_LIB_PATH])
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup freetype (The FreeType2 font rendering library)
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
||||
[
|
||||
AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
|
||||
[specify whether to use 'system' or 'bundled' freetype.
|
||||
The selected option applies to both build time and run time.
|
||||
The default behaviour can be platform dependent.
|
||||
If using 'system' and either the include files or libraries cannot be
|
||||
located automatically, then additionally specify both using
|
||||
--with-freetype-include and --with-freetype-lib.])])
|
||||
AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
|
||||
[specify directory for the freetype include files])])
|
||||
AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
|
||||
[specify directory for the freetype library])])
|
||||
|
||||
# This setup is to verify access to system installed freetype header and
|
||||
# libraries. On Windows and MacOS this does not apply and using these options
|
||||
# will report an error. On other platforms they will default to using the
|
||||
# system libraries. If they are found automatically, nothing need be done.
|
||||
# If they are not found, the configure "--with-freetype-*" options may be
|
||||
# used to fix that. If the preference is to bundle on these platforms then
|
||||
# use --with-freetype=bundled.
|
||||
|
||||
FREETYPE_BASE_NAME=freetype
|
||||
FREETYPE_CFLAGS=
|
||||
FREETYPE_LIBS=
|
||||
|
||||
if (test "x$with_freetype_include" = "x" && \
|
||||
test "x$with_freetype_lib" != "x") || \
|
||||
(test "x$with_freetype_include" != "x" && \
|
||||
test "x$with_freetype_lib" = "x"); then
|
||||
AC_MSG_ERROR([Must specify both or neither of --with-freetype-include and --with-freetype-lib])
|
||||
fi
|
||||
|
||||
FREETYPE_TO_USE=bundled
|
||||
if test "x$OPENJDK_TARGET_OS" != "xwindows" && \
|
||||
test "x$OPENJDK_TARGET_OS" != "xmacosx" && \
|
||||
test "x$OPENJDK_TARGET_OS" != "xaix"; then
|
||||
FREETYPE_TO_USE=system
|
||||
fi
|
||||
if test "x$with_freetype" != "x" ; then
|
||||
if test "x$with_freetype" = "xsystem" ; then
|
||||
FREETYPE_TO_USE=system
|
||||
elif test "x$with_freetype" = "xbundled" ; then
|
||||
FREETYPE_TO_USE=bundled
|
||||
if test "x$with_freetype_include" != "x" || \
|
||||
test "x$with_freetype_lib" != "x" ; then
|
||||
AC_MSG_ERROR(['bundled' cannot be specified with --with-freetype-include and --with-freetype-lib])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Valid values for --with-freetype are 'system' and 'bundled'])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$with_freetype_include" != "x" && \
|
||||
test "x$with_freetype_lib" != "x" ; then
|
||||
FREETYPE_TO_USE=system
|
||||
fi
|
||||
|
||||
if test "x$FREETYPE_TO_USE" = "xsystem" && \
|
||||
(test "x$OPENJDK_TARGET_OS" = "xwindows" || \
|
||||
test "x$OPENJDK_TARGET_OS" = "xmacosx"); then
|
||||
AC_MSG_ERROR([Only bundled freetype can be specified on Mac and Windows])
|
||||
fi
|
||||
|
||||
if test "x$with_freetype_include" != "x" ; then
|
||||
POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
|
||||
fi
|
||||
if test "x$with_freetype_lib" != "x" ; then
|
||||
POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
|
||||
fi
|
||||
|
||||
if test "x$FREETYPE_TO_USE" = "xsystem" ; then
|
||||
if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != "x" && \
|
||||
test "x$POTENTIAL_FREETYPE_LIB_PATH" != "x" ; then
|
||||
# Okay, we got it. Check that it works.
|
||||
LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH,
|
||||
$POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype-lib|include])
|
||||
fi
|
||||
else
|
||||
# User did not specify a location, but asked for system freetype.
|
||||
# Try to locate it.
|
||||
|
||||
# If we have a sysroot, assume that's where we are supposed to look and
|
||||
# skip pkg-config.
|
||||
if test "x$SYSROOT" = "x" ; then
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
# Check modules using pkg-config, but only if we have it (ugly output
|
||||
# results otherwise)
|
||||
if test "x$PKG_CONFIG" != "x" ; then
|
||||
PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
|
||||
if test "x$FOUND_FREETYPE" = "xyes" ; then
|
||||
AC_MSG_CHECKING([for freetype])
|
||||
AC_MSG_RESULT([yes (using pkg-config)])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
# Check in well-known locations
|
||||
FREETYPE_BASE_DIR="$SYSROOT/usr"
|
||||
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" ; then
|
||||
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
||||
[$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-linux-gnu], [well-known location])
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
||||
[$FREETYPE_BASE_DIR/lib64], [well-known location])
|
||||
fi
|
||||
else
|
||||
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
||||
[$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location])
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
||||
[$FREETYPE_BASE_DIR/lib32], [well-known location])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
||||
[$FREETYPE_BASE_DIR/lib], [well-known location])
|
||||
fi
|
||||
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
||||
[$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI], [well-known location])
|
||||
fi
|
||||
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
||||
[$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI], [well-known location])
|
||||
fi
|
||||
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
|
||||
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
||||
[$FREETYPE_BASE_DIR/lib], [well-known location])
|
||||
fi
|
||||
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
FREETYPE_BASE_DIR="$SYSROOT/usr/local"
|
||||
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
||||
[$FREETYPE_BASE_DIR/lib], [well-known location])
|
||||
fi
|
||||
fi # end check in well-known locations
|
||||
|
||||
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([freetype])
|
||||
AC_MSG_ERROR([Could not find freetype! $HELP_MSG ])
|
||||
fi
|
||||
fi # end user specified settings
|
||||
|
||||
# Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
|
||||
if test "x$FREETYPE_CFLAGS" = "x" ; then
|
||||
if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype ; then
|
||||
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
|
||||
else
|
||||
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$FREETYPE_LIBS" = "x" ; then
|
||||
FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -l$FREETYPE_BASE_NAME"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([Using freetype: $FREETYPE_TO_USE])
|
||||
|
||||
AC_SUBST(FREETYPE_TO_USE)
|
||||
AC_SUBST(FREETYPE_CFLAGS)
|
||||
AC_SUBST(FREETYPE_LIBS)
|
||||
])
|
||||
420
make/autoconf/lib-hsdis.m4
Normal file
420
make/autoconf/lib-hsdis.m4
Normal file
|
|
@ -0,0 +1,420 @@
|
|||
#
|
||||
# Copyright (c) 2021, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Helper function to setup hsdis using Capstone
|
||||
#
|
||||
AC_DEFUN([LIB_SETUP_HSDIS_CAPSTONE],
|
||||
[
|
||||
AC_ARG_WITH(capstone, [AS_HELP_STRING([--with-capstone],
|
||||
[where to find the Capstone files needed for hsdis/capstone])])
|
||||
|
||||
if test "x$with_capstone" != x; then
|
||||
AC_MSG_CHECKING([for capstone])
|
||||
CAPSTONE="$with_capstone"
|
||||
AC_MSG_RESULT([$CAPSTONE])
|
||||
|
||||
HSDIS_CFLAGS="-I${CAPSTONE}/include/capstone"
|
||||
if test "x$OPENJDK_TARGET_OS" != xwindows; then
|
||||
HSDIS_LDFLAGS="-L${CAPSTONE}/lib"
|
||||
if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" ; then
|
||||
HSDIS_LDFLAGS="-L${CAPSTONE}/lib64 $HSDIS_LDFLAGS"
|
||||
fi
|
||||
HSDIS_LIBS="-lcapstone"
|
||||
else
|
||||
HSDIS_LDFLAGS="-nodefaultlib:libcmt.lib"
|
||||
HSDIS_LIBS="${CAPSTONE}/capstone.lib"
|
||||
fi
|
||||
else
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
||||
# There is no way to auto-detect capstone on Windows
|
||||
AC_MSG_NOTICE([You must specify capstone location using --with-capstone=<path>])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(CAPSTONE, capstone, [CAPSTONE_FOUND=yes], [CAPSTONE_FOUND=no])
|
||||
if test "x$CAPSTONE_FOUND" = xyes; then
|
||||
HSDIS_CFLAGS="$CAPSTONE_CFLAGS"
|
||||
HSDIS_LDFLAGS="$CAPSTONE_LDFLAGS"
|
||||
HSDIS_LIBS="$CAPSTONE_LIBS"
|
||||
else
|
||||
HELP_MSG_MISSING_DEPENDENCY([capstone])
|
||||
AC_MSG_NOTICE([Cannot locate capstone which is needed for hsdis/capstone. Try using --with-capstone=<path>. $HELP_MSG])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
fi
|
||||
|
||||
capstone_header="\"$CAPSTONE/include/capstone/capstone.h\""
|
||||
AC_MSG_CHECKING([capstone aarch64 arch name])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include $capstone_header],[[cs_arch test = CS_ARCH_AARCH64]])],
|
||||
[
|
||||
AC_MSG_RESULT([AARCH64])
|
||||
CAPSTONE_ARCH_AARCH64_NAME="AARCH64"
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([ARM64])
|
||||
CAPSTONE_ARCH_AARCH64_NAME="ARM64"
|
||||
]
|
||||
)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Helper function to setup hsdis using LLVM
|
||||
#
|
||||
AC_DEFUN([LIB_SETUP_HSDIS_LLVM],
|
||||
[
|
||||
AC_ARG_WITH([llvm], [AS_HELP_STRING([--with-llvm],
|
||||
[where to find the LLVM files needed for hsdis/llvm])])
|
||||
|
||||
if test "x$with_llvm" != x; then
|
||||
LLVM_DIR="$with_llvm"
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" != xwindows; then
|
||||
if test "x$LLVM_DIR" = x; then
|
||||
# Macs with homebrew can have llvm in different places
|
||||
UTIL_LOOKUP_PROGS(LLVM_CONFIG, llvm-config, [$PATH:/usr/local/opt/llvm/bin:/opt/homebrew/opt/llvm/bin])
|
||||
if test "x$LLVM_CONFIG" = x; then
|
||||
AC_MSG_NOTICE([Cannot locate llvm-config which is needed for hsdis/llvm. Try using --with-llvm=<LLVM home>.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
else
|
||||
UTIL_LOOKUP_PROGS(LLVM_CONFIG, llvm-config, [$LLVM_DIR/bin])
|
||||
if test "x$LLVM_CONFIG" = x; then
|
||||
AC_MSG_NOTICE([Cannot locate llvm-config in $LLVM_DIR. Check your --with-llvm argument.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
fi
|
||||
|
||||
# We need the LLVM flags and libs, and llvm-config provides them for us.
|
||||
HSDIS_CFLAGS=`$LLVM_CONFIG --cflags`
|
||||
HSDIS_LDFLAGS=`$LLVM_CONFIG --ldflags`
|
||||
HSDIS_LIBS=`$LLVM_CONFIG --libs $OPENJDK_TARGET_CPU_ARCH ${OPENJDK_TARGET_CPU_ARCH}disassembler`
|
||||
else
|
||||
if test "x$LLVM_DIR" = x; then
|
||||
AC_MSG_NOTICE([--with-llvm is needed on Windows to point out the LLVM home])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
# Official Windows installation of LLVM do not ship llvm-config, and self-built llvm-config
|
||||
# produced unusable output, so just ignore it on Windows.
|
||||
if ! test -e $LLVM_DIR/include/llvm-c/lto.h; then
|
||||
AC_MSG_NOTICE([$LLVM_DIR does not seem like a valid LLVM home; include dir is missing])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
if ! test -e $LLVM_DIR/include/llvm-c/Disassembler.h; then
|
||||
AC_MSG_NOTICE([$LLVM_DIR does not point to a complete LLVM installation. ])
|
||||
AC_MSG_NOTICE([The official LLVM distribution is missing crucical files; you need to build LLVM yourself or get all include files elsewhere])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
if ! test -e $LLVM_DIR/lib/llvm-c.lib; then
|
||||
AC_MSG_NOTICE([$LLVM_DIR does not seem like a valid LLVM home; lib dir is missing])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
HSDIS_CFLAGS="-I$LLVM_DIR/include"
|
||||
HSDIS_LDFLAGS="-libpath:$LLVM_DIR/lib"
|
||||
HSDIS_LIBS="llvm-c.lib"
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Helper function to build binutils from source.
|
||||
#
|
||||
AC_DEFUN([LIB_BUILD_BINUTILS],
|
||||
[
|
||||
BINUTILS_SRC="$with_binutils_src"
|
||||
UTIL_FIXUP_PATH(BINUTILS_SRC)
|
||||
|
||||
BINUTILS_BUILD_DIR="$CONFIGURESUPPORT_OUTPUTDIR/binutils"
|
||||
BINUTILS_INSTALL_DIR="$CONFIGURESUPPORT_OUTPUTDIR/binutils-install"
|
||||
|
||||
if ! test -d $BINUTILS_SRC; then
|
||||
AC_MSG_ERROR([--with-binutils-src is not pointing to a directory])
|
||||
fi
|
||||
if ! test -x $BINUTILS_SRC/configure; then
|
||||
AC_MSG_ERROR([--with-binutils-src does not look like a binutils source directory])
|
||||
fi
|
||||
|
||||
if ! test -d $BINUTILS_BUILD_DIR; then
|
||||
$MKDIR -p $BINUTILS_BUILD_DIR
|
||||
fi
|
||||
|
||||
# We don't know the version, not checking for libsframe.a
|
||||
if test -e $BINUTILS_INSTALL_DIR/lib/libbfd.a && \
|
||||
test -e $BINUTILS_INSTALL_DIR/lib/libopcodes.a && \
|
||||
test -e $BINUTILS_INSTALL_DIR/lib/libiberty.a; then
|
||||
AC_MSG_NOTICE([Found binutils binaries in binutils install directory -- not building])
|
||||
else
|
||||
# On Windows, we cannot build with the normal Microsoft CL, but must instead use
|
||||
# a separate mingw toolchain.
|
||||
if test "x$OPENJDK_BUILD_OS" = xwindows; then
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
|
||||
target_base="i686-w64-mingw32"
|
||||
else
|
||||
target_base="$OPENJDK_TARGET_CPU-w64-mingw32"
|
||||
fi
|
||||
binutils_cc="$target_base-gcc"
|
||||
binutils_target="--host=$target_base --target=$target_base"
|
||||
# Somehow the uint typedef is not included when building with mingw
|
||||
binutils_cflags="-Duint=unsigned"
|
||||
compiler_version=`$binutils_cc --version 2>&1`
|
||||
if ! [ [[ "$compiler_version" =~ GCC ]] ]; then
|
||||
AC_MSG_NOTICE([Could not find correct mingw compiler $binutils_cc.])
|
||||
HELP_MSG_MISSING_DEPENDENCY([$binutils_cc])
|
||||
AC_MSG_ERROR([Cannot continue. $HELP_MSG])
|
||||
else
|
||||
AC_MSG_NOTICE([Using compiler $binutils_cc with version $compiler_version])
|
||||
fi
|
||||
elif test "x$OPENJDK_BUILD_OS" = xmacosx; then
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
|
||||
binutils_target="--enable-targets=aarch64-darwin"
|
||||
else
|
||||
binutils_target=""
|
||||
fi
|
||||
else
|
||||
binutils_cc="$CC $SYSROOT_CFLAGS"
|
||||
if test "x$COMPILE_TYPE" = xcross; then
|
||||
binutils_target="--host=$OPENJDK_TARGET_AUTOCONF_NAME"
|
||||
else
|
||||
binutils_target=""
|
||||
fi
|
||||
fi
|
||||
binutils_cflags="$binutils_cflags $MACHINE_FLAG $JVM_PICFLAG $C_O_FLAG_NORM"
|
||||
|
||||
AC_MSG_NOTICE([Running binutils configure])
|
||||
AC_MSG_NOTICE([configure command line: cd $BINUTILS_BUILD_DIR && $BINUTILS_SRC/configure --disable-werror --prefix=$BINUTILS_INSTALL_DIR --enable-install-libiberty --with-system-zlib --without-zstd --disable-nls CFLAGS="$binutils_cflags" CC="$binutils_cc" AR="$AR" $binutils_target])
|
||||
saved_dir=`pwd`
|
||||
cd "$BINUTILS_BUILD_DIR"
|
||||
$BINUTILS_SRC/configure --disable-werror --prefix=$BINUTILS_INSTALL_DIR --enable-install-libiberty --with-system-zlib --without-zstd --disable-nls CFLAGS="$binutils_cflags" CC="$binutils_cc" AR="$AR" $binutils_target
|
||||
if test $? -ne 0 || ! test -e $BINUTILS_BUILD_DIR/Makefile; then
|
||||
AC_MSG_NOTICE([Automatic building of binutils failed on configure. Try building it manually])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
AC_MSG_NOTICE([Running binutils make])
|
||||
$MAKE all-opcodes all-libiberty
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_NOTICE([Automatic building of binutils failed on make. Try building it manually])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
AC_MSG_NOTICE([Running binutils make install])
|
||||
$MAKE install-opcodes install-libiberty
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_NOTICE([Automatic building, install step, of binutils failed on make. Try building it manually])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
cd $saved_dir
|
||||
AC_MSG_NOTICE([Building of binutils done])
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Helper function to setup hsdis using binutils
|
||||
#
|
||||
AC_DEFUN([LIB_SETUP_HSDIS_BINUTILS],
|
||||
[
|
||||
AC_ARG_WITH([binutils], [AS_HELP_STRING([--with-binutils],
|
||||
[where to find the binutils files needed for hsdis/binutils])])
|
||||
|
||||
AC_ARG_WITH([binutils-src], [AS_HELP_STRING([--with-binutils-src],
|
||||
[where to find the binutils source for building])])
|
||||
|
||||
# We need the binutils static libs and includes.
|
||||
if test "x$with_binutils_src" != x; then
|
||||
# Try building the source first. If it succeeds, it sets $BINUTILS_INSTALL_DIR.
|
||||
LIB_BUILD_BINUTILS
|
||||
fi
|
||||
|
||||
if test "x$with_binutils" != x; then
|
||||
BINUTILS_INSTALL_DIR="$with_binutils"
|
||||
fi
|
||||
|
||||
binutils_system_error=""
|
||||
HSDIS_LDFLAGS=""
|
||||
HSDIS_LIBS=""
|
||||
disasm_header="<dis-asm.h>"
|
||||
|
||||
if test "x$BINUTILS_INSTALL_DIR" = xsystem; then
|
||||
AC_CHECK_LIB(bfd, bfd_openr, [ HSDIS_LIBS="-lbfd" ], [ binutils_system_error="libbfd not found" ])
|
||||
AC_CHECK_LIB(opcodes, disassembler, [ HSDIS_LIBS="$HSDIS_LIBS -lopcodes" ], [ binutils_system_error="libopcodes not found" ])
|
||||
AC_CHECK_LIB(z, deflate, [ HSDIS_LIBS="$HSDIS_LIBS -lz" ], [ binutils_system_error="libz not found" ])
|
||||
# libiberty is not required on Ubuntu
|
||||
AC_CHECK_LIB(iberty, xmalloc, [ HSDIS_LIBS="$HSDIS_LIBS -liberty" ])
|
||||
AC_CHECK_LIB(sframe, frame, [ HSDIS_LIBS="$HSDIS_LIBS -lsframe" ], )
|
||||
HSDIS_CFLAGS="-DLIBARCH_$OPENJDK_TARGET_CPU_LEGACY_LIB"
|
||||
elif test "x$BINUTILS_INSTALL_DIR" != x; then
|
||||
disasm_header="\"$BINUTILS_INSTALL_DIR/include/dis-asm.h\""
|
||||
if (test -e $BINUTILS_INSTALL_DIR/lib/libbfd.a || \
|
||||
test -e $BINUTILS_INSTALL_DIR/lib64/libbfd.a) && \
|
||||
(test -e $BINUTILS_INSTALL_DIR/lib/libopcodes.a || \
|
||||
test -e $BINUTILS_INSTALL_DIR/lib64/libopcodes.a) && \
|
||||
(test -e $BINUTILS_INSTALL_DIR/lib/libiberty.a || \
|
||||
test -e $BINUTILS_INSTALL_DIR/lib64/libiberty.a || \
|
||||
test -e $BINUTILS_INSTALL_DIR/lib32/libiberty.a); then
|
||||
HSDIS_CFLAGS="-DLIBARCH_$OPENJDK_TARGET_CPU_LEGACY_LIB -I$BINUTILS_INSTALL_DIR/include"
|
||||
|
||||
# libiberty ignores --libdir and may be installed in $BINUTILS_INSTALL_DIR/lib, $BINUTILS_INSTALL_DIR/lib32
|
||||
# or $BINUTILS_INSTALL_DIR/lib64, depending on system setup
|
||||
LIBOPCODES_LIB=""
|
||||
LIBBFD_LIB=""
|
||||
LIBIBERTY_LIB=""
|
||||
if test -e $BINUTILS_INSTALL_DIR/lib/libbfd.a; then
|
||||
LIBBFD_LIB="$BINUTILS_INSTALL_DIR/lib/libbfd.a"
|
||||
else
|
||||
LIBBFD_LIB="$BINUTILS_INSTALL_DIR/lib64/libbfd.a"
|
||||
fi
|
||||
if test -e $BINUTILS_INSTALL_DIR/lib/libopcodes.a; then
|
||||
LIBOPCODES_LIB="$BINUTILS_INSTALL_DIR/lib/libopcodes.a"
|
||||
else
|
||||
LIBOPCODES_LIB="$BINUTILS_INSTALL_DIR/lib64/libopcodes.a"
|
||||
fi
|
||||
if test -e $BINUTILS_INSTALL_DIR/lib/libiberty.a; then
|
||||
LIBIBERTY_LIB="$BINUTILS_INSTALL_DIR/lib/libiberty.a"
|
||||
elif test -e $BINUTILS_INSTALL_DIR/lib32/libiberty.a; then
|
||||
LIBIBERTY_LIB="$BINUTILS_INSTALL_DIR/lib32/libiberty.a"
|
||||
else
|
||||
LIBIBERTY_LIB="$BINUTILS_INSTALL_DIR/lib64/libiberty.a"
|
||||
fi
|
||||
HSDIS_LIBS="$LIBBFD_LIB $LIBOPCODES_LIB $LIBIBERTY_LIB"
|
||||
# If we have libsframe add it.
|
||||
if test -e $BINUTILS_INSTALL_DIR/lib/libsframe.a; then
|
||||
HSDIS_LIBS="$HSDIS_LIBS $BINUTILS_INSTALL_DIR/lib/libsframe.a"
|
||||
elif test -e $BINUTILS_INSTALL_DIR/lib64/libsframe.a; then
|
||||
HSDIS_LIBS="$HSDIS_LIBS $BINUTILS_INSTALL_DIR/lib64/libsframe.a"
|
||||
fi
|
||||
AC_CHECK_LIB(z, deflate, [ HSDIS_LIBS="$HSDIS_LIBS -lz" ], AC_MSG_ERROR([libz not found]))
|
||||
else
|
||||
AC_MSG_ERROR(["$BINUTILS_INSTALL_DIR/lib[64] must contain libbfd.a, libopcodes.a and libiberty.a"])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([Checking binutils API])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include $disasm_header],[[init_disassemble_info(0, 0, 0, 0);]])],
|
||||
[
|
||||
AC_MSG_RESULT([New API])
|
||||
HSDIS_CFLAGS="$HSDIS_CFLAGS -DBINUTILS_NEW_API"
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([Old API])
|
||||
]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([for binutils to use with hsdis])
|
||||
case "x$BINUTILS_INSTALL_DIR" in
|
||||
xsystem)
|
||||
if test "x$OPENJDK_TARGET_OS" != xlinux; then
|
||||
AC_MSG_RESULT([invalid])
|
||||
AC_MSG_ERROR([binutils on system is supported for Linux only])
|
||||
elif test "x$binutils_system_error" = x; then
|
||||
AC_MSG_RESULT([system])
|
||||
HSDIS_CFLAGS="$HSDIS_CFLAGS -DSYSTEM_BINUTILS"
|
||||
else
|
||||
AC_MSG_RESULT([invalid])
|
||||
AC_MSG_ERROR([$binutils_system_error])
|
||||
fi
|
||||
;;
|
||||
x)
|
||||
AC_MSG_RESULT([missing])
|
||||
AC_MSG_NOTICE([--with-hsdis=binutils requires specifying a binutils installation.])
|
||||
AC_MSG_NOTICE([Download binutils from https://www.gnu.org/software/binutils and unpack it,])
|
||||
AC_MSG_NOTICE([and point --with-binutils-src to the resulting directory, or use])
|
||||
AC_MSG_NOTICE([--with-binutils to point to a pre-built binutils installation.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
;;
|
||||
*)
|
||||
if test "x$HSDIS_LIBS" != x; then
|
||||
AC_MSG_RESULT([$BINUTILS_INSTALL_DIR])
|
||||
else
|
||||
AC_MSG_RESULT([invalid])
|
||||
AC_MSG_ERROR([$BINUTILS_INSTALL_DIR does not contain a proper binutils installation])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Determine if hsdis should be built, and if so, with which backend.
|
||||
#
|
||||
AC_DEFUN_ONCE([LIB_SETUP_HSDIS],
|
||||
[
|
||||
AC_ARG_WITH([hsdis], [AS_HELP_STRING([--with-hsdis],
|
||||
[what hsdis backend to use ('none', 'capstone', 'llvm', 'binutils') @<:@none@:>@])])
|
||||
|
||||
UTIL_ARG_ENABLE(NAME: hsdis-bundling, DEFAULT: false,
|
||||
RESULT: ENABLE_HSDIS_BUNDLING,
|
||||
DESC: [enable bundling of hsdis to allow HotSpot disassembly out-of-the-box])
|
||||
|
||||
AC_MSG_CHECKING([what hsdis backend to use])
|
||||
|
||||
if test "x$with_hsdis" = xyes; then
|
||||
AC_MSG_ERROR([--with-hsdis must have a value])
|
||||
elif test "x$with_hsdis" = xnone || test "x$with_hsdis" = xno || test "x$with_hsdis" = x; then
|
||||
HSDIS_BACKEND=none
|
||||
AC_MSG_RESULT(['none', hsdis will not be built])
|
||||
elif test "x$with_hsdis" = xcapstone; then
|
||||
HSDIS_BACKEND=capstone
|
||||
AC_MSG_RESULT(['capstone'])
|
||||
|
||||
LIB_SETUP_HSDIS_CAPSTONE
|
||||
elif test "x$with_hsdis" = xllvm; then
|
||||
HSDIS_BACKEND=llvm
|
||||
AC_MSG_RESULT(['llvm'])
|
||||
|
||||
LIB_SETUP_HSDIS_LLVM
|
||||
elif test "x$with_hsdis" = xbinutils; then
|
||||
HSDIS_BACKEND=binutils
|
||||
AC_MSG_RESULT(['binutils'])
|
||||
|
||||
LIB_SETUP_HSDIS_BINUTILS
|
||||
else
|
||||
AC_MSG_RESULT([invalid])
|
||||
AC_MSG_ERROR([Incorrect hsdis backend "$with_hsdis"])
|
||||
fi
|
||||
|
||||
AC_SUBST(HSDIS_BACKEND)
|
||||
AC_SUBST(HSDIS_CFLAGS)
|
||||
AC_SUBST(HSDIS_LDFLAGS)
|
||||
AC_SUBST(HSDIS_LIBS)
|
||||
AC_SUBST(CAPSTONE_ARCH_AARCH64_NAME)
|
||||
|
||||
AC_MSG_CHECKING([if hsdis should be bundled])
|
||||
if test "x$ENABLE_HSDIS_BUNDLING" = "xtrue"; then
|
||||
if test "x$HSDIS_BACKEND" = xnone; then
|
||||
AC_MSG_RESULT([no, backend missing])
|
||||
AC_MSG_ERROR([hsdis-bundling requires a hsdis backend. Please set --with-hsdis=<backend>]);
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
if test "x$HSDIS_BACKEND" = xbinutils; then
|
||||
AC_MSG_WARN([The resulting build might not be redistributable. Seek legal advice before distributing.])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
AC_SUBST(ENABLE_HSDIS_BUNDLING)
|
||||
])
|
||||
87
make/autoconf/lib-std.m4
Normal file
87
make/autoconf/lib-std.m4
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2020, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Setup the standard C/C++ runtime libraries.
|
||||
#
|
||||
# Most importantly, determine if stdc++ should be linked statically or
|
||||
# dynamically.
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_STD_LIBS],
|
||||
[
|
||||
# statically link libstdc++ before C++ ABI is stabilized on Linux unless
|
||||
# dynamic build is configured on command line.
|
||||
AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=<static>,<dynamic>,<default>],
|
||||
[force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])],
|
||||
[
|
||||
if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \
|
||||
&& test "x$with_stdc__lib" != xdefault; then
|
||||
AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!])
|
||||
fi
|
||||
],
|
||||
[with_stdc__lib=default]
|
||||
)
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
# Test if stdc++ can be linked statically.
|
||||
AC_MSG_CHECKING([if static link of stdc++ is possible])
|
||||
STATIC_STDCXX_FLAGS="-static-libstdc++ -static-libgcc"
|
||||
AC_LANG_PUSH(C++)
|
||||
OLD_LIBS="$LIBS"
|
||||
LIBS="$STATIC_STDCXX_FLAGS"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
|
||||
[has_static_libstdcxx=yes],
|
||||
[has_static_libstdcxx=no])
|
||||
LIBS="$OLD_LIBS"
|
||||
AC_LANG_POP(C++)
|
||||
AC_MSG_RESULT([$has_static_libstdcxx])
|
||||
|
||||
if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then
|
||||
AC_MSG_ERROR([Static linking of libstdc++ was not possible!])
|
||||
fi
|
||||
|
||||
# If dynamic was requested, it's available since it would fail above otherwise.
|
||||
# If dynamic wasn't requested, go with static unless it isn't available.
|
||||
AC_MSG_CHECKING([how to link with libstdc++])
|
||||
if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno ; then
|
||||
AC_MSG_RESULT([dynamic])
|
||||
else
|
||||
LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
|
||||
JVM_LDFLAGS="$JVM_LDFLAGS $STATIC_STDCXX_FLAGS"
|
||||
ADLC_LDFLAGS="$ADLC_LDFLAGS $STATIC_STDCXX_FLAGS"
|
||||
# Ideally, we should test stdc++ for the BUILD toolchain separately. For now
|
||||
# just use the same setting as for the TARGET toolchain.
|
||||
OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS $STATIC_STDCXX_FLAGS"
|
||||
AC_MSG_RESULT([static])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBCXX)
|
||||
|
||||
# Setup Windows runtime dlls
|
||||
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
|
||||
TOOLCHAIN_SETUP_VS_RUNTIME_DLLS
|
||||
fi
|
||||
])
|
||||
383
make/autoconf/lib-tests.m4
Normal file
383
make/autoconf/lib-tests.m4
Normal file
|
|
@ -0,0 +1,383 @@
|
|||
#
|
||||
# Copyright (c) 2018, 2026, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Setup libraries and functionalities needed to test the JDK.
|
||||
################################################################################
|
||||
|
||||
# Minimum supported versions
|
||||
JTREG_MINIMUM_VERSION=8.2.1
|
||||
GTEST_MINIMUM_VERSION=1.14.0
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Setup and check for gtest framework source files
|
||||
#
|
||||
AC_DEFUN_ONCE([LIB_TESTS_SETUP_GTEST],
|
||||
[
|
||||
AC_ARG_WITH(gtest, [AS_HELP_STRING([--with-gtest],
|
||||
[specify prefix directory for the gtest framework])])
|
||||
|
||||
if test "x${with_gtest}" != x; then
|
||||
AC_MSG_CHECKING([for gtest])
|
||||
if test "x${with_gtest}" = xno; then
|
||||
AC_MSG_RESULT([no, disabled])
|
||||
elif test "x${with_gtest}" = xyes; then
|
||||
AC_MSG_RESULT([no, error])
|
||||
AC_MSG_ERROR([--with-gtest must have a value])
|
||||
else
|
||||
if ! test -s "${with_gtest}/googletest/include/gtest/gtest.h"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can't find 'googletest/include/gtest/gtest.h' under ${with_gtest} given with the --with-gtest option.])
|
||||
elif ! test -s "${with_gtest}/googlemock/include/gmock/gmock.h"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can't find 'googlemock/include/gmock/gmock.h' under ${with_gtest} given with the --with-gtest option.])
|
||||
else
|
||||
GTEST_FRAMEWORK_SRC=$with_gtest
|
||||
AC_MSG_RESULT([$GTEST_FRAMEWORK_SRC])
|
||||
UTIL_FIXUP_PATH([GTEST_FRAMEWORK_SRC])
|
||||
|
||||
# Verify that the version is the required one.
|
||||
# This is a simplified version of TOOLCHAIN_CHECK_COMPILER_VERSION
|
||||
gtest_version="`$GREP GOOGLETEST_VERSION $GTEST_FRAMEWORK_SRC/CMakeLists.txt | $SED -e 's/set(GOOGLETEST_VERSION \(.*\))/\1/'`"
|
||||
comparable_actual_version=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$gtest_version"`
|
||||
comparable_minimum_version=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$GTEST_MINIMUM_VERSION"`
|
||||
if test $comparable_actual_version -lt $comparable_minimum_version ; then
|
||||
AC_MSG_ERROR([gtest version is too old, at least version $GTEST_MINIMUM_VERSION is required])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(GTEST_FRAMEWORK_SRC)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Setup and check the Java Microbenchmark Harness
|
||||
#
|
||||
AC_DEFUN_ONCE([LIB_TESTS_SETUP_JMH],
|
||||
[
|
||||
AC_ARG_WITH(jmh, [AS_HELP_STRING([--with-jmh],
|
||||
[Java Microbenchmark Harness for building the OpenJDK Microbenchmark Suite])])
|
||||
|
||||
AC_MSG_CHECKING([for jmh (Java Microbenchmark Harness)])
|
||||
if test "x$with_jmh" = xno || test "x$with_jmh" = x; then
|
||||
AC_MSG_RESULT([no, disabled])
|
||||
elif test "x$with_jmh" = xyes; then
|
||||
AC_MSG_RESULT([no, error])
|
||||
AC_MSG_ERROR([--with-jmh requires a directory containing all jars needed by JMH])
|
||||
else
|
||||
# Path specified
|
||||
JMH_HOME="$with_jmh"
|
||||
if test ! -d [$JMH_HOME]; then
|
||||
AC_MSG_RESULT([no, error])
|
||||
AC_MSG_ERROR([$JMH_HOME does not exist or is not a directory])
|
||||
fi
|
||||
AC_MSG_RESULT([yes, $JMH_HOME])
|
||||
|
||||
UTIL_FIXUP_PATH([JMH_HOME])
|
||||
|
||||
jar_names="jmh-core jmh-generator-annprocess jopt-simple commons-math3"
|
||||
for jar in $jar_names; do
|
||||
found_jar_files=$($ECHO $(ls $JMH_HOME/$jar-*.jar 2> /dev/null))
|
||||
|
||||
if test "x$found_jar_files" = x; then
|
||||
AC_MSG_ERROR([--with-jmh does not contain $jar-*.jar])
|
||||
elif ! test -e "$found_jar_files"; then
|
||||
AC_MSG_ERROR([--with-jmh contain multiple $jar-*.jar: $found_jar_files])
|
||||
fi
|
||||
|
||||
found_jar_var_name=found_${jar//-/_}
|
||||
eval $found_jar_var_name='"'$found_jar_files'"'
|
||||
done
|
||||
|
||||
JMH_CORE_JAR=$found_jmh_core
|
||||
JMH_GENERATOR_JAR=$found_jmh_generator_annprocess
|
||||
JMH_JOPT_SIMPLE_JAR=$found_jopt_simple
|
||||
JMH_COMMONS_MATH_JAR=$found_commons_math3
|
||||
|
||||
|
||||
if [ [[ "$JMH_CORE_JAR" =~ jmh-core-(.*)\.jar$ ]] ] ; then
|
||||
JMH_VERSION=${BASH_REMATCH[[1]]}
|
||||
else
|
||||
JMH_VERSION=unknown
|
||||
fi
|
||||
|
||||
AC_MSG_NOTICE([JMH core version: $JMH_VERSION])
|
||||
fi
|
||||
|
||||
AC_SUBST(JMH_CORE_JAR)
|
||||
AC_SUBST(JMH_GENERATOR_JAR)
|
||||
AC_SUBST(JMH_JOPT_SIMPLE_JAR)
|
||||
AC_SUBST(JMH_COMMONS_MATH_JAR)
|
||||
AC_SUBST(JMH_VERSION)
|
||||
])
|
||||
|
||||
# Setup the JTReg Regression Test Harness.
|
||||
AC_DEFUN_ONCE([LIB_TESTS_SETUP_JTREG],
|
||||
[
|
||||
AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
|
||||
[Regression Test Harness @<:@probed@:>@])])
|
||||
|
||||
if test "x$with_jtreg" = xno; then
|
||||
# jtreg disabled
|
||||
AC_MSG_CHECKING([for jtreg test harness])
|
||||
AC_MSG_RESULT([no, disabled])
|
||||
elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
|
||||
if test -d "$with_jtreg"; then
|
||||
# An explicit path is specified, use it.
|
||||
JT_HOME="$with_jtreg"
|
||||
else
|
||||
case "$with_jtreg" in
|
||||
*.zip )
|
||||
JTREG_SUPPORT_DIR=$CONFIGURESUPPORT_OUTPUTDIR/jtreg
|
||||
$RM -rf $JTREG_SUPPORT_DIR
|
||||
$MKDIR -p $JTREG_SUPPORT_DIR
|
||||
$UNZIP -qq -d $JTREG_SUPPORT_DIR $with_jtreg
|
||||
|
||||
# Try to find jtreg to determine JT_HOME path
|
||||
JTREG_PATH=`$FIND $JTREG_SUPPORT_DIR | $GREP "/bin/jtreg"`
|
||||
if test "x$JTREG_PATH" != x; then
|
||||
JT_HOME=$($DIRNAME $($DIRNAME $JTREG_PATH))
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
UTIL_FIXUP_PATH([JT_HOME])
|
||||
if test ! -d "$JT_HOME"; then
|
||||
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not exist])
|
||||
fi
|
||||
|
||||
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
|
||||
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg is not a valid jtreg home])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for jtreg test harness])
|
||||
AC_MSG_RESULT([$JT_HOME])
|
||||
else
|
||||
# Try to locate jtreg using the JT_HOME environment variable
|
||||
if test "x$JT_HOME" != x; then
|
||||
# JT_HOME set in environment, use it
|
||||
if test ! -d "$JT_HOME"; then
|
||||
AC_MSG_WARN([Ignoring JT_HOME pointing to invalid directory: $JT_HOME])
|
||||
JT_HOME=
|
||||
else
|
||||
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
|
||||
AC_MSG_WARN([Ignoring JT_HOME which is not a valid jtreg home: $JT_HOME])
|
||||
JT_HOME=
|
||||
else
|
||||
AC_MSG_NOTICE([Located jtreg using JT_HOME from environment])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$JT_HOME" = x; then
|
||||
# JT_HOME is not set in environment, or was deemed invalid.
|
||||
# Try to find jtreg on path
|
||||
UTIL_LOOKUP_PROGS(JTREGEXE, jtreg)
|
||||
if test "x$JTREGEXE" != x; then
|
||||
# That's good, now try to derive JT_HOME
|
||||
JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)`
|
||||
if test ! -e "$JT_HOME/lib/jtreg.jar"; then
|
||||
AC_MSG_WARN([Ignoring jtreg from path since a valid jtreg home cannot be found])
|
||||
JT_HOME=
|
||||
else
|
||||
AC_MSG_NOTICE([Located jtreg using jtreg executable in path])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for jtreg test harness])
|
||||
if test "x$JT_HOME" != x; then
|
||||
AC_MSG_RESULT([$JT_HOME])
|
||||
else
|
||||
AC_MSG_RESULT([no, not found])
|
||||
|
||||
if test "x$with_jtreg" = xyes; then
|
||||
AC_MSG_ERROR([--with-jtreg was specified, but no jtreg found.])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
UTIL_FIXUP_PATH(JT_HOME)
|
||||
AC_SUBST(JT_HOME)
|
||||
|
||||
# Specify a JDK for running jtreg. Defaults to the BOOT_JDK.
|
||||
AC_ARG_WITH(jtreg-jdk, [AS_HELP_STRING([--with-jdk],
|
||||
[path to JDK for running jtreg @<:@BOOT_JDK@:>@])])
|
||||
|
||||
AC_MSG_CHECKING([for jtreg jdk])
|
||||
if test "x${with_jtreg_jdk}" != x; then
|
||||
if test "x${with_jtreg_jdk}" = xno; then
|
||||
AC_MSG_RESULT([no, jtreg jdk not specified])
|
||||
elif test "x${with_jtreg_jdk}" = xyes; then
|
||||
AC_MSG_RESULT([not specified])
|
||||
AC_MSG_ERROR([--with-jtreg-jdk needs a value])
|
||||
else
|
||||
JTREG_JDK="${with_jtreg_jdk}"
|
||||
AC_MSG_RESULT([$JTREG_JDK])
|
||||
UTIL_FIXUP_PATH(JTREG_JDK)
|
||||
if test ! -f "$JTREG_JDK/bin/java"; then
|
||||
AC_MSG_ERROR([Could not find jtreg java at $JTREG_JDK/bin/java])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
JTREG_JDK="${BOOT_JDK}"
|
||||
AC_MSG_RESULT([no, using BOOT_JDK])
|
||||
fi
|
||||
|
||||
UTIL_FIXUP_PATH(JTREG_JDK)
|
||||
AC_SUBST([JTREG_JDK])
|
||||
# For use in the configure script
|
||||
JTREG_JAVA="$FIXPATH $JTREG_JDK/bin/java"
|
||||
|
||||
# Verify jtreg version
|
||||
if test "x$JT_HOME" != x; then
|
||||
AC_MSG_CHECKING([jtreg jar existence])
|
||||
if test ! -f "$JT_HOME/lib/jtreg.jar"; then
|
||||
AC_MSG_ERROR([Could not find jtreg jar at $JT_HOME/lib/jtreg.jar])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([jtreg version number])
|
||||
# jtreg -version looks like this: "jtreg 6.1+1-19"
|
||||
# Extract actual version part ("6.1" in this case)
|
||||
jtreg_version_full=$($JTREG_JAVA -jar $JT_HOME/lib/jtreg.jar -version | $HEAD -n 1 | $CUT -d ' ' -f 2)
|
||||
|
||||
jtreg_version=${jtreg_version_full/%+*}
|
||||
AC_MSG_RESULT([$jtreg_version])
|
||||
|
||||
# This is a simplified version of TOOLCHAIN_CHECK_COMPILER_VERSION
|
||||
comparable_actual_version=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$jtreg_version"`
|
||||
comparable_minimum_version=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$JTREG_MINIMUM_VERSION"`
|
||||
if test $comparable_actual_version -lt $comparable_minimum_version ; then
|
||||
AC_MSG_ERROR([jtreg version is too old, at least version $JTREG_MINIMUM_VERSION is required])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
# Setup the JIB dependency resolver
|
||||
AC_DEFUN_ONCE([LIB_TESTS_SETUP_JIB],
|
||||
[
|
||||
AC_ARG_WITH(jib, [AS_HELP_STRING([--with-jib],
|
||||
[Jib dependency management tool @<:@not used@:>@])])
|
||||
|
||||
if test "x$with_jib" = xno || test "x$with_jib" = x; then
|
||||
# jib disabled
|
||||
AC_MSG_CHECKING([for jib])
|
||||
AC_MSG_RESULT(no)
|
||||
elif test "x$with_jib" = xyes; then
|
||||
AC_MSG_ERROR([Must supply a value to --with-jib])
|
||||
else
|
||||
JIB_HOME="${with_jib}"
|
||||
AC_MSG_CHECKING([for jib])
|
||||
AC_MSG_RESULT(${JIB_HOME})
|
||||
if test ! -d "${JIB_HOME}"; then
|
||||
AC_MSG_ERROR([--with-jib must be a directory])
|
||||
fi
|
||||
JIB_JAR=$(ls ${JIB_HOME}/lib/jib-*.jar)
|
||||
if test ! -f "${JIB_JAR}"; then
|
||||
AC_MSG_ERROR([Could not find jib jar file in ${JIB_HOME}])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(JIB_HOME)
|
||||
])
|
||||
|
||||
# Setup the tidy html checker
|
||||
AC_DEFUN_ONCE([LIB_TESTS_SETUP_TIDY],
|
||||
[
|
||||
UTIL_LOOKUP_PROGS(TIDY, tidy)
|
||||
|
||||
if test "x$TIDY" != x; then
|
||||
AC_MSG_CHECKING([if tidy is working properly])
|
||||
tidy_output=`$TIDY --version 2>&1`
|
||||
if ! $ECHO "$tidy_output" | $GREP -q "HTML Tidy" 2>&1 > /dev/null; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_NOTICE([$TIDY is not a valid tidy executable and will be ignored. Output from --version: $tidy_output])
|
||||
TIDY=
|
||||
elif ! $ECHO "$tidy_output" | $GREP -q "version" 2>&1 > /dev/null; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_NOTICE([$TIDY is missing a proper version number and will be ignored. Output from --version: $tidy_output])
|
||||
TIDY=
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_MSG_CHECKING([for tidy version])
|
||||
tidy_version=`$ECHO $tidy_output | $SED -e 's/.*version //g'`
|
||||
AC_MSG_RESULT([$tidy_version])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(TIDY)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Check if building of the jtreg failure handler should be enabled.
|
||||
#
|
||||
AC_DEFUN_ONCE([LIB_TESTS_ENABLE_DISABLE_FAILURE_HANDLER],
|
||||
[
|
||||
if test "x$BUILD_ENV" = "xci"; then
|
||||
BUILD_FAILURE_HANDLER_DEFAULT=auto
|
||||
else
|
||||
BUILD_FAILURE_HANDLER_DEFAULT=false
|
||||
fi
|
||||
|
||||
UTIL_ARG_ENABLE(NAME: jtreg-failure-handler, DEFAULT: $BUILD_FAILURE_HANDLER_DEFAULT,
|
||||
RESULT: BUILD_FAILURE_HANDLER,
|
||||
DESC: [enable building of the jtreg failure handler],
|
||||
DEFAULT_DESC: [enabled if jtreg is present and build env is CI],
|
||||
CHECKING_MSG: [if the jtreg failure handler should be built],
|
||||
CHECK_AVAILABLE: [
|
||||
AC_MSG_CHECKING([if the jtreg failure handler is available])
|
||||
if test "x$JT_HOME" != "x"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AVAILABLE=false
|
||||
AC_MSG_RESULT([no (jtreg not present)])
|
||||
fi
|
||||
])
|
||||
AC_SUBST(BUILD_FAILURE_HANDLER)
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([LIB_TESTS_ENABLE_DISABLE_JTREG_TEST_THREAD_FACTORY],
|
||||
[
|
||||
UTIL_ARG_ENABLE(NAME: jtreg-test-thread-factory, DEFAULT: auto,
|
||||
RESULT: BUILD_JTREG_TEST_THREAD_FACTORY,
|
||||
DESC: [enable building of the jtreg test thread factory],
|
||||
DEFAULT_DESC: [enabled if jtreg is present],
|
||||
CHECKING_MSG: [if the jtreg test thread factory should be built],
|
||||
CHECK_AVAILABLE: [
|
||||
AC_MSG_CHECKING([if the jtreg test thread factory is available])
|
||||
if test "x$JT_HOME" != "x"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AVAILABLE=false
|
||||
AC_MSG_RESULT([no (jtreg not present)])
|
||||
fi
|
||||
])
|
||||
AC_SUBST(BUILD_JTREG_TEST_THREAD_FACTORY)
|
||||
])
|
||||
135
make/autoconf/lib-x11.m4
Normal file
135
make/autoconf/lib-x11.m4
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2024, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Setup X11 Windows system
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_X11],
|
||||
[
|
||||
if test "x$NEEDS_LIB_X11" = xfalse; then
|
||||
if (test "x${with_x}" != x && test "x${with_x}" != xno); then
|
||||
AC_MSG_WARN([X11 is not used, so --with-x is ignored])
|
||||
fi
|
||||
X_CFLAGS=
|
||||
X_LIBS=
|
||||
else
|
||||
x_libraries_orig="$x_libraries"
|
||||
|
||||
if test "x${with_x}" = xno; then
|
||||
AC_MSG_ERROR([It is not possible to disable the use of X11. Remove the --without-x option.])
|
||||
fi
|
||||
|
||||
if test "x${with_x}" != x && test "x${with_x}" != xyes; then
|
||||
# The user has specified a X11 base directory. Use it for includes and
|
||||
# libraries, unless explicitly overridden.
|
||||
if test "x$x_includes" = xNONE; then
|
||||
x_includes="${with_x}/include"
|
||||
fi
|
||||
if test "x$x_libraries" = xNONE; then
|
||||
x_libraries="${with_x}/lib"
|
||||
x_libraries_orig="$x_libraries"
|
||||
fi
|
||||
else
|
||||
# Check if the user has specified sysroot, but not --with-x, --x-includes or --x-libraries.
|
||||
# Make a simple check for the libraries at the sysroot, and setup --x-includes and
|
||||
# --x-libraries for the sysroot, if that seems to be correct.
|
||||
if test "x$SYSROOT" != "x"; then
|
||||
if test "x$x_includes" = xNONE; then
|
||||
if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
|
||||
x_includes="$SYSROOT/usr/X11R6/include"
|
||||
elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
|
||||
x_includes="$SYSROOT/usr/include"
|
||||
fi
|
||||
fi
|
||||
if test "x$x_libraries" = xNONE; then
|
||||
if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/X11R6/lib"
|
||||
elif test -f "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
x_libraries="$SYSROOT/usr/lib64"
|
||||
elif test -f "$SYSROOT/usr/lib/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/lib"
|
||||
elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI"
|
||||
elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Now let autoconf do it's magic
|
||||
AC_PATH_X
|
||||
AC_PATH_XTRA
|
||||
|
||||
# AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
|
||||
# this doesn't make sense so we remove it; same for sysroot (devkit).
|
||||
if test "x$COMPILE_TYPE" = xcross || (test "x$SYSROOT" != "x" && test "x$x_libraries_orig" = xNONE); then
|
||||
X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'`
|
||||
fi
|
||||
|
||||
if test "x$no_x" = xyes; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([x11])
|
||||
AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
|
||||
fi
|
||||
|
||||
AC_LANG_PUSH(C)
|
||||
OLD_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
# There is no Xrandr extension on AIX. Code is duplicated to avoid autoconf
|
||||
# 2.71+ warning "AC_CHECK_HEADERS: you should use literals"
|
||||
X_CFLAGS="$X_CFLAGS -DNO_XRANDR"
|
||||
AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
|
||||
[X11_HEADERS_OK=yes],
|
||||
[X11_HEADERS_OK=no; break],
|
||||
[
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xutil.h>
|
||||
]
|
||||
)
|
||||
else
|
||||
AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h X11/extensions/Xrandr.h],
|
||||
[X11_HEADERS_OK=yes],
|
||||
[X11_HEADERS_OK=no; break],
|
||||
[
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xutil.h>
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
if test "x$X11_HEADERS_OK" = xno; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([x11])
|
||||
AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h Xrandr.h XTest.h Intrinsic.h). $HELP_MSG])
|
||||
fi
|
||||
|
||||
CFLAGS="$OLD_CFLAGS"
|
||||
AC_LANG_POP(C)
|
||||
fi # NEEDS_LIB_X11
|
||||
|
||||
AC_SUBST(X_CFLAGS)
|
||||
AC_SUBST(X_LIBS)
|
||||
])
|
||||
215
make/autoconf/libraries.m4
Normal file
215
make/autoconf/libraries.m4
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
# Major library component reside in separate files.
|
||||
m4_include([lib-alsa.m4])
|
||||
m4_include([lib-bundled.m4])
|
||||
m4_include([lib-cups.m4])
|
||||
m4_include([lib-ffi.m4])
|
||||
m4_include([lib-fontconfig.m4])
|
||||
m4_include([lib-freetype.m4])
|
||||
m4_include([lib-hsdis.m4])
|
||||
m4_include([lib-std.m4])
|
||||
m4_include([lib-x11.m4])
|
||||
|
||||
m4_include([lib-tests.m4])
|
||||
|
||||
################################################################################
|
||||
# Determine which libraries are needed for this configuration
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
|
||||
[
|
||||
# Check if X11 is needed
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows ||
|
||||
test "x$OPENJDK_TARGET_OS" = xmacosx ||
|
||||
test "x$ENABLE_HEADLESS_ONLY" = xtrue; then
|
||||
NEEDS_LIB_X11=false
|
||||
else
|
||||
# All other instances need X11 for libawt.
|
||||
NEEDS_LIB_X11=true
|
||||
fi
|
||||
|
||||
# Check if fontconfig is needed
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
# No fontconfig support on windows or macosx
|
||||
NEEDS_LIB_FONTCONFIG=false
|
||||
else
|
||||
# All other instances need fontconfig, even if building headless only,
|
||||
# libawt still needs fontconfig headers.
|
||||
NEEDS_LIB_FONTCONFIG=true
|
||||
fi
|
||||
|
||||
# Check if cups is needed
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
||||
# Windows have a separate print system
|
||||
NEEDS_LIB_CUPS=false
|
||||
else
|
||||
NEEDS_LIB_CUPS=true
|
||||
fi
|
||||
|
||||
# A custom hook may have set this already
|
||||
if test "x$NEEDS_LIB_FREETYPE" = "x"; then
|
||||
NEEDS_LIB_FREETYPE=true
|
||||
fi
|
||||
|
||||
# Check if alsa is needed
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
NEEDS_LIB_ALSA=true
|
||||
else
|
||||
NEEDS_LIB_ALSA=false
|
||||
fi
|
||||
|
||||
# Check if ffi is needed
|
||||
if HOTSPOT_CHECK_JVM_VARIANT(zero) || test "x$ENABLE_FALLBACK_LINKER" = "xtrue"; then
|
||||
NEEDS_LIB_FFI=true
|
||||
else
|
||||
NEEDS_LIB_FFI=false
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup BASIC_JVM_LIBS that can be different depending on build/target platform
|
||||
################################################################################
|
||||
AC_DEFUN([LIB_SETUP_JVM_LIBS],
|
||||
[
|
||||
# Atomic library
|
||||
# 32-bit platforms needs fallback library for 8-byte atomic ops on Zero
|
||||
if HOTSPOT_CHECK_JVM_VARIANT(zero); then
|
||||
if test "x$OPENJDK_$1_OS" = xlinux &&
|
||||
test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
|
||||
BASIC_JVM_LIBS_$1="$BASIC_JVM_LIBS_$1 -latomic"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Parse library options, and setup needed libraries
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
|
||||
[
|
||||
LIB_SETUP_STD_LIBS
|
||||
|
||||
LIB_SETUP_ALSA
|
||||
LIB_SETUP_BUNDLED_LIBS
|
||||
LIB_SETUP_CUPS
|
||||
LIB_SETUP_FONTCONFIG
|
||||
LIB_SETUP_FREETYPE
|
||||
LIB_SETUP_HSDIS
|
||||
LIB_SETUP_LIBFFI
|
||||
LIB_SETUP_MISC_LIBS
|
||||
LIB_SETUP_X11
|
||||
|
||||
LIB_TESTS_SETUP_GTEST
|
||||
|
||||
# Math library
|
||||
BASIC_JVM_LIBS="$LIBM"
|
||||
|
||||
# Dynamic loading library
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBDL"
|
||||
fi
|
||||
|
||||
# Threading library
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBPTHREAD"
|
||||
fi
|
||||
|
||||
# librt - for timers (timer_* functions)
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lrt"
|
||||
fi
|
||||
|
||||
# perfstat lib
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lperfstat"
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
||||
BASIC_JVM_LIBS="$BASIC_JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
|
||||
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib powrprof.lib uuid.lib \
|
||||
ws2_32.lib winmm.lib version.lib psapi.lib"
|
||||
fi
|
||||
LIB_SETUP_JVM_LIBS(BUILD)
|
||||
LIB_SETUP_JVM_LIBS(TARGET)
|
||||
|
||||
JVM_LIBS="$BASIC_JVM_LIBS $BASIC_JVM_LIBS_TARGET"
|
||||
OPENJDK_BUILD_JDKLIB_LIBS=""
|
||||
OPENJDK_BUILD_JVM_LIBS="$BASIC_JVM_LIBS $BASIC_JVM_LIBS_BUILD"
|
||||
|
||||
AC_SUBST(JVM_LIBS)
|
||||
AC_SUBST(OPENJDK_BUILD_JDKLIB_LIBS)
|
||||
AC_SUBST(OPENJDK_BUILD_JVM_LIBS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup various libraries, typically small system libraries
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
|
||||
[
|
||||
# Setup libm (the maths library)
|
||||
if test "x$OPENJDK_TARGET_OS" != "xwindows"; then
|
||||
AC_CHECK_LIB(m, cos, [], [
|
||||
AC_MSG_NOTICE([Maths library was not found])
|
||||
])
|
||||
LIBM="-lm"
|
||||
else
|
||||
LIBM=""
|
||||
fi
|
||||
AC_SUBST(LIBM)
|
||||
|
||||
# Setup libdl (for dynamic library loading)
|
||||
save_LIBS="$LIBS"
|
||||
LIBS=""
|
||||
AC_CHECK_LIB(dl, dlopen)
|
||||
LIBDL="$LIBS"
|
||||
AC_SUBST(LIBDL)
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
# Setup posix pthread support
|
||||
if test "x$OPENJDK_TARGET_OS" != "xwindows"; then
|
||||
LIBPTHREAD="-lpthread"
|
||||
else
|
||||
LIBPTHREAD=""
|
||||
fi
|
||||
AC_SUBST(LIBPTHREAD)
|
||||
|
||||
# Setup libiconv flags and library
|
||||
if test "x$OPENJDK_TARGET_OS" == "xaix" || test "x$OPENJDK_TARGET_OS" == "xmacosx"; then
|
||||
ICONV_CFLAGS=
|
||||
ICONV_LDFLAGS=
|
||||
ICONV_LIBS=-liconv
|
||||
else
|
||||
ICONV_CFLAGS=
|
||||
ICONV_LDFLAGS=
|
||||
ICONV_LIBS=
|
||||
fi
|
||||
AC_SUBST(ICONV_CFLAGS)
|
||||
AC_SUBST(ICONV_LDFLAGS)
|
||||
AC_SUBST(ICONV_LIBS)
|
||||
|
||||
# Control if libzip can use mmap. Available for purposes of overriding.
|
||||
LIBZIP_CAN_USE_MMAP=true
|
||||
AC_SUBST(LIBZIP_CAN_USE_MMAP)
|
||||
])
|
||||
753
make/autoconf/platform.m4
Normal file
753
make/autoconf/platform.m4
Normal file
|
|
@ -0,0 +1,753 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2026, 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.
|
||||
#
|
||||
|
||||
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
|
||||
# Converts autoconf style CPU name to OpenJDK style, into
|
||||
# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
|
||||
AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
|
||||
[
|
||||
# First argument is the cpu name from the trip/quad
|
||||
case "$1" in
|
||||
x86_64*x32)
|
||||
VAR_CPU=x32
|
||||
VAR_CPU_ARCH=x86
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
x86_64)
|
||||
VAR_CPU=x86_64
|
||||
VAR_CPU_ARCH=x86
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
i?86)
|
||||
VAR_CPU=x86
|
||||
VAR_CPU_ARCH=x86
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
alpha*)
|
||||
VAR_CPU=alpha
|
||||
VAR_CPU_ARCH=alpha
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
arm*)
|
||||
VAR_CPU=arm
|
||||
VAR_CPU_ARCH=arm
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
aarch64)
|
||||
VAR_CPU=aarch64
|
||||
VAR_CPU_ARCH=aarch64
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
ia64)
|
||||
VAR_CPU=ia64
|
||||
VAR_CPU_ARCH=ia64
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
loongarch64)
|
||||
VAR_CPU=loongarch64
|
||||
VAR_CPU_ARCH=loongarch
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
m68k)
|
||||
VAR_CPU=m68k
|
||||
VAR_CPU_ARCH=m68k
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
mips)
|
||||
VAR_CPU=mips
|
||||
VAR_CPU_ARCH=mips
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
mipsel)
|
||||
VAR_CPU=mipsel
|
||||
VAR_CPU_ARCH=mipsel
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
mips64)
|
||||
VAR_CPU=mips64
|
||||
VAR_CPU_ARCH=mips64
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
mips64el)
|
||||
VAR_CPU=mips64el
|
||||
VAR_CPU_ARCH=mips64el
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
powerpc)
|
||||
VAR_CPU=ppc
|
||||
VAR_CPU_ARCH=ppc
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
powerpc64)
|
||||
VAR_CPU=ppc64
|
||||
VAR_CPU_ARCH=ppc
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
powerpc64le)
|
||||
VAR_CPU=ppc64le
|
||||
VAR_CPU_ARCH=ppc
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
riscv32)
|
||||
VAR_CPU=riscv32
|
||||
VAR_CPU_ARCH=riscv
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
riscv64)
|
||||
VAR_CPU=riscv64
|
||||
VAR_CPU_ARCH=riscv
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
s390)
|
||||
VAR_CPU=s390
|
||||
VAR_CPU_ARCH=s390
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
s390x)
|
||||
VAR_CPU=s390x
|
||||
VAR_CPU_ARCH=s390
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
sh*eb)
|
||||
VAR_CPU=sh
|
||||
VAR_CPU_ARCH=sh
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
sh*)
|
||||
VAR_CPU=sh
|
||||
VAR_CPU_ARCH=sh
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=little
|
||||
;;
|
||||
sparc)
|
||||
VAR_CPU=sparc
|
||||
VAR_CPU_ARCH=sparc
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
sparcv9|sparc64)
|
||||
VAR_CPU=sparcv9
|
||||
VAR_CPU_ARCH=sparc
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
sparc)
|
||||
VAR_CPU=sparc
|
||||
VAR_CPU_ARCH=sparc
|
||||
VAR_CPU_BITS=32
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
sparcv9|sparc64)
|
||||
VAR_CPU=sparcv9
|
||||
VAR_CPU_ARCH=sparc
|
||||
VAR_CPU_BITS=64
|
||||
VAR_CPU_ENDIAN=big
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([unsupported cpu $1])
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
|
||||
# Converts autoconf style OS name to OpenJDK style, into
|
||||
# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV.
|
||||
AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
|
||||
[
|
||||
case "$1" in
|
||||
*linux*)
|
||||
VAR_OS=linux
|
||||
VAR_OS_TYPE=unix
|
||||
;;
|
||||
*darwin*)
|
||||
VAR_OS=macosx
|
||||
VAR_OS_TYPE=unix
|
||||
;;
|
||||
*bsd*)
|
||||
VAR_OS=bsd
|
||||
VAR_OS_TYPE=unix
|
||||
;;
|
||||
*cygwin*)
|
||||
VAR_OS=windows
|
||||
VAR_OS_ENV=windows.cygwin
|
||||
;;
|
||||
*wsl*)
|
||||
VAR_OS=windows
|
||||
VAR_OS_ENV=windows.wsl
|
||||
;;
|
||||
*msys* | *mingw*)
|
||||
VAR_OS=windows
|
||||
VAR_OS_ENV=windows.msys2
|
||||
;;
|
||||
*aix*)
|
||||
VAR_OS=aix
|
||||
VAR_OS_TYPE=unix
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([unsupported operating system $1])
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
|
||||
# Converts autoconf style OS name to OpenJDK style, into
|
||||
# VAR_LIBC.
|
||||
AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_LIBC],
|
||||
[
|
||||
case "$1" in
|
||||
*linux*-musl)
|
||||
VAR_LIBC=musl
|
||||
;;
|
||||
*linux*-gnu)
|
||||
VAR_LIBC=gnu
|
||||
;;
|
||||
*)
|
||||
VAR_LIBC=default
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
|
||||
# Converts autoconf style OS name to OpenJDK style, into
|
||||
# VAR_ABI.
|
||||
AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_ABI],
|
||||
[
|
||||
case "$1" in
|
||||
*linux*-musl)
|
||||
VAR_ABI=musl
|
||||
;;
|
||||
*linux*-gnu)
|
||||
VAR_ABI=gnu
|
||||
;;
|
||||
*linux*-gnueabi)
|
||||
VAR_ABI=gnueabi
|
||||
;;
|
||||
*linux*-gnueabihf)
|
||||
VAR_ABI=gnueabihf
|
||||
;;
|
||||
*linux*-gnuabi64)
|
||||
VAR_ABI=gnuabi64
|
||||
;;
|
||||
*)
|
||||
VAR_ABI=default
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Expects $host_os $host_cpu $build_os and $build_cpu
|
||||
# and $with_target_bits to have been setup!
|
||||
#
|
||||
# Translate the standard triplet(quadruplet) definition
|
||||
# of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
|
||||
# OPENJDK_BUILD_OS, etc.
|
||||
AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
|
||||
[
|
||||
# Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME
|
||||
# (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME
|
||||
# Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build,
|
||||
# but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME.
|
||||
OPENJDK_TARGET_AUTOCONF_NAME="$host"
|
||||
OPENJDK_BUILD_AUTOCONF_NAME="$build"
|
||||
AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME)
|
||||
AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME)
|
||||
|
||||
# Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU/LIBC variables.
|
||||
PLATFORM_EXTRACT_VARS_FROM_OS($build_os)
|
||||
PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu)
|
||||
PLATFORM_EXTRACT_VARS_FROM_LIBC($build_os)
|
||||
PLATFORM_EXTRACT_VARS_FROM_ABI($build_os)
|
||||
# ..and setup our own variables. (Do this explicitly to facilitate searching)
|
||||
OPENJDK_BUILD_OS="$VAR_OS"
|
||||
if test "x$VAR_OS_TYPE" != x; then
|
||||
OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE"
|
||||
else
|
||||
OPENJDK_BUILD_OS_TYPE="$VAR_OS"
|
||||
fi
|
||||
if test "x$VAR_OS_ENV" != x; then
|
||||
OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV"
|
||||
else
|
||||
OPENJDK_BUILD_OS_ENV="$VAR_OS"
|
||||
fi
|
||||
# Special handling for MSYS2 that reports a Cygwin triplet as the default host triplet.
|
||||
case `uname` in
|
||||
MSYS*)
|
||||
OPENJDK_BUILD_OS_ENV=windows.msys2
|
||||
;;
|
||||
esac
|
||||
OPENJDK_BUILD_CPU="$VAR_CPU"
|
||||
OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
|
||||
OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
|
||||
OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
|
||||
OPENJDK_BUILD_CPU_AUTOCONF="$build_cpu"
|
||||
OPENJDK_BUILD_LIBC="$VAR_LIBC"
|
||||
OPENJDK_BUILD_ABI="$VAR_ABI"
|
||||
AC_SUBST(OPENJDK_BUILD_OS)
|
||||
AC_SUBST(OPENJDK_BUILD_OS_TYPE)
|
||||
AC_SUBST(OPENJDK_BUILD_OS_ENV)
|
||||
AC_SUBST(OPENJDK_BUILD_CPU)
|
||||
AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
|
||||
AC_SUBST(OPENJDK_BUILD_CPU_BITS)
|
||||
AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN)
|
||||
AC_SUBST(OPENJDK_BUILD_CPU_AUTOCONF)
|
||||
AC_SUBST(OPENJDK_BUILD_LIBC)
|
||||
AC_SUBST(OPENJDK_BUILD_ABI)
|
||||
|
||||
AC_MSG_CHECKING([openjdk-build os-cpu])
|
||||
AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU])
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS" = "xlinux"; then
|
||||
AC_MSG_CHECKING([openjdk-build C library])
|
||||
AC_MSG_RESULT([$OPENJDK_BUILD_LIBC])
|
||||
fi
|
||||
|
||||
# Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU/LIBC variables.
|
||||
PLATFORM_EXTRACT_VARS_FROM_OS($host_os)
|
||||
PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
|
||||
PLATFORM_EXTRACT_VARS_FROM_LIBC($host_os)
|
||||
PLATFORM_EXTRACT_VARS_FROM_ABI($host_os)
|
||||
# ... and setup our own variables. (Do this explicitly to facilitate searching)
|
||||
OPENJDK_TARGET_OS="$VAR_OS"
|
||||
if test "x$VAR_OS_TYPE" != x; then
|
||||
OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE"
|
||||
else
|
||||
OPENJDK_TARGET_OS_TYPE="$VAR_OS"
|
||||
fi
|
||||
if test "x$VAR_OS_ENV" != x; then
|
||||
OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV"
|
||||
else
|
||||
OPENJDK_TARGET_OS_ENV="$VAR_OS"
|
||||
fi
|
||||
OPENJDK_TARGET_CPU="$VAR_CPU"
|
||||
OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
|
||||
OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
|
||||
OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
|
||||
OPENJDK_TARGET_CPU_AUTOCONF="$host_cpu"
|
||||
OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
||||
OPENJDK_TARGET_LIBC="$VAR_LIBC"
|
||||
OPENJDK_TARGET_ABI="$VAR_ABI"
|
||||
|
||||
AC_SUBST(OPENJDK_TARGET_OS)
|
||||
AC_SUBST(OPENJDK_TARGET_OS_TYPE)
|
||||
AC_SUBST(OPENJDK_TARGET_OS_ENV)
|
||||
AC_SUBST(OPENJDK_TARGET_OS_UPPERCASE)
|
||||
AC_SUBST(OPENJDK_TARGET_CPU)
|
||||
AC_SUBST(OPENJDK_TARGET_CPU_ARCH)
|
||||
AC_SUBST(OPENJDK_TARGET_CPU_BITS)
|
||||
AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN)
|
||||
AC_SUBST(OPENJDK_TARGET_CPU_AUTOCONF)
|
||||
AC_SUBST(OPENJDK_TARGET_LIBC)
|
||||
AC_SUBST(OPENJDK_TARGET_ABI)
|
||||
|
||||
AC_MSG_CHECKING([openjdk-target os-cpu])
|
||||
AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
|
||||
AC_MSG_CHECKING([openjdk-target C library])
|
||||
AC_MSG_RESULT([$OPENJDK_TARGET_LIBC])
|
||||
fi
|
||||
])
|
||||
|
||||
# Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behavior
|
||||
# accordingly. Must be done after setting up build and target system, but before
|
||||
# doing anything else with these values.
|
||||
AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS],
|
||||
[
|
||||
AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits],
|
||||
[build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])])
|
||||
|
||||
# We have three types of compiles:
|
||||
# native == normal compilation, target system == build system
|
||||
# cross == traditional cross compilation, target system != build system; special toolchain needed
|
||||
# reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines
|
||||
#
|
||||
if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then
|
||||
# We're doing a proper cross-compilation
|
||||
COMPILE_TYPE="cross"
|
||||
else
|
||||
COMPILE_TYPE="native"
|
||||
fi
|
||||
|
||||
if test "x$with_target_bits" != x; then
|
||||
if test "x$COMPILE_TYPE" = "xcross"; then
|
||||
AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.])
|
||||
fi
|
||||
|
||||
if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
# A reduced build is requested
|
||||
COMPILE_TYPE="reduced"
|
||||
OPENJDK_TARGET_CPU_BITS=32
|
||||
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
|
||||
OPENJDK_TARGET_CPU=x86
|
||||
elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
|
||||
OPENJDK_TARGET_CPU=sparc
|
||||
else
|
||||
AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9])
|
||||
fi
|
||||
elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
|
||||
AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.])
|
||||
elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then
|
||||
AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning])
|
||||
else
|
||||
AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(COMPILE_TYPE)
|
||||
|
||||
AC_MSG_CHECKING([compilation type])
|
||||
AC_MSG_RESULT([$COMPILE_TYPE])
|
||||
])
|
||||
|
||||
# Setup the legacy variables, for controlling the old makefiles.
|
||||
#
|
||||
AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
|
||||
[
|
||||
PLATFORM_SETUP_LEGACY_VARS_HELPER([TARGET])
|
||||
PLATFORM_SETUP_LEGACY_VARS_HELPER([BUILD])
|
||||
])
|
||||
|
||||
# $1 - Either TARGET or BUILD to setup the variables for.
|
||||
AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
|
||||
[
|
||||
# Also store the legacy naming of the cpu.
|
||||
# Ie i586 and amd64 instead of x86 and x86_64
|
||||
OPENJDK_$1_CPU_LEGACY="$OPENJDK_$1_CPU"
|
||||
if test "x$OPENJDK_$1_CPU" = xx86; then
|
||||
OPENJDK_$1_CPU_LEGACY="i586"
|
||||
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
|
||||
# On all platforms except MacOSX replace x86_64 with amd64.
|
||||
OPENJDK_$1_CPU_LEGACY="amd64"
|
||||
elif test "x$OPENJDK_$1_CPU" = xalpha; then
|
||||
# Avoid name collisions with variables named alpha
|
||||
OPENJDK_$1_CPU_LEGACY="_alpha_"
|
||||
elif test "x$OPENJDK_$1_CPU" = xsh; then
|
||||
# Avoid name collisions with variables named sh
|
||||
OPENJDK_$1_CPU_LEGACY="_sh_"
|
||||
fi
|
||||
AC_SUBST(OPENJDK_$1_CPU_LEGACY)
|
||||
|
||||
# And the second legacy naming of the cpu.
|
||||
# Ie i386 and amd64 instead of x86 and x86_64.
|
||||
OPENJDK_$1_CPU_LEGACY_LIB="$OPENJDK_$1_CPU"
|
||||
if test "x$OPENJDK_$1_CPU" = xx86; then
|
||||
OPENJDK_$1_CPU_LEGACY_LIB="i386"
|
||||
elif test "x$OPENJDK_$1_CPU" = xx86_64; then
|
||||
OPENJDK_$1_CPU_LEGACY_LIB="amd64"
|
||||
fi
|
||||
AC_SUBST(OPENJDK_$1_CPU_LEGACY_LIB)
|
||||
|
||||
# Setup OPENJDK_$1_CPU_OSARCH, which is used to set the os.arch Java system property
|
||||
OPENJDK_$1_CPU_OSARCH="$OPENJDK_$1_CPU"
|
||||
if test "x$OPENJDK_$1_OS" = xlinux && test "x$OPENJDK_$1_CPU" = xx86; then
|
||||
# On linux only, we replace x86 with i386.
|
||||
OPENJDK_$1_CPU_OSARCH="i386"
|
||||
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
|
||||
# On all platforms except macosx, we replace x86_64 with amd64.
|
||||
OPENJDK_$1_CPU_OSARCH="amd64"
|
||||
fi
|
||||
AC_SUBST(OPENJDK_$1_CPU_OSARCH)
|
||||
|
||||
OPENJDK_$1_CPU_JLI="$OPENJDK_$1_CPU"
|
||||
if test "x$OPENJDK_$1_CPU" = xx86; then
|
||||
OPENJDK_$1_CPU_JLI="i386"
|
||||
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
|
||||
# On all platforms except macosx, we replace x86_64 with amd64.
|
||||
OPENJDK_$1_CPU_JLI="amd64"
|
||||
fi
|
||||
|
||||
# The new version string in JDK 9 also defined new naming of OS and ARCH for bundles
|
||||
# The macOS bundle name was revised in JDK 17
|
||||
#
|
||||
# macosx is macos and x86_64 is x64
|
||||
if test "x$OPENJDK_$1_OS" = xmacosx; then
|
||||
OPENJDK_$1_OS_BUNDLE="macos"
|
||||
else
|
||||
OPENJDK_$1_OS_BUNDLE="$OPENJDK_TARGET_OS"
|
||||
fi
|
||||
if test "x$OPENJDK_$1_CPU" = xx86_64; then
|
||||
OPENJDK_$1_CPU_BUNDLE="x64"
|
||||
else
|
||||
OPENJDK_$1_CPU_BUNDLE="$OPENJDK_$1_CPU"
|
||||
fi
|
||||
|
||||
OPENJDK_$1_LIBC_BUNDLE=""
|
||||
if test "x$OPENJDK_$1_LIBC" = "xmusl"; then
|
||||
OPENJDK_$1_LIBC_BUNDLE="-$OPENJDK_$1_LIBC"
|
||||
fi
|
||||
|
||||
OPENJDK_$1_BUNDLE_PLATFORM="${OPENJDK_$1_OS_BUNDLE}-${OPENJDK_$1_CPU_BUNDLE}${OPENJDK_$1_LIBC_BUNDLE}"
|
||||
AC_SUBST(OPENJDK_$1_BUNDLE_PLATFORM)
|
||||
|
||||
if test "x$COMPILE_TYPE" = "xcross"; then
|
||||
# FIXME: ... or should this include reduced builds..?
|
||||
DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_$1_CPU_LEGACY"
|
||||
else
|
||||
DEFINE_CROSS_COMPILE_ARCH=""
|
||||
fi
|
||||
AC_SUBST(DEFINE_CROSS_COMPILE_ARCH)
|
||||
|
||||
# Convert openjdk platform names to hotspot names
|
||||
|
||||
HOTSPOT_$1_OS=${OPENJDK_$1_OS}
|
||||
if test "x$OPENJDK_$1_OS" = xmacosx; then
|
||||
HOTSPOT_$1_OS=bsd
|
||||
fi
|
||||
AC_SUBST(HOTSPOT_$1_OS)
|
||||
|
||||
HOTSPOT_$1_OS_TYPE=${OPENJDK_$1_OS_TYPE}
|
||||
if test "x$OPENJDK_$1_OS_TYPE" = xunix; then
|
||||
HOTSPOT_$1_OS_TYPE=posix
|
||||
fi
|
||||
AC_SUBST(HOTSPOT_$1_OS_TYPE)
|
||||
|
||||
HOTSPOT_$1_CPU=${OPENJDK_$1_CPU}
|
||||
if test "x$OPENJDK_$1_CPU" = xx86; then
|
||||
HOTSPOT_$1_CPU=x86_32
|
||||
elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
|
||||
HOTSPOT_$1_CPU=sparc
|
||||
elif test "x$OPENJDK_$1_CPU" = xppc64; then
|
||||
HOTSPOT_$1_CPU=ppc_64
|
||||
elif test "x$OPENJDK_$1_CPU" = xppc64le; then
|
||||
HOTSPOT_$1_CPU=ppc_64
|
||||
fi
|
||||
AC_SUBST(HOTSPOT_$1_CPU)
|
||||
|
||||
# This is identical with OPENJDK_*, but define anyway for consistency.
|
||||
HOTSPOT_$1_CPU_ARCH=${OPENJDK_$1_CPU_ARCH}
|
||||
AC_SUBST(HOTSPOT_$1_CPU_ARCH)
|
||||
|
||||
# Setup HOTSPOT_$1_CPU_DEFINE
|
||||
if test "x$OPENJDK_$1_CPU" = xx86; then
|
||||
HOTSPOT_$1_CPU_DEFINE=IA32
|
||||
elif test "x$OPENJDK_$1_CPU" = xx86_64; then
|
||||
HOTSPOT_$1_CPU_DEFINE=AMD64
|
||||
elif test "x$OPENJDK_$1_CPU" = xx32; then
|
||||
HOTSPOT_$1_CPU_DEFINE=X32
|
||||
elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
|
||||
HOTSPOT_$1_CPU_DEFINE=SPARC
|
||||
elif test "x$OPENJDK_$1_CPU" = xaarch64; then
|
||||
HOTSPOT_$1_CPU_DEFINE=AARCH64
|
||||
elif test "x$OPENJDK_$1_CPU" = xppc64; then
|
||||
HOTSPOT_$1_CPU_DEFINE=PPC64
|
||||
elif test "x$OPENJDK_$1_CPU" = xppc64le; then
|
||||
HOTSPOT_$1_CPU_DEFINE=PPC64
|
||||
elif test "x$OPENJDK_$1_CPU" = xriscv64; then
|
||||
HOTSPOT_$1_CPU_DEFINE=RISCV64
|
||||
|
||||
# The cpu defines below are for zero, we don't support them directly.
|
||||
elif test "x$OPENJDK_$1_CPU" = xsparc; then
|
||||
HOTSPOT_$1_CPU_DEFINE=SPARC
|
||||
elif test "x$OPENJDK_$1_CPU" = xppc; then
|
||||
HOTSPOT_$1_CPU_DEFINE=PPC32
|
||||
elif test "x$OPENJDK_$1_CPU" = xriscv32; then
|
||||
HOTSPOT_$1_CPU_DEFINE=RISCV32
|
||||
elif test "x$OPENJDK_$1_CPU" = xs390; then
|
||||
HOTSPOT_$1_CPU_DEFINE=S390
|
||||
elif test "x$OPENJDK_$1_CPU" = xs390x; then
|
||||
HOTSPOT_$1_CPU_DEFINE=S390
|
||||
elif test "x$OPENJDK_$1_CPU" = xloongarch64; then
|
||||
HOTSPOT_$1_CPU_DEFINE=LOONGARCH64
|
||||
elif test "x$OPENJDK_$1_CPU" != x; then
|
||||
HOTSPOT_$1_CPU_DEFINE=$(echo $OPENJDK_$1_CPU | tr a-z A-Z)
|
||||
fi
|
||||
AC_SUBST(HOTSPOT_$1_CPU_DEFINE)
|
||||
|
||||
HOTSPOT_$1_LIBC=$OPENJDK_$1_LIBC
|
||||
AC_SUBST(HOTSPOT_$1_LIBC)
|
||||
|
||||
# For historical reasons, the OS include directories have odd names.
|
||||
OPENJDK_$1_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
|
||||
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
|
||||
OPENJDK_$1_OS_INCLUDE_SUBDIR="win32"
|
||||
elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
|
||||
OPENJDK_$1_OS_INCLUDE_SUBDIR="darwin"
|
||||
fi
|
||||
AC_SUBST(OPENJDK_$1_OS_INCLUDE_SUBDIR)
|
||||
])
|
||||
|
||||
AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
|
||||
[
|
||||
if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
|
||||
RELEASE_FILE_OS_NAME=Linux
|
||||
fi
|
||||
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
|
||||
RELEASE_FILE_OS_NAME=Windows
|
||||
fi
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
RELEASE_FILE_OS_NAME="Darwin"
|
||||
fi
|
||||
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
|
||||
RELEASE_FILE_OS_NAME="AIX"
|
||||
fi
|
||||
RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU}
|
||||
RELEASE_FILE_LIBC=${OPENJDK_TARGET_LIBC}
|
||||
|
||||
AC_SUBST(RELEASE_FILE_OS_NAME)
|
||||
AC_SUBST(RELEASE_FILE_OS_ARCH)
|
||||
AC_SUBST(RELEASE_FILE_LIBC)
|
||||
])
|
||||
|
||||
AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES],
|
||||
[
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
OPENJDK_MODULE_TARGET_OS_NAME="macos"
|
||||
else
|
||||
OPENJDK_MODULE_TARGET_OS_NAME="$OPENJDK_TARGET_OS"
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
||||
OPENJDK_MODULE_TARGET_OS_ARCH="amd64"
|
||||
else
|
||||
OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU"
|
||||
fi
|
||||
|
||||
OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}"
|
||||
AC_SUBST(OPENJDK_MODULE_TARGET_PLATFORM)
|
||||
])
|
||||
|
||||
#%%% Build and target systems %%%
|
||||
# Make sure to only use tools set up in BASIC_SETUP_FUNDAMENTAL_TOOLS.
|
||||
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET],
|
||||
[
|
||||
# Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target"
|
||||
# is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the
|
||||
# product you're building. The target of this build is called "host". Since this is confusing to most people, we
|
||||
# have not adopted that system, but use "target" as the platform we are building for. In some places though we need
|
||||
# to use the configure naming style.
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
PLATFORM_EXTRACT_TARGET_AND_BUILD
|
||||
PLATFORM_SETUP_TARGET_CPU_BITS
|
||||
PLATFORM_SET_MODULE_TARGET_OS_VALUES
|
||||
PLATFORM_SET_RELEASE_FILE_OS_VALUES
|
||||
PLATFORM_SETUP_LEGACY_VARS
|
||||
PLATFORM_CHECK_DEPRECATION
|
||||
])
|
||||
|
||||
AC_DEFUN([PLATFORM_CHECK_DEPRECATION],
|
||||
[
|
||||
AC_ARG_ENABLE(deprecated-ports, [AS_HELP_STRING([--enable-deprecated-ports@<:@=yes/no@:>@],
|
||||
[Suppress the error when configuring for a deprecated port @<:@no@:>@])])
|
||||
# There are no deprecated ports. Implement the deprecation warnings here.
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
|
||||
[
|
||||
##############################################################################
|
||||
|
||||
# Note that this is the build platform OS version!
|
||||
|
||||
OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
|
||||
OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
|
||||
OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
|
||||
OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
|
||||
AC_SUBST(OS_VERSION_MAJOR)
|
||||
AC_SUBST(OS_VERSION_MINOR)
|
||||
AC_SUBST(OS_VERSION_MICRO)
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
|
||||
[
|
||||
##############################################################################
|
||||
#
|
||||
# Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
|
||||
# (The JVM can use 32 or 64 bit Java pointers but that decision
|
||||
# is made at runtime.)
|
||||
#
|
||||
|
||||
# Make compilation sanity check
|
||||
AC_CHECK_HEADERS([stdio.h], , [
|
||||
AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.])
|
||||
if test "x$COMPILE_TYPE" = xreduced; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([reduced])
|
||||
AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG])
|
||||
elif test "x$COMPILE_TYPE" = xcross; then
|
||||
AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
|
||||
fi
|
||||
AC_MSG_ERROR([Cannot continue.])
|
||||
])
|
||||
|
||||
AC_CHECK_SIZEOF([int *], [1111])
|
||||
|
||||
# AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
|
||||
if test "x$ac_cv_sizeof_int_p" = x; then
|
||||
# The test failed, lets stick to the assumed value.
|
||||
AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
|
||||
else
|
||||
TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
|
||||
|
||||
if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
|
||||
AC_MSG_NOTICE([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
|
||||
if test "x$COMPILE_TYPE" = xreduced; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([reduced])
|
||||
AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG])
|
||||
elif test "x$COMPILE_TYPE" = xcross; then
|
||||
AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
|
||||
fi
|
||||
AC_MSG_ERROR([Cannot continue.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for target address size])
|
||||
AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])
|
||||
])
|
||||
|
||||
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
|
||||
[
|
||||
##############################################################################
|
||||
#
|
||||
# Is the target little or big endian?
|
||||
#
|
||||
AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"])
|
||||
|
||||
if test "x$ENDIAN" = xuniversal_endianness; then
|
||||
AC_MSG_ERROR([Building with both big and little endianness is not supported])
|
||||
fi
|
||||
if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
|
||||
AC_MSG_ERROR([The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)])
|
||||
fi
|
||||
])
|
||||
92
make/autoconf/source-dirs.m4
Normal file
92
make/autoconf/source-dirs.m4
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2020, 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_ONCE([SRCDIRS_SETUP_DIRS],
|
||||
[
|
||||
OUTPUTDIR="$OUTPUTDIR"
|
||||
AC_SUBST(OUTPUTDIR)
|
||||
JDK_OUTPUTDIR="$OUTPUTDIR/jdk"
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Define a mechanism for importing extra prebuilt modules
|
||||
#
|
||||
|
||||
AC_DEFUN_ONCE([SRCDIRS_SETUP_IMPORT_MODULES],
|
||||
[
|
||||
AC_ARG_WITH(import-modules, [AS_HELP_STRING([--with-import-modules],
|
||||
[import a set of prebuilt modules either as a zip file or an exploded directory])])
|
||||
|
||||
if test "x$with_import_modules" != x \
|
||||
&& test "x$with_import_modules" != "xno"; then
|
||||
if test -d "$with_import_modules"; then
|
||||
IMPORT_MODULES_TOPDIR="$with_import_modules"
|
||||
UTIL_FIXUP_PATH([IMPORT_MODULES_TOPDIR])
|
||||
elif test -e "$with_import_modules"; then
|
||||
IMPORT_MODULES_TOPDIR="$CONFIGURESUPPORT_OUTPUTDIR/import-modules"
|
||||
$RM -rf "$IMPORT_MODULES_TOPDIR"
|
||||
$MKDIR -p "$IMPORT_MODULES_TOPDIR"
|
||||
if ! $UNZIP -q "$with_import_modules" -d "$IMPORT_MODULES_TOPDIR"; then
|
||||
AC_MSG_ERROR([--with-import-modules="$with_import_modules" must point to a dir or a zip file])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([--with-import-modules="$with_import_modules" must point to a dir or a zip file])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -d "$IMPORT_MODULES_TOPDIR/modules"; then
|
||||
IMPORT_MODULES_CLASSES="$IMPORT_MODULES_TOPDIR/modules"
|
||||
fi
|
||||
if test -d "$IMPORT_MODULES_TOPDIR/modules_cmds"; then
|
||||
IMPORT_MODULES_CMDS="$IMPORT_MODULES_TOPDIR/modules_cmds"
|
||||
fi
|
||||
if test -d "$IMPORT_MODULES_TOPDIR/modules_libs"; then
|
||||
IMPORT_MODULES_LIBS="$IMPORT_MODULES_TOPDIR/modules_libs"
|
||||
fi
|
||||
if test -d "$IMPORT_MODULES_TOPDIR/modules_conf"; then
|
||||
IMPORT_MODULES_CONF="$IMPORT_MODULES_TOPDIR/modules_conf"
|
||||
fi
|
||||
if test -d "$IMPORT_MODULES_TOPDIR/modules_legal"; then
|
||||
IMPORT_MODULES_LEGAL="$IMPORT_MODULES_TOPDIR/modules_legal"
|
||||
fi
|
||||
if test -d "$IMPORT_MODULES_TOPDIR/modules_man"; then
|
||||
IMPORT_MODULES_MAN="$IMPORT_MODULES_TOPDIR/modules_man"
|
||||
fi
|
||||
if test -d "$IMPORT_MODULES_TOPDIR/modules_src"; then
|
||||
IMPORT_MODULES_SRC="$IMPORT_MODULES_TOPDIR/modules_src"
|
||||
fi
|
||||
if test -d "$IMPORT_MODULES_TOPDIR/make"; then
|
||||
IMPORT_MODULES_MAKE="$IMPORT_MODULES_TOPDIR/make"
|
||||
fi
|
||||
|
||||
AC_SUBST(IMPORT_MODULES_CLASSES)
|
||||
AC_SUBST(IMPORT_MODULES_CMDS)
|
||||
AC_SUBST(IMPORT_MODULES_LIBS)
|
||||
AC_SUBST(IMPORT_MODULES_CONF)
|
||||
AC_SUBST(IMPORT_MODULES_LEGAL)
|
||||
AC_SUBST(IMPORT_MODULES_MAN)
|
||||
AC_SUBST(IMPORT_MODULES_SRC)
|
||||
AC_SUBST(IMPORT_MODULES_MAKE)
|
||||
])
|
||||
969
make/autoconf/spec.gmk.template
Normal file
969
make/autoconf/spec.gmk.template
Normal file
|
|
@ -0,0 +1,969 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2026, 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 target system @OPENJDK_TARGET_OS@-@OPENJDK_TARGET_CPU@
|
||||
# (called @OPENJDK_TARGET_AUTOCONF_NAME@ by autoconf)
|
||||
# on build system @OPENJDK_BUILD_OS@-@OPENJDK_BUILD_CPU@
|
||||
# (called @OPENJDK_BUILD_AUTOCONF_NAME@ by autoconf)
|
||||
# using 'configure @CONFIGURE_COMMAND_LINE@'
|
||||
|
||||
# The command line given to configure.
|
||||
CONFIGURE_COMMAND_LINE := @CONFIGURE_COMMAND_LINE@
|
||||
# The current directory when configure was run
|
||||
CONFIGURE_START_DIR := @CONFIGURE_START_DIR@
|
||||
|
||||
# How configure was originally called, if not called directly
|
||||
REAL_CONFIGURE_COMMAND_EXEC_SHORT := @REAL_CONFIGURE_COMMAND_EXEC_SHORT@
|
||||
REAL_CONFIGURE_COMMAND_EXEC_FULL := @REAL_CONFIGURE_COMMAND_EXEC_FULL@
|
||||
REAL_CONFIGURE_COMMAND_LINE := @REAL_CONFIGURE_COMMAND_LINE@
|
||||
|
||||
# A self-referential reference to this file.
|
||||
SPEC := @SPEC@
|
||||
|
||||
# Path to autoconf if overridden by the user, to be used by "make reconfigure"
|
||||
AUTOCONF := @AUTOCONF@
|
||||
|
||||
# SPACE and COMMA are defined in MakeBase.gmk, but they are also used in
|
||||
# some definitions here, and are needed if MakeBase.gmk is not included before
|
||||
# this file.
|
||||
X :=
|
||||
SPACE := $(X) $(X)
|
||||
COMMA := ,
|
||||
|
||||
# What make to use for main processing, after bootstrapping top-level Makefile.
|
||||
MAKE := @MAKE@
|
||||
|
||||
# Make sure all shell commands are executed with a proper locale
|
||||
export LC_ALL := @LOCALE_USED@
|
||||
|
||||
# Make sure we override any local CLASSPATH variable
|
||||
export CLASSPATH := @CLASSPATH@
|
||||
|
||||
# The default make arguments
|
||||
MAKE_ARGS = $(MAKE_LOG_FLAGS) -r -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \
|
||||
MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" $(MAKE_LOG_VARS)
|
||||
|
||||
OUTPUT_SYNC_SUPPORTED := @OUTPUT_SYNC_SUPPORTED@
|
||||
OUTPUT_SYNC := @OUTPUT_SYNC@
|
||||
|
||||
# Override the shell with bash
|
||||
BASH := @BASH@
|
||||
BASH_ARGS := @BASH_ARGS@
|
||||
SHELL := $(BASH) $(BASH_ARGS)
|
||||
|
||||
# The "human readable" name of this configuration
|
||||
CONF_NAME := @CONF_NAME@
|
||||
|
||||
# The built jdk will run in this target system.
|
||||
OPENJDK_TARGET_OS := @OPENJDK_TARGET_OS@
|
||||
OPENJDK_TARGET_OS_TYPE := @OPENJDK_TARGET_OS_TYPE@
|
||||
OPENJDK_TARGET_OS_ENV := @OPENJDK_TARGET_OS_ENV@
|
||||
OPENJDK_TARGET_OS_UPPERCASE := @OPENJDK_TARGET_OS_UPPERCASE@
|
||||
|
||||
OPENJDK_TARGET_CPU := @OPENJDK_TARGET_CPU@
|
||||
OPENJDK_TARGET_CPU_ARCH := @OPENJDK_TARGET_CPU_ARCH@
|
||||
OPENJDK_TARGET_CPU_BITS := @OPENJDK_TARGET_CPU_BITS@
|
||||
OPENJDK_TARGET_CPU_ENDIAN := @OPENJDK_TARGET_CPU_ENDIAN@
|
||||
|
||||
OPENJDK_TARGET_LIBC := @OPENJDK_TARGET_LIBC@
|
||||
|
||||
COMPILE_TYPE := @COMPILE_TYPE@
|
||||
|
||||
# Legacy support
|
||||
OPENJDK_TARGET_CPU_LEGACY := @OPENJDK_TARGET_CPU_LEGACY@
|
||||
OPENJDK_TARGET_CPU_LEGACY_LIB := @OPENJDK_TARGET_CPU_LEGACY_LIB@
|
||||
OPENJDK_TARGET_CPU_OSARCH := @OPENJDK_TARGET_CPU_OSARCH@
|
||||
OPENJDK_TARGET_OS_INCLUDE_SUBDIR := @OPENJDK_TARGET_OS_INCLUDE_SUBDIR@
|
||||
|
||||
HOTSPOT_TARGET_OS := @HOTSPOT_TARGET_OS@
|
||||
HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_TARGET_OS_TYPE@
|
||||
|
||||
HOTSPOT_TARGET_CPU := @HOTSPOT_TARGET_CPU@
|
||||
HOTSPOT_TARGET_CPU_ARCH := @HOTSPOT_TARGET_CPU_ARCH@
|
||||
HOTSPOT_TARGET_CPU_DEFINE := @HOTSPOT_TARGET_CPU_DEFINE@
|
||||
|
||||
HOTSPOT_TARGET_LIBC := @HOTSPOT_TARGET_LIBC@
|
||||
|
||||
OPENJDK_TARGET_BUNDLE_PLATFORM := @OPENJDK_TARGET_BUNDLE_PLATFORM@
|
||||
JDK_ARCH_ABI_PROP_NAME := @JDK_ARCH_ABI_PROP_NAME@
|
||||
|
||||
# We are building on this build system.
|
||||
# When not cross-compiling, it is the same as the target.
|
||||
OPENJDK_BUILD_OS := @OPENJDK_BUILD_OS@
|
||||
OPENJDK_BUILD_OS_TYPE := @OPENJDK_BUILD_OS_TYPE@
|
||||
OPENJDK_BUILD_OS_ENV := @OPENJDK_BUILD_OS_ENV@
|
||||
|
||||
OPENJDK_BUILD_CPU := @OPENJDK_BUILD_CPU@
|
||||
OPENJDK_BUILD_CPU_ARCH := @OPENJDK_BUILD_CPU_ARCH@
|
||||
OPENJDK_BUILD_CPU_BITS := @OPENJDK_BUILD_CPU_BITS@
|
||||
OPENJDK_BUILD_CPU_ENDIAN := @OPENJDK_BUILD_CPU_ENDIAN@
|
||||
|
||||
OPENJDK_BUILD_LIBC := @OPENJDK_BUILD_LIBC@
|
||||
|
||||
OPENJDK_BUILD_OS_INCLUDE_SUBDIR := @OPENJDK_TARGET_OS_INCLUDE_SUBDIR@
|
||||
|
||||
# Target platform value in ModuleTarget class file attribute.
|
||||
OPENJDK_MODULE_TARGET_PLATFORM := @OPENJDK_MODULE_TARGET_PLATFORM@
|
||||
|
||||
# OS_* properties in release file
|
||||
RELEASE_FILE_OS_NAME := @RELEASE_FILE_OS_NAME@
|
||||
RELEASE_FILE_OS_ARCH := @RELEASE_FILE_OS_ARCH@
|
||||
RELEASE_FILE_LIBC := @RELEASE_FILE_LIBC@
|
||||
|
||||
SOURCE_DATE := @SOURCE_DATE@
|
||||
ISO_8601_FORMAT_STRING := @ISO_8601_FORMAT_STRING@
|
||||
|
||||
ifneq ($(SOURCE_DATE), updated)
|
||||
# For "updated" source date value, these are set in InitSupport.gmk
|
||||
export SOURCE_DATE_EPOCH := $(SOURCE_DATE)
|
||||
SOURCE_DATE_ISO_8601 := @SOURCE_DATE_ISO_8601@
|
||||
endif
|
||||
|
||||
LIBM := @LIBM@
|
||||
LIBDL := @LIBDL@
|
||||
LIBPTHREAD := @LIBPTHREAD@
|
||||
|
||||
WINENV_ROOT := @WINENV_ROOT@
|
||||
WINENV_PREFIX := @WINENV_PREFIX@
|
||||
|
||||
ifneq ($(findstring windows.wsl, @OPENJDK_BUILD_OS_ENV@), )
|
||||
# Tell WSL to convert PATH between linux and windows
|
||||
export WSLENV := PATH/l
|
||||
else ifeq (@OPENJDK_BUILD_OS_ENV@, windows.msys2)
|
||||
# Prohibit msys2 from attempting any path wrangling
|
||||
export MSYS2_ARG_CONV_EXCL := "*"
|
||||
endif
|
||||
|
||||
# Save the original path before replacing it with the Visual Studio tools
|
||||
ORIGINAL_PATH := @ORIGINAL_PATH@
|
||||
|
||||
ifeq (@TOOLCHAIN_TYPE@, microsoft)
|
||||
# The Visual Studio toolchain needs the PATH to be adjusted to include
|
||||
# Visual Studio tools.
|
||||
export PATH := @TOOLCHAIN_PATH@:$(PATH)
|
||||
endif
|
||||
|
||||
SYSROOT_CFLAGS := @SYSROOT_CFLAGS@
|
||||
SYSROOT_LDFLAGS := @SYSROOT_LDFLAGS@
|
||||
|
||||
# The top-level directory of the source repository
|
||||
TOPDIR := @TOPDIR@
|
||||
# Usually the top level directory, but could be something else if a custom
|
||||
# root is defined.
|
||||
WORKSPACE_ROOT := @WORKSPACE_ROOT@
|
||||
IMPORT_MODULES_CLASSES := @IMPORT_MODULES_CLASSES@
|
||||
IMPORT_MODULES_CMDS := @IMPORT_MODULES_CMDS@
|
||||
IMPORT_MODULES_LIBS := @IMPORT_MODULES_LIBS@
|
||||
IMPORT_MODULES_CONF := @IMPORT_MODULES_CONF@
|
||||
IMPORT_MODULES_LEGAL := @IMPORT_MODULES_LEGAL@
|
||||
IMPORT_MODULES_MAN := @IMPORT_MODULES_MAN@
|
||||
IMPORT_MODULES_SRC := @IMPORT_MODULES_SRC@
|
||||
IMPORT_MODULES_MAKE := @IMPORT_MODULES_MAKE@
|
||||
|
||||
COPYRIGHT_YEAR := @COPYRIGHT_YEAR@
|
||||
HOTSPOT_BUILD_TIME := @HOTSPOT_BUILD_TIME@
|
||||
|
||||
# Platform naming variables
|
||||
LAUNCHER_NAME := @LAUNCHER_NAME@
|
||||
PRODUCT_NAME := @PRODUCT_NAME@
|
||||
PRODUCT_SUFFIX := @PRODUCT_SUFFIX@
|
||||
JDK_RC_PLATFORM_NAME := @JDK_RC_PLATFORM_NAME@
|
||||
JDK_RC_NAME := @JDK_RC_NAME@
|
||||
JDK_RC_COMPANY_NAME := @JDK_RC_COMPANY_NAME@
|
||||
COMPANY_NAME := @COMPANY_NAME@
|
||||
HOTSPOT_VM_DISTRO := @HOTSPOT_VM_DISTRO@
|
||||
MACOSX_BUNDLE_NAME_BASE := @MACOSX_BUNDLE_NAME_BASE@
|
||||
MACOSX_BUNDLE_ID_BASE := @MACOSX_BUNDLE_ID_BASE@
|
||||
MACOSX_BUNDLE_BUILD_VERSION := @MACOSX_BUNDLE_BUILD_VERSION@
|
||||
USERNAME := @USERNAME@
|
||||
VENDOR_URL := @VENDOR_URL@
|
||||
VENDOR_URL_BUG := @VENDOR_URL_BUG@
|
||||
VENDOR_URL_VM_BUG := @VENDOR_URL_VM_BUG@
|
||||
|
||||
# New (JEP-223) version information
|
||||
|
||||
## Building blocks of the version string
|
||||
# First three version numbers, with well-specified meanings (numerical)
|
||||
VERSION_FEATURE := @VERSION_FEATURE@
|
||||
VERSION_INTERIM := @VERSION_INTERIM@
|
||||
VERSION_UPDATE := @VERSION_UPDATE@
|
||||
VERSION_PATCH := @VERSION_PATCH@
|
||||
VERSION_EXTRA1 := @VERSION_EXTRA1@
|
||||
VERSION_EXTRA2 := @VERSION_EXTRA2@
|
||||
VERSION_EXTRA3 := @VERSION_EXTRA3@
|
||||
# The pre-release identifier (string)
|
||||
VERSION_PRE := @VERSION_PRE@
|
||||
# The build number (numerical)
|
||||
VERSION_BUILD := @VERSION_BUILD@
|
||||
# Optional build information (string)
|
||||
VERSION_OPT := @VERSION_OPT@
|
||||
|
||||
## Composite variables
|
||||
# The version number as a dot separated sequence of numbers, e.g. 9.0.1
|
||||
VERSION_NUMBER := @VERSION_NUMBER@
|
||||
# VERSION_NUMBER but always with exactly 4 positions, with 0 for empty positions.
|
||||
VERSION_NUMBER_FOUR_POSITIONS := @VERSION_NUMBER_FOUR_POSITIONS@
|
||||
# The complete version string, with additional build information
|
||||
VERSION_STRING := @VERSION_STRING@
|
||||
# The short version string, without trailing zeroes and just PRE, if present.
|
||||
VERSION_SHORT := @VERSION_SHORT@
|
||||
# The Java specification version. It usually equals the feature version number.
|
||||
VERSION_SPECIFICATION := @VERSION_FEATURE@
|
||||
# A GA version is defined by the PRE string being empty. Rather than testing for
|
||||
# that, this variable defines it with true/false.
|
||||
VERSION_IS_GA := @VERSION_IS_GA@
|
||||
|
||||
# Version date
|
||||
VERSION_DATE := @VERSION_DATE@
|
||||
|
||||
# Vendor version string
|
||||
VENDOR_VERSION_STRING := @VENDOR_VERSION_STRING@
|
||||
|
||||
# Class-file version
|
||||
VERSION_CLASSFILE_MAJOR := @VERSION_CLASSFILE_MAJOR@
|
||||
VERSION_CLASSFILE_MINOR := @VERSION_CLASSFILE_MINOR@
|
||||
|
||||
# Version for API docs "new-since" feature
|
||||
VERSION_DOCS_API_SINCE := @VERSION_DOCS_API_SINCE@
|
||||
|
||||
JDK_SOURCE_TARGET_VERSION := @JDK_SOURCE_TARGET_VERSION@
|
||||
|
||||
# Convenience CFLAGS settings for passing version information into native programs.
|
||||
VERSION_CFLAGS = \
|
||||
-DVERSION_FEATURE=$(VERSION_FEATURE) \
|
||||
-DVERSION_INTERIM=$(VERSION_INTERIM) \
|
||||
-DVERSION_UPDATE=$(VERSION_UPDATE) \
|
||||
-DVERSION_PATCH=$(VERSION_PATCH) \
|
||||
-DVERSION_EXTRA1=$(VERSION_EXTRA1) \
|
||||
-DVERSION_EXTRA2=$(VERSION_EXTRA2) \
|
||||
-DVERSION_EXTRA3=$(VERSION_EXTRA3) \
|
||||
-DVERSION_PRE='"$(VERSION_PRE)"' \
|
||||
-DVERSION_BUILD=$(VERSION_BUILD) \
|
||||
-DVERSION_OPT='"$(VERSION_OPT)"' \
|
||||
-DVERSION_NUMBER='"$(VERSION_NUMBER)"' \
|
||||
-DVERSION_STRING='"$(VERSION_STRING)"' \
|
||||
-DVERSION_SHORT='"$(VERSION_SHORT)"' \
|
||||
-DVERSION_SPECIFICATION='"$(VERSION_SPECIFICATION)"' \
|
||||
-DVERSION_DATE='"$(VERSION_DATE)"' \
|
||||
-DVENDOR_VERSION_STRING='"$(VENDOR_VERSION_STRING)"' \
|
||||
-DVERSION_CLASSFILE_MAJOR=$(VERSION_CLASSFILE_MAJOR) \
|
||||
-DVERSION_CLASSFILE_MINOR=$(VERSION_CLASSFILE_MINOR) \
|
||||
#
|
||||
|
||||
ifneq ($(COMPANY_NAME), )
|
||||
# COMPANY_NAME is set to "N/A" in make/conf/branding.conf by default,
|
||||
# but can be customized with the '--with-vendor-name' configure option.
|
||||
# Only export "VENDOR" to the build if COMPANY_NAME contains a real value.
|
||||
# Otherwise the default value for VENDOR, which is used to set the "java.vendor"
|
||||
# and "java.vm.vendor" properties is hard-coded into the source code (i.e. in
|
||||
# VersionProps.java.template in the jdk for "java.vendor" and
|
||||
# vm_version.cpp in the VM for "java.vm.vendor")
|
||||
ifneq ($(COMPANY_NAME), N/A)
|
||||
VERSION_CFLAGS += -DVENDOR='"$(COMPANY_NAME)"'
|
||||
endif
|
||||
endif
|
||||
|
||||
# Only export VENDOR_URL, VENDOR_URL_BUG and VENDOR_VM_URL_BUG to the build if
|
||||
# they are not empty. Otherwise, default values which are defined in the sources
|
||||
# will be used.
|
||||
ifneq ($(VENDOR_URL), )
|
||||
VERSION_CFLAGS += -DVENDOR_URL='"$(VENDOR_URL)"'
|
||||
endif
|
||||
ifneq ($(VENDOR_URL_BUG), )
|
||||
VERSION_CFLAGS += -DVENDOR_URL_BUG='"$(VENDOR_URL_BUG)"'
|
||||
endif
|
||||
ifneq ($(VENDOR_URL_VM_BUG), )
|
||||
VERSION_CFLAGS += -DVENDOR_URL_VM_BUG='"$(VENDOR_URL_VM_BUG)"'
|
||||
endif
|
||||
|
||||
# Different naming strings generated from the above information.
|
||||
RUNTIME_NAME = $(PRODUCT_NAME) $(PRODUCT_SUFFIX)
|
||||
|
||||
# How to compile the code: release, fastdebug or slowdebug
|
||||
DEBUG_LEVEL := @DEBUG_LEVEL@
|
||||
HOTSPOT_DEBUG_LEVEL := @HOTSPOT_DEBUG_LEVEL@
|
||||
|
||||
# Which JVM variants to build (space-separated list)
|
||||
JVM_VARIANTS := @JVM_VARIANTS@
|
||||
JVM_VARIANT_MAIN := @JVM_VARIANT_MAIN@
|
||||
|
||||
# Lists of features per variant. Only relevant for the variants listed in
|
||||
# JVM_VARIANTS.
|
||||
JVM_FEATURES_server := @JVM_FEATURES_server@
|
||||
JVM_FEATURES_client := @JVM_FEATURES_client@
|
||||
JVM_FEATURES_core := @JVM_FEATURES_core@
|
||||
JVM_FEATURES_minimal := @JVM_FEATURES_minimal@
|
||||
JVM_FEATURES_zero := @JVM_FEATURES_zero@
|
||||
JVM_FEATURES_custom := @JVM_FEATURES_custom@
|
||||
|
||||
# Used for make-time verifications
|
||||
VALID_JVM_FEATURES := @VALID_JVM_FEATURES@
|
||||
VALID_JVM_VARIANTS := @VALID_JVM_VARIANTS@
|
||||
|
||||
# Allow overriding the default hotspot library path
|
||||
HOTSPOT_OVERRIDE_LIBPATH := @HOTSPOT_OVERRIDE_LIBPATH@
|
||||
|
||||
# Control use of precompiled header in hotspot libjvm build
|
||||
USE_PRECOMPILED_HEADER := @USE_PRECOMPILED_HEADER@
|
||||
|
||||
# Only build headless support or not
|
||||
ENABLE_HEADLESS_ONLY := @ENABLE_HEADLESS_ONLY@
|
||||
|
||||
ENABLE_LINKTIME_GC := @ENABLE_LINKTIME_GC@
|
||||
|
||||
# Ship debug symbols (e.g. pdbs on Windows)
|
||||
SHIP_DEBUG_SYMBOLS := @SHIP_DEBUG_SYMBOLS@
|
||||
|
||||
ENABLE_FULL_DOCS := @ENABLE_FULL_DOCS@
|
||||
|
||||
# JDK_OUTPUTDIR specifies where a working jvm is built.
|
||||
# You can run $(JDK_OUTPUTDIR)/bin/java
|
||||
|
||||
OUTPUTDIR := @OUTPUTDIR@
|
||||
# Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
|
||||
SUPPORT_OUTPUTDIR = $(OUTPUTDIR)/support
|
||||
BUILDTOOLS_OUTPUTDIR = $(OUTPUTDIR)/buildtools
|
||||
|
||||
HOTSPOT_OUTPUTDIR = $(OUTPUTDIR)/hotspot
|
||||
JDK_OUTPUTDIR = $(OUTPUTDIR)/jdk
|
||||
IMAGES_OUTPUTDIR = $(OUTPUTDIR)/images
|
||||
BUNDLES_OUTPUTDIR = $(OUTPUTDIR)/bundles
|
||||
TESTMAKE_OUTPUTDIR = $(OUTPUTDIR)/test-make
|
||||
MAKESUPPORT_OUTPUTDIR = $(OUTPUTDIR)/make-support
|
||||
|
||||
JAVA_TMP_DIR = $(SUPPORT_OUTPUTDIR)/javatmp
|
||||
|
||||
# This does not get overridden in a bootcycle build
|
||||
CONFIGURESUPPORT_OUTPUTDIR := @CONFIGURESUPPORT_OUTPUTDIR@
|
||||
BUILDJDK_OUTPUTDIR = $(OUTPUTDIR)/buildjdk
|
||||
|
||||
BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@
|
||||
|
||||
BUILD_JTREG_TEST_THREAD_FACTORY := @BUILD_JTREG_TEST_THREAD_FACTORY@
|
||||
|
||||
ENABLE_GENERATE_CLASSLIST := @ENABLE_GENERATE_CLASSLIST@
|
||||
|
||||
EXCLUDE_TRANSLATIONS := @EXCLUDE_TRANSLATIONS@
|
||||
|
||||
BUILD_CDS_ARCHIVE := @BUILD_CDS_ARCHIVE@
|
||||
BUILD_CDS_ARCHIVE_COH := @BUILD_CDS_ARCHIVE_COH@
|
||||
|
||||
ENABLE_COMPATIBLE_CDS_ALIGNMENT := @ENABLE_COMPATIBLE_CDS_ALIGNMENT@
|
||||
|
||||
ALLOW_ABSOLUTE_PATHS_IN_OUTPUT := @ALLOW_ABSOLUTE_PATHS_IN_OUTPUT@
|
||||
|
||||
HSDIS_BACKEND := @HSDIS_BACKEND@
|
||||
ENABLE_HSDIS_BUNDLING := @ENABLE_HSDIS_BUNDLING@
|
||||
HSDIS_CFLAGS := @HSDIS_CFLAGS@
|
||||
HSDIS_LDFLAGS := @HSDIS_LDFLAGS@
|
||||
HSDIS_LIBS := @HSDIS_LIBS@
|
||||
CAPSTONE_ARCH_AARCH64_NAME := @CAPSTONE_ARCH_AARCH64_NAME@
|
||||
|
||||
# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
|
||||
# it in sync.
|
||||
BOOT_JDK := @BOOT_JDK@
|
||||
|
||||
EXTERNAL_BUILDJDK_PATH := @EXTERNAL_BUILDJDK_PATH@
|
||||
|
||||
ifneq ($(EXTERNAL_BUILDJDK_PATH), )
|
||||
EXTERNAL_BUILDJDK := true
|
||||
CREATE_BUILDJDK := false
|
||||
BUILD_JDK := $(EXTERNAL_BUILDJDK_PATH)
|
||||
else
|
||||
EXTERNAL_BUILDJDK := false
|
||||
ifeq ($(COMPILE_TYPE), cross)
|
||||
CREATE_BUILDJDK := true
|
||||
BUILD_JDK := $(BUILDJDK_OUTPUTDIR)/jdk
|
||||
else
|
||||
CREATE_BUILDJDK := false
|
||||
BUILD_JDK := $(JDK_OUTPUTDIR)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Whether the boot jdk jar supports --date=TIMESTAMP
|
||||
BOOT_JDK_JAR_SUPPORTS_DATE := @BOOT_JDK_JAR_SUPPORTS_DATE@
|
||||
|
||||
# The oldest supported boot jdk version
|
||||
OLDEST_BOOT_JDK_VERSION := @OLDEST_BOOT_JDK_VERSION@
|
||||
|
||||
# Information about the build system
|
||||
NUM_CORES := @NUM_CORES@
|
||||
MEMORY_SIZE := @MEMORY_SIZE@
|
||||
ENABLE_JAVAC_SERVER := @ENABLE_JAVAC_SERVER@
|
||||
# Store javac server synchronization files here, and
|
||||
# the javac server log files.
|
||||
JAVAC_SERVER_DIR = $(MAKESUPPORT_OUTPUTDIR)/javacservers
|
||||
|
||||
# Number of parallel jobs to use for compilation
|
||||
JOBS ?= @JOBS@
|
||||
TEST_JOBS ?= @TEST_JOBS@
|
||||
|
||||
# Default make target
|
||||
DEFAULT_MAKE_TARGET := @DEFAULT_MAKE_TARGET@
|
||||
DEFAULT_LOG := @DEFAULT_LOG@
|
||||
|
||||
# Fallback linker
|
||||
ENABLE_FALLBACK_LINKER := @ENABLE_FALLBACK_LINKER@
|
||||
|
||||
FREETYPE_TO_USE := @FREETYPE_TO_USE@
|
||||
FREETYPE_LIBS := @FREETYPE_LIBS@
|
||||
FREETYPE_CFLAGS := @FREETYPE_CFLAGS@
|
||||
FONTCONFIG_CFLAGS := @FONTCONFIG_CFLAGS@
|
||||
CUPS_CFLAGS := @CUPS_CFLAGS@
|
||||
ALSA_LIBS := @ALSA_LIBS@
|
||||
ALSA_CFLAGS := @ALSA_CFLAGS@
|
||||
LIBFFI_LIBS := @LIBFFI_LIBS@
|
||||
LIBFFI_CFLAGS := @LIBFFI_CFLAGS@
|
||||
ENABLE_LIBFFI_BUNDLING := @ENABLE_LIBFFI_BUNDLING@
|
||||
LIBFFI_LIB_FILE := @LIBFFI_LIB_FILE@
|
||||
ICONV_CFLAGS := @ICONV_CFLAGS@
|
||||
ICONV_LDFLAGS := @ICONV_LDFLAGS@
|
||||
ICONV_LIBS := @ICONV_LIBS@
|
||||
FILE_MACRO_CFLAGS := @FILE_MACRO_CFLAGS@
|
||||
REPRODUCIBLE_CFLAGS := @REPRODUCIBLE_CFLAGS@
|
||||
|
||||
JMH_CORE_JAR := @JMH_CORE_JAR@
|
||||
JMH_GENERATOR_JAR := @JMH_GENERATOR_JAR@
|
||||
JMH_JOPT_SIMPLE_JAR := @JMH_JOPT_SIMPLE_JAR@
|
||||
JMH_COMMONS_MATH_JAR := @JMH_COMMONS_MATH_JAR@
|
||||
JMH_VERSION := @JMH_VERSION@
|
||||
|
||||
GTEST_FRAMEWORK_SRC := @GTEST_FRAMEWORK_SRC@
|
||||
|
||||
# Source file for cacerts
|
||||
CACERTS_FILE := @CACERTS_FILE@
|
||||
# Source folder for user provided cacerts PEM files
|
||||
CACERTS_SRC := @CACERTS_SRC@
|
||||
|
||||
# Enable unlimited crypto policy
|
||||
UNLIMITED_CRYPTO := @UNLIMITED_CRYPTO@
|
||||
|
||||
GCOV_ENABLED := @GCOV_ENABLED@
|
||||
JCOV_ENABLED := @JCOV_ENABLED@
|
||||
JCOV_HOME := @JCOV_HOME@
|
||||
JCOV_INPUT_JDK := @JCOV_INPUT_JDK@
|
||||
JCOV_FILTERS := @JCOV_FILTERS@
|
||||
JCOV_MODULES := @JCOV_MODULES@
|
||||
|
||||
# AddressSanitizer
|
||||
ASAN_ENABLED := @ASAN_ENABLED@
|
||||
|
||||
# LeakSanitizer
|
||||
LSAN_ENABLED := @LSAN_ENABLED@
|
||||
|
||||
# UndefinedBehaviorSanitizer
|
||||
UBSAN_ENABLED := @UBSAN_ENABLED@
|
||||
UBSAN_CFLAGS := @UBSAN_CFLAGS@
|
||||
UBSAN_LDFLAGS := @UBSAN_LDFLAGS@
|
||||
|
||||
# Necessary additional compiler flags to compile X11
|
||||
X_CFLAGS := @X_CFLAGS@
|
||||
X_LIBS := @X_LIBS@
|
||||
|
||||
# The lowest required version of macosx
|
||||
MACOSX_VERSION_MIN := @MACOSX_VERSION_MIN@
|
||||
# The highest allowed version of macosx
|
||||
MACOSX_VERSION_MAX := @MACOSX_VERSION_MAX@
|
||||
|
||||
# The macosx code signing configuration
|
||||
MACOSX_CODESIGN_MODE := @MACOSX_CODESIGN_MODE@
|
||||
MACOSX_CODESIGN_IDENTITY := @MACOSX_CODESIGN_IDENTITY@
|
||||
|
||||
# The code signing hook configuration
|
||||
SIGNING_HOOK := @SIGNING_HOOK@
|
||||
|
||||
# Toolchain type: gcc, clang, microsoft...
|
||||
TOOLCHAIN_TYPE := @TOOLCHAIN_TYPE@
|
||||
TOOLCHAIN_VERSION := @TOOLCHAIN_VERSION@
|
||||
CC_VERSION_NUMBER := @CC_VERSION_NUMBER@
|
||||
CXX_VERSION_NUMBER := @CXX_VERSION_NUMBER@
|
||||
|
||||
# Legacy support
|
||||
HOTSPOT_TOOLCHAIN_TYPE := @HOTSPOT_TOOLCHAIN_TYPE@
|
||||
|
||||
AS_NON_ASM_EXTENSION_OPTION := @AS_NON_ASM_EXTENSION_OPTION@
|
||||
|
||||
# Flags used for overriding the default opt setting for a C/C++ source file.
|
||||
C_O_FLAG_HIGHEST_JVM := @C_O_FLAG_HIGHEST_JVM@
|
||||
C_O_FLAG_HIGHEST := @C_O_FLAG_HIGHEST@
|
||||
C_O_FLAG_HI := @C_O_FLAG_HI@
|
||||
C_O_FLAG_NORM := @C_O_FLAG_NORM@
|
||||
C_O_FLAG_NONE := @C_O_FLAG_NONE@
|
||||
C_O_FLAG_SIZE := @C_O_FLAG_SIZE@
|
||||
C_O_FLAG_LTO := @C_O_FLAG_LTO@
|
||||
CXX_O_FLAG_HIGHEST_JVM := @CXX_O_FLAG_HIGHEST_JVM@
|
||||
CXX_O_FLAG_HIGHEST := @CXX_O_FLAG_HIGHEST@
|
||||
CXX_O_FLAG_HI := @CXX_O_FLAG_HI@
|
||||
CXX_O_FLAG_NORM := @CXX_O_FLAG_NORM@
|
||||
CXX_O_FLAG_NONE := @CXX_O_FLAG_NONE@
|
||||
CXX_O_FLAG_SIZE := @CXX_O_FLAG_SIZE@
|
||||
CXX_O_FLAG_LTO := @CXX_O_FLAG_LTO@
|
||||
|
||||
GENDEPS_FLAGS := @GENDEPS_FLAGS@
|
||||
|
||||
DISABLE_WARNING_PREFIX := @DISABLE_WARNING_PREFIX@
|
||||
CFLAGS_WARNINGS_ARE_ERRORS := @CFLAGS_WARNINGS_ARE_ERRORS@
|
||||
DISABLED_WARNINGS := @DISABLED_WARNINGS@
|
||||
DISABLED_WARNINGS_C := @DISABLED_WARNINGS_C@
|
||||
DISABLED_WARNINGS_CXX := @DISABLED_WARNINGS_CXX@
|
||||
CFLAGS_CONVERSION_WARNINGS := @CFLAGS_CONVERSION_WARNINGS@
|
||||
|
||||
# A global flag (true or false) determining if native warnings are considered errors.
|
||||
WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
|
||||
JAVA_WARNINGS_AS_ERRORS := @JAVA_WARNINGS_AS_ERRORS@
|
||||
|
||||
CFLAGS_CCACHE := @CFLAGS_CCACHE@
|
||||
ADLC_LANGSTD_CXXFLAGS := @ADLC_LANGSTD_CXXFLAGS@
|
||||
ADLC_LDFLAGS := @ADLC_LDFLAGS@
|
||||
|
||||
# Tools that potentially need to be cross compilation aware.
|
||||
CC := @CCACHE@ @ICECC@ @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@
|
||||
|
||||
FDLIBM_CFLAGS := @FDLIBM_CFLAGS@
|
||||
JVM_CFLAGS := @JVM_CFLAGS@
|
||||
JVM_LDFLAGS := @JVM_LDFLAGS@
|
||||
JVM_ASFLAGS := @JVM_ASFLAGS@
|
||||
JVM_LIBS := @JVM_LIBS@
|
||||
|
||||
BASIC_ASFLAGS := @BASIC_ASFLAGS@
|
||||
|
||||
MACHINE_FLAG := @MACHINE_FLAG@
|
||||
|
||||
# These flags might contain variables set by a custom extension that is included later.
|
||||
EXTRA_CFLAGS := @EXTRA_CFLAGS@
|
||||
EXTRA_CXXFLAGS := @EXTRA_CXXFLAGS@
|
||||
EXTRA_LDFLAGS := @EXTRA_LDFLAGS@
|
||||
EXTRA_ASFLAGS := @EXTRA_ASFLAGS@
|
||||
|
||||
CXX := @CCACHE@ @ICECC@ @CXX@
|
||||
|
||||
CPP := @CPP@
|
||||
|
||||
# The linker can be gcc or ld on unix systems, or link.exe on windows systems.
|
||||
LD := @LD@
|
||||
|
||||
SYSROOT := @SYSROOT@
|
||||
|
||||
# LDFLAGS used to link the jdk native libraries (C-code)
|
||||
LDFLAGS_JDKLIB := @LDFLAGS_JDKLIB@
|
||||
|
||||
# LDFLAGS used to link the jdk native launchers (C-code)
|
||||
LDFLAGS_JDKEXE := @LDFLAGS_JDKEXE@
|
||||
|
||||
# LDFLAGS used to link the static jdk library
|
||||
LDFLAGS_STATIC_JDK := @LDFLAGS_STATIC_JDK@
|
||||
|
||||
# LDFLAGS specific to C++ linking.
|
||||
LDFLAGS_CXX_JDK := @LDFLAGS_CXX_JDK@
|
||||
|
||||
# LDFLAGS specific to partial linking.
|
||||
LDFLAGS_CXX_PARTIAL_LINKING := @LDFLAGS_CXX_PARTIAL_LINKING@
|
||||
|
||||
# LDFLAGS specific to link time optimization
|
||||
LDFLAGS_LTO := @LDFLAGS_LTO@
|
||||
|
||||
# Sometimes a different linker is needed for c++ libs
|
||||
LDCXX := @LDCXX@
|
||||
# The flags for linking libstdc++ linker.
|
||||
LIBCXX := @LIBCXX@
|
||||
|
||||
# BUILD_CC/BUILD_LD is a compiler/linker that generates code that is runnable on the
|
||||
# build platform.
|
||||
BUILD_CC := @BUILD_ICECC@ @BUILD_CC@
|
||||
BUILD_CXX := @BUILD_ICECC@ @BUILD_CXX@
|
||||
BUILD_LD := @BUILD_LD@
|
||||
BUILD_LDCXX := @BUILD_LDCXX@
|
||||
BUILD_AS := @BUILD_AS@
|
||||
BUILD_AR := @BUILD_AR@
|
||||
BUILD_NM := @BUILD_NM@
|
||||
BUILD_OBJCOPY := @BUILD_OBJCOPY@
|
||||
BUILD_STRIP := @BUILD_STRIP@
|
||||
BUILD_SYSROOT_CFLAGS := @BUILD_SYSROOT_CFLAGS@
|
||||
BUILD_SYSROOT_LDFLAGS := @BUILD_SYSROOT_LDFLAGS@
|
||||
|
||||
AS := @AS@
|
||||
|
||||
AR := @AR@
|
||||
ARFLAGS := @ARFLAGS@
|
||||
LIB := @LIB@
|
||||
LIBFLAGS := @LIBFLAGS@
|
||||
NM := @NM@
|
||||
NMFLAGS := @NMFLAGS@
|
||||
STRIP := @STRIP@
|
||||
OBJDUMP := @OBJDUMP@
|
||||
CXXFILT := @CXXFILT@
|
||||
|
||||
LIPO := @LIPO@
|
||||
INSTALL_NAME_TOOL := @INSTALL_NAME_TOOL@
|
||||
METAL := @METAL@
|
||||
METALLIB := @METALLIB@
|
||||
|
||||
#
|
||||
# Options for generating debug symbols
|
||||
COMPILE_WITH_DEBUG_SYMBOLS := @COMPILE_WITH_DEBUG_SYMBOLS@
|
||||
COPY_DEBUG_SYMBOLS := @COPY_DEBUG_SYMBOLS@
|
||||
ZIP_EXTERNAL_DEBUG_SYMBOLS := @ZIP_EXTERNAL_DEBUG_SYMBOLS@
|
||||
|
||||
CFLAGS_DEBUG_SYMBOLS := @CFLAGS_DEBUG_SYMBOLS@
|
||||
ASFLAGS_DEBUG_SYMBOLS := @ASFLAGS_DEBUG_SYMBOLS@
|
||||
|
||||
#
|
||||
# Compress (or not) jars
|
||||
COMPRESS_JARS := @COMPRESS_JARS@
|
||||
|
||||
SHARED_LIBRARY_FLAGS := @SHARED_LIBRARY_FLAGS@
|
||||
|
||||
LIBRARY_PREFIX := @LIBRARY_PREFIX@
|
||||
SHARED_LIBRARY_SUFFIX := @SHARED_LIBRARY_SUFFIX@
|
||||
STATIC_LIBRARY_SUFFIX := @STATIC_LIBRARY_SUFFIX@
|
||||
EXECUTABLE_SUFFIX := @EXECUTABLE_SUFFIX@
|
||||
OBJ_SUFFIX := @OBJ_SUFFIX@
|
||||
|
||||
STRIPFLAGS := @STRIPFLAGS@
|
||||
|
||||
JAVA_FLAGS_TMPDIR := -Djava.io.tmpdir=$(JAVA_TMP_DIR)
|
||||
JAVA_FLAGS := @JAVA_FLAGS@ $(JAVA_FLAGS_TMPDIR)
|
||||
JAVA_FLAGS_BIG := @JAVA_FLAGS_BIG@
|
||||
JAVA_FLAGS_SMALL := @JAVA_FLAGS_SMALL@
|
||||
BUILD_JAVA_FLAGS_SMALL := @BUILD_JAVA_FLAGS_SMALL@
|
||||
JAVA_TOOL_FLAGS_SMALL := @JAVA_TOOL_FLAGS_SMALL@
|
||||
|
||||
# The *_CMD variables are defined separately to be easily overridden in bootcycle-spec.gmk
|
||||
# for bootcycle-images build. Make sure to keep them in sync. Do not use the *_CMD
|
||||
# versions of the variables directly.
|
||||
JAVA_CMD := @JAVA@
|
||||
JAVAC_CMD := @JAVAC@
|
||||
JAVADOC_CMD := @JAVADOC@
|
||||
JAR_CMD := @JAR@
|
||||
JLINK_CMD := @FIXPATH@ $(BUILD_JDK)/bin/jlink
|
||||
JMOD_CMD := @FIXPATH@ $(BUILD_JDK)/bin/jmod
|
||||
# These variables are meant to be used. They are defined with = instead of := to make
|
||||
# it possible to override only the *_CMD variables.
|
||||
JAVA = $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
|
||||
JAVA_SMALL = $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
|
||||
JAVAC = $(JAVAC_CMD)
|
||||
JAVADOC = $(JAVADOC_CMD)
|
||||
JAR = $(JAR_CMD)
|
||||
JLINK = $(JLINK_CMD)
|
||||
JMOD = $(JMOD_CMD)
|
||||
|
||||
JTREG_JDK := @JTREG_JDK@
|
||||
JTREG_JAVA = @FIXPATH@ $(JTREG_JDK)/bin/java $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
|
||||
|
||||
BUILD_JAVA_FLAGS := @BOOTCYCLE_JVM_ARGS_BIG@
|
||||
BUILD_JAVA = @FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS)
|
||||
BUILD_JAVA_SMALL = @FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS_SMALL)
|
||||
BUILD_JAVAC = @FIXPATH@ $(BUILD_JDK)/bin/javac
|
||||
BUILD_JAR = @FIXPATH@ $(BUILD_JDK)/bin/jar
|
||||
|
||||
DOCS_REFERENCE_JAVADOC := @DOCS_REFERENCE_JAVADOC@
|
||||
|
||||
# A file containing a way to uniquely identify the source code revision that
|
||||
# the build was created from
|
||||
SOURCE_REVISION_TRACKER := $(SUPPORT_OUTPUTDIR)/src-rev/source-revision-tracker
|
||||
|
||||
# Interim langtools modules and arguments
|
||||
INTERIM_LANGTOOLS_BASE_MODULES := java.compiler jdk.compiler jdk.internal.md jdk.javadoc
|
||||
INTERIM_LANGTOOLS_MODULES := $(addsuffix .interim, $(INTERIM_LANGTOOLS_BASE_MODULES))
|
||||
INTERIM_LANGTOOLS_ADD_EXPORTS := \
|
||||
--add-exports java.base/sun.reflect.annotation=jdk.compiler.interim \
|
||||
--add-exports java.base/jdk.internal.jmod=jdk.compiler.interim \
|
||||
--add-exports java.base/jdk.internal.misc=jdk.compiler.interim \
|
||||
--add-exports java.base/sun.invoke.util=jdk.compiler.interim \
|
||||
--add-exports java.base/jdk.internal.javac=java.compiler.interim \
|
||||
--add-exports java.base/jdk.internal.javac=jdk.compiler.interim \
|
||||
--add-exports jdk.internal.opt/jdk.internal.opt=jdk.compiler.interim \
|
||||
--add-exports jdk.internal.opt/jdk.internal.opt=jdk.javadoc.interim \
|
||||
#
|
||||
INTERIM_LANGTOOLS_MODULES_COMMA := $(strip $(subst $(SPACE),$(COMMA),$(strip \
|
||||
$(INTERIM_LANGTOOLS_MODULES))))
|
||||
INTERIM_LANGTOOLS_ARGS := \
|
||||
--limit-modules java.base,jdk.zipfs,$(INTERIM_LANGTOOLS_MODULES_COMMA) \
|
||||
--add-modules $(INTERIM_LANGTOOLS_MODULES_COMMA) \
|
||||
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
|
||||
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
|
||||
$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
|
||||
#
|
||||
JAVAC_MAIN_CLASS := -m jdk.compiler.interim/com.sun.tools.javac.Main
|
||||
JAVADOC_MAIN_CLASS := -m jdk.javadoc.interim/jdk.javadoc.internal.tool.Main
|
||||
|
||||
# You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
|
||||
# Use = assignment to be able to override in bootcycle-spec.gmk
|
||||
NEW_JAVAC = $(INTERIM_LANGTOOLS_ARGS) $(JAVAC_MAIN_CLASS)
|
||||
NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) $(JAVADOC_MAIN_CLASS)
|
||||
|
||||
JMOD_COMPRESS := @JMOD_COMPRESS@
|
||||
JLINK_KEEP_PACKAGED_MODULES := @JLINK_KEEP_PACKAGED_MODULES@
|
||||
JLINK_PRODUCE_LINKABLE_RUNTIME := @JLINK_PRODUCE_LINKABLE_RUNTIME@
|
||||
JLINK_USER_EXTRA_FLAGS := @JLINK_USER_EXTRA_FLAGS@
|
||||
|
||||
RCFLAGS := @RCFLAGS@
|
||||
|
||||
# Tools adhering to a minimal and common standard of posix compliance.
|
||||
AWK := @AWK@
|
||||
BASENAME := @BASENAME@
|
||||
CAT := @CAT@
|
||||
CCACHE := @CCACHE@
|
||||
# CD is going away, but remains to cater for legacy makefiles.
|
||||
CD := cd
|
||||
CHMOD := @CHMOD@
|
||||
CMAKE := @CMAKE@
|
||||
CODESIGN := @CODESIGN@
|
||||
CP := @CP@
|
||||
CUT := @CUT@
|
||||
DATE := @DATE@
|
||||
IS_GNU_DATE := @IS_GNU_DATE@
|
||||
DIFF := @DIFF@
|
||||
DIRNAME := @DIRNAME@
|
||||
DSYMUTIL := @DSYMUTIL@
|
||||
FIND := @FIND@
|
||||
FIND_DELETE := @FIND_DELETE@
|
||||
FLOCK := @FLOCK@
|
||||
ECHO := @ECHO@
|
||||
EGREP := @EGREP@
|
||||
FGREP := @FGREP@
|
||||
GREP := @GREP@
|
||||
GZIP := @GZIP@
|
||||
HEAD := @HEAD@
|
||||
LS := @LS@
|
||||
LN := @LN@
|
||||
MIG := @MIG@
|
||||
MKDIR := @MKDIR@
|
||||
MV := @MV@
|
||||
NICE := @NICE@
|
||||
PANDOC := @PANDOC@
|
||||
TIDY := @TIDY@
|
||||
PATCH := @PATCH@
|
||||
PRINTF := @PRINTF@
|
||||
READLINK := @READLINK@
|
||||
RM := @RM@
|
||||
RMDIR := @RMDIR@
|
||||
SED := @SED@
|
||||
SH := @SH@
|
||||
SORT := @SORT@
|
||||
TAR := @TAR@
|
||||
TAIL := @TAIL@
|
||||
TEE := @TEE@
|
||||
TIME := @TIME@
|
||||
IS_GNU_TIME := @IS_GNU_TIME@
|
||||
TR := @TR@
|
||||
TOUCH := @TOUCH@
|
||||
WC := @WC@
|
||||
XARGS := @XARGS@
|
||||
ZIPEXE := @ZIPEXE@
|
||||
UNZIP := @UNZIP@
|
||||
MT := @MT@
|
||||
RC := @RC@
|
||||
DUMPBIN := @DUMPBIN@
|
||||
PATHTOOL := @PATHTOOL@
|
||||
WSLPATH := @WSLPATH@
|
||||
LDD := @LDD@
|
||||
OTOOL := @OTOOL@
|
||||
READELF := @READELF@
|
||||
EXPR := @EXPR@
|
||||
FILE := @FILE@
|
||||
DOT := @DOT@
|
||||
GIT := @GIT@
|
||||
OBJCOPY := @OBJCOPY@
|
||||
SETFILE := @SETFILE@
|
||||
XATTR := @XATTR@
|
||||
JT_HOME := @JT_HOME@
|
||||
JIB_HOME := @JIB_HOME@
|
||||
DTRACE := @DTRACE@
|
||||
FIXPATH := @FIXPATH@
|
||||
FIXPATH_BASE := @FIXPATH_BASE@
|
||||
ULIMIT := @ULIMIT@
|
||||
|
||||
TAR_TYPE := @TAR_TYPE@
|
||||
TAR_INCLUDE_PARAM := @TAR_INCLUDE_PARAM@
|
||||
TAR_SUPPORTS_TRANSFORM := @TAR_SUPPORTS_TRANSFORM@
|
||||
|
||||
# Build setup
|
||||
USE_EXTERNAL_LIBJPEG := @USE_EXTERNAL_LIBJPEG@
|
||||
LIBJPEG_CFLAGS := @LIBJPEG_CFLAGS@
|
||||
LIBJPEG_LIBS := @LIBJPEG_LIBS@
|
||||
USE_EXTERNAL_LIBGIF := @USE_EXTERNAL_LIBGIF@
|
||||
GIFLIB_CFLAGS := @GIFLIB_CFLAGS@
|
||||
GIFLIB_LIBS := @GIFLIB_LIBS@
|
||||
USE_EXTERNAL_LIBZ := @USE_EXTERNAL_LIBZ@
|
||||
LIBZ_CFLAGS := @LIBZ_CFLAGS@
|
||||
LIBZ_LIBS := @LIBZ_LIBS@
|
||||
LIBZIP_CAN_USE_MMAP := @LIBZIP_CAN_USE_MMAP@
|
||||
MSVCR_DLL := @MSVCR_DLL@
|
||||
VCRUNTIME_1_DLL := @VCRUNTIME_1_DLL@
|
||||
MSVCP_DLL := @MSVCP_DLL@
|
||||
UCRT_DLL_DIR := @UCRT_DLL_DIR@
|
||||
ENABLE_PANDOC := @ENABLE_PANDOC@
|
||||
PANDOC_MARKDOWN_FLAG := @PANDOC_MARKDOWN_FLAG@
|
||||
|
||||
# Libraries
|
||||
USE_EXTERNAL_LCMS := @USE_EXTERNAL_LCMS@
|
||||
LCMS_CFLAGS := @LCMS_CFLAGS@
|
||||
LCMS_LIBS := @LCMS_LIBS@
|
||||
|
||||
USE_EXTERNAL_HARFBUZZ := @USE_EXTERNAL_HARFBUZZ@
|
||||
HARFBUZZ_CFLAGS := @HARFBUZZ_CFLAGS@
|
||||
HARFBUZZ_LIBS := @HARFBUZZ_LIBS@
|
||||
|
||||
USE_EXTERNAL_LIBPNG := @USE_EXTERNAL_LIBPNG@
|
||||
PNG_LIBS := @PNG_LIBS@
|
||||
PNG_CFLAGS := @PNG_CFLAGS@
|
||||
|
||||
# Misc
|
||||
INCLUDE_SA := @INCLUDE_SA@
|
||||
INCLUDE_JVMCI := @INCLUDE_JVMCI@
|
||||
INCLUDE_COMPILER2 := @INCLUDE_COMPILER2@
|
||||
|
||||
OS_VERSION_MAJOR := @OS_VERSION_MAJOR@
|
||||
OS_VERSION_MINOR := @OS_VERSION_MINOR@
|
||||
OS_VERSION_MICRO := @OS_VERSION_MICRO@
|
||||
|
||||
# Arm SVE
|
||||
SVE_CFLAGS := @SVE_CFLAGS@
|
||||
|
||||
# Images directory definitions
|
||||
JDK_IMAGE_SUBDIR := jdk
|
||||
JRE_IMAGE_SUBDIR := jre
|
||||
JCOV_IMAGE_SUBDIR := jdk-jcov
|
||||
STATIC_JDK_IMAGE_SUBDIR := static-jdk
|
||||
|
||||
# Colon left out to be able to override output dir for bootcycle-images
|
||||
JDK_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
|
||||
JRE_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
|
||||
STATIC_JDK_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(STATIC_JDK_IMAGE_SUBDIR)
|
||||
JCOV_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(JCOV_IMAGE_SUBDIR)
|
||||
|
||||
# Test image, as above
|
||||
TEST_IMAGE_SUBDIR := test
|
||||
TEST_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(TEST_IMAGE_SUBDIR)
|
||||
|
||||
# Symbols image
|
||||
SYMBOLS_IMAGE_SUBDIR := symbols
|
||||
SYMBOLS_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(SYMBOLS_IMAGE_SUBDIR)
|
||||
|
||||
# Interim image
|
||||
INTERIM_JMODS_DIR := $(SUPPORT_OUTPUTDIR)/interim-jmods
|
||||
INTERIM_IMAGE_DIR := $(SUPPORT_OUTPUTDIR)/interim-image
|
||||
|
||||
# Docs image
|
||||
DOCS_JDK_IMAGE_SUBDIR := docs
|
||||
DOCS_JDK_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(DOCS_JDK_IMAGE_SUBDIR)
|
||||
DOCS_JAVASE_IMAGE_SUBDIR := docs-javase
|
||||
DOCS_JAVASE_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(DOCS_JAVASE_IMAGE_SUBDIR)
|
||||
DOCS_REFERENCE_IMAGE_SUBDIR := docs-reference
|
||||
DOCS_REFERENCE_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(DOCS_REFERENCE_IMAGE_SUBDIR)
|
||||
# Output docs directly into image
|
||||
DOCS_OUTPUTDIR := $(DOCS_JDK_IMAGE_DIR)
|
||||
|
||||
# Static libs image
|
||||
STATIC_LIBS_IMAGE_SUBDIR := static-libs
|
||||
STATIC_LIBS_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(STATIC_LIBS_IMAGE_SUBDIR)
|
||||
|
||||
# Graal static libs image
|
||||
STATIC_LIBS_GRAAL_IMAGE_SUBDIR := static-libs-graal
|
||||
STATIC_LIBS_GRAAL_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(STATIC_LIBS_GRAAL_IMAGE_SUBDIR)
|
||||
|
||||
# Graal builder image
|
||||
GRAAL_BUILDER_IMAGE_SUBDIR := graal-builder-jdk
|
||||
GRAAL_BUILDER_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(GRAAL_BUILDER_IMAGE_SUBDIR)
|
||||
|
||||
# Macosx bundles directory definitions
|
||||
JDK_MACOSX_BUNDLE_SUBDIR := jdk-bundle
|
||||
JRE_MACOSX_BUNDLE_SUBDIR := jre-bundle
|
||||
JDK_MACOSX_BUNDLE_SUBDIR_SIGNED := jdk-bundle-signed
|
||||
JRE_MACOSX_BUNDLE_SUBDIR_SIGNED := jre-bundle-signed
|
||||
JDK_MACOSX_BUNDLE_DIR = $(IMAGES_OUTPUTDIR)/$(JDK_MACOSX_BUNDLE_SUBDIR)
|
||||
JRE_MACOSX_BUNDLE_DIR = $(IMAGES_OUTPUTDIR)/$(JRE_MACOSX_BUNDLE_SUBDIR)
|
||||
JDK_MACOSX_BUNDLE_DIR_SIGNED = $(IMAGES_OUTPUTDIR)/$(JDK_MACOSX_BUNDLE_SUBDIR_SIGNED)
|
||||
JRE_MACOSX_BUNDLE_DIR_SIGNED = $(IMAGES_OUTPUTDIR)/$(JRE_MACOSX_BUNDLE_SUBDIR_SIGNED)
|
||||
JDK_MACOSX_BUNDLE_TOP_SUBDIR = jdk-$(VERSION_NUMBER).jdk
|
||||
JRE_MACOSX_BUNDLE_TOP_SUBDIR = jre-$(VERSION_NUMBER).jre
|
||||
JDK_MACOSX_CONTENTS_SUBDIR = $(JDK_MACOSX_BUNDLE_TOP_SUBDIR)/Contents
|
||||
JRE_MACOSX_CONTENTS_SUBDIR = $(JRE_MACOSX_BUNDLE_TOP_SUBDIR)/Contents
|
||||
JDK_MACOSX_CONTENTS_DIR = $(JDK_MACOSX_BUNDLE_DIR)/$(JDK_MACOSX_CONTENTS_SUBDIR)
|
||||
JRE_MACOSX_CONTENTS_DIR = $(JRE_MACOSX_BUNDLE_DIR)/$(JRE_MACOSX_CONTENTS_SUBDIR)
|
||||
JDK_MACOSX_BUNDLE_TOP_DIR = $(JDK_MACOSX_BUNDLE_DIR)/$(JDK_MACOSX_BUNDLE_TOP_SUBDIR)
|
||||
JRE_MACOSX_BUNDLE_TOP_DIR = $(JRE_MACOSX_BUNDLE_DIR)/$(JRE_MACOSX_BUNDLE_TOP_SUBDIR)
|
||||
|
||||
# Bundle names
|
||||
ifneq ($(VERSION_BUILD), )
|
||||
BASE_NAME := $(VERSION_SHORT)+$(VERSION_BUILD)_$(OPENJDK_TARGET_BUNDLE_PLATFORM)
|
||||
else
|
||||
BASE_NAME := $(VERSION_SHORT)_$(OPENJDK_TARGET_BUNDLE_PLATFORM)
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG_LEVEL), fastdebug)
|
||||
DEBUG_PART := -debug
|
||||
else ifneq ($(DEBUG_LEVEL), release)
|
||||
DEBUG_PART := -$(DEBUG_LEVEL)
|
||||
endif
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
JDK_BUNDLE_EXTENSION := zip
|
||||
else
|
||||
JDK_BUNDLE_EXTENSION := tar.gz
|
||||
endif
|
||||
JDK_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART).$(JDK_BUNDLE_EXTENSION)
|
||||
JRE_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART).$(JDK_BUNDLE_EXTENSION)
|
||||
JDK_SYMBOLS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz
|
||||
TEST_DEMOS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin-tests-demos$(DEBUG_PART).tar.gz
|
||||
TEST_BUNDLE_NAME := jdk-$(BASE_NAME)_bin-tests$(DEBUG_PART).tar.gz
|
||||
DOCS_JDK_BUNDLE_NAME := jdk-$(BASE_NAME)_doc-api-spec$(DEBUG_PART).tar.gz
|
||||
DOCS_JAVASE_BUNDLE_NAME := javase-$(BASE_NAME)_doc-api-spec$(DEBUG_PART).tar.gz
|
||||
DOCS_REFERENCE_BUNDLE_NAME := jdk-reference-$(BASE_NAME)_doc-api-spec$(DEBUG_PART).tar.gz
|
||||
STATIC_LIBS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin-static-libs$(DEBUG_PART).tar.gz
|
||||
STATIC_LIBS_GRAAL_BUNDLE_NAME := jdk-$(BASE_NAME)_bin-static-libs-graal$(DEBUG_PART).tar.gz
|
||||
STATIC_JDK_BUNDLE_NAME := static-jdk-$(BASE_NAME)_bin$(DEBUG_PART).$(JDK_BUNDLE_EXTENSION)
|
||||
JCOV_BUNDLE_NAME := jdk-jcov-$(BASE_NAME)_bin$(DEBUG_PART).$(JDK_BUNDLE_EXTENSION)
|
||||
|
||||
JDK_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JDK_BUNDLE_NAME)
|
||||
JRE_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JRE_BUNDLE_NAME)
|
||||
JDK_SYMBOLS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JDK_SYMBOLS_BUNDLE_NAME)
|
||||
TEST_DEMOS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(TEST_DEMOS_BUNDLE_NAME)
|
||||
TEST_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(TEST_BUNDLE_NAME)
|
||||
DOCS_JDK_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(DOCS_JDK_BUNDLE_NAME)
|
||||
DOCS_JAVASE_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(DOCS_JAVASE_BUNDLE_NAME)
|
||||
DOCS_REFERENCE_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(DOCS_REFERENCE_BUNDLE_NAME)
|
||||
STATIC_JDK_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(STATIC_JDK_BUNDLE_NAME)
|
||||
JCOV_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JCOV_BUNDLE_NAME)
|
||||
|
||||
# This macro is called to allow inclusion of closed source counterparts.
|
||||
# Unless overridden in closed sources, it expands to nothing.
|
||||
# Usage: This function is called in an open makefile, with the following
|
||||
# argument:
|
||||
# $1 the name of the makefile
|
||||
define IncludeCustomExtension
|
||||
endef
|
||||
|
||||
# Include the custom-spec.gmk file if it exists
|
||||
-include $(dir @SPEC@)/custom-spec.gmk
|
||||
958
make/autoconf/toolchain.m4
Normal file
958
make/autoconf/toolchain.m4
Normal file
|
|
@ -0,0 +1,958 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# This file is responsible for detecting, verifying and setting up the
|
||||
# toolchain, i.e. the compiler, linker and related utilities. It will setup
|
||||
# proper paths to the binaries, but it will not setup any flags.
|
||||
#
|
||||
# The binaries used is determined by the toolchain type, which is the family of
|
||||
# compilers and related tools that are used.
|
||||
################################################################################
|
||||
|
||||
m4_include([toolchain_microsoft.m4])
|
||||
|
||||
# All valid toolchains, regardless of platform (used by help.m4)
|
||||
VALID_TOOLCHAINS_all="gcc clang microsoft"
|
||||
|
||||
# These toolchains are valid on different platforms
|
||||
VALID_TOOLCHAINS_linux="gcc clang"
|
||||
VALID_TOOLCHAINS_macosx="clang"
|
||||
VALID_TOOLCHAINS_aix="clang"
|
||||
VALID_TOOLCHAINS_windows="microsoft"
|
||||
|
||||
# Toolchain descriptions
|
||||
TOOLCHAIN_DESCRIPTION_clang="clang/LLVM"
|
||||
TOOLCHAIN_DESCRIPTION_gcc="GNU Compiler Collection"
|
||||
TOOLCHAIN_DESCRIPTION_microsoft="Microsoft Visual Studio"
|
||||
|
||||
# Minimum supported versions, empty means unspecified
|
||||
TOOLCHAIN_MINIMUM_VERSION_clang="13.0"
|
||||
TOOLCHAIN_MINIMUM_VERSION_gcc="10.0"
|
||||
TOOLCHAIN_MINIMUM_VERSION_microsoft="19.28.0.0" # VS2019 16.8, aka MSVC 14.28
|
||||
|
||||
# Minimum supported linker versions, empty means unspecified
|
||||
TOOLCHAIN_MINIMUM_LD_VERSION_gcc="2.18"
|
||||
|
||||
# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
|
||||
# Must have CC_VERSION_NUMBER and CXX_VERSION_NUMBER.
|
||||
# $1 - optional variable prefix for compiler and version variables (BUILD_)
|
||||
# $2 - optional variable prefix for comparable variable (OPENJDK_BUILD_)
|
||||
# $3 - optional human readable description for the type of compilers ("build " or "")
|
||||
AC_DEFUN([TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS],
|
||||
[
|
||||
if test "x[$]$1CC_VERSION_NUMBER" != "x[$]$1CXX_VERSION_NUMBER"; then
|
||||
AC_MSG_WARN([The $3C and C++ compilers have different version numbers, [$]$1CC_VERSION_NUMBER vs [$]$1CXX_VERSION_NUMBER.])
|
||||
AC_MSG_WARN([This typically indicates a broken setup, and is not supported])
|
||||
fi
|
||||
|
||||
# We only check CC_VERSION_NUMBER since we assume CXX_VERSION_NUMBER is equal.
|
||||
if [ [[ "[$]$1CC_VERSION_NUMBER" =~ (.*\.){4} ]] ]; then
|
||||
AC_MSG_WARN([C compiler version number has more than four parts (W.X.Y.Z): [$]$1CC_VERSION_NUMBER. Comparisons might be wrong.])
|
||||
fi
|
||||
|
||||
if [ [[ "[$]$1CC_VERSION_NUMBER" =~ [0-9]{6} ]] ]; then
|
||||
AC_MSG_WARN([C compiler version number has a part larger than 99999: [$]$1CC_VERSION_NUMBER. Comparisons might be wrong.])
|
||||
fi
|
||||
|
||||
$2COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "[$]$1CC_VERSION_NUMBER"`
|
||||
])
|
||||
|
||||
# Check if the configured compiler (C and C++) is of a specific version or
|
||||
# newer. TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS must have been called before.
|
||||
#
|
||||
# Arguments:
|
||||
# VERSION: The version string to check against the found version
|
||||
# IF_AT_LEAST: block to run if the compiler is at least this version (>=)
|
||||
# IF_OLDER_THAN: block to run if the compiler is older than this version (<)
|
||||
# PREFIX: Optional variable prefix for compiler to compare version for (OPENJDK_BUILD_)
|
||||
UTIL_DEFUN_NAMED([TOOLCHAIN_CHECK_COMPILER_VERSION],
|
||||
[*VERSION PREFIX IF_AT_LEAST IF_OLDER_THAN], [$@],
|
||||
[
|
||||
# Need to assign to a variable since m4 is blocked from modifying parts in [].
|
||||
REFERENCE_VERSION=ARG_VERSION
|
||||
|
||||
if [ [[ "$REFERENCE_VERSION" =~ (.*\.){4} ]] ]; then
|
||||
AC_MSG_ERROR([Internal error: Cannot compare to ARG_VERSION, only four parts (W.X.Y.Z) is supported])
|
||||
fi
|
||||
|
||||
if [ [[ "$REFERENCE_VERSION" =~ [0-9]{6} ]] ]; then
|
||||
AC_MSG_ERROR([Internal error: Cannot compare to ARG_VERSION, only parts < 99999 is supported])
|
||||
fi
|
||||
|
||||
# Version comparison method inspired by http://stackoverflow.com/a/24067243
|
||||
COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$REFERENCE_VERSION"`
|
||||
|
||||
if test [$]ARG_PREFIX[COMPARABLE_ACTUAL_VERSION] -ge $COMPARABLE_REFERENCE_VERSION ; then
|
||||
:
|
||||
ARG_IF_AT_LEAST
|
||||
else
|
||||
:
|
||||
ARG_IF_OLDER_THAN
|
||||
fi
|
||||
])
|
||||
|
||||
# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
|
||||
# Must have LD_VERSION_NUMBER.
|
||||
# $1 - optional variable prefix for compiler and version variables (BUILD_)
|
||||
# $2 - optional variable prefix for comparable variable (OPENJDK_BUILD_)
|
||||
AC_DEFUN([TOOLCHAIN_PREPARE_FOR_LD_VERSION_COMPARISONS],
|
||||
[
|
||||
if [ [[ "[$]$1LD_VERSION_NUMBER" =~ (.*\.){4} ]] ]; then
|
||||
AC_MSG_WARN([Linker version number has more than four parts (W.X.Y.Z): [$]$1LD_VERSION_NUMBER. Comparisons might be wrong.])
|
||||
fi
|
||||
|
||||
if [ [[ "[$]$1LD_VERSION_NUMBER" =~ [0-9]{6} ]] ]; then
|
||||
AC_MSG_WARN([Linker version number has a part larger than 99999: [$]$1LD_VERSION_NUMBER. Comparisons might be wrong.])
|
||||
fi
|
||||
|
||||
$2COMPARABLE_ACTUAL_LD_VERSION=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "[$]$1LD_VERSION_NUMBER"`
|
||||
])
|
||||
|
||||
# Check if the configured linker is of a specific version or
|
||||
# newer. TOOLCHAIN_PREPARE_FOR_LD_VERSION_COMPARISONS must have been called before.
|
||||
#
|
||||
# Arguments:
|
||||
# VERSION: The version string to check against the found version
|
||||
# IF_AT_LEAST: block to run if the compiler is at least this version (>=)
|
||||
# IF_OLDER_THAN: block to run if the compiler is older than this version (<)
|
||||
# PREFIX: Optional variable prefix for compiler to compare version for (OPENJDK_BUILD_)
|
||||
UTIL_DEFUN_NAMED([TOOLCHAIN_CHECK_LINKER_VERSION],
|
||||
[*VERSION PREFIX IF_AT_LEAST IF_OLDER_THAN], [$@],
|
||||
[
|
||||
# Need to assign to a variable since m4 is blocked from modifying parts in [].
|
||||
REFERENCE_VERSION=ARG_VERSION
|
||||
|
||||
if [ [[ "$REFERENCE_VERSION" =~ (.*\.){4} ]] ]; then
|
||||
AC_MSG_ERROR([Internal error: Cannot compare to ARG_VERSION, only four parts (W.X.Y.Z) is supported])
|
||||
fi
|
||||
|
||||
if [ [[ "$REFERENCE_VERSION" =~ [0-9]{6} ]] ]; then
|
||||
AC_MSG_ERROR([Internal error: Cannot compare to ARG_VERSION, only parts < 99999 is supported])
|
||||
fi
|
||||
|
||||
# Version comparison method inspired by http://stackoverflow.com/a/24067243
|
||||
COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d%05d\n", [$]1, [$]2, [$]3, [$]4) }' <<< "$REFERENCE_VERSION"`
|
||||
|
||||
if test [$]ARG_PREFIX[COMPARABLE_ACTUAL_LD_VERSION] -ge $COMPARABLE_REFERENCE_VERSION ; then
|
||||
:
|
||||
ARG_IF_AT_LEAST
|
||||
else
|
||||
:
|
||||
ARG_IF_OLDER_THAN
|
||||
fi
|
||||
])
|
||||
|
||||
# Setup a number of variables describing how native output files are
|
||||
# named on this platform/toolchain.
|
||||
AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS],
|
||||
[
|
||||
# Define filename patterns
|
||||
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
||||
LIBRARY_PREFIX=
|
||||
SHARED_LIBRARY_SUFFIX='.dll'
|
||||
STATIC_LIBRARY_SUFFIX='.lib'
|
||||
OBJ_SUFFIX='.obj'
|
||||
EXECUTABLE_SUFFIX='.exe'
|
||||
else
|
||||
LIBRARY_PREFIX=lib
|
||||
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
SHARED_LIBRARY_SUFFIX='.dylib'
|
||||
else
|
||||
SHARED_LIBRARY_SUFFIX='.so'
|
||||
fi
|
||||
STATIC_LIBRARY_SUFFIX='.a'
|
||||
OBJ_SUFFIX='.o'
|
||||
EXECUTABLE_SUFFIX=''
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBRARY_PREFIX)
|
||||
AC_SUBST(SHARED_LIBRARY_SUFFIX)
|
||||
AC_SUBST(STATIC_LIBRARY_SUFFIX)
|
||||
AC_SUBST(OBJ_SUFFIX)
|
||||
AC_SUBST(EXECUTABLE_SUFFIX)
|
||||
])
|
||||
|
||||
# Determine which toolchain type to use, and make sure it is valid for this
|
||||
# platform. Setup various information about the selected toolchain.
|
||||
AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
|
||||
[
|
||||
AC_ARG_WITH(toolchain-type, [AS_HELP_STRING([--with-toolchain-type],
|
||||
[the toolchain type (or family) to use, use '--help' to show possible values @<:@platform dependent@:>@])])
|
||||
|
||||
# Linux x86_64 needs higher binutils after 8265783
|
||||
# (this really is a dependency on as version, but we take ld as a check for a general binutils version)
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
|
||||
TOOLCHAIN_MINIMUM_LD_VERSION_gcc="2.25"
|
||||
fi
|
||||
|
||||
# Use indirect variable referencing
|
||||
toolchain_var_name=VALID_TOOLCHAINS_$OPENJDK_BUILD_OS
|
||||
VALID_TOOLCHAINS=${!toolchain_var_name}
|
||||
|
||||
# First toolchain type in the list is the default
|
||||
DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
|
||||
|
||||
if test "x$with_toolchain_type" = xlist; then
|
||||
# List all toolchains
|
||||
AC_MSG_NOTICE([The following toolchains are valid on this platform:])
|
||||
for toolchain in $VALID_TOOLCHAINS; do
|
||||
toolchain_var_name=TOOLCHAIN_DESCRIPTION_$toolchain
|
||||
TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
|
||||
$PRINTF " %-10s %s\n" $toolchain "$TOOLCHAIN_DESCRIPTION"
|
||||
done
|
||||
|
||||
exit 0
|
||||
elif test "x$with_toolchain_type" != x; then
|
||||
# User override; check that it is valid
|
||||
if test "x${VALID_TOOLCHAINS/$with_toolchain_type/}" = "x${VALID_TOOLCHAINS}"; then
|
||||
AC_MSG_NOTICE([Toolchain type $with_toolchain_type is not valid on this platform.])
|
||||
AC_MSG_NOTICE([Valid toolchains: $VALID_TOOLCHAINS.])
|
||||
AC_MSG_ERROR([Cannot continue.])
|
||||
fi
|
||||
TOOLCHAIN_TYPE=$with_toolchain_type
|
||||
else
|
||||
# No flag given, use default
|
||||
TOOLCHAIN_TYPE=$DEFAULT_TOOLCHAIN
|
||||
fi
|
||||
AC_SUBST(TOOLCHAIN_TYPE)
|
||||
|
||||
TOOLCHAIN_CC_BINARY_clang="ibm-clang_r clang"
|
||||
TOOLCHAIN_CC_BINARY_gcc="gcc"
|
||||
TOOLCHAIN_CC_BINARY_microsoft="cl"
|
||||
|
||||
TOOLCHAIN_CXX_BINARY_clang="ibm-clang++_r clang++"
|
||||
TOOLCHAIN_CXX_BINARY_gcc="g++"
|
||||
TOOLCHAIN_CXX_BINARY_microsoft="cl"
|
||||
|
||||
# Use indirect variable referencing
|
||||
toolchain_var_name=TOOLCHAIN_DESCRIPTION_$TOOLCHAIN_TYPE
|
||||
TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
|
||||
toolchain_var_name=TOOLCHAIN_MINIMUM_VERSION_$TOOLCHAIN_TYPE
|
||||
TOOLCHAIN_MINIMUM_VERSION=${!toolchain_var_name}
|
||||
toolchain_var_name=TOOLCHAIN_MINIMUM_LD_VERSION_$TOOLCHAIN_TYPE
|
||||
TOOLCHAIN_MINIMUM_LD_VERSION=${!toolchain_var_name}
|
||||
toolchain_var_name=TOOLCHAIN_CC_BINARY_$TOOLCHAIN_TYPE
|
||||
TOOLCHAIN_CC_BINARY=${!toolchain_var_name}
|
||||
toolchain_var_name=TOOLCHAIN_CXX_BINARY_$TOOLCHAIN_TYPE
|
||||
TOOLCHAIN_CXX_BINARY=${!toolchain_var_name}
|
||||
|
||||
TOOLCHAIN_SETUP_FILENAME_PATTERNS
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = "x$DEFAULT_TOOLCHAIN"; then
|
||||
AC_MSG_NOTICE([Using default toolchain $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)])
|
||||
else
|
||||
AC_MSG_NOTICE([Using user selected toolchain $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION). Default toolchain is $DEFAULT_TOOLCHAIN.])
|
||||
fi
|
||||
])
|
||||
|
||||
# Before we start detecting the toolchain executables, we might need some
|
||||
# special setup, e.g. additional paths etc.
|
||||
AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
|
||||
[
|
||||
# Store the CFLAGS etc passed to the configure script.
|
||||
ORG_CFLAGS="$CFLAGS"
|
||||
ORG_CXXFLAGS="$CXXFLAGS"
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
|
||||
if test "x$XCODEBUILD" != x; then
|
||||
XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2> /dev/null | $HEAD -n 1`
|
||||
$ECHO "$XCODE_VERSION_OUTPUT" | $GREP "^Xcode " > /dev/null
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_NOTICE([xcodebuild -version output: $XCODE_VERSION_OUTPUT])
|
||||
AC_MSG_ERROR([Failed to determine Xcode version])
|
||||
fi
|
||||
|
||||
# For Xcode, we set the Xcode version as TOOLCHAIN_VERSION
|
||||
TOOLCHAIN_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | $CUT -f 2 -d ' '`
|
||||
TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode $TOOLCHAIN_VERSION"
|
||||
if test "x$TOOLCHAIN_VERSION" = "x16" || test "x$TOOLCHAIN_VERSION" = "x16.1" ; then
|
||||
AC_MSG_NOTICE([Xcode $TOOLCHAIN_VERSION has a compiler bug that causes the build to fail.])
|
||||
AC_MSG_NOTICE([Please use Xcode 16.2 or later, or a version prior to 16.])
|
||||
AC_MSG_ERROR([Compiler version is not supported.])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(TOOLCHAIN_VERSION)
|
||||
|
||||
# For the microsoft toolchain the toolchain path needs to be added to the
|
||||
# normal path, or the compiler will not work in some situations in later
|
||||
# configure checks.
|
||||
if test "x$TOOLCHAIN_TYPE" = "xmicrosoft" && test "x$TOOLCHAIN_PATH" != x; then
|
||||
export PATH=$TOOLCHAIN_PATH:$PATH
|
||||
fi
|
||||
])
|
||||
|
||||
# Restore path, etc
|
||||
AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION],
|
||||
[
|
||||
# Restore the flags to the user specified values.
|
||||
# This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
|
||||
CFLAGS="$ORG_CFLAGS"
|
||||
CXXFLAGS="$ORG_CXXFLAGS"
|
||||
])
|
||||
|
||||
# Check if a compiler is of the toolchain type we expect, and save the version
|
||||
# information from it. If the compiler does not match the expected type,
|
||||
# this function will abort using AC_MSG_ERROR. If it matches, the version will
|
||||
# be stored in CC_VERSION_NUMBER/CXX_VERSION_NUMBER (as a dotted number), and
|
||||
# the full version string in CC_VERSION_STRING/CXX_VERSION_STRING.
|
||||
#
|
||||
# $1 = compiler to test (CC or CXX)
|
||||
# $2 = human readable name of compiler (C or C++)
|
||||
AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION],
|
||||
[
|
||||
COMPILER=[$]$1
|
||||
COMPILER_NAME=$2
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# There is no specific version flag, but all output starts with a version string.
|
||||
# First line typically looks something like:
|
||||
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
|
||||
# but the compiler name may vary depending on locale.
|
||||
COMPILER_VERSION_OUTPUT=`$COMPILER 2>&1 1>/dev/null | $HEAD -n 1 | $TR -d '\r'`
|
||||
# Check that this is likely to be Microsoft CL.EXE.
|
||||
$ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft" > /dev/null
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
|
||||
AC_MSG_NOTICE([The result from running it was: "$COMPILER_VERSION_OUTPUT"])
|
||||
AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
|
||||
fi
|
||||
# Collapse compiler output into a single line
|
||||
COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
|
||||
COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
||||
$SED -e 's/^.*ersion.\(@<:@1-9@:>@@<:@0-9.@:>@*\) .*$/\1/'`
|
||||
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
# gcc --version output typically looks like
|
||||
# gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
|
||||
# Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
# This is free software; see the source for copying conditions. There is NO
|
||||
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# or look like
|
||||
# gcc (GCC) 10.2.1 20200825 (Alibaba 10.2.1-3.8 2.32)
|
||||
# Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
# This is free software; see the source for copying conditions. There is NO
|
||||
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
|
||||
# Check that this is likely to be GCC.
|
||||
$ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Free Software Foundation" > /dev/null
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
|
||||
AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION"])
|
||||
AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
|
||||
fi
|
||||
# Remove Copyright and legalese from version string, and
|
||||
# collapse into a single line
|
||||
COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
||||
$SED -e 's/ *Copyright .*//'`
|
||||
COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
||||
$AWK -F ')' '{print [$]2}' | \
|
||||
$AWK '{print [$]1}'`
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
# clang --version output typically looks like
|
||||
# Apple clang version 15.0.0 (clang-1500.3.9.4)
|
||||
# Target: arm64-apple-darwin23.2.0
|
||||
# Thread model: posix
|
||||
# InstalledDir: /Library/Developer/CommandLineTools/usr/bin
|
||||
# or
|
||||
# clang version 10.0.0-4ubuntu1
|
||||
# Target: x86_64-pc-linux-gnu
|
||||
# Thread model: posix
|
||||
# InstalledDir: /usr/bin
|
||||
# Target: x86_64-pc-linux-gnu
|
||||
# Thread model: posix
|
||||
# or
|
||||
# IBM Open XL C/C++ for AIX 17.1.0 (5725-C72, 5765-J18), clang version 13.0.0
|
||||
# Target: powerpc-ibm-aix7.2.0.0
|
||||
# Thread model: posix
|
||||
# InstalledDir: /opt/IBM/openxlC/17.1.0/bin
|
||||
COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
|
||||
# Check that this is likely to be clang
|
||||
$ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "clang" > /dev/null
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
|
||||
AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_OUTPUT"])
|
||||
AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
|
||||
fi
|
||||
# Remove "Thread model:" and further details from the version string, and
|
||||
# collapse into a single line
|
||||
COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
||||
$SED -e 's/ *Thread model: .*//'`
|
||||
COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
||||
$SED -e 's/^.*clang version \(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
|
||||
else
|
||||
AC_MSG_ERROR([Unknown toolchain type $TOOLCHAIN_TYPE.])
|
||||
fi
|
||||
# This sets CC_VERSION_NUMBER or CXX_VERSION_NUMBER. (This comment is a grep marker)
|
||||
$1_VERSION_NUMBER="$COMPILER_VERSION_NUMBER"
|
||||
# This sets CC_VERSION_STRING or CXX_VERSION_STRING. (This comment is a grep marker)
|
||||
$1_VERSION_STRING="$COMPILER_VERSION_STRING"
|
||||
|
||||
AC_MSG_NOTICE([Using $TOOLCHAIN_TYPE $COMPILER_NAME compiler version $COMPILER_VERSION_NUMBER @<:@$COMPILER_VERSION_STRING@:>@])
|
||||
])
|
||||
|
||||
# Try to locate the given C or C++ compiler in the path, or otherwise.
|
||||
#
|
||||
# $1 = compiler to test (CC or CXX)
|
||||
# $2 = human readable name of compiler (C or C++)
|
||||
# $3 = compiler name to search for
|
||||
AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
|
||||
[
|
||||
COMPILER_NAME=$2
|
||||
SEARCH_LIST="$3"
|
||||
|
||||
if test "x[$]$1" != x; then
|
||||
# User has supplied compiler name already, always let that override.
|
||||
AC_MSG_NOTICE([Will use user supplied compiler $1=[$]$1])
|
||||
if test "x`basename [$]$1`" = "x[$]$1"; then
|
||||
# A command without a complete path is provided, search $PATH.
|
||||
|
||||
UTIL_LOOKUP_PROGS(POTENTIAL_$1, [$]$1)
|
||||
if test "x$POTENTIAL_$1" != x; then
|
||||
$1=$POTENTIAL_$1
|
||||
else
|
||||
AC_MSG_ERROR([User supplied compiler $1=[$]$1 could not be found])
|
||||
fi
|
||||
else
|
||||
# Otherwise it might already be a complete path
|
||||
if test ! -x "[$]$1"; then
|
||||
AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist])
|
||||
fi
|
||||
fi
|
||||
$1_IS_USER_SUPPLIED=true
|
||||
else
|
||||
# No user supplied value. Locate compiler ourselves.
|
||||
|
||||
# If we are cross compiling, assume cross compilation tools follows the
|
||||
# cross compilation standard where they are prefixed with the autoconf
|
||||
# standard name for the target. For example the binary
|
||||
# i686-sun-solaris2.10-gcc will cross compile for i686-sun-solaris2.10.
|
||||
# If we are not cross compiling, then the default compiler name will be
|
||||
# used.
|
||||
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(POTENTIAL_$1, $SEARCH_LIST)
|
||||
if test "x$POTENTIAL_$1" != x; then
|
||||
$1=$POTENTIAL_$1
|
||||
else
|
||||
HELP_MSG_MISSING_DEPENDENCY([devkit])
|
||||
AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
|
||||
fi
|
||||
$1_IS_USER_SUPPLIED=false
|
||||
fi
|
||||
|
||||
# Now we have a compiler binary in $1. Make sure it's okay.
|
||||
TEST_COMPILER="[$]$1"
|
||||
|
||||
AC_MSG_CHECKING([resolved symbolic links for $1])
|
||||
SYMLINK_ORIGINAL="$TEST_COMPILER"
|
||||
UTIL_REMOVE_SYMBOLIC_LINKS(SYMLINK_ORIGINAL)
|
||||
if test "x$TEST_COMPILER" = "x$SYMLINK_ORIGINAL"; then
|
||||
AC_MSG_RESULT([no symlink])
|
||||
else
|
||||
AC_MSG_RESULT([$SYMLINK_ORIGINAL])
|
||||
|
||||
# We can't handle ccache by gcc wrappers, since we need to know if we're
|
||||
# using ccache. Instead ccache usage must be controlled by a configure option.
|
||||
COMPILER_BASENAME=`$BASENAME "$SYMLINK_ORIGINAL"`
|
||||
if test "x$COMPILER_BASENAME" = "xccache"; then
|
||||
AC_MSG_NOTICE([Please use --enable-ccache instead of providing a wrapped compiler.])
|
||||
AC_MSG_ERROR([$TEST_COMPILER is a symbolic link to ccache. This is not supported.])
|
||||
fi
|
||||
fi
|
||||
|
||||
TOOLCHAIN_EXTRACT_COMPILER_VERSION([$1], [$COMPILER_NAME])
|
||||
])
|
||||
|
||||
# Retrieve the linker version number and store it in LD_VERSION_NUMBER
|
||||
# (as a dotted number), and
|
||||
# the full version string in LD_VERSION_STRING.
|
||||
#
|
||||
# $1 = linker to test (LD or BUILD_LD)
|
||||
# $2 = human readable name of linker (Linker or BuildLinker)
|
||||
AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION],
|
||||
[
|
||||
LINKER=[$]$1
|
||||
LINKER_NAME="$2"
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# There is no specific version flag, but all output starts with a version string.
|
||||
# First line typically looks something like:
|
||||
# Microsoft (R) Incremental Linker Version 12.00.31101.0
|
||||
LINKER_VERSION_STRING=`$LINKER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
|
||||
# Extract version number
|
||||
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
|
||||
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
|
||||
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
# gcc -Wl,-version output typically looks like:
|
||||
# GNU ld (GNU Binutils for Ubuntu) 2.26.1
|
||||
# Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
# This program is free software; [...]
|
||||
# If using gold it will look like:
|
||||
# GNU gold (GNU Binutils 2.30) 1.15
|
||||
LINKER_VERSION_STRING=`$LINKER -Wl,--version 2> /dev/null | $HEAD -n 1`
|
||||
# Extract version number
|
||||
if [ [[ "$LINKER_VERSION_STRING" == *gold* ]] ]; then
|
||||
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
|
||||
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*) .*/\1/'` ]
|
||||
$1_TYPE=gold
|
||||
else
|
||||
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
|
||||
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
|
||||
fi
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
# clang -Wl,-v output typically looks like
|
||||
# @(#)PROGRAM:ld PROJECT:ld64-305
|
||||
# configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
|
||||
# Library search paths: [...]
|
||||
# or
|
||||
# GNU ld (GNU Binutils for Ubuntu) 2.26.1
|
||||
|
||||
LINKER_VERSION_STRING=`$LINKER -Wl,-v 2>&1 | $HEAD -n 1`
|
||||
# Check if we're using the GNU ld
|
||||
$ECHO "$LINKER_VERSION_STRING" | $GREP "GNU" > /dev/null
|
||||
if test $? -eq 0; then
|
||||
# Extract version number
|
||||
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
|
||||
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
|
||||
else
|
||||
# Extract version number
|
||||
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
|
||||
$SED -e 's/.*-\([0-9][0-9]*\)/\1/'` ]
|
||||
fi
|
||||
fi
|
||||
|
||||
$1_VERSION_NUMBER="$LINKER_VERSION_NUMBER"
|
||||
$1_VERSION_STRING="$LINKER_VERSION_STRING"
|
||||
|
||||
AC_MSG_NOTICE([Using $TOOLCHAIN_TYPE $LINKER_NAME version $LINKER_VERSION_NUMBER @<:@$LINKER_VERSION_STRING@:>@])
|
||||
])
|
||||
|
||||
# Make sure we did not pick up /usr/bin/link, which is the unix-style link
|
||||
# executable.
|
||||
#
|
||||
# $1 = linker to test (LD or BUILD_LD)
|
||||
AC_DEFUN(TOOLCHAIN_VERIFY_LINK_BINARY,
|
||||
[
|
||||
LINKER=[$]$1
|
||||
|
||||
AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
|
||||
$LINKER --version > /dev/null
|
||||
if test $? -eq 0 ; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([$LINKER is the winenv link tool. Please check your PATH and rerun configure.])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
])
|
||||
# Detect the core components of the toolchain, i.e. the compilers (CC and CXX),
|
||||
# preprocessor (CPP and CXXCPP), the linker (LD), the assembler (AS) and the
|
||||
# archiver (AR). Verify that the compilers are correct according to the
|
||||
# toolchain type.
|
||||
AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
|
||||
[
|
||||
#
|
||||
# Setup the compilers (CC and CXX)
|
||||
#
|
||||
TOOLCHAIN_FIND_COMPILER([CC], [C], $TOOLCHAIN_CC_BINARY)
|
||||
# Now that we have resolved CC ourself, let autoconf have its go at it
|
||||
AC_PROG_CC([$CC])
|
||||
|
||||
TOOLCHAIN_FIND_COMPILER([CXX], [C++], $TOOLCHAIN_CXX_BINARY)
|
||||
# Now that we have resolved CXX ourself, let autoconf have its go at it
|
||||
AC_PROG_CXX([$CXX])
|
||||
|
||||
# This is the compiler version number on the form X.Y[.Z]
|
||||
AC_SUBST(CC_VERSION_NUMBER)
|
||||
AC_SUBST(CXX_VERSION_NUMBER)
|
||||
|
||||
TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS
|
||||
|
||||
if test "x$TOOLCHAIN_MINIMUM_VERSION" != x; then
|
||||
TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: $TOOLCHAIN_MINIMUM_VERSION,
|
||||
IF_OLDER_THAN: [
|
||||
AC_MSG_WARN([You are using $TOOLCHAIN_TYPE $CC_VERSION_NUMBER which is older than $TOOLCHAIN_MINIMUM_VERSION. This is not a supported configuration.])
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
#
|
||||
# Setup the preprocessor (CPP and CXXCPP)
|
||||
#
|
||||
AC_PROG_CPP
|
||||
UTIL_FIXUP_EXECUTABLE(CPP)
|
||||
AC_PROG_CXXCPP
|
||||
UTIL_FIXUP_EXECUTABLE(CXXCPP)
|
||||
|
||||
#
|
||||
# Setup the linker (LD)
|
||||
#
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# In the Microsoft toolchain we have a separate LD command "link".
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(LD, link)
|
||||
TOOLCHAIN_VERIFY_LINK_BINARY(LD)
|
||||
LDCXX="$LD"
|
||||
else
|
||||
# All other toolchains use the compiler to link.
|
||||
LD="$CC"
|
||||
LDCXX="$CXX"
|
||||
# Force use of lld, since that is what we expect when setting flags later on
|
||||
if test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
LD="$LD -fuse-ld=lld"
|
||||
LDCXX="$LDCXX -fuse-ld=lld"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(LD)
|
||||
# FIXME: it should be CXXLD, according to standard (cf CXXCPP)
|
||||
AC_SUBST(LDCXX)
|
||||
|
||||
TOOLCHAIN_EXTRACT_LD_VERSION([LD], [linker])
|
||||
TOOLCHAIN_PREPARE_FOR_LD_VERSION_COMPARISONS
|
||||
|
||||
if test "x$TOOLCHAIN_MINIMUM_LD_VERSION" != x; then
|
||||
AC_MSG_NOTICE([comparing linker version to minimum version $TOOLCHAIN_MINIMUM_LD_VERSION])
|
||||
TOOLCHAIN_CHECK_LINKER_VERSION(VERSION: $TOOLCHAIN_MINIMUM_LD_VERSION,
|
||||
IF_OLDER_THAN: [
|
||||
AC_MSG_ERROR([You are using a linker older than $TOOLCHAIN_MINIMUM_LD_VERSION. This is not a supported configuration.])
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
#
|
||||
# Setup the assembler (AS)
|
||||
#
|
||||
if test "x$TOOLCHAIN_TYPE" != xmicrosoft; then
|
||||
AS="$CC -c"
|
||||
else
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
|
||||
# On Windows aarch64, the assembler is "armasm64.exe"
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(AS, armasm64)
|
||||
elif test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
|
||||
# On Windows x64, the assembler is "ml64.exe"
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(AS, ml64)
|
||||
else
|
||||
# otherwise, the assembler is "ml.exe"
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(AS, ml)
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(AS)
|
||||
|
||||
#
|
||||
# Setup tools for creating static libraries (AR/LIB)
|
||||
#
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(LIB, lib)
|
||||
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(AR, ar gcc-ar)
|
||||
else
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(AR, ar)
|
||||
fi
|
||||
])
|
||||
|
||||
# Setup additional tools that is considered a part of the toolchain, but not the
|
||||
# core part. Many of these are highly platform-specific and do not exist,
|
||||
# and/or are not needed on all platforms.
|
||||
AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
|
||||
[
|
||||
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
|
||||
UTIL_LOOKUP_PROGS(LIPO, lipo)
|
||||
UTIL_REQUIRE_PROGS(OTOOL, otool)
|
||||
UTIL_REQUIRE_PROGS(INSTALL_NAME_TOOL, install_name_tool)
|
||||
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(METAL, metal)
|
||||
if test "x$METAL" = x; then
|
||||
AC_MSG_CHECKING([if metal can be run using xcrun])
|
||||
METAL="xcrun -sdk macosx metal"
|
||||
test_metal=`$METAL --version 2>&1`
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_NOTICE([A full XCode is required to build the JDK (not only command line tools)])
|
||||
AC_MSG_NOTICE([If you have XCode installed, you might need to reset the Xcode active developer directory])
|
||||
AC_MSG_NOTICE([using 'sudo xcode-select -r'])
|
||||
AC_MSG_ERROR([XCode tool 'metal' neither found in path nor with xcrun])
|
||||
else
|
||||
AC_MSG_RESULT([yes, will be using '$METAL'])
|
||||
fi
|
||||
fi
|
||||
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(METALLIB, metallib)
|
||||
if test "x$METALLIB" = x; then
|
||||
AC_MSG_CHECKING([if metallib can be run using xcrun])
|
||||
METALLIB="xcrun -sdk macosx metallib"
|
||||
test_metallib=`$METALLIB --version 2>&1`
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([XCode tool 'metallib' neither found in path nor with xcrun])
|
||||
else
|
||||
AC_MSG_RESULT([yes, will be using '$METALLIB'])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# Setup the manifest tool (MT)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(MT, mt)
|
||||
# Setup the resource compiler (RC)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(RC, rc)
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(DUMPBIN, dumpbin)
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_OS" != xwindows; then
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(STRIP, strip)
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(NM, nm gcc-nm)
|
||||
else
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(NM, nm)
|
||||
fi
|
||||
fi
|
||||
|
||||
# objcopy is used for moving debug symbols to separate files when
|
||||
# full debug symbols are enabled.
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(OBJCOPY, gobjcopy objcopy)
|
||||
fi
|
||||
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS(OBJDUMP, gobjdump objdump)
|
||||
|
||||
case $TOOLCHAIN_TYPE in
|
||||
gcc|clang)
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
UTIL_REQUIRE_TOOLCHAIN_PROGS(CXXFILT, ibm-llvm-cxxfilt)
|
||||
else
|
||||
UTIL_REQUIRE_TOOLCHAIN_PROGS(CXXFILT, c++filt)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Setup the build tools (i.e, the compiler and linker used to build programs
|
||||
# that should be run on the build platform, not the target platform, as a build
|
||||
# helper). Since the non-cross-compile case uses the normal, target compilers
|
||||
# for this, we can only do this after these have been setup.
|
||||
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
|
||||
[
|
||||
if test "x$COMPILE_TYPE" = "xcross"; then
|
||||
# Now we need to find a C/C++ compiler that can build executables for the
|
||||
# build platform. We can't use the AC_PROG_CC macro, since it can only be
|
||||
# used once. Also, we need to do this without adding a tools dir to the
|
||||
# path, otherwise we might pick up cross-compilers which don't use standard
|
||||
# naming.
|
||||
|
||||
OLDPATH="$PATH"
|
||||
|
||||
AC_ARG_WITH(build-devkit, [AS_HELP_STRING([--with-build-devkit],
|
||||
[Devkit to use for the build platform toolchain])])
|
||||
if test "x$with_build_devkit" = "xyes"; then
|
||||
AC_MSG_ERROR([--with-build-devkit must have a value])
|
||||
elif test -n "$with_build_devkit"; then
|
||||
if test ! -d "$with_build_devkit"; then
|
||||
AC_MSG_ERROR([--with-build-devkit points to non existing dir: $with_build_devkit])
|
||||
else
|
||||
UTIL_FIXUP_PATH([with_build_devkit])
|
||||
BUILD_DEVKIT_ROOT="$with_build_devkit"
|
||||
# Check for a meta data info file in the root of the devkit
|
||||
if test -f "$BUILD_DEVKIT_ROOT/devkit.info"; then
|
||||
# Process devkit.info so that existing devkit variables are not
|
||||
# modified by this
|
||||
$SED -e "s/^DEVKIT_/BUILD_DEVKIT_/g" \
|
||||
-e "s/\$DEVKIT_ROOT/\$BUILD_DEVKIT_ROOT/g" \
|
||||
-e "s/\$host/\$build/g" \
|
||||
$BUILD_DEVKIT_ROOT/devkit.info \
|
||||
> $CONFIGURESUPPORT_OUTPUTDIR/build-devkit.info
|
||||
. $CONFIGURESUPPORT_OUTPUTDIR/build-devkit.info
|
||||
# This potentially sets the following:
|
||||
# A descriptive name of the devkit
|
||||
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_NAME])
|
||||
# Corresponds to --with-extra-path
|
||||
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_EXTRA_PATH])
|
||||
# Corresponds to --with-toolchain-path
|
||||
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_TOOLCHAIN_PATH])
|
||||
# Corresponds to --with-sysroot
|
||||
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_SYSROOT])
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_VS_INCLUDE])
|
||||
BASIC_EVAL_BUILD_DEVKIT_VARIABLE([BUILD_DEVKIT_VS_LIB])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for build platform devkit])
|
||||
if test "x$BUILD_DEVKIT_NAME" != x; then
|
||||
AC_MSG_RESULT([$BUILD_DEVKIT_NAME in $BUILD_DEVKIT_ROOT])
|
||||
else
|
||||
AC_MSG_RESULT([$BUILD_DEVKIT_ROOT])
|
||||
fi
|
||||
|
||||
# Fallback default of just /bin if DEVKIT_PATH is not defined
|
||||
if test "x$BUILD_DEVKIT_TOOLCHAIN_PATH" = x; then
|
||||
BUILD_DEVKIT_TOOLCHAIN_PATH="$BUILD_DEVKIT_ROOT/bin"
|
||||
fi
|
||||
PATH="$BUILD_DEVKIT_TOOLCHAIN_PATH:$BUILD_DEVKIT_EXTRA_PATH"
|
||||
|
||||
BUILD_SYSROOT="$BUILD_DEVKIT_SYSROOT"
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# For historical reasons, paths are separated by ; in devkit.info
|
||||
BUILD_VS_INCLUDE="${BUILD_DEVKIT_VS_INCLUDE//;/:}"
|
||||
BUILD_VS_LIB="${BUILD_DEVKIT_VS_LIB//;/:}"
|
||||
|
||||
TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS(BUILD_, BUILD_)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# If we got no devkit, we need to go hunting for the proper env
|
||||
TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE($OPENJDK_BUILD_CPU, [$TOOLCHAIN_VERSION])
|
||||
TOOLCHAIN_EXTRACT_VISUAL_STUDIO_ENV($OPENJDK_BUILD_CPU, BUILD_)
|
||||
|
||||
# We cannot currently export the VS_PATH to spec.gmk. This is probably
|
||||
# strictly not correct, but seems to work anyway.
|
||||
|
||||
# Convert VS_INCLUDE and VS_LIB into sysroot flags
|
||||
TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS(BUILD_)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, cl, [$VS_PATH])
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, cl, [$VS_PATH])
|
||||
|
||||
# On windows, the assembler is "ml.exe". We currently don't need this so
|
||||
# do not require.
|
||||
if test "x$OPENJDK_BUILD_CPU_BITS" = "x64"; then
|
||||
# On 64 bit windows, the assembler is "ml64.exe"
|
||||
UTIL_LOOKUP_PROGS(BUILD_AS, ml64, [$VS_PATH])
|
||||
else
|
||||
# otherwise the assembler is "ml.exe"
|
||||
UTIL_LOOKUP_PROGS(BUILD_AS, ml, [$VS_PATH])
|
||||
fi
|
||||
|
||||
# On windows, the ar tool is lib.exe (used to create static libraries).
|
||||
# We currently don't need this so do not require.
|
||||
UTIL_LOOKUP_PROGS(BUILD_AR, lib, [$VS_PATH])
|
||||
|
||||
# In the Microsoft toolchain we have a separate LD command "link".
|
||||
UTIL_REQUIRE_PROGS(BUILD_LD, link, [$VS_PATH])
|
||||
TOOLCHAIN_VERIFY_LINK_BINARY(BUILD_LD)
|
||||
BUILD_LDCXX="$BUILD_LD"
|
||||
else
|
||||
if test "x$OPENJDK_BUILD_OS" = xmacosx; then
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, clang)
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, clang++)
|
||||
else
|
||||
UTIL_REQUIRE_PROGS(BUILD_CC, cc gcc)
|
||||
UTIL_REQUIRE_PROGS(BUILD_CXX, CC g++)
|
||||
fi
|
||||
UTIL_LOOKUP_PROGS(BUILD_NM, nm gcc-nm)
|
||||
UTIL_LOOKUP_PROGS(BUILD_AR, ar gcc-ar lib)
|
||||
UTIL_LOOKUP_PROGS(BUILD_OBJCOPY, objcopy)
|
||||
UTIL_LOOKUP_PROGS(BUILD_STRIP, strip)
|
||||
# Assume the C compiler is the assembler
|
||||
BUILD_AS="$BUILD_CC -c"
|
||||
# Just like for the target compiler, use the compiler as linker
|
||||
BUILD_LD="$BUILD_CC"
|
||||
BUILD_LDCXX="$BUILD_CXX"
|
||||
fi
|
||||
|
||||
PATH="$OLDPATH"
|
||||
|
||||
TOOLCHAIN_EXTRACT_COMPILER_VERSION(BUILD_CC, [BuildC])
|
||||
TOOLCHAIN_EXTRACT_COMPILER_VERSION(BUILD_CXX, [BuildC++])
|
||||
TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([BUILD_], [OPENJDK_BUILD_], [build ])
|
||||
TOOLCHAIN_EXTRACT_LD_VERSION(BUILD_LD, [build linker])
|
||||
TOOLCHAIN_PREPARE_FOR_LD_VERSION_COMPARISONS([BUILD_], [OPENJDK_BUILD_])
|
||||
else
|
||||
# If we are not cross compiling, use the normal target compilers for
|
||||
# building the build platform executables.
|
||||
BUILD_CC="$CC"
|
||||
BUILD_CXX="$CXX"
|
||||
BUILD_LD="$LD"
|
||||
BUILD_LDCXX="$LDCXX"
|
||||
BUILD_NM="$NM"
|
||||
BUILD_AS="$AS"
|
||||
BUILD_OBJCOPY="$OBJCOPY"
|
||||
BUILD_STRIP="$STRIP"
|
||||
BUILD_AR="$AR"
|
||||
|
||||
TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([], [OPENJDK_BUILD_], [build ])
|
||||
TOOLCHAIN_PREPARE_FOR_LD_VERSION_COMPARISONS([BUILD_], [OPENJDK_BUILD_])
|
||||
fi
|
||||
|
||||
AC_SUBST(BUILD_CC)
|
||||
AC_SUBST(BUILD_CXX)
|
||||
AC_SUBST(BUILD_LD)
|
||||
AC_SUBST(BUILD_LDCXX)
|
||||
AC_SUBST(BUILD_NM)
|
||||
AC_SUBST(BUILD_AS)
|
||||
AC_SUBST(BUILD_AR)
|
||||
])
|
||||
|
||||
# Do some additional checks on the detected tools.
|
||||
AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
|
||||
[
|
||||
# Check for extra potential brokenness.
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
# On Windows, double-check that we got the right compiler.
|
||||
CC_VERSION_OUTPUT=`$CC 2>&1 1>/dev/null | $HEAD -n 1 | $TR -d '\r'`
|
||||
COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"`
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
|
||||
if test "x$COMPILER_CPU_TEST" != "x80x86" -a "x$COMPILER_CPU_TEST" != "xx86"; then
|
||||
AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86" or "x86".])
|
||||
fi
|
||||
elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
|
||||
if test "x$COMPILER_CPU_TEST" != "xx64"; then
|
||||
AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
|
||||
fi
|
||||
elif test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
|
||||
if test "x$COMPILER_CPU_TEST" != "xARM64"; then
|
||||
AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "arm64".])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "x$OPENJDK_TARGET_OS" = xaix; then
|
||||
# Make sure we have the Open XL version of clang on AIX
|
||||
|
||||
$ECHO "$CC_VERSION_STRING" | $GREP "IBM Open XL C/C++ for AIX" > /dev/null
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_ERROR([ibm-clang_r version output check failed, output: $CC_VERSION_OUTPUT])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
# Check if linker has -z noexecstack.
|
||||
HAS_NOEXECSTACK=`$CC -Wl,--help 2>/dev/null | $GREP 'z noexecstack'`
|
||||
# This is later checked when setting flags.
|
||||
fi
|
||||
|
||||
# Setup hotspot lecagy names for toolchains
|
||||
HOTSPOT_TOOLCHAIN_TYPE=$TOOLCHAIN_TYPE
|
||||
if test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
HOTSPOT_TOOLCHAIN_TYPE=gcc
|
||||
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
HOTSPOT_TOOLCHAIN_TYPE=visCPP
|
||||
fi
|
||||
AC_SUBST(HOTSPOT_TOOLCHAIN_TYPE)
|
||||
])
|
||||
690
make/autoconf/toolchain_microsoft.m4
Normal file
690
make/autoconf/toolchain_microsoft.m4
Normal file
|
|
@ -0,0 +1,690 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 order of these defines the priority by which we try to find them.
|
||||
VALID_VS_VERSIONS="2022 2019 2026"
|
||||
|
||||
VS_DESCRIPTION_2019="Microsoft Visual Studio 2019"
|
||||
VS_VERSION_INTERNAL_2019=142
|
||||
VS_MSVCR_2019=vcruntime140.dll
|
||||
VS_VCRUNTIME_1_2019=vcruntime140_1.dll
|
||||
VS_MSVCP_2019=msvcp140.dll
|
||||
VS_ENVVAR_2019="VS160COMNTOOLS"
|
||||
VS_USE_UCRT_2019="true"
|
||||
VS_VS_INSTALLDIR_2019="Microsoft Visual Studio/2019"
|
||||
VS_EDITIONS_2019="BuildTools Community Professional Enterprise"
|
||||
VS_SDK_INSTALLDIR_2019=
|
||||
VS_VS_PLATFORM_NAME_2019="v142"
|
||||
VS_SDK_PLATFORM_NAME_2019=
|
||||
VS_SUPPORTED_2019=true
|
||||
VS_TOOLSET_SUPPORTED_2019=true
|
||||
|
||||
VS_DESCRIPTION_2022="Microsoft Visual Studio 2022"
|
||||
VS_VERSION_INTERNAL_2022=143
|
||||
VS_MSVCR_2022=vcruntime140.dll
|
||||
VS_VCRUNTIME_1_2022=vcruntime140_1.dll
|
||||
VS_MSVCP_2022=msvcp140.dll
|
||||
VS_ENVVAR_2022="VS170COMNTOOLS"
|
||||
VS_USE_UCRT_2022="true"
|
||||
VS_VS_INSTALLDIR_2022="Microsoft Visual Studio/2022"
|
||||
VS_EDITIONS_2022="BuildTools Community Professional Enterprise"
|
||||
VS_SDK_INSTALLDIR_2022=
|
||||
VS_VS_PLATFORM_NAME_2022="v143"
|
||||
VS_SDK_PLATFORM_NAME_2022=
|
||||
VS_SUPPORTED_2022=true
|
||||
VS_TOOLSET_SUPPORTED_2022=true
|
||||
|
||||
VS_DESCRIPTION_2026="Microsoft Visual Studio 2026"
|
||||
VS_VERSION_INTERNAL_2026=145
|
||||
VS_MSVCR_2026=vcruntime140.dll
|
||||
VS_VCRUNTIME_1_2026=vcruntime140_1.dll
|
||||
VS_MSVCP_2026=msvcp140.dll
|
||||
VS_ENVVAR_2026="VS180COMNTOOLS"
|
||||
VS_USE_UCRT_2026="true"
|
||||
VS_VS_INSTALLDIR_2026="Microsoft Visual Studio/18"
|
||||
VS_EDITIONS_2026="BuildTools Community Professional Enterprise"
|
||||
VS_SDK_INSTALLDIR_2026=
|
||||
VS_VS_PLATFORM_NAME_2026="v145"
|
||||
VS_SDK_PLATFORM_NAME_2026=
|
||||
VS_SUPPORTED_2026=true
|
||||
VS_TOOLSET_SUPPORTED_2026=true
|
||||
|
||||
################################################################################
|
||||
|
||||
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
|
||||
[
|
||||
if test "x$VS_ENV_CMD" = x; then
|
||||
TARGET_CPU="$1"
|
||||
VS_VERSION="$2"
|
||||
VS_BASE="$3"
|
||||
METHOD="$4"
|
||||
|
||||
UTIL_FIXUP_PATH(VS_BASE, NOFAIL)
|
||||
|
||||
if test "x$VS_BASE" != x && test -d "$VS_BASE"; then
|
||||
# In VS 2019, the default installation is in a subdir named after the edition.
|
||||
# Find the first one present and use that.
|
||||
if test "x$VS_EDITIONS" != x; then
|
||||
for edition in $VS_EDITIONS; do
|
||||
if test -d "$VS_BASE/$edition"; then
|
||||
VS_BASE="$VS_BASE/$edition"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
|
||||
if test "x$TARGET_CPU" = xx86_64; then
|
||||
VCVARSFILES="vcvars64.bat vcvarsx86_amd64.bat"
|
||||
elif test "x$TARGET_CPU" = xaarch64; then
|
||||
# for host x86-64, target aarch64
|
||||
# aarch64 requires Visual Studio 16.8 or higher
|
||||
VCVARSFILES="vcvarsarm64.bat vcvarsamd64_arm64.bat vcvarsx86_arm64.bat"
|
||||
fi
|
||||
|
||||
for VCVARSFILE in $VCVARSFILES; do
|
||||
if test -f "$VS_BASE/vc/auxiliary/build/$VCVARSFILE"; then
|
||||
VS_ENV_CMD="$VS_BASE/vc/auxiliary/build/$VCVARSFILE"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test "x$VS_ENV_CMD" = x; then
|
||||
AC_MSG_NOTICE([Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring])
|
||||
else
|
||||
# PLATFORM_TOOLSET is used during the compilation of the freetype sources
|
||||
# (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
|
||||
# 'v110' or 'v120' for VS 2010, 2012 or VS2013
|
||||
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
|
||||
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
|
||||
[
|
||||
if test "x$VS_ENV_CMD" = x; then
|
||||
TARGET_CPU="$1"
|
||||
VS_VERSION="$2"
|
||||
WIN_SDK_BASE="$3"
|
||||
METHOD="$4"
|
||||
|
||||
UTIL_FIXUP_PATH(WIN_SDK_BASE, NOFAIL)
|
||||
|
||||
if test "x$WIN_SDK_BASE" != x && test -d "$WIN_SDK_BASE"; then
|
||||
# There have been cases of partial or broken SDK installations. A missing
|
||||
# lib dir is not going to work.
|
||||
if test ! -d "$WIN_SDK_BASE/lib"; then
|
||||
AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
|
||||
AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
|
||||
elif test -f "$WIN_SDK_BASE/bin/setenv.cmd"; then
|
||||
AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
|
||||
VS_ENV_CMD="$WIN_SDK_BASE/bin/setenv.cmd"
|
||||
if test "x$TARGET_CPU" = xx86_64; then
|
||||
VS_ENV_ARGS="/x64"
|
||||
elif test "x$TARGET_CPU" = xaarch64; then
|
||||
VS_ENV_ARGS="/arm64"
|
||||
fi
|
||||
# PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
|
||||
# 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
|
||||
# TODO: improve detection for other versions of SDK
|
||||
eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
|
||||
else
|
||||
AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
|
||||
AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
|
||||
# build environment and assigns it to VS_ENV_CMD
|
||||
AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
|
||||
[
|
||||
# Since VS2017 MS provides the option to install previous minor versions of
|
||||
# the toolset. In order to build with a previous minor compiler toolset
|
||||
# version, pass -vcvars_ver=<toolset_version> argument to vcvarsall.bat.
|
||||
AC_ARG_WITH(msvc-toolset-version, [AS_HELP_STRING([--with-msvc-toolset-version],
|
||||
[specific MSVC toolset version to use, passed as -vcvars_ver argument to
|
||||
pass to vcvarsall.bat (Windows only)])])
|
||||
|
||||
TARGET_CPU="$1"
|
||||
VS_VERSION="$2"
|
||||
eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
|
||||
eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
|
||||
eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
|
||||
eval VS_EDITIONS="\${VS_EDITIONS_${VS_VERSION}}"
|
||||
eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
|
||||
eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}"
|
||||
eval VS_TOOLSET_SUPPORTED="\${VS_TOOLSET_SUPPORTED_${VS_VERSION}}"
|
||||
|
||||
VS_ENV_CMD=""
|
||||
|
||||
# When using --with-tools-dir, assume it points to the correct and default
|
||||
# version of Visual Studio or that --with-toolchain-version was also set.
|
||||
if test "x$with_tools_dir" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$with_tools_dir/../..], [--with-tools-dir])
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$with_tools_dir/../../..], [--with-tools-dir])
|
||||
if test "x$VS_ENV_CMD" = x; then
|
||||
# Having specified an argument which is incorrect will produce an instant failure;
|
||||
# we should not go on looking
|
||||
AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid])
|
||||
AC_MSG_NOTICE([Visual Studio installation. Please point to the VC/bin or VC/bin/amd64])
|
||||
AC_MSG_NOTICE([directory within the Visual Studio installation])
|
||||
AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$VS_COMNTOOLS" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable])
|
||||
fi
|
||||
if test "x$PROGRAMFILES" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
# Work around the insanely named ProgramFiles(x86) env variable
|
||||
PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
|
||||
if test "x$PROGRAMFILES_X86" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[c:/program files/$VS_INSTALL_DIR], [well-known name])
|
||||
TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[c:/program files (x86)/$VS_INSTALL_DIR], [well-known name])
|
||||
if test "x$SDK_INSTALL_DIR" != x; then
|
||||
if test "x$ProgramW6432" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$ProgramW6432/$SDK_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
if test "x$PROGRAMW6432" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
if test "x$PROGRAMFILES" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[c:/program files/$SDK_INSTALL_DIR], [well-known name])
|
||||
TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION],
|
||||
[c:/program files (x86)/$SDK_INSTALL_DIR], [well-known name])
|
||||
fi
|
||||
|
||||
VCVARS_VER=auto
|
||||
if test "x$VS_TOOLSET_SUPPORTED" != x; then
|
||||
if test "x$with_msvc_toolset_version" != x; then
|
||||
VCVARS_VER="$with_msvc_toolset_version"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
|
||||
AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
|
||||
[
|
||||
AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
|
||||
[the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
|
||||
|
||||
if test "x$with_toolchain_version" = xlist; then
|
||||
# List all toolchains
|
||||
AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
|
||||
for version in $VALID_VS_VERSIONS; do
|
||||
eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
|
||||
$PRINTF " %-10s %s\n" $version "$VS_DESCRIPTION"
|
||||
done
|
||||
|
||||
exit 0
|
||||
elif test "x$DEVKIT_VS_VERSION" != x; then
|
||||
VS_VERSION=$DEVKIT_VS_VERSION
|
||||
TOOLCHAIN_VERSION=$VS_VERSION
|
||||
# If the devkit has a name, use that as description
|
||||
VS_DESCRIPTION="$DEVKIT_NAME"
|
||||
if test "x$VS_DESCRIPTION" = x; then
|
||||
eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
|
||||
fi
|
||||
eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
|
||||
eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
|
||||
eval VCRUNTIME_1_NAME="\${VS_VCRUNTIME_1_${VS_VERSION}}"
|
||||
eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
|
||||
eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
|
||||
eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
|
||||
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
|
||||
|
||||
# For historical reasons, paths are separated by ; in devkit.info
|
||||
VS_INCLUDE=${DEVKIT_VS_INCLUDE//;/:}
|
||||
VS_LIB=${DEVKIT_VS_LIB//;/:}
|
||||
|
||||
AC_MSG_NOTICE([Found devkit $VS_DESCRIPTION])
|
||||
|
||||
elif test "x$with_toolchain_version" != x; then
|
||||
# User override; check that it is valid
|
||||
if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
|
||||
AC_MSG_NOTICE([Visual Studio version $with_toolchain_version is not valid.])
|
||||
AC_MSG_NOTICE([Valid Visual Studio versions: $VALID_VS_VERSIONS.])
|
||||
AC_MSG_ERROR([Cannot continue.])
|
||||
fi
|
||||
VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
|
||||
else
|
||||
# No flag given, use default
|
||||
VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
|
||||
fi
|
||||
|
||||
for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
|
||||
TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE($OPENJDK_TARGET_CPU, [$VS_VERSION])
|
||||
if test "x$VS_ENV_CMD" != x; then
|
||||
TOOLCHAIN_VERSION=$VS_VERSION
|
||||
eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
|
||||
eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
|
||||
eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
|
||||
eval VCRUNTIME_1_NAME="\${VS_VCRUNTIME_1_${VS_VERSION}}"
|
||||
eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
|
||||
eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
|
||||
eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
|
||||
# The rest of the variables are already evaluated while probing
|
||||
AC_MSG_NOTICE([Found $VS_DESCRIPTION])
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION"
|
||||
if test "x$VS_SUPPORTED" = "xfalse"; then
|
||||
UNSUPPORTED_TOOLCHAIN_VERSION=yes
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([TOOLCHAIN_EXTRACT_VISUAL_STUDIO_ENV],
|
||||
[
|
||||
TARGET_CPU=$1
|
||||
|
||||
AC_MSG_NOTICE([Trying to extract Visual Studio environment variables for $TARGET_CPU])
|
||||
AC_MSG_NOTICE([using $VS_ENV_CMD $VS_ENV_ARGS])
|
||||
|
||||
VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env-$TARGET_CPU"
|
||||
$MKDIR -p $VS_ENV_TMP_DIR
|
||||
|
||||
# Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
|
||||
# Instead create a shell script which will set the relevant variables when run.
|
||||
|
||||
OLDPATH="$PATH"
|
||||
# Make sure we only capture additions to PATH needed by VS.
|
||||
# Clear out path, but need system dir present for vsvars cmd file to be able to run
|
||||
export PATH=$WINENV_PREFIX/c/windows/system32
|
||||
# The "| cat" is to stop SetEnv.Cmd to mess with system colors on some systems
|
||||
# We can't pass -vcvars_ver=$VCVARS_VER here because cmd.exe eats all '='
|
||||
# in bat file arguments. :-(
|
||||
$FIXPATH $CMD /c "$TOPDIR/make/scripts/extract-vs-env.cmd" "$VS_ENV_CMD" \
|
||||
"$VS_ENV_TMP_DIR/set-vs-env.sh" $VCVARS_VER $VS_ENV_ARGS \
|
||||
> $VS_ENV_TMP_DIR/extract-vs-env.log | $CAT 2>&1
|
||||
PATH="$OLDPATH"
|
||||
|
||||
if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
|
||||
AC_MSG_NOTICE([Could not successfully extract the environment variables needed for the VS setup.])
|
||||
AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation.])
|
||||
AC_MSG_NOTICE([To analyze the problem, see extract-vs-env.log and extract-vs-env.bat in])
|
||||
AC_MSG_NOTICE([$VS_ENV_TMP_DIR.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
|
||||
# Remove windows line endings
|
||||
$SED -i -e 's|\r||g' $VS_ENV_TMP_DIR/set-vs-env.sh
|
||||
|
||||
# Now set all paths and other env variables by executing the generated
|
||||
# shell script. This will allow the rest of the configure script to find
|
||||
# and run the compiler in the proper way.
|
||||
AC_MSG_NOTICE([Setting extracted environment variables for $TARGET_CPU])
|
||||
. $VS_ENV_TMP_DIR/set-vs-env.sh
|
||||
|
||||
# Extract only what VS_ENV_CMD added to the PATH
|
||||
VS_PATH=${PATH_AFTER/"$PATH_BEFORE"}
|
||||
VS_PATH=${VS_PATH//::/:}
|
||||
|
||||
# Remove any paths containing # (typically F#) as that messes up make. This
|
||||
# is needed if visual studio was installed with F# support.
|
||||
[ VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[^:#]*#[^:]*://g'` ]
|
||||
|
||||
# Sometimes case is off
|
||||
if test -z "$WINDOWSSDKDIR"; then
|
||||
WINDOWSSDKDIR="$WindowsSdkDir"
|
||||
fi
|
||||
# Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
|
||||
# also define VCINSTALLDIR and WINDOWSSDKDIR. All are in
|
||||
# unix style.
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if the VS env variables were setup prior to running configure.
|
||||
# If not, then find vcvarsall.bat and run it automatically, and integrate
|
||||
# the set env variables into the spec file.
|
||||
AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
|
||||
[
|
||||
# Locate the vsvars bat file and save it as VS_ENV_CMD
|
||||
TOOLCHAIN_FIND_VISUAL_STUDIO
|
||||
|
||||
# If we have a devkit, we don't need to run VS_ENV_CMD
|
||||
if test "x$DEVKIT_VS_VERSION" = x; then
|
||||
if test "x$VS_ENV_CMD" != x; then
|
||||
# We have found a Visual Studio environment on disk, let's extract variables
|
||||
# from the vsvars bat file into shell variables in the configure script.
|
||||
TOOLCHAIN_EXTRACT_VISUAL_STUDIO_ENV($OPENJDK_TARGET_CPU)
|
||||
|
||||
# Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
|
||||
# also define VCINSTALLDIR and WINDOWSSDKDIR. All are in
|
||||
# unix style.
|
||||
else
|
||||
# We did not find a vsvars bat file.
|
||||
AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
|
||||
fi
|
||||
fi
|
||||
|
||||
# At this point, we should have correct variables in the environment
|
||||
AC_MSG_CHECKING([that Visual Studio variables have been correctly extracted])
|
||||
|
||||
if test "x$VCINSTALLDIR" != x || test "x$WINDOWSSDKDIR" != x \
|
||||
|| test "x$DEVKIT_NAME" != x; then
|
||||
if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
|
||||
AC_MSG_RESULT([no; Visual Studio present but broken])
|
||||
AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
|
||||
else
|
||||
AC_MSG_RESULT([ok])
|
||||
|
||||
# Turn VS_PATH into TOOLCHAIN_PATH
|
||||
TOOLCHAIN_PATH="$TOOLCHAIN_PATH:$VS_PATH"
|
||||
|
||||
# Convert VS_INCLUDE and VS_LIB into sysroot flags
|
||||
TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([not found])
|
||||
|
||||
if test "x$VS_ENV_CMD" = x; then
|
||||
AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk])
|
||||
else
|
||||
AC_MSG_NOTICE([Running the extraction script failed])
|
||||
fi
|
||||
AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation.])
|
||||
AC_MSG_NOTICE([To analyze the problem, see extract-vs-env.log and extract-vs-env.bat in])
|
||||
AC_MSG_NOTICE([$VS_ENV_TMP_DIR.])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
|
||||
[
|
||||
DLL_NAME="$1"
|
||||
POSSIBLE_MSVC_DLL="$2"
|
||||
METHOD="$3"
|
||||
if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
|
||||
AC_MSG_NOTICE([Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD])
|
||||
|
||||
# Need to check if the found msvcr is correct architecture
|
||||
AC_MSG_CHECKING([found $DLL_NAME architecture])
|
||||
MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
||||
CORRECT_MSVCR_ARCH=x86-64
|
||||
elif test "x$OPENJDK_TARGET_CPU" = xaarch64; then
|
||||
# The cygwin 'file' command only returns "PE32+ executable (DLL) (console), for MS Windows",
|
||||
# without specifying which architecture it is for specifically. This has been fixed upstream.
|
||||
# https://github.com/file/file/commit/b849b1af098ddd530094bf779b58431395db2e10#diff-ff2eced09e6860de75057dd731d092aeR142
|
||||
CORRECT_MSVCR_ARCH="PE32+ executable"
|
||||
fi
|
||||
if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
|
||||
AC_MSG_RESULT([ok])
|
||||
MSVC_DLL="$POSSIBLE_MSVC_DLL"
|
||||
AC_MSG_CHECKING([for $DLL_NAME])
|
||||
AC_MSG_RESULT([$MSVC_DLL])
|
||||
else
|
||||
AC_MSG_RESULT([incorrect, ignoring])
|
||||
AC_MSG_NOTICE([The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
|
||||
[
|
||||
DLL_NAME="$1"
|
||||
DLL_HELP="$2"
|
||||
MSVC_DLL=
|
||||
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
||||
vs_target_cpu=x64
|
||||
elif test "x$OPENJDK_TARGET_CPU" = xaarch64; then
|
||||
vs_target_cpu=arm64
|
||||
fi
|
||||
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
if test "x$VCINSTALLDIR" != x; then
|
||||
# Probe: Using well-known location
|
||||
POSSIBLE_MSVC_DLL="`ls $VCToolsRedistDir/$vs_target_cpu/microsoft.vc${VS_VERSION_INTERNAL}.crt/$DLL_NAME 2> /dev/null`"
|
||||
# If the above finds more than one file, loop over them.
|
||||
for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll],
|
||||
[well-known location in VCINSTALLDIR])
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
# Probe: Check in the Boot JDK directory.
|
||||
POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
|
||||
[well-known location in Boot JDK])
|
||||
fi
|
||||
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
# Probe: Look in the Windows system32 directory
|
||||
WIN_SYSTEMROOT="$SYSTEMROOT"
|
||||
UTIL_FIXUP_PATH(WIN_SYSTEMROOT, NOFAIL)
|
||||
if test "x$WIN_SYSTEMROOT" != x; then
|
||||
POSSIBLE_MSVC_DLL="$WIN_SYSTEMROOT/system32/$DLL_NAME"
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
|
||||
[well-known location in SYSTEMROOT])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
# Probe: If Visual Studio Express is installed, there is usually one with the debugger
|
||||
if test "x$VS100COMNTOOLS" != x; then
|
||||
WIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
|
||||
UTIL_FIXUP_PATH(WIN_VS_TOOLS_DIR, NOFAIL)
|
||||
if test "x$WIN_VS_TOOLS_DIR" != x; then
|
||||
POSSIBLE_MSVC_DLL=`$FIND "$WIN_VS_TOOLS_DIR" -name $DLL_NAME \
|
||||
| $GREP -i /$vs_target_cpu/ | $HEAD --lines 1`
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
|
||||
[search of VS100COMNTOOLS])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
# Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
|
||||
# (This was the original behaviour; kept since it might turn something up)
|
||||
if test "x$VCINSTALLDIR" != x; then
|
||||
POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \
|
||||
| $GREP x64 | $HEAD --lines 1`
|
||||
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
|
||||
[search of VCINSTALLDIR])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
AC_MSG_CHECKING([for $DLL_NAME])
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using ${DLL_HELP}.])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
|
||||
[
|
||||
AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
|
||||
[path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
|
||||
|
||||
if test "x$with_msvcr_dll" != x; then
|
||||
# If given explicitly by user, do not probe. If not present, fail directly.
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$with_msvcr_dll], [--with-msvcr-dll])
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll])
|
||||
fi
|
||||
MSVCR_DLL="$MSVC_DLL"
|
||||
elif test "x$DEVKIT_MSVCR_DLL" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$DEVKIT_MSVCR_DLL], [devkit])
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by devkit])
|
||||
fi
|
||||
MSVCR_DLL="$MSVC_DLL"
|
||||
else
|
||||
TOOLCHAIN_SETUP_MSVC_DLL([${MSVCR_NAME}], [--with-msvcr-dll])
|
||||
MSVCR_DLL="$MSVC_DLL"
|
||||
fi
|
||||
AC_SUBST(MSVCR_DLL)
|
||||
|
||||
AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll],
|
||||
[path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])])
|
||||
|
||||
if test "x$MSVCP_NAME" != "x"; then
|
||||
if test "x$with_msvcp_dll" != x; then
|
||||
# If given explicitly by user, do not probe. If not present, fail directly.
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$with_msvcp_dll], [--with-msvcp-dll])
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll])
|
||||
fi
|
||||
MSVCP_DLL="$MSVC_DLL"
|
||||
elif test "x$DEVKIT_MSVCP_DLL" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$DEVKIT_MSVCP_DLL], [devkit])
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by devkit])
|
||||
fi
|
||||
MSVCP_DLL="$MSVC_DLL"
|
||||
else
|
||||
TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}], [--with-msvcp-dll])
|
||||
MSVCP_DLL="$MSVC_DLL"
|
||||
fi
|
||||
AC_SUBST(MSVCP_DLL)
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(vcruntime-1-dll, [AS_HELP_STRING([--with-vcruntime-1-dll],
|
||||
[path to microsoft C++ runtime dll (vcruntime*_1.dll) (Windows x64 only) @<:@probed@:>@])])
|
||||
|
||||
if test "x$VCRUNTIME_1_NAME" != "x" && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
||||
if test "x$with_vcruntime_1_dll" != x; then
|
||||
# If given explicitly by user, do not probe. If not present, fail directly.
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($VCRUNTIME_1_NAME, [$with_vcruntime_1_dll],
|
||||
[--with-vcruntime-1-dll])
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
AC_MSG_ERROR([Could not find a proper $VCRUNTIME_1_NAME as specified by --with-vcruntime-1-dll])
|
||||
fi
|
||||
VCRUNTIME_1_DLL="$MSVC_DLL"
|
||||
elif test "x$DEVKIT_VCRUNTIME_1_DLL" != x; then
|
||||
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($VCRUNTIME_1_NAME, [$DEVKIT_VCRUNTIME_1_DLL], [devkit])
|
||||
if test "x$MSVC_DLL" = x; then
|
||||
AC_MSG_ERROR([Could not find a proper $VCRUNTIME_1_NAME as specified by devkit])
|
||||
fi
|
||||
VCRUNTIME_1_DLL="$MSVC_DLL"
|
||||
else
|
||||
TOOLCHAIN_SETUP_MSVC_DLL([${VCRUNTIME_1_NAME}], [--with-vcruntime-1-dll])
|
||||
VCRUNTIME_1_DLL="$MSVC_DLL"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(VCRUNTIME_1_DLL)
|
||||
|
||||
AC_ARG_WITH(ucrt-dll-dir, [AS_HELP_STRING([--with-ucrt-dll-dir],
|
||||
[path to Microsoft Windows Kit UCRT DLL dir (Windows only) @<:@probed@:>@])])
|
||||
|
||||
if test "x$USE_UCRT" = "xtrue" && test "x$OPENJDK_TARGET_CPU" != xaarch64; then
|
||||
AC_MSG_CHECKING([for UCRT DLL dir])
|
||||
if test "x$with_ucrt_dll_dir" != x; then
|
||||
if test -z "$(ls -d "$with_ucrt_dll_dir/"*.dll 2> /dev/null)"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Could not find any dlls in $with_ucrt_dll_dir])
|
||||
else
|
||||
AC_MSG_RESULT([$with_ucrt_dll_dir])
|
||||
UCRT_DLL_DIR="$with_ucrt_dll_dir"
|
||||
UTIL_FIXUP_PATH([UCRT_DLL_DIR])
|
||||
fi
|
||||
elif test "x$DEVKIT_UCRT_DLL_DIR" != "x"; then
|
||||
UCRT_DLL_DIR="$DEVKIT_UCRT_DLL_DIR"
|
||||
AC_MSG_RESULT($UCRT_DLL_DIR)
|
||||
else
|
||||
dll_subdir=$OPENJDK_TARGET_CPU
|
||||
if test "x$dll_subdir" = "xaarch64"; then
|
||||
dll_subdir="arm64"
|
||||
elif test "x$dll_subdir" = "xx86_64"; then
|
||||
dll_subdir="x64"
|
||||
fi
|
||||
UCRT_DLL_DIR="$WINDOWSSDKDIR/redist/ucrt/dlls/$dll_subdir"
|
||||
if test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then
|
||||
# Try with version subdir
|
||||
UCRT_DLL_DIR="`ls -d $WINDOWSSDKDIR/redist/*/ucrt/dlls/$dll_subdir \
|
||||
2> /dev/null | $SORT -d | $HEAD -n1`"
|
||||
if test -z "$UCRT_DLL_DIR" \
|
||||
|| test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Could not find any dlls in $UCRT_DLL_DIR])
|
||||
else
|
||||
AC_MSG_RESULT($UCRT_DLL_DIR)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT($UCRT_DLL_DIR)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
UCRT_DLL_DIR=
|
||||
fi
|
||||
AC_SUBST(UCRT_DLL_DIR)
|
||||
])
|
||||
|
||||
# Setup the sysroot flags and add them to global CFLAGS and LDFLAGS so
|
||||
# that configure can use them while detecting compilers.
|
||||
# TOOLCHAIN_TYPE is available here.
|
||||
# Param 1 - Optional prefix to SYSROOT variables. (e.g BUILD_)
|
||||
# Param 2 - Optional prefix to VS variables. (e.g BUILD_)
|
||||
AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS],
|
||||
[
|
||||
OLDIFS="$IFS"
|
||||
IFS=":"
|
||||
|
||||
# Convert VS_INCLUDE into SYSROOT_CFLAGS
|
||||
for ipath in [$]$2VS_INCLUDE; do
|
||||
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -I$ipath"
|
||||
done
|
||||
|
||||
# Convert VS_LIB into SYSROOT_LDFLAGS
|
||||
for libpath in [$]$2VS_LIB; do
|
||||
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -libpath:$libpath"
|
||||
done
|
||||
|
||||
IFS="$OLDIFS"
|
||||
|
||||
AC_SUBST($1SYSROOT_CFLAGS)
|
||||
AC_SUBST($1SYSROOT_LDFLAGS)
|
||||
])
|
||||
901
make/autoconf/util.m4
Normal file
901
make/autoconf/util.m4
Normal file
|
|
@ -0,0 +1,901 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
m4_include([util_paths.m4])
|
||||
|
||||
###############################################################################
|
||||
# Overwrite the existing version of AC_PROG_CC with our own custom variant.
|
||||
# Unlike the regular AC_PROG_CC, the compiler list must always be passed.
|
||||
AC_DEFUN([AC_PROG_CC],
|
||||
[
|
||||
AC_LANG_PUSH(C)
|
||||
AC_ARG_VAR([CC], [C compiler command])
|
||||
AC_ARG_VAR([CFLAGS], [C compiler flags])
|
||||
|
||||
_AC_ARG_VAR_LDFLAGS()
|
||||
_AC_ARG_VAR_LIBS()
|
||||
_AC_ARG_VAR_CPPFLAGS()
|
||||
|
||||
AC_CHECK_TOOLS(CC, [$1])
|
||||
|
||||
test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])
|
||||
|
||||
# Provide some information about the compiler.
|
||||
_AS_ECHO_LOG([checking for _AC_LANG compiler version])
|
||||
set X $ac_compile
|
||||
ac_compiler=$[2]
|
||||
for ac_option in --version -v -V -qversion -version; do
|
||||
_AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
|
||||
done
|
||||
|
||||
m4_expand_once([_AC_COMPILER_EXEEXT])
|
||||
m4_expand_once([_AC_COMPILER_OBJEXT])
|
||||
|
||||
_AC_PROG_CC_G
|
||||
|
||||
AC_LANG_POP(C)
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
# Overwrite the existing version of AC_PROG_CXX with our own custom variant.
|
||||
# Unlike the regular AC_PROG_CXX, the compiler list must always be passed.
|
||||
AC_DEFUN([AC_PROG_CXX],
|
||||
[
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_ARG_VAR([CXX], [C++ compiler command])
|
||||
AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])
|
||||
|
||||
_AC_ARG_VAR_LDFLAGS()
|
||||
_AC_ARG_VAR_LIBS()
|
||||
_AC_ARG_VAR_CPPFLAGS()
|
||||
|
||||
AC_CHECK_TOOLS(CXX, [$1])
|
||||
|
||||
# Provide some information about the compiler.
|
||||
_AS_ECHO_LOG([checking for _AC_LANG compiler version])
|
||||
set X $ac_compile
|
||||
ac_compiler=$[2]
|
||||
for ac_option in --version -v -V -qversion; do
|
||||
_AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
|
||||
done
|
||||
|
||||
m4_expand_once([_AC_COMPILER_EXEEXT])
|
||||
m4_expand_once([_AC_COMPILER_OBJEXT])
|
||||
|
||||
_AC_PROG_CXX_G
|
||||
|
||||
AC_LANG_POP(C++)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Create a function/macro that takes a series of named arguments. The call is
|
||||
# similar to AC_DEFUN, but the setup of the function looks like this:
|
||||
# UTIL_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [
|
||||
# ... do something
|
||||
# AC_MSG_NOTICE([Value of BAR is ARG_BAR])
|
||||
# ])
|
||||
# A star (*) in front of a named argument means that it is required and it's
|
||||
# presence will be verified. To pass e.g. the first value as a normal indexed
|
||||
# argument, use [m4_shift($@)] as the third argument instead of [$@]. These
|
||||
# arguments are referenced in the function by their name prefixed by ARG_, e.g.
|
||||
# "ARG_FOO".
|
||||
#
|
||||
# The generated function can be called like this:
|
||||
# MYFUNC(FOO: [foo-val],
|
||||
# BAR: [
|
||||
# $ECHO hello world
|
||||
# ])
|
||||
# Note that the argument value must start on the same line as the argument name.
|
||||
#
|
||||
# Argument 1: Name of the function to define
|
||||
# Argument 2: List of legal named arguments, with a * prefix for required arguments
|
||||
# Argument 3: Argument array to treat as named, typically $@
|
||||
# Argument 4: The main function body
|
||||
AC_DEFUN([UTIL_DEFUN_NAMED],
|
||||
[
|
||||
AC_DEFUN($1, [
|
||||
m4_foreach([arg], m4_split(m4_normalize($2)), [
|
||||
m4_if(m4_bregexp(arg, [^\*]), -1,
|
||||
[
|
||||
m4_set_add(legal_named_args, arg)
|
||||
],
|
||||
[
|
||||
m4_set_add(legal_named_args, m4_substr(arg, 1))
|
||||
m4_set_add(required_named_args, m4_substr(arg, 1))
|
||||
]
|
||||
)
|
||||
])
|
||||
|
||||
# Delicate quoting and unquoting sequence to ensure the actual value is passed along unchanged
|
||||
# For details on how this works, see https://git.openjdk.org/jdk/pull/11458#discussion_r1038173051
|
||||
# WARNING: Proceed at the risk of your own sanity, getting this to work has made me completely
|
||||
# incapable of feeling love or any other positive emotion
|
||||
# ~Julian
|
||||
m4_foreach([arg], m4_dquote(m4_dquote_elt($3)), [
|
||||
m4_if(m4_index(arg, [: ]), -1, [m4_define([arg], m4_dquote(m4_bpatsubst(m4_dquote(arg), [:], [: ])))])
|
||||
m4_define(arg_name, m4_substr(arg, 0, m4_index(arg, [: ])))
|
||||
m4_set_contains(legal_named_args, arg_name, [],[AC_MSG_ERROR([Internal error: m4_if(arg_name, , arg, arg_name) is not a valid named argument to [$1]. Valid arguments are 'm4_set_contents(defined_args, [ ]) m4_set_contents(legal_named_args, [ ])'.])])
|
||||
m4_set_remove(required_named_args, arg_name)
|
||||
m4_set_remove(legal_named_args, arg_name)
|
||||
m4_pushdef([ARG_][]arg_name, m4_bpatsubst(m4_bpatsubst(m4_dquote(m4_dquote(arg)), arg_name[: ]), [^\s*]))
|
||||
m4_set_add(defined_args, arg_name)
|
||||
m4_undefine([arg_name])
|
||||
])
|
||||
m4_set_empty(required_named_args, [], [
|
||||
AC_MSG_ERROR([Internal error: Required named arguments are missing for [$1]. Missing arguments: 'm4_set_contents(required_named_args, [ ])'])
|
||||
])
|
||||
m4_foreach([arg], m4_indir([m4_dquote]m4_set_listc([legal_named_args])), [
|
||||
m4_pushdef([ARG_][]arg, [])
|
||||
m4_set_add(defined_args, arg)
|
||||
])
|
||||
m4_set_delete(legal_named_args)
|
||||
m4_set_delete(required_named_args)
|
||||
|
||||
# Execute function body
|
||||
$4
|
||||
|
||||
m4_foreach([arg], m4_indir([m4_dquote]m4_set_listc([defined_args])), [
|
||||
m4_popdef([ARG_][]arg)
|
||||
])
|
||||
|
||||
m4_set_delete(defined_args)
|
||||
])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Assert that a programmatic condition holds. If not, exit with an error message.
|
||||
# Check that a shell expression gives return code 0
|
||||
#
|
||||
# $1: The shell expression to evaluate
|
||||
# $2: A message to describe the expression in case of failure
|
||||
# $2: An message to print in case of failure [optional]
|
||||
#
|
||||
AC_DEFUN([UTIL_ASSERT_SHELL_TEST],
|
||||
[
|
||||
ASSERTION_MSG="m4_normalize([$3])"
|
||||
if $1; then
|
||||
$ECHO Assertion failed: $2
|
||||
if test "x$3" != x; then
|
||||
$ECHO Assertion message: "$3"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
################################################################################
|
||||
# Assert that a programmatic condition holds. If not, exit with an error message.
|
||||
# Check that two strings are equal.
|
||||
#
|
||||
# $1: The actual string found
|
||||
# $2: The expected string
|
||||
# $3: An message to print in case of failure [optional]
|
||||
#
|
||||
AC_DEFUN([UTIL_ASSERT_STRING_EQUALS],
|
||||
[
|
||||
UTIL_ASSERT_SHELL_TEST(
|
||||
[test "x[$1]" != "x[$2]"],
|
||||
[Actual value '[$1]' \("[$1]"\) did not match expected value '[$2]' \("[$2]"\)],
|
||||
$3)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Assert that a programmatic condition holds. If not, exit with an error message.
|
||||
# Check that two strings not are equal.
|
||||
#
|
||||
# $1: The actual string found
|
||||
# $2: The expected string
|
||||
# $3: An message to print in case of failure [optional]
|
||||
#
|
||||
AC_DEFUN([UTIL_ASSERT_STRING_NOT_EQUALS],
|
||||
[
|
||||
UTIL_ASSERT_SHELL_TEST(
|
||||
[test "x[$1]" = "x[$2]"],
|
||||
[Actual value '[$1]' \("[$1]"\) unexpectedly matched '[$2]' \("[$2]"\)],
|
||||
$3)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Assert that a programmatic condition holds. If not, exit with an error message.
|
||||
# Check that the given expression evaluates to the string 'true'
|
||||
#
|
||||
# $1: The expression to evaluate
|
||||
# $2: An message to print in case of failure [optional]
|
||||
#
|
||||
AC_DEFUN([UTIL_ASSERT_TRUE],
|
||||
[
|
||||
UTIL_ASSERT_STRING_EQUALS($1, true, $3)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Assert that a programmatic condition holds. If not, exit with an error message.
|
||||
# Check that the given expression does not evaluate to the string 'true'
|
||||
#
|
||||
# $1: The expression to evaluate
|
||||
# $2: An message to print in case of failure [optional]
|
||||
#
|
||||
AC_DEFUN([UTIL_ASSERT_NOT_TRUE],
|
||||
[
|
||||
UTIL_ASSERT_STRING_NOT_EQUALS($1, true, $3)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if a list of space-separated words are selected only from a list of
|
||||
# space-separated legal words. Typical use is to see if a user-specified
|
||||
# set of words is selected from a set of legal words.
|
||||
#
|
||||
# Sets the specified variable to list of non-matching (offending) words, or to
|
||||
# the empty string if all words are matching the legal set.
|
||||
#
|
||||
# $1: result variable name
|
||||
# $2: list of values to check
|
||||
# $3: list of legal values
|
||||
AC_DEFUN([UTIL_GET_NON_MATCHING_VALUES],
|
||||
[
|
||||
# grep filter function inspired by a comment to http://stackoverflow.com/a/1617326
|
||||
# Notice that the original variant fails on SLES 10 and 11
|
||||
# Some grep versions (at least bsd) behaves strangely on the base case with
|
||||
# no legal_values, so make it explicit.
|
||||
values_to_check=`$ECHO $2 | $TR ' ' '\n'`
|
||||
legal_values=`$ECHO $3 | $TR ' ' '\n'`
|
||||
if test -z "$legal_values"; then
|
||||
$1="$2"
|
||||
else
|
||||
result=`$GREP -Fvx -- "$legal_values" <<< "$values_to_check" | $GREP -v '^$'`
|
||||
$1=${result//$'\n'/ }
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Check if a list of space-separated words contains any word(s) from a list of
|
||||
# space-separated illegal words. Typical use is to see if a user-specified
|
||||
# set of words contains any from a set of illegal words.
|
||||
#
|
||||
# Sets the specified variable to list of matching illegal words, or to
|
||||
# the empty string if no words are matching the illegal set.
|
||||
#
|
||||
# $1: result variable name
|
||||
# $2: list of values to check
|
||||
# $3: list of illegal values
|
||||
AC_DEFUN([UTIL_GET_MATCHING_VALUES],
|
||||
[
|
||||
# grep filter function inspired by a comment to http://stackoverflow.com/a/1617326
|
||||
# Notice that the original variant fails on SLES 10 and 11
|
||||
# Some grep versions (at least bsd) behaves strangely on the base case with
|
||||
# no legal_values, so make it explicit.
|
||||
values_to_check=`$ECHO $2 | $TR ' ' '\n'`
|
||||
illegal_values=`$ECHO $3 | $TR ' ' '\n'`
|
||||
if test -z "$illegal_values"; then
|
||||
$1=""
|
||||
else
|
||||
result=`$GREP -Fx -- "$illegal_values" <<< "$values_to_check" | $GREP -v '^$'`
|
||||
$1=${result//$'\n'/ }
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Converts an ISO-8601 date/time string to a unix epoch timestamp. If no
|
||||
# suitable conversion method was found, an empty string is returned.
|
||||
#
|
||||
# $1: result variable name
|
||||
# $2: input date/time string
|
||||
AC_DEFUN([UTIL_GET_EPOCH_TIMESTAMP],
|
||||
[
|
||||
if test "x$IS_GNU_DATE" = xyes; then
|
||||
# GNU date
|
||||
timestamp=$($DATE --utc --date=$2 +"%s" 2> /dev/null)
|
||||
else
|
||||
# BSD date
|
||||
# ISO-8601 date&time in Zulu 'date'T'time'Z
|
||||
timestamp=$($DATE -u -j -f "%FT%TZ" "$2" "+%s" 2> /dev/null)
|
||||
if test "x$timestamp" = x; then
|
||||
# BSD date cannot handle trailing milliseconds.
|
||||
# Try again ignoring characters at end
|
||||
timestamp=$($DATE -u -j -f "%Y-%m-%dT%H:%M:%S" "$2" "+%s" 2> /dev/null)
|
||||
fi
|
||||
if test "x$timestamp" = x; then
|
||||
# Perhaps the time was missing.
|
||||
timestamp=$($DATE -u -j -f "%FT%TZ" "$2""T00:00:00Z" "+%s" 2> /dev/null)
|
||||
fi
|
||||
fi
|
||||
$1=$timestamp
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Sort a space-separated list, and remove duplicates.
|
||||
#
|
||||
# Sets the specified variable to the resulting list.
|
||||
#
|
||||
# $1: result variable name
|
||||
# $2: list of values to sort
|
||||
AC_DEFUN([UTIL_SORT_LIST],
|
||||
[
|
||||
values_to_sort=`$ECHO $2 | $TR ' ' '\n'`
|
||||
result=`$SORT -u <<< "$values_to_sort" | $GREP -v '^$'`
|
||||
$1=${result//$'\n'/ }
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
|
||||
# If so, then append $1 to $2 \
|
||||
# Also set JVM_ARG_OK to true/false depending on outcome.
|
||||
AC_DEFUN([UTIL_ADD_JVM_ARG_IF_OK],
|
||||
[
|
||||
$ECHO "Check if jvm arg is ok: $1" >&AS_MESSAGE_LOG_FD
|
||||
$ECHO "Command: $3 $1 -version" >&AS_MESSAGE_LOG_FD
|
||||
OUTPUT=`$3 $1 $USER_BOOT_JDK_OPTIONS -version 2>&1`
|
||||
FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
|
||||
FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
|
||||
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
|
||||
$2="[$]$2 $1"
|
||||
JVM_ARG_OK=true
|
||||
else
|
||||
$ECHO "Arg failed:" >&AS_MESSAGE_LOG_FD
|
||||
$ECHO "$OUTPUT" >&AS_MESSAGE_LOG_FD
|
||||
JVM_ARG_OK=false
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Register a --with argument but mark it as deprecated
|
||||
# $1: The name of the with argument to deprecate, not including --with-
|
||||
AC_DEFUN([UTIL_DEPRECATED_ARG_WITH],
|
||||
[
|
||||
AC_ARG_WITH($1, [AS_HELP_STRING([--with-$1],
|
||||
[Deprecated. Option is kept for backwards compatibility and is ignored])],
|
||||
[AC_MSG_WARN([Option --with-$1 is deprecated and will be ignored.])])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Register a --enable argument but mark it as deprecated
|
||||
# $1: The name of the with argument to deprecate, not including --enable-
|
||||
AC_DEFUN([UTIL_DEPRECATED_ARG_ENABLE],
|
||||
[
|
||||
AC_ARG_ENABLE($1, [AS_HELP_STRING([--enable-$1],
|
||||
[Deprecated. Option is kept for backwards compatibility and is ignored])],
|
||||
[AC_MSG_WARN([Option --enable-$1 is deprecated and will be ignored.])])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Register an --enable-* argument as an alias for another argument.
|
||||
# $1: The name of the enable argument for the new alias, not including --enable-
|
||||
# $2: The full name of the argument of which to make this an alias, including
|
||||
# --enable- or --with-.
|
||||
AC_DEFUN([UTIL_ALIASED_ARG_ENABLE],
|
||||
[
|
||||
AC_ARG_ENABLE($1, [AS_HELP_STRING([--enable-$1], [alias for $2])], [
|
||||
# Use m4 to strip initial -- from target ($2), convert - to _, prefix enable_
|
||||
# to new alias name, and create a shell variable assignment,
|
||||
# e.g.: enable_old_style="$enable_new_alias"
|
||||
m4_translit(m4_bpatsubst($2, --), -, _)="$[enable_]m4_translit($1, -, _)"
|
||||
])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Creates a command-line option using the --enable-* pattern. Will return a
|
||||
# value of 'true' or 'false' in the RESULT variable, depending on whether the
|
||||
# option was enabled or not by the user. The option can not be turned on if it
|
||||
# is not available, as specified by AVAILABLE and/or CHECK_AVAILABLE.
|
||||
#
|
||||
# Arguments:
|
||||
# NAME: The base name of this option (i.e. what follows --enable-). Required.
|
||||
# RESULT: The name of the variable to set to the result. Defaults to
|
||||
# <NAME in uppercase>_ENABLED.
|
||||
# DEFAULT: The default value for this option. Can be true, false or auto.
|
||||
# Defaults to true.
|
||||
# AVAILABLE: If true, this option is allowed to be selected. Defaults to true.
|
||||
# DESC: A description of this option. Defaults to a generic and unhelpful
|
||||
# string.
|
||||
# DEFAULT_DESC: A message describing the default value, for the help. Defaults
|
||||
# to the literal value of DEFAULT.
|
||||
# CHECKING_MSG: The message to present to user when checking this option.
|
||||
# Defaults to a generic message.
|
||||
# CHECK_AVAILABLE: An optional code block to execute to determine if the
|
||||
# option should be available. Must set AVAILABLE to 'false' if not.
|
||||
# IF_GIVEN: An optional code block to execute if the option was given on the
|
||||
# command line (regardless of the value).
|
||||
# IF_NOT_GIVEN: An optional code block to execute if the option was not given
|
||||
# on the command line (regardless of the value).
|
||||
# IF_ENABLED: An optional code block to execute if the option is turned on.
|
||||
# IF_DISABLED: An optional code block to execute if the option is turned off.
|
||||
#
|
||||
UTIL_DEFUN_NAMED([UTIL_ARG_ENABLE],
|
||||
[*NAME RESULT DEFAULT AVAILABLE DESC DEFAULT_DESC CHECKING_MSG
|
||||
CHECK_AVAILABLE IF_GIVEN IF_NOT_GIVEN IF_ENABLED IF_DISABLED], [$@],
|
||||
[
|
||||
##########################
|
||||
# Part 1: Set up m4 macros
|
||||
##########################
|
||||
|
||||
# If DEFAULT is not specified, set it to 'true'.
|
||||
m4_define([ARG_DEFAULT], m4_if(ARG_DEFAULT, , true, ARG_DEFAULT))
|
||||
|
||||
# If AVAILABLE is not specified, set it to 'true'.
|
||||
m4_define([ARG_AVAILABLE], m4_if(ARG_AVAILABLE, , true, ARG_AVAILABLE))
|
||||
|
||||
# If DEFAULT_DESC is not specified, calculate it from DEFAULT.
|
||||
m4_define([ARG_DEFAULT_DESC], m4_if(ARG_DEFAULT_DESC, , m4_if(ARG_DEFAULT, true, enabled, m4_if(ARG_DEFAULT, false, disabled, ARG_DEFAULT)), ARG_DEFAULT_DESC))
|
||||
|
||||
# If RESULT is not specified, set it to 'ARG_NAME[_ENABLED]'.
|
||||
m4_define([ARG_RESULT], m4_if(ARG_RESULT, , m4_translit(ARG_NAME, [a-z-], [A-Z_])[_ENABLED], ARG_RESULT))
|
||||
# Construct shell variable names for the option
|
||||
m4_define(ARG_OPTION, [enable_]m4_translit(ARG_NAME, [-], [_]))
|
||||
m4_define(ARG_GIVEN, m4_translit(ARG_NAME, [a-z-], [A-Z_])[_GIVEN])
|
||||
|
||||
# If DESC is not specified, set it to a generic description.
|
||||
m4_define([ARG_DESC], m4_if(m4_quote(ARG_DESC), , [[Enable the ARG_NAME feature]], [m4_normalize(ARG_DESC)]))
|
||||
|
||||
# If CHECKING_MSG is not specified, set it to a generic description.
|
||||
m4_define([ARG_CHECKING_MSG], m4_if(m4_quote(ARG_CHECKING_MSG), , [[for --enable-ARG_NAME]], [m4_normalize(ARG_CHECKING_MSG)]))
|
||||
|
||||
# If the code blocks are not given, set them to the empty statements to avoid
|
||||
# tripping up bash.
|
||||
m4_if(ARG_CHECK_AVAILABLE, , [m4_define([ARG_CHECK_AVAILABLE], [:])])
|
||||
m4_if(ARG_IF_GIVEN, , [m4_define([ARG_IF_GIVEN], [:])])
|
||||
m4_if(ARG_IF_NOT_GIVEN, , [m4_define([ARG_IF_NOT_GIVEN], [:])])
|
||||
m4_if(ARG_IF_ENABLED, , [m4_define([ARG_IF_ENABLED], [:])])
|
||||
m4_if(ARG_IF_DISABLED, , [m4_define([ARG_IF_DISABLED], [:])])
|
||||
|
||||
##########################
|
||||
# Part 2: Set up autoconf shell code
|
||||
##########################
|
||||
|
||||
# Check that DEFAULT has a valid value
|
||||
if test "[x]ARG_DEFAULT" != xtrue && test "[x]ARG_DEFAULT" != xfalse && \
|
||||
test "[x]ARG_DEFAULT" != xauto ; then
|
||||
AC_MSG_ERROR([Internal error: Argument DEFAULT to [UTIL_ARG_ENABLE] can only be true, false or auto, was: 'ARG_DEFAULT'])
|
||||
fi
|
||||
|
||||
# Check that AVAILABLE has a valid value
|
||||
if test "[x]ARG_AVAILABLE" != xtrue && test "[x]ARG_AVAILABLE" != xfalse; then
|
||||
AC_MSG_ERROR([Internal error: Argument AVAILABLE to [UTIL_ARG_ENABLE] can only be true or false, was: 'ARG_AVAILABLE'])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(ARG_NAME, AS_HELP_STRING([--enable-]ARG_NAME,
|
||||
[ARG_DESC [ARG_DEFAULT_DESC]]), [ARG_GIVEN=true], [ARG_GIVEN=false])
|
||||
|
||||
# Check if the option is available
|
||||
AVAILABLE=ARG_AVAILABLE
|
||||
# Run the available check block (if any), which can overwrite AVAILABLE.
|
||||
ARG_CHECK_AVAILABLE
|
||||
|
||||
# Check if the option should be turned on
|
||||
AC_MSG_CHECKING(ARG_CHECKING_MSG)
|
||||
if test x$ARG_GIVEN = xfalse; then
|
||||
if test ARG_DEFAULT = auto; then
|
||||
# If not given, and default is auto, set it to true iff it's available.
|
||||
ARG_RESULT=$AVAILABLE
|
||||
REASON="from default 'auto'"
|
||||
else
|
||||
ARG_RESULT=ARG_DEFAULT
|
||||
REASON="default"
|
||||
fi
|
||||
else
|
||||
if test x$ARG_OPTION = xyes; then
|
||||
ARG_RESULT=true
|
||||
REASON="from command line"
|
||||
elif test x$ARG_OPTION = xno; then
|
||||
ARG_RESULT=false
|
||||
REASON="from command line"
|
||||
elif test x$ARG_OPTION = xauto; then
|
||||
if test ARG_DEFAULT = auto; then
|
||||
# If both given and default is auto, set it to true iff it's available.
|
||||
ARG_RESULT=$AVAILABLE
|
||||
else
|
||||
ARG_RESULT=ARG_DEFAULT
|
||||
fi
|
||||
REASON="from command line 'auto'"
|
||||
else
|
||||
AC_MSG_ERROR([Option [--enable-]ARG_NAME can only be 'yes', 'no' or 'auto'])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$ARG_RESULT = xtrue; then
|
||||
AC_MSG_RESULT([enabled, $REASON])
|
||||
if test x$AVAILABLE = xfalse; then
|
||||
AC_MSG_ERROR([Option [--enable-]ARG_NAME is not available])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([disabled, $REASON])
|
||||
fi
|
||||
|
||||
# Execute result payloads, if present
|
||||
if test x$ARG_GIVEN = xtrue; then
|
||||
ARG_IF_GIVEN
|
||||
else
|
||||
ARG_IF_NOT_GIVEN
|
||||
fi
|
||||
|
||||
if test x$ARG_RESULT = xtrue; then
|
||||
ARG_IF_ENABLED
|
||||
else
|
||||
ARG_IF_DISABLED
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Helper functions for ARG_WITH, to validate different types of argument
|
||||
|
||||
# Dispatcher to call the correct UTIL_CHECK_TYPE_* function depending on the ARG_TYPE
|
||||
AC_DEFUN([UTIL_CHECK_TYPE],
|
||||
[
|
||||
UTIL_CHECK_TYPE_$1($2)
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_CHECK_TYPE_string],
|
||||
[
|
||||
# All strings always passes
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_CHECK_TYPE_integer],
|
||||
[
|
||||
# Check that the argument is an integer
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
[ if [[ ! "$1" =~ ^[0-9]+$ ]] ; then ]
|
||||
FAILURE="Not an integer: $1"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_CHECK_TYPE_file],
|
||||
[
|
||||
# Check that the argument is an existing file
|
||||
if test ! -f "$1" ; then
|
||||
FAILURE="File $1 does not exist or is not readable"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_CHECK_TYPE_executable],
|
||||
[
|
||||
# Check that the argument is an existing file that the user has execute access to.
|
||||
if (test ! -x "$1") || (test ! -f "$1") ; then
|
||||
FAILURE="File $1 does not exist or is not executable"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_CHECK_TYPE_directory],
|
||||
[
|
||||
# Check that the argument is an existing directory
|
||||
if test ! -d "$1" ; then
|
||||
FAILURE="Directory $1 does not exist or is not readable"
|
||||
fi
|
||||
|
||||
if test "[x]ARG_CHECK_FOR_FILES" != "x:"; then
|
||||
for file in ARG_CHECK_FOR_FILES; do
|
||||
found_files=$($ECHO $($LS -d $1/$file 2> /dev/null))
|
||||
if test "x$found_files" = x; then
|
||||
FAILURE="Directory $1 does not contain $file"
|
||||
break
|
||||
elif ! test -e "$found_files"; then
|
||||
FAILURE="Directory $1 contains multiple $file: $found_files"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_CHECK_TYPE_literal],
|
||||
[
|
||||
# Check if it contains a space between non-space characters
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
[ if [[ "$1" =~ [^' ']' '+[^' '] ]] ; then ]
|
||||
FAILURE="Multiple words: $1"
|
||||
fi
|
||||
|
||||
# Check that the selected variants are valid
|
||||
UTIL_GET_NON_MATCHING_VALUES(invalid_value, $1, \
|
||||
ARG_VALID_VALUES)
|
||||
if test "x$invalid_value" != x; then
|
||||
FAILURE="Invalid value: $invalid_value. Valid values are: ARG_VALID_VALUES"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_CHECK_TYPE_multivalue],
|
||||
[
|
||||
# We accept either space or comma as separator, but use space internally
|
||||
values=`$ECHO $1 | $SED -e 's/,/ /g'`
|
||||
|
||||
# Check that the selected variants are valid
|
||||
UTIL_GET_NON_MATCHING_VALUES(invalid_value, $values, \
|
||||
ARG_VALID_VALUES)
|
||||
if test "x$invalid_value" != x; then
|
||||
FAILURE="Invalid value(s): $invalid_value. Valid values are: ARG_VALID_VALUES"
|
||||
fi
|
||||
|
||||
# Update to version without comma
|
||||
ARG_RESULT=$($ECHO $values)
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_CHECK_TYPE_features],
|
||||
[
|
||||
# We accept either space or comma as separator, but use space internally
|
||||
feature_list=`$ECHO $1 | $SED -e 's/,/ /g'`
|
||||
features_enabled=`$ECHO $feature_list | \
|
||||
$AWK '{ for (i=1; i<=NF; i++) if (!match($i, /^-.*/)) printf("%s ", $i) }'`
|
||||
features_disabled=`$ECHO $feature_list | \
|
||||
$AWK '{ for (i=1; i<=NF; i++) if (match($i, /^-.*/)) printf("%s ", substr($i, 2))}'`
|
||||
|
||||
# Check that the selected features are valid
|
||||
UTIL_GET_NON_MATCHING_VALUES(invalid_features, $features_enabled \
|
||||
$features_disabled, ARG_VALID_VALUES)
|
||||
if test "x$invalid_features" != x; then
|
||||
FAILURE="Invalid feature(s): $invalid_features. Valid values are: ARG_VALID_VALUES"
|
||||
fi
|
||||
|
||||
# Update to version without comma
|
||||
ARG_RESULT=$($ECHO $feature_list)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Creates a command-line option using the --with-* pattern. Will return a
|
||||
# string in the RESULT variable with the option provided by the user, or the
|
||||
# empty string if the --with-* option was not given. The option can not be given
|
||||
# if it is not available, as specified by AVAILABLE and/or CHECK_AVAILABLE.
|
||||
#
|
||||
# Arguments:
|
||||
# NAME: The base name of this option (i.e. what follows --with-). Required.
|
||||
# TYPE: The type of the value. Can be one of "string", "integer", "file",
|
||||
# "executable", "directory", "literal", "multivalue" or "features". Required.
|
||||
# DEFAULT: The default value for this option. Can be any valid string.
|
||||
# Required.
|
||||
# OPTIONAL: If this feature can be disabled. Defaults to false. If true,
|
||||
# the feature can be disabled using --without-FOO, --with-FOO=no, or
|
||||
# --with-FOO=. Check the ENABLED_RESULT variable for the enabled/disabled
|
||||
# state.
|
||||
# RESULT: The name of the variable to set to the result. Defaults to
|
||||
# <NAME in uppercase>. Set to empty if ENABLED_RESULT is false.
|
||||
# ENABLED_DEFAULT: If the value is enabled by default. Defaults to false. Only
|
||||
# relevant if OPTIONAL is true.
|
||||
# ENABLED_RESULT: The name of the variable to set to the enabled/disabled
|
||||
# result state. Defaults to <NAME in uppercase>_ENABLED.
|
||||
# AVAILABLE: If true, this option is allowed to be selected. Defaults to true.
|
||||
# DESC: A description of this option. Defaults to a generic and unhelpful
|
||||
# string.
|
||||
# DEFAULT_DESC: A message describing the default value, for the help. Defaults
|
||||
# to the literal value of DEFAULT, or "<none>" if DEFAULT is empty.
|
||||
# CHECKING_MSG: The message to present to user when checking this option.
|
||||
# Defaults to a generic message.
|
||||
# CHECK_AVAILABLE: An optional code block to execute to determine if the
|
||||
# option should be available. Must set AVAILABLE to 'false' if not.
|
||||
# VALID_VALUES: A list of literals that are the allowed values. Only valid if
|
||||
# TYPE is "literal", "multivalue" or "features".
|
||||
# CHECK_VALUE: An optional code block to execute to determine if the value
|
||||
# is correct. Must set FAILURE to a non-empty string if not. This string
|
||||
# will be displayed. The value is given in $RESULT.
|
||||
# CHECK_FOR_FILES: A list of files to verify the presence for. Only valid if
|
||||
# TYPE is "directory". Paths are relative the directory given as value.
|
||||
# Wildcards are accepted. Exactly one matching file must be found, for each
|
||||
# listed file, or FAILURE is set.
|
||||
# IF_AUTO: An optional code block to execute if the value is "auto", either by
|
||||
# default or given by the command line. Must set RESULT to the calculated
|
||||
# value.
|
||||
# IF_GIVEN: An optional code block to execute if the option was given on the
|
||||
# command line (regardless of the value).
|
||||
# IF_NOT_GIVEN: An optional code block to execute if the option was not given
|
||||
# on the command line (regardless of the value).
|
||||
#
|
||||
UTIL_DEFUN_NAMED([UTIL_ARG_WITH],
|
||||
[*NAME *TYPE *DEFAULT OPTIONAL RESULT ENABLED_DEFAULT ENABLED_RESULT
|
||||
AVAILABLE DESC DEFAULT_DESC CHECKING_MSG CHECK_AVAILABLE VALID_VALUES
|
||||
CHECK_VALUE CHECK_FOR_FILES IF_AUTO IF_GIVEN IF_NOT_GIVEN], [$@],
|
||||
[
|
||||
##########################
|
||||
# Part 1: Set up m4 macros
|
||||
##########################
|
||||
|
||||
# If ENABLED_DEFAULT is not specified, set it to 'false'.
|
||||
m4_define([ARG_ENABLED_DEFAULT], m4_if(ARG_ENABLED_DEFAULT, , false, ARG_ENABLED_DEFAULT))
|
||||
|
||||
# If AVAILABLE is not specified, set it to 'true'.
|
||||
m4_define([ARG_AVAILABLE], m4_if(ARG_AVAILABLE, , true, ARG_AVAILABLE))
|
||||
|
||||
# If OPTIONAL is not specified, set it to 'false'.
|
||||
m4_define([ARG_OPTIONAL], m4_if(ARG_OPTIONAL, , false, ARG_OPTIONAL))
|
||||
|
||||
# If DEFAULT_DESC is not specified, calculate it from DEFAULT.
|
||||
m4_define([ARG_DEFAULT_DESC], m4_if(ARG_DEFAULT_DESC, , m4_if(ARG_DEFAULT, , <none>, ARG_DEFAULT), ARG_DEFAULT_DESC))
|
||||
|
||||
# If RESULT is not specified, set it to 'ARG_NAME'.
|
||||
m4_define([ARG_RESULT], m4_if(ARG_RESULT, , m4_translit(ARG_NAME, [a-z-], [A-Z_]), ARG_RESULT))
|
||||
|
||||
# If ENABLED_RESULT is not specified, set it to 'ARG_NAME[_ENABLED]'.
|
||||
m4_define([ARG_ENABLED_RESULT], m4_if(ARG_ENABLED_RESULT, , m4_translit(ARG_NAME, [a-z-], [A-Z_])[_ENABLED], ARG_ENABLED_RESULT))
|
||||
|
||||
# Construct shell variable names for the option
|
||||
m4_define(ARG_OPTION, [with_]m4_translit(ARG_NAME, [-], [_]))
|
||||
m4_define(ARG_GIVEN, m4_translit(ARG_NAME, [a-z-], [A-Z_])[_GIVEN])
|
||||
|
||||
# If DESC is not specified, set it to a generic description.
|
||||
m4_define([ARG_DESC], m4_if(m4_quote(ARG_DESC), , [[Give a value for the ARG_NAME feature]], [m4_normalize(ARG_DESC)]))
|
||||
|
||||
# If CHECKING_MSG is not specified, set it to a generic description.
|
||||
m4_define([ARG_CHECKING_MSG], m4_if(m4_quote(ARG_CHECKING_MSG), , [[for --with-ARG_NAME]], [m4_normalize(ARG_CHECKING_MSG)]))
|
||||
|
||||
m4_define([ARG_HAS_AUTO_BLOCK], m4_if(ARG_IF_AUTO, , false, true))
|
||||
|
||||
# If the code blocks are not given, set them to the empty statements to avoid
|
||||
# tripping up bash.
|
||||
m4_if(ARG_CHECK_AVAILABLE, , [m4_define([ARG_CHECK_AVAILABLE], [:])])
|
||||
m4_if(ARG_CHECK_VALUE, , [m4_define([ARG_CHECK_VALUE], [:])])
|
||||
m4_if(ARG_CHECK_FOR_FILES, , [m4_define([ARG_CHECK_FOR_FILES], [:])])
|
||||
m4_if(ARG_IF_AUTO, , [m4_define([ARG_IF_AUTO], [:])])
|
||||
m4_if(ARG_IF_GIVEN, , [m4_define([ARG_IF_GIVEN], [:])])
|
||||
m4_if(ARG_IF_NOT_GIVEN, , [m4_define([ARG_IF_NOT_GIVEN], [:])])
|
||||
|
||||
##########################
|
||||
# Part 2: Set up autoconf shell code
|
||||
##########################
|
||||
|
||||
# Check that OPTIONAL has a valid value
|
||||
if test "[x]ARG_OPTIONAL" != xtrue && test "[x]ARG_OPTIONAL" != xfalse ; then
|
||||
AC_MSG_ERROR([Internal error: Argument OPTIONAL to [UTIL_ARG_WITH] can only be true or false, was: 'ARG_OPTIONAL'])
|
||||
fi
|
||||
|
||||
# Check that ENABLED_DEFAULT has a valid value
|
||||
if test "[x]ARG_ENABLED_DEFAULT" != xtrue && test "[x]ARG_ENABLED_DEFAULT" != xfalse ; then
|
||||
AC_MSG_ERROR([Internal error: Argument ENABLED_DEFAULT to [UTIL_ARG_WITH] can only be true or false, was: 'ARG_ENABLED_DEFAULT'])
|
||||
fi
|
||||
|
||||
# Check that AVAILABLE has a valid value
|
||||
if test "[x]ARG_AVAILABLE" != xtrue && test "[x]ARG_AVAILABLE" != xfalse; then
|
||||
AC_MSG_ERROR([Internal error: Argument AVAILABLE to [UTIL_ARG_WITH] can only be true or false, was: 'ARG_AVAILABLE'])
|
||||
fi
|
||||
|
||||
# Check that TYPE has a valid value
|
||||
# Need to assign since we can't expand ARG TYPE inside the m4 quoted if statement
|
||||
TEST_TYPE="ARG_TYPE"
|
||||
# Additional [] needed to keep m4 from mangling shell constructs.
|
||||
[ if [[ ! "$TEST_TYPE" =~ ^(string|integer|file|executable|directory|literal|multivalue|features)$ ]] ; then ]
|
||||
AC_MSG_ERROR([Internal error: Argument TYPE to [UTIL_ARG_WITH] must be a valid type, was: 'ARG_TYPE'])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(ARG_NAME, AS_HELP_STRING([--with-]ARG_NAME,
|
||||
[ARG_DESC [ARG_DEFAULT_DESC]]), [ARG_GIVEN=true], [ARG_GIVEN=false])
|
||||
|
||||
# Check if the option is available
|
||||
AVAILABLE=ARG_AVAILABLE
|
||||
# Run the available check block (if any), which can overwrite AVAILABLE.
|
||||
ARG_CHECK_AVAILABLE
|
||||
|
||||
# Check if the option should be turned on
|
||||
AC_MSG_CHECKING(ARG_CHECKING_MSG)
|
||||
|
||||
if test x$AVAILABLE = xfalse; then
|
||||
ARG_RESULT="$ARG_OPTION"
|
||||
ARG_ENABLED_RESULT=false
|
||||
REASON="not available"
|
||||
else
|
||||
if test x$ARG_GIVEN = xfalse; then
|
||||
ARG_RESULT="ARG_DEFAULT"
|
||||
if test "[x]ARG_OPTIONAL" = xtrue; then
|
||||
ARG_ENABLED_RESULT=ARG_ENABLED_DEFAULT
|
||||
else
|
||||
ARG_ENABLED_RESULT=true
|
||||
fi
|
||||
REASON="default"
|
||||
|
||||
else # ARG_GIVEN is true
|
||||
# Special treatment of "yes" and "no" for "--with-ARG" and "--without-ARG"
|
||||
if test "x$ARG_OPTION" = xyes || test "x$ARG_OPTION" = xno || test "x$ARG_OPTION" = x ; then
|
||||
if test "[x]ARG_OPTIONAL" = xfalse; then
|
||||
if test "x$ARG_OPTION" = x; then
|
||||
# If not optional, the empty string is a valid value
|
||||
ARG_RESULT=""
|
||||
ARG_ENABLED_RESULT=true
|
||||
REASON="from command line"
|
||||
else
|
||||
AC_MSG_RESULT([invalid])
|
||||
AC_MSG_ERROR([Option [--with-]ARG_NAME must have a specified value])
|
||||
fi
|
||||
else
|
||||
if test "x$ARG_OPTION" = xyes; then
|
||||
ARG_RESULT="ARG_DEFAULT"
|
||||
ARG_ENABLED_RESULT=true
|
||||
REASON="default as enabled from command line"
|
||||
else
|
||||
# For optional values, both --without-FOO and --with-FOO= disables
|
||||
ARG_RESULT=""
|
||||
ARG_ENABLED_RESULT=false
|
||||
REASON="from command line"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# The most common case -- the user gives a value for the option.
|
||||
ARG_RESULT="$ARG_OPTION"
|
||||
ARG_ENABLED_RESULT=true
|
||||
REASON="from command line"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$ARG_ENABLED_RESULT" = xfalse; then
|
||||
if test "x$REASON" = "xnot available"; then
|
||||
AC_MSG_RESULT([<invalid>, $REASON])
|
||||
if test "x$ARG_RESULT" != "x" && test "x$ARG_RESULT" != "xno" ; then
|
||||
AC_MSG_WARN([Option [--with-]ARG_NAME is not available for this configuration])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([<disabled>, $REASON])
|
||||
fi
|
||||
ARG_RESULT=""
|
||||
else
|
||||
if test [x]ARG_HAS_AUTO_BLOCK = xtrue && test "x$ARG_RESULT" = xauto; then
|
||||
# Execute "auto" payload
|
||||
ARG_IF_AUTO
|
||||
|
||||
ARG_RESULT="$RESULT"
|
||||
REASON="$REASON (calculated from 'auto')"
|
||||
fi
|
||||
|
||||
if test "x$ARG_RESULT" = x; then
|
||||
AC_MSG_RESULT([<none>, $REASON])
|
||||
else
|
||||
AC_MSG_RESULT([$ARG_RESULT, $REASON])
|
||||
fi
|
||||
|
||||
# Verify value
|
||||
# First use our dispatcher to verify that type requirements are satisfied
|
||||
UTIL_CHECK_TYPE(ARG_TYPE, $ARG_RESULT)
|
||||
|
||||
if test "x$FAILURE" = x; then
|
||||
# Execute custom verification payload, if present
|
||||
RESULT="$ARG_RESULT"
|
||||
|
||||
ARG_CHECK_VALUE
|
||||
|
||||
ARG_RESULT="$RESULT"
|
||||
fi
|
||||
|
||||
if test "x$FAILURE" != x; then
|
||||
AC_MSG_NOTICE([Invalid value for [--with-]ARG_NAME: "$ARG_RESULT"])
|
||||
AC_MSG_NOTICE([$FAILURE])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
fi
|
||||
|
||||
# Execute result payloads, if present
|
||||
if test x$ARG_GIVEN = xtrue; then
|
||||
ARG_IF_GIVEN
|
||||
else
|
||||
ARG_IF_NOT_GIVEN
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Helper functions for CHECK_VALUE in ARG_WITH.
|
||||
AC_DEFUN([UTIL_CHECK_STRING_NON_EMPTY],
|
||||
[
|
||||
if test "x$RESULT" = "x"; then
|
||||
FAILURE="Value cannot be empty"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([UTIL_CHECK_STRING_NON_EMPTY_PRINTABLE],
|
||||
[
|
||||
if test "x$RESULT" = x; then
|
||||
FAILURE="Value cannot be empty"
|
||||
elif [ ! [[ $RESULT =~ ^[[:print:]]*$ ]] ]; then
|
||||
FAILURE="Value contains non-printing characters: $RESULT"
|
||||
fi
|
||||
])
|
||||
596
make/autoconf/util_paths.m4
Normal file
596
make/autoconf/util_paths.m4
Normal file
|
|
@ -0,0 +1,596 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Appends a string to a path variable, only adding the : when needed.
|
||||
AC_DEFUN([UTIL_APPEND_TO_PATH],
|
||||
[
|
||||
if test "x$2" != x; then
|
||||
if test "x[$]$1" = x; then
|
||||
$1="$2"
|
||||
else
|
||||
$1="[$]$1:$2"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Prepends a string to a path variable, only adding the : when needed.
|
||||
AC_DEFUN([UTIL_PREPEND_TO_PATH],
|
||||
[
|
||||
if test "x$2" != x; then
|
||||
if test "x[$]$1" = x; then
|
||||
$1="$2"
|
||||
else
|
||||
$1="$2:[$]$1"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# This will make sure the given variable points to a full and proper
|
||||
# path. This means:
|
||||
# 1) There will be no spaces in the path. On unix platforms,
|
||||
# spaces in the path will result in an error. On Windows,
|
||||
# the path will be rewritten using short-style to be space-free.
|
||||
# 2) The path will be absolute, and it will be in unix-style (on
|
||||
# cygwin).
|
||||
# $1: The name of the variable to fix
|
||||
# $2: if NOFAIL, if the path cannot be resolved then errors will not be
|
||||
# reported and an empty path will be set
|
||||
AC_DEFUN([UTIL_FIXUP_PATH],
|
||||
[
|
||||
# Only process if variable expands to non-empty
|
||||
path="[$]$1"
|
||||
if test "x$path" != x; then
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
imported_path=`$FIXPATH_BASE -q import "$path"`
|
||||
if test $? -ne 0 || test ! -e $imported_path; then
|
||||
if test "x$2" != "xNOFAIL"; then
|
||||
AC_MSG_NOTICE([The path of $1, which is given as "$path", can not be properly resolved.])
|
||||
AC_MSG_NOTICE([Please see the section "Special Considerations" in building.md.])
|
||||
AC_MSG_NOTICE([This is the error message given by fixpath:])
|
||||
# Rerun fixpath without -q to get an error message
|
||||
$FIXPATH_BASE import "$path"
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
else
|
||||
imported_path=""
|
||||
fi
|
||||
fi
|
||||
|
||||
$FIXPATH_BASE -q verify "$imported_path"
|
||||
if test $? -ne 0; then
|
||||
if test "x$2" != "xNOFAIL"; then
|
||||
AC_MSG_ERROR([The path of $1, which resolves as "$path", could not be verified.])
|
||||
else
|
||||
imported_path=""
|
||||
fi
|
||||
fi
|
||||
[ imported_path_lower=`$ECHO $imported_path | $TR '[:upper:]' '[:lower:]'` ]
|
||||
[ orig_path_lower=`$ECHO $path | $TR '[:upper:]' '[:lower:]'` ]
|
||||
# If only case differs, keep original path
|
||||
if test "x$imported_path_lower" != "x$orig_path_lower"; then
|
||||
$1="$imported_path"
|
||||
fi
|
||||
else # non-Windows
|
||||
[ if [[ "$path" =~ " " ]]; then ]
|
||||
if test "x$2" != "xNOFAIL"; then
|
||||
AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])
|
||||
AC_MSG_ERROR([Spaces are not allowed in this path.])
|
||||
else
|
||||
path=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# Use eval to expand a potential ~.
|
||||
eval new_path="$path"
|
||||
if test ! -e "$new_path"; then
|
||||
if test "x$2" != "xNOFAIL"; then
|
||||
AC_MSG_ERROR([The path of $1, which resolves as "$new_path", is not found.])
|
||||
else
|
||||
new_path=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make the path absolute
|
||||
if test "x$new_path" != x; then
|
||||
if test -d "$new_path"; then
|
||||
path="`cd "$new_path"; pwd -L`"
|
||||
else
|
||||
dir="`$DIRNAME "$new_path"`"
|
||||
base="`$BASENAME "$new_path"`"
|
||||
path="`cd "$dir"; pwd -L`/$base"
|
||||
fi
|
||||
else
|
||||
path=""
|
||||
fi
|
||||
|
||||
$1="$path"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Fixup path to be a Windows full long path
|
||||
# Note: Only supported with cygwin/msys2 (cygpath tool)
|
||||
AC_DEFUN([UTIL_FIXUP_WIN_LONG_PATH],
|
||||
[
|
||||
# Only process if variable expands to non-empty
|
||||
path="[$]$1"
|
||||
if test "x$path" != x; then
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
win_path=$($PATHTOOL -wl "$path")
|
||||
if test "x$win_path" != "x$path"; then
|
||||
$1="$win_path"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
################################################################################
|
||||
# Check if the given file is a unix-style or windows-style executable, that is,
|
||||
# if it expects paths in unix-style or windows-style.
|
||||
# Returns "windows" or "unix" in $RESULT.
|
||||
AC_DEFUN([UTIL_CHECK_WINENV_EXEC_TYPE],
|
||||
[
|
||||
# For cygwin and msys2, if it's linked with the correct helper lib, it
|
||||
# accept unix paths
|
||||
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin" || \
|
||||
test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then
|
||||
linked_libs=`$LDD $1 2>&1`
|
||||
if test $? -ne 0; then
|
||||
# Non-binary files (e.g. shell scripts) are unix files
|
||||
RESULT=unix
|
||||
else
|
||||
[ if [[ "$linked_libs" =~ $WINENV_MARKER_DLL ]]; then ]
|
||||
RESULT=unix
|
||||
else
|
||||
RESULT=windows
|
||||
fi
|
||||
fi
|
||||
elif test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
# On WSL, we can check if it is a PE file
|
||||
file_type=`$FILE -b $1 2>&1`
|
||||
[ if [[ $file_type =~ PE.*Windows ]]; then ]
|
||||
RESULT=windows
|
||||
else
|
||||
RESULT=unix
|
||||
fi
|
||||
else
|
||||
RESULT=unix
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# This will make sure the given variable points to a executable
|
||||
# with a full and proper path. This means:
|
||||
# 1) There will be no spaces in the path. On unix platforms,
|
||||
# spaces in the path will result in an error. On Windows,
|
||||
# the path will be rewritten using short-style to be space-free.
|
||||
# 2) The path will be absolute, and it will be in unix-style (on
|
||||
# cygwin).
|
||||
# Any arguments given to the executable is preserved.
|
||||
# If the input variable does not have a directory specification, then
|
||||
# it need to be in the PATH.
|
||||
# $1: The name of the variable to fix
|
||||
# $2: Where to look for the command (replaces $PATH)
|
||||
AC_DEFUN([UTIL_FIXUP_EXECUTABLE],
|
||||
[
|
||||
input="[$]$1"
|
||||
|
||||
# Only process if variable expands to non-empty
|
||||
if test "x$input" != x; then
|
||||
# First separate the path from the arguments. This will split at the first
|
||||
# space.
|
||||
[ if [[ "$OPENJDK_BUILD_OS" = "windows" && input =~ ^$FIXPATH ]]; then
|
||||
line="${input#$FIXPATH }"
|
||||
fixpath_prefix="$FIXPATH "
|
||||
else
|
||||
line="$input"
|
||||
fixpath_prefix=""
|
||||
fi ]
|
||||
path="${line%% *}"
|
||||
arguments="${line#"$path"}"
|
||||
|
||||
[ if ! [[ "$path" =~ /|\\ ]]; then ]
|
||||
# This is a command without path (e.g. "gcc" or "echo")
|
||||
command_type=`type -t "$path"`
|
||||
if test "x$command_type" = xbuiltin || test "x$command_type" = xkeyword; then
|
||||
# Shell builtin or keyword; we're done here
|
||||
new_path="$path"
|
||||
else
|
||||
# Search in $PATH using bash built-in 'type -p'.
|
||||
saved_path="$PATH"
|
||||
if test "x$2" != x; then
|
||||
PATH="$2"
|
||||
fi
|
||||
new_path=`type -p "$path"`
|
||||
if test "x$new_path" = x && test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
# Try again with .exe
|
||||
new_path="`type -p "$path.exe"`"
|
||||
fi
|
||||
PATH="$saved_path"
|
||||
|
||||
if test "x$new_path" = x; then
|
||||
AC_MSG_NOTICE([The command for $1, which resolves as "$input", is not found in the PATH.])
|
||||
AC_MSG_ERROR([Cannot locate $path])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# This is a path with slashes, don't look at $PATH
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
# fixpath.sh import will do all heavy lifting for us
|
||||
new_path=`$FIXPATH_BASE -q import "$path"`
|
||||
|
||||
if test $? -ne 0 || test ! -e $new_path; then
|
||||
# It failed, but maybe spaces were part of the path and not separating
|
||||
# the command and argument. Retry using that assumption.
|
||||
new_path=`$FIXPATH_BASE -q import "$input"`
|
||||
if test $? -ne 0 || test ! -e $new_path; then
|
||||
AC_MSG_NOTICE([The command for $1, which is given as "$input", can not be properly resolved.])
|
||||
AC_MSG_NOTICE([Please see the section "Special Considerations" in building.md.])
|
||||
AC_MSG_NOTICE([This is the error message given by fixpath:])
|
||||
# Rerun fixpath without -q to get an error message
|
||||
$FIXPATH_BASE import "$input"
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
fi
|
||||
# It worked, clear all "arguments"
|
||||
arguments=""
|
||||
fi
|
||||
else # on unix
|
||||
# Make absolute
|
||||
$1="$path"
|
||||
UTIL_FIXUP_PATH($1, NOFAIL)
|
||||
new_path="[$]$1"
|
||||
|
||||
if test ! -e $new_path; then
|
||||
AC_MSG_NOTICE([The command for $1, which resolves as "$input", is not found])
|
||||
[ if [[ "$path" =~ " " ]]; then ]
|
||||
AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.])
|
||||
fi
|
||||
AC_MSG_ERROR([Cannot locate $path])
|
||||
fi
|
||||
if test ! -x $new_path; then
|
||||
AC_MSG_NOTICE([The command for $1, which resolves as "$input", is not executable.])
|
||||
AC_MSG_ERROR([Cannot execute command at $path])
|
||||
fi
|
||||
fi # end on unix
|
||||
fi # end with or without slashes
|
||||
|
||||
# Now we have a usable command as new_path, with arguments in arguments
|
||||
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
if test "x$fixpath_prefix" = x; then
|
||||
# Only mess around if fixpath_prefix was not given
|
||||
UTIL_CHECK_WINENV_EXEC_TYPE("$new_path")
|
||||
if test "x$RESULT" = xwindows; then
|
||||
fixpath_prefix="$FIXPATH "
|
||||
# make sure we have an .exe suffix (but not two)
|
||||
new_path="${new_path%.exe}.exe"
|
||||
else
|
||||
# If we have gotten a .exe suffix, remove it
|
||||
new_path="${new_path%.exe}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Now join together the path and the arguments once again
|
||||
new_complete="$fixpath_prefix$new_path$arguments"
|
||||
$1="$new_complete"
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup a tool for the given variable. If correctly specified by the user,
|
||||
# use that value, otherwise search for the tool using the supplied code snippet.
|
||||
# $1: variable to set
|
||||
# $2: code snippet to call to look for the tool
|
||||
# $3: code snippet to call if variable was used to find tool
|
||||
AC_DEFUN([UTIL_SETUP_TOOL],
|
||||
[
|
||||
# Publish this variable in the help.
|
||||
AC_ARG_VAR($1, [Override default value for $1])
|
||||
|
||||
if [[ -z "${$1+x}" ]]; then
|
||||
# The variable is not set by user, try to locate tool using the code snippet
|
||||
$2
|
||||
else
|
||||
# The variable is set, but is it from the command line or the environment?
|
||||
|
||||
# Try to remove the string !$1! from our list.
|
||||
try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!$1!/}
|
||||
if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
|
||||
# If it failed, the variable was not from the command line. Ignore it,
|
||||
# but warn the user (except for BASH, which is always set by the calling BASH).
|
||||
if test "x$1" != xBASH; then
|
||||
AC_MSG_WARN([Ignoring value of $1 from the environment. Use command line variables instead.])
|
||||
fi
|
||||
# Try to locate tool using the code snippet
|
||||
$2
|
||||
else
|
||||
# If it succeeded, then it was overridden by the user. We will use it
|
||||
# for the tool.
|
||||
|
||||
# First remove it from the list of overridden variables, so we can test
|
||||
# for unknown variables in the end.
|
||||
CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
|
||||
|
||||
tool_override=[$]$1
|
||||
|
||||
# Check if we try to supply an empty value
|
||||
if test "x$tool_override" = x; then
|
||||
AC_MSG_CHECKING([for $1])
|
||||
AC_MSG_RESULT([[[disabled by user]]])
|
||||
else
|
||||
# Split up override in command part and argument part
|
||||
tool_and_args=($tool_override)
|
||||
[ tool_command=${tool_and_args[0]} ]
|
||||
[ unset 'tool_and_args[0]' ]
|
||||
[ tool_args=${tool_and_args[@]} ]
|
||||
|
||||
# Check if the provided tool contains a complete path.
|
||||
tool_basename="${tool_command##*/}"
|
||||
if test "x$tool_basename" = "x$tool_command"; then
|
||||
# A command without a complete path is provided, search $PATH.
|
||||
AC_MSG_NOTICE([Will search for user supplied tool "$tool_basename"])
|
||||
AC_PATH_PROGS($1, $tool_basename ${tool_basename}.exe)
|
||||
tool_command="[$]$1"
|
||||
if test "x$tool_command" = x; then
|
||||
AC_MSG_ERROR([User supplied tool $1="$tool_basename" could not be found in PATH])
|
||||
fi
|
||||
else
|
||||
# Otherwise we believe it is a complete path. Use it as it is.
|
||||
if test ! -x "$tool_command" && test ! -x "${tool_command}.exe"; then
|
||||
# Maybe the path had spaces in it; try again with the entire argument
|
||||
if test ! -x "$tool_override" && test ! -x "${tool_override}.exe"; then
|
||||
AC_MSG_ERROR([User supplied tool $1="$tool_override" does not exist or is not executable])
|
||||
else
|
||||
# We successfully located the executable assuming the spaces were part of the path.
|
||||
# We can't combine using paths with spaces and arguments, so assume tool_args is empty.
|
||||
tool_command="$tool_override"
|
||||
tool_args=""
|
||||
fi
|
||||
fi
|
||||
if test ! -x "$tool_command"; then
|
||||
tool_command="${tool_command}.exe"
|
||||
fi
|
||||
$1="$tool_command"
|
||||
fi
|
||||
# Make sure we add fixpath if needed
|
||||
UTIL_FIXUP_EXECUTABLE($1)
|
||||
if test "x$tool_args" != x; then
|
||||
# If we got arguments, re-append them to the command after the fixup.
|
||||
$1="[$]$1 $tool_args"
|
||||
fi
|
||||
AC_MSG_CHECKING([for $1])
|
||||
AC_MSG_RESULT([[$]$1 [[user supplied]]])
|
||||
fi
|
||||
fi
|
||||
$3
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Locate a tool using proper methods.
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
# $3: [path]
|
||||
AC_DEFUN([UTIL_LOOKUP_PROGS],
|
||||
[
|
||||
UTIL_SETUP_TOOL($1, [
|
||||
$1=""
|
||||
|
||||
if test "x$3" != x; then
|
||||
old_path="$PATH"
|
||||
PATH="$3"
|
||||
fi
|
||||
|
||||
for name in $2; do
|
||||
AC_MSG_CHECKING(for $name)
|
||||
|
||||
command_type=`type -t "$name"`
|
||||
if test "x$command_type" = xbuiltin || test "x$command_type" = xkeyword; then
|
||||
# Shell builtin or keyword; we're done here
|
||||
full_path="$name"
|
||||
$1="$full_path"
|
||||
AC_MSG_RESULT([[$full_path [builtin]]])
|
||||
break
|
||||
else
|
||||
# Search in $PATH
|
||||
old_ifs="$IFS"
|
||||
IFS=":"
|
||||
for elem in $PATH; do
|
||||
IFS="$old_ifs"
|
||||
if test "x$elem" = x; then
|
||||
continue
|
||||
fi
|
||||
full_path="$elem/$name"
|
||||
if test ! -e "$full_path" && test "x$OPENJDK_BUILD_OS" = "xwindows"; then
|
||||
# Try again with .exe
|
||||
full_path="$elem/$name.exe"
|
||||
fi
|
||||
if test -x "$full_path" && test ! -d "$full_path" ; then
|
||||
$1="$full_path"
|
||||
UTIL_FIXUP_EXECUTABLE($1, $3, $4)
|
||||
result="[$]$1"
|
||||
|
||||
# If we have FIXPATH enabled, strip all instances of it and prepend
|
||||
# a single one, to avoid double fixpath prefixing.
|
||||
[ if [[ $FIXPATH != "" && $result =~ ^"$FIXPATH " ]]; then ]
|
||||
result="\$FIXPATH ${result#"$FIXPATH "}"
|
||||
fi
|
||||
AC_MSG_RESULT([$result])
|
||||
break 2;
|
||||
fi
|
||||
done
|
||||
IFS="$old_ifs"
|
||||
fi
|
||||
AC_MSG_RESULT([[[not found]]])
|
||||
done
|
||||
|
||||
if test "x$3" != x; then
|
||||
PATH="$old_path"
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Call UTIL_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool. This will look
|
||||
# first for tools using the cross-compilation prefix, and then for tools without
|
||||
# this prefix. For each of these name variants, it will look first in the
|
||||
# toolchain path, and then in the normal path.
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
AC_DEFUN([UTIL_LOOKUP_TOOLCHAIN_PROGS],
|
||||
[
|
||||
if test "x$ac_tool_prefix" = x; then
|
||||
UTIL_LOOKUP_PROGS($1, $2, [$TOOLCHAIN_PATH:$PATH])
|
||||
else
|
||||
prefixed_names=$(for name in $2; do echo ${ac_tool_prefix}${name} $name; done)
|
||||
UTIL_LOOKUP_PROGS($1, $prefixed_names, [$TOOLCHAIN_PATH:$PATH])
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Test that variable $1 denoting a program is not empty. If empty, exit with an error.
|
||||
# $1: variable to check
|
||||
AC_DEFUN([UTIL_CHECK_NONEMPTY],
|
||||
[
|
||||
if test "x[$]$1" = x; then
|
||||
AC_MSG_ERROR([Could not find required tool for $1])
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Like UTIL_LOOKUP_PROGS but fails if no tool was found.
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
# $3: [path]
|
||||
AC_DEFUN([UTIL_REQUIRE_PROGS],
|
||||
[
|
||||
UTIL_LOOKUP_PROGS($1, $2, $3)
|
||||
UTIL_CHECK_NONEMPTY($1)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Like UTIL_LOOKUP_PROGS but fails if no tool was found.
|
||||
# $1: variable to set
|
||||
# $2: executable name (or list of names) to look for
|
||||
AC_DEFUN([UTIL_REQUIRE_TOOLCHAIN_PROGS],
|
||||
[
|
||||
UTIL_LOOKUP_TOOLCHAIN_PROGS($1, $2)
|
||||
UTIL_CHECK_NONEMPTY($1)
|
||||
])
|
||||
|
||||
|
||||
################################################################################
|
||||
# Like UTIL_SETUP_TOOL but fails if no tool was found.
|
||||
# $1: variable to set
|
||||
# $2: autoconf macro to call to look for the special tool
|
||||
AC_DEFUN([UTIL_REQUIRE_SPECIAL],
|
||||
[
|
||||
UTIL_SETUP_TOOL($1, [$2])
|
||||
UTIL_CHECK_NONEMPTY($1)
|
||||
# The special macro will return an absolute path, and is only used for
|
||||
# unix tools. No further processing needed.
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Add FIXPATH prefix to variable. Normally this is done by UTIL_LOOKUP_PROGS
|
||||
# or UTIL_FIXUP_EXECUTABLE, but in some circumstances this has to be done
|
||||
# explicitly, such as when the command in question does not exist yet.
|
||||
#
|
||||
# $1: variable to add fixpath to
|
||||
AC_DEFUN([UTIL_ADD_FIXPATH],
|
||||
[
|
||||
if test "x$FIXPATH" != x; then
|
||||
$1="$FIXPATH [$]$1"
|
||||
fi
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Return a path to the executable binary from a command line, stripping away
|
||||
# any FIXPATH prefix or arguments. The resulting value can be checked for
|
||||
# existence using "test -e". The result is returned in a variable named
|
||||
# "$1_EXECUTABLE".
|
||||
#
|
||||
# $1: variable describing the command to get the binary for
|
||||
AC_DEFUN([UTIL_GET_EXECUTABLE],
|
||||
[
|
||||
# Strip the FIXPATH prefix, if any
|
||||
fixpath_stripped="[$]$1"
|
||||
[ if [[ $FIXPATH != "" && $fixpath_stripped =~ ^"$FIXPATH " ]]; then ]
|
||||
fixpath_stripped="${fixpath_stripped#"$FIXPATH "}"
|
||||
fi
|
||||
# Remove any arguments following the binary
|
||||
$1_EXECUTABLE="${fixpath_stripped%% *}"
|
||||
])
|
||||
|
||||
################################################################################
|
||||
AC_DEFUN([UTIL_REMOVE_SYMBOLIC_LINKS],
|
||||
[
|
||||
if test "x$OPENJDK_BUILD_OS" != xwindows; then
|
||||
# Follow a chain of symbolic links. Use readlink
|
||||
# where it exists, else fall back to horribly
|
||||
# complicated shell code.
|
||||
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.
|
||||
READLINK_ISGNU=`$READLINK --version 2>&1 | $GREP GNU`
|
||||
# If READLINK_ISGNU is empty, then it's a non-GNU readlink. Don't use it.
|
||||
READLINK_TESTED=yes
|
||||
fi
|
||||
|
||||
if test "x$READLINK" != x && test "x$READLINK_ISGNU" != x; then
|
||||
$1=`$READLINK -f [$]$1`
|
||||
else
|
||||
# Save the current directory for restoring afterwards
|
||||
STARTDIR=$PWD
|
||||
COUNTER=0
|
||||
sym_link_dir=`$DIRNAME [$]$1`
|
||||
sym_link_file=`$BASENAME [$]$1`
|
||||
cd $sym_link_dir
|
||||
# Use -P flag to resolve symlinks in directories.
|
||||
cd `pwd -P`
|
||||
sym_link_dir=`pwd -P`
|
||||
# Resolve file symlinks
|
||||
while test $COUNTER -lt 20; do
|
||||
ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP -e '->' | $SED -e 's/.*-> \(.*\)/\1/'`
|
||||
if test "x$ISLINK" == x; then
|
||||
# This is not a symbolic link! We are done!
|
||||
break
|
||||
fi
|
||||
# Again resolve directory symlinks since the target of the just found
|
||||
# link could be in a different directory
|
||||
cd `$DIRNAME $ISLINK`
|
||||
sym_link_dir=`pwd -P`
|
||||
sym_link_file=`$BASENAME $ISLINK`
|
||||
let COUNTER=COUNTER+1
|
||||
done
|
||||
cd $STARTDIR
|
||||
$1=$sym_link_dir/$sym_link_file
|
||||
fi
|
||||
fi
|
||||
])
|
||||
114
make/common/CopyFiles.gmk
Normal file
114
make/common/CopyFiles.gmk
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
# Code for handling the SetupCopyFiles macro.
|
||||
################################################################################
|
||||
|
||||
define AddFileToCopy
|
||||
# Helper macro for SetupCopyFiles
|
||||
# 1 : Source file
|
||||
# 2 : Dest file
|
||||
# 3 : Variable to add targets to
|
||||
# 4 : Macro to call for copy operation
|
||||
# 5 : Action text to log
|
||||
$2: $1
|
||||
$$(call LogInfo, $(strip $5) $$(patsubst $(OUTPUTDIR)/%,%,$$(call DecodeSpace, $$@)))
|
||||
$$($$(strip $4))
|
||||
|
||||
$3 += $2
|
||||
$3_SOURCES += $1
|
||||
endef
|
||||
|
||||
# Returns the value of the first argument
|
||||
identity = \
|
||||
$(strip $1)
|
||||
|
||||
# Setup make rules for copying files, with an option to do more complex
|
||||
# processing instead of copying.
|
||||
#
|
||||
# Parameter 1 is the name of the rule. This name is used as variable prefix,
|
||||
# and the targets generated are listed in a variable by that name.
|
||||
#
|
||||
# The list of all source files is returned in $1_SOURCES.
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# SRC : Source root dir (defaults to dir of first file)
|
||||
# DEST : Dest root dir
|
||||
# FILES : List of files to copy with absolute paths, or path relative to SRC.
|
||||
# Must be in SRC.
|
||||
# FLATTEN : Set to flatten the directory structure in the DEST dir.
|
||||
# MACRO : Optionally override the default macro used for making the copy.
|
||||
# Default is 'install-file'
|
||||
# NAME_MACRO : Optionally supply a macro that rewrites the target file name
|
||||
# based on the source file name
|
||||
# LOG_ACTION : Optionally specify a different action text for log messages
|
||||
SetupCopyFiles = $(NamedParamsMacroTemplate)
|
||||
define SetupCopyFilesBody
|
||||
|
||||
ifeq ($$($1_MACRO), )
|
||||
$1_MACRO := install-file
|
||||
endif
|
||||
|
||||
# Default SRC to the dir of the first file.
|
||||
ifeq ($$($1_SRC), )
|
||||
$1_SRC := $$(dir $$(firstword $$($1_FILES)))
|
||||
endif
|
||||
|
||||
ifeq ($$($1_NAME_MACRO), )
|
||||
$1_NAME_MACRO := identity
|
||||
endif
|
||||
|
||||
ifeq ($$($1_LOG_ACTION), )
|
||||
$1_LOG_ACTION := Copying
|
||||
endif
|
||||
|
||||
# Remove any trailing slash from SRC and DEST
|
||||
$1_SRC := $$(patsubst %/,%,$$($1_SRC))
|
||||
$1_DEST := $$(patsubst %/,%,$$($1_DEST))
|
||||
|
||||
# Need to wrap arguments in DoubleDollar because of the eval nested inside an
|
||||
# eval macro body.
|
||||
$$(foreach f, $$(patsubst $$($1_SRC)/%,%,$$($1_FILES)), \
|
||||
$$(eval $$(call AddFileToCopy, \
|
||||
$$(call DoubleDollar, $$($1_SRC)/$$f), \
|
||||
$$(call DoubleDollar, \
|
||||
$$($1_DEST)/$$(call $$(strip $$($1_NAME_MACRO)),$$(if $$($1_FLATTEN),$$(notdir $$f),$$f)) \
|
||||
), \
|
||||
$1, \
|
||||
$$($1_MACRO), \
|
||||
$$($1_LOG_ACTION) \
|
||||
)) \
|
||||
)
|
||||
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
58
make/common/DebugInfoUtils.gmk
Normal file
58
make/common/DebugInfoUtils.gmk
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#
|
||||
# Copyright (c) 2024, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
# Common debuginfo utility functions
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# Find native debuginfo files in a directory
|
||||
#
|
||||
# Param 1 - dir to find debuginfo files in
|
||||
FindDebuginfoFiles = \
|
||||
$(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \
|
||||
$(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \
|
||||
$(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES)))
|
||||
|
||||
# Pick the correct debug info files to copy, either zipped or not.
|
||||
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
|
||||
DEBUGINFO_SUFFIXES += .diz
|
||||
else
|
||||
DEBUGINFO_SUFFIXES := .debuginfo .pdb .map
|
||||
# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
|
||||
# dirs.
|
||||
ifeq ($(call isTargetOs, macosx), true)
|
||||
$(call FillFindCache, \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_libs $(SUPPORT_OUTPUTDIR)/modules_cmds)
|
||||
FindDebuginfoFiles = \
|
||||
$(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1)))
|
||||
endif
|
||||
endif
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
222
make/common/Execute.gmk
Normal file
222
make/common/Execute.gmk
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
#
|
||||
# Copyright (c) 2019, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
# Code for handling the SetupExecute macro.
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# Setup make rules for executing an arbitrary command.
|
||||
#
|
||||
# Parameter 1 is the name of the rule. This name is used as variable prefix,
|
||||
# and the targets generated are listed in a variable by that name.
|
||||
#
|
||||
# You need to specify a COMMAND, the actual command line to execute. You are
|
||||
# strongly recommended to provide a INFO with the text to display for LOG=info
|
||||
# on what operation is performed. You can use DEPS to provide additional
|
||||
# dependencies for your command to run. You can optionally include a PRE_COMMAND
|
||||
# and a POST_COMMAND, intended for simple pre- and post-processing. The latter
|
||||
# might be e.g. a mv from a temporary file to the final destination, the former
|
||||
# e.g. a simple sed replacement on the input file. If the operations are
|
||||
# unrelated to the main COMMAND, this is not a suitable solution.
|
||||
#
|
||||
# Before execution, the current working directory is changed to SUPPORT_DIR.
|
||||
# This can be overridden with WORKING_DIR.
|
||||
#
|
||||
# If your command outputs a variety of files, or if it's really a single file
|
||||
# but you don't really care about the output from the perspective, you can just
|
||||
# supply an OUTPUT_DIR. You are supposed to make sure the command creates files
|
||||
# in this directory (which will be created for you if it does not exist), but
|
||||
# this can't be enforced by SetupExecute. Additional support files (like logs
|
||||
# and markers) are created in this directory. If you want support files in a
|
||||
# separate directory (e.g. if you're targeting an OUTPUT_DIR in the image
|
||||
# directly), you can specify a SUPPORT_DIR. If your command outputs only a
|
||||
# single file, you can get rid of the marker files (but not the log files) by
|
||||
# specifying OUTPUT_FILE. Note that if you specify an OUTPUT_FILE, support log
|
||||
# files will be placed in the same directory as the OUTPUT_FILE. If you do not
|
||||
# want that, use SUPPORT_DIR as well.
|
||||
#
|
||||
# After the call to SetupExecute, $1 will contain references to all generated
|
||||
# files (that make knows about), and $1_TARGET will contain a reference to the
|
||||
# final target (that is OUTPUT_FILE if it exists, or the $1_exec.marker file
|
||||
# otherwise).
|
||||
#
|
||||
# All the above keep functioning as expected even if PRE_COMMAND and
|
||||
# POST_COMMAND are given. One special case worth noting is that if OUTPUT_FILE
|
||||
# and POST_COMMAND is both given, the actual OUTPUT_FILE is considered to be a
|
||||
# result of running the POST_COMMAND.
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# COMMAND : The command to execute
|
||||
# PRE_COMMAND : A helper command to execute before COMMAND
|
||||
# POST_COMMAND: A helper command to execute after COMMAND
|
||||
# OUTPUT_DIR : The directory that will contain the result from the command
|
||||
# OUTPUT_FILE : Use this if the command results in a single output file
|
||||
# SUPPORT_DIR : Where to store generated support files
|
||||
# WORKING_DIR : Directory to cd to before executing the command
|
||||
# INFO : Message to display at LOG=info level when running command (optional)
|
||||
# WARN : Message to display at LOG=warn level when running command (optional)
|
||||
# DEPS : Dependencies for the execution to take place
|
||||
# DRYRUN : Set to true to perform everything but executing the command \
|
||||
# (defaults to false, primarily intended for debugging)
|
||||
#
|
||||
|
||||
# Setup make rules for copying files, with an option to do more complex
|
||||
SetupExecute = $(NamedParamsMacroTemplate)
|
||||
define SetupExecuteBody
|
||||
ifeq ($$($1_COMMAND), )
|
||||
$$(error COMMAND is missing in SetupExecute $1)
|
||||
endif
|
||||
|
||||
ifneq ($$($1_OUTPUT_FILE), )
|
||||
ifneq ($$($1_OUTPUT_DIR), )
|
||||
$$(error Cannot specify both OUTPUT_DIR and OUTPUT_FILE in SetupExecute $1)
|
||||
endif
|
||||
# We need to know output dir since we will make sure it is created.
|
||||
$1_OUTPUT_DIR := $$(patsubst %/,%, $$(dir $$($1_OUTPUT_FILE)))
|
||||
ifeq ($$($1_SUPPORT_DIR), )
|
||||
# If support dir is not given, use base dir of output file.
|
||||
$1_SUPPORT_DIR := $$($1_OUTPUT_DIR)
|
||||
endif
|
||||
else ifneq ($$($1_OUTPUT_DIR), )
|
||||
ifeq ($$($1_SUPPORT_DIR), )
|
||||
# If support dir is not given, use output dir.
|
||||
$1_SUPPORT_DIR := $$($1_OUTPUT_DIR)
|
||||
endif
|
||||
else
|
||||
$$(error OUTPUT_DIR or OUTPUT_FILE is required in SetupExecute $1)
|
||||
endif
|
||||
|
||||
$1_BASE := $$($1_SUPPORT_DIR)/_$1
|
||||
$1_PRE_MARKER := $$($1_BASE)_pre.marker
|
||||
$1_EXEC_MARKER := $$($1_BASE)_exec.marker
|
||||
$1_POST_MARKER := $$($1_BASE)_post.marker
|
||||
|
||||
ifeq ($$($1_OUTPUT_FILE), )
|
||||
# No specified output file, use markers everywhere
|
||||
$1_EXEC_RESULT := $$($1_EXEC_MARKER)
|
||||
ifeq ($$($1_POST_COMMAND), )
|
||||
$1_FINAL_RESULT := $$($1_EXEC_MARKER)
|
||||
else
|
||||
$1_FINAL_RESULT := $$($1_POST_MARKER)
|
||||
endif
|
||||
|
||||
else
|
||||
# If we have a single output file, we don't need a separate marker
|
||||
|
||||
ifeq ($$($1_POST_COMMAND), )
|
||||
$1_EXEC_RESULT := $$($1_OUTPUT_FILE)
|
||||
$1_FINAL_RESULT := $$($1_EXEC_RESULT)
|
||||
else
|
||||
$1_EXEC_RESULT := $$($1_EXEC_MARKER)
|
||||
$1_FINAL_RESULT := $$($1_OUTPUT_FILE)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($$($1_WORKING_DIR), )
|
||||
$1_WORKING_DIR := $$($1_SUPPORT_DIR)
|
||||
endif
|
||||
|
||||
ifeq ($$($1_INFO)$$($1_WARN), )
|
||||
# If neither info nor warn is provided, add basic info text.
|
||||
$1_INFO := Running commands for $1
|
||||
endif
|
||||
|
||||
$1_VARDEPS := $$($1_COMMAND) $$($1_PRE_COMMAND) $$($1_POST_COMMAND)
|
||||
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BASE)_exec.vardeps)
|
||||
|
||||
ifneq ($$($1_PRE_COMMAND), )
|
||||
|
||||
$$($1_PRE_MARKER): $$($1_DEPS) $$($1_VARDEPS_FILE)
|
||||
ifneq ($$($1_WARN), )
|
||||
$$(call LogWarn, $$($1_WARN))
|
||||
endif
|
||||
ifneq ($$($1_INFO), )
|
||||
$$(call LogInfo, $$($1_INFO))
|
||||
endif
|
||||
$$(call MakeDir, $$(call EncodeSpace, $$($1_WORKING_DIR)) $$(call EncodeSpace, $$($1_SUPPORT_DIR)) $$(call EncodeSpace, $$($1_OUTPUT_DIR)))
|
||||
$$(call ExecuteWithLog, $$($1_BASE)_pre, \
|
||||
cd $$($1_WORKING_DIR) && $$($1_PRE_COMMAND))
|
||||
$$(TOUCH) $$@
|
||||
|
||||
$$($1_EXEC_RESULT): $$($1_PRE_MARKER)
|
||||
ifneq ($$($1_DRYRUN), true)
|
||||
$$(call ExecuteWithLog, $$($1_BASE)_exec, \
|
||||
cd $$($1_WORKING_DIR) && $$($1_COMMAND))
|
||||
else
|
||||
$$(call LogWarn, DRYRUN enabled for $1, not actually running command)
|
||||
$$(TOUCH) $$@
|
||||
endif
|
||||
ifeq ($$($1_EXEC_RESULT), $$($1_EXEC_MARKER))
|
||||
$$(TOUCH) $$@
|
||||
endif
|
||||
|
||||
$1 := $$($1_PRE_MARKER) $$($1_EXEC_RESULT)
|
||||
else
|
||||
$$($1_EXEC_RESULT): $$($1_DEPS) $$($1_VARDEPS_FILE)
|
||||
ifneq ($$($1_WARN), )
|
||||
$$(call LogWarn, $$($1_WARN))
|
||||
endif
|
||||
ifneq ($$($1_INFO), )
|
||||
$$(call LogInfo, $$($1_INFO))
|
||||
endif
|
||||
$$(call MakeDir, $$(call EncodeSpace, $$($1_WORKING_DIR)) $$(call EncodeSpace, $$($1_SUPPORT_DIR)) $$(call EncodeSpace, $$($1_OUTPUT_DIR)))
|
||||
ifneq ($$($1_DRYRUN), true)
|
||||
$$(call ExecuteWithLog, $$($1_BASE)_exec, \
|
||||
cd $$($1_WORKING_DIR) && $$($1_COMMAND))
|
||||
else
|
||||
$$(call LogWarn, DRYRUN enabled for $1, not actually running command)
|
||||
$$(TOUCH) $$@
|
||||
endif
|
||||
ifeq ($$($1_EXEC_RESULT), $$($1_EXEC_MARKER))
|
||||
$$(TOUCH) $$@
|
||||
endif
|
||||
|
||||
$1 := $$($1_EXEC_RESULT)
|
||||
endif
|
||||
|
||||
ifneq ($$($1_POST_COMMAND), )
|
||||
|
||||
$$($1_FINAL_RESULT): $$($1_EXEC_RESULT)
|
||||
$$(call ExecuteWithLog, $$($1_BASE)_post, \
|
||||
cd $$($1_WORKING_DIR) && $$($1_POST_COMMAND))
|
||||
$$(TOUCH) $$@
|
||||
|
||||
$1 += $$($1_FINAL_RESULT)
|
||||
endif
|
||||
|
||||
# Export all our generated targets in $1, and the final target in $1_TARGET.
|
||||
$1_TARGET := $$($1_FINAL_RESULT)
|
||||
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
311
make/common/FileUtils.gmk
Normal file
311
make/common/FileUtils.gmk
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
# Common file utility functions
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# Replace question marks with space in string. This macro needs to be called on
|
||||
# files from FindFiles in case any of them contains space in their file name,
|
||||
# since FindFiles replaces space with ?.
|
||||
# Param 1 - String to replace in
|
||||
DecodeSpace = \
|
||||
$(subst ?,$(SPACE),$(strip $1))
|
||||
|
||||
EncodeSpace = \
|
||||
$(subst $(SPACE),?,$(strip $1))
|
||||
|
||||
################################################################################
|
||||
# Take two paths and return the path of the last common directory.
|
||||
# Ex: /foo/bar/baz, /foo/bar/banan -> /foo/bar
|
||||
# foo/bar/baz, /foo/bar -> <empty>
|
||||
#
|
||||
# The x prefix is used to preserve the presence of the initial slash
|
||||
# On Windows paths are treated as case-insensitive
|
||||
#
|
||||
# $1 - Path to compare
|
||||
# $2 - Other path to compare
|
||||
FindCommonPathPrefix = \
|
||||
$(call DecodeSpace,$(patsubst x%,%,$(subst $(SPACE),/,$(strip \
|
||||
$(call FindCommonPathPrefixHelper1, \
|
||||
$(subst /,$(SPACE),x$(call EncodeSpace,$(strip $1))), \
|
||||
$(subst /,$(SPACE),x$(call EncodeSpace,$(strip $2)))) \
|
||||
))))
|
||||
|
||||
FindCommonPathPrefixHelper1 = \
|
||||
$(if $(filter $(OPENJDK_TARGET_OS), windows), \
|
||||
$(call FindCommonPathPrefixHelper2,$(call uppercase,$1),$(call uppercase,$2),$1), \
|
||||
$(call FindCommonPathPrefixHelper2,$1,$2,$1))
|
||||
|
||||
FindCommonPathPrefixHelper2 = \
|
||||
$(if $(call equals, $(firstword $1), $(firstword $2)), \
|
||||
$(if $(call equals, $(firstword $1),),, \
|
||||
$(firstword $3) \
|
||||
$(call FindCommonPathPrefixHelper2, \
|
||||
$(wordlist 2, $(words $1), $1), \
|
||||
$(wordlist 2, $(words $2), $2), \
|
||||
$(wordlist 2, $(words $3), $3) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
# Computes the relative path from a directory to a file
|
||||
# $1 - File to compute the relative path to
|
||||
# $2 - Directory to compute the relative path from
|
||||
RelativePath = \
|
||||
$(call DecodeSpace,$(strip $(call RelativePathHelper,$(call EncodeSpace \
|
||||
,$(strip $1)),$(call EncodeSpace \
|
||||
,$(strip $2)),$(call EncodeSpace \
|
||||
,$(call FindCommonPathPrefix,$1,$2)))))
|
||||
|
||||
RelativePathHelper = \
|
||||
$(eval $3_prefix_length := $(words $(subst /,$(SPACE),$3))) \
|
||||
$(eval $1_words := $(subst /,$(SPACE),$1)) \
|
||||
$(eval $2_words := $(subst /,$(SPACE),$2)) \
|
||||
$(if $(call equals,$($3_prefix_length),0),, \
|
||||
$(eval $1_words := $(wordlist 2,$(words $($1_words)),$(wordlist \
|
||||
$($3_prefix_length),$(words $($1_words)),$($1_words)))) \
|
||||
$(eval $2_words := $(wordlist 2,$(words $($2_words)),$(wordlist \
|
||||
$($3_prefix_length),$(words $($2_words)),$($2_words)))) \
|
||||
) \
|
||||
$(eval $1_suffix := $(subst $(SPACE),/,$($1_words))) \
|
||||
$(eval $2_dotdots := $(subst $(SPACE),/,$(foreach d,$($2_words),..))) \
|
||||
$(if $($1_suffix), \
|
||||
$(if $($2_dotdots), $($2_dotdots)/$($1_suffix), $($1_suffix)), \
|
||||
$(if $($2_dotdots), $($2_dotdots), .))
|
||||
|
||||
# Make directory for target file. Should handle spaces in filenames. Just
|
||||
# calling $(call MakeDir $(@D)) will not work if the directory contains a space
|
||||
# and the target file already exists. In that case, the target file will have
|
||||
# its wildcard ? resolved and the $(@D) will evaluate each space separated dir
|
||||
# part on its own.
|
||||
MakeTargetDir = \
|
||||
$(call MakeDir, $(dir $(call EncodeSpace, $@)))
|
||||
|
||||
################################################################################
|
||||
# All install-file and related macros automatically call DecodeSpace when needed.
|
||||
|
||||
ifeq ($(call isTargetOs, macosx), true)
|
||||
# On mac, extended attributes sometimes creep into the source files, which may later
|
||||
# cause the creation of ._* files which confuses testing. Clear these with xattr if
|
||||
# set. Some files get their write permissions removed after being copied to the
|
||||
# output dir. When these are copied again to images, xattr would fail. By only clearing
|
||||
# attributes when they are present, failing on this is avoided.
|
||||
#
|
||||
# If copying a soft link to a directory, need to delete the target first to avoid
|
||||
# weird errors.
|
||||
define install-file
|
||||
$(call MakeTargetDir)
|
||||
$(RM) '$(call DecodeSpace, $@)'
|
||||
# Work around a weirdness with cp on Macosx. When copying a symlink, if
|
||||
# the target of the link is write protected (e.g. 444), cp will add
|
||||
# write permission for the user on the target file (644). Avoid this by
|
||||
# using ln to create a new link instead.
|
||||
if [ -h '$(call DecodeSpace, $<)' ]; then \
|
||||
$(LN) -s "`$(READLINK) '$(call DecodeSpace, $<)'`" '$(call DecodeSpace, $@)'; \
|
||||
else \
|
||||
$(CP) -fRP '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'; \
|
||||
fi
|
||||
if [ -n "`$(XATTR) -ls '$(call DecodeSpace, $@)'`" ]; then \
|
||||
$(CHMOD) -h u+w '$(call DecodeSpace, $@)'; \
|
||||
$(XATTR) -cs '$(call DecodeSpace, $@)'; \
|
||||
fi
|
||||
endef
|
||||
else
|
||||
define install-file
|
||||
$(call MakeTargetDir)
|
||||
$(CP) -fP '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
|
||||
endef
|
||||
endif
|
||||
|
||||
# Variant of install file that does not preserve symlinks
|
||||
define install-file-nolink
|
||||
$(call MakeTargetDir)
|
||||
$(CP) -f '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
# link-file-* works similarly to install-file but creates a symlink instead.
|
||||
# There are two versions, either creating a relative or an absolute link. Be
|
||||
# careful when using this on Windows since the symlink created is only valid in
|
||||
# the unix emulation environment.
|
||||
# In msys2 we use mklink /J because its ln would perform a deep copy of the target.
|
||||
# This inhibits performance and can lead to issues with long paths. With mklink /J
|
||||
# relative linking does not work, so we handle the link as absolute path.
|
||||
ifeq ($(OPENJDK_BUILD_OS_ENV), windows.msys2)
|
||||
define link-file-relative
|
||||
$(call MakeTargetDir)
|
||||
$(RM) '$(call DecodeSpace, $@)'
|
||||
cmd //c "mklink /J $(call FixPath, $(call DecodeSpace, $@)) $(call FixPath, $(call DecodeSpace, $<))"
|
||||
endef
|
||||
else
|
||||
define link-file-relative
|
||||
$(call MakeTargetDir)
|
||||
$(RM) '$(call DecodeSpace, $@)'
|
||||
$(LN) -s '$(call DecodeSpace, $(call RelativePath, $<, $(@D)))' '$(call DecodeSpace, $@)'
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_BUILD_OS_ENV), windows.msys2)
|
||||
define link-file-absolute
|
||||
$(call MakeTargetDir)
|
||||
$(RM) '$(call DecodeSpace, $@)'
|
||||
cmd //c "mklink /J $(call FixPath, $(call DecodeSpace, $@)) $(call FixPath, $(call DecodeSpace, $<))"
|
||||
endef
|
||||
else
|
||||
define link-file-absolute
|
||||
$(call MakeTargetDir)
|
||||
$(RM) '$(call DecodeSpace, $@)'
|
||||
$(LN) -s '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
|
||||
endef
|
||||
endif
|
||||
|
||||
define copy-and-chmod-executable
|
||||
$(install-file)
|
||||
$(CHMOD) a+rx $@
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
|
||||
# Recursive wildcard function. Walks down directories recursively and matches
|
||||
# files with the search patterns. Patterns use standard file wildcards (* and
|
||||
# ?).
|
||||
#
|
||||
# $1 - Directories to start search in
|
||||
# $2 - Search patterns
|
||||
rwildcard = \
|
||||
$(strip \
|
||||
$(foreach d, \
|
||||
$(patsubst %/,%,$(sort $(dir $(wildcard $(addsuffix /*/*, $(strip $1)))))), \
|
||||
$(call rwildcard,$d,$2) \
|
||||
) \
|
||||
$(call DoubleDollar, $(wildcard $(foreach p, $2, $(addsuffix /$(strip $p), $(strip $1))))) \
|
||||
)
|
||||
|
||||
# Find non directories using recursive wildcard function. This function may
|
||||
# be used directly when a small amount of directories is expected to be
|
||||
# searched and caching is not expected to be of use.
|
||||
#
|
||||
# $1 - Directory to start search in
|
||||
# $2 - Optional search patterns, defaults to '*'.
|
||||
WildcardFindFiles = \
|
||||
$(sort $(strip \
|
||||
$(eval WildcardFindFiles_result := $(call rwildcard,$(patsubst %/,%,$1),$(if $(strip $2),$2,*))) \
|
||||
$(filter-out $(patsubst %/,%,$(sort $(dir $(WildcardFindFiles_result)))), \
|
||||
$(WildcardFindFiles_result) \
|
||||
) \
|
||||
))
|
||||
|
||||
# Find non directories using the find utility in the shell. Safe to call for
|
||||
# non existing directories, or directories containing wildcards.
|
||||
#
|
||||
# Files containing space will get spaces replaced with ? because GNU Make
|
||||
# cannot handle lists of files with space in them. By using ?, make will match
|
||||
# the wildcard to space in many situations so we don't need to replace back
|
||||
# to space on every use. While not a complete solution it does allow some uses
|
||||
# of FindFiles to function with spaces in file names, including for
|
||||
# SetupCopyFiles. Unfortunately this does not work for WildcardFindFiles so
|
||||
# if files with spaces are anticipated, use ShellFindFiles directly.
|
||||
#
|
||||
# $1 - Directories to start search in.
|
||||
# $2 - Optional search patterns, empty means find everything. Patterns use
|
||||
# standard file wildcards (* and ?) and should not be quoted.
|
||||
# $3 - Optional options to find.
|
||||
ShellFindFiles = \
|
||||
$(if $(wildcard $1), \
|
||||
$(sort \
|
||||
$(shell $(FIND) $3 $(patsubst %/,%,$(wildcard $1)) \( -type f -o -type l \) \
|
||||
$(if $(strip $2), -a \( -name "$(firstword $2)" \
|
||||
$(foreach p, $(filter-out $(firstword $2), $2), -o -name "$(p)") \)) \
|
||||
| $(TR) ' ' '?' \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
# Find non directories using the method most likely to work best for the
|
||||
# current build host
|
||||
#
|
||||
# $1 - Directory to start search in
|
||||
# $2 - Optional search patterns, defaults to '*'.
|
||||
ifeq ($(OPENJDK_BUILD_OS)-$(RWILDCARD_WORKS), windows-true)
|
||||
DirectFindFiles = $(WildcardFindFiles)
|
||||
else
|
||||
DirectFindFiles = $(ShellFindFiles)
|
||||
endif
|
||||
|
||||
# Finds files using a cache that is populated by FillFindCache below. If any of
|
||||
# the directories given have not been cached, DirectFindFiles is used for
|
||||
# everything. Caching is especially useful in Cygwin, where file finds are very
|
||||
# costly.
|
||||
#
|
||||
# $1 - Directories to start search in.
|
||||
# $2 - Optional search patterns. If used, no caching is done.
|
||||
CacheFindFiles_CACHED_DIRS :=
|
||||
CacheFindFiles_CACHED_FILES :=
|
||||
CacheFindFiles = \
|
||||
$(if $2, \
|
||||
$(call DirectFindFiles, $1, $2) \
|
||||
, \
|
||||
$(if $(filter-out $(addsuffix /%, $(CacheFindFiles_CACHED_DIRS)) \
|
||||
$(CacheFindFiles_CACHED_DIRS), $1), \
|
||||
$(call DirectFindFiles, $1) \
|
||||
, \
|
||||
$(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(CacheFindFiles_CACHED_FILES)) \
|
||||
) \
|
||||
)
|
||||
|
||||
# Explicitly adds files to the find cache used by CacheFindFiles.
|
||||
#
|
||||
# $1 - Directories to start search in
|
||||
FillFindCache = \
|
||||
$(eval CacheFindFiles_NEW_DIRS := $$(filter-out $$(addsuffix /%, \
|
||||
$$(CacheFindFiles_CACHED_DIRS)) $$(CacheFindFiles_CACHED_DIRS), $1)) \
|
||||
$(if $(CacheFindFiles_NEW_DIRS), \
|
||||
$(eval CacheFindFiles_CACHED_DIRS += $$(patsubst %/,%,$$(CacheFindFiles_NEW_DIRS))) \
|
||||
$(eval CacheFindFiles_CACHED_FILES := $$(sort $$(CacheFindFiles_CACHED_FILES) \
|
||||
$$(call DirectFindFiles, $$(CacheFindFiles_NEW_DIRS)))) \
|
||||
)
|
||||
|
||||
# Findfiles is the default macro that should be used to find files in the file
|
||||
# system. This function does not always support files with spaces in the names.
|
||||
# If files with spaces are anticipated, use ShellFindFiles directly.
|
||||
#
|
||||
# $1 - Directories to start search in.
|
||||
# $2 - Optional search patterns, empty means find everything. Patterns use
|
||||
# standard file wildcards (* and ?) and should not be quoted.
|
||||
ifeq ($(DISABLE_CACHE_FIND), true)
|
||||
FindFiles = $(DirectFindFiles)
|
||||
else
|
||||
FindFiles = $(CacheFindFiles)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeIncludeEnd.gmk
|
||||
endif # include guard
|
||||
100
make/common/FindTests.gmk
Normal file
100
make/common/FindTests.gmk
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
#
|
||||
# Copyright (c) 2017, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
|
||||
# TEST_BASEDIRS might have been set by a custom extension
|
||||
TEST_BASEDIRS += $(TOPDIR)/test $(TOPDIR)
|
||||
|
||||
# JTREG_TESTROOTS might have been set by a custom extension
|
||||
JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools jaxp lib-test docs)
|
||||
|
||||
# Extract the names of the Jtreg group files from the TEST.ROOT files. The
|
||||
# TEST.ROOT files being properties files can be interpreted as makefiles so
|
||||
# use include to get at the contents instead of expensive shell calls. We are
|
||||
# looking for the "groups" property in each file.
|
||||
JTREG_ROOT_FILES := $(addsuffix /TEST.ROOT, $(JTREG_TESTROOTS))
|
||||
JTREG_GROUP_FILES :=
|
||||
$(foreach root, $(JTREG_TESTROOTS), \
|
||||
$(if $(wildcard $(root)/TEST.ROOT), \
|
||||
$(eval include $(root)/TEST.ROOT) \
|
||||
$(eval $(root)_JTREG_GROUP_FILES := $$(addprefix $(root)/, $$(groups))) \
|
||||
$(eval JTREG_GROUP_FILES += $$($(root)_JTREG_GROUP_FILES)) \
|
||||
) \
|
||||
)
|
||||
|
||||
# Cache the expensive to calculate test names in a generated makefile.
|
||||
FIND_TESTS_CACHE_FILE := $(MAKESUPPORT_OUTPUTDIR)/find-tests.gmk
|
||||
|
||||
ifeq ($(GENERATE_FIND_TESTS_FILE), true)
|
||||
# If this file is deemed outdated, it will automatically get regenerated
|
||||
# by this rule before being included below.
|
||||
$(FIND_TESTS_CACHE_FILE): $(JTREG_ROOT_FILES) $(JTREG_GROUP_FILES) \
|
||||
$(TOPDIR)/test/make/TestMake.gmk
|
||||
$(call MakeTargetDir)
|
||||
( $(foreach root, $(JTREG_TESTROOTS), \
|
||||
$(ECHO) ""; \
|
||||
$(PRINTF) "\n%s_JTREG_TEST_GROUPS := " "$(root)"; \
|
||||
$(SED) -n -e 's/^\#.*//g' -e 's/\([^ ]*\)\w*=.*/\1/gp' \
|
||||
$($(root)_JTREG_GROUP_FILES) \
|
||||
| $(SORT) -u | $(TR) '\n' ' ' ; \
|
||||
) \
|
||||
) > $@
|
||||
$(ECHO) "" >> $@
|
||||
$(PRINTF) "MAKE_TEST_TARGETS := " >> $@
|
||||
$(MAKE) -s --no-print-directory $(MAKE_ARGS) \
|
||||
SPEC=$(SPEC) -f $(TOPDIR)/test/make/TestMake.gmk print-targets \
|
||||
TARGETS_FILE=$@
|
||||
endif
|
||||
|
||||
-include $(FIND_TESTS_CACHE_FILE)
|
||||
|
||||
# Create a list of all available Jtreg test groups in all components
|
||||
JTREG_TEST_GROUPS += $(sort $(foreach root, $(JTREG_TESTROOTS), \
|
||||
$($(root)_JTREG_TEST_GROUPS)))
|
||||
|
||||
# Add Jtreg test groups to list of named tests (test groups, test list, etc)
|
||||
# ALL_NAMED_TESTS might have been set by a custom extension
|
||||
ALL_NAMED_TESTS += $(JTREG_TEST_GROUPS)
|
||||
|
||||
# Add the make test targets
|
||||
ALL_NAMED_TESTS += $(addprefix make-, $(MAKE_TEST_TARGETS))
|
||||
|
||||
# Add Gtest
|
||||
ALL_NAMED_TESTS += gtest
|
||||
|
||||
# Add microbenchmarks
|
||||
ALL_NAMED_TESTS += micro
|
||||
|
||||
# Add special tests
|
||||
ALL_NAMED_TESTS += failure-handler make
|
||||
|
||||
################################################################################
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
287
make/common/JarArchive.gmk
Normal file
287
make/common/JarArchive.gmk
Normal file
|
|
@ -0,0 +1,287 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeIO.gmk
|
||||
|
||||
FALSE_FIND_PATTERN := -name FILE_NAME_THAT_DOESNT_EXIST
|
||||
|
||||
# Setup make rules for creating a jar archive.
|
||||
#
|
||||
# Parameter 1 is the name of the rule. This name is used as variable prefix,
|
||||
# and the targets generated are listed in a variable by that name.
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# DEPENDENCIES List of dependencies for the jar target. If left empty,
|
||||
# dependencies are calculated automatically from the source files found.
|
||||
# For this to work, the source files must exist when the makefile is
|
||||
# parsed.
|
||||
# SRCS List of directories in where to find files to add to archive
|
||||
# BIN Directory where to store build control files
|
||||
# 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
|
||||
# JARINDEX true means generate the index in the jar file.
|
||||
# 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.
|
||||
# CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
|
||||
# JAR_CMD Optionally override the jar command to use when creating the archive.
|
||||
SetupJarArchive = $(NamedParamsMacroTemplate)
|
||||
define SetupJarArchiveBody
|
||||
|
||||
$1_JARMAIN := $(strip $$($1_JARMAIN))
|
||||
$1_JARNAME := $$(notdir $$($1_JAR))
|
||||
$1_JAR_OUTPUT_DIR := $$(patsubst %/, %, $$(dir $$($1_JAR)))
|
||||
$$(call SetIfEmpty, $1_BIN, $$($1_JAR_OUTPUT_DIR))
|
||||
$1_MANIFEST_FILE := $$($1_BIN)/_the.$$($1_JARNAME)_manifest
|
||||
$1_DELETESS_FILE := $$($1_BIN)/_the.$$($1_JARNAME)_deletess
|
||||
$1_DELETES_FILE := $$($1_BIN)/_the.$$($1_JARNAME)_deletes
|
||||
$$(call SetIfEmpty, $1_JAR_CMD, $$(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))
|
||||
# On windows, a lot of includes/excludes risk making the command line too long, so
|
||||
# writing the grep patterns to files.
|
||||
# Grep returns 1 if nothing is matched. Do not fail the build for this.
|
||||
ifneq ($$($1_INCLUDES), )
|
||||
$1_GREP_INCLUDE_PATTERNS := $$(call EscapeDollar, \
|
||||
$$(foreach src,$$($1_SRCS), $$(addprefix $$(src)/,$$($1_INCLUDES))))
|
||||
# If there are a lot of include patterns, output to file to shorten command lines
|
||||
ifeq ($$(word 20, $$($1_GREP_INCLUDE_PATTERNS)), )
|
||||
$1_GREP_INCLUDES := | ( $(GREP) $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_INCLUDE_PATTERNS)) \
|
||||
|| test "$$$$?" = "1" )
|
||||
else
|
||||
$1_GREP_INCLUDE_OUTPUT = \
|
||||
$$(eval $$(call ListPathsSafely, $1_GREP_INCLUDE_PATTERNS, \
|
||||
$$($1_BIN)/_the.$$($1_JARNAME)_include))
|
||||
$1_GREP_INCLUDES := | ( $(GREP) -f $$($1_BIN)/_the.$$($1_JARNAME)_include \
|
||||
|| test "$$$$?" = "1" )
|
||||
endif
|
||||
endif
|
||||
ifneq ($$($1_EXCLUDES)$$($1_EXCLUDE_FILES), )
|
||||
$1_GREP_EXCLUDE_PATTERNS := $$(call EscapeDollar, \
|
||||
$$(foreach src, $$($1_SRCS), $$(addprefix $$(src)/, \
|
||||
$$($1_EXCLUDES) $$($1_EXCLUDE_FILES))))
|
||||
# If there are a lot of include patterns, output to file to shorten command lines
|
||||
ifeq ($$(word 20, $$($1_GREP_EXCLUDE_PATTERNS)), )
|
||||
$1_GREP_EXCLUDES := | ( $(GREP) -v $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_EXCLUDE_PATTERNS)) \
|
||||
|| test "$$$$?" = "1" )
|
||||
else
|
||||
$1_GREP_EXCLUDE_OUTPUT = \
|
||||
$$(eval $$(call ListPathsSafely, $1_GREP_EXCLUDE_PATTERNS, \
|
||||
$$($1_BIN)/_the.$$($1_JARNAME)_exclude))
|
||||
$1_GREP_EXCLUDES := | ( $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude \
|
||||
|| test "$$$$?" = "1" )
|
||||
endif
|
||||
endif
|
||||
|
||||
# Check if this jar needs to have its index generated.
|
||||
ifneq ($$($1_JARINDEX), )
|
||||
$1_JARINDEX = (cd $$(dir $$@) && $$($1_JAR_CMD) -i $$(notdir $$@))
|
||||
else
|
||||
$1_JARINDEX = true
|
||||
endif
|
||||
# When this macro is run in the same makefile as the java compilation, dependencies are
|
||||
# transferred in make variables. When the macro is run in a different makefile than the
|
||||
# java compilation, the dependencies need to be found in the filesystem.
|
||||
$1_ORIG_DEPS := $$($1_DEPENDENCIES)
|
||||
ifeq ($$($1_DEPENDENCIES), )
|
||||
# Add all source roots to the find cache since we are likely going to run find
|
||||
# on these more than once. The cache will only be updated if necessary.
|
||||
$$(call FillFindCache, $$($1_FIND_LIST))
|
||||
$1_DEPENDENCIES := $$(filter $$(addprefix %, $$($1_SUFFIXES)), \
|
||||
$$(call FindFiles, $$($1_SRCS)))
|
||||
ifneq ($$($1_GREP_INCLUDE_PATTERNS), )
|
||||
$1_DEPENDENCIES := $$(filter $$(addsuffix %, $$($1_GREP_INCLUDE_PATTERNS)), $$($1_DEPENDENCIES))
|
||||
endif
|
||||
ifneq ($$($1_GREP_EXCLUDE_PATTERNS), )
|
||||
$1_DEPENDENCIES := $$(filter-out $$(addsuffix %, $$($1_GREP_EXCLUDE_PATTERNS)), $$($1_DEPENDENCIES))
|
||||
endif
|
||||
# Look for EXTRA_FILES in all SRCS dirs and as absolute paths.
|
||||
$1_DEPENDENCIES += $$(wildcard $$(foreach src, $$($1_SRCS), \
|
||||
$$(addprefix $$(src)/, $$($1_EXTRA_FILES))) $$($1_EXTRA_FILES))
|
||||
ifeq ($$($1_SKIP_METAINF), )
|
||||
$1_DEPENDENCIES += $$(call FindFiles, $$(wildcard $$(addsuffix /META-INF, $$($1_SRCS))))
|
||||
endif
|
||||
endif
|
||||
# The dependency list should never be empty
|
||||
ifeq ($$(strip $$($1_DEPENDENCIES)), )
|
||||
$$(warning No dependencies found for $1)
|
||||
endif
|
||||
|
||||
# Utility macros, to make the shell script receipt somewhat easier to decipher.
|
||||
|
||||
# Capture extra files is the same for both CAPTURE_CONTENTS and SCAPTURE_CONTENTS so
|
||||
# only define it once to avoid duplication.
|
||||
# The list of extra files might be long, so need to use ListPathsSafely to print
|
||||
# them out to a separate file. Then process the contents of that file to rewrite
|
||||
# into -C <dir> <file> lines.
|
||||
# The EXTRA_FILES_RESOLVED variable must be set in the macro so that it's evaluated
|
||||
# in the recipe when the files are guaranteed to exist.
|
||||
$1_CAPTURE_EXTRA_FILES = \
|
||||
$$(eval $1_EXTRA_FILES_RESOLVED := $$(call DoubleDollar, \
|
||||
$$(wildcard $$(foreach src, $$($1_SRCS), \
|
||||
$$(addprefix $$(src)/, $$($1_EXTRA_FILES))) $$($1_EXTRA_FILES)))) \
|
||||
$$(if $$($1_EXTRA_FILES_RESOLVED), \
|
||||
$$(eval $$(call ListPathsSafely, $1_EXTRA_FILES_RESOLVED, \
|
||||
$$($1_BIN)/_the.$$($1_JARNAME)_contents.extra)) \
|
||||
$(SED) $$(foreach src, $$($1_SRCS), -e 's|$$(src)/|-C $$(src) |g') \
|
||||
$$($1_BIN)/_the.$$($1_JARNAME)_contents.extra \
|
||||
>> $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE))
|
||||
|
||||
# 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.
|
||||
# NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
|
||||
$1_CAPTURE_CONTENTS = \
|
||||
$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE) \
|
||||
$$(foreach src, $$($1_SRCS), \
|
||||
$(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) \
|
||||
$$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/|-C $$(src) |g' \
|
||||
>> $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)) \
|
||||
$$($1_CAPTURE_EXTRA_FILES)
|
||||
|
||||
# The capture metainf macro finds all files below the META-INF directory that are newer than the jar-file.
|
||||
# Find returns non zero if the META-INF dir does not exist, ignore this.
|
||||
ifeq ($$($1_SKIP_METAINF), )
|
||||
$1_CAPTURE_METAINF = $$(foreach src, $$($1_SRCS), \
|
||||
( ( $(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null || true ) \
|
||||
| $(SED) 's|$$(src)/|-C $$(src) |g' >> \
|
||||
$$($1_BIN)/_the.$$($1_JARNAME)_contents ) $$(NEWLINE) )
|
||||
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) \;) $$(NEWLINE))
|
||||
# The update contents macro updates the jar file with the previously capture contents.
|
||||
# Use 'wc -w' to see if the contents file is empty.
|
||||
$1_UPDATE_CONTENTS = \
|
||||
if [ "`$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \
|
||||
$(ECHO) " updating" `$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
|
||||
$(SORT) $$($1_BIN)/_the.$$($1_JARNAME)_contents > $$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted && \
|
||||
$$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted; \
|
||||
fi $$(NEWLINE)
|
||||
# The s-variants of the above macros are used when the jar is created from scratch.
|
||||
# NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
|
||||
$1_SCAPTURE_CONTENTS = \
|
||||
$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE) \
|
||||
$$(foreach src, $$($1_SRCS), \
|
||||
$(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
|
||||
$$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/|-C $$(src) |g' \
|
||||
>> $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)) \
|
||||
$$($1_CAPTURE_EXTRA_FILES)
|
||||
|
||||
# Find returns non zero if the META-INF dir does not exist, ignore this.
|
||||
ifeq ($$($1_SKIP_METAINF), )
|
||||
$1_SCAPTURE_METAINF = $$(foreach src, $$($1_SRCS), \
|
||||
( ( $(FIND) $$(src)/META-INF -type f 2> /dev/null || true ) \
|
||||
| $(SED) 's|$$(src)/|-C $$(src) |g' >> \
|
||||
$$($1_BIN)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
|
||||
endif
|
||||
$1_SUPDATE_CONTENTS = \
|
||||
$(SORT) $$($1_BIN)/_the.$$($1_JARNAME)_contents > $$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted && \
|
||||
$$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted $$(NEWLINE)
|
||||
|
||||
# Use a slightly shorter name for logging, but with enough path to identify this jar.
|
||||
$1_NAME := $$(subst $$(OUTPUTDIR)/,,$$($1_JAR))
|
||||
|
||||
# If reproducible build and the boot jdk jar supports --date option
|
||||
# then specify the --date using SOURCE_DATE in ISO-8601
|
||||
$1_JAR_OPTIONS :=
|
||||
ifeq ($$(BOOT_JDK_JAR_SUPPORTS_DATE), true)
|
||||
$1_JAR_OPTIONS += --date $(SOURCE_DATE_ISO_8601)
|
||||
endif
|
||||
ifneq ($$($1_CHECK_COMPRESS_JAR), )
|
||||
ifneq ($(COMPRESS_JARS), true)
|
||||
$1_JAR_OPTIONS += --no-compress
|
||||
endif
|
||||
endif
|
||||
|
||||
# Include all variables of significance in the vardeps file
|
||||
$1_VARDEPS := $$($1_JAR_CMD) $$($1_JAR_OPTIONS) $$($1_MANIFEST) \
|
||||
$$($1_JARMAIN) $$($1_EXTRA_MANIFEST_ATTR) $$($1_ORIG_DEPS) $$($1_SRCS) \
|
||||
$$($1_INCLUDES) $$($1_EXCLUDES) $$($1_EXCLUDE_FILES) $$($1_EXTRA_FILES)
|
||||
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BIN)/_the.$$($1_JARNAME).vardeps)
|
||||
|
||||
# Here is the rule that creates/updates the jar file.
|
||||
$$($1_JAR) : $$($1_DEPENDENCIES) $$($1_MANIFEST) $$($1_VARDEPS_FILE)
|
||||
$$(call MakeTargetDir)
|
||||
$$(call MakeDir, $$($1_BIN))
|
||||
$$($1_GREP_INCLUDE_OUTPUT)
|
||||
$$($1_GREP_EXCLUDE_OUTPUT)
|
||||
# If the vardeps file is part of the newer prereq list, it means that
|
||||
# either the jar file does not exist, or we need to recreate it from
|
||||
# from scratch anyway since a simple update will not catch all the
|
||||
# potential changes.
|
||||
$$(if $$(filter $$($1_VARDEPS_FILE) $$($1_MANIFEST), $$?), \
|
||||
$$(if $$($1_MANIFEST), \
|
||||
$(CP) $$($1_MANIFEST) $$($1_MANIFEST_FILE) $$(NEWLINE) \
|
||||
, \
|
||||
$(RM) $$($1_MANIFEST_FILE) && $(TOUCH) $$($1_MANIFEST_FILE) $$(NEWLINE)) \
|
||||
$$(if $$($1_JARMAIN), \
|
||||
$(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE) $$(NEWLINE)) \
|
||||
$$(if $$($1_EXTRA_MANIFEST_ATTR), \
|
||||
$(ECHO) "$$($1_EXTRA_MANIFEST_ATTR)" >> $$($1_MANIFEST_FILE) $$(NEWLINE)) \
|
||||
$(ECHO) Creating $$($1_NAME) $$(NEWLINE) \
|
||||
$$($1_JAR_CMD) --create $$($1_JAR_OPTIONS) --file $$@ --manifest $$($1_MANIFEST_FILE) $$(NEWLINE) \
|
||||
$$($1_SCAPTURE_CONTENTS) \
|
||||
$$($1_SCAPTURE_METAINF) \
|
||||
$$($1_SUPDATE_CONTENTS) \
|
||||
$$($1_JARINDEX) && true \
|
||||
, \
|
||||
$(ECHO) Modifying $$($1_NAME) $$(NEWLINE) \
|
||||
$$($1_CAPTURE_CONTENTS) \
|
||||
$$($1_CAPTURE_METAINF) \
|
||||
$(RM) $$($1_DELETES_FILE) $$(NEWLINE) \
|
||||
$$($1_CAPTURE_DELETES) \
|
||||
$(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) $$(NEWLINE) \
|
||||
if [ -s $$($1_DELETESS_FILE) ]; then \
|
||||
$(ECHO) " deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \
|
||||
$(ZIPEXE) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
|
||||
fi $$(NEWLINE) \
|
||||
$$($1_UPDATE_CONTENTS) true $$(NEWLINE) \
|
||||
$$($1_JARINDEX) && true )
|
||||
|
||||
# Add jar to target list
|
||||
$1 += $$($1_JAR)
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
568
make/common/JavaCompilation.gmk
Normal file
568
make/common/JavaCompilation.gmk
Normal file
|
|
@ -0,0 +1,568 @@
|
|||
#
|
||||
# Copyright (c) 2011, 2025, 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 MakeIncludeStart.gmk
|
||||
ifeq ($(INCLUDE), true)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeIO.gmk
|
||||
|
||||
# Java compilation needs SetupJarArchive if we're generating a jar file
|
||||
include JarArchive.gmk
|
||||
|
||||
###
|
||||
### Definitions for common release targets
|
||||
###
|
||||
|
||||
# Create classes that can run on the bootjdk
|
||||
# -Xlint:-options is added to avoid the warning
|
||||
# "system modules path not set in conjunction with -source"
|
||||
TARGET_RELEASE_BOOTJDK := -source $(OLDEST_BOOT_JDK_VERSION) \
|
||||
-target $(OLDEST_BOOT_JDK_VERSION) -Xlint:-options
|
||||
|
||||
# Create classes that can be used in (or be a part of) the new jdk we're
|
||||
# building
|
||||
TARGET_RELEASE_NEWJDK := -source $(JDK_SOURCE_TARGET_VERSION) \
|
||||
-target $(JDK_SOURCE_TARGET_VERSION)
|
||||
|
||||
# Create classes that can be used in JDK 8, for legacy support
|
||||
TARGET_RELEASE_JDK8 := --release 8
|
||||
|
||||
# Create classes for the new jdk, relying only on the modules of the new jdk
|
||||
TARGET_RELEASE_NEWJDK_UPGRADED := $(TARGET_RELEASE_NEWJDK) \
|
||||
--upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none
|
||||
|
||||
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)))
|
||||
# To allow for automatic overrides, do not create a rule for a target file that
|
||||
# already has one
|
||||
ifneq ($$($1_COPY_$$($2_TARGET)), 1)
|
||||
$1_COPY_$$($2_TARGET) := 1
|
||||
# Now we can setup the dependency that will trigger the copying.
|
||||
$$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
|
||||
$$(call LogInfo, Copying $$(patsubst $$(OUTPUTDIR)/%,%, $$@))
|
||||
$$(install-file)
|
||||
$(CHMOD) -f ug+w $$@
|
||||
|
||||
# And do not forget this target
|
||||
$1_ALL_COPY_TARGETS += $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET)
|
||||
endif
|
||||
endef
|
||||
|
||||
# This macro is used only for properties files that are to be
|
||||
# copied over to the classes directory in cleaned form.
|
||||
#
|
||||
# An empty echo ensures that the input to sed always ends with a newline.
|
||||
# Certain implementations (e.g. Solaris) will skip the last line without
|
||||
# it.
|
||||
#
|
||||
# The sed expression does this:
|
||||
# 1. Add a backslash before any :, = or ! that do not have a backslash already.
|
||||
# 2. Delete all lines starting with #.
|
||||
# 3. Delete empty lines.
|
||||
# 4. Append lines ending with \ with the next line.
|
||||
# 5. Remove leading and trailing white space. Note that tabs must be explicit
|
||||
# as sed on macosx does not understand '\t'.
|
||||
# 6. Replace the first \= with just =.
|
||||
# 7. Finally it's all sorted to create a stable output.
|
||||
#
|
||||
# It is assumed that = is the character used for separating names and values.
|
||||
define add_file_to_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 dependency that will trigger the copying.
|
||||
# To allow for automatic overrides, do not create a rule for a target file that
|
||||
# already has one
|
||||
ifneq ($$($1_CLEAN_$$($2_TARGET)), 1)
|
||||
$1_CLEAN_$$($2_TARGET) := 1
|
||||
$$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
|
||||
$$(call LogInfo, Cleaning $$(patsubst $$(OUTPUTDIR)/%,%, $$@))
|
||||
$$(call MakeTargetDir)
|
||||
( $(CAT) $$< && $(ECHO) "" ) \
|
||||
| $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
|
||||
-e 's/\([^\\]\)!/\1\\!/g' -e 's/^[ ]*#.*/#/g' \
|
||||
| $(SED) -e '/^#/d' -e '/^$$$$/d' \
|
||||
-e :a -e '/\\$$$$/N; s/\\\n//; ta' \
|
||||
-e 's/^[ ]*//;s/[ ]*$$$$//' \
|
||||
-e 's/\\=/=/' \
|
||||
| $(SORT) > $$@
|
||||
$(CHMOD) -f ug+w $$@
|
||||
|
||||
# And do not forget this target
|
||||
$1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET)
|
||||
endif
|
||||
endef
|
||||
|
||||
define remove_string
|
||||
$2 := $$(subst $1,,$$($2))
|
||||
endef
|
||||
|
||||
# Setup make rules for compiling Java source code to class files and/or a
|
||||
# resulting jar file.
|
||||
#
|
||||
# Parameter 1 is the name of the rule. This name is used as variable prefix,
|
||||
# and the targets generated are listed in a variable by that name.
|
||||
#
|
||||
# The target for public API digest is returned in $1_API_TARGET.
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# SMALL_JAVA set to false to run javac as a "big" java app
|
||||
# COMPILER bootjdk or interim, the latter is default
|
||||
# TARGET_RELEASE javac flags to set the targeted jdk release (-source/-target or --release)
|
||||
# Defaults to $(TARGET_RELEASE_NEWJDK).
|
||||
# JAVAC_FLAGS javac flags to append to the default ones.
|
||||
# JAVA_FLAGS flags to be appended to the java launching the compiler
|
||||
# DISABLED_WARNINGS list of Xlint warnings that should be disabled
|
||||
# SRC one or more directories to search for sources. The order of the source roots
|
||||
# is significant. The first found file of a certain name has priority.
|
||||
# BIN store classes here
|
||||
# MODULE Name of module being compiled. If set, classes are put in BIN/MODULE.
|
||||
# CLASSPATH a list of additional entries to set as classpath to javac
|
||||
# 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.
|
||||
# COPY_FILES myapp/foo/setting.txt means copy this file over to the package myapp/foo
|
||||
# CLEAN .properties means copy and clean all properties file to the corresponding package in BIN.
|
||||
# CLEAN_FILES myapp/foo/setting.txt means clean this file over to the package myapp/foo
|
||||
# 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.
|
||||
# EXCLUDE_PATTERNS Exclude files matching any of these substrings
|
||||
# EXTRA_FILES List of extra source files to include in compilation. Can be used to
|
||||
# specify files that need to be generated by other rules first.
|
||||
# HEADERS path to directory where all generated c-headers are written.
|
||||
# DEPENDS Extra dependency
|
||||
# KEEP_DUPS Do not remove duplicate file names from different source roots.
|
||||
# FAIL_NO_SRC Set to false to not fail the build if no source files are found,
|
||||
# default is true.
|
||||
# CREATE_API_DIGEST Set to true to use a javac plugin to generate a public API
|
||||
# hash which can be used for down stream dependencies to only rebuild
|
||||
# when the API changes.
|
||||
# KEEP_ALL_TRANSLATIONS Set to true to skip translation filtering
|
||||
SetupJavaCompilation = $(NamedParamsMacroTemplate)
|
||||
define SetupJavaCompilationBody
|
||||
|
||||
# Verify arguments
|
||||
ifeq ($$($1_BIN), )
|
||||
$$(error Must specify BIN (in $1))
|
||||
endif
|
||||
|
||||
ifneq ($$($1_MODULE), )
|
||||
$1_MODULE_SUBDIR := /$$($1_MODULE)
|
||||
endif
|
||||
|
||||
$1_SAFE_NAME := $$(strip $$(subst /,_, $1))
|
||||
|
||||
ifeq ($$($1_LOG_ACTION), )
|
||||
$1_LOG_ACTION := Compiling
|
||||
endif
|
||||
|
||||
ifeq ($$($1_SMALL_JAVA), )
|
||||
# If unspecified, default to true
|
||||
$1_SMALL_JAVA := true
|
||||
endif
|
||||
|
||||
ifeq ($$($1_COMPILER), )
|
||||
# If unspecified, default to interim compiler
|
||||
$1_COMPILER := interim
|
||||
endif
|
||||
|
||||
ifeq ($$($1_COMPILER), bootjdk)
|
||||
# Javac server is not available when using the bootjdk compiler.
|
||||
$1_JAVAC_CMD := $$(JAVAC) -J$$(JAVA_FLAGS_TMPDIR)
|
||||
|
||||
ifeq ($$($1_SMALL_JAVA), true)
|
||||
$1_FLAGS += $$(addprefix -J, $$(JAVA_FLAGS_SMALL))
|
||||
endif
|
||||
ifeq ($$($1_JAVA_FLAGS), true)
|
||||
$1_FLAGS += $$(addprefix -J, $$($1_JAVA_FLAGS))
|
||||
endif
|
||||
|
||||
ifeq ($$($1_TARGET_RELEASE), )
|
||||
# If unspecified, default to the new jdk we're building
|
||||
$1_TARGET_RELEASE := $$(TARGET_RELEASE_BOOTJDK)
|
||||
endif
|
||||
else ifeq ($$($1_COMPILER), buildjdk)
|
||||
$1_JAVAC_CMD := $$(BUILD_JAVAC) -J$$(JAVA_FLAGS_TMPDIR)
|
||||
|
||||
ifeq ($$($1_TARGET_RELEASE), )
|
||||
# If unspecified, default to the new jdk we're building
|
||||
$1_TARGET_RELEASE := $$(TARGET_RELEASE_NEWJDK)
|
||||
endif
|
||||
else ifeq ($$($1_COMPILER), interim)
|
||||
# Use java server if it is enabled, and the user does not want a specialized
|
||||
# class path.
|
||||
ifeq ($$(ENABLE_JAVAC_SERVER)+$$($1_CLASSPATH), true+)
|
||||
# Create a configuration file with the needed information for the javac
|
||||
# server to function properly.
|
||||
$1_JAVAC_SERVER_CONFIG := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)-javacserver.conf
|
||||
|
||||
# Arguments needed to launch the javacserver client, as well as for the
|
||||
# client to launch the server.
|
||||
$1_JAVAC_SERVER_ARGS := $$(INTERIM_LANGTOOLS_ARGS) \
|
||||
-cp $(BUILDTOOLS_OUTPUTDIR)/langtools_javacserver_classes
|
||||
|
||||
# The portfile contains the tcp/ip on which the server listens
|
||||
# and the cookie necessary to talk to the server.
|
||||
$1_JAVAC_PORT_FILE := $$(call FixPath, $$(JAVAC_SERVER_DIR)/server.port)
|
||||
|
||||
# The javacmd tells the client how to run java to launch the server.
|
||||
$1_JAVAC_SERVER_JAVA_CMD := $$(call FixPath, $$(JAVA) $$($1_JAVA_FLAGS) \
|
||||
$$($1_JAVAC_SERVER_ARGS))
|
||||
|
||||
$1_CONFIG_VARDEPS := $$($1_JAVAC_PORT_FILE) $$($1_JAVAC_SERVER_JAVA_CMD)
|
||||
$1_CONFIG_VARDEPS_FILE := $$(call DependOnVariable, $1_CONFIG_VARDEPS, \
|
||||
$$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.config_vardeps)
|
||||
|
||||
# Write these values to a config file
|
||||
$$($1_JAVAC_SERVER_CONFIG): $$($1_CONFIG_VARDEPS_FILE)
|
||||
$(ECHO) portfile=$$($1_JAVAC_PORT_FILE) > $$@
|
||||
$(ECHO) javacmd=$$($1_JAVAC_SERVER_JAVA_CMD) >> $$@
|
||||
|
||||
# Always use small java to launch client
|
||||
$1_JAVAC_CMD := $$(JAVA_SMALL) $$($1_JAVA_FLAGS) $$($1_JAVAC_SERVER_ARGS) \
|
||||
javacserver.Main --conf=$$($1_JAVAC_SERVER_CONFIG)
|
||||
else
|
||||
# No javac server
|
||||
$1_JAVAC := $$(INTERIM_LANGTOOLS_ARGS) -m jdk.compiler.interim/com.sun.tools.javac.Main
|
||||
|
||||
ifeq ($$($1_SMALL_JAVA), true)
|
||||
$1_JAVAC_CMD := $$(JAVA_SMALL) $$($1_JAVA_FLAGS) $$($1_JAVAC)
|
||||
else
|
||||
$1_JAVAC_CMD := $$(JAVA) $$($1_JAVA_FLAGS) $$($1_JAVAC)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($$($1_TARGET_RELEASE), )
|
||||
# If unspecified, default to the new jdk we're building
|
||||
$1_TARGET_RELEASE := $$(TARGET_RELEASE_NEWJDK)
|
||||
endif
|
||||
else
|
||||
$$(error Invalid value for COMPILER in SetupJavaCompilation for $1: '$$($1_COMPILER)')
|
||||
endif
|
||||
|
||||
# Tell javac to do exactly as told and no more
|
||||
PARANOIA_FLAGS := -implicit:none -Xprefer:source -XDignore.symbol.file=true
|
||||
|
||||
$1_FLAGS += -g -Xlint:all $$($1_TARGET_RELEASE) $$(PARANOIA_FLAGS)
|
||||
$1_FLAGS += $$($1_JAVAC_FLAGS)
|
||||
# Set character encoding in source
|
||||
$1_FLAGS += -encoding utf-8
|
||||
|
||||
ifeq ($$(JAVA_WARNINGS_AS_ERRORS), true)
|
||||
$1_FLAGS += -Werror
|
||||
endif
|
||||
|
||||
ifneq ($$($1_DISABLED_WARNINGS), )
|
||||
$1_FLAGS += -Xlint:$$(call CommaList, $$(addprefix -, $$($1_DISABLED_WARNINGS)))
|
||||
endif
|
||||
|
||||
$1_AUGMENTED_CLASSPATH := $$($1_CLASSPATH)
|
||||
$1_API_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi
|
||||
$1_API_INTERNAL := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_internalapi
|
||||
|
||||
ifeq ($$($1_CREATE_API_DIGEST), true)
|
||||
$1_API_DIGEST_FLAGS := \
|
||||
-Xplugin:"depend $$($1_API_TARGET)" \
|
||||
"-XDinternalAPIPath=$$($1_API_INTERNAL)" \
|
||||
"-XDLOG_LEVEL=$(LOG_LEVEL)" \
|
||||
#
|
||||
|
||||
$1_EXTRA_DEPS := $$(BUILDTOOLS_OUTPUTDIR)/depend/_the.COMPILE_DEPEND_batch
|
||||
# including the compilation output on the classpath, so that incremental
|
||||
# compilations in unnamed module can refer to other classes from the same
|
||||
# source root, which are not being recompiled in this compilation:
|
||||
$1_AUGMENTED_CLASSPATH += $$(BUILDTOOLS_OUTPUTDIR)/depend $$($1_BIN)
|
||||
endif
|
||||
|
||||
ifneq ($$($1_AUGMENTED_CLASSPATH), )
|
||||
$1_FLAGS += -cp $$(call PathList, $$($1_AUGMENTED_CLASSPATH))
|
||||
endif
|
||||
|
||||
# Make sure the dirs exist, or that one of the EXTRA_FILES, that may not
|
||||
# exist yet, is in it.
|
||||
$$(foreach d, $$($1_SRC), \
|
||||
$$(if $$(wildcard $$d), , \
|
||||
$$(if $$(filter $$d%, $$($1_EXTRA_FILES)), , \
|
||||
$$(error SRC specified to SetupJavaCompilation $1 contains missing directory >$$d<) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
$$(call MakeDir, $$($1_BIN))
|
||||
# Order src files according to the order of the src dirs. Correct ordering is
|
||||
# needed for correct overriding between different source roots.
|
||||
$1_ALL_SRC_RAW := $$(call FindFiles, $$($1_SRC))
|
||||
$1_ALL_SRCS := $$($1_EXTRA_FILES) \
|
||||
$$(foreach d, $$($1_SRC), $$(filter $$d%, $$($1_ALL_SRC_RAW)))
|
||||
|
||||
# Extract the java files.
|
||||
$1_SRCS := $$(filter %.java, $$($1_ALL_SRCS))
|
||||
|
||||
# Translate include/exclude into patterns
|
||||
ifneq ($$($1_EXCLUDE_FILES), )
|
||||
$1_EXCLUDE_PATTERN := $$(addprefix %, $$($1_EXCLUDE_FILES))
|
||||
endif
|
||||
ifneq ($$($1_INCLUDE_FILES), )
|
||||
$1_INCLUDE_PATTERN := $$(foreach i, $$($1_SRC), $$(addprefix $$i/, $$($1_INCLUDE_FILES)))
|
||||
endif
|
||||
ifneq ($$($1_EXCLUDES), )
|
||||
$1_EXCLUDE_PATTERN += $$(foreach i, $$($1_SRC), $$(addprefix $$i/, $$(addsuffix /%, $$($1_EXCLUDES))))
|
||||
endif
|
||||
ifneq ($$($1_INCLUDES), )
|
||||
$1_INCLUDE_PATTERN += $$(foreach i, $$($1_SRC), $$(addprefix $$i/, $$(addsuffix /%, $$($1_INCLUDES))))
|
||||
endif
|
||||
|
||||
ifneq ($$($1_EXCLUDE_PATTERNS), )
|
||||
# We must not match the exclude pattern against the src roots, so first
|
||||
# strip the src prefixes from the absolute file paths in SRCS.
|
||||
$1_SRCS_WITHOUT_ROOTS := $$(foreach i, $$($1_SRC), \
|
||||
$$(patsubst $$i/%,%, $$(filter $$i/%, $$($1_SRCS))))
|
||||
$1_EXCLUDE_PATTERNS_WITHOUT_ROOTS := $$(call containing, \
|
||||
$$($1_EXCLUDE_PATTERNS), $$($1_SRCS_WITHOUT_ROOTS))
|
||||
# The add back all possible src prefixes; this will generate more paths
|
||||
# than really exists, but it does not matter since we will use this as
|
||||
# input to filter-out.
|
||||
$1_EXCLUDE_PATTERN += $$(foreach i, $$($1_SRC), $$(addprefix $$i/, \
|
||||
$$($1_EXCLUDE_PATTERNS_WITHOUT_ROOTS)))
|
||||
endif
|
||||
|
||||
# Apply include/exclude patterns to java sources
|
||||
ifneq ($$($1_EXCLUDE_PATTERN), )
|
||||
$1_SRCS := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_SRCS))
|
||||
endif
|
||||
ifneq ($$($1_INCLUDE_PATTERN), )
|
||||
$1_SRCS := $$(filter $$($1_INCLUDE_PATTERN) $$($1_EXTRA_FILES), $$($1_SRCS))
|
||||
endif
|
||||
|
||||
ifneq ($$($1_KEEP_DUPS), true)
|
||||
# Remove duplicate source files by keeping the first found of each duplicate.
|
||||
# This allows for automatic overrides with custom or platform specific versions
|
||||
# source files. Need to call DoubleDollar as we have java classes with '$' in
|
||||
# their names.
|
||||
$1_SRCS := $$(strip $$(foreach s, $$($1_SRCS), \
|
||||
$$(eval relative_src := $$(call remove-prefixes, $$($1_SRC), \
|
||||
$$(call DoubleDollar, $$(s)))) \
|
||||
$$(if $$($1_$$(relative_src)), \
|
||||
, \
|
||||
$$(eval $1_$$(relative_src) := 1) $$(s))))
|
||||
endif
|
||||
|
||||
# Filter out any excluded translations
|
||||
ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
|
||||
$1_SRCS := $$(call FilterExcludedTranslations, $$($1_SRCS), .java)
|
||||
endif
|
||||
|
||||
ifeq ($$(strip $$($1_SRCS)), )
|
||||
ifneq ($$($1_FAIL_NO_SRC), false)
|
||||
$$(error No source files found for $1)
|
||||
endif
|
||||
else
|
||||
# All files below META-INF are always copied.
|
||||
$1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%, $$($1_SRC)), $$($1_ALL_SRCS))
|
||||
# Find all files to be copied from source to bin.
|
||||
ifneq ($$($1_COPY)$$($1_COPY_FILES), )
|
||||
# Search for all files to be copied.
|
||||
$1_ALL_COPIES += $$(filter $$(addprefix %, $$($1_COPY)), $$($1_ALL_SRCS))
|
||||
# Copy these explicitly
|
||||
$1_ALL_COPIES += $$($1_COPY_FILES)
|
||||
endif
|
||||
# Copy must also respect filters.
|
||||
ifneq ($$($1_INCLUDE_PATTERN), )
|
||||
$1_ALL_COPIES := $$(filter $$($1_INCLUDE_PATTERN), $$($1_ALL_COPIES))
|
||||
endif
|
||||
ifneq ($$($1_EXCLUDE_PATTERN), )
|
||||
$1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_ALL_COPIES))
|
||||
endif
|
||||
# Filter out any excluded translations
|
||||
ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
|
||||
$1_ALL_COPIES := $$(call FilterExcludedTranslations, $$($1_ALL_COPIES), .properties)
|
||||
endif
|
||||
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
|
||||
|
||||
# Find all property files to be copied and cleaned from source to bin.
|
||||
ifneq ($$($1_CLEAN)$$($1_CLEAN_FILES), )
|
||||
# Search for all files to be copied.
|
||||
$1_ALL_CLEANS := $$(filter $$(addprefix %, $$($1_CLEAN)), $$($1_ALL_SRCS))
|
||||
# Clean these explicitly
|
||||
$1_ALL_CLEANS += $$($1_CLEAN_FILES)
|
||||
# Copy and clean must also respect filters.
|
||||
ifneq ($$($1_INCLUDE_PATTERN), )
|
||||
$1_ALL_CLEANS := $$(filter $$($1_INCLUDE_PATTERN), $$($1_ALL_CLEANS))
|
||||
endif
|
||||
ifneq ($$($1_EXCLUDE_PATTERN), )
|
||||
$1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_ALL_CLEANS))
|
||||
endif
|
||||
# Filter out any excluded translations
|
||||
ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
|
||||
$1_ALL_CLEANS := $$(call FilterExcludedTranslations, $$($1_ALL_CLEANS), .properties)
|
||||
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_clean,$1,$$i)))
|
||||
# Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
|
||||
endif
|
||||
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'
|
||||
|
||||
$1_COMPILE_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch
|
||||
$1_FILELIST := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch.filelist
|
||||
$1_MODFILELIST := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch.modfiles
|
||||
$1_MODFILELIST_FIXED := $$($1_MODFILELIST).fixed
|
||||
|
||||
# Put headers in a temp dir to filter out those that actually
|
||||
# changed before copying them to the real header dir.
|
||||
ifneq ($$($1_HEADERS), )
|
||||
$1_HEADERS_ARG := -h $$($1_HEADERS).$1.tmp
|
||||
|
||||
$$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET)
|
||||
$$(call MakeTargetDir)
|
||||
if [ -d "$$($1_HEADERS).$1.tmp" ]; then \
|
||||
for f in `$(CD) $$($1_HEADERS).$1.tmp && $(FIND) . -type f`; do \
|
||||
if [ ! -f "$$($1_HEADERS)/$$$$f" ] \
|
||||
|| [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).$1.tmp/$$$$f`" != "" ]; then \
|
||||
$(MKDIR) -p `$(DIRNAME) $$($1_HEADERS)/$$$$f`; \
|
||||
$(CP) -f $$($1_HEADERS).$1.tmp/$$$$f $$($1_HEADERS)/$$$$f; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
$(RM) -r $$($1_HEADERS).$1.tmp
|
||||
$(TOUCH) $$@
|
||||
|
||||
$1_HEADER_TARGETS := $$($1_HEADERS)/_the.$1_headers
|
||||
endif
|
||||
|
||||
$1_VARDEPS := $$($1_JAVAC_CMD) $$($1_FLAGS) $$($1_BIN) \
|
||||
$$($1_HEADERS_ARG) $$($1_EXCLUDES) $$($1_INCLUDES) \
|
||||
$$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
|
||||
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
|
||||
$$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
|
||||
|
||||
# Create a file with all sources, to pass to javac in an @file.
|
||||
# $$($1_VARDEPS_FILE) is used as dependency to track changes in set of
|
||||
# list of files.
|
||||
$$($1_FILELIST): $$($1_SRCS) $$($1_VARDEPS_FILE)
|
||||
$$(call MakeDir, $$(@D))
|
||||
$$(call LogWarn, $$($1_LOG_ACTION) up to $$(words $$($1_SRCS)) files for $1)
|
||||
$$(eval $$(call ListPathsSafely, $1_SRCS, $$($1_FILELIST)))
|
||||
|
||||
# Create a $$($1_MODFILELIST) file with significant modified dependencies
|
||||
# (either sources files or the other mark dependencies).
|
||||
# It is then sent using a side-channel
|
||||
# to the custom Depend plugin. The Depend plugin will check the provided list
|
||||
# of modified files, and if none of the Java source files is changed in a way
|
||||
# observable from outside of the file, and the list of modified files does
|
||||
# not include a non-Java source file, it will only compile the modified files.
|
||||
# Otherwise, all module's sources will be compiled. If a non-Java file is included,
|
||||
# it will be considered to be a significant change, and all module source will
|
||||
# be recompiled
|
||||
$$($1_MODFILELIST): $$($1_SRCS) $$($1_DEPENDS) \
|
||||
$$($1_VARDEPS_FILE) $$($1_EXTRA_DEPS) $$($1_JAVAC_SERVER_CONFIG)
|
||||
$$(eval $1_MODFILES := $$?)
|
||||
$$(eval $$(call ListPathsSafely, $1_MODFILES, $$($1_MODFILELIST)))
|
||||
|
||||
# Convert the paths in the MODFILELIST file to Windows-style paths
|
||||
# on Windows. This is needed because javac operates on Windows-style paths
|
||||
# when running on Windows. On other platforms this just copies the MODFILELIST file.
|
||||
$$($1_MODFILELIST_FIXED): $$($1_MODFILELIST)
|
||||
$$(call FixPathFile, $$($1_MODFILELIST), $$($1_MODFILELIST_FIXED))
|
||||
|
||||
# Do the actual compilation
|
||||
$$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_FILELIST) $$($1_DEPENDS) \
|
||||
$$($1_VARDEPS_FILE) $$($1_EXTRA_DEPS) $$($1_JAVAC_SERVER_CONFIG) \
|
||||
$$($1_MODFILELIST_FIXED)
|
||||
$$(call MakeDir, $$(@D))
|
||||
$$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
|
||||
$$($1_JAVAC_CMD) $$($1_FLAGS) \
|
||||
$$($1_API_DIGEST_FLAGS) \
|
||||
-XDmodifiedInputs=$$($1_MODFILELIST_FIXED) \
|
||||
-d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_FILELIST)) && \
|
||||
$(TOUCH) $$@
|
||||
|
||||
# Add all targets to main variable
|
||||
$1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_COMPILE_TARGET) \
|
||||
$$($1_HEADER_TARGETS)
|
||||
|
||||
# Check if a jar file was specified, then setup the rules for the jar.
|
||||
ifneq ($$($1_JAR), )
|
||||
# If no suffixes was explicitly set for this jar file.
|
||||
# Use class and the cleaned/copied properties file suffixes as the default
|
||||
# for the types of files to be put into the jar.
|
||||
ifeq ($$($1_SUFFIXES), )
|
||||
$1_SUFFIXES := .class $$($1_CLEAN) $$($1_COPY)
|
||||
endif
|
||||
|
||||
$$(eval $$(call SetupJarArchive, ARCHIVE_$1, \
|
||||
DEPENDENCIES := $$($1), \
|
||||
SRCS := $$($1_BIN)$$($1_MODULE_SUBDIR), \
|
||||
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), \
|
||||
JARINDEX := $$($1_JARINDEX), \
|
||||
HEADERS := $$($1_HEADERS), \
|
||||
))
|
||||
|
||||
# Add jar to target list
|
||||
$1 += $$($1_JAR)
|
||||
endif
|
||||
endif # Source files found
|
||||
endef
|
||||
|
||||
# Use this macro to find the correct target to depend on when the original
|
||||
# SetupJavaCompilation is declared in a different makefile, to avoid having
|
||||
# to declare and evaluate it again.
|
||||
# param 1 is for example BUILD_MYPACKAGE
|
||||
# param 2 is the output directory (BIN)
|
||||
SetupJavaCompilationCompileTarget = \
|
||||
$(strip $2)/_the.$(strip $1)_batch
|
||||
|
||||
SetupJavaCompilationApiTarget = \
|
||||
$(strip $2)/_the.$(strip $1)_pubapi
|
||||
|
||||
################################################################################
|
||||
|
||||
endif # include guard
|
||||
include MakeIncludeEnd.gmk
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue