GP-1266: Upgrading YAJSW to 13.01-beta to support JDK 17

This commit is contained in:
Ryan Kurtz 2021-08-31 10:43:05 -04:00
parent c788a01228
commit 7e6eea065f
6 changed files with 62 additions and 52 deletions

View File

@ -55,8 +55,8 @@ You may not need all of these, depending on which portions you are building or d
- https://github.com/pxb1988/dex2jar/releases
* AXMLPrinter2
- https://code.google.com/archive/p/android4me/downloads
* Yet Another Java Service Wrapper. We use version 12.12 - Only to build Ghidra package.
- https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-12.12/
* Yet Another Java Service Wrapper. We use version 13.01 - Only to build Ghidra package.
- https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-beta-13.01/
* Eclipse PDE - Environment for developing the GhidraDev plugin.
- https://www.eclipse.org/pde/
* Eclipse CDT. We build against version 8.6.0 - Build dependency for the GhidraDev plugin.
@ -122,7 +122,7 @@ directory populated with the following files:
* flatRepo/dex-writer-2.0.jar
* GhidraDev/cdt-8.6.0.zip
* GhidraDev/PyDev 6.3.1.zip
* GhidraServer/yajsw-stable-12.12.zip
* GhidraServer/yajsw-beta-13.01.zip
* fidb/*.fidb
If you see these, congrats! Skip to [building](#building-ghidra) or [developing](#developing-ghidra). If not, continue with manual download
@ -163,14 +163,14 @@ curl -OL https://storage.googleapis.com/google-code-archive-downloads/v2/code.go
#### Get Dependencies for GhidraServer
Building the GhidraServer requires "Yet another Java service wrapper" (yajsw) version 12.12.
Download `yajsw-stable-12.12.zip` from their project on www.sourceforge.net, and place it in:
Building the GhidraServer requires "Yet another Java service wrapper" (yajsw) version 13.01.
Download `yajsw-beta-13.01.zip` from their project on www.sourceforge.net, and place it in:
`~/git/ghidra/dependencies/GhidraServer/`:
```bash
cd ~/Downloads # Or wherever
curl -OL https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-12.12/yajsw-stable-12.12.zip
cp ~/Downloads/yajsw-stable-12.12.zip ~/git/ghidra/dependencies/GhidraServer/
curl -OL https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-beta-13.01/yajsw-beta-13.01.zip
cp ~/Downloads/yajsw-beta-13.01.zip ~/git/ghidra/dependencies/GhidraServer/
```
#### Get Dependencies for GhidraDev

View File

@ -21,7 +21,7 @@ apply plugin: 'eclipse'
eclipse.project.name = 'Features GhidraServer'
def yajswRelease = "yajsw-stable-12.12"
def yajswRelease = "yajsw-beta-13.01"
configurations {
runGhidraServer
@ -42,15 +42,20 @@ CopySpec yajswCopySpec = copySpec {
// First check if the file is in the dependencies repo. If not, check in the bin repo.
def yajswZipTree = depsFile.exists() ? zipTree(depsFile) : zipTree(binRepoFile)
// In yajsw-beta-13.01.zip there is not a top level directory like there was in previous
// versions, so we need the "into". This is a bug which will be fixed in a future version,
// of yajsw, so for the next upgrade we'll likely need to get rid of the into and preface each
// include with a ${yajswRelease} like we used to do.
from(yajswZipTree) {
include "${yajswRelease}/lib/core/**"
include "${yajswRelease}/lib/extended/**"
include "${yajswRelease}/templates/**"
include "${yajswRelease}/*.jar"
include "${yajswRelease}/doc/**"
include "${yajswRelease}/LICENSE.txt"
include "${yajswRelease}/yajsw.policy.txt"
include "lib/core/**"
include "lib/extended/**"
include "templates/**"
include "*.jar"
include "doc/**"
include "LICENSE.txt"
include "yajsw.policy.txt"
}
into "${yajswRelease}"
}
// Unpack YAJSW archive into build/data for development use
task yajswDevUnpack(type:Copy) {

View File

@ -17,9 +17,6 @@ wrapper.java.umask=027
# Java Classpath
include=${classpath_frag}
# Java Library Path (location of native authentication support libraries)
wrapper.java.library.path.1=${os_dir}
# Java Additional Parameters
wrapper.java.additional.1=-Djava.net.preferIPv4Stack=true
@ -199,6 +196,12 @@ wrapper.logfile.maxsize=10m
# files are deleted. The default value of 0 implies no limit.
wrapper.logfile.maxfiles=10
#********************************************************************
# Service Wrapper Linux Properties
#********************************************************************
# Force initd (systemd had issues during testing on Ubuntu 21.04 with yajsw-13.00)
wrapper.daemon.system = initd
#********************************************************************
# Service Wrapper Windows Properties
#********************************************************************

View File

@ -180,7 +180,7 @@ EOF
checkInstall() {
# capture status text
RESULT=$(java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" os_dir="${OS_DIR}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -q "${WRAPPER_CONF}" | grep "Installed :" | sed -E "s/Installed : //")
RESULT=$(java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -q "${WRAPPER_CONF}" | grep "Installed :" | sed -E "s/Installed : //")
if [ "${RESULT}" = "true" ]; then
return 0
fi
@ -190,31 +190,31 @@ checkInstall() {
console() {
echo "Running ${APP_LONG_NAME}..."
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" os_dir="${OS_DIR}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -c "${WRAPPER_CONF}"
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -c "${WRAPPER_CONF}"
}
start() {
echo "Starting ${APP_LONG_NAME}..."
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" os_dir="${OS_DIR}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -t "${WRAPPER_CONF}"
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -t "${WRAPPER_CONF}"
}
stopit() {
echo "Stopping ${APP_LONG_NAME}..."
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" os_dir="${OS_DIR}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -p "${WRAPPER_CONF}"
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -p "${WRAPPER_CONF}"
}
install() {
echo "Installing ${APP_LONG_NAME}..."
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" os_dir="${OS_DIR}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -i "${WRAPPER_CONF}"
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -i "${WRAPPER_CONF}"
}
uninstall() {
echo "Uninstalling ${APP_LONG_NAME}..."
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" os_dir="${OS_DIR}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -r "${WRAPPER_CONF}"
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -r "${WRAPPER_CONF}"
}
status() {
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" os_dir="${OS_DIR}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -q "${WRAPPER_CONF}"
java="${JAVA_CMD}" ghidra_home="${GHIDRA_HOME}" classpath_frag="${CLASSPATH_FRAG}" "${JAVA_CMD}" -jar "${WRAPPER_HOME}/wrapper.jar" -q "${WRAPPER_CONF}"
}
case "$1" in

View File

@ -75,21 +75,23 @@ if exist "%SERVER_DIR%\..\Ghidra\" goto normal
rem NOTE: If adjusting JAVA command assignment - do not attempt to add parameters (e.g., -d64, -version:1.7, etc.)
rem NOTE: Variables that get accessed in server.conf must be lowercase
rem Development Environment
set "GHIDRA_HOME=%SERVER_DIR%\..\..\..\.."
set "ghidra_home=%SERVER_DIR%\..\..\..\.."
set "WRAPPER_CONF=%SERVER_DIR%\..\..\Common\server\server.conf"
set "DATA_DIR=%GHIDRA_HOME%\%MODULE_DIR%\build\data"
set "CLASSPATH_FRAG=%GHIDRA_HOME%\%MODULE_DIR%\build\dev-meta\classpath.frag"
set "LS_CPATH=%GHIDRA_HOME%\GhidraBuild\LaunchSupport\bin\main"
set "DATA_DIR=%ghidra_home%\%MODULE_DIR%\build\data"
set "classpath_frag=%ghidra_home%\%MODULE_DIR%\build\dev-meta\classpath.frag"
set "LS_CPATH=%ghidra_home%\GhidraBuild\LaunchSupport\bin\main"
goto lab1
:normal
set "GHIDRA_HOME=%SERVER_DIR%\.."
set "ghidra_home=%SERVER_DIR%\.."
set "WRAPPER_CONF=%SERVER_DIR%\server.conf"
set "DATA_DIR=%GHIDRA_HOME%\%MODULE_DIR%\data"
set "CLASSPATH_FRAG=%GHIDRA_HOME%\%MODULE_DIR%\data\classpath.frag"
set "LS_CPATH=%GHIDRA_HOME%\support\LaunchSupport.jar"
set "DATA_DIR=%ghidra_home%\%MODULE_DIR%\data"
set "classpath_frag=%ghidra_home%\%MODULE_DIR%\data\classpath.frag"
set "LS_CPATH=%ghidra_home%\support\LaunchSupport.jar"
:lab1
@ -109,16 +111,16 @@ echo Using service wrapper: %WRAPPER_DIRNAME%
rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA=java.exe
%JAVA% -version >NUL 2>&1
set java=java.exe
%java% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto lab2
set ERROR=ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
goto reportError
:findJavaFromJavaHome
set "JAVA=%JAVA_HOME%\bin\java.exe"
set "java=%JAVA_HOME%\bin\java.exe"
if exist "%JAVA%" goto lab2
if exist "%java%" goto lab2
set ERROR=ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
goto reportError
@ -126,40 +128,40 @@ goto reportError
:: Get the java that will be used to launch GhidraServer
set JAVA_HOME=
for /f "delims=*" %%i in ('call "%JAVA%" -cp "%LS_CPATH%" LaunchSupport "%GHIDRA_HOME%" -java_home') do set JAVA_HOME=%%i
for /f "delims=*" %%i in ('call "%java%" -cp "%LS_CPATH%" LaunchSupport "%ghidra_home%" -java_home') do set JAVA_HOME=%%i
if "%JAVA_HOME%" == "" (
set ERROR=Failed to find a supported Java runtime. Please refer to the Ghidra Installation Guide's Troubleshooting section.
goto reportError
)
rem reestablish JAVA path based upon final JAVA_HOME
set "JAVA=%JAVA_HOME%\bin\java.exe"
set "java=%JAVA_HOME%\bin\java.exe"
:: set DEBUG=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:18888
if "%OPTION%"=="console" (
start "%APP_LONG_NAME%" "%JAVA%" %DEBUG% -jar "%WRAPPER_HOME%/wrapper.jar" -c "%WRAPPER_CONF%"
start "%APP_LONG_NAME%" "%java%" %DEBUG% -jar "%WRAPPER_HOME%/wrapper.jar" -c "%WRAPPER_CONF%"
echo Use Ctrl-C in Ghidra Console to terminate...
) else if "%OPTION%"=="status" (
"%JAVA%" -jar "%WRAPPER_HOME%/wrapper.jar" -q "%WRAPPER_CONF%"
"%java%" -jar "%WRAPPER_HOME%/wrapper.jar" -q "%WRAPPER_CONF%"
) else if "%OPTION%"=="start" (
"%JAVA%" %DEBUG% -jar "%WRAPPER_HOME%/wrapper.jar" -t "%WRAPPER_CONF%"
"%java%" %DEBUG% -jar "%WRAPPER_HOME%/wrapper.jar" -t "%WRAPPER_CONF%"
) else if "%OPTION%"=="stop" (
"%JAVA%" -jar "%WRAPPER_HOME%/wrapper.jar" -p "%WRAPPER_CONF%"
"%java%" -jar "%WRAPPER_HOME%/wrapper.jar" -p "%WRAPPER_CONF%"
) else if "%OPTION%"=="restart" (
"%JAVA%" -jar "%WRAPPER_HOME%/wrapper.jar" -p "%WRAPPER_CONF%"
"%JAVA%" -jar "%WRAPPER_HOME%/wrapper.jar" -t "%WRAPPER_CONF%"
"%java%" -jar "%WRAPPER_HOME%/wrapper.jar" -p "%WRAPPER_CONF%"
"%java%" -jar "%WRAPPER_HOME%/wrapper.jar" -t "%WRAPPER_CONF%"
) else if "%OPTION%"=="install" (
"%JAVA%" -jar "%WRAPPER_HOME%/wrapper.jar" -i "%WRAPPER_CONF%"
"%JAVA%" -jar "%WRAPPER_HOME%/wrapper.jar" -t "%WRAPPER_CONF%"
"%java%" -jar "%WRAPPER_HOME%/wrapper.jar" -i "%WRAPPER_CONF%"
"%java%" -jar "%WRAPPER_HOME%/wrapper.jar" -t "%WRAPPER_CONF%"
) else if "%OPTION%"=="uninstall" (
"%JAVA%" -jar "%WRAPPER_HOME%/wrapper.jar" -r "%WRAPPER_CONF%"
"%java%" -jar "%WRAPPER_HOME%/wrapper.jar" -r "%WRAPPER_CONF%"
) else (
goto usage
@ -177,7 +179,7 @@ goto eof
echo.
echo %ERROR%
echo.
echo %ERROR% >> %GHIDRA_HOME%\wrapper.log
echo %ERROR% >> %ghidra_home%\wrapper.log
exit /B 1
:eof

View File

@ -68,9 +68,9 @@ ext.deps = [
destination: FLAT_REPO_DIR
],
[
name: 'yajsw-stable-12.12.zip',
url: 'https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-12.12/yajsw-stable-12.12.zip',
sha256: '1398fcb1e93abb19992c4fa06d7fe5758aabb4c45781d7ef306c6f57ca7a7321',
name: 'yajsw-beta-13.01.zip',
url: 'https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-beta-13.01/yajsw-beta-13.01.zip',
sha256: '430fb7901bd0fd52a5b90bd0cbd89e9d334077eb72a9b26896f465de1e593a99',
destination: file("${DEPS_DIR}/GhidraServer")
],
[