%define mono_dir %{_prefix}/lib/mono
%define _name gtk-sharp

Name: gtk-sharp2
Version: 2.12.29
Release: 1%{?_dist_release}
Summary: GTK+ bindings for Mono
Summary(ja): Mono 用 GTK+ バインディング

Group: System Environment/Libraries
License: LGPLv2
URL: http://www.mono-project.com/docs/gui/gtksharp/

Source: https://github.com/mono/%{_name}/archive/%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: mono-devel
BuildRequires: monodoc
BuildRequires: glib2-devel >= 2.12.0
BuildRequires: pango-devel
BuildRequires: atk-devel
BuildRequires: gtk2-devel >= 2.12.0
BuildRequires: libglade2-devel
BuildRequires: automake, libtool

BuildRequires: nkf

# Mono only availible on these:
ExclusiveArch: %{ix86} x86_64 ppc ia64 armv4l sparc s390 s390x

Vendor: Project Vine
Distribution: Vine Linux

%description
This package provides a library that allows you to build
fully native graphical GNOME applications using Mono. Gtk#
is a binding to GTK+, the cross platform user interface
toolkit used in GNOME. It includes bindings for Gtk, Atk,
Pango, Gdk, libgnome, libgnomeui and libgnomecanvas. Gtk#
2.12.x binds GTK+ 2.12.

%package gapi
Summary:      Glib and GObject C source parser and C generator for the creation and maintenance of managed bindings for Mono and .NET
Group:        Development/Tools
Requires:     perl-XML-LibXML-Common
Requires:     perl-XML-LibXML
Requires:     perl-XML-SAX

%description gapi
This package provides developer tools for the creation and
maintenance of managed bindings to native libraries which utilize
glib and GObject. Some examples of libraries currently bound using
the GAPI tools and found in Gtk# include Gtk, Atk, Pango, Gdk.

%package devel
Summary: Files needed for developing with gtk-sharp2
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig

%description devel
This package provides the necessary development libraries and headers
for writing gtk-sharp2 applications.

%package doc
Summary: Gtk# documentation
Group: Documentation
Requires: %{name} = %{version}-%{release}
Requires: monodoc

%description doc
This package provides the Gtk# documentation for monodoc.


%prep
%setup -q -n %{_name}-%{version}
./bootstrap-2.12

%build
export MONO_SHARED_DIR=%{_builddir}/%{?buildsubdir}
%configure --enable-silent-rules
make

%install
%{__rm} -rf $RPM_BUILD_ROOT
export MONO_SHARED_DIR=%{_builddir}/%{?buildsubdir}
make install DESTDIR=$RPM_BUILD_ROOT GACUTIL_FLAGS="/package gtk-sharp /gacdir %{_prefix}/lib /root ${RPM_BUILD_ROOT}%{_prefix}/lib"

