Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate OpenJCEPlus into Semeru OpenJDK #2

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# exclude all source directories
/omr
/openj9
/OpenJCEPlus
/openssl

# openjdk gitignore
Expand Down
1 change: 1 addition & 0 deletions closed/GensrcJ9JCL.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ $(eval $(call SetupCopyFiles,COPY_OVERLAY_FILES, \
src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java \
src/java.base/share/classes/jdk/internal/access/JavaNetInetAddressAccess.java \
src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java \
src/java.base/share/classes/module-info.java \
src/java.base/share/classes/sun/security/jca/ProviderConfig.java \
src/java.base/share/classes/sun/security/jca/ProviderList.java \
src/java.base/share/classes/sun/security/provider/DigestBase.java \
Expand Down
4 changes: 4 additions & 0 deletions closed/JPP.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ ifeq (true,$(OPENJ9_ENABLE_INLINE_TYPES))
JPP_TAGS += INLINE-TYPES
endif # OPENJ9_ENABLE_INLINE_TYPES

ifeq (true,$(BUILD_OPENJCEPLUS))
JPP_TAGS += OPENJCEPLUS_SUPPORT
endif # BUILD_OPENJCEPLUS

# invoke JPP to preprocess java source files
# $1 - configuration
# $2 - source directory
Expand Down
26 changes: 26 additions & 0 deletions closed/autoconf/custom-hook.m4
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
OPENJ9_CONFIGURE_INLINE_TYPES
OPENJ9_THIRD_PARTY_REQUIREMENTS
OPENJ9_CHECK_NASM_VERSION
OPENJCEPLUS_SETUP
])

AC_DEFUN([OPENJ9_CONFIGURE_CMAKE],
Expand Down Expand Up @@ -839,3 +840,28 @@ AC_DEFUN([OPENJ9_GENERATE_TOOL_WRAPPERS],
OPENJ9_GENERATE_TOOL_WRAPPER([nasm], [$NASM])
OPENJ9_GENERATE_TOOL_WRAPPER([rc], [$RC])
])

AC_DEFUN([OPENJCEPLUS_SETUP],
[
AC_ARG_ENABLE([openjceplus], [AS_HELP_STRING([--enable-openjceplus],
[enable OpenJCEPlus integration @<:@disabled@:>@])])
AC_MSG_CHECKING([for OpenJCEPlus])
if test "x$enable_openjceplus" = xyes ; then
if test -d "$TOPDIR/OpenJCEPlus" ; then
AC_MSG_RESULT([yes (explicitly set)])
BUILD_OPENJCEPLUS=true
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([OpenJCEPlus not found at $TOPDIR/OpenJCEPlus])
fi
elif test "x$enable_openjceplus" = xno ; then
AC_MSG_RESULT([no])
BUILD_OPENJCEPLUS=false
elif test "x$enable_openjceplus" = x ; then
AC_MSG_RESULT([no (default)])
BUILD_OPENJCEPLUS=false
else
AC_MSG_ERROR([--enable-openjceplus accepts no argument])
fi
AC_SUBST(BUILD_OPENJCEPLUS)
])
5 changes: 5 additions & 0 deletions closed/autoconf/custom-spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ WARNING_MODULES := \
openj9.dtfj \
openj9.dtfjview \
openj9.traceformat \
openjceplus \
#

ifneq (,$(filter $(WARNING_MODULES),$(MODULE)))
Expand Down Expand Up @@ -183,3 +184,7 @@ J9JCL_SOURCES_DONEFILE := $(MAKESUPPORT_OUTPUTDIR)/j9jcl.done

# Disable all hotspot features.
JVM_FEATURES_server :=

# Required by OpenJCEPlus.
BUILD_OPENJCEPLUS := @BUILD_OPENJCEPLUS@
OPENJCEPLUS_TOPDIR := $(TOPDIR)/OpenJCEPlus
3 changes: 2 additions & 1 deletion closed/custom/Images-pre.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2020, 2021 All Rights Reserved
# (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
Expand All @@ -24,4 +24,5 @@ JRE_MODULES += \
openj9.dataaccess \
openj9.dtfj \
openj9.gpu \
$(if $(call equals, $(BUILD_OPENJCEPLUS), true), openjceplus) \
#
20 changes: 20 additions & 0 deletions closed/custom/Main.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,23 @@ ifneq (,$(HEALTHCENTER_JAR))
# The content must be extracted before module-info can be compiled.
ibm.healthcenter-java : ibm.healthcenter-copy
endif # HEALTHCENTER_JAR

ifeq (true,$(BUILD_OPENJCEPLUS))

ifeq ($(call And, $(call isTargetOs, windows) $(call isTargetCpu, x86_64)), true)
OPENJCEPLUS_JGSKIT_MAKE := jgskit.win64.mak
else
OPENJCEPLUS_JGSKIT_MAKE := jgskit.mak
endif

