%define _qt4_version %(pkg-config --modversion --silence-errors Qt 2>/dev/null || echo 4.8.6)

%global ruby_vendorlib %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["vendorlibdir"]')
%global ruby_vendorarch %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["vendorarchdir"]')

Name:    QtRuby
Summary:  Ruby bindings for Qt4
Summary(ja): Qt4 の Ruby バインディング
Version: 4.14.3
Release: 2%{?_dist_release}

License: LGPLv2+ and GPLv2+
Group:   System Environment/Libraries
URL:     https://techbase.kde.org/Development/Languages/Ruby

Source0: http://download.kde.org/stable/%{version}/src/qtruby-%{version}.tar.xz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: cmake
BuildRequires: phonon-devel
BuildRequires: qimageblitz-devel
BuildRequires: qt4-devel
BuildRequires: qscintilla-devel
BuildRequires: qwt-qt4-devel
BuildRequires: ruby-devel >= 1.8
BuildRequires: smokeqt-devel >= %{version}

# common name some other distros use
Provides: ruby-qt = %{version}-%{release} 

Requires: qt4 >= %{_qt4_version}
Requires: ruby >= 1.8
Requires: smokeqt >= %{version}

%description
%{summary}.

%package devel
Summary: Development libraries for %{name} 
Summary(ja): %{name} の開発用ファイル 
Group:   Development/Libraries
Requires: %{name} = %{version}-%{release}
Provides: ruby-qt-devel = %{version}-%{release}

%description devel
This package contains development files for the Ruby bindings
for the Qt libraries.


%prep
%setup -q -n qtruby-%{version}


%build
mkdir -p %{_target_platform}
pushd %{_target_platform}

%cmake \
    -DCUSTOM_RUBY_SITE_ARCH_DIR:PATH=%{ruby_vendorarch} \
    -DCUSTOM_RUBY_SITE_LIB_DIR:PATH=%{ruby_vendorlib} \
    ..
popd

make %{?_smp_mflags} -C %{_target_platform}


%install
rm -rf $RPM_BUILD_ROOT
make install/fast DESTDIR=%{buildroot} -C %{_target_platform}


%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%clean
rm -rf $RPM_BUILD_ROOT

