%define with_mono 1

Summary:       Library to access the iPod
Summary(ja):   iPod にアクセスするためのライブラリ
Name:          libgpod
Version:       0.8.3
Release:       6%{?_dist_release}
Group:         System Environment/Libraries
License:       LGPLv2+
URL:           http://www.gtkpod.org/libgpod.html

Source0:       %{name}-%{version}.tar.bz2

# Vine Patch
Patch100:      %{name}-0.8.3-python-uncomment.patch

Buildroot:     %{_tmppath}/%{name}-%{version}-root
BuildRequires: docbook-style-xsl
BuildRequires: glib2-devel
BuildRequires: gtk2-devel
BuildRequires: gettext
BuildRequires: intltool
BuildRequires: libimobiledevice-devel >= 1.1.4
BuildRequires: libplist-devel >= 1.0
BuildRequires: libusb1-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt
BuildRequires: libffi-devel
BuildRequires: perl(XML::Parser)
BuildRequires: pygobject-devel
BuildRequires: python-devel
BuildRequires: python-mutagen
BuildRequires: sg3_utils-devel
BuildRequires: sqlite3-devel
BuildRequires: taglib-devel
BuildRequires: swig
%if %{with_mono}
BuildRequires: mono-devel
BuildRequires: gtk-sharp2-devel
%endif

Requires:      udev

Vendor:        Project Vine
Distribution:  Vine Linux
Packager:      daisuke

%description
libgpod is a library meant to abstract access to an iPod content. It
provides an easy to use API to retrieve the list of files and playlist
stored on an iPod, to modify them and to save them back to the iPod.

%description -l ja
libgpod は iPod のコンテンツにアクセスするためのライブラリです。
iPod に格納されているファイルリストやプレイリストを取得し、変更し、
iPod に書き戻すための API が提供されています。

%package devel
Summary:     Support files necessary to compile applications with libgpod.
Summary(ja): libgpod を使うアプリケーションのコンパイルに必要なファイル.
Group:       Development/Libraries
Requires:    libgpod = %{version}-%{release}
Requires:    glib2-devel
Requires:    gtk2-devel

%description devel
Libraries, headers, and support files necessary to compile applications using libgpod.

%description -l ja devel
libgpod を使ったアプリケーションのコンパイルに必要なライブラリ，ヘッダファイルなどが含まれています．

%package -n python-gpod
Summary:     Python module to access iPod content
Summary(ja): iPod にアクセスするための Python モジュール
Group:       System Environment/Libraries
Requires:    %{name} = %{version}-%{release}
Requires:    python-mutagen

%description -n python-gpod
A python module to access iPod content. This module provides bindings to the libgpod library.


%if %{with_mono}
%package sharp
Summary:     C#/.NET library to access iPod content
Summary(ja): iPod にアクセスするための C#/.NET ライブラリ
Group:       System Environment/Libraries
Requires:    %{name} = %{version}-%{release}

%description sharp
C#/.NET library to access iPod content.  Provides bindings to the libgpod library.

%package sharp-devel
Summary:     Development files for libgpod-sharp
Summary(ja): libgpod-sharp の開発用ファイル
Group:       Development/Libraries
Requires:    %{name}-sharp = %{version}-%{release}
Requires:    pkgconfig

%description sharp-devel
C#/.NET library to access iPod content. Provides bindings to the libgpod library.

This package contains the files required to develop programs that will use
libgpod-sharp.
%endif


%prep
%setup -q
%patch100 -p1 -b .uncomment