## remove unused files
%{__rm} $RPM_BUILD_ROOT%{_libdir}/*.a
%{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la

mv $RPM_BUILD_ROOT%{mono_dir}/gtk-sharp $RPM_BUILD_ROOT%{mono_dir}/gtk-sharp-2.0

for file in $RPM_BUILD_ROOT%{_bindir}/gapi2-codegen $RPM_BUILD_ROOT%{_bindir}/gapi2-fixup $RPM_BUILD_ROOT%{_bindir}/gapi2-parser $RPM_BUILD_ROOT%{_prefix}/lib/gtk-sharp-2.0/gapi2xml.pl $RPM_BUILD_ROOT%{_prefix}/lib/gtk-sharp-2.0/gapi_pp.pl
do
	mv $file $file.orig
	nkf -w --unix $file.orig > $file
	chmod 755 $file
	rm $file.orig
done


%clean
%{__rm} -rf $RPM_BUILD_ROOT

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


%files
%defattr(-,root,root,-)
%doc COPYING ChangeLog README
%{_libdir}/libatksharpglue-2.so
%{_libdir}/libgdksharpglue-2.so
%{_libdir}/libgladesharpglue-2.so
%{_libdir}/libglibsharpglue-2.so
%{_libdir}/libgtksharpglue-2.so
%{_libdir}/libpangosharpglue-2.so
%dir %{_prefix}/lib/gtk-sharp-2.0
%{mono_dir}/gac/atk-sharp
%{mono_dir}/gac/gdk-sharp
%{mono_dir}/gac/glade-sharp
%{mono_dir}/gac/glib-sharp
%{mono_dir}/gac/gtk-dotnet
%{mono_dir}/gac/gtk-sharp
%{mono_dir}/gac/pango-sharp
%{mono_dir}/gac/policy.2.10.*
%{mono_dir}/gac/policy.2.4.*
%{mono_dir}/gac/policy.2.6.*
%{mono_dir}/gac/policy.2.8.*
%{mono_dir}/gtk-sharp-2.0

%files gapi
%defattr(-,root,root,-)
%{_bindir}/gapi2-codegen
%{_bindir}/gapi2-fixup
%{_bindir}/gapi2-parser
%{_prefix}/lib/gtk-sharp-2.0/gapi-fixup.exe
%{_prefix}/lib/gtk-sharp-2.0/gapi-parser.exe
%{_prefix}/lib/gtk-sharp-2.0/gapi_codegen.exe
%{_prefix}/lib/gtk-sharp-2.0/gapi2xml.pl
%{_prefix}/lib/gtk-sharp-2.0/gapi_pp.pl
%{_libdir}/pkgconfig/gapi-2.0.pc
%{_prefix}/share/gapi-2.0

%files devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/*-sharp-2.0.pc
%{_libdir}/pkgconfig/gtk-dotnet-2.0.pc

%files doc
%defattr(-,root,root,-)
%{_prefix}/lib/monodoc/sources/*


%changelog
* Thu Mar 26 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.12.29-1
- updated to 2.12.29
- built with mono 3.12.1

* Mon Nov  3 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.12.27-1
- updated to 2.12.27
- split devel and doc subpackage
- fixed gapi2xml.pl and gapi_pp.pl encoding

* Sun Dec 29 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.12.21-1
- update to 2.12.21

* Mon Apr 25 2011 Shu KONNO <owa@bg.wakwak.com> 2.12.10-6
- rebuilt with mono-2.10.1-3

* Sun Apr 03 2011 Shu KONNO <owa@bg.wakwak.com> 2.12.10-5
- rebuilt with mono-2.10.1

* Fri Oct 08 2010 Shu KONNO <owa@bg.wakwak.com> 2.12.10-4
- rebuilt with mono-2.8

* Wed Sep 22 2010 IWAI, Masaharu <iwai@alib.jp> 2.12.10-3
- build with rpm-4.8.1-1 for pkg-config file

* Wed Apr 14 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.12.10-2
- updated build dependencies

* Thu Apr 08 2010 Shu KONNO <owa@bg.wakwak.com> 2.12.10-1
- updated gtk-sharp to 2.12.10

* Sun Dec 27 2009 Shu KONNO <owa@bg.wakwak.com> 2.12.9-2
- rebuilt with mono-2.6.1

* Wed Jul 08 2009 Shu KONNO <owa@bg.wakwak.com> 2.12.9-1
- updated gtk-sharp to 2.12.9
- built with latest rpm to update mono-dependencies

* Sun Apr 05 2009 Shu KONNO <owa@bg.wakwak.com> 2.12.8-1vl5
- updated gtk-sharp to 2.12.8

* Mon Dec 29 2008 Shu KONNO <owa@bg.wakwak.com> 2.12.5-1vl5
- updated gtk-sharp to 2.12.5

* Wed Sep 17 2008 Shu KONNO <owa@bg.wakwak.com> 2.12.3-1vl5
- updated gtk-sharp to 2.12.3
- dropt gtk-sharp2-vtelibs.patch
- built with mono-2.0

* Wed Aug 27 2008 Shu KONNO <owa@bg.wakwak.com> 2.8.2-2vl5
- applied new versioning policy, spec in utf-8
- use automake-1.7

* Sun Apr  2 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 2.8.2-1vl1
- rebuilt for Vine Linux

* Fri Mar  3 2006 Christopher Aillon <caillon@redhat.com> - 2.8.2-1
- Update to 2.8.2 to fix an issue with marshalling on x86-64

* Fri Feb 10 2006 Christopher Aillon <caillon@redhat.com> - 2.8.1-1
- Update to 2.8.1

* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 2.8.0-1.1
- rebuilt for new gcc4.1 snapshot and glibc changes

* Tue Jan 31 2006 Christopher Aillon <caillon@redhat.com> 2.8.0-1
- Update to 2.8.0

* Thu Jan 19 2006 Alexander Larsson <alexl@redhat.com> 2.4.0-3
- Mono now builds on s390x

* Mon Jan  9 2006 Alexander Larsson <alexl@redhat.com> - 2.4.0-2
- Fix vte build

* Tue Nov 15 2005 Alexander Larsson <alexl@redhat.com> - 2.4.0-1
- Initial version
