%define ruby     /usr/bin/ruby
%define rbindir  %(%{ruby} -r rbconfig -e 'print Config::CONFIG["bindir"]')
%define rlibdir  %(%{ruby} -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
%define rarchdir %(%{ruby} -r rbconfig -e 'print Config::CONFIG["archdir"]')

Summary:     bindings for GNOME for use with Ruby
Summary(ja): Ruby から GNOME を使う為のライブラリ
Name:        ruby-gnome
Version:     0.34
Release:     0vl2
Group:       System Environment/Libraries
Copyright:   GPL
URL:         http://ruby-gnome.sourceforge.net/
Source:      http://prdownloads.sourceforge.net/ruby-gnome/ruby-gnome-all-%{version}.tar.gz

# Vine Patch(es)
Patch10:      ruby-gnome-0.30-vine.patch

Requires:    gnome-libs >= 1.0.50
Requires:    ruby-gtk = %{version}-%{release}
Obsoletes:   gnome-ruby < %{version}

BuildPreReq: ruby gnome-libs-devel imlib-devel gdk-pixbuf-devel
BuildRoot:   %{_tmppath}/%{name}-%{version}-root


%description
Ruby-gnome provides both GNOME and GTK bindings for ruby.
 * You can handle GTK objects as Ruby objects and do natural GUI programming.
 * Simple signal description by block(anonymous procedure) or singleton method.
 * Interface for Imlib.
 * Works with Ruby threading.

This package provides GNOME bindings for ruby.


%package -n ruby-gtk
Summary:     bindings for GTK+ for use with Ruby
Summary(ja): Ruby から GTK+ を使う為のライブラリ
Group:       System Environment/Libraries
Requires:    ruby


%description -n ruby-gtk
Ruby-gnome provides both GNOME and GTK bindings for ruby.
 * You can handle GTK objects as Ruby objects and do natural GUI programming.
 * Simple signal description by block(anonymous procedure) or singleton method.
 * Interface for Imlib.
 * Works with Ruby threading.

This package provides GTK bindings for ruby.


%package -n ruby-libglade
Summary:     bindings for LibGlade for use with Ruby
Summary(ja): Ruby から LibGlade を使う為のライブラリ
Group:       System Environment/Libraries
Requires:    ruby-gtk = %{version}-%{release}
Requires:    ruby-gnome = %{version}-%{release}
Epoch:       1


%description -n ruby-libglade
Ruby-gnome provides both GNOME and GTK bindings for ruby.
 * You can handle GTK objects as Ruby objects and do natural GUI programming.
 * Simple signal description by block(anonymous procedure) or singleton method.
 * Interface for Imlib.
 * Works with Ruby threading.

This package provides LibGlade bindings for ruby.



%prep
%setup -q -n ruby-gnome-all-%{version}
%patch10 -p1

rm -rf panel-applet


%build
%{ruby} extconf.rb
make

## rbbr
cp -a gnome/doc/rbbr.rb ruby-classbrowser-gnome
cp -a gtk/doc/rbbr.rb ruby-classbrowser-gtk


%install
rm -rf ${RPM_BUILD_ROOT}
make sitearchdir=${RPM_BUILD_ROOT}%{rarchdir} \
     sitelibdir=${RPM_BUILD_ROOT}%{rlibdir} \
     install

mkdir -p %{buildroot}%{_bindir}
install -m 0755 ruby-class* %{buildroot}%{_bindir}/

mkdir -p ${RPM_BUILD_ROOT}%{_docdir}/ruby-gtk-%{version}/gtk
mkdir -p ${RPM_BUILD_ROOT}%{_docdir}/ruby-gtk-%{version}/gdkimlib
mkdir -p ${RPM_BUILD_ROOT}%{_docdir}/ruby-gtk-%{version}/gdkpixbuf
mkdir -p ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}/gnome
#mkdir -p ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}/panel-applet

cp -a gdkimlib/{ChangeLog,sample}* \
    ${RPM_BUILD_ROOT}/%{_docdir}/ruby-gtk-%{version}/gdkimlib/
cp -a gdkpixbuf/{COPYING,ChangeLog,README,sample}* \
    ${RPM_BUILD_ROOT}/%{_docdir}/ruby-gtk-%{version}/gdkpixbuf/
cp -a gtk/BUGS gtk/COPYING* gtk/ChangeLog gtk/NEWS gtk/README* \
      gtk/ToDo gtk/doc gtk/sample \
    ${RPM_BUILD_ROOT}/%{_docdir}/ruby-gtk-%{version}/gtk/

cp -a ChangeLog README \
    ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}/
cp -a gnome/{ChangeLog,NEWS,README,ToDo,doc,sample}* \
    ${RPM_BUILD_ROOT}/%{_docdir}/%{name}-%{version}/gnome/
#cp -a panel-applet/{ChangeLog,README,sample}* \
#    ${RPM_BUILD_ROOT}/%{_docdir}/%{name}-%{version}/panel-applet/


%clean
rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,root)
%{_docdir}/%{name}-%{version}
%{_bindir}/ruby-classbrowser-gnome
%{rlibdir}/gnome.rb
#%{rlibdir}/panel-applet.rb
%{rarchdir}/gnome.so
%{rarchdir}/libart.so
#%{rarchdir}/panel_applet.so


%files -n ruby-gtk
%defattr(-,root,root)
%{_docdir}/ruby-gtk-%{version}
%{_bindir}/ruby-classbrowser-gtk

%{rlibdir}/gdk_imlib.rb
%{rlibdir}/gdk_pixbuf.rb
%{rarchdir}/gtk.so
%{rarchdir}/gdk_imlib.so
%{rarchdir}/gdk_pixbuf.so


%files -n ruby-libglade
%defattr(-,root,root)
%doc libglade/ChangeLog libglade/README libglade/sample

%{rarchdir}/lglade.so


%changelog
* Sat Nov  6 2004 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.34-0vl2
- rebuilt with db4-4.2.52

* Tue Sep 28 2004 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.34-0vl1
- updated to 0.34 and rebuilt with ruby-1.8.1
- panel-applet temporarily removed

* Sat Sep 14 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.30-0vl1
- updated to new upstream release
- ruby-libgrade requires ruby-gnome

* Fri Aug 02 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.29-0vl2
- increased release number to avoid confusion between VinePlus and VineSeedPlus
- put ruby-classbrowser-{gtk,gnome} to %%{_bindir}

* Mon Jul 01 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.29-0vl1
- updated to 0.29 upstream release
- Patch0 removed
- added forgottten %%clean section

* Mon Jun 03 2002 Satoshi MACHINO <machino@vinelinux.org> 0.28-0vl1
- updated ruby-gnome-0.28
- dropped ruby-gnome-itemfactory.patch
	-- merged upstream
- added ruby-gnome-0.28-extconf.patch
	-- To install gnome.rb
	
* Wed May 08 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.27-0vl1
- tons of changes since 0.27-0vl0 :)
- now ruby-gtk and ruby-libglade are separated subpackages
- files installed to rlibdir, NOT sitedir
- added Obsoletes: gnome-ruby < %%{version}

* Fri Apr 12 2002 Seiya Nishizawa <seiya@kugi.kyoto-u.ac.jp>
- First package.
