Name: libdbusmenu
Summary: Library that pulling out some code out of indicator-applet
Version: 12.10.2
Release: 1%{?_dist_release}

# All files installed in final rpms use C sources with dual licensing headers.
# Tests compiled in the build process are licensed GPLv3

License: LGPLv3 or LGPLv2 and GPLv3
Group: System Environment/Libraries
URL: https://launchpad.net/dbusmenu

Source0: https://launchpad.net/libdbusmenu/12.10/%{version}/+download/libdbusmenu-%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: chrpath
BuildRequires: glib2-devel
BuildRequires: gnome-common
BuildRequires: gnome-doc-utils
BuildRequires: gobject-introspection-devel
BuildRequires: gtk2-devel 
BuildRequires: intltool
BuildRequires: json-glib-devel
BuildRequires: perl-XML-Parser
BuildRequires: pkgconfig
BuildRequires: python
BuildRequires: vala-devel
BuildRequires: vala-tools
BuildRequires: valgrind-devel

Obsoletes: dbusmenu-glib < %{version}-%{release}
Provides: dbusmenu-glib = %{version}-%{release}

%description
libdbusmenu passes a menu structure across DBus so that a program 
can create a menu simply without worrying about how it is displayed 
on the other side of the bus.

%package devel
Summary: Development files for %{name}
Summary(ja): %{name} の開発用ファイル
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Obsoletes: dbusmenu-glib-devel < %{version}-%{release}
Provides:  dbusmenu-glib-devel = %{version}-%{release}

%description devel
%{summary}.

%package gtk
Summary: Gtk+ implementation of the DBusMenu protocol
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
Obsoletes: dbusmenu-gtk < %{version}-%{release}
Provides:  dbusmenu-gtk = %{version}-%{release}

%description gtk
%{summary}.

%package gtk-devel
Summary: Development files for dbusmenu-gtk
Summary(ja): dbusmenu-gtk の開発用ファイル
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
Requires: %{name}-gtk = %{version}-%{release}
Requires: gtk2-devel
Requires: dbus-glib-devel
Obsoletes: dbusmenu-gtk-devel < %{version}-%{release}
Provides:  dbusmenu-gtk-devel = %{version}-%{release}

%description gtk-devel
%{summary}.

%package jsonloader
Summary: Loader to turn JSON into dbusmenu menuitems
Group: System Environment/Libraries
Requires: %{name}-devel = %{version}-%{release}
Obsoletes: dbusmenu-jsonloader < %{version}-%{release}
Provides: dbusmenu-jsonloader = %{version}-%{release}

%description jsonloader
%{summary}.

%package jsonloader-devel
Summary: Development files for dbusmenu-jsonloader
Group: Development/Libraries
Requires: %{name}-jsonloader = %{version}-%{release}
Obsoletes: dbusmenu-jsonloader-devel < %{version}-%{release}
Provides:  dbusmenu-jsonloader-devel = %{version}-%{release}

%description jsonloader-devel
%{summary}.

%package doc
Summary: Document files for %{name}
BuildArch: noarch
Group: Documentation

%description doc 
The %{name}-doc package contains documents for
developing applications that use %{name}.

%package tools
Summary: Development tools for the dbusmenu libraries
Group: Development/Tools
Requires: %{name} = %{version}-%{release}
Obsoletes: dbusmenu-tools < %{version}-%{release}
Provides: dbusmenu-tools = %{version}-%{release}

%description tools
This package contains tools that are useful when developing and 
building applications with libdbusmenu.

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

%build
export CFLAGS="%{optflags} -Wno-error=deprecated-declarations"
%configure \
    --disable-static \
    --disable-scrollkeeper \
    --enable-silent-rules \
    --with-gtk=2 \
    --disable-dumper

sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
make %{?_smp_mflags} V=1


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT 

chrpath --delete $RPM_BUILD_ROOT%{_libdir}/libdbusmenu-gtk.so.4.0.12
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/libdbusmenu-jsonloader.so.4.0.12
chrpath --delete $RPM_BUILD_ROOT%{_libexecdir}/dbusmenu-testapp

find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'

rm -rf _docs/*
mkdir -p _docs
mv $RPM_BUILD_ROOT%{_docdir}/libdbusmenu/* _docs/

%check

%clean
rm -rf $RPM_BUILD_ROOT


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post gtk -p /sbin/ldconfig

%postun gtk -p /sbin/ldconfig

%post jsonloader -p /sbin/ldconfig

%postun jsonloader -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc README COPYING COPYING.2.1 COPYING-GPL3 AUTHORS
%{_libdir}/libdbusmenu-glib.so.*
%{_libdir}/girepository-1.0/Dbusmenu-0.4.typelib

%files devel
%defattr(-,root,root,-)
%doc _docs/examples
%dir %{_includedir}/libdbusmenu-glib-0.4/
%dir %{_includedir}/libdbusmenu-glib-0.4/libdbusmenu-glib/
%{_includedir}/libdbusmenu-glib-0.4/libdbusmenu-glib/*.h
%{_libdir}/libdbusmenu-glib.so
%{_libdir}/pkgconfig/dbusmenu-glib-0.4.pc
%{_datadir}/gir-1.0/Dbusmenu-0.4.gir
%{_datadir}/vala/vapi/Dbusmenu-0.4.vapi

%files gtk
%defattr(-,root,root,-)
%{_libdir}/libdbusmenu-gtk.so.*
%{_libdir}/girepository-1.0/DbusmenuGtk-0.4.typelib

%files gtk-devel
%defattr(-,root,root,-)
%dir %{_includedir}/libdbusmenu-gtk-0.4
%dir %{_includedir}/libdbusmenu-gtk-0.4/libdbusmenu-gtk
%{_includedir}/libdbusmenu-gtk-0.4/libdbusmenu-gtk/*.h
%{_libdir}/libdbusmenu-gtk.so
%{_libdir}/pkgconfig/dbusmenu-gtk-0.4.pc
%{_datadir}/gir-1.0/DbusmenuGtk-0.4.gir
%{_datadir}/vala/vapi/DbusmenuGtk-0.4.vapi

%files jsonloader
%defattr(-,root,root,-)
%{_libdir}/libdbusmenu-jsonloader.so.*

%files jsonloader-devel
%defattr(-,root,root,-)
%dir %{_includedir}/libdbusmenu-glib-0.4/
%dir %{_includedir}/libdbusmenu-glib-0.4/libdbusmenu-jsonloader/
%{_includedir}/libdbusmenu-glib-0.4/libdbusmenu-jsonloader/*.h
%{_libdir}/libdbusmenu-jsonloader.so
%{_libdir}/pkgconfig/dbusmenu-jsonloader-0.4.pc

%files doc 
%doc README COPYING COPYING.2.1 AUTHORS
%dir %{_datadir}/gtk-doc/
%{_datadir}/gtk-doc/*

%files tools
%defattr(-,root,root,-)
%doc _docs/README.dbusmenu-bench
%{_libexecdir}/dbusmenu-*
%{_datadir}/libdbusmenu/json/test-gtk-label.json

%changelog
* Mon Nov  3 2014 Ryoichi INAAGKI <ryo1@toki.waseda.jp> 12.10.2-1
- updated to 12.10.2
- renamed to libdbusmenu

* Sun Feb 27 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.3.16-2
- add BuildRequires: gtk2-devel, libxml2-devel

* Thu Feb 17 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.3.16-1
- Initial build for VineLinux

