File ddskk.spec of Package ddskk

#
# spec file for package ddskk
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#



Name:           ddskk
# Current version does not build with current xemacs, disable for now
%define use_xemacs 0
BuildRequires:  compface emacs-x11 flim giflib-devel krb5 libpng-devel libtiff-devel openldap2-devel w3m xorg-x11-devel
%if %use_xemacs
BuildRequires:  flim-xemacs semi-xemacs xemacs-packages
%endif
License:        GPL v2 or later
Group:          Productivity/Editors/Emacs
Requires:       emacs, apel, skkdic
Provides:       locale(emacs:ja)
Version:        20050123
Release:        267
Url:            http://openlab.jp/skk/index.html
Source0:        http://openlab.jp/skk/maintrunk/ddskk-20050123.tar.bz2
Source1:        suse-start.el
Source100:      http://openlab.jp/skk/dic/SKK-JISYO.L.bz2
Source101:      http://openlab.jp/skk/dic/SKK-JISYO.M.bz2
Source102:      http://openlab.jp/skk/dic/SKK-JISYO.ML.bz2
Source103:      http://openlab.jp/skk/dic/SKK-JISYO.S.bz2
Source104:      http://openlab.jp/skk/dic/SKK-JISYO.JIS2.bz2
Source105:      http://openlab.jp/skk/dic/SKK-JISYO.JIS3_4.bz2
Source106:      http://openlab.jp/skk/dic/SKK-JISYO.wrong.annotated.bz2
Source107:      http://openlab.jp/skk/dic/SKK-JISYO.pubdic+.bz2
Source108:      http://openlab.jp/skk/dic/SKK-JISYO.edict.tar.bz2
Source109:      http://openlab.jp/skk/dic/SKK-JISYO.geo.bz2
Source110:      http://openlab.jp/skk/dic/zipcode.tar.bz2
Source111:      http://openlab.jp/skk/dic/SKK-JISYO.assoc.bz2
Source112:      http://openlab.jp/skk/dic/SKK-JISYO.okinawa.bz2
Source113:      http://openlab.jp/skk/dic/SKK-JISYO.law.bz2
Source114:      http://openlab.jp/skk/dic/SKK-JISYO.jinmei.bz2
Source115:      http://openlab.jp/skk/dic/SKK-JISYO.china_taiwan.bz2
Source116:      http://openlab.jp/skk/dic/SKK-JISYO.mazegaki.bz2
Source117:      http://openlab.jp/skk/dic/SKK-JISYO.fukugo.bz2
# explanation for the dictionaries downloaded from:
# http://openlab.jp/skk/wiki/wiki.cgi?page=SKK%BC%AD%BD%F1
Source200:      SKK-JISYO.wiki.bz2
Patch0:         fix-build-for-xemacs.patch
Patch1:         skk-texinfo-illegal-character.patch
Patch2:         bugzilla-141756-workaround.patch
Summary:        SKK (Simple Kana to Kanji Conversion Program) for Emacs
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
SKK (Simple Kana to Kanji conversion program) is a Japanese input
method for Emacs. ddskk (Daredevil SKK) is a version of SKK that is
aggressively developed.

%if %use_xemacs

