%define build_vine5 0

%if "%{?_dist_release}" == "vl5"
%define build_vine5 1
%endif

Summary:	Standalone graphical debugger for GNOME
Summary(ja): 	GNOME 向けの GUI デバッガ
Name:		nemiver
Version:	0.8.0
Release: 	1%{?_dist_release}
Source0:	%{name}-%{version}.tar.bz2
Patch0:		nemiver-0.8.0-below-gtkmm2.18.0.patch
License:	GPLv2
Group:		Applications/Development
URL:		http://projects.gnome.org/nemiver/

Requires:	gdb
Requires:	ghex > 2.21.4
Requires(pre):	GConf2
Requires(post):	GConf2, desktop-file-utils, scrollkeeper
Requires(postun):GConf2, desktop-file-utils, scrollkeeper
BuildRequires:	ghex > 2.21.4
BuildRequires:	gdb
BuildRequires:	gnome-doc-utils >= 0.3.2
BuildRequires:	gtkmm2-devel >= 2.14.0
BuildRequires:	gtksourceviewmm-devel >= 1.9.4
BuildRequires:	libgtop2-devel >= 2.14
BuildRequires:	vte-devel >= 0.12.0
BuildRequires:	GConf2-devel >= 2.14.0
BuildRequires:	sqlite3-devel >= 3.0
BuildRequires:	libboost-devel >= 1.33.1

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

Packager:	kazutaka

%description
Nemiver is a standalone graphical debugger that integrates well in the
GNOME desktop environment.  It currently features a backend which uses
the GNU debugger GDB for debugging C/C++ programs.

%description -l ja
Nemiver は GNOME デスクトップ向けのスタンドアローンな GUI デバッガです。
C/C++ プログラムのデバッグのバックエンドには GDB (GNU デバッガ)を利用
しています。

%package devel
Summary:	Libraries and headers for %{name}
Summary(ja):	%{name} 用の開発ライブラリおよびヘッダファイル
Group:		Development/Libraries
Requires:	%{name} = %{version}

%description devel
This package includes the files needed for developing and compiling
applications which use the %{name} library.

You should install the %{name}-devel package if you would like to
develop applications using %{name}.

%description devel -l ja
このパッケージは %{name} ライブラリを使用するアプリケーションを開発
するのに必要なライブラリやヘッダファイルを含んでいます。

%{name} を使用したアプリケーションを開発するなら、このパッケージ
をインストールしてください。

%prep
%setup -q
%if %{build_vine5}
%patch0 -p1 -b .below-gtkmm218
%endif

%build
%configure --disable-static \
           --disable-scrollkeeper \
           --disable-schemas-install

%{__make} %{?_smp_mflags}


%install
%{__rm} -rf $RPM_BUILD_ROOT
%{__make} install DESTDIR=$RPM_BUILD_ROOT
%find_lang %{name}

# remove unnecessary files
find $RPM_BUILD_ROOT/%{_libdir} -name "*.la" -exec %{__rm} -f "{}" \;


%clean
%{__rm} -rf $RPM_BUILD_ROOT


%pre
# uninstall old schemas before update
if [ "$1" -gt 1 ]; then
  export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
  SCHEMAS="nemiver-dbgperspective.schemas nemiver-workbench.schemas"
  for S in $SCHEMAS; do
    echo %{_sysconfdir}/gconf/schemas/$S ; done \
    | xargs gconftool-2 --makefile-uninstall-rule >& /dev/null ||:
fi

%post
update-desktop-database %{_datadir}/applications >& /dev/null ||:
scrollkeeper-update > /dev/null 2>&1 || :
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache -q %{_datadir}/icons/hicolor ||:
fi

# install schemas after install/update
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
SCHEMAS="nemiver-dbgperspective.schemas nemiver-workbench.schemas"
for S in $SCHEMAS; do
  echo %{_sysconfdir}/gconf/schemas/$S ; done \
  | xargs gconftool-2 --makefile-install-rule >& /dev/null ||:

%preun
# uninstall schemas before clean remove
if [ "$1" -eq 0 ]; then
  export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
  SCHEMAS="nemiver-dbgperspective.schemas nemiver-workbench.schemas"
  for S in $SCHEMAS; do
    echo %{_sysconfdir}/gconf/schemas/$S ; done \
    | xargs gconftool-2 --makefile-uninstall-rule >& /dev/null ||:
fi

%postun
update-desktop-database %{_datadir}/applications >& /dev/null ||:
scrollkeeper-update > /dev/null 2>&1 || :
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache -q %{_datadir}/icons/hicolor ||:
fi


%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS COPYING COPYRIGHT ChangeLog INSTALL NEWS
%doc README TODO
%{_bindir}/%{name}
%{_libdir}/%{name}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/16x16/apps/%{name}.png
%{_datadir}/icons/hicolor/22x22/apps/%{name}.png
%{_datadir}/icons/hicolor/24x24/apps/%{name}.png
%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/gnome/help/%{name}
%{_datadir}/omf/%{name}
%{_mandir}/man1/nemiver.1*
%{_sysconfdir}/gconf/schemas/nemiver-dbgperspective.schemas
%{_sysconfdir}/gconf/schemas/nemiver-workbench.schemas

%files devel
%{_includedir}/%{name}


%changelog
* Sun Oct 24 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 0.8.0-1
- initial build for Vine Linux
- add patch0 to fix compile error with gtkmm-2.14 (for Vine Linux 5)
