diff --git a/closed/Components.gmk b/closed/Components.gmk deleted file mode 100644 index 3386f4f4cb4..00000000000 --- a/closed/Components.gmk +++ /dev/null @@ -1,71 +0,0 @@ -# =========================================================================== -# (c) Copyright IBM Corp. 2020, 2023 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 -# published by the Free Software Foundation. -# -# IBM designates this particular file as subject to the "Classpath" exception -# as provided by IBM 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, see . -# =========================================================================== - -no_default : - $(error Components.gmk has no default target) - -include $(SPEC) -include $(TOPDIR)/make/common/MakeBase.gmk - -.PHONY : no_default stage-components - -# copy_component_tree -# ------------------- -# Copy recursively source $2 to target directory $1. -# $1 = target directory -# $2 = source directory -define copy_component_tree - $(if $(filter 1,$(words $2)),,$(error copy_component_tree requires exactly one source directory; got '$2')) - @$(MKDIR) -p $1 - @$(CP) -fR $2 $1 -endef - -# download_icc_binaries -# ------------------- -# $1 = icc binaries url -# $2 = icc sdk binaries url -# $3 = icc binaries credential -define download_icc_binaries - @$(MKDIR) -p $(OPENJCEPLUS_TOPDIR)/icc/jgsk_sdk/lib64/ - $(if $(strip $3), - @curl -H "Authorization: Bearer $3" -H "Accept: application/octet-stream" -L $1 --output $(OPENJCEPLUS_TOPDIR)/icc/jgsk_crypto.tar, \ - @echo "GSKIT_BIN_CREDENTIAL is either undefined or empty, will add curl command HERE without credential.") - $(if $(strip $3), - @curl -H "Authorization: Bearer $3" -H "Accept: application/octet-stream" -L $2 --output $(OPENJCEPLUS_TOPDIR)/icc/jgsk_crypto_sdk.tar, \ - @echo "GSKIT_BIN_CREDENTIAL is either undefined or empty, will add curl command HERE without credential.") - @$(TAR) -xf $(OPENJCEPLUS_TOPDIR)/icc/jgsk_crypto_sdk.tar -C $(OPENJCEPLUS_TOPDIR)/icc/ - @$(TAR) -xf $(OPENJCEPLUS_TOPDIR)/icc/jgsk_crypto.tar -C $(OPENJCEPLUS_TOPDIR)/icc/jgsk_sdk/lib64/ -endef - -ifeq (true,$(BUILD_JGSKIT)) - -.PHONY : stage-openjceplus - -stage-components : stage-openjceplus - -# Copy openjceplus java source codes into $(TOPDIR)/src/openjceplus folder -# Download ICC binaries into $(OPENJCEPLUS_TOPDIR)/icc folder -stage-openjceplus : - @$(ECHO) Staging OpenJCEPlus in $(TOPDIR)/src/openjceplus - $(call copy_component_tree,$(TOPDIR)/src/openjceplus/share/classes,$(OPENJCEPLUS_TOPDIR)/src/main/java/*) - @$(ECHO) Staging ICC in $(OPENJCEPLUS_TOPDIR)/icc - $(call download_icc_binaries,$(GSKIT_BIN),$(GSKIT_SDK_BIN),$(GSKIT_BIN_CREDENTIAL)) - -endif # BUILD_JGSKIT diff --git a/closed/autoconf/custom-hook.m4 b/closed/autoconf/custom-hook.m4 index c321984917a..9dd84b958b3 100644 --- a/closed/autoconf/custom-hook.m4 +++ b/closed/autoconf/custom-hook.m4 @@ -823,64 +823,25 @@ AC_DEFUN([OPENJ9_GENERATE_TOOL_WRAPPERS], AC_DEFUN([OPENJCEPLUS_SETUP], [ BUILD_JGSKIT=false - GSKIT_BIN= - GSKIT_SDK_BIN= - GSKIT_BIN_CREDENTIAL= GSKIT_HOME= OPENJCEPLUS_TOPDIR= + OPENJCEPLUS_TOPDIR_JAVA= - # check for GSKIT crypyo library for OpenJCEPlus - AC_ARG_WITH(gskit-bin, [AS_HELP_STRING([--with-gskit-bin], [specify path to the gskit bin url])]) - AC_ARG_WITH(gskit-sdk-bin, [AS_HELP_STRING([--with-gskit-sdk-bin], [specify path to the gskit sdk bin url])]) - AC_ARG_WITH(gskit-bin-credential, [AS_HELP_STRING([--with-gskit-bin-credential], [specify path to the gskit bin credential])]) + OPENJCEPLUS_TOPDIR="$TOPDIR/OpenJCEPlus" + OPENJCEPLUS_TOPDIR_JAVA="$TOPDIR/OpenJCEPlus/src/main" + GSKIT_HOME="$TOPDIR/OpenJCEPlus/icc/jgsk_sdk" - AC_MSG_CHECKING([if gskit and gskit sdk bin url is set]) - if test "x$with_gskit_bin" = x || test "x$with_gskit_bin" = xyes || test "x$with_gskit_sdk_bin" = x || test "x$with_gskit_sdk_bin" = xyes ; then + AC_MSG_CHECKING([if OpenJCEPlus will be built with Semeru]) + if ! test -d "$OPENJCEPLUS_TOPDIR" ; then + BUILD_JGSKIT=false AC_MSG_RESULT([no]) - PRINT_GSKIT_HELP - AC_MSG_ERROR([--with-gskit-bin and --with-gskit-sdk-bin must have values]) else - AC_MSG_RESULT([yes]) BUILD_JGSKIT=true - GSKIT_BIN="$with_gskit_bin" - GSKIT_SDK_BIN="$with_gskit_sdk_bin" - - AC_MSG_CHECKING([if gskit and gskit sdk bin credential is set]) - if test "x$with_gskit_bin_credential" != x ; then - AC_MSG_RESULT([yes]) - GSKIT_BIN_CREDENTIAL="$with_gskit_bin_credential" - else - AC_MSG_RESULT([no]) - fi - - OPENJCEPLUS_TOPDIR="$TOPDIR/OpenJCEPlus" - GSKIT_HOME="$TOPDIR/OpenJCEPlus/icc/jgsk_sdk" - if ! test -d "$OPENJCEPLUS_TOPDIR" ; then - AC_MSG_ERROR(["Cannot locate the path to OpenJCEPlus sources: $OPENJCEPLUS_TOPDIR! Try 'bash get_source.sh' and restart configure"]) - fi + AC_MSG_RESULT([yes]) fi AC_SUBST(BUILD_JGSKIT) - AC_SUBST(GSKIT_BIN) - AC_SUBST(GSKIT_SDK_BIN) - AC_SUBST(GSKIT_BIN_CREDENTIAL) AC_SUBST(GSKIT_HOME) AC_SUBST(OPENJCEPLUS_TOPDIR) -]) - -AC_DEFUN([PRINT_GSKIT_HELP], -[ - printf "\n" - printf "GSKIT is required to compile the OpenJCEPlus native library and has to\n" - printf "be provided during configure process in order to build OpenJCEPlus with\n" - printf "GSKIT.\n" - printf "\n" - printf "Run configure with '--with-gskit-bin' and '--with-gskit-sdk-bin' to\n" - printf "specify the URL of GSKIT binary and GSKIT SDK binary. And run configure\n" - printf "with '--with-gskit-bin-credential' to specify the credential(if needed)\n" - printf "when downloading the GSKIT binary and GSKIT SDK binary.\n" - printf "\n" - printf "To ignore OpenJCEPLUs with GSKIT, run configure without '--with-gskit-bin',\n" - printf "and '--with-gskit-sdk-bin'." - printf "\n" + AC_SUBST(OPENJCEPLUS_TOPDIR_JAVA) ]) diff --git a/closed/autoconf/custom-spec.gmk.in b/closed/autoconf/custom-spec.gmk.in index 404d5278621..389377ba357 100644 --- a/closed/autoconf/custom-spec.gmk.in +++ b/closed/autoconf/custom-spec.gmk.in @@ -186,8 +186,6 @@ JVM_FEATURES_server := # required by OpenJCEPlus BUILD_JGSKIT := @BUILD_JGSKIT@ -GSKIT_BIN := @GSKIT_BIN@ -GSKIT_BIN_CREDENTIAL := @GSKIT_BIN_CREDENTIAL@ GSKIT_HOME := @GSKIT_HOME@ -GSKIT_SDK_BIN := @GSKIT_SDK_BIN@ OPENJCEPLUS_TOPDIR := @OPENJCEPLUS_TOPDIR@ +OPENJCEPLUS_TOPDIR_JAVA := @OPENJCEPLUS_TOPDIR_JAVA@ diff --git a/closed/custom/Main-pre.gmk b/closed/custom/Main-pre.gmk deleted file mode 100644 index f375d579e48..00000000000 --- a/closed/custom/Main-pre.gmk +++ /dev/null @@ -1,42 +0,0 @@ -# =========================================================================== -# (c) Copyright IBM Corp. 2020, 2023 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 -# published by the Free Software Foundation. -# -# IBM designates this particular file as subject to the "Classpath" exception -# as provided by IBM 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, see . -# ============================================================================ - -COMPONENTS_MAKE := $(MAKE) $(MAKE_ARGS) -f $(TOPDIR)/closed/Components.gmk - -ifeq (true,$(BUILD_JGSKIT)) - -.PHONY : clean-openjceplus openjceplus-libs - -clean : clean-openjceplus - -clean-openjceplus : - @$(ECHO) Cleaning OpenJCEPlus native - @$(RM) -f $(addprefix $(OPENJCEPLUS_TOPDIR)/src/main/native/, com_ibm_crypto_plus_provider_icc_NativeInterface.h com_ibm_crypto_plus_provider_icc_FastJNIBuffer.h libjgskit.x) - $(MAKE) -C $(OPENJCEPLUS_TOPDIR)/src/main/native/ -f jgskit.mak cleanAll - -java.base-copy : openjceplus-libs - -openjceplus-libs : - @$(ECHO) Compiling OpenJCEPlus native - export PLATFORM=x86-linux64 JAVA_HOME=$(BOOT_JDK) GSKIT_HOME=$(GSKIT_HOME) JCE_CLASSPATH=$(OPENJCEPLUS_TOPDIR)/src/main/java/:$(TOPDIR)/src/java.base/share/classes/ \ - && $(MAKE) -j1 -C $(OPENJCEPLUS_TOPDIR)/src/main/native/ -f jgskit.mak all - @$(ECHO) OpenJCEplus compile complete - -endif # BUILD_JGSKIT diff --git a/closed/custom/Main.gmk b/closed/custom/Main.gmk index c73975a2daf..1df265da032 100644 --- a/closed/custom/Main.gmk +++ b/closed/custom/Main.gmk @@ -120,5 +120,23 @@ ifneq (,$(HEALTHCENTER_JAR)) ibm.healthcenter-java : ibm.healthcenter-copy endif # HEALTHCENTER_JAR -# include Main-pre.gmk -$(eval $(call IncludeCustomExtension, Main-pre.gmk)) +ifeq (true,$(BUILD_JGSKIT)) + +.PHONY : clean-openjceplus openjceplus-libs + +clean : clean-openjceplus + +clean-openjceplus : + @$(ECHO) Cleaning OpenJCEPlus native + @$(RM) -f $(addprefix $(OPENJCEPLUS_TOPDIR)/src/main/native/, com_ibm_crypto_plus_provider_icc_NativeInterface.h com_ibm_crypto_plus_provider_icc_FastJNIBuffer.h libjgskit.x) + $(MAKE) -C $(OPENJCEPLUS_TOPDIR)/src/main/native/ -f jgskit.mak cleanAll + +java.base-copy : openjceplus-libs + +openjceplus-libs : + @$(ECHO) Compiling OpenJCEPlus native + export PLATFORM=x86-linux64 JAVA_HOME=$(BOOT_JDK) GSKIT_HOME=$(GSKIT_HOME) JCE_CLASSPATH=$(OPENJCEPLUS_TOPDIR)/src/main/java/:$(TOPDIR)/src/java.base/share/classes/ \ + && $(MAKE) -j1 -C $(OPENJCEPLUS_TOPDIR)/src/main/native/ -f jgskit.mak all + @$(ECHO) OpenJCEplus compile complete + +endif # BUILD_JGSKIT diff --git a/closed/custom/common/Modules.gmk b/closed/custom/common/Modules.gmk index 8d6fb846599..74df4a6f3e8 100644 --- a/closed/custom/common/Modules.gmk +++ b/closed/custom/common/Modules.gmk @@ -54,13 +54,13 @@ MODULES_FILTER += \ TOP_SRC_DIRS += \ $(J9JCL_SOURCES_DIR) \ + $(OPENJCEPLUS_TOPDIR_JAVA) \ # .PHONY : generate-j9jcl-sources generate-j9jcl-sources $(J9JCL_SOURCES_DONEFILE) : @+$(MAKE) $(MAKE_ARGS) -f $(TOPDIR)/closed/GensrcJ9JCL.gmk - @+$(COMPONENTS_MAKE) stage-components # When building multiple configurations at once (e.g. 'make CONF= images') # the 'create-main-targets-include' target will only be considered for the diff --git a/closed/get_j9_source.sh b/closed/get_j9_source.sh index ef1c8e50d52..b6a99defa19 100644 --- a/closed/get_j9_source.sh +++ b/closed/get_j9_source.sh @@ -43,6 +43,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 and GSKit SDK" echo " -parallel (boolean) if 'true' then the clone j9 repository commands run in parallel, default is false" echo "" exit 1 @@ -124,6 +127,18 @@ for i in "$@" ; do shas[OpenJCEPlus]="${i#*=}" ;; + -with-gskit-bin=* ) + gskit_bin="${i#*=}" + ;; + + -with-gskit-sdk-bin=* ) + gskit_sdk_bin="${i#*=}" + ;; + + -with-gskit-bin-credential=* ) + gskit_bin_credential="${i#*=}" + ;; + -openjceplus-reference=* ) references[OpenJCEPlus]="${i#*=}" ;; @@ -193,6 +208,34 @@ if [ ${pflag} = true ] ; then wait fi +# Download ICC binaries and create Java module folder +openjceplus_source="OpenJCEPlus" +if [ "${git_urls[$openjceplus_source]}" ]; then + + echo + echo "$openjceplus_source exists, download ICC binaries" + echo + + cd $openjceplus_source + mkdir -p ./icc/jgsk_sdk/lib64/ + + if [ $gskit_bin_credential ]; then + curl -H "Authorization: Bearer $gskit_bin_credential" -H "Accept: application/octet-stream" -L $gskit_bin --output ./icc/jgsk_crypto.tar + curl -H "Authorization: Bearer $gskit_bin_credential" -H "Accept: application/octet-stream" -L $gskit_sdk_bin --output ./icc/jgsk_crypto_sdk.tar + else + echo "-with-gskit-bin-credential is empty, will add curl command HERE without credential once there are binaries in open repo." + fi + + tar -xf ./icc/jgsk_crypto_sdk.tar -C ./icc/ + tar -xf ./icc/jgsk_crypto.tar -C ./icc/jgsk_sdk/lib64/ + + # Create OpenJCEPlus Java module folder + mkdir -p ./src/main/openjceplus/share/classes/ + cp -r ./src/main/java/* ./src/main/openjceplus/share/classes/ + + cd .. +fi + END_TIME=$(date +%s) date "+[%F %T] OpenJ9 clone repositories finished in $(($END_TIME - $START_TIME)) seconds" diff --git a/get_source.sh b/get_source.sh index 118fe4171ef..80e8ff53a80 100644 --- a/get_source.sh +++ b/get_source.sh @@ -44,6 +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 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" @@ -61,7 +64,7 @@ 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=* | -parallel=* ) + -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=* ) j9options="${j9options} ${i}" ;;