From d83630d32cc31bdae81c6851308e5390ee322de2 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Mon, 20 Nov 2023 17:05:42 -0500 Subject: [PATCH] Updates according to code review --- closed/autoconf/custom-hook.m4 | 26 ++++--------- closed/autoconf/custom-spec.gmk.in | 8 ++-- closed/custom/Main.gmk | 48 ------------------------ closed/custom/common/Modules.gmk | 5 ++- closed/get_j9_source.sh | 28 +++++++------- closed/make/modules/openjceplus/Copy.gmk | 17 ++++++--- closed/make/modules/openjceplus/Lib.gmk | 48 ++++++++++++++++++++++++ get_source.sh | 24 ++++++++++-- 8 files changed, 107 insertions(+), 97 deletions(-) create mode 100644 closed/make/modules/openjceplus/Lib.gmk diff --git a/closed/autoconf/custom-hook.m4 b/closed/autoconf/custom-hook.m4 index 9dd84b958b3..d7065867f4b 100644 --- a/closed/autoconf/custom-hook.m4 +++ b/closed/autoconf/custom-hook.m4 @@ -822,26 +822,14 @@ AC_DEFUN([OPENJ9_GENERATE_TOOL_WRAPPERS], AC_DEFUN([OPENJCEPLUS_SETUP], [ - BUILD_JGSKIT=false - GSKIT_HOME= - OPENJCEPLUS_TOPDIR= - OPENJCEPLUS_TOPDIR_JAVA= - - OPENJCEPLUS_TOPDIR="$TOPDIR/OpenJCEPlus" - OPENJCEPLUS_TOPDIR_JAVA="$TOPDIR/OpenJCEPlus/src/main" - GSKIT_HOME="$TOPDIR/OpenJCEPlus/icc/jgsk_sdk" - - AC_MSG_CHECKING([if OpenJCEPlus will be built with Semeru]) - if ! test -d "$OPENJCEPLUS_TOPDIR" ; then - BUILD_JGSKIT=false - AC_MSG_RESULT([no]) - else - BUILD_JGSKIT=true + AC_MSG_CHECKING([for OpenJCEPlus]) + if test -d "$TOPDIR/OpenJCEPlus" ; then + BUILD_OPENJCEPLUS=true AC_MSG_RESULT([yes]) + else + BUILD_OPENJCEPLUS=false + AC_MSG_RESULT([no]) fi - AC_SUBST(BUILD_JGSKIT) - AC_SUBST(GSKIT_HOME) - AC_SUBST(OPENJCEPLUS_TOPDIR) - AC_SUBST(OPENJCEPLUS_TOPDIR_JAVA) + AC_SUBST(BUILD_OPENJCEPLUS) ]) diff --git a/closed/autoconf/custom-spec.gmk.in b/closed/autoconf/custom-spec.gmk.in index 389377ba357..8e1d92a10ed 100644 --- a/closed/autoconf/custom-spec.gmk.in +++ b/closed/autoconf/custom-spec.gmk.in @@ -184,8 +184,6 @@ J9JCL_SOURCES_DONEFILE := $(MAKESUPPORT_OUTPUTDIR)/j9jcl.done # Disable all hotspot features. JVM_FEATURES_server := -# required by OpenJCEPlus -BUILD_JGSKIT := @BUILD_JGSKIT@ -GSKIT_HOME := @GSKIT_HOME@ -OPENJCEPLUS_TOPDIR := @OPENJCEPLUS_TOPDIR@ -OPENJCEPLUS_TOPDIR_JAVA := @OPENJCEPLUS_TOPDIR_JAVA@ +# Required by OpenJCEPlus. +BUILD_OPENJCEPLUS := @BUILD_OPENJCEPLUS@ +OPENJCEPLUS_TOPDIR := $(TOPDIR)/OpenJCEPlus diff --git a/closed/custom/Main.gmk b/closed/custom/Main.gmk index bda6818a9d3..4ae5a28972c 100644 --- a/closed/custom/Main.gmk +++ b/closed/custom/Main.gmk @@ -120,52 +120,4 @@ ifneq (,$(HEALTHCENTER_JAR)) ibm.healthcenter-java : ibm.healthcenter-copy endif # HEALTHCENTER_JAR -ifeq (true,$(BUILD_JGSKIT)) - -# Identify the desired JGSKIT target platform. -JGSKIT_TARGET := -JGSKIT_MAKE := jgskit.mak -JGSKIT_MAKE_PATH := $(OPENJCEPLUS_TOPDIR)/src/main/native/ -JCE_CLASSPATH := $(OPENJCEPLUS_TOPDIR)/src/main/java:$(TOPDIR)/src/java.base/share/classes -JCE_CLASSPATH_WIN64 := "$(call MixedPath,$(OPENJCEPLUS_TOPDIR)/src/main/java)\;$(call MixedPath,$(TOPDIR)/src/java.base/share/classes)" - -ifeq ($(OPENJDK_TARGET_OS), aix) - JGSKIT_TARGET := ppc-aix64 -else ifeq ($(OPENJDK_TARGET_OS), linux) - ifeq ($(OPENJDK_TARGET_CPU), x86_64) - JGSKIT_TARGET := x86-linux64 - else ifeq ($(OPENJDK_TARGET_CPU), ppc64le) - JGSKIT_TARGET := ppcle-linux64 - endif -else ifeq ($(OPENJDK_TARGET_OS), windows) - ifeq ($(OPENJDK_TARGET_CPU), x86_64) - JGSKIT_TARGET := win64 - JGSKIT_MAKE := jgskit.win64.mak - JCE_CLASSPATH := $(JCE_CLASSPATH_WIN64) - GSKIT_HOME := $(call MixedPath,$(GSKIT_HOME)) - BOOT_JDK := $(call MixedPath,$(BOOT_JDK)) - endif -endif # OPENJDK_TARGET_OS - -ifeq (,$(JGSKIT_TARGET)) - $(error Unsupported platform $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU)) -endif # JGSKIT_TARGET - -.PHONY : clean-openjceplus openjceplus-libs - -clean : clean-openjceplus - -clean-openjceplus : - @$(ECHO) Cleaning OpenJCEPlus native - @$(RM) -f $(addprefix $(JGSKIT_MAKE_PATH), com_ibm_crypto_plus_provider_icc_NativeInterface.h com_ibm_crypto_plus_provider_icc_FastJNIBuffer.h libjgskit.x) - $(MAKE) -C $(JGSKIT_MAKE_PATH) -f $(JGSKIT_MAKE) cleanAll - openjceplus-copy : openjceplus-libs - -openjceplus-libs : - @$(ECHO) Compiling OpenJCEPlus native - export PLATFORM=$(JGSKIT_TARGET) JAVA_HOME=$(BOOT_JDK) GSKIT_HOME=$(GSKIT_HOME) JCE_CLASSPATH=$(JCE_CLASSPATH) \ - && $(MAKE) -j1 -C $(JGSKIT_MAKE_PATH) -f $(JGSKIT_MAKE) all - @$(ECHO) OpenJCEplus compile complete - -endif # BUILD_JGSKIT diff --git a/closed/custom/common/Modules.gmk b/closed/custom/common/Modules.gmk index 74df4a6f3e8..394236b8885 100644 --- a/closed/custom/common/Modules.gmk +++ b/closed/custom/common/Modules.gmk @@ -54,9 +54,12 @@ MODULES_FILTER += \ TOP_SRC_DIRS += \ $(J9JCL_SOURCES_DIR) \ - $(OPENJCEPLUS_TOPDIR_JAVA) \ # +ifeq (true,$(BUILD_OPENJCEPLUS)) + TOP_SRC_DIRS += $(OPENJCEPLUS_TOPDIR)/src/main +endif + .PHONY : generate-j9jcl-sources generate-j9jcl-sources $(J9JCL_SOURCES_DONEFILE) : diff --git a/closed/get_j9_source.sh b/closed/get_j9_source.sh index 45f58654f08..c330103e1a9 100644 --- a/closed/get_j9_source.sh +++ b/closed/get_j9_source.sh @@ -127,20 +127,20 @@ for i in "$@" ; do shas[OpenJCEPlus]="${i#*=}" ;; - -with-gskit-bin=* ) - gskit_bin="${i#*=}" + -openjceplus-reference=* ) + references[OpenJCEPlus]="${i#*=}" ;; - -with-gskit-sdk-bin=* ) - gskit_sdk_bin="${i#*=}" + -gskit-bin=* ) + gskit_bin="${i#*=}" ;; - -with-gskit-bin-credential=* ) - gskit_bin_credential="${i#*=}" + -gskit-sdk-bin=* ) + gskit_sdk_bin="${i#*=}" ;; - -openjceplus-reference=* ) - references[OpenJCEPlus]="${i#*=}" + -gskit-credential=* ) + gskit_credential="${i#*=}" ;; -parallel=* ) @@ -209,20 +209,20 @@ if [ ${pflag} = true ] ; then fi # Download ICC binaries and create Java module folder -openjceplus_source="OpenJCEPlus" -if [ "${git_urls[$openjceplus_source]}" ]; then +openjceplus_source=OpenJCEPlus +if [ -n "${git_urls[$openjceplus_source]}" ] ; then echo echo "$openjceplus_source exists, download ICC binaries" echo cd $openjceplus_source - mkdir -p ./icc/jgsk_sdk/lib64/ + mkdir -p icc/jgsk_sdk/lib64 - if [ $gskit_bin_credential ]; then + if [ $gskit_credential ]; then # Download GSKit binaries from artifactory - curl -vk -u "$gskit_bin_credential" -X GET $gskit_bin > ./icc/jgsk_crypto.tar - curl -vk -u "$gskit_bin_credential" -X GET $gskit_sdk_bin > ./icc/jgsk_crypto_sdk.tar + curl -vk -u "$gskit_credential" -X GET $gskit_bin > ./icc/jgsk_crypto.tar + curl -vk -u "$gskit_credential" -X GET $gskit_sdk_bin > ./icc/jgsk_crypto_sdk.tar else echo echo "GSKit binaries are needed for compiling $openjceplus_source" diff --git a/closed/make/modules/openjceplus/Copy.gmk b/closed/make/modules/openjceplus/Copy.gmk index 87cd7054fec..1f536135af8 100644 --- a/closed/make/modules/openjceplus/Copy.gmk +++ b/closed/make/modules/openjceplus/Copy.gmk @@ -20,11 +20,11 @@ include $(TOPDIR)/closed/CopySupport.gmk -ifeq (true,$(BUILD_JGSKIT)) +ifeq (true,$(BUILD_OPENJCEPLUS)) # Copy OpenJCEPlus native libraries $(eval $(call SetupCopyFiles, COPY_JGSKIT_LIBS, \ - SRC := $(OPENJCEPLUS_TOPDIR), \ - FILES := $(filter %.so %.x %.dll,$(call FindFiles, $(OPENJCEPLUS_TOPDIR))), \ + SRC := $(OPENJCEPLUS_TOPDIR)/target, \ + FILES := $(filter %.dll %.so %.x, $(call FindFiles, $(OPENJCEPLUS_TOPDIR)/target)), \ FLATTEN := true, \ DEST := $(LIB_DST_DIR), \ )) @@ -32,13 +32,18 @@ ifeq (true,$(BUILD_JGSKIT)) TARGETS += $(COPY_JGSKIT_LIBS) # Bundle GSKIT library - ICC_DIR := $(GSKIT_HOME)/lib64 + ICC_DIR := $(TOPDIR)/OpenJCEPlus/icc/jgsk_sdk/lib64 + ifeq ($(call isTargetOs, windows), true) + ICC_SUB_DIR := modules_cmds + else + ICC_SUB_DIR := modules_libs + endif $(eval $(call SetupCopyFiles, COPY_ICC, \ SRC := $(ICC_DIR), \ - DEST := $(LIB_DST_DIR), \ + DEST := $(SUPPORT_OUTPUTDIR)/$(ICC_SUB_DIR)/$(MODULE), \ FILES := $(call FindFiles, $(ICC_DIR)), \ )) TARGETS += $(COPY_ICC) -endif # BUILD_JGSKIT +endif # BUILD_OPENJCEPLUS diff --git a/closed/make/modules/openjceplus/Lib.gmk b/closed/make/modules/openjceplus/Lib.gmk new file mode 100644 index 00000000000..813ff2708ed --- /dev/null +++ b/closed/make/modules/openjceplus/Lib.gmk @@ -0,0 +1,48 @@ +# =========================================================================== +# (c) Copyright IBM Corp. 2023, 2023 All Rights Reserved +# =========================================================================== + +include LibCommon.gmk + +ifeq (true,$(BUILD_OPENJCEPLUS)) + +# Identify the desired JGSKIT target platform. +GSKIT_HOME := $(TOPDIR)/OpenJCEPlus/icc/jgsk_sdk +JGSKIT_TARGET := +JGSKIT_MAKE := jgskit.mak +JGSKIT_MAKE_PATH := $(OPENJCEPLUS_TOPDIR)/src/main/native/ +JCE_CLASSPATH := $(OPENJCEPLUS_TOPDIR)/src/main/java:$(TOPDIR)/src/java.base/share/classes + +ifeq ($(call isTargetOs, aix), true) + JGSKIT_TARGET := ppc-aix64 +else ifeq ($(call isTargetOs, linux), true) + ifeq ($(call isTargetCpu, x86_64), true) + JGSKIT_TARGET := x86-linux64 + else ifeq ($(call isTargetCpu, ppc64le), true) + JGSKIT_TARGET := ppcle-linux64 + endif +else ifeq ($(call isTargetOs, windows), true) + ifeq ($(call isTargetCpu, x86_64), true) + JGSKIT_TARGET := win64 + JGSKIT_MAKE := jgskit.win64.mak + JCE_CLASSPATH := "$(call MixedPath,$(OPENJCEPLUS_TOPDIR)/src/main/java)\;$(call MixedPath,$(TOPDIR)/src/java.base/share/classes)" + GSKIT_HOME := $(call MixedPath,$(GSKIT_HOME)) + BOOT_JDK := $(call MixedPath,$(BOOT_JDK)) + endif +endif + +ifeq (,$(JGSKIT_TARGET)) + $(error Unsupported platform $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU)) +endif # JGSKIT_TARGET + +.PHONY : compile-libs + +compile-libs : + @$(ECHO) Compiling OpenJCEPlus native + export PLATFORM=$(JGSKIT_TARGET) JAVA_HOME=$(BOOT_JDK) GSKIT_HOME=$(GSKIT_HOME) JCE_CLASSPATH=$(JCE_CLASSPATH) \ + && $(MAKE) -j1 -C $(JGSKIT_MAKE_PATH) -f $(JGSKIT_MAKE) all + @$(ECHO) OpenJCEplus compile complete + +TARGETS += compile-libs + +endif # BUILD_OPENJCEPLUS diff --git a/get_source.sh b/get_source.sh index c599c71ee3c..7fcaec15b56 100644 --- a/get_source.sh +++ b/get_source.sh @@ -44,9 +44,9 @@ usage() { echo " -openjceplus-branch the OpenJCEPlus git branch" echo " -openjceplus-sha a commit SHA for the OpenJCEPlus repository" echo " -openjceplus-reference a local repo to use as a clone reference" - echo " -with-gskit-bin the GSKit binary url" - echo " -with-gskit-sdk-bin the GSKIT SDK binary url" - echo " -with-gskit-bin-credential the credential for downloading the GSKit binaries" + echo " -gskit-bin the GSKit binary url" + echo " -gskit-sdk-bin the GSKIT SDK binary url" + echo " -gskit-credential the credential for downloading the GSKit and GSKit SDK" echo " -parallel (boolean) if 'true' then the clone j9 repository commands run in parallel, default is false" echo " --openssl-repo Specify the OpenSSL repository to download from" echo " --openssl-version Specify the version of OpenSSL source to download" @@ -64,7 +64,23 @@ for i in "$@" ; do usage ;; - -openj9-repo=* | -openj9-branch=* | -openj9-sha=* | -openj9-reference=* | -omr-repo=* | -omr-branch=* | -omr-sha=* | -omr-reference=* | -openjceplus-repo=* | -openjceplus-branch=* | -openjceplus-sha=* | -openjceplus-reference=* | -with-gskit-bin=* | -with-gskit-sdk-bin=* | -with-gskit-bin-credential=* | -parallel=* ) + -gskit-bin=* \ + | -gskit-credential=* \ + | -gskit-sdk-bin=* \ + | -omr-branch=* \ + | -omr-reference=* \ + | -omr-repo=* \ + | -omr-sha=* \ + | -openj9-branch=* \ + | -openj9-reference=* \ + | -openj9-repo=* \ + | -openj9-sha=* \ + | -openjceplus-branch=* \ + | -openjceplus-reference=* \ + | -openjceplus-repo=* \ + | -openjceplus-sha=* \ + | -parallel=* \ + ) j9options="${j9options} ${i}" ;;