New port: games/multimc

MultiMC is a custom launcher for Minecraft that allows you to easily
manage multiple installations of Minecraft at once.  It also allows
you to easily install and remove mods by simply dragging and dropping.

WWW: https://multimc.org

PR:		224823
Submitted by:	tsundoku <me@tsundoku.ne.jp> (based on)
This commit is contained in:
Tobias Kortkamp 2018-06-06 15:54:57 +00:00
parent fd8a4a64da
commit 0ab76735dc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=471856
22 changed files with 456 additions and 0 deletions

View File

@ -674,6 +674,7 @@
SUBDIR += mt_gtk_client
SUBDIR += mtaserver
SUBDIR += mudmagic
SUBDIR += multimc
SUBDIR += mvdsv
SUBDIR += nInvaders
SUBDIR += nadar

38
games/multimc/Makefile Normal file
View File

@ -0,0 +1,38 @@
# $FreeBSD$
PORTNAME= multimc
DISTVERSION= 0.6.0
CATEGORIES= games java
MAINTAINER= me@tsundoku.ne.jp
COMMENT= Minecraft launcher with the ability to manage multiple instances
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/COPYING.md
RUN_DEPENDS= lwjgl>=2.9.3:games/lwjgl
USES= cmake:outsource compiler:c++14-lang
USE_GITHUB= yes
GH_ACCOUNT= MultiMC
GH_PROJECT= MultiMC5
GH_TUPLE= MultiMC:libnbtplusplus:4b305bb:libnbtplusplus/libraries/libnbtplusplus \
MultiMC:quazip:164acc3:quazip/libraries/quazip
USE_LDCONFIG= yes
USE_JAVA= 1.8+
USE_QT5= buildtools core concurrent gui network qmake testlib_build widgets xml
CMAKE_ARGS= -DMultiMC_LAYOUT="lin-system"
CMAKE_OFF= MultiMC_UPDATER
CXXFLAGS+= -Wno-inconsistent-missing-override \
-Wno-delete-non-virtual-dtor \
-DLWJGL_DIR='\"${LOCALBASE}/lib/lwjgl2.9.3\"'
post-patch:
@${REINPLACE_CMD} 's,usr/local,${PREFIX:S@^/@@},g' \
${WRKSRC}/application/CMakeLists.txt
post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libMultiMC_*.so
.include <bsd.port.mk>

7
games/multimc/distinfo Normal file
View File

@ -0,0 +1,7 @@
TIMESTAMP = 1514826359
SHA256 (MultiMC-MultiMC5-0.6.0_GH0.tar.gz) = ac458be99250d2a369ee805bf9560e396d0e0f16a95cc84c36eb0ef1e94a6374
SIZE (MultiMC-MultiMC5-0.6.0_GH0.tar.gz) = 1844862
SHA256 (MultiMC-libnbtplusplus-4b305bb_GH0.tar.gz) = 576391fb7aac44e8d8e2012f38b1f0bbb08cb9d0cd9104f162cfdee4b83e5627
SIZE (MultiMC-libnbtplusplus-4b305bb_GH0.tar.gz) = 47080
SHA256 (MultiMC-quazip-164acc3_GH0.tar.gz) = fb289ba497f2e315a8e85881ca78218f859d7a72f11463251cfb83271c4381b7
SIZE (MultiMC-quazip-164acc3_GH0.tar.gz) = 103454

View File

@ -0,0 +1,11 @@
--- CMakeLists.txt.orig 2017-12-18 00:19:43 UTC
+++ CMakeLists.txt
@@ -5,6 +5,8 @@ if(IS_IN_SOURCE_BUILD)
message(AUTHOR_WARNING "You are building MultiMC in-source. This is NOT recommended!")
endif()
+set(CMAKE_INSTALL_PREFIX "/")
+
if(WIN32)
# In Qt 5.1+ we have our own main() function, don't autolink to qtmain on Windows
cmake_policy(SET CMP0020 OLD)

View File

@ -0,0 +1,56 @@
--- api/gui/DesktopServices.cpp.orig 2017-12-18 00:19:43 UTC
+++ api/gui/DesktopServices.cpp
@@ -7,7 +7,7 @@
/**
* This shouldn't exist, but until QTBUG-9328 and other unreported bugs are fixed, it needs to be a thing.
*/
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
#include <unistd.h>
#include <errno.h>
@@ -83,7 +83,7 @@ bool openDirectory(const QString &path,
{
return QDesktopServices::openUrl(QUrl::fromLocalFile(dir.absolutePath()));
};
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined (Q_OS_FREEBSD)
return IndirectOpen(f);
#else
return f();
@@ -97,7 +97,7 @@ bool openFile(const QString &path)
{
return QDesktopServices::openUrl(QUrl::fromLocalFile(path));
};
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined (Q_OS_FREEBSD)
return IndirectOpen(f);
#else
return f();
@@ -107,7 +107,7 @@ bool openFile(const QString &path)
bool openFile(const QString &application, const QString &path, const QString &workingDirectory, qint64 *pid)
{
qDebug() << "Opening file" << path << "using" << application;
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined (Q_OS_FREEBSD)
// FIXME: the pid here is fake. So if something depends on it, it will likely misbehave
return IndirectOpen([&]()
{
@@ -121,7 +121,7 @@ bool openFile(const QString &application
bool run(const QString &application, const QStringList &args, const QString &workingDirectory, qint64 *pid)
{
qDebug() << "Running" << application << "with args" << args.join(' ');
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined (Q_OS_FREEBSD)
// FIXME: the pid here is fake. So if something depends on it, it will likely misbehave
return IndirectOpen([&]()
{
@@ -139,7 +139,7 @@ bool openUrl(const QUrl &url)
{
return QDesktopServices::openUrl(url);
};
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
return IndirectOpen(f);
#else
return f();

View File

@ -0,0 +1,11 @@
--- api/logic/FileSystem.cpp.orig 2017-12-18 00:19:43 UTC
+++ api/logic/FileSystem.cpp
@@ -407,7 +407,7 @@ QString getDesktopDir()
bool createShortCut(QString location, QString dest, QStringList args, QString name,
QString icon)
{
-#if defined Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
location = PathCombine(location, name + ".desktop");
QFile f(location);

View File

@ -0,0 +1,20 @@
--- api/logic/FileSystem_test.cpp.orig 2017-12-18 00:19:43 UTC
+++ api/logic/FileSystem_test.cpp
@@ -119,7 +119,7 @@ slots:
// this is only valid on linux
// FIXME: implement on windows, OSX, then test.
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
void test_createShortcut_data()
{
QTest::addColumn<QString>("location");
@@ -134,7 +134,7 @@ slots:
<< (QStringList() << "arg1" << "arg2")
<< "asdf"
<< QString()
- #if defined(Q_OS_LINUX)
+ #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
<< MULTIMC_GET_TEST_FILE("data/FileSystem-test_createShortcut-unix")
#elif defined(Q_OS_WIN)
<< QByteArray()

View File

@ -0,0 +1,29 @@
--- api/logic/java/JavaUtils.cpp.orig 2017-12-18 00:19:43 UTC
+++ api/logic/java/JavaUtils.cpp
@@ -81,7 +81,7 @@ QProcessEnvironment CleanEnviroment()
qDebug() << "Env: ignoring" << key << value;
continue;
}
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
// Do not pass LD_* variables to java. They were intended for MultiMC
if(key.startsWith("LD_"))
{
@@ -110,7 +110,7 @@ QProcessEnvironment CleanEnviroment()
qDebug() << "Env: " << key << value;
env.insert(key, value);
}
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
// HACK: Workaround for QTBUG42500
if(!env.contains("LD_LIBRARY_PATH"))
{
@@ -291,7 +291,7 @@ QList<QString> JavaUtils::FindJavaPaths(
return javas;
}
-#elif defined(Q_OS_LINUX)
+#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
QList<QString> JavaUtils::FindJavaPaths()
{
qDebug() << "Linux Java detection incomplete - defaulting to \"java\"";

View File

@ -0,0 +1,14 @@
--- api/logic/minecraft/MinecraftInstance.cpp.orig 2017-12-18 00:19:43 UTC
+++ api/logic/minecraft/MinecraftInstance.cpp
@@ -163,7 +163,11 @@ QString MinecraftInstance::binRoot() con
QString MinecraftInstance::getNativePath() const
{
+#if defined(Q_OS_FREEBSD)
+ QDir natives_dir(LWJGL_DIR "/");
+#else
QDir natives_dir(FS::PathCombine(instanceRoot(), "natives/"));
+#endif
return natives_dir.absolutePath();
}

View File

@ -0,0 +1,27 @@
--- api/logic/minecraft/OpSys.cpp.orig 2017-12-18 00:19:43 UTC
+++ api/logic/minecraft/OpSys.cpp
@@ -17,6 +17,8 @@
OpSys OpSys_fromString(QString name)
{
+ if (name == "freebsd")
+ return Os_FreeBSD;
if (name == "linux")
return Os_Linux;
if (name == "windows")
@@ -30,6 +32,8 @@ QString OpSys_toString(OpSys name)
{
switch (name)
{
+ case Os_FreeBSD:
+ return "freebsd";
case Os_Linux:
return "linux";
case Os_OSX:
@@ -39,4 +43,4 @@ QString OpSys_toString(OpSys name)
default:
return "other";
}
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,25 @@
--- api/logic/minecraft/OpSys.h.orig 2017-12-18 00:19:43 UTC
+++ api/logic/minecraft/OpSys.h
@@ -20,6 +20,7 @@ enum OpSys
Os_Windows,
Os_Linux,
Os_OSX,
+ Os_FreeBSD,
Os_Other
};
@@ -28,10 +29,10 @@ QString OpSys_toString(OpSys);
#ifdef Q_OS_WIN32
#define currentSystem Os_Windows
-#else
-#ifdef Q_OS_MAC
+#elif defined Q_OS_MAC
#define currentSystem Os_OSX
+#elif defined Q_OS_FREEBSD
+#define currentSystem Os_FreeBSD
#else
#define currentSystem Os_Linux
#endif
-#endif
\ No newline at end of file

View File

@ -0,0 +1,17 @@
--- api/logic/minecraft/launch/ExtractNatives.cpp.orig 2017-12-18 00:19:43 UTC
+++ api/logic/minecraft/launch/ExtractNatives.cpp
@@ -23,6 +23,14 @@
#include "FileSystem.h"
#include <QDir>
+//C library defines interfere with Java version check
+#ifdef major
+ #undef major
+#endif
+#ifdef minor
+ #undef minor
+#endif
+
static QString replaceSuffix (QString target, const QString &suffix, const QString &replacement)
{
if (!target.endsWith(suffix))

View File

@ -0,0 +1,62 @@
--- api/logic/minecraft/launch/PrintInstanceInfo.cpp.orig 2017-12-18 00:19:43 UTC
+++ api/logic/minecraft/launch/PrintInstanceInfo.cpp
@@ -24,6 +24,10 @@ void PrintInstanceInfo::executeTask()
auto instance = m_parent->instance();
auto lines = instance->verboseDescription(m_session);
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
+
+ char buff[512];
+
#ifdef Q_OS_LINUX
std::ifstream cpuin("/proc/cpuinfo");
for (std::string line; std::getline(cpuin, line);)
@@ -36,7 +40,6 @@ void PrintInstanceInfo::executeTask()
}
}
- char buff[512];
int gpuline = -1;
int cline = 0;
FILE *fp = popen("lspci -k", "r");
@@ -64,6 +67,40 @@ void PrintInstanceInfo::executeTask()
cline++;
}
}
+#elif defined(Q_OS_FREEBSD)
+
+ std::string strcard;
+
+ FILE *fp3 = popen("sysctl hw.model", "r");
+ if (fp3 != NULL)
+ {
+ fgets(buff, 512, fp3);
+ std::string str(buff);
+ QStringList clines = (QStringList() << QString::fromStdString(str.substr(10, std::string::npos)));
+ logLines(clines, MessageLevel::MultiMC);
+ }
+
+ FILE *fp4 = popen("pciconf -lv -a vgapci0", "r");
+ if (fp4 != NULL)
+ {
+ while (fgets(buff, 512, fp4) != NULL)
+ {
+ if (strncmp(buff, " vendor", 10) == 0)
+ {
+ std::string str(buff);
+ strcard.append(str.substr(str.find_first_of("'") + 1, str.find_last_not_of("'") - (str.find_first_of("'") + 2)));
+ strcard.append(" ");
+ }
+ else if (strncmp(buff, " device", 10) == 0)
+ {
+ std::string str2(buff);
+ strcard.append(str2.substr(str2.find_first_of("'") + 1, str2.find_last_not_of("'") - (str2.find_first_of("'") + 2)));
+ QStringList glines = (QStringList() << QString::fromStdString(strcard));
+ logLines(glines, MessageLevel::MultiMC);
+ }
+ }
+ }
+#endif
FILE *fp2 = popen("glxinfo", "r");
if (fp2 != NULL)

View File

@ -0,0 +1,10 @@
--- api/logic/minecraft/update/FMLLibrariesTask.h.orig 2018-06-03 04:17:36 UTC
+++ api/logic/minecraft/update/FMLLibrariesTask.h
@@ -1,6 +1,7 @@
#pragma once
#include "tasks/Task.h"
#include "net/NetJob.h"
+#include "minecraft/VersionFilterData.h"
class MinecraftInstance;
class FMLLibrariesTask : public Task

View File

@ -0,0 +1,31 @@
--- application/CMakeLists.txt.orig 2017-12-18 00:19:43 UTC
+++ application/CMakeLists.txt
@@ -27,11 +27,11 @@ set(MultiMC_PASTE_EE_API_KEY "" CACHE ST
set(MultiMC_ANALYTICS_ID "" CACHE STRING "ID you can get from Google analytics")
#### Check the current Git commit and branch
-include(GetGitRevisionDescription)
-get_git_head_revision(MultiMC_GIT_REFSPEC MultiMC_GIT_COMMIT)
+#include(GetGitRevisionDescription)
+#get_git_head_revision(MultiMC_GIT_REFSPEC MultiMC_GIT_COMMIT)
-message(STATUS "Git commit: ${MultiMC_GIT_COMMIT}")
-message(STATUS "Git refspec: ${MultiMC_GIT_REFSPEC}")
+#message(STATUS "Git commit: ${MultiMC_GIT_COMMIT}")
+#message(STATUS "Git refspec: ${MultiMC_GIT_REFSPEC}")
set(MultiMC_RELEASE_VERSION_NAME "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_HOTFIX}")
@@ -390,9 +390,9 @@ elseif(MultiMC_LAYOUT_REAL STREQUAL "lin
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/multimc" CACHE STRING "Relative path from packaging root to the shared data directory")
+ set(MultiMC_BINARY_DEST_DIR "usr/local/bin" CACHE STRING "Relative path from packaging root to the binary directory")
+ set(MultiMC_LIBRARY_DEST_DIR "usr/local/lib" CACHE STRING "Relative path from packaging root to the library directory")
+ set(MultiMC_SHARE_DEST_DIR "usr/local/share/multimc" CACHE STRING "Relative path from packaging root to the shared data directory")
set(MultiMC_APP_BINARY_NAME "multimc" CACHE STRING "Name of the MultiMC binary for the purposes of linux packaging")
set(JARS_DEST_DIR "${MultiMC_SHARE_DEST_DIR}")

View File

@ -0,0 +1,11 @@
--- application/MultiMC.cpp.orig 2017-12-18 00:19:43 UTC
+++ application/MultiMC.cpp
@@ -322,7 +322,7 @@ MultiMC::MultiMC(int &argc, char **argv)
// Set up paths
{
// Root path is used for updates.
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
QDir foo(FS::PathCombine(binPath, ".."));
m_rootPath = foo.absolutePath();
#elif defined(Q_OS_WIN32)

View File

@ -0,0 +1,11 @@
--- application/UpdateController.cpp.orig 2017-12-18 00:19:43 UTC
+++ application/UpdateController.cpp
@@ -90,7 +90,7 @@ void UpdateController::installUpdates()
qDebug() << "Installing updates.";
#ifdef Q_OS_WIN
QString finishCmd = QApplication::applicationFilePath();
-#elif defined Q_OS_LINUX
+#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
QString finishCmd = FS::PathCombine(m_root, "MultiMC");
#elif defined Q_OS_MAC
QString finishCmd = QApplication::applicationFilePath();

View File

@ -0,0 +1,8 @@
--- application/install_prereqs.cmake.in.orig 2017-12-18 00:19:43 UTC
+++ application/install_prereqs.cmake.in
@@ -23,5 +23,4 @@ set(gp_cmd_paths ${gp_cmd_paths}
)
include(BundleUtilities)
-fixup_bundle("@APPS@" "${QTPLUGINS}" "@DIRS@")

View File

@ -0,0 +1,11 @@
--- libraries/iconfix/internal/qiconloader.cpp.orig 2017-12-18 00:19:43 UTC
+++ libraries/iconfix/internal/qiconloader.cpp
@@ -320,7 +320,7 @@ Description: Make it so that the QIcon l
icon theme specification.
Bug: https://bugreports.qt.nokia.com/browse/QTBUG-12874
*********************************************************************/
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
/* Freedesktop standard says to look in /usr/share/pixmaps last */
if (entries.isEmpty())
{

View File

@ -0,0 +1,41 @@
--- libraries/systeminfo/src/sys_unix.cpp.orig 2017-12-18 00:19:43 UTC
+++ libraries/systeminfo/src/sys_unix.cpp
@@ -16,6 +16,7 @@ Sys::KernelInfo Sys::getKernelInfo()
uint64_t Sys::getSystemRam()
{
std::string token;
+ #ifdef Q_OS_LINUX
std::ifstream file("/proc/meminfo");
while(file >> token)
{
@@ -34,6 +35,19 @@ uint64_t Sys::getSystemRam()
// ignore rest of the line
file.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
+ #elif defined Q_OS_FREEBSD
+ char buff[512];
+ FILE *fp = popen("sysctl hw.physmem", "r");
+ if (fp != NULL)
+ {
+ while(fgets(buff, 512, fp) != NULL)
+ {
+ std::string str(buff);
+ uint64_t mem = std::stoull(str.substr(12, std::string::npos));
+ return mem * 1024ull;
+ }
+ }
+ #endif
return 0; // nothing found
}
@@ -43,7 +57,9 @@ bool Sys::isCPU64bit()
}
bool Sys::isSystem64bit()
-{
+{
+ #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
// kernel build arch on linux
return QSysInfo::currentCpuArchitecture() == "x86_64";
+ #endif
}

5
games/multimc/pkg-descr Normal file
View File

@ -0,0 +1,5 @@
MultiMC is a custom launcher for Minecraft that allows you to easily
manage multiple installations of Minecraft at once. It also allows
you to easily install and remove mods by simply dragging and dropping.
WWW: https://multimc.org

10
games/multimc/pkg-plist Normal file
View File

@ -0,0 +1,10 @@
bin/multimc
lib/libMultiMC_gui.so
lib/libMultiMC_iconfix.so
lib/libMultiMC_logic.so
lib/libMultiMC_nbt++.so
lib/libMultiMC_quazip.so
lib/libMultiMC_rainbow.so
lib/libMultiMC_unpack200.so
%%DATADIR%%/jars/JavaCheck.jar
%%DATADIR%%/jars/NewLaunch.jar