Skip to content

Commit

Permalink
Updates according to code review
Browse files Browse the repository at this point in the history
  • Loading branch information
taoliult committed Nov 20, 2023
1 parent 8c1c350 commit c26236d
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 96 deletions.
26 changes: 7 additions & 19 deletions closed/autoconf/custom-hook.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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)
])
8 changes: 3 additions & 5 deletions closed/autoconf/custom-spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
48 changes: 0 additions & 48 deletions closed/custom/Main.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion closed/custom/common/Modules.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -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) :
Expand Down
28 changes: 14 additions & 14 deletions closed/get_j9_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=* )
Expand Down Expand Up @@ -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"
Expand Down
15 changes: 10 additions & 5 deletions closed/make/modules/openjceplus/Copy.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,30 @@

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))), \
FILES := $(filter %.dll %.so %.x, $(call FindFiles, $(OPENJCEPLUS_TOPDIR))), \
FLATTEN := true, \
DEST := $(LIB_DST_DIR), \
))

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
52 changes: 52 additions & 0 deletions closed/make/modules/openjceplus/Lib.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# ===========================================================================
# (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 : 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

TARGETS += openjceplus-libs

endif # BUILD_OPENJCEPLUS

################################################################################
24 changes: 20 additions & 4 deletions get_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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}"
;;

Expand Down

0 comments on commit c26236d

Please sign in to comment.