Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configure option '--with-openssl=fetched' on Windows #543

Merged
merged 1 commit into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 50 additions & 37 deletions closed/openssl.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2018, 2019 All Rights Reserved
# (c) Copyright IBM Corp. 2018, 2022 All Rights Reserved
# ===========================================================================
# 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
Expand All @@ -18,50 +18,63 @@
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
# ===========================================================================

# spec.gmk is generated by configure and contains many of the variable definitions used in this makefile
# spec.gmk is generated by configure and contains definitions used in this makefile

ifeq (,$(wildcard $(SPEC)))
$(error OpenSSL.gmk needs SPEC set to a proper spec.gmk)
endif

include $(SPEC)

# config command guess the operating system and Configure openssl accordignly.
# However, on some platforms (like AIX, Windows) it is essential to configure
# with one of the platform list provided by command ./Configure LIST command
# For AIX PPC64, it is aix64-cc
# For Linux ppc64le, it is linux-ppc64le
# For Linux s390x, it is linux64-s390x
# For Linux x64, it is linux-x86_64
# For Mac OSX, it is darwin64-x86_64-cc
# For Windows x64, it is VC-WIN64A
# For Windows x32, it is VC-WIN32
build_openssl:
ifeq ($(BUILD_OPENSSL), yes)
$(ECHO) Compiling OpenSSL in $(OPENSSL_DIR)
ifeq ($(OPENJDK_TARGET_OS), linux)
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
($(CD) $(OPENSSL_DIR) && ./Configure linux-x86_64 shared && $(MAKE))
else ifeq ($(OPENJDK_TARGET_CPU), s390x)
($(CD) $(OPENSSL_DIR) && ./Configure linux64-s390x shared && $(MAKE))
else ifeq ($(OPENJDK_TARGET_CPU), ppc64le)
($(CD) $(OPENSSL_DIR) && ./Configure linux-ppc64le shared && $(MAKE))
else
($(CD) $(OPENSSL_DIR) && ./config shared && $(MAKE))
endif
else ifeq ($(OPENJDK_TARGET_OS), macosx)
($(CD) $(OPENSSL_DIR) && ./Configure darwin64-x86_64-cc shared && $(MAKE))
else ifeq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
($(CD) $(OPENSSL_DIR) && ./Configure VC-WIN64A shared && $(MAKE))
else
($(CD) $(OPENSSL_DIR) && ./Configure VC-WIN32 shared && $(MAKE))
endif
else ifeq ($(OPENJDK_TARGET_OS), aix)
($(CD) $(OPENSSL_DIR) && ./Configure aix64-cc shared && $(MAKE))
ifeq ($(OPENJDK_TARGET_OS), windows)
# Special setup required for Windows:
# - OpenSSL generates an nmake-style makefile so we must use nmake
OPENSSL_MAKE := nmake
# - CONFIGURE_INSIST bypasses the requirement that perl use Windows-style paths (with backslashes)
# - LIB cannot have the surrounding double-quotes provided by custom-spec.gmk
# - PERL must be a Windows-style path that will be usable by nmake
# - MAKEFLAGS uses unix-style options (with a dash) which won't be understood by nmake
OPENSSL_SETUP := export \
CONFIGURE_INSIST=true \
LIB='$(subst ",,$(LIB))' \
PERL='$(shell $(CYGPATH) -m $(PERL))' \
&& unset MAKEFLAGS \
&&
else
OPENSSL_MAKE := $(MAKE)
OPENSSL_SETUP :=
endif

# Identify the desired openssl target configuration.
OPENSSL_TARGET :=
ifeq ($(OPENJDK_TARGET_OS), aix)
OPENSSL_TARGET := aix64-cc
else ifeq ($(OPENJDK_TARGET_OS), linux)
ifneq (,$(filter aarch64 ppc64le x86_64, $(OPENJDK_TARGET_CPU)))
OPENSSL_TARGET := linux-$(OPENJDK_TARGET_CPU)
else ifneq (,$(filter riscv64 s390x, $(OPENJDK_TARGET_CPU)))
OPENSSL_TARGET := linux64-$(OPENJDK_TARGET_CPU)
endif
else ifeq ($(OPENJDK_TARGET_OS), macosx)
ifneq (,$(filter arm64 x86_64, $(OPENJDK_TARGET_CPU)))
OPENSSL_TARGET := darwin64-$(OPENJDK_TARGET_CPU)-cc
endif
else ifeq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
OPENSSL_TARGET := VC-WIN64A
else
($(CD) $(OPENSSL_DIR) && ./config shared && $(MAKE))
OPENSSL_TARGET := VC-WIN32
endif
endif
endif # OPENJDK_TARGET_OS

ifeq (,$(OPENSSL_TARGET))
$(error Unsupported platform $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU))
endif # OPENSSL_TARGET

build_openssl :
ifeq ($(BUILD_OPENSSL), yes)
@$(ECHO) Compiling OpenSSL in $(OPENSSL_DIR) for $(OPENSSL_TARGET)
( $(OPENSSL_SETUP) $(CD) $(OPENSSL_DIR) && ./Configure $(OPENSSL_TARGET) shared && $(OPENSSL_MAKE) )
endif # BUILD_OPENSSL

