# This is a sample RPM spec file (and also the one I use) that composes the
# r2l package from the separate subpackages.

%define name r2l
%define version          PACKAGE_VERSION
#%define r2llib_version   0.36
#%define biditext_version 0.9.7
#%define plugins_version  0.60
#%define refreshd_version 0.1.3
%define release 6

Summary: Makes some X apps display bidirectional hebrew 
Name: %{name}
Version: %{version}
Release: %{release}
#Source: r2l-package-%{version}.tar.gz
#Source1: r2llib-%{r2llib_version}.tar.gz
#Source2: biditext-%{biditext_version}.tar.gz
#Source3: r2l-plugins-%{plugins_version}.tar.gz
#Source4: refreshd-%{refreshd_version}.tar.gz

# Alternatively: remove those 4 sources and use only:
Source: r2l-%{version}.tar.gz
# And see a comment in the %prep phase

#Patch0: biditext-0.0.3.patch
#Patch0: biditext-flagfile.patch
#Patch1: biditext-flagfile-makefile.patch
URL: http://www.technion.ac.il/~tzafrir/R2L/
License: GPL
Group: System Environment/Internationalization
BuildRoot: %{_tmppath}/%{name}-buildroot

%description
Biditext is a library that can be used to make X apps display bidirectional 
hebrew almost properly. It modifies the Xlib string drawing function, so that 
strings will be printed according to the bidi. algorithm.
Surrisingly, this low-level hack works relatively well. Almost any X 
application is affected. And in most cases the result is resonable.

This package includes biditext, which starts a program with biditext support,
as well as some 'r2l' programs that are used to control the way biditext 
"reverses" the text.

This package contains the biditext library and loading script, as well as 
dock applet, terminal and command-line control programs.

%package gnome
Group: System Environment/Internationalization
Summary: gnome panel applet for controlling the biditext library
#BuildArchitectures: noarch

# Which is really required?
#Requires: %{name} = %{version}
Requires: %{name}

%description gnome
Biditext is a library that can be used to make X apps display bidirectional 
hebrew almost properly. It modifies the Xlib string drawing function, so that 
strings will be printed according to the bidi. algorithm.
Surrisingly, this low-level hack works relatively well. Almost any X 
application is affected. And in most cases the result is resonable.

This package contains a gnome applet r2l client.

%prep
%setup
# If you use the r2l-n.n.n tarball, then %setup is all you need.

# Otherwise:
# not elegant, but those tarballs are not big.
# alternatively I could set BIDITEXT_TARBALL, R2LLIB_TARBALL and 
# PLUGINS_TARBALL explicitly to make. But this seems to error-prone to me. 
#cp %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} .
#make PACKAGES_DIR=. unpack

%build
# delete the old biditext script:
make clean
# This is a very simple configure script at the moment. No point in passing it
# --prefix and alike, as it will have no effect.
./configure
make OPT_CFLAGS="$RPM_OPT_FLAGS" PREFIX=%{_prefix}

%install
rm -rf $RPM_BUILD_ROOT
#install -d $RPM_BUILD_ROOT%{_prefix}/bin
#install -d $RPM_BUILD_ROOT%{_prefix}/lib
make PREFIX=$RPM_BUILD_ROOT%{_prefix} MANDIR=$RPM_BUILD_ROOT%{_mandir} install

# A hack: the biditext script requires r2l in the path. This current tarball 
# does not install it
#cp bin/r2l $RPM_BUILD_ROOT%{_prefix}/bin

# Copy the documentation files:
mkdir docs
cp src/biditext/ChangeLog           docs/ChangeLog.biditext
cp src/biditext/README              docs/README.biditext
cp src/biditext/TODO                docs/TODO.biditext
cp src/r2llib/TODO                  docs/TODO.r2llib
cp src/r2llib/ChangeLog             docs/ChangeLog.r2llib
cp src/r2l-plugins/README           docs/README.plugins
cp src/r2l-plugins/README.internals docs/README.internals.plugins
cp -r src/refreshd/doc              docs/refreshd

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,0755)
%doc README docs/*
%{_prefix}/bin/r2l
%{_prefix}/bin/r2ltcl
%{_prefix}/bin/r2ldockapp
%{_prefix}/bin/r2lterminal
%{_prefix}/bin/biditext
%{_prefix}/bin/refreshd
%{_prefix}/lib/biditext.so
%{_prefix}/lib/refreshd_hook.so
%{_mandir}/man1/biditext.1*
%{_mandir}/man1/refreshd.1*
%{_mandir}/man1/r2l.1*
%{_mandir}/man1/r2lterminal.1*
%{_mandir}/man1/r2ldockapp.1*

%files gnome
%defattr(-,root,root,0755)
%{_prefix}/bin/r2lgnomeapplet
%{_mandir}/man1/r2lgnomeapplet.1*

%changelog
* Sat Mar 23 2002 Tzafrir Cohen <tzafrir@technion.ac.il> 1.0.1-6
- slight update to source
- some man pages

* Tue Jan 22 2002 Tzafrir Cohen <tzafrir@technion.ac.il> 1.0.0-5
- 1.0.0 finally!
- Added a couple of man pages

* Sun Jan 20 2002 Tzafrir Cohen <tzafrir@canada1.technion.ac.il> 0.9.6-4
- Added r2ltcl

* Wed Jan  2 2002 Tzafrir Cohen <tzafrir@canada1.technion.ac.il> 0.9.4-3
- updated source
- no longer copying r2l manually

* Fri Dec 28 2001 Tzafrir Cohen <tzafrir@canada1.technion.ac.il> 0.9.2-2
- Updated source

* Thu Dec 27 2001 Tzafrir Cohen <tzafrir@technion.ac.il> 0.9.1-1
- added ./configure and biditext.1
- building from one unified tarball, finally

* Wed Oct 31 2001 Tzafrir Cohen <tzafrir@technion.ac.il> 0.1.2-2
- refreshd 0.1.2 (can be built with gcc 2.96)

* Thu Sep 13 2001 Tzafrir Cohen <tzafrir@technion.ac.il> 0.1.2-1
- Updated packages: biditext 0.9.6.1, r2llib 0.35

* Mon Sep 10 2001 Tzafrir Cohen <tzafrir@technion.ac.il> 0.1.0-1
- Added reshreshd (0.1.1)
- Changed CFLAGES to OPT_CFLAGS
- using r2llib 0.33, biditext 0.9.5, r2l-plugins 0.51

* Mon Sep  3 2001 Tzafrir Cohen <tzafrir@technion.ac.il> 0.0.2-1
- initial rpm spec. Still no kde plugin and refreshd
