%define udev_rules_dir %{_sysconfdir}/udev/rules.d

Summary: A fast FrameBuffer based TERMinal emulator for linux
Summary(ja): 高速なフレームバッファベースのターミナルエミュレータ
Name: fbterm
Version: 1.7.0
Release: 2%{?_dist_release}
License: GPLv2+
Group: Applications/System
URL: http://code.google.com/p/fbterm/
Vendor: Project Vine
Distribution: Vine Linux

Source0: http://fbterm.googlecode.com/files/%name-%version.tar.gz
Patch10: fbterm-1.4-antialias.patch
Patch11: fbterm-1.7.0-default-size.patch
Patch12: fbterm-1.7.0-default-ambiguous-wide.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: freetype2-devel
BuildRequires: fontconfig-devel
Requires(post): libcap

%description
FbTerm is a fast terminal emulator for linux with frame buffer. Features
include: 

* mostly as fast as terminal of linux kernel while accelerated scrolling
  is enabled on framebuffer device
* select font with fontconfig and draw text with freetype2, same as
  Qt/Gtk+ based GUI apps
* dynamicly create/destroy up to 10 windows initially running default
  shell
* record scrollback history for every window 
* auto-detect text encoding with current locale, support double width
  scripts like Chinese, Japanese etc
* switch between configurable additional text encodings with hot keys on
  the fly 
* copy/past selected text between windows with mouse when gpm server is
  running

%package udevrules
Summary:    udev rules that grant regular user access
Summary(ja):一般ユーザに fb へのアクセス権を与えるためのudevルール
Group:      Applications/System
Requires:   udev

%description udevrules
Regular users might use some applications that require access to
frame-buffer device.
For example, ibus-fbterm requires access to /dev/fb0.
This sub-package enables regular user for such access.

%prep
%setup -q -n %{name}-1.7
%patch10 -p1
%patch11 -p1
%patch12 -p1

%build
autoreconf -iv
%configure --disable-gpm ||:
%__make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
%__make install DESTDIR=$RPM_BUILD_ROOT

# install udev rules
%__mkdir -p $RPM_BUILD_ROOT/%{udev_rules_dir}
%__cat >>$RPM_BUILD_ROOT/%{udev_rules_dir}/99-fbterm.rules <<EOF
KERNEL=="fb[0-9]*", SUBSYSTEM=="graphics", MODE="0666"
EOF

%clean
rm -rf $RPM_BUILD_ROOT

%post
[ -x /usr/sbin/setcap ] && /usr/sbin/setcap 'cap_sys_tty_config+ep' %{_bindir}/%{name}

%files
%defattr(-, root, root)
%doc AUTHORS ChangeLog README
%{_bindir}/*
%{_mandir}/man1/*

%files udevrules
%defattr(-,root,root,-)
%config(noreplace) %{udev_rules_dir}/99-fbterm.rules

%changelog
* Sun Jul 10 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 
- build with new toolchain.

* Fri Jul 08 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 1.7-1
- update to 1.7
- add udevrules subpackage to grant regular user access
- rename patch1 to patch10
- add patch11 to change deafult font size
- add patch12 to enable ambiguous-wide by default

* Sat Apr 04 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4-1
- new upstream release
- add patch1 to use antialiased font.

* Tue Jan 19 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.3-1
- new upstream release

* Fri Sep 05 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.1-1
- initial build for Vine Linux

* Sat Aug 23 2008 Funda Wang <fundawang@mandriva.org> 1.1-1mdv2009.0
+ Revision: 275412
- import fbterm


