git: 2e217b7dc6ae - main - x11/plasma5-plasma-workspace: Restore a patch for kcm_regionandlang.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Aug 2023 07:43:11 UTC
The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/ports/commit/?id=2e217b7dc6ae43089fcccd7783ae900ae78f98df commit 2e217b7dc6ae43089fcccd7783ae900ae78f98df Author: Gleb Popov <arrowd@FreeBSD.org> AuthorDate: 2023-08-18 07:42:04 +0000 Commit: Gleb Popov <arrowd@FreeBSD.org> CommitDate: 2023-08-18 07:43:08 +0000 x11/plasma5-plasma-workspace: Restore a patch for kcm_regionandlang. Sponsored by: Serenity Cybersecurity, LLC --- x11/plasma5-plasma-workspace/Makefile | 1 + .../files/patch-regionandlang | 322 +++++++++++++++++++++ 2 files changed, 323 insertions(+) diff --git a/x11/plasma5-plasma-workspace/Makefile b/x11/plasma5-plasma-workspace/Makefile index 684e7fec59eb..f0d6fb6851ec 100644 --- a/x11/plasma5-plasma-workspace/Makefile +++ b/x11/plasma5-plasma-workspace/Makefile @@ -1,5 +1,6 @@ PORTNAME= plasma-workspace DISTVERSION= ${KDE_PLASMA_VERSION} +PORTREVISION= 1 CATEGORIES= x11 kde kde-plasma MAINTAINER= kde@FreeBSD.org diff --git a/x11/plasma5-plasma-workspace/files/patch-regionandlang b/x11/plasma5-plasma-workspace/files/patch-regionandlang new file mode 100644 index 000000000000..23113c2e722d --- /dev/null +++ b/x11/plasma5-plasma-workspace/files/patch-regionandlang @@ -0,0 +1,322 @@ +From 6fff5ebf2eb9ec2def4f7b5f0569b48c36061844 Mon Sep 17 00:00:00 2001 +From: Gleb Popov <6yearold@gmail.com> +Date: Fri, 28 Jul 2023 10:59:40 +0300 +Subject: [PATCH 1/2] Rename REGION_LANG_GENERATE_LOCALE to + REGION_LANG_GENERATE_LOCALE_HELPER + +(cherry picked from commit 09d0b42a9) +--- + CMakeLists.txt | 6 +++--- + kcms/region_language/CMakeLists.txt | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt CMakeLists.txt +index afd3bdcf22..54da6be721 100644 +--- a/CMakeLists.txt ++++ CMakeLists.txt +@@ -253,19 +253,19 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(GLIBC_LOCALE TRUE) + endif() + if(UBUNTU_PACKAGEKIT OR GLIBC_LOCALE_GEN) +- set(REGION_LANG_GENERATE_LOCALE TRUE) ++ set(REGION_LANG_GENERATE_LOCALE_HELPER TRUE) + endif() + + option(GLIBC_LOCALE_GENERATED "Systems that don't require locale generation. Such as openSUSE or Fedora" OFF) + if(GLIBC_LOCALE_GENERATED) + set(LOCALE_GENERATED TRUE) + endif() +- if(REGION_LANG_GENERATE_LOCALE AND GLIBC_LOCALE_GENERATED) ++ if(REGION_LANG_GENERATE_LOCALE_HELPER AND GLIBC_LOCALE_GENERATED) + message(FATAL_ERROR "(UBUNTU_PACKAGEKIT || GLIBC_LOCALE_GEN) and GLIBC_LOCALE_GENERATED both enabled") + endif() + + ################## Find libraries ################### +- if(REGION_LANG_GENERATE_LOCALE) ++ if(REGION_LANG_GENERATE_LOCALE_HELPER) + find_package(PolkitQt${QT_MAJOR_VERSION}-1) + set_package_properties(PolkitQt${QT_MAJOR_VERSION}-1 + PROPERTIES DESCRIPTION "DBus interface wrapper for Polkit" +diff --git a/kcms/region_language/CMakeLists.txt kcms/region_language/CMakeLists.txt +index d134937b77..56ccec7cba 100644 +--- a/kcms/region_language/CMakeLists.txt ++++ kcms/region_language/CMakeLists.txt +@@ -47,7 +47,7 @@ ecm_qt_declare_logging_category( + ) + + ################ Build helper and add additional source files ############# +-if(REGION_LANG_GENERATE_LOCALE) ++if(REGION_LANG_GENERATE_LOCALE_HELPER) + add_subdirectory("localegenhelper") + qt_generate_dbus_interface( + ${CMAKE_CURRENT_SOURCE_DIR}/localegenhelper/localegenhelper.h +-- +GitLab + + +From 0d53975b637620cc7619a67df3397fd43f710eba Mon Sep 17 00:00:00 2001 +From: Gleb Popov <6yearold@gmail.com> +Date: Mon, 26 Jun 2023 08:46:23 +0300 +Subject: [PATCH 2/2] region_language KCM: Guard glibc-related code with + ifdefs. + +This introduces GLIBC_LOCALE_AUTO and GLIBC_LOCALE_GENERATED to differentiate +between Linux distributions. The GLIBC_LOCALE define is set for both cases. + +The change unbreaks the KCM on FreeBSD. + +Sponsored by: Serenity Cybersecurity, LLC + +(cherry picked from commit e8eabb689f82f99a362b6860915a8269b8e1268c) +--- + CMakeLists.txt | 14 +++++++------- + config-workspace.h.cmake | 8 ++++++-- + kcms/region_language/kcmregionandlang.cpp | 16 ++++++++++++++-- + kcms/region_language/kcmregionandlang.h | 7 +++++++ + kcms/region_language/languagelistmodel.cpp | 6 ++++++ + kcms/region_language/localegenerator.cpp | 6 +++--- + 6 files changed, 43 insertions(+), 14 deletions(-) + +diff --git a/CMakeLists.txt CMakeLists.txt +index 54da6be721..af371f8455 100644 +--- a/CMakeLists.txt ++++ CMakeLists.txt +@@ -209,7 +209,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + # + # For Glibc systems that come with pre-generated locales, such as Fedora and openSUSE + # a note to let user install fonts themselves if required is displayed +- # You should enable GLIBC_LOCALE_GENERATED option ++ # You should enable GLIBC_LOCALE_PREGENERATED option + # + # For non-glibc systems such as VoidLinux and *BSD + # A warning of configure locale manually is displayed (although the relevant ENVs are set by Plasma) +@@ -250,18 +250,18 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + message(FATAL_ERROR "UBUNTU_PACKAGEKIT and GLIBC_LOCALE_GEN both enabled, only UBUNTU_PACKEGKIT will be used") + endif() + if(GLIBC_LOCALE_GEN) +- set(GLIBC_LOCALE TRUE) ++ set(GLIBC_LOCALE_AUTO TRUE) + endif() + if(UBUNTU_PACKAGEKIT OR GLIBC_LOCALE_GEN) + set(REGION_LANG_GENERATE_LOCALE_HELPER TRUE) + endif() + +- option(GLIBC_LOCALE_GENERATED "Systems that don't require locale generation. Such as openSUSE or Fedora" OFF) +- if(GLIBC_LOCALE_GENERATED) +- set(LOCALE_GENERATED TRUE) ++ option(GLIBC_LOCALE_PREGENERATED "Systems that don't require locale generation. Such as openSUSE or Fedora" OFF) ++ if(GLIBC_LOCALE_PREGENERATED) ++ set(GLIBC_LOCALE_GENERATED TRUE) + endif() +- if(REGION_LANG_GENERATE_LOCALE_HELPER AND GLIBC_LOCALE_GENERATED) +- message(FATAL_ERROR "(UBUNTU_PACKAGEKIT || GLIBC_LOCALE_GEN) and GLIBC_LOCALE_GENERATED both enabled") ++ if(REGION_LANG_GENERATE_LOCALE_HELPER AND GLIBC_LOCALE_PREGENERATED) ++ message(FATAL_ERROR "(UBUNTU_PACKAGEKIT || GLIBC_LOCALE_GEN) and GLIBC_LOCALE_PREGENERATED both enabled") + endif() + + ################## Find libraries ################### +diff --git a/config-workspace.h.cmake config-workspace.h.cmake +index d7cf5fe7ed..b696cd8fa5 100644 +--- a/config-workspace.h.cmake ++++ config-workspace.h.cmake +@@ -12,5 +12,9 @@ + #define WORKSPACE_VERSION_STRING "${PROJECT_VERSION}" + + #cmakedefine OS_UBUNTU 1 +-#cmakedefine GLIBC_LOCALE 1 +-#cmakedefine LOCALE_GENERATED 1 ++#cmakedefine01 GLIBC_LOCALE_AUTO ++#cmakedefine01 GLIBC_LOCALE_GENERATED ++ ++#if defined(GLIBC_LOCALE_AUTO) || defined(GLIBC_LOCALE_GENERATED) ++#define GLIBC_LOCALE ++#endif +diff --git a/kcms/region_language/kcmregionandlang.cpp kcms/region_language/kcmregionandlang.cpp +index 9e99466a40..364b8767cd 100644 +--- a/kcms/region_language/kcmregionandlang.cpp ++++ kcms/region_language/kcmregionandlang.cpp +@@ -2,10 +2,11 @@ + kcmregionandlang.cpp + SPDX-FileCopyrightText: 2014 Sebastian Kügler <sebas@kde.org> + SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com> ++ SPDX-FileCopyrightText: 2023 Serenity Cybersecurity, LLC <license@futurecrew.ru> ++ Author: Gleb Popov <arrowd@FreeBSD.org> + + SPDX-License-Identifier: GPL-2.0-or-later + */ +-#include "config-workspace.h" + + #include "kcmregionandlang.h" + +@@ -60,6 +61,7 @@ KCMRegionAndLang::KCMRegionAndLang(QObject *parent, const KPluginMetaData &data, + qRegisterMetaType<KCM_RegionAndLang::SettingType>(); + qmlRegisterUncreatableMetaObject(KCM_RegionAndLang::staticMetaObject, "kcmregionandlang", 1, 0, "SettingType", "Error: SettingType is an enum"); + ++#ifdef GLIBC_LOCALE_GENERATED + // fedora pre generate locales, fetch available locales from localectl. /usr/share/i18n/locales is empty in fedora + QDir glibcLocaleDir(localeFileDirPath()); + if (glibcLocaleDir.isEmpty()) { +@@ -80,6 +82,9 @@ KCMRegionAndLang::KCMRegionAndLang(QObject *parent, const KPluginMetaData &data, + } else { + m_enabled = true; + } ++#else ++ m_enabled = true; ++#endif + } + + QString KCMRegionAndLang::failedFindLocalesMessage() +@@ -124,6 +129,7 @@ void KCMRegionAndLang::save() + if (!settings()->isDefaultSetting(SettingType::PhoneNumbers)) { + locales.append(settings()->phoneNumbers()); + } ++#ifdef GLIBC_LOCALE + if (!settings()->language().isEmpty()) { + QStringList languages = settings()->language().split(QLatin1Char(':')); + for (const QString &lang : languages) { +@@ -133,6 +139,7 @@ void KCMRegionAndLang::save() + } + } + } ++#endif + + auto setLangCall = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.Accounts"), + QStringLiteral("/org/freedesktop/Accounts/User%1").arg(getuid()), +@@ -214,7 +221,7 @@ bool KCMRegionAndLang::isGlibc() + { + #ifdef OS_UBUNTU + return true; +-#elif GLIBC_LOCALE ++#elif defined(GLIBC_LOCALE) + return true; + #else + return false; +@@ -226,6 +233,7 @@ bool KCMRegionAndLang::enabled() const + return m_enabled; + } + ++#ifdef GLIBC_LOCALE + std::optional<QString> KCMRegionAndLang::toGlibcLocale(const QString &lang) + { + static std::unordered_map<QString, QString> map = constructGlibcLocaleMap(); +@@ -235,6 +243,7 @@ std::optional<QString> KCMRegionAndLang::toGlibcLocale(const QString &lang) + } + return std::nullopt; + } ++#endif + + QString KCMRegionAndLang::toUTF8Locale(const QString &locale) + { +@@ -252,6 +261,7 @@ QString KCMRegionAndLang::toUTF8Locale(const QString &locale) + return locale + QLatin1String(".UTF-8"); + } + ++#ifdef GLIBC_LOCALE + std::unordered_map<QString, QString> KCMRegionAndLang::constructGlibcLocaleMap() + { + std::unordered_map<QString, QString> localeMap; +@@ -338,5 +348,7 @@ std::unordered_map<QString, QString> KCMRegionAndLang::constructGlibcLocaleMap() + } + return localeMap; + } ++#endif ++ + #include "kcmregionandlang.moc" + #include "moc_kcmregionandlang.cpp" +diff --git a/kcms/region_language/kcmregionandlang.h kcms/region_language/kcmregionandlang.h +index bdf9d19dbb..4649983b03 100644 +--- a/kcms/region_language/kcmregionandlang.h ++++ kcms/region_language/kcmregionandlang.h +@@ -2,6 +2,8 @@ + kcmregionandlang.h + SPDX-FileCopyrightText: 2014 Sebastian Kügler <sebas@kde.org> + SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com> ++ SPDX-FileCopyrightText: 2023 Serenity Cybersecurity, LLC <license@futurecrew.ru> ++ Author: Gleb Popov <arrowd@FreeBSD.org> + + SPDX-License-Identifier: GPL-2.0-or-later + */ +@@ -11,6 +13,7 @@ + #include <optional> + #include <unordered_map> + ++#include "config-workspace.h" + #include "settingtype.h" + + #include <KConfigGroup> +@@ -36,7 +39,9 @@ public: + OptionsModel *optionsModel() const; + bool enabled() const; + static bool isGlibc(); ++#ifdef GLIBC_LOCALE + std::optional<QString> toGlibcLocale(const QString &lang); ++#endif + Q_INVOKABLE void unset(KCM_RegionAndLang::SettingType setting); + Q_INVOKABLE void reboot(); + Q_SIGNALS: +@@ -53,7 +58,9 @@ private Q_SLOTS: + void saveToConfigFile(); + + private: ++#ifdef GLIBC_LOCALE + std::unordered_map<QString, QString> constructGlibcLocaleMap(); ++#endif + static QString failedFindLocalesMessage(); + static QString localeFileDirPath(); + static QString toUTF8Locale(const QString &locale); +diff --git a/kcms/region_language/languagelistmodel.cpp kcms/region_language/languagelistmodel.cpp +index d9846226da..cc73178f86 100644 +--- a/kcms/region_language/languagelistmodel.cpp ++++ kcms/region_language/languagelistmodel.cpp +@@ -2,6 +2,8 @@ + languagelistmodel.h + SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com> + SPDX-FileCopyrightText: 2019 Kevin Ottens <kevin.ottens@enioka.com> ++ SPDX-FileCopyrightText: 2023 Serenity Cybersecurity, LLC <license@futurecrew.ru> ++ Author: Gleb Popov <arrowd@FreeBSD.org> + SPDX-License-Identifier: GPL-2.0-or-later + */ + +@@ -384,10 +386,14 @@ void SelectedLanguageModel::saveLanguages() + Q_EMIT unsupportedLanguageChanged(); + } + ++#ifdef GLIBC_LOCALE + auto glibcLang = m_kcm->toGlibcLocale(m_selectedLanguages.front()); + if (glibcLang.has_value()) { + m_settings->setLang(glibcLang.value()); + } ++#else ++ m_settings->setLang(m_selectedLanguages.front()); ++#endif + } + QString languages; + for (auto i = m_selectedLanguages.cbegin(); i != m_selectedLanguages.cend(); i++) { +diff --git a/kcms/region_language/localegenerator.cpp kcms/region_language/localegenerator.cpp +index 2da02617a4..fb8033c95d 100644 +--- a/kcms/region_language/localegenerator.cpp ++++ kcms/region_language/localegenerator.cpp +@@ -15,7 +15,7 @@ + + #ifdef OS_UBUNTU + #include "localegeneratorubuntu.h" +-#elif GLIBC_LOCALE ++#elif GLIBC_LOCALE_AUTO + #include "localegeneratorglibc.h" + #endif + +@@ -23,9 +23,9 @@ LocaleGeneratorBase *LocaleGenerator::getGenerator() + { + #ifdef OS_UBUNTU + static LocaleGeneratorUbuntu singleton; +-#elif GLIBC_LOCALE ++#elif GLIBC_LOCALE_AUTO + static LocaleGeneratorGlibc singleton; +-#elif LOCALE_GENERATED ++#elif GLIBC_LOCALE_GENERATED + static LocaleGeneratorGeneratedGlibc singleton; + #else + static LocaleGeneratorBase singleton; +-- +GitLab +