File kterm.spec of Package kterm

#
# spec file for package kterm
#
# Copyright (c) 2013 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:           kterm
BuildRequires:  ncurses-devel
BuildRequires:  xorg-x11
BuildRequires:  xorg-x11-devel
%if 0%{?suse_version} > 1130
BuildRequires:  utempter-devel
%else
BuildRequires:  utempter
%endif
%define	appdefdir  /usr/share/X11
%define mymandir   /usr/share/man
%define mybindir   /usr/bin
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Version:        6.2.0
Release:        0
PreReq:         /bin/ln
Summary:        Kanji Terminal
License:        MIT
Group:          System/X11/Terminals
# original source is tar.gz
Source:         ftp://ftp.kddlabs.co.jp//X11/contrib/applications/kterm-6.2.0.tar.bz2
Source1:        kterm.termcap
Source2:        kterm.terminfo
Source3:        KTerm-ja.ad
Patch:          kterm-6.2.0-16colors.diff
Patch1:         kterm-6.2.0-secure.diff
Patch2:         kterm-6.2.0-glibc.pje.patch
Patch3:         kterm-6.2.0-glibc2.1.suse.diff
Patch4:         kterm-6.2.0-powerpc.diff
Patch5:         kterm-6.2.0-glibc2.2-setlocale.patch
Patch7:         KTerm.ad.patch
Patch8:         kterm-6.2.0-utempter.patch
# see http://phe.phyas.aichi-edu.ac.jp/~cyamauch/pl2.html
#     http://phe.phyas.aichi-edu.ac.jp/~cyamauch/pl2_kterm_srb.html
Patch9:         http://phe.phyas.aichi-edu.ac.jp/~cyamauch/arch/kterm-6.2.0-rightbar.patch
Patch11:        kterm-6.2.0-nonvoid.patch
Patch12:        kterm-6.2.0-gcc4.patch
Patch13:        null-pointer.patch

%description
Kterm is a multilingual terminal emulator based on xterm. The major
ways kterm differs from xterm are that it can handle multilingual text
encoded in ISO2022, can display colored text, and has the status line
function. To input multilingual text, both the X Input Method (XIM)
protocol and kinput2 protocol can be used.

%description -l ja 

%prep
%setup -q             
cp -pf %{SOURCE1} ./         
cp -pf %{SOURCE2} ./         
cp -pf %{SOURCE3} ./         
%patch -p1             
%patch1 -p1            
%patch2                
%patch3 -p1            
%patch4 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1 -b .utempter
%patch9 -p1 -b .rightbar
%patch11 -p1
%patch12
%patch13 -p1

%build
xmkmf -a
make CCOPTIONS="$RPM_OPT_FLAGS"

%install
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
make install DESTDIR=$RPM_BUILD_ROOT
make install.man MANSUFFIX=1 LIBMANSUFFIX=3 DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{appdefdir}/{ja,ja_JP.SJIS}/app-defaults/
install -m444 KTerm-ja.ad $RPM_BUILD_ROOT%{appdefdir}/ja/app-defaults/KTerm
iconv -f EUC-JP -t SJIS KTerm-ja.ad > KTerm-ja.ad.SJIS
LC_ALL=C perl -pi -e 's/^(\*VT100\*kanjiMode:\s+)euc/\1sjis/' KTerm-ja.ad.SJIS
install -m444 KTerm-ja.ad.SJIS $RPM_BUILD_ROOT%{appdefdir}/ja_JP.SJIS/app-defaults/KTerm
install -d -m755 $RPM_BUILD_ROOT%{mymandir}/ja/man1
iconv -f iso-2022-jp -t euc-jp kterm.jman > kterm.1
install -m444 kterm.1 $RPM_BUILD_ROOT%{mymandir}/ja/man1/kterm.1

%post
# 
# Workaround to make kterm find it's app-defaults even if
# LANG="japanese" or LANG="japanese.euc" is used. Setting the LANG
# variable to such a value fails to load the app-defaults because X11
# searches for a directory /usr/X11R6/lib/X11/japanese/app-defaults,
# which doesn't exist.
# 
# See "man XtResolvePathname"
# 
# In the long term, this should probably be solved somehow in X11
# 
# As a temporary workaround I just create symbolic links here, if
# such directories don't exist:
# 
if [ ! -e %{appdefdir}/japanese ] ; then
    ln -s %{appdefdir}/ja %{appdefdir}/japanese
fi
if [ ! -e %{appdefdir}/japanese.euc ] ; then
    ln -s %{appdefdir}/ja %{appdefdir}/japanese.euc
fi
if [ ! -e %{appdefdir}/japanese.sjis ] ; then
    ln -s %{appdefdir}/ja_JP.SJIS %{appdefdir}/japanese.sjis
fi

%files
%defattr(-,root,root)
%doc README.kt DEMO.kt.uu DEMO.xbm kterm.termcap kterm.terminfo
%attr(755,root,root) %{mybindir}/kterm
%{appdefdir}/app-defaults/KTerm
%{mymandir}/man1/kterm.1*
%dir %{appdefdir}/ja/
%dir %{appdefdir}/ja/app-defaults/
%{appdefdir}/ja/app-defaults/KTerm
%dir %{appdefdir}/ja_JP.SJIS/
%dir %{appdefdir}/ja_JP.SJIS/app-defaults/
%{appdefdir}/ja_JP.SJIS/app-defaults/KTerm
%dir %{mymandir}/ja/
%dir %{mymandir}/ja/man1/
%{mymandir}/ja/man1/kterm.1*

%changelog
openSUSE Build Service is sponsored by