.PHONY : build_openssl
2 changes: 1 addition & 1 deletion common/autoconf/generated-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4430,7 +4430,7 @@ VS_SDK_PLATFORM_NAME_2017=
#CUSTOM_AUTOCONF_INCLUDE

# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1635449047
DATE_WHEN_GENERATED=1642694809

###############################################################################
#
Expand Down
15 changes: 5 additions & 10 deletions jdk/make/closed/autoconf/custom-hook.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2017, 2021 All Rights Reserved
# (c) Copyright IBM Corp. 2017, 2022 All Rights Reserved
# ===========================================================================
# 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
Expand Down Expand Up @@ -494,7 +494,6 @@ AC_DEFUN([OPENJ9_CHECK_NASM_VERSION],
[NASM_VERSION=`$NASM -v | $SED -e 's/^.* \([2-9]\.[0-9][0-9]\.[0-9][0-9]\).*$/\1/'`]
AC_MSG_ERROR([nasm version detected: $NASM_VERSION; required version 2.11+])
fi
AC_SUBST([NASM])
fi
])

Expand Down Expand Up @@ -597,10 +596,10 @@ AC_DEFUN_ONCE([CUSTOM_LATE_HOOK],

if test "x$OPENJDK_BUILD_OS" = xwindows ; then
OPENJ9_TOOL_DIR="$OUTPUT_ROOT/tools"
AC_SUBST([OPENJ9_TOOL_DIR])
AC_SUBST(OPENJ9_TOOL_DIR)
OPENJ9_GENERATE_TOOL_WRAPPERS
fi
AC_SUBST([SYSROOT])
AC_SUBST(SYSROOT)
AC_CONFIG_FILES([$OUTPUT_ROOT/toolchain.cmake:$CLOSED_AUTOCONF_DIR/toolchain.cmake.in])
])

Expand Down Expand Up @@ -656,12 +655,6 @@ AC_DEFUN([CONFIGURE_OPENSSL],

# Process --with-openssl=fetched
if test "x$with_openssl" = xfetched ; then
if test "x$OPENJDK_BUILD_OS" = xwindows ; then
AC_MSG_RESULT([no])
printf "On Windows, value of \"fetched\" is currently not supported with --with-openssl. Please build OpenSSL using VisualStudio outside cygwin and specify the path with --with-openssl\n"
AC_MSG_ERROR([Cannot continue])
fi

if test -d "$SRC_ROOT/openssl" ; then
OPENSSL_DIR="$SRC_ROOT/openssl"
OPENSSL_CFLAGS="-I${OPENSSL_DIR}/include"
Expand All @@ -675,6 +668,8 @@ AC_DEFUN([CONFIGURE_OPENSSL],
OPENSSL_BUNDLE_LIB_PATH="$OPENSSL_DIR"
fi
AC_MSG_RESULT([yes])
# perl is required to build openssl
BASIC_REQUIRE_PROGS(PERL, perl)
else
AC_MSG_RESULT([no])
printf "$SRC_ROOT/openssl is not found.\n"
Expand Down
25 changes: 10 additions & 15 deletions jdk/make/closed/autoconf/custom-spec.gmk.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2017, 2021 All Rights Reserved
# (c) Copyright IBM Corp. 2017, 2022 All Rights Reserved
# ===========================================================================
# 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
Expand Down Expand Up @@ -47,24 +47,19 @@ endif
HEALTHCENTER_JAR := @HEALTHCENTER_JAR@

# OpenSSL
OPENSSL_DIR := @OPENSSL_DIR@
BUILD_OPENSSL := @BUILD_OPENSSL@
OPENSSL_CFLAGS := @OPENSSL_CFLAGS@
OPENSSL_BUNDLE_LIB_PATH := @OPENSSL_BUNDLE_LIB_PATH@
OPENSSL_CFLAGS := @OPENSSL_CFLAGS@
OPENSSL_DIR := @OPENSSL_DIR@
PERL := @PERL@
WITH_OPENSSL := @WITH_OPENSSL@

# DDR
OPENJ9_ENABLE_DDR := @OPENJ9_ENABLE_DDR@

OPENJ9_ENABLE_DEMOS := @OPENJ9_ENABLE_DEMOS@

# JITSERVER
OPENJ9_ENABLE_JITSERVER := @OPENJ9_ENABLE_JITSERVER@

# CRIU Support
OPENJ9_ENABLE_CRIU_SUPPORT := @OPENJ9_ENABLE_CRIU_SUPPORT@

# OpenJDK MethodHandles
# feature enablement flags
OPENJ9_ENABLE_CRIU_SUPPORT := @OPENJ9_ENABLE_CRIU_SUPPORT@
OPENJ9_ENABLE_DDR := @OPENJ9_ENABLE_DDR@
OPENJ9_ENABLE_DEMOS := @OPENJ9_ENABLE_DEMOS@
OPENJ9_ENABLE_INLINE_TYPES := @OPENJ9_ENABLE_INLINE_TYPES@
OPENJ9_ENABLE_JITSERVER := @OPENJ9_ENABLE_JITSERVER@
OPENJ9_ENABLE_OPENJDK_METHODHANDLES := @OPENJ9_ENABLE_OPENJDK_METHODHANDLES@

# for constructing version output
Expand Down
Loading