chmod -x bindings/python/examples/*.py

%build
%configure \
    --without-hal \
    --enable-udev \
    --with-temp-mount-dir=%{_localstatedir}/run/%{name}
make %{?_smp_mflags}

%install
if [ -d $RPM_BUILD_ROOT ]; then rm -rf $RPM_BUILD_ROOT; fi

make DESTDIR=%{buildroot} install

%find_lang %{name}

rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.{a,la}
rm -f $RPM_BUILD_ROOT%{python_sitearch}/gpod/*.{a,la}

%clean
if [ -d $RPM_BUILD_ROOT ]; then rm -rf $RPM_BUILD_ROOT; fi

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files -f %{name}.lang
%defattr(-, root, root, 0755)
%doc AUTHORS ChangeLog COPYING README
%{_bindir}/*
%{_libdir}/lib*.so.*
%dir %{_localstatedir}/run/%{name}
/lib/udev/iphone-set-info
/lib/udev/ipod-set-info
/lib/udev/rules.d/*.rules

%files devel
%defattr(-, root, root, 0755)
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/%{name}-1.0.pc
%{_includedir}/gpod-1.0/
%{_datadir}/gtk-doc/html/%{name}

%files -n python-gpod
%defattr(-, root, root, 0755)
%doc COPYING bindings/python/README bindings/python/examples
%{python_sitearch}/gpod

%if %{with_mono}
%files sharp
%defattr(-, root, root, 0755)
%{_libdir}/%{name}/%{name}-sharp*

%files sharp-devel
%defattr(-, root, root, 0755)
%{_libdir}/pkgconfig/%{name}-sharp.pc
%endif


%changelog
* Thu May 21 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 0.8.3-6
- rebuilt with libimovbiledevice 1.2.0 and libplist 1.12

* Sat Mar 28 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 0.8.3-5
- rebuilt with mono 3.12.1

* Sun Mar  8 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 0.8.3-4
- added patch100 to build swig 3.0.5
- moved %%{_libdir}/pkgconfig/libgpod-sharp.pc to sharp subpackage

* Wed Nov 12 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 0.8.3-3
- moved sharp subpackage to System Environment/Libraries Group
- moved sharp-devel subpackage to Development/Libraries Group

* Wed Jul 09 2014 Daisuke SUZUKI <daisuke@vinelinux.org> 0.8.3-2
- rebuild with new libplist, libimobiledevice

* Sat Jan 04 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.3-1
- new upstream release

* Sun Mar 24 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.2-2
- rebuild with libimobiledevice-1.1.5

* Sun Jun 03 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.2-1
- update to 0.8.2
- remove Patch0
- add BuildRequires: mono-devel, gtk-sharp2, taglib-devel
- create sharp and sharp-devel package

* Wed Apr 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.0-4
- rebuild with libimobiledevice-1.1.4

* Thu Feb 16 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.0-3
- rebuild with python-2.7.2

* Tue Aug 16 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.0-2
- rebuild with libimobiledevice-1.1.1

* Fri Jun 10 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 0.8.0-1
- update to 0.8.0

* Tue Sep 28 2010 Shu KONNO <owa@bg.wakwak.com> 0.7.93-2
- rebuilt with rpm-4.8.1 for pkg-config

* Sat Jun 26 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 0.7.93-1
- new upstream release
- add configure option (disable hal, enable udev, specify temp mount dir)
- add python subpackage
- add BR:

* Wed Jun 10 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.7.2-1
- new upstream release
- remove static library

* Sat Oct 11 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.0-3vl5
- added BuildRequires: libffi-devel

* Thu Oct 09 2008 Shu KONNO <owa@bg.wakwak.com> 0.6.0-2vl5
- spec in utf-8

* Thu Apr 10 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6.0-1vl5
- applied new versioning policy

* Thu Jan 03 2008 Satoshi MACHINO <machino@vinelinux.org> 0.6.0-0vl1
- new upstream release

* Tue May 29 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.4.2-0vl2
- for VineSeedPlus
- new upstream release
- built with new toolchain

* Sun Oct  1 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.4.0-0vl1
- new upstream release
- build with dbus-0.62

* Mon Mar 13 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 0.3.2-0vl1
- new upstream release
- build with dbus-0.61

* Wed Dec 14 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.3.0-0vl1
- initial package
