From b55176e34cf84ac9a8b2ef6d720f0c5086d9044e Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 5 Aug 2020 12:45:40 +0800 Subject: [PATCH] Use cmake macro --- librime-fixes-opencc-usage.patch | 51 ++++++++++++++++++++++++++++++++ librime.spec | 21 +++++++------ 2 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 librime-fixes-opencc-usage.patch diff --git a/librime-fixes-opencc-usage.patch b/librime-fixes-opencc-usage.patch new file mode 100644 index 0000000..5ffa0e4 --- /dev/null +++ b/librime-fixes-opencc-usage.patch @@ -0,0 +1,51 @@ +Index: librime-1.5.3/src/rime/gear/simplifier.cc +=================================================================== +--- librime-1.5.3.orig/src/rime/gear/simplifier.cc ++++ librime-1.5.3/src/rime/gear/simplifier.cc +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -45,8 +46,7 @@ class Opencc { + } + } + +- bool ConvertWord(const string& text, +- vector* forms) { ++ bool ConvertWord(const string& text, vector* forms) { + if (dict_ == nullptr) return false; + opencc::Optional item = dict_->Match(text); + if (item.IsNull()) { +@@ -54,15 +54,14 @@ class Opencc { + return false; + } else { + const opencc::DictEntry* entry = item.Get(); +- for (const char* value : entry->Values()) { +- forms->push_back(value); ++ for (auto&& value : entry->Values()) { ++ forms->push_back(std::move(value)); + } + return forms->size() > 0; + } + } + +- bool RandomConvertText(const string& text, +- string* simplified) { ++ bool RandomConvertText(const string& text, string* simplified) { + if (dict_ == nullptr) return false; + const char *phrase = text.c_str(); + std::ostringstream buffer; +@@ -83,8 +82,7 @@ class Opencc { + return *simplified != text; + } + +- bool ConvertText(const string& text, +- string* simplified) { ++ bool ConvertText(const string& text, string* simplified) { + if (converter_ == nullptr) return false; + *simplified = converter_->Convert(text); + return *simplified != text; diff --git a/librime.spec b/librime.spec index c5d0cb2..2114556 100644 --- a/librime.spec +++ b/librime.spec @@ -1,11 +1,12 @@ Name: librime Version: 1.5.3 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Rime Input Method Engine Library License: GPLv3 URL: https://rime.im/ Source0: https://github.com/rime/librime/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +Patch0: librime-fixes-opencc-usage.patch BuildRequires: gcc-c++ BuildRequires: cmake, opencc-devel @@ -44,20 +45,15 @@ The %{name}-tools package contains tools for %{name}. %prep -%autosetup +%autosetup -p1 %build -mkdir cmake-build -pushd cmake-build -%cmake .. -make VERBOSE=1 %{?_smp_mflags} -popd +%cmake +%cmake_build + %install -pushd cmake-build -make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" -find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' -popd +%cmake_install %ldconfig_scriptlets @@ -83,6 +79,9 @@ popd %changelog +* Wed Aug 5 2020 Peng Wu - 1.5.3-6 +- Use cmake macro + * Sat Aug 01 2020 Fedora Release Engineering - 1.5.3-5 - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild