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

Summary:     language bindings for GNOME2 and GNOME3 for use with Ruby
Summary(ja): Ruby から GNOME2 及び GNOME3 を使う為のライブラリ
Name:        ruby-gnome2
Version:     2.2.5
Release:     3%{?_dist_release}
Group:       Development/Libraries
License:     GPL
URL:         http://ruby-gnome2.sourceforge.jp/
Source0:     http://sourceforge.net/projects/%{name}/files/%{name}/%{name}-%{version}/%{name}-all-%{version}.tar.gz

Requires:    ruby-gtk2 = %{version}-%{release}
Requires:    ruby-gtk3 = %{version}-%{release}

BuildRoot:   %{_tmppath}/%{name}-%{version}-root

BuildRequires: ruby-devel
BuildRequires: ruby-pkg-config
BuildRequires: rcairo-devel >= 1.8.0
BuildRequires: glib2-devel
BuildRequires: pango-devel
BuildRequires: atk-devel
BuildRequires: gtk2-devel
BuildRequires: gtk3-devel >= 3.4.2
BuildRequires: gobject-introspection-devel >= 1.32.1
BuildRequires: gtksourceview2-devel >= 2.0.0
BuildRequires: gtksourceview3-devel >= 3.4.2
BuildRequires: librsvg2-devel >= 2.8.0
BuildRequires: gstreamer1-devel
BuildRequires: gstreamer1-plugins-base-devel
BuildRequires: vte-devel >= 0.12.1
BuildRequires: vte290-devel >= 0.32.2
BuildRequires: poppler-devel >= 0.14.2
BuildRequires: sed

Obsoletes: ruby-gtkglext < 2.0.0
Obsoletes: ruby-gtkmozembed < 2.0.0
Obsoletes: ruby-glade2 < 2.0.0
Obsoletes: ruby-goocanvas < 2.2.5


%description
This is a set of bindings for the GNOME-2.x and GNOME-3.x libraries to
use from Ruby 2.2.x.


%package -n ruby-gtk2
Summary:     language bindings for GTK+2 for use with Ruby
Summary(ja): Ruby から GTK+2 を使う為のライブラリ
Group:       Development/Libraries
Requires:    ruby
Requires:    rcairo >= 1.12.0

%description -n ruby-gtk2
This package is a ruby bindings for gtk2.
This package contains follow bindings.
  * Ruby/GLib2:           Ruby binding of GLib-2.x.
  * Ruby/GIO2:            Ruby binding of gio-2.0.x.
  * Ruby/ATK:             Ruby binding of ATK-1.0.x or later.
  * Ruby/Pango:           Ruby binding of pango-1.x.
  * Ruby/GdkPixbuf2:      Ruby binding of GdkPixbuf-2.x.
  * Ruby/GTK2:            Ruby binding of GTK+-2.0.x.
  * Ruby/GObjectIntrospection: Ruby binding of GObject Introspect.
  * Ruby/CairoGObject:    Ruby binding of cairo-gobject.


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

%description -n ruby-gtk3
This package is a ruby bindings for gtk3.
This package contains follow bindings.
  * Ruby/GDK3:            Ruby binding of GDK 3.
  * Ruby/GTK3:            Ruby binding of GTK 3.


%package -n %{name}-devel
Summary:     The header files for the ruby-gnome2.
Summary(ja): ruby-gnome2 用のヘッダーファイル群
Group:       Development/Libraries
Requires:    %{name} = %{version}-%{release}

%description -n %{name}-devel
%{name}-devel provides the header files for the %{name}.


%package -n ruby-gstreamer
Summary:    Ruby binding of GStreamer
Group:      Development/Libraries
Requires:   ruby-gtk3 = %{version}-%{release}

%description -n ruby-gstreamer
Ruby/GStreamer is a Ruby binding for GStreamer


%package -n ruby-gtksourceview2
Summary:     Ruby binding of gtksourceview-2.x
Summary(ja): Ruby の gtksourceview-2.x バインディング
Group:       Development/Libraries
Requires:    ruby-gtk2 = %{version}-%{release}

%description -n ruby-gtksourceview2
Ruby/GtkSourceView2 is a Ruby binding of gtksourceview-2.x.


%package -n ruby-gtksourceview3
Summary:     Ruby binding of gtksourceview-3.x
Summary(ja): Ruby の gtksourceview-3.x バインディング
Group:       Development/Libraries
Requires:    ruby-gtk3 = %{version}-%{release}

%description -n ruby-gtksourceview3
Ruby/GtkSourceView3 is a Ruby binding of gtksourceview-3.x.


%package -n ruby-poppler
Summary:     bindings for poppler for use with Ruby
Summary(ja): Ruby から poppler を使う為のライブラリ
Group:       Development/Libraries
License:     LGPL
Requires:    ruby-gtk2 = %{version}-%{release}

%description -n ruby-poppler
Ruby/Poppler is a Ruby binding of poppler-glib.


%package -n ruby-vte
Summary:     bindings for vte for use with Ruby
Summary(ja): Ruby から vte を使う為のライブラリ
Group:       Development/Libraries
License:     LGPL
Requires:    ruby-gtk2 = %{version}-%{release}

%description -n ruby-vte
Ruby/VTE is a Ruby binding of VTE.


%package -n ruby-vte3
Summary:     bindings for vte3 for use with Ruby
Summary(ja): Ruby から vte3 を使う為のライブラリ
Group:       Development/Libraries
License:     LGPL
Requires:    ruby-gtk3 = %{version}-%{release}

%description -n ruby-vte3
Ruby/VTE3 is a Ruby binding of VTE3.


%package -n ruby-rsvg2
Summary:     Ruby binding of librsvg2
Summary(ja): Ruby の rsvg-2.x バインディング
Group:       Development/Libraries
Requires:    ruby-gtk2 = %{version}-%{release}

%description -n ruby-rsvg2
Ruby/RSVG is a Ruby binding of librsvg2.


%prep
%setup -q -n %{name}-all-%{version}

for file in `find . -regex '.*/sample/.*\.rb'` 
do
    sed -e 's/^#! *\/usr\/local\/bin\/ruby/#!\/usr\/bin\/env ruby/' < $file > $file.mod
    mv $file.mod $file
done


%build
%{ruby} extconf.rb --with-opt-include=%{rarchdir}
make

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

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc AUTHORS COPYING.LIB NEWS README

%{rlibdir}/gnome2/
%{rlibdir}/gnome2-raketask.rb
%{rlibdir}/mkmf-gnome2.rb

%files -n %{name}-devel
%defattr(-,root,root)
%{rarchdir}/*.h

%files -n ruby-gtk2
%defattr(-,root,root)
%doc glib2/COPYING.LIB glib2/README glib2/sample
%doc gdk_pixbuf2/COPYING.LIB gdk_pixbuf2/README gdk_pixbuf2/sample
%doc gio2/COPYING.LIB gio2/README gio2/sample
%doc gobject-introspection/COPYING.LIB
%doc gobject-introspection/README gobject-introspection/sample
%doc gtk2/COPYING.LIB gtk2/README gtk2/sample
%doc pango/COPYING.LIB pango/README pango/sample
%{rlibdir}/atk.rb
%{rlibdir}/cairo-gobject.rb
%{rlibdir}/gdk_pixbuf2.rb
%{rlibdir}/glib2.rb
%{rlibdir}/glib2/
%{rlibdir}/gio2.rb
%{rlibdir}/gio2/
%{rlibdir}/glib-mkenums.rb
%{rlibdir}/gobject-introspection/
%{rlibdir}/gobject-introspection.rb
%{rlibdir}/gtk2/
%{rlibdir}/gtk2.rb
%{rlibdir}/pango.rb
%{rarchdir}/atk.so
%{rarchdir}/cairo_gobject.so
%{rarchdir}/gdk_pixbuf2.so
%{rarchdir}/glib2.so
%{rarchdir}/gio2.so
%{rarchdir}/gobject_introspection.so
%{rarchdir}/gtk2.so
%{rarchdir}/pango.so

%files -n ruby-gtk3
%defattr(-,root,root)
%doc gtk3/COPYING.LIB gtk3/README gtk3/sample
%{rlibdir}/gtk3/
%{rlibdir}/gtk3.rb
%{rarchdir}/gtk3.so

%files -n ruby-gstreamer
%defattr(-,root,root,-)
%doc gstreamer/COPYING.LIB gstreamer/sample
%{rlibdir}/gst/
%{rlibdir}/gst.rb
%{rlibdir}/gstreamer.rb
%{rarchdir}/gstreamer.so

%files -n ruby-gtksourceview2
%defattr(-,root,root,-)
%doc gtksourceview2/COPYING.LIB gtksourceview2/README gtksourceview2/sample
%{rlibdir}/gtksourceview2.rb
%{rarchdir}/gtksourceview2.so

%files -n ruby-gtksourceview3
%defattr(-,root,root,-)
%doc gtksourceview3/COPYING.LIB gtksourceview3/README gtksourceview3/sample
%{rlibdir}/gtksourceview3.rb
%{rlibdir}/gtksourceview3/
%{rarchdir}/gtksourceview3.so

%files -n ruby-poppler
%defattr(-,root,root)
%doc poppler/COPYING.LIB poppler/README poppler/sample
%{rlibdir}/poppler.rb
%{rarchdir}/poppler.so

%files -n ruby-vte
%defattr(-,root,root)
%doc vte/COPYING.LIB vte/README vte/sample
%{rlibdir}/vte.rb
%{rlibdir}/vte/
%{rarchdir}/vte.so

%files -n ruby-vte3
%defattr(-,root,root)
%doc vte3/COPYING.LIB vte3/README vte3/sample
%{rlibdir}/vte3.rb
%{rlibdir}/vte3/
%{rarchdir}/vte3.so

%files -n ruby-rsvg2
%defattr(-,root,root)
%doc rsvg2/COPYING.LIB rsvg2/README rsvg2/sample
%{rlibdir}/rsvg2.rb
%{rarchdir}/rsvg2.so


%changelog
* Sun Nov 01 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.2.5-3
- rebuild with poppler-0.37.0

* Fri Sep 11 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.2.5-2
- rebuild with ruby-2.2.3

* Sun May 03 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.2.5-1
- new upstream release
- change BuildRequires: vte290-devel instead of vte3-devel
- remove %%{name}-goocanvas subpackage

* Tue Jul 08 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.2.0-3
- rebuild with poppler-0.26.2

* Sat May 03 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.2.0-2
- rebuild with poppler-0.24.5

* Sun Mar 30 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.2.0-1
- new upstream release

* Sat Dec 07 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.2-3
- rebuild with ruby-2.0.0.353

* Sat Oct 26 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.2-2
- rebuild with poppler-0.24.2

* Sat Sep 21 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.2-1
- new upstream release
- fix BR
- remove old patches
- remove ruby-gtkglext, ruby-gtkmozembed, ruby-glade2 subpackages
- add ruby-gtk3, ruby-gtksourceview3, ruby-vte3, ruby-rsvg2 subpackages

* Sat Mar 12 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.19.3-3
- rebuilt with poppler-0.16.3
- added Patch15
- added BuildRequires: goocanvas-devel

* Wed Oct 06 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.19.3-2
- rebuild with poppler-0.14.2
- add BuildRequires: ruby
- change BuildRequires: gnome-panel-devel instead of gnome-panel
- fix %files (add pkgconfig files)

* Fri Mar 19 2010 IWAI, Masaharu <iwai@alib.jp> 0.19.3-1
- new upstream release
- drop gtkmozembed.patch (Patch15): upstream fixed
- add BuildRequires:
  - gtksourceview-devel >= 1.0.1
  - gstreamer-plugins-base-devel
  - mesa-libGLU-devel 
  - libXmu-devel

* Tue Jun 30 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.19.0-1
- new upstream release
- build with xulrunner-1.9.1

* Sun Dec 14 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.18.1-2
- rebuild with poppler-0.10.2

* Sat Nov 15 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.18.1-1vl5
- new upstream release
- changed Group to Development/Libraries

* Tue Oct 14 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.18.0-1vl5
- applied new versioning policy
- spec in UTF-8
- new upstream release
- added Patch14 from Fedora for building with xulrunner
  * Fri Dec 28 2007 Alex Lancaster <alexlan@fedoraproject.org> 0.16.0-21
  - Add xulrunner patch from bugzilla #402591
  - Rebuild against gecko-lib 1.9 (xulrunner)
- dropped Patch20-23
- new ruby-gstreaner, ruby-gtksourceview2 subpackage

* Fri Aug 31 2007 Shu KONNO <owa@bg.wakwak.com> 0.16.0-0vl3
- add Patch20: ruby-gnome2-all-0.16.0-rbglib_unicode.patch
- add Patch21: ruby-gnome2-all-0.16.0-rbglib_maincontext.patch
- add Patch22: ruby-gnome2-all-0.16.0-rbgobj_boxed.patch
- add Patch23: ruby-gnome2-all-0.16.0-rbgtktreeiter.patch
- set iffox is true if x86_64

* Sun Jun 25 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.16.0-0vl2
- upstream release
- add BuildRequires: poppler-devel, vte-devel
- add new packages: ruby-poppler, ruby-vte
- add Obsoletes: ruby-libgda (no longer supported)
- drop Patch10
- add Requires: mozilla to ruby-gtkmozembed

* Tue May 16 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.14.1-0vl5
- rebuild with Ruby-1.8.4

* Sat Apr 1 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.14.1-0vl4
- rebuild with GNOME-2.14
- change BuildRequires: from gstreamer-devel to gstreamer08-devel
- change BuildRequires: from firefox-devel to mozilla-devel
  (Patch 10 is kept in package)

* Sat Feb 25 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.14.1-0vl3
- add Requires: ruby-gtk2 to ruby-gtkmozembed
- add Requires: ruby-gnome2 to ruby-libglade2

* Tue Feb 21 2006 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.14.1-0vl2
- added Patch10 (use firefox-devel instead of mozilla-devel)

* Sat Feb 18 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.14.1-0vl1
- upstream release
- temporally remove ruby-libgda
  (libgda binding is not available with libgda-1.9.100-0vl1)

* Sun Oct 30 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.14.0-0vl2
- fix typo in Summary: of ruby-gtk2
- add Requires: rcairo for ruby-gtk2
- add BuildRequires: rcairo-devel to support rcairo

* Sun Oct 23 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.14.0-0vl1
- upstream release
- add BuildRequires: mozilla-devel to build ruby-gtkmozembed

* Sun Sep 4 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.13.0-0vl1
- upstream release
- change BuildRequires: kernel-headers to glibc-kernheaders

* Mon May 9 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.12.0-0vl2
- add gtkglext and libgda modules as independent VineSeedPlus package

* Fri May 6 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.12.0-0vl1
- catch up to upstream release
- replace Patch10 with eqivalent C-shell script
- replace BuildRequires
- add new modules to ruby-gnome2
- remove gtkglext modules (currently in VineSeedPlus)

* Fri Nov 12 2004 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.9.1-0vl3
- rebuilt with newest gnome in VineSeed

* Sun Sep 26 2004 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.9.1-0vl2
- remove ruby-libglade2's ruby-gnome2 dependency
- temporarily removed libgda module (libgda is in VineSeedPlus)

* Fri Mar 26 2004 Seiya Nishizawa <seiya@kugi.kyoto-u.ac.jp> 0.9.1-0vl1
- updated to newest upstream release
- add ruby-gnome2-0.9.1-vine.patch for remove /usr/local/bin/ruby
- add atk to ruby-gtk2 and libgda and gtkglext to ruby-gnome2
- remove sentence for Imlib from description

* Sun Dec 07 2003 Seiya Nishizawa <seiya@kugi.kyoto-u.ac.jp> 0.8.1-0vl1
- updated to newest upstream releas
- added to kernel-headers and libgnomeui-devel in BuildPrereq
- new subpackage ruby-gnome2-devel for header files

* Fri Oct 10 2003 Satoshi MACHINO <machino@vinelinux.org> 0.7.0-0vl2
- added to gstreamer-devel in BuildPrereq

* Thu Oct 09 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.7.0-0vl1
- updated to newest upstream release

* Mon May 26 2003 Kazuhisa TAKEI <takei@vinelinux.org> 0.4.0-0vl6
- add html_stream_close

* Sun May 25 2003 Kazuhisa TAKEI <takei@vinelinux.org> 0.4.0-0vl5
- fixed lack of HtmlStrem's free.

* Sun May 25 2003 Kazuhisa TAKEI <takei@vinelinux.org> 0.4.0-0vl4
- add html_stream_write.

* Sun May 25 2003 Kazuhisa TAKEI <takei@vinelinux.org> 0.4.0-0vl3
- add libgtkhtml2

* Mon May 12 2003 kazuhisa TAKEI <takei@vinelinux.org> 0.4.0vl2
- rebuild for new gtk2,gnome2

* Fri Apr 11 2003 Kazuhisa TAKEI <takei@linux.or.jp> 0.4.0-0vl1
- new upstream version 

* Wed Jan 1 2003 Kazuhisa TAKEI <takei@linux.or.jp> 0.2-0vl1
- initial package for ruby-gnome2 based on ruby-gnme package.

* 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.
