Skip to content

Commit

Permalink
Fix Azure pipelines
Browse files Browse the repository at this point in the history
Previously all JAR files were installed in /usr/share/java/pki,
but since now pki-tools.jar uses JNI Maven might install it under
/usr/lib/java/pki depending on the build environment (which needs
further investigation).

To maintain consistency the CMake script has been modified to
install pki-tools.jar in /usr/lib/java/pki and create a link to
it in /usr/share/java/pki.

The RPM spec has been modified to check where pki-tools.jar is
installed and create a link at the other location.
  • Loading branch information
edewata committed Mar 3, 2025
1 parent d09271c commit c719935
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
15 changes: 14 additions & 1 deletion base/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,24 @@ jar(pki-tools-jar
add_dependencies(java pki-tools-jar)

if(WITH_JAVA)
# install pki-tools.jar in /usr/lib/java/pki
install(
FILES
${PKI_TOOLS_JAR}
DESTINATION
${JAVA_JAR_INSTALL_DIR}/pki
${JAVA_LIB_INSTALL_DIR}/pki
)

# create link to pki-tools.jar in /usr/share/java/pki
install(
CODE "
MESSAGE(
\"-- Installing: \$ENV{DESTDIR}${JAVA_JAR_INSTALL_DIR}/pki/pki-tools.jar\"
)
execute_process(
COMMAND ln -sf ../../../..${JAVA_LIB_INSTALL_DIR}/pki/pki-tools.jar \$ENV{DESTDIR}${JAVA_JAR_INSTALL_DIR}/pki
)
"
)
endif(WITH_JAVA)

Expand Down
20 changes: 16 additions & 4 deletions pki.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,20 @@ pkgs=base\
%if %{with maven}
# install Java binaries
%mvn_install

# Normally JAR files are installed in /usr/share/java/pki.
# Since pki-tools.jar uses JNI Maven might install it in /usr/lib/java/pki
# or /usr/share/java/pki depending on the build environment.
find %{buildroot} -name "*.jar"

# Create link to ensure pki-tools.jar is available at both locations.
if [ -e %{buildroot}%{_jnidir}/pki/pki-tools.jar ]; then
ln -sf ../../../..%{_jnidir}/pki/pki-tools.jar %{buildroot}%{_javadir}/pki
else
ln -sf ../../../..%{_javadir}/pki/pki-tools.jar %{buildroot}%{_jnidir}/pki
fi

# with maven
%endif

# install PKI console, Javadoc, and native binaries
Expand Down Expand Up @@ -1760,10 +1774,8 @@ fi
%{_mandir}/man1/PKCS10Client.1.gz
%{_mandir}/man1/PKICertImport.1.gz
%{_mandir}/man1/tpsclient.1.gz

%if %{without maven}
%{_datadir}/java/pki/pki-tools.jar
%endif
%{_javadir}/pki/pki-tools.jar
%{_jnidir}/pki/pki-tools.jar

# with base
%endif
Expand Down

0 comments on commit c719935

Please sign in to comment.