From 7912e0f32ba3c465cb564e4c17ab73effeebfefb Mon Sep 17 00:00:00 2001 From: swirl Date: Fri, 17 Dec 2021 12:52:13 -0500 Subject: [PATCH] Apply patches Re-add lin-system, and fix Linux datadir fix jar paths allow for modern java --- CMakeLists.txt | 20 ++++++++++++++++++-- launcher/Application.cpp | 12 +++++++++++- libraries/javacheck/CMakeLists.txt | 2 +- libraries/launcher/CMakeLists.txt | 2 +- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0a8c5ec..9e42e038 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,8 +140,8 @@ endif() ####################################### Install layout ####################################### # How to install the build results -set(Launcher_LAYOUT "auto" CACHE STRING "The layout for the launcher installation (auto, win-bundle, lin-nodeps, mac-bundle)") -set_property(CACHE Launcher_LAYOUT PROPERTY STRINGS auto win-bundle lin-nodeps mac-bundle) +set(Launcher_LAYOUT "auto" CACHE STRING "The layout for the launcher installation (auto, win-bundle, lin-nodeps, lin-system, mac-bundle)") +set_property(CACHE Launcher_LAYOUT PROPERTY STRINGS auto win-bundle lin-nodeps lin-system mac-bundle) if(Launcher_LAYOUT STREQUAL "auto") if(UNIX AND APPLE) @@ -206,6 +206,22 @@ elseif(Launcher_LAYOUT_REAL STREQUAL "lin-nodeps") configure_file(launcher/Launcher.in "${CMAKE_CURRENT_BINARY_DIR}/LauncherScript" @ONLY) install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/LauncherScript" DESTINATION ${BUNDLE_DEST_DIR} RENAME ${Launcher_Name}) +elseif(Launcher_LAYOUT_REAL STREQUAL "lin-system") + set(Launcher_APP_BINARY_NAME "devlauncher" CACHE STRING "Name of the Launcher binary") + set(Launcher_BINARY_DEST_DIR "bin" CACHE STRING "Path to the binary directory") + set(Launcher_LIBRARY_DEST_DIR "lib${LIB_SUFFIX}" CACHE STRING "Path to the library directory") + set(Launcher_SHARE_DEST_DIR "share/devlauncher" CACHE STRING "Path to the shard data directory") + set(JARS_DEST_DIR "${Launcher_SHARE_DEST_DIR}/jars") + + set(BINARY_DEST_DIR ${Launcher_BINARY_DEST_DIR}) + set(LIBRARY_DEST_DIR ${Launcher_LIBRARY_DEST_DIR}) + + MESSAGE(STATUS "Compiling for linux system with ${Launcher_SHARE_DEST_DIR} and LAUNCHER_LINUX_DATADIR") + SET(Launcher_APP_BINARY_DEFS "-DMULTIMC_JARS_LOCATION=${CMAKE_INSTALL_PREFIX}/${JARS_DEST_DIR}" "-DLAUNCHER_LINUX_DATADIR") + + # install as bundle with no dependencies included + set(INSTALL_BUNDLE "nodeps") + elseif(Launcher_LAYOUT_REAL STREQUAL "win-bundle") set(BINARY_DEST_DIR ".") set(LIBRARY_DEST_DIR ".") diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 2d0c81bb..c1849b4e 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -308,7 +308,13 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) } else { -#if defined(Q_OS_MAC) +#ifdef LAUNCHER_LINUX_DATADIR + QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME")); + if (xdgDataHome.isEmpty()) + xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); + dataPath = xdgDataHome + "/devlauncher"; + adjustedBy += "XDG standard " + dataPath; +#elif defined(Q_OS_MAC) QDir foo(FS::PathCombine(applicationDirPath(), "../../Data")); dataPath = foo.absolutePath(); adjustedBy += "Fallback to special Mac location " + dataPath; @@ -524,6 +530,10 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) FS::updateTimestamp(m_rootPath); #endif +#ifdef MULTIMC_JARS_LOCATION + m_jarsPath = TOSTRING(MULTIMC_JARS_LOCATION); +#endif + qDebug() << BuildConfig.LAUNCHER_DISPLAYNAME << ", (c) 2013-2021 " << BuildConfig.LAUNCHER_COPYRIGHT; qDebug() << "Version : " << BuildConfig.printableVersionString(); qDebug() << "Git commit : " << BuildConfig.GIT_COMMIT; diff --git a/libraries/javacheck/CMakeLists.txt b/libraries/javacheck/CMakeLists.txt index dba5a1ae..97a17f08 100644 --- a/libraries/javacheck/CMakeLists.txt +++ b/libraries/javacheck/CMakeLists.txt @@ -4,7 +4,7 @@ find_package(Java 1.6 REQUIRED COMPONENTS Development) include(UseJava) set(CMAKE_JAVA_JAR_ENTRY_POINT JavaCheck) -set(CMAKE_JAVA_COMPILE_FLAGS -target 1.6 -source 1.6 -Xlint:deprecation -Xlint:unchecked) +set(CMAKE_JAVA_COMPILE_FLAGS -target 8 -source 8 -Xlint:deprecation -Xlint:unchecked) set(SRC JavaCheck.java diff --git a/libraries/launcher/CMakeLists.txt b/libraries/launcher/CMakeLists.txt index a64c601d..8fb221b8 100644 --- a/libraries/launcher/CMakeLists.txt +++ b/libraries/launcher/CMakeLists.txt @@ -4,7 +4,7 @@ find_package(Java 1.6 REQUIRED COMPONENTS Development) include(UseJava) set(CMAKE_JAVA_JAR_ENTRY_POINT org.multimc.EntryPoint) -set(CMAKE_JAVA_COMPILE_FLAGS -target 1.6 -source 1.6 -Xlint:deprecation -Xlint:unchecked) +set(CMAKE_JAVA_COMPILE_FLAGS -target 8 -source 8 -Xlint:deprecation -Xlint:unchecked) set(SRC org/multimc/EntryPoint.java