Refactored path parameters into a separate configuration file.

This commit is contained in:
LoRd_MuldeR 2020-10-03 19:28:18 +02:00
parent bf4172cd14
commit c9f6f428ef
7 changed files with 43 additions and 15 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
/*.html /*.html
/bin /bin
/build.cfg
/obj /obj
/out /out

View File

@ -48,6 +48,7 @@ Launch5j executables come in a number of variants, allowing you to pick the most
- [Oracle JDK (JavaSoft)](https://www.oracle.com/java/technologies/javase-downloads.html) - [Oracle JDK (JavaSoft)](https://www.oracle.com/java/technologies/javase-downloads.html)
- [AdoptOpenJDK](https://adoptopenjdk.net/) - [AdoptOpenJDK](https://adoptopenjdk.net/)
- [Liberica OpenJDK](https://bell-sw.com/) - [Liberica OpenJDK](https://bell-sw.com/)
- [Zulu OpenJDK](https://www.azul.com/downloads/zulu-community/)
Regarding the different available distributions of Java, please refer to this document: Regarding the different available distributions of Java, please refer to this document:
[*Java Is Still Free*](https://docs.google.com/document/d/1nFGazvrCvHMZJgFstlbzoHjpAVwv5DEdnaBr_5pKuHo/preview) [*Java Is Still Free*](https://docs.google.com/document/d/1nFGazvrCvHMZJgFstlbzoHjpAVwv5DEdnaBr_5pKuHo/preview)

4
build.EXAMPLE.cfg Normal file
View File

@ -0,0 +1,4 @@
MSYS2_DIR=C:\msys64
JAVA_HOME=C:\Program Files\BellSoft\LibericaJDK-8
ANT_HOME=C:\Program Files (x86)\Ant
PANDOC_DIR=C:\Program Files (x86)\Pandoc

View File

@ -2,10 +2,28 @@
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
cd /d "%~dp0" cd /d "%~dp0"
set "MSYS2_DIR=C:\msys64" REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set "JAVA_HOME=C:\Java\jdk-8.0.265.01-hotspot" REM Read configuration
set "ANT_HOME=C:\Program Files (x86)\Ant" REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set "PANDOC_DIR=C:\Program Files (x86)\Pandoc"
set MSYS2_DIR=
set JAVA_HOME=
set ANT_HOME=
set PANDOC_DIR=
if not exist "%~dp0.\build.cfg" (
echo Configuration file "build.cfg" not found. Please create^^!
pause
goto:eof
)
for /F "usebackq tokens=1,* delims==" %%a in ("%~dp0.\build.cfg") do (
set "%%~a=%%~b"
)
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Verify paths
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if not exist "%MSYS2_DIR%\msys2_shell.cmd" ( if not exist "%MSYS2_DIR%\msys2_shell.cmd" (
echo MSYS2 SHELL not found. Please check MSYS2_DIR and try again^^! echo MSYS2 SHELL not found. Please check MSYS2_DIR and try again^^!

View File

@ -6,7 +6,7 @@ REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Get current date REM Get current date
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set "ISO_DATE=" set ISO_DATE=
for /F "usebackq tokens=1" %%a in (`start /WAIT /B "" "%~dp0.\etc\utils\core-utils\date.exe" +"%%Y-%%m-%%d"`) do ( for /F "usebackq tokens=1" %%a in (`start /WAIT /B "" "%~dp0.\etc\utils\core-utils\date.exe" +"%%Y-%%m-%%d"`) do (
set "ISO_DATE=%%a" set "ISO_DATE=%%a"

View File

@ -48,7 +48,7 @@ END
// Version // Version
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#define L5J_VERSION_GLUE1(W,X,Y,Z) #W "." #X "." #Y "_r" #Z #define L5J_VERSION_GLUE1(W,X,Y,Z) #W "." #X "." #Y " [build " #Z "]"
#define L5J_VERSION_GLUE2(W,X,Y,Z) L5J_VERSION_GLUE1(W,X,Y,Z) #define L5J_VERSION_GLUE2(W,X,Y,Z) L5J_VERSION_GLUE1(W,X,Y,Z)
#define L5J_VERSION_STR L5J_VERSION_GLUE2(L5J_VERSION_MAJOR,L5J_VERSION_MINOR,L5J_VERSION_PATCH,L5J_BUILDNO) #define L5J_VERSION_STR L5J_VERSION_GLUE2(L5J_VERSION_MAJOR,L5J_VERSION_MINOR,L5J_VERSION_PATCH,L5J_BUILDNO)

View File

@ -285,21 +285,25 @@ static const wchar_t *url_encode_str(const CHAR *const input)
/* System information */ /* System information */
/* ======================================================================== */ /* ======================================================================== */
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE hProcess, PBOOL wow64Process);
static BOOL running_on_64bit(void) static BOOL running_on_64bit(void)
{ {
#ifndef _M_X64 #ifndef _M_X64
const HMODULE kernel32 = GetModuleHandleW(L"kernel32");
if (kernel32)
{
const LPFN_ISWOW64PROCESS ptr_is_wow64_process = (LPFN_ISWOW64PROCESS) GetProcAddress(kernel32,"IsWow64Process");
if (ptr_is_wow64_process)
{
BOOL is_wow64_flag = FALSE; BOOL is_wow64_flag = FALSE;
const LPFN_ISWOW64PROCESS is_wow64_process = (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandleW(L"kernel32"),"IsWow64Process"); if (ptr_is_wow64_process(GetCurrentProcess(), &is_wow64_flag))
if (is_wow64_process)
{ {
if (!is_wow64_process(GetCurrentProcess(), &is_wow64_flag))
{
is_wow64_flag = FALSE;
}
}
return is_wow64_flag; return is_wow64_flag;
}
}
}
return FALSE;
#else #else
return TRUE; return TRUE;
#endif #endif
@ -1007,7 +1011,7 @@ static const wchar_t *detect_java_runtime(const DWORD required_bitness, const UL
{ 1U, L"SOFTWARE\\JavaSoft\\Java Runtime Environment" }, { 1U, L"SOFTWARE\\JavaSoft\\JRE" }, { 2U, L"SOFTWARE\\AdoptOpenJDK\\JRE" }, { 1U, L"SOFTWARE\\JavaSoft\\Java Runtime Environment" }, { 1U, L"SOFTWARE\\JavaSoft\\JRE" }, { 2U, L"SOFTWARE\\AdoptOpenJDK\\JRE" },
{ 1U, L"SOFTWARE\\JavaSoft\\Java Development Kit" }, { 1U, L"SOFTWARE\\JavaSoft\\JDK" }, { 2U, L"SOFTWARE\\AdoptOpenJDK\\JDK" }, { 1U, L"SOFTWARE\\JavaSoft\\Java Development Kit" }, { 1U, L"SOFTWARE\\JavaSoft\\JDK" }, { 2U, L"SOFTWARE\\AdoptOpenJDK\\JDK" },
{ 3U, L"SOFTWARE\\BellSoft\\Liberica" }, { 3U, L"SOFTWARE\\BellSoft\\Liberica" },
{ 0U, NULL } { 3U, L"SOFTWARE\\Azul Systems\\Zulu" }, { 0U, NULL }
}; };
const wchar_t *runtime_path = NULL; const wchar_t *runtime_path = NULL;