%files 
%defattr(-,root,root,-)
%doc AUTHORS COPYING COPYING.LIB README
%{_libdir}/libqtruby4shared.so.*
%{ruby_vendorlib}/Qt*.rb
%{ruby_vendorlib}/Qt/
%{ruby_vendorlib}/phonon/
%{ruby_vendorlib}/qscintilla/
%{ruby_vendorlib}/qtdeclarative/
%{ruby_vendorlib}/qtscript/
%{ruby_vendorlib}/qttest/
%{ruby_vendorlib}/qtuitools/
%{ruby_vendorlib}/qtwebkit/
%{ruby_vendorlib}/qwt/
%{ruby_vendorarch}/*.so

%files devel
%defattr(-,root,root,-)
%{_bindir}/rbqtapi
%{_bindir}/rbrcc
%{_bindir}/rbuic4
%{_includedir}/qtruby
%{_libdir}/libqtruby4shared.so
%{_datadir}/qtruby4

%changelog
* Sat Sep 12 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.14.3-2
- rebuild with ruby-2.2.3

* Sun Jan 11 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 4.14.3-1
- updated to 4.14.3

* Wed Nov 12 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 4.14.2-2
- installed modules to vendor_ruby
- fixed URL

* Sun Nov  9 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 4.14.2-1
- splitted from kdebindings

* Thu Jun 16 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.6.4-1
- new upstream release

* Thu Apr 14 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.6.1-1
- updated to 4.6.1
- added BR: kdesdk-devel
- disabled attica plugins temporaly
- rebuilt with mono-2.10.1

* Sun Sep 26 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.5.1-2
- rebuilt with rpm-4.8.1 for pkg-config

* Sat Sep 18 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.5.1-1
- new upstream release
- added Patch50
- added more japanese summaries

* Tue Aug 17 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.5.0-1
- new upstream release

* Sun Jul  4 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.4.5-1
- new upstream release

* Fri May  7 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.4.3-1
- new upstream release

* Thu Apr 15 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.4.2-1
- new upstream release

* Tue Mar  9 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.4.1-1
- new upstream release
- added -DCMAKE_SKIP_RPATH:BOOL=OFF option to cmake
  (see https://bugs.kde.org/show_bug.cgi?id=214824)
- built with new toolchain

* Wed Nov 25 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.3.3-1
- new upstream release

* Thu Oct 29 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.3.2-4
- merged 4.3.1-2 %changelog 
- re-define %%{mono_dir} to %{_prefix}/lib/mono (again)

* Tue Oct 27 2009 Shu KONNO <owa@bg.wakwak.com> 4.3.2-3
- use %%{_prefix}/lib for mono-dll (for x86_64)

* Tue Oct 27 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.3.2-2
- new upstream release
- built with PyQt4-4.6

* Sun Sep 06 2009 NAKAMURA Kenta <kenta@vinelinux.org> 4.3.1-2
- define %%{mono_dir} to specify mono library install path

* Sun Sep  6 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.3.1-1
- new upstream release
- fixed ruby modules installation path

* Thu Aug 20 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.3.0-1
- new upstream release
- spilt sub package based on Fedora

* Mon May 11 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.5.8-1
- applied new versioning policy
- added Patch1 
  (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=484191)

* Fri Nov 23 2007 NAKAMURA Kenta <kenta@vinelinux.org> 3.5.8-0vl3
- added --with-qt-libraries option

* Mon Oct 29 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.8-0vl2
- rebuild for VineSeed

* Mon Oct 29 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.8-0vl1
- new upstream release

* Mon Jun 25 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.7-0vl2
- rebuild for VineSeed

* Thu May 31 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.7-0vl1
- new upstream release
- update Patch0
- drop Patch1

* Mon Jan 29 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.6-0vl1
- new upstream release
- add Patch1
- add --enable-libsuffix option

* Tue Oct  3 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.5-0vl2
- rebuild for VineSeed

* Tue Oct  3 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.5-0vl1
- new upstream release

* Wed Aug  2 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.4-0vl2
- rebuild for VineSeed

* Wed Aug  2 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.4-0vl1
- new upstream release

* Thu Jun  1 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.3-0vl2
- rebuild for VineSeed

* Thu Jun  1 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.3-0vl1
- new upstream release

* Wed Mar 22 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.2-0vl2
- rebuild for VineSeed

* Wed Mar 22 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.2-0vl1
- new upstream release

* Wed Feb  1 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.1-0vl2
- rebuild for VineSeed

* Wed Feb  1 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 3.5.1-0vl1
- new upstream release
- renew BuildPrereq and build section
- renew %%files
- enable python
- change spec to make main and devel package
- add BuildPrereq: ruby ruby-devel
- add Patch0 to install ruby-bindings under /usr/lib/ruby

* Sun Mar 17 2002 AKIYAMA Kazuhito <akiyama@karen.servepics.com> 2.2.2-1vl1
- build for VineSeed
- disable python and mozilla
- objprelink (i386 only)

* Wed Nov 21 2001 Than Ngo <than@redhat.com> <bero@redhat.com> 2.2.2-1
- 2.2.2
- build kmozilla binding only on x86/alpha

* Thu Aug  9 2001 Bernhard Rosenkraenzer <bero@redhat.com> 2.2-2
- Make sure %%{name}-kmozilla isn't built on ia64

* Mon Jul 23 2001 Bernhard Rosenkraenzer <bero@redhat.com> 2.2-0.cvs20010723.2
- Move python bindings to separate package
- Add perl bindings
- Shut up rpmlint

* Wed Feb 21 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.1

* Sun Jan 28 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- initial RPM