1、安装相关的依赖包

  yum install gettext-devel intltool libtool pkgconfig sqlite-devel libuuid-devel opencc-devel lua-devel ibus-devel ibus gcc gcc-c++ gtk3-devel rpm-build -y

  yum install cmake doxygen -y

  yum install libdb-devel -y

  

2、制作opencc-1.0.2 rpm包

   rpm -ivf opencc-1.0.2-4.fc23.src.rpm 

   cd /root/rpmbuild/SPECS

   rpmbuild -ba opencc.spec 

   制作好的rpm存放在/root/rpmbuild/RPMS/x86_64/

   

3、制作libpinyin-1.3.0 rpm包

   rpm -ivf libpinyin-1.3.0-1.fc24.src.rpm

   cd /root/rpmbuild/SPECS

   rpmbuild -ba libpinyin.spec 

   制作好的rpm存放在/root/rpmbuild/RPMS/x86_64/

   

   安装libpinyin-1.3.0 

   

   rpm -e libpinyin-data-0.9.93-4.el7.x86_64 libpinyin-0.9.93-4.el7.x86_64 ibus-libpinyin

   rpm -e opencc-0.4.3-3.el7.x86_64 opencc-devel

   cd /root/rpmbuild/RPMS/x86_64/

   rpm -ivf opencc-1.0.2-4.el7.centos.x86_64.rpm opencc-devel-1.0.2-4.el7.centos.x86_64.rpm 

   rpm -ivf libpinyin-1.3.0-1.el7.centos.x86_64.rpm libpinyin-data-1.3.0-1.el7.centos.x86_64.rpm libpinyin-devel-1.3.0-1.el7.centos.x86_64.rpm 

   

   

4、制作ibus-libpinyin-1.7.4 rpm包

   cp ibus-libpinyin-1.7.4.tar.gz /root/rpmbuild/SOURCES/

   tar zxvf ibus-libpinyin-1.7.4.tar.gz

   cd ibus-libpinyin-1.7.4

   ./configure

   rpmbuild -ba ibus-libpinyin.spec 

   遇到问题:

 error: Installed (but unpackaged) file(s) found:

  /usr/share/appdata/libpinyin.appdata.xml

  /usr/share/applications/ibus-setup-libbopomofo.desktop

  /usr/share/applications/ibus-setup-libpinyin.desktop

  /usr/share/ibus-libpinyin/db/strokes.db

  /usr/share/ibus-libpinyin/user.lua

RPM build errors:

   Installed (but unpackaged) file(s) found:

  /usr/share/appdata/libpinyin.appdata.xml

  /usr/share/applications/ibus-setup-libbopomofo.desktop

  /usr/share/applications/ibus-setup-libpinyin.desktop

  /usr/share/ibus-libpinyin/db/strokes.db

  /usr/share/ibus-libpinyin/user.lua

解决问题:

修改:ibus-libpinyin.spec 

在%{_datadir}/ibus/component/*下一行添加以下内容:

/usr/share/appdata/libpinyin.appdata.xml

/usr/share/applications/ibus-setup-libbopomofo.desktop

/usr/share/applications/ibus-setup-libpinyin.desktop

/usr/share/ibus-libpinyin/db/strokes.db

/usr/share/ibus-libpinyin/user.lua

 

cd /root/rpmbuild/RPMS/x86_64/

rpm -ivf ibus-libpinyin-1.7.4-1.el7.centos.x86_64.rpm