Skip to content

Instantly share code, notes, and snippets.

@mikoim
Created May 3, 2019 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikoim/1e4927614dd347b4f5d00eddccf45ca5 to your computer and use it in GitHub Desktop.
Save mikoim/1e4927614dd347b4f5d00eddccf45ca5 to your computer and use it in GitHub Desktop.
spec file for building mozc ut2 package
%global pkg mozc
%undefine _hardened_build
Name: mozc
Version: 2.23.2815.102
Release: 2%{?dist}
Summary: A Japanese Input Method Editor (IME) designed for multi-platform
License: BSD and ASL 2.0 and UCD and Public Domain and mecab-ipadic
URL: https://github.com/google/mozc
Source0: a.tar
BuildRequires: python gettext
BuildRequires: libstdc++-devel zlib-devel libxcb-devel protobuf-devel protobuf-c glib2-devel qt5-devel zinnia-devel gtk2-devel
BuildRequires: clang ninja-build
BuildRequires: gyp >= 0.1-0.4.840svn
BuildRequires: ibus-devel >= 1.5.4
ExcludeArch: ppc ppc64 sparcv9 sparc64 s390x
Requires: zinnia-tomoe-ja
%description
Mozc is a Japanese Input Method Editor (IME) designed for
multi-platform such as Chromium OS, Windows, Mac and Linux.
%package -n ibus-mozc
Summary: The mozc engine for IBus input platform
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: ibus%{?_isa} >= 1.5.4
%description -n ibus-mozc
Mozc is a Japanese Input Method Editor (IME) designed for
multi-platform such as Chromium OS, Windows, Mac and Linux.
This package contains the Input Method Engine for IBus.
%prep
%setup -q -c -n %{name}-%{version}
%build
# replace compiler flags to build with the proper debugging information
t=`mktemp /tmp/mozc.gyp-XXXXXXXX`
opts=$(for i in $(echo $RPM_OPT_FLAGS |sed -e 's/-fstack-clash-protection//g' -e 's/-fcf-protection//g'); do #); do
echo "i \\"
echo "\"$i\","
done)
sed -ne "/'linux_cflags':/{p;n;p;:a;/[[:space:]]*\],/{\
$opts
p;b b};n;b a;};{p};:b" gyp/common.gypi > $t && mv $t gyp/common.gypi || exit 1
GYP_DEFINES="use_libprotobuf=1 use_libzinnia=1 zinnia_model_file=/usr/share/zinnia/model/tomoe/handwriting-ja.model ibus_mozc_path=%{_libexecdir}/ibus-engine-mozc ibus_mozc_icon_path=%{_datadir}/ibus-mozc/product_icon.png" python build_mozc.py gyp --gypdir=%{_bindir} --server_dir=%{_libexecdir}/mozc --target_platform=Linux
python build_mozc.py build -c Release unix/ibus/ibus.gyp:ibus_mozc server/server.gyp:mozc_server gui/gui.gyp:mozc_tool renderer/renderer.gyp:mozc_renderer
%install
install -d $RPM_BUILD_ROOT%{_libexecdir}/mozc
install -d $RPM_BUILD_ROOT%{_libexecdir}/mozc/documents
install -p -m0755 out_linux/Release/mozc_server $RPM_BUILD_ROOT%{_libexecdir}/mozc
install -p -m0755 out_linux/Release/mozc_tool $RPM_BUILD_ROOT%{_libexecdir}/mozc
install -p -m0755 out_linux/Release/mozc_renderer $RPM_BUILD_ROOT%{_libexecdir}/mozc
# ibus-mozc
install -d $RPM_BUILD_ROOT%{_datadir}/ibus/component
install -d $RPM_BUILD_ROOT%{_datadir}/ibus-mozc
install -p -m0755 out_linux/Release/ibus_mozc $RPM_BUILD_ROOT%{_libexecdir}/ibus-engine-mozc
install -p -m0644 out_linux/Release/gen/unix/ibus/mozc.xml $RPM_BUILD_ROOT%{_datadir}/ibus/component/
(cd data/images/unix;
install -p -m0644 ime_product_icon_opensource-32.png $RPM_BUILD_ROOT%{_datadir}/ibus-mozc/product_icon.png
for i in ui-*.png; do
install -p -m0644 $i $RPM_BUILD_ROOT%{_datadir}/ibus-mozc/${i//ui-/}
done)
%post -n ibus-mozc
[ -x %{_bindir}/ibus ] && %{_bindir}/ibus write-cache --system >& /dev/null || :
%postun -n ibus-mozc
[ -x %{_bindir}/ibus ] && %{_bindir}/ibus write-cache --system >& /dev/null || :
%files
%dir %{_libexecdir}/mozc
%{_libexecdir}/mozc/mozc_server
%{_libexecdir}/mozc/mozc_tool
%{_libexecdir}/mozc/documents
%files -n ibus-mozc
%dir %{_datadir}/ibus-mozc
%{_libexecdir}/ibus-engine-mozc
%{_libexecdir}/mozc/mozc_renderer
%{_datadir}/ibus/component/mozc.xml
%{_datadir}/ibus-mozc/*.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment