Permalink
Browse files

NOISSUE add a linux system packaging install layout

  • Loading branch information...
peterix committed May 12, 2017
1 parent 4cf4110 commit 868669a497fd08524eec6d31ac483f431b95198c
View
@@ -3,11 +3,13 @@
#include "BaseVersion.h"
#include "BaseVersionList.h"
#include <QDir>
#include <QCoreApplication>
#include <QNetworkProxy>
#include <QNetworkAccessManager>
#include <QDebug>
#include "tasks/Task.h"
#include "meta/Index.h"
#include "FileSystem.h"
#include <QDebug>
@@ -19,6 +21,7 @@ class Env::Private
std::shared_ptr<IIconList> m_iconlist;
QMap<QString, std::shared_ptr<BaseVersionList>> m_versionLists;
shared_qobject_ptr<Meta::Index> m_metadataIndex;
QString m_jarsPath;
};
static Env * instance;
@@ -190,4 +193,18 @@ void Env::updateProxySettings(QString proxyTypeStr, QString addr, int port, QStr
qDebug() << proxyDesc;
}
QString Env::getJarsPath()
{
if(d->m_jarsPath.isEmpty())
{
return FS::PathCombine(QCoreApplication::applicationDirPath(), "jars");
}
return d->m_jarsPath;
}
void Env::setJarsPath(const QString& path)
{
d->m_jarsPath = path;
}
#include "Env.moc"
View
@@ -59,6 +59,8 @@ class MULTIMC_LOGIC_EXPORT Env
shared_qobject_ptr<Meta::Index> metadataIndex();
QString getJarsPath();
void setJarsPath(const QString & path);
protected:
Private * d;
};
@@ -7,13 +7,15 @@
#include <QCoreApplication>
#include <QDebug>
#include "Env.h"
JavaChecker::JavaChecker(QObject *parent) : QObject(parent)
{
}
void JavaChecker::performCheck()
{
QString checkerJar = FS::PathCombine(QCoreApplication::applicationDirPath(), "jars", "JavaCheck.jar");
QString checkerJar = FS::PathCombine(ENV.getJarsPath(), "JavaCheck.jar");
QStringList args;
@@ -19,6 +19,7 @@
#include <minecraft/MinecraftInstance.h>
#include <FileSystem.h>
#include <QStandardPaths>
#include "Env.h"
LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent)
{
@@ -43,7 +44,7 @@ void LauncherPartLaunch::executeTask()
// make detachable - this will keep the process running even if the object is destroyed
m_process.setDetachable(true);
args << "-jar" << FS::PathCombine(QCoreApplication::applicationDirPath(), "jars", "NewLaunch.jar");
args << "-jar" << FS::PathCombine(ENV.getJarsPath(), "NewLaunch.jar");
QString wrapperCommand = instance->getWrapperCommand();
if(!wrapperCommand.isEmpty())
View
@@ -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,22 +381,41 @@ 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/")
# 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
View
@@ -79,6 +79,9 @@
#include <stdio.h>
#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
{
@@ -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
@@ -1,11 +0,0 @@
Package: multimc
Version: 1.1-2
Architecture: all
Maintainer: Petr Mrázek <peterix@gmail.com>
Section: games
Priority: optional
Installed-Size: 75
Depends: zenity, default-jre
Homepage: http://multimc.org
Description: A local install wrapper for MultiMC
@@ -1,3 +0,0 @@
#!/bin/sh
set -e
update-desktop-database
Oops, something went wrong.

0 comments on commit 868669a

Please sign in to comment.