Use cmake macro

This commit is contained in:
Peng Wu 2020-08-05 12:45:40 +08:00
parent 80092eec75
commit b55176e34c
2 changed files with 61 additions and 11 deletions

View File

@ -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 <boost/filesystem.hpp>
#include <stdint.h>
#include <utf8.h>
+#include <utility>
#include <rime/candidate.h>
#include <rime/common.h>
#include <rime/config.h>
@@ -45,8 +46,7 @@ class Opencc {
}
}
- bool ConvertWord(const string& text,
- vector<string>* forms) {
+ bool ConvertWord(const string& text, vector<string>* forms) {
if (dict_ == nullptr) return false;
opencc::Optional<const opencc::DictEntry*> 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;

View File

@ -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 <pwu@redhat.com> - 1.5.3-6
- Use cmake macro
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.3-5
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild