Skip to content

Commit

Permalink
Merge pull request #471 from keithc-ca/openssl
Browse files Browse the repository at this point in the history
Support configure option '--with-openssl=fetched' on Windows
  • Loading branch information
pshipton committed Jan 24, 2022
2 parents 52406d9 + 0dd49d5 commit 370a460
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 62 deletions.
14 changes: 5 additions & 9 deletions closed/autoconf/custom-hook.m4
@@ -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 @@ -534,7 +534,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 @@ -599,10 +598,10 @@ AC_DEFUN_ONCE([CUSTOM_LATE_HOOK],
if test "x$OPENJDK_BUILD_OS" = xwindows ; then
OPENJ9_TOOL_DIR="$OUTPUTDIR/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([$OUTPUTDIR/toolchain.cmake:$CLOSED_AUTOCONF_DIR/toolchain.cmake.in])
])

Expand All @@ -626,11 +625,6 @@ AC_DEFUN([CONFIGURE_OPENSSL],
fi
# 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 "$TOPDIR/openssl" ; then
OPENSSL_DIR="$TOPDIR/openssl"
OPENSSL_CFLAGS="-I${OPENSSL_DIR}/include"
Expand All @@ -643,6 +637,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 "$TOPDIR/openssl is not found.\n"
Expand Down
20 changes: 7 additions & 13 deletions closed/autoconf/custom-spec.gmk.in
@@ -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 @@ -54,18 +54,11 @@ ifneq (,@OPENJ9_GDK_HOME@)
export GDK_HOME := @OPENJ9_GDK_HOME@
endif

# 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_JITSERVER := @OPENJ9_ENABLE_JITSERVER@
OPENJ9_ENABLE_OPENJDK_METHODHANDLES := @OPENJ9_ENABLE_OPENJDK_METHODHANDLES@

# for constructing version output
Expand Down Expand Up @@ -141,6 +134,7 @@ BUILD_OPENSSL := @BUILD_OPENSSL@
OPENSSL_BUNDLE_LIB_PATH := @OPENSSL_BUNDLE_LIB_PATH@
OPENSSL_CFLAGS := @OPENSSL_CFLAGS@
OPENSSL_DIR := @OPENSSL_DIR@
PERL := @PERL@
WITH_OPENSSL := @WITH_OPENSSL@

# Use '=' instead of ':=' because bootcycle-spec.gmk overrides OUTPUTDIR.
Expand Down
90 changes: 50 additions & 40 deletions closed/openssl.gmk
@@ -1,5 +1,5 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2018, 2021 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,53 +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 Windows x64, it is VC-WIN64A
# For Windows x32, it is VC-WIN32
# For Mac OSX x64, it is darwin64-x86_64-cc
# For Mac OSX aarch64, it is darwin64-arm64-cc
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
OPENSSL_TARGET := VC-WIN32
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)
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)
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
($(CD) $(OPENSSL_DIR) && ./Configure darwin64-x86_64-cc shared && $(MAKE))
else
($(CD) $(OPENSSL_DIR) && ./Configure darwin64-arm64-cc shared && $(MAKE))
endif
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))
endif
endif
@$(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

0 comments on commit 370a460

Please sign in to comment.