From 868669a497fd08524eec6d31ac483f431b95198c Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Sat, 13 May 2017 01:24:15 +0200 Subject: NOISSUE add a linux system packaging install layout --- application/CMakeLists.txt | 50 +- application/MultiMC.cpp | 19 +- application/package/linux/multimc.desktop | 11 + application/package/ubuntu/multimc/DEBIAN/control | 11 - application/package/ubuntu/multimc/DEBIAN/postrm | 3 - .../package/ubuntu/multimc/opt/multimc/icon.svg | 1993 -------------------- .../package/ubuntu/multimc/opt/multimc/run.sh | 33 - .../multimc/usr/share/applications/multimc.desktop | 16 - application/package/ubuntu/readme.md | 12 - 9 files changed, 64 insertions(+), 2084 deletions(-) create mode 100755 application/package/linux/multimc.desktop delete mode 100644 application/package/ubuntu/multimc/DEBIAN/control delete mode 100755 application/package/ubuntu/multimc/DEBIAN/postrm delete mode 100644 application/package/ubuntu/multimc/opt/multimc/icon.svg delete mode 100755 application/package/ubuntu/multimc/opt/multimc/run.sh delete mode 100755 application/package/ubuntu/multimc/usr/share/applications/multimc.desktop delete mode 100644 application/package/ubuntu/readme.md (limited to 'application') diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index 2ae8b1c5..9c1ca3cd 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -304,8 +304,8 @@ target_link_libraries(MultiMC MultiMC_gui ${QUAZIP_LIBRARIES} hoedown MultiMC_ra ######## Packaging/install paths setup ######## # How to install the build results -set(MultiMC_LAYOUT "auto" CACHE STRING "The layout for MultiMC installation (auto, win-bundle, lin-bundle, mac-bundle, lin-nodeps)") -set_property(CACHE MultiMC_LAYOUT PROPERTY STRINGS auto win-bundle lin-bundle mac-bundle lin-nodeps) +set(MultiMC_LAYOUT "auto" CACHE STRING "The layout for MultiMC installation (auto, win-bundle, lin-bundle, lin-nodeps, lin-system, mac-bundle)") +set_property(CACHE MultiMC_LAYOUT PROPERTY STRINGS auto win-bundle lin-bundle lin-nodeps lin-system mac-bundle) if(MultiMC_LAYOUT STREQUAL "auto") if(UNIX AND APPLE) @@ -326,6 +326,7 @@ if(MultiMC_LAYOUT_REAL STREQUAL "mac-bundle") set(LIBRARY_DEST_DIR "MultiMC.app/Contents/MacOS") set(PLUGIN_DEST_DIR "MultiMC.app/Contents/MacOS") set(RESOURCES_DEST_DIR "MultiMC.app/Contents/Resources") + set(JARS_DEST_DIR "MultiMC.app/Contents/MacOS") set(BUNDLE_DEST_DIR ".") @@ -346,7 +347,7 @@ if(MultiMC_LAYOUT_REAL STREQUAL "mac-bundle") set(DIRS ${QT_LIBS_DIR} ${QT_LIBEXECS_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) # install as bundle - set(INSTALL_BUNDLE TRUE) + set(INSTALL_BUNDLE "full") # Add the icon install(FILES resources/MultiMC.icns DESTINATION ${RESOURCES_DEST_DIR}) @@ -357,6 +358,7 @@ elseif(MultiMC_LAYOUT_REAL STREQUAL "lin-bundle") set(PLUGIN_DEST_DIR "plugins") set(BUNDLE_DEST_DIR ".") set(RESOURCES_DEST_DIR ".") + set(JARS_DEST_DIR "bin") # Apps to bundle set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/MultiMC") @@ -365,7 +367,7 @@ elseif(MultiMC_LAYOUT_REAL STREQUAL "lin-bundle") set(DIRS ${QT_LIBS_DIR} ${QT_LIBEXECS_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) # install as bundle - set(INSTALL_BUNDLE TRUE) + set(INSTALL_BUNDLE "full") # Set RPATH SET_TARGET_PROPERTIES(MultiMC PROPERTIES INSTALL_RPATH "$ORIGIN/") @@ -379,9 +381,10 @@ elseif(MultiMC_LAYOUT_REAL STREQUAL "lin-nodeps") set(PLUGIN_DEST_DIR "plugins") set(BUNDLE_DEST_DIR ".") set(RESOURCES_DEST_DIR ".") + set(JARS_DEST_DIR "bin") - # do not install as bundle - set(INSTALL_BUNDLE FALSE) + # install as bundle with no dependencies included + set(INSTALL_BUNDLE "nodeps") # Set RPATH SET_TARGET_PROPERTIES(MultiMC PROPERTIES INSTALL_RPATH "$ORIGIN/") @@ -389,12 +392,30 @@ elseif(MultiMC_LAYOUT_REAL STREQUAL "lin-nodeps") # Install basic runner script install(PROGRAMS package/linux/MultiMC DESTINATION ${BUNDLE_DEST_DIR}) +elseif(MultiMC_LAYOUT_REAL STREQUAL "lin-system") + set(MultiMC_BINARY_DEST_DIR "usr/bin" CACHE STRING "Relative path from packaging root to the binary directory") + set(MultiMC_LIBRARY_DEST_DIR "usr/lib" CACHE STRING "Relative path from packaging root to the library directory") + set(MultiMC_SHARE_DEST_DIR "usr/share/multimc5" CACHE STRING "Relative path from packaging root to the shared data directory") + set(JARS_DEST_DIR "${MultiMC_SHARE_DEST_DIR}") + + set(BINARY_DEST_DIR ${MultiMC_BINARY_DEST_DIR}) + set(LIBRARY_DEST_DIR ${MultiMC_LIBRARY_DEST_DIR}) + + MESSAGE(STATUS "Compiling for linux system with ${MultiMC_SHARE_DEST_DIR} and MULTIMC_LINUX_DATADIR") + set_target_properties(MultiMC PROPERTIES OUTPUT_NAME "multimc5") + target_compile_definitions(MultiMC PRIVATE "-DMULTIMC_JARS_LOCATION=/${MultiMC_SHARE_DEST_DIR}/jars" "-DMULTIMC_LINUX_DATADIR" + ) + + # install as bundle with no dependencies included + set(INSTALL_BUNDLE "nodeps") + elseif(MultiMC_LAYOUT_REAL STREQUAL "win-bundle") set(BINARY_DEST_DIR ".") set(LIBRARY_DEST_DIR ".") set(PLUGIN_DEST_DIR ".") set(BUNDLE_DEST_DIR ".") set(RESOURCES_DEST_DIR ".") + set(JARS_DEST_DIR ".") # Apps to bundle set(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.exe") @@ -403,7 +424,7 @@ elseif(MultiMC_LAYOUT_REAL STREQUAL "win-bundle") set(DIRS ${QT_LIBS_DIR} ${QT_LIBEXECS_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) # install as bundle - set(INSTALL_BUNDLE TRUE) + set(INSTALL_BUNDLE "full") else() message(FATAL_ERROR "No sensible install layout set.") endif() @@ -417,12 +438,11 @@ install(TARGETS MultiMC RUNTIME DESTINATION ${BINARY_DEST_DIR} COMPONENT Runtime ) -#### jars needed for testing java and launching Minecraft #### -install_jar(JavaCheck "${BINARY_DEST_DIR}/jars") -install_jar(NewLaunch "${BINARY_DEST_DIR}/jars") +install_jar(JavaCheck "${JARS_DEST_DIR}/jars") +install_jar(NewLaunch "${JARS_DEST_DIR}/jars") -#### Shared libraries and dependencies #### -if(NOT INSTALL_BUNDLE) +#### Dependency installations #### +if(INSTALL_BUNDLE STREQUAL "nodeps") # Just our own stuff # FIXME: this does not remove RPATH. install( @@ -437,7 +457,7 @@ if(NOT INSTALL_BUNDLE) DESTINATION ${LIBRARY_DEST_DIR} ) -else() +elseif(INSTALL_BUNDLE STREQUAL "full") # Add qt.conf - this makes Qt stop looking for things outside the bundle install( CODE "file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}/qt.conf\" \" \")" @@ -450,7 +470,7 @@ else() DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION ${PLUGIN_DEST_DIR} COMPONENT Runtime - REGEX "tga|tiff|mng" EXCLUDE + REGEX "tga|tiff|mng|webp" EXCLUDE ) # Icon engines install( @@ -472,7 +492,7 @@ else() DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION ${PLUGIN_DEST_DIR} COMPONENT Runtime - REGEX "tga|tiff|mng" EXCLUDE + REGEX "tga|tiff|mng|webp" EXCLUDE REGEX "d\\." EXCLUDE REGEX "_debug\\." EXCLUDE REGEX "\\.dSYM" EXCLUDE diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index 52755e84..495b14a0 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -79,6 +79,9 @@ #include #endif +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) + static const QLatin1String liveCheckFile("live.check"); using namespace Commandline; @@ -138,7 +141,7 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) parser.addShortOpt("version", 'V'); parser.addDocumentation("version", "display program version and exit."); // --dir - parser.addOption("dir", applicationDirPath()); + parser.addOption("dir"); parser.addShortOpt("dir", 'd'); parser.addDocumentation("dir", "use the supplied folder as MultiMC root instead of " "the binary location (use '.' for current)"); @@ -199,8 +202,19 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) } else { +#ifdef MULTIMC_LINUX_DATADIR + QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME")); + if (xdgDataHome.isEmpty()) + xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); + dataPath = xdgDataHome + "/multimc"; + printf("BLAH %s", xdgDataHome.toStdString().c_str()); + + adjustedBy += "XDG standard " + dataPath; + +#else dataPath = applicationDirPath(); adjustedBy += "Fallback to binary path " + dataPath; +#endif } if (!FS::ensureFolderPathExists(dataPath)) @@ -297,6 +311,9 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) { qDebug() << "ID of instance to launch : " << m_instanceIdToLaunch; } +#ifdef MULTIMC_JARS_LOCATION + ENV.setJarsPath( TOSTRING(MULTIMC_JARS_LOCATION) ); +#endif do // once { diff --git a/application/package/linux/multimc.desktop b/application/package/linux/multimc.desktop new file mode 100755 index 00000000..ad18381e --- /dev/null +++ b/application/package/linux/multimc.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Encoding=UTF-8 +Name=MultiMC +GenericName=Minecraft launcher +Comment=Free, open source launcher and instance manager for Minecraft. +Type=Application +Terminal=false +Exec=multimc +Icon=multimc +Categories=Application;Game diff --git a/application/package/ubuntu/multimc/DEBIAN/control b/application/package/ubuntu/multimc/DEBIAN/control deleted file mode 100644 index a0300e99..00000000 --- a/application/package/ubuntu/multimc/DEBIAN/control +++ /dev/null @@ -1,11 +0,0 @@ -Package: multimc -Version: 1.1-2 -Architecture: all -Maintainer: Petr Mrázek -Section: games -Priority: optional -Installed-Size: 75 -Depends: zenity, default-jre -Homepage: http://multimc.org -Description: A local install wrapper for MultiMC - diff --git a/application/package/ubuntu/multimc/DEBIAN/postrm b/application/package/ubuntu/multimc/DEBIAN/postrm deleted file mode 100755 index f9bbc8a7..00000000 --- a/application/package/ubuntu/multimc/DEBIAN/postrm +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -set -e -update-desktop-database diff --git a/application/package/ubuntu/multimc/opt/multimc/icon.svg b/application/package/ubuntu/multimc/opt/multimc/icon.svg deleted file mode 100644 index 178509ac..00000000 --- a/application/package/ubuntu/multimc/opt/multimc/icon.svg +++ /dev/null @@ -1,1993 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -