diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2018-03-29 20:36:21 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2018-03-29 20:56:40 +0200 |
commit | 2bc30a2ca0454d4c93ae8e7b88775b14dbe36841 (patch) | |
tree | daff1add65b197830cac4d00285b66a0f38d6abb /games-strategy/hedgewars | |
parent | sys-apps/sandbox: drop ~x86-fbsd keyword. (diff) | |
download | gentoo-2bc30a2ca0454d4c93ae8e7b88775b14dbe36841.tar.gz gentoo-2bc30a2ca0454d4c93ae8e7b88775b14dbe36841.tar.bz2 gentoo-2bc30a2ca0454d4c93ae8e7b88775b14dbe36841.zip |
games-strategy/hedgewars: Fix settings saving w/ Qt-5.9
Thanks-to: Quentin R. <gentoo@retornaz.com>
Closes: https://bugs.gentoo.org/651810
Package-Manager: Portage-2.3.26, Repoman-2.3.7
Diffstat (limited to 'games-strategy/hedgewars')
-rw-r--r-- | games-strategy/hedgewars/files/hedgewars-0.9.23-settings-saving.patch | 134 | ||||
-rw-r--r-- | games-strategy/hedgewars/hedgewars-0.9.23-r3.ebuild | 94 |
2 files changed, 228 insertions, 0 deletions
diff --git a/games-strategy/hedgewars/files/hedgewars-0.9.23-settings-saving.patch b/games-strategy/hedgewars/files/hedgewars-0.9.23-settings-saving.patch new file mode 100644 index 000000000000..3997ac37649b --- /dev/null +++ b/games-strategy/hedgewars/files/hedgewars-0.9.23-settings-saving.patch @@ -0,0 +1,134 @@ +From f8e302e5ac5033c1b7ac5d83d6d8df3f15eb6178 Mon Sep 17 00:00:00 2001 +From: Wuzzy <Wuzzy2@mail.ru> +Date: Tue, 27 Mar 2018 17:32:23 +0200 +Subject: [PATCH] Fix team files and settings not saving properly, and remove + FileEngine stuff from DLC + +This is done by using absolute paths and removing physfs:// +--- + QTfrontend/game.cpp | 4 ++-- + QTfrontend/team.cpp | 10 +++++----- + QTfrontend/ui/page/pagedata.cpp | 6 ------ + QTfrontend/util/DataManager.cpp | 4 ++-- + 4 files changed, 9 insertions(+), 15 deletions(-) + +diff --git a/QTfrontend/game.cpp b/QTfrontend/game.cpp +index 224c38350..f071ef734 100644 +--- a/QTfrontend/game.cpp ++++ b/QTfrontend/game.cpp +@@ -536,7 +536,7 @@ void HWGame::abort() + void HWGame::sendCampaignVar(const QByteArray &varToSend) + { + QString varToFind = QString::fromUtf8(varToSend); +- QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0); ++ QSettings teamfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0); + teamfile.setIniCodec("UTF-8"); + QString varValue = teamfile.value("Campaign " + campaign + "/" + varToFind, "").toString(); + QByteArray command; +@@ -553,7 +553,7 @@ void HWGame::writeCampaignVar(const QByteArray & varVal) + QString varToWrite = QString::fromUtf8(varVal.left(i)); + QString varValue = QString::fromUtf8(varVal.mid(i + 1)); + +- QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0); ++ QSettings teamfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(campaignTeam), QSettings::IniFormat, 0); + teamfile.setIniCodec("UTF-8"); + teamfile.setValue("Campaign " + campaign + "/" + varToWrite, varValue); + } +diff --git a/QTfrontend/team.cpp b/QTfrontend/team.cpp +index 0586e622a..740697b7f 100644 +--- a/QTfrontend/team.cpp ++++ b/QTfrontend/team.cpp +@@ -171,7 +171,7 @@ HWTeam & HWTeam::operator = (const HWTeam & other) + + bool HWTeam::loadFromFile() + { +- QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name)), QSettings::IniFormat, 0); ++ QSettings teamfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name)), QSettings::IniFormat, 0); + teamfile.setIniCodec("UTF-8"); + m_name = teamfile.value("Team/Name", m_name).toString(); + m_grave = teamfile.value("Team/Grave", "Statue").toString(); +@@ -204,7 +204,7 @@ bool HWTeam::loadFromFile() + + bool HWTeam::fileExists() + { +- QFile f(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name))); ++ QFile f(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name))); + return f.exists(); + } + +@@ -220,7 +220,7 @@ bool HWTeam::deleteFile() + { + if(m_isNetTeam) + return false; +- QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name))); ++ QFile cfgfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name))); + cfgfile.remove(); + return true; + } +@@ -229,12 +229,12 @@ bool HWTeam::saveToFile() + { + if (OldTeamName != m_name) + { +- QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(OldTeamName))); ++ QFile cfgfile(QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(OldTeamName))); + cfgfile.remove(); + OldTeamName = m_name; + } + +- QString fileName = QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name)); ++ QString fileName = QString(cfgdir->absolutePath() + "/Teams/%1.hwt").arg(DataManager::safeFileName(m_name)); + DataManager::ensureFileExists(fileName); + QSettings teamfile(fileName, QSettings::IniFormat, 0); + teamfile.setIniCodec("UTF-8"); +diff --git a/QTfrontend/ui/page/pagedata.cpp b/QTfrontend/ui/page/pagedata.cpp +index ccdea5ac4..cc7d17b2a 100644 +--- a/QTfrontend/ui/page/pagedata.cpp ++++ b/QTfrontend/ui/page/pagedata.cpp +@@ -31,8 +31,6 @@ + #include "pagedata.h" + #include "databrowser.h" + #include "hwconsts.h" +-#include "DataManager.h" +-#include "FileEngine.h" + + QLayout * PageDataDownload::bodyLayoutDefinition() + { +@@ -197,9 +195,6 @@ void PageDataDownload::fileDownloaded() + out.write(reply->readAll()); + + out.close(); +- +- // now mount it +- FileEngineHandler::mount(fileName); + } + } + +@@ -229,7 +224,6 @@ void PageDataDownload::onPageLeave() + if (m_contentDownloaded) + { + m_contentDownloaded = false; +- //DataManager::instance().reload(); + } + } + +diff --git a/QTfrontend/util/DataManager.cpp b/QTfrontend/util/DataManager.cpp +index 3d69931cf..5c8aa4cc5 100644 +--- a/QTfrontend/util/DataManager.cpp ++++ b/QTfrontend/util/DataManager.cpp +@@ -172,11 +172,11 @@ QString DataManager::settingsFileName() + { + if(m_settingsFileName.isEmpty()) + { +- QFile settingsFile("physfs://settings.ini"); ++ QFile settingsFile(cfgdir->absoluteFilePath("settings.ini")); + + if(!settingsFile.exists()) + { +- QFile oldSettingsFile("physfs://hedgewars.ini"); ++ QFile oldSettingsFile(cfgdir->absoluteFilePath("hedgewars.ini")); + + settingsFile.open(QFile::WriteOnly); + settingsFile.close(); +-- +2.16.1 + diff --git a/games-strategy/hedgewars/hedgewars-0.9.23-r3.ebuild b/games-strategy/hedgewars/hedgewars-0.9.23-r3.ebuild new file mode 100644 index 000000000000..2c30a518ab04 --- /dev/null +++ b/games-strategy/hedgewars/hedgewars-0.9.23-r3.ebuild @@ -0,0 +1,94 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +CMAKE_MAKEFILE_GENERATOR=emake +inherit cmake-utils desktop xdg-utils + +MY_P=${PN}-src-${PV} +DEB_PATCH_VER=7 + +DESCRIPTION="A turn-based strategy, artillery, action and comedy game" +HOMEPAGE="https://www.hedgewars.org/" +SRC_URI="https://www.hedgewars.org/download/releases/${MY_P}.tar.bz2 + mirror://debian/pool/main/h/${PN}/${PN}_0.9.22-dfsg-${DEB_PATCH_VER}.debian.tar.xz" + +LICENSE="GPL-2 Apache-2.0 FDL-1.3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="libav" + +QA_FLAGS_IGNORED="/usr/bin/hwengine" # pascal sucks +QA_PRESTRIPPED="/usr/bin/hwengine" # pascal sucks + +# qtcore:5= - depends on private header +CDEPEND=" + >=dev-games/physfs-3.0.1 + dev-lang/lua:0= + dev-qt/qtcore:5= + dev-qt/qtgui:5 + dev-qt/qtnetwork:5 + dev-qt/qtwidgets:5 + media-libs/libpng:0= + media-libs/libsdl2:= + media-libs/sdl2-image:= + media-libs/sdl2-mixer:=[vorbis] + media-libs/sdl2-net:= + media-libs/sdl2-ttf:= + sys-libs/zlib:= + libav? ( media-video/libav:= ) + !libav? ( media-video/ffmpeg:= )" +DEPEND="${CDEPEND} + >=dev-lang/fpc-2.4 + dev-qt/linguist-tools:5" +RDEPEND="${CDEPEND} + app-arch/xz-utils + >=media-fonts/dejavu-2.28 + media-fonts/wqy-zenhei" + +S="${WORKDIR}"/${MY_P} + +PATCHES=( + "${FILESDIR}"/${PN}-0.9.22-rpath-fix.patch + "${FILESDIR}"/${P}-qt5-{1,2}.patch # bug 645504 + "${FILESDIR}"/${P}-settings-saving.patch # bug 651810 +) + +src_configure() { + local mycmakeargs=( + -DMINIMAL_FLAGS=ON + -DDATA_INSTALL_DIR="${EPREFIX}/usr/share/${PN}" + -Dtarget_binary_install_dir="${EPREFIX}/usr/bin" + -Dtarget_library_install_dir="${EPREFIX}/usr/$(get_libdir)" + -DNOSERVER=TRUE + -DCMAKE_VERBOSE_MAKEFILE=TRUE + -DPHYSFS_SYSTEM=ON + # Need to tell the build system where the fonts are located + # as it uses PhysFS' symbolic link protection mode which + # prevents us from symlinking the fonts into the right directory + # https://hg.hedgewars.org/hedgewars/rev/76ad55807c24 + # https://icculus.org/physfs/docs/html/physfs_8h.html#aad451d9b3f46f627a1be8caee2eef9b7 + -DFONTS_DIRS="${EPREFIX}/usr/share/fonts/wqy-zenhei;${EPREFIX}/usr/share/fonts/dejavu" + # upstream sets RPATH that leads to weird breakage + # https://bugzilla.redhat.com/show_bug.cgi?id=1200193 + -DCMAKE_SKIP_RPATH=ON + ) + cmake-utils_src_configure +} + +src_install() { + cmake-utils_src_install + + doicon misc/hedgewars.png + make_desktop_entry ${PN} Hedgewars + doman man/${PN}.6 +} + +pkg_postinst() { + xdg_desktop_database_update +} + +pkg_postrm() { + xdg_desktop_database_update +} |