From 8a98fd717cefbdada7df506e81e14e5559ec0fe0 Mon Sep 17 00:00:00 2001 From: Annabelle Huo Date: Thu, 16 May 2019 14:46:56 -0700 Subject: [PATCH] Add OpenSSL related settings to CUSTOM_COMPILER_ENV_VARS - Add `OPENSSL_DIR`, `OPENSSL_CFLAGS`, `OPENSSL_LIBS`, and `OPENSSL_BUNDLE_LIB_PATH` to `CUSTOM_COMPILER_ENV_VARS`. - Bundle libssl if `--with-openssl=fetched --enable-openssl-bundling` is set. It is required by JITaaS. Issue eclipse/openj9#5720 Signed-off-by: Annabelle Huo --- closed/OpenJ9.gmk | 15 +++++++++++++++ jdk/make/CopyFiles.gmk | 20 ++++++++++++++++++++ jdk/make/closed/autoconf/custom-hook.m4 | 1 + jdk/make/closed/autoconf/custom-spec.gmk.in | 1 + 4 files changed, 37 insertions(+) diff --git a/closed/OpenJ9.gmk b/closed/OpenJ9.gmk index 62cb10e2ac0..18db085d1fd 100644 --- a/closed/OpenJ9.gmk +++ b/closed/OpenJ9.gmk @@ -408,6 +408,21 @@ endif ifneq (,$(OPENJ9_DEVELOPER_DIR)) CUSTOM_COMPILER_ENV_VARS += DEVELOPER_DIR="$(OPENJ9_DEVELOPER_DIR)" endif +ifneq (,$(OPENSSL_CFLAGS)) + CUSTOM_COMPILER_ENV_VARS += OPENSSL_CFLAGS="$(OPENSSL_CFLAGS)" + + ifneq (,$(OPENSSL_DIR)) + CUSTOM_COMPILER_ENV_VARS += OPENSSL_DIR="$(OPENSSL_DIR)" + endif + + ifneq (,$(OPENSSL_LIBS)) + CUSTOM_COMPILER_ENV_VARS += OPENSSL_LIBS="$(OPENSSL_LIBS)" + endif + + ifneq (,$(OPENSSL_BUNDLE_LIB_PATH)) + CUSTOM_COMPILER_ENV_VARS += OPENSSL_BUNDLE_LIB_PATH="$(OPENSSL_BUNDLE_LIB_PATH)" + endif +endif generate-j9-version-headers : @$(ECHO) Ensuring version information is up-to-date diff --git a/jdk/make/CopyFiles.gmk b/jdk/make/CopyFiles.gmk index a9eeae00e37..fc06fda732f 100644 --- a/jdk/make/CopyFiles.gmk +++ b/jdk/make/CopyFiles.gmk @@ -323,6 +323,26 @@ ifneq ($(OPENSSL_BUNDLE_LIB_PATH), ) COPY_FILES += $(OPENSSL_TARGET_LIB) endif + +# To bundle first search for libssl 1.1.x library, if not found, search for 1.0.x + ifeq ($(OPENJDK_TARGET_OS), linux) + OPENSSL_SSL_LIB_NAME = libssl.so.1.1 + ifeq ("$(wildcard $(OPENSSL_BUNDLE_LIB_PATH)/$(OPENSSL_SSL_LIB_NAME))", "") + OPENSSL_SSL_LIB_NAME = libssl.so.1.0.0 + ifeq ("$(wildcard $(OPENSSL_BUNDLE_LIB_PATH)/$(OPENSSL_SSL_LIB_NAME))", "") + OPENSSL_SSL_LIB_NAME = + endif + endif + endif + + ifneq ($(OPENSSL_SSL_LIB_NAME), ) + OPENSSL_SSL_TARGET_LIB = $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(OPENSSL_SSL_LIB_NAME) + + $(OPENSSL_SSL_TARGET_LIB): $(OPENSSL_BUNDLE_LIB_PATH)/$(OPENSSL_SSL_LIB_NAME) + $(CP) $(OPENSSL_BUNDLE_LIB_PATH)/$(OPENSSL_SSL_LIB_NAME) $@ + + COPY_FILES += $(OPENSSL_SSL_TARGET_LIB) + endif endif ########################################################################################## diff --git a/jdk/make/closed/autoconf/custom-hook.m4 b/jdk/make/closed/autoconf/custom-hook.m4 index 0bf61d6e5f0..9c163466ac5 100644 --- a/jdk/make/closed/autoconf/custom-hook.m4 +++ b/jdk/make/closed/autoconf/custom-hook.m4 @@ -659,4 +659,5 @@ AC_DEFUN([CONFIGURE_OPENSSL], AC_SUBST(WITH_OPENSSL) AC_SUBST(BUILD_OPENSSL) AC_SUBST(OPENSSL_CFLAGS) + AC_SUBST(OPENSSL_LIBS) ]) diff --git a/jdk/make/closed/autoconf/custom-spec.gmk.in b/jdk/make/closed/autoconf/custom-spec.gmk.in index 84a4f492a02..b8820793de8 100644 --- a/jdk/make/closed/autoconf/custom-spec.gmk.in +++ b/jdk/make/closed/autoconf/custom-spec.gmk.in @@ -44,6 +44,7 @@ BUILD_OPENSSL := @BUILD_OPENSSL@ OPENSSL_CFLAGS := @OPENSSL_CFLAGS@ OPENSSL_BUNDLE_LIB_PATH := @OPENSSL_BUNDLE_LIB_PATH@ WITH_OPENSSL := @WITH_OPENSSL@ +OPENSSL_LIBS := @OPENSSL_LIBS@ ## DDR OPENJ9_ENABLE_DDR := @OPENJ9_ENABLE_DDR@