Skip to content

Commit

Permalink
Update according to code review
Browse files Browse the repository at this point in the history
  • Loading branch information
taoliult committed Oct 12, 2023
1 parent 238e144 commit 8207f72
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 168 deletions.
71 changes: 0 additions & 71 deletions closed/Components.gmk

This file was deleted.

57 changes: 9 additions & 48 deletions closed/autoconf/custom-hook.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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)
])
4 changes: 1 addition & 3 deletions closed/autoconf/custom-spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@
42 changes: 0 additions & 42 deletions closed/custom/Main-pre.gmk

This file was deleted.

22 changes: 20 additions & 2 deletions closed/custom/Main.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion closed/custom/common/Modules.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions closed/get_j9_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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#*=}"
;;
Expand Down Expand Up @@ -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"

Expand Down
5 changes: 4 additions & 1 deletion get_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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}"
;;

Expand Down

0 comments on commit 8207f72

Please sign in to comment.