%package -n ddskk-xemacs
License:        GPL v2 or later
Group:          Productivity/Editors/Emacs
Requires:       xemacs, xemacs-packages, skkdic
Provides:       locale(xemacs:ja)
Summary:        SKK (`Simple Kana to Kanji conversion program') for XEmacs

%description -n ddskk-xemacs
SKK (`Simple Kana to Kanji conversion program') is a Japanese input
method for XEmacs. ddskk ('Daredevil SKK') is a version of SKK which is
aggressively developed.

%endif

%package -n skkdic
License:        GPL v2 or later
Group:          System/I18n/Japanese
Provides:       locale(scim-skk:ja)
PreReq:         info
Url:            http://openlab.jp/skk/dic.html
Summary:        Main Dictionary for SKK

%description -n skkdic
main dictionary for SKK

%package -n skkdic-extra
License:        GPL v2 or later
Group:          System/I18n/Japanese
Url:            http://openlab.jp/skk/dic.html
Summary:        optional, additional dictionaries for SKK

%description -n skkdic-extra
optional, additional dictionaries for SKK

%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
tar jxf $RPM_SOURCE_DIR/zipcode.tar.bz2
cp $RPM_SOURCE_DIR/SKK-JISYO*bz2 zipcode/SKK-JISYO* dic
bunzip2 dic/*bz2
iconv -f iso-2022-jp -t utf-8 doc/skk.texi > doc/skk.texi.utf-8
mv doc/skk.texi.utf-8 doc/skk.texi
perl -pi -e "s/coding: iso-2022-jp/coding: utf-8/" doc/skk.texi
# check if changing the encoding cookie worked, exit if not:
grep "coding: utf-8" doc/skk.texi || exit 1

%build
%define emacs_sitelisp_dir %{_datadir}/emacs/site-lisp
%define emacs_package_dir %{emacs_sitelisp_dir}/skk
export LANG=ja_JP.UTF-8
make PREFIX=$RPM_BUILD_ROOT/usr \
     SKK_DATADIR=$RPM_BUILD_ROOT/usr/share/skk \
     SKK_INFODIR=$RPM_BUILD_ROOT/usr/share/info \
     APEL_SPECIFIC_LISPDIR=$RPM_BUILD_ROOT%emacs_sitelisp_dir/apel \
     SKK_LISPDIR=$RPM_BUILD_ROOT%emacs_package_dir \
     EMACS=emacs %{?_smp_mflags}

%install
export LANG=ja_JP.UTF-8
mkdir -p $RPM_BUILD_ROOT%{emacs_package_dir}
make PREFIX=$RPM_BUILD_ROOT/usr \
     SKK_DATADIR=$RPM_BUILD_ROOT/usr/share/skk \
     SKK_INFODIR=$RPM_BUILD_ROOT/usr/share/info \
     APEL_SPECIFIC_LISPDIR=$RPM_BUILD_ROOT%emacs_sitelisp_dir/apel \
     SKK_LISPDIR=$RPM_BUILD_ROOT%emacs_package_dir \
     EMACS=emacs \
     install
{
  echo ";; %{emacs_sitelisp_dir}/suse-start-%{name}.el"
  echo ""
  echo "(add-to-list 'load-path \"%{emacs_package_dir}\")"
  echo ""
  cat $RPM_SOURCE_DIR/suse-start.el
  echo ""
  echo ";; %{emacs_sitelisp_dir}/suse-start-%{name}.el ends here"
} > %{buildroot}%{emacs_sitelisp_dir}/suse-start-%{name}.el
######################################################################
%if %use_xemacs
# now build for XEmacs:
%define xemacs_package_dir /usr/share/xemacs/site-packages/
make clean
make PREFIX=$RPM_BUILD_ROOT/usr \
     SKK_DATADIR=$RPM_BUILD_ROOT/usr/share/skk \
     SKK_INFODIR=$RPM_BUILD_ROOT%xemacs_package_dir/info \
     APEL_SPECIFIC_LISPDIR=$RPM_BUILD_ROOT%xemacs_package_dir/lisp/apel \
     SKK_LISPDIR=$RPM_BUILD_ROOT%xemacs_package_dir/lisp/skk \
     PACKAGEDIR=$RPM_BUILD_ROOT%xemacs_package_dir \
     EMACS=xemacs %{?_smp_mflags}
make PREFIX=$RPM_BUILD_ROOT/usr \
     SKK_DATADIR=$RPM_BUILD_ROOT/usr/share/skk \
     SKK_INFODIR=$RPM_BUILD_ROOT%xemacs_package_dir/info \
     APEL_SPECIFIC_LISPDIR=$RPM_BUILD_ROOT%xemacs_package_dir/lisp/apel \
     SKK_LISPDIR=$RPM_BUILD_ROOT%xemacs_package_dir/lisp/skk \
     PACKAGEDIR=$RPM_BUILD_ROOT%xemacs_package_dir \
     EMACS=xemacs \
     install-package
gzip $RPM_BUILD_ROOT%{xemacs_package_dir}/info/skk*.info*
# I would be wasteful if XEmacs had it's own copy of the dictionaries
# and some other files. The whole %{xemacs_package_dir}/etc/skk
# can be shared with Emacs.
rm -rf $RPM_BUILD_ROOT%{xemacs_package_dir}/etc/skk
ln -s /usr/share/skk $RPM_BUILD_ROOT%{xemacs_package_dir}/etc/skk
# the info pages are in the skkdic package to be able to share them
# for Emacs and XEmacs:
rm -f $RPM_BUILD_ROOT%{xemacs_package_dir}/info/skk*
# replace buildroot in comments in .elc files by spaces with the same total length:
RPM_BUILD_ROOT_REPLACEMENT=$(echo "$RPM_BUILD_ROOT" | tr [:print:] ' ')
for i in $(find $RPM_BUILD_ROOT -name "*.elc")
do
    perl -pi -e "s|(;;; from file )$RPM_BUILD_ROOT(/usr/share/xemacs/site-packages/.*)|\1$RPM_BUILD_ROOT_REPLACEMENT\2|" $i
done
%endif
# remove buildroot in .el files:
# for i in $(find $RPM_BUILD_ROOT -name "*.el")
# do
#     perl -pi -e "s|$RPM_BUILD_ROOT||" $i
#     # touch the .elc files again because they are still up to date:
#     if -f ${i}c
#     then
#         touch ${i}c
#     fi
# done
perl -pi -e "s|$RPM_BUILD_ROOT||" $RPM_BUILD_ROOT%{emacs_package_dir}/skk-setup.el

rm -f $RPM_BUILD_ROOT/%{_infodir}/dir
rm -f $RPM_BUILD_ROOT/%{xemacs_package_dir}/info/dir 

%post -n skkdic
for i in skk
do
    %install_info --info-dir=%{_infodir} %{_infodir}/${i}.info.gz
done

%preun -n skkdic
for i in skk
do
    %install_info --delete --info-dir=%{_infodir} %{_infodir}/${i}.info.gz
done

%files
%defattr(-,root,root)
%doc ChangeLog* READMEs
%{emacs_package_dir}
%config %{emacs_sitelisp_dir}/suse-start-%{name}.el
%{_infodir}/*
%if %use_xemacs

%files -n ddskk-xemacs
%defattr(-,root,root)
%doc ChangeLog* READMEs
%dir %{xemacs_package_dir}/
%dir %{xemacs_package_dir}/lisp/
%dir %{xemacs_package_dir}/etc/
%{xemacs_package_dir}/lisp/*
%{xemacs_package_dir}/etc/*
%endif

%files -n skkdic
%defattr(-,root,root)
%dir /usr/share/skk/
/usr/share/skk/SKK-JISYO.L
/usr/share/skk/skk.xpm
/usr/share/skk/SKK.tut
/usr/share/skk/SKK.tut.E
%{_infodir}/*

%files -n skkdic-extra
%defattr(-,root,root)
%dir /usr/share/skk/
/usr/share/skk/SKK-JISYO.ML
/usr/share/skk/SKK-JISYO.M
/usr/share/skk/SKK-JISYO.zipcode
/usr/share/skk/SKK-JISYO.office.zipcode
/usr/share/skk/SKK-JISYO.pubdic+
/usr/share/skk/SKK-JISYO.JIS3_4
/usr/share/skk/SKK-JISYO.JIS2
/usr/share/skk/SKK-JISYO.S
/usr/share/skk/NICOLA-SKK.tut

%changelog
openSUSE Build Service is sponsored by