openjceplus-copy : openjceplus-libs

.PHONY : openjceplus-clean

openjceplus-clean :
@$(ECHO) Cleaning OpenJCEPlus native code
$(MAKE) -C $(OPENJCEPLUS_TOPDIR)/src/main/native -f $(OPENJCEPLUS_JGSKIT_MAKE) cleanAll

clean-openjceplus : openjceplus-clean

endif # BUILD_OPENJCEPLUS
6 changes: 5 additions & 1 deletion closed/custom/common/Modules.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2017, 2022 All Rights Reserved
# (c) Copyright IBM Corp. 2017, 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
Expand Down Expand Up @@ -56,6 +56,10 @@ TOP_SRC_DIRS += \
$(J9JCL_SOURCES_DIR) \
#

ifeq (true,$(BUILD_OPENJCEPLUS))
TOP_SRC_DIRS += $(OPENJCEPLUS_TOPDIR)/src/main
endif

.PHONY : generate-j9jcl-sources

generate-j9jcl-sources $(J9JCL_SOURCES_DONEFILE) :
Expand Down
66 changes: 66 additions & 0 deletions closed/get_j9_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ usage() {
echo " -omr-branch the OpenJ9/omr git branch: openj9"
echo " -omr-sha a commit SHA for the omr repository"
echo " -omr-reference a local repo to use as a clone reference"
echo " -openjceplus-repo the OpenJCEPlus repository url"
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 " -gskit-bin the GSKit binary url"
echo " -gskit-sdk-bin the GSKIT SDK binary url"
echo " -gskit-credential the credential for downloading the GSKit binaries"
echo " -parallel (boolean) if 'true' then the clone j9 repository commands run in parallel, default is false"
echo ""
exit 1
Expand Down Expand Up @@ -108,6 +115,34 @@ for i in "$@" ; do
references[omr]="${i#*=}"
;;

-openjceplus-repo=* )
git_urls[OpenJCEPlus]="${i#*=}"
;;

-openjceplus-branch=* )
branches[OpenJCEPlus]="${i#*=}"
;;

-openjceplus-sha=* )
shas[OpenJCEPlus]="${i#*=}"
;;

-openjceplus-reference=* )
references[OpenJCEPlus]="${i#*=}"
;;

-gskit-bin=* )
gskit_bin="${i#*=}"
;;

-gskit-sdk-bin=* )
gskit_sdk_bin="${i#*=}"
;;

-gskit-credential=* )
gskit_credential="${i#*=}"
;;

-parallel=* )
pflag="${i#*=}"
;;
Expand Down Expand Up @@ -170,6 +205,37 @@ if [ ${pflag} = true ] ; then
wait
fi

# Download OCK binaries and create Java module folder.
openjceplus_source=OpenJCEPlus
if [ -n "${git_urls[$openjceplus_source]}" ] ; then

echo
echo "$openjceplus_source exists, download OCK binaries"
echo

cd $openjceplus_source
mkdir -p ock/jgsk_sdk/lib64

if [ -n "$gskit_credential" ] ; then
curl -u "$gskit_credential" $gskit_bin > ock/jgsk_crypto.tar
curl -u "$gskit_credential" $gskit_sdk_bin > ock/jgsk_crypto_sdk.tar
else
echo
echo "GSKit binaries are needed for compiling $openjceplus_source"
echo "Please set -gskit-bin, -gskit-sdk-bin, and -gskit-credential"
exit 1
fi

tar -xf ock/jgsk_crypto_sdk.tar -C ock
tar -xf ock/jgsk_crypto.tar -C ock/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

for i in "${!git_urls[@]}" ; do
if [ -e /tmp/${i}.pid.rc ] ; then
# check if the git clone repository command failed
Expand Down
49 changes: 49 additions & 0 deletions closed/make/modules/openjceplus/Copy.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2023, 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 <http://www.gnu.org/licenses/>.
# ===========================================================================

include $(TOPDIR)/closed/CopySupport.gmk

ifeq (true,$(BUILD_OPENJCEPLUS))
# Copy OpenJCEPlus native libraries.
$(eval $(call SetupCopyFiles, OPENJCEPLUS_JGSKIT_LIBS_COPY, \
SRC := $(OPENJCEPLUS_TOPDIR)/target, \
FILES := $(filter %.dll %.so %.x, $(call FindFiles, $(OPENJCEPLUS_TOPDIR)/target)), \
FLATTEN := true, \
DEST := $(LIB_DST_DIR), \
))

TARGETS += $(OPENJCEPLUS_JGSKIT_LIBS_COPY)

# Bundle GSKIT library.
OPENJCEPLUS_OCK_DIR := $(OPENJCEPLUS_TOPDIR)/ock/jgsk_sdk/lib64
ifeq ($(call isTargetOs, windows), true)
OPENJCEPLUS_OCK_SUB_DIR := modules_cmds
else
OPENJCEPLUS_OCK_SUB_DIR := modules_libs
endif

$(eval $(call SetupCopyFiles, OPENJCEPLUS_OCK_COPY, \
SRC := $(OPENJCEPLUS_OCK_DIR), \
DEST := $(SUPPORT_OUTPUTDIR)/$(OPENJCEPLUS_OCK_SUB_DIR)/$(MODULE), \
FILES := $(call FindFiles, $(OPENJCEPLUS_OCK_DIR)), \
))

TARGETS += $(OPENJCEPLUS_OCK_COPY)
endif # BUILD_OPENJCEPLUS
69 changes: 69 additions & 0 deletions closed/make/modules/openjceplus/Lib.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2023, 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 <http://www.gnu.org/licenses/>.
# ===========================================================================

include LibCommon.gmk

ifeq (true,$(BUILD_OPENJCEPLUS))

# Identify the desired JGSKIT target platform.
OPENJCEPLUS_BOOT_JDK := $(BOOT_JDK)
OPENJCEPLUS_GSKIT_HOME := $(OPENJCEPLUS_TOPDIR)/ock/jgsk_sdk
OPENJCEPLUS_JCE_CLASSPATH := $(JDK_OUTPUTDIR)/modules/openjceplus:$(JDK_OUTPUTDIR)/modules/java.base
OPENJCEPLUS_JGSKIT_MAKE := jgskit.mak
OPENJCEPLUS_JGSKIT_MAKE_PATH := $(OPENJCEPLUS_TOPDIR)/src/main/native
OPENJCEPLUS_JGSKIT_PLATFORM :=

ifeq ($(call isTargetOs, aix), true)
OPENJCEPLUS_JGSKIT_PLATFORM := ppc-aix64
else ifeq ($(call isTargetOs, linux), true)
ifeq ($(call isTargetCpu, ppc64le), true)
OPENJCEPLUS_JGSKIT_PLATFORM := ppcle-linux64
else ifeq ($(call isTargetCpu, x86_64), true)
OPENJCEPLUS_JGSKIT_PLATFORM := x86-linux64
endif
else ifeq ($(call isTargetOs, windows), true)
ifeq ($(call isTargetCpu, x86_64), true)
OPENJCEPLUS_BOOT_JDK := $(call MixedPath,$(OPENJCEPLUS_BOOT_JDK))
OPENJCEPLUS_GSKIT_HOME := $(call MixedPath,$(OPENJCEPLUS_GSKIT_HOME))
OPENJCEPLUS_JCE_CLASSPATH := "$(call MixedPath,$(JDK_OUTPUTDIR)/modules/openjceplus)\;$(call MixedPath,$(JDK_OUTPUTDIR)/modules/java.base)"
OPENJCEPLUS_JGSKIT_MAKE := jgskit.win64.mak
OPENJCEPLUS_JGSKIT_PLATFORM := win64
endif
endif

ifeq (,$(OPENJCEPLUS_JGSKIT_PLATFORM))
$(error Unsupported platform $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU))
endif # OPENJCEPLUS_JGSKIT_PLATFORM

.PHONY : compile-libs

compile-libs :
@$(ECHO) Compiling OpenJCEPlus native code
export \
GSKIT_HOME=$(OPENJCEPLUS_GSKIT_HOME) \
JAVA_HOME=$(OPENJCEPLUS_BOOT_JDK) \
JCE_CLASSPATH=$(OPENJCEPLUS_JCE_CLASSPATH) \
PLATFORM=$(OPENJCEPLUS_JGSKIT_PLATFORM) \
&& $(MAKE) -j1 -C $(OPENJCEPLUS_JGSKIT_MAKE_PATH) -f $(OPENJCEPLUS_JGSKIT_MAKE) all
@$(ECHO) OpenJCEplus compile complete

TARGETS += compile-libs

endif # BUILD_OPENJCEPLUS
27 changes: 25 additions & 2 deletions get_source.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# ===========================================================================
# (c) Copyright IBM Corp. 2017, 2022 All Rights Reserved
# (c) Copyright IBM Corp. 2017, 2023 All Rights Reserved
# ===========================================================================
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -40,6 +40,13 @@ usage() {
echo " -omr-branch the OpenJ9/omr git branch: openj9"
echo " -omr-sha a commit SHA for the omr repository"
echo " -omr-reference a local repo to use as a clone reference"
echo " -openjceplus-repo the OpenJCEPlus repository url"
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 " -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 @@ -57,7 +64,23 @@ for i in "$@" ; do
usage
;;

-openj9-repo=* | -openj9-branch=* | -openj9-sha=* | -openj9-reference=* | -omr-repo=* | -omr-branch=* | -omr-sha=* | -omr-reference=* | -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
Loading