###  for Vine Linux 4.x / 5.x / VineSeed ###

%define  pkg_version  2.8.0
%define  strtag       110203
%define  repoid       40140
%define  vendor_rel   1

%define  pre_release  0
%if %{pre_release}
%define  pkg_release  %{vendor_rel}.%{strtag}%{?_dist_release}
%else
%define  pkg_release  %{vendor_rel}%{?_dist_release}
%endif

## icon install dist dir
%define  icondir  %{_datadir}/icons/hicolor

## enable/disable sound (0:disable 1:enable)
%define  sound  1

Summary:      A 2ch browser
Summary(ja):  2ちゃんねる用ブラウザ
Name:         jd
Version:      %{pkg_version}
Release:      %{pkg_release}

Source0:  http://prdownloads.sourceforge.jp/jd4linux/%{repoid}/%{name}-%{version}-%{strtag}.tgz
Source1:  jd-vl.desktop

# Vine Patch
Patch1:	    jd-vine_env.patch

# upstream svn patches
# Patch100: jd-2.5.0_http_201.patch
# Patch100: jd-2.4.0_close_err_image.patch
# Patch110: jd-2.4.0_tag_drawing_fix.patch
# Patch100: jd-2.6.0_gtkmm28.patch
# Patch100: jd-2.7.0_maru_p2.patch
# Patch100: jd-2.7.5-command_line_color_config.patch
Patch110: jd-2.6.5_vine4.patch

License:  GPL
Group:    Applications/Internet
URL:      http://jd4linux.sourceforge.jp/

Requires:  gtkmm2 >= 2.8
Requires:  glibmm
Requires:  zlib >= 1.2
Requires:  pango
Requires:  gnutls >= 1.2
Requires(pre):  desktop-file-utils
# Prereq:    desktop-file-utils

BuildRequires:  libtool, automake, autoconf
BuildRequires:  gtkmm2-devel >= 2.8
BuildRequires:  glibmm-devel
BuildRequires:  zlib-devel >= 1.2
BuildRequires:  XOrg-devel
BuildRequires:  pango-devel
BuildRequires:  gnutls-devel >= 1.2
BuildRequires:  libgpg-error-devel
%if %{sound}
BuildRequires:  alsa-lib-devel
%endif
BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root

Packager: tomcat, iwamoto
Vendor: Project Vine
Distribution: Vine Linux

%description
JD is a 2ch browser based on gtkmm2.

%description -l ja
JD は gtkmm2 ベースの2ちゃんねる用ブラウザです。

%prep
%setup -q -n %{name}-%{version}-%{strtag}
# find . -name .svn | sort -r | xargs %{__rm} -rf

%patch1 -p1 -b .vine_env

# Patch 100 - 200 are upstream patches
# %patch100 -p2 -b .close_err_image
# %patch100 -p2 -b .gtkmm28
# %patch100 -p0 -b .maru_p2
# %patch100 -p0 -b .color

%if %{?_dist_release} == "vl4"
%patch110 -p1 -b .vine4
%endif

%build
autoreconf -i

## set TZ for __TIME__
export TZ='Asia/Tokyo'

%if %{sound}
%configure  --with-alsa 
%else
%configure
%endif

%{__make} %{?_smp_mflags}

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

%{__mkdir_p} ${RPM_BUILD_ROOT}%{_datadir}/applications
%{__install} -p -m644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_datadir}/applications/jd.desktop

for i in 16 32 48 96;do \
  %{__mkdir_p} ${RPM_BUILD_ROOT}%{icondir}/$i"x"$i/apps; \
  %{__install} -p -m644 src/icons/%{name}$i.png ${RPM_BUILD_ROOT}%{icondir}/$i"x"$i/apps/%{name}.png; \
done

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post
update-desktop-database %{_datadir}/applications

%postun
update-desktop-database %{_datadir}/applications


%files
%defattr(-,root,root)
%doc COPYING ChangeLog README
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{icondir}/*/apps/%{name}.png

%changelog
* Thu Feb  3 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.8.0-1
- new upstream release

* Wed Feb  2 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.8.0-0
- testpackage (not for release)
- drop patch100 (included in new release)

* Tue Feb  1 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.7.5-3
- use Requires(pre) tag instead of Prereq

* Tue Jan 11 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.7.5-2
- add patch100 to add config status line color setting

* Sat Jan  1 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.7.5-1
- 2.7.5 release

* Wed Dec 15 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.7.5-0.1
- 2.7.5 beta (not for release) 

* Sat Dec 11 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.7.5-0
- 2.7.5 beta (not for release)
- drop Patch100 (is included in new release)

* Fri Aug 27 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.7.0-2
- add patch1 to show vine package into environment 
- add patch100 to fix maru & p2 issue

* Tue Aug 24 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.7.0-1
- new upstream release

* Thu Apr 29 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.6.5-2
- add patch110 to fix build error on Vine4
- add BR: libgpg-error-devel

* Wed Apr 28 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.6.5-1
- new upstream release   
- drop Patch100 (is included in new release)

* Mon Mar 22 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.6.0-2
- add Patch100 to build fix with <= gtkmm28 (Vine 4.x env)

* Mon Feb  8 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.6.0-1
- new upstream release   

* Sat Feb  6 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.6.0-0.100130
- 2.6.0 rc1 (not for release)

* Tue Dec 29 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.5.5-1
- new upstream release  

* Mon Dec 28 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.5.5-0.091225
- 2.5.5 rc1 (not for release)

* Wed Dec 23 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.5.5-0.091220
- 2.5.5 beta (not for release)
- drop patch100 (included in new release)

* Sat Dec 12 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.5.0-1
- new upstream release 

* Mon Sep 28 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.4.2-1
- new upstream release

* Tue Sep 22 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp>
- 2.4.2-rc090921-0
- for test

* Mon Jul 13 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.4.1-1
- new upstream release

* Sat Jul 11 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 
- 2.4.1-rc090705-1
- new upstream rc release for testing
- drop patch100, 110 (included in new release)

* Sat May 30 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.4.0-2
- Merge spec file for vl4 and for vl5
- add patch100, 110 from upstream svn

* Sat May 23 2009 tomcat <webmaster2@tomcat.nyanta.jp> 2.4.0-1vl4
- new upstream release

* Fri Mar 06 2009 tomcat <webmaster2@tomcat.nyanta.jp> 2.3.0-1vl4
- new upstream release

* Fri Jan 16 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.1.0-2vl4
- fix icon file install method

* Sun Dec 28 2008 tomcat <webmaster2@tomcat.nyanta.jp> 2.1.0-1vl4
- new upstream release

* Mon Nov 24 2008 tomcat <webmaster2@tomcat.nyanta.jp> 2.0.3-1vl4
- new upstream release

* Wed Oct 01 2008 tomcat <webmaster2@tomcat.nyanta.jp> 2.0.2-1vl4
- rebuild for official

* Sun Sep 21 2008 tomcat <webmaster2@tomcat.nyanta.jp> 2.0.2-1tomvl4
- update to 2.0.2

* Sun Feb 03 2008 tomcat <webmaster2@tomcat.nyanta.jp> 1.9.8-1tom3
- build with gnutls-1.4.1(official package)

* Sun Dec 30 2007 tomcat <webmaster2@tomcat.nyanta.jp> 1.9.8-1tom2
- build with gnutls-1.6.3(unofficial package)

* Sat Dec 29 2007 tomcat <webmaster2@tomcat.nyanta.jp> 1.9.8-1tom1
- new upstream release
- drop Patch0 (jd-1.9.5-desktop-vi.patch)
- add Source1 (jd-vi.desktop)

* Fri Nov 23 2007 tomcat <webmaster2@tomcat.nyanta.jp> 1.9.7-1tom1
- new upstream release

* Sat Oct 06 2007 tomcat <webmaster2@tomcat.nyanta.jp> 1.9.6-1tom1
- new upstream release

* Wed Jul 04 2007 tomcat <webmaster2@tomcat.nyanta.jp> 1.9.5-1tom2
- modified jd-vi.spec
- add patch0

* Sun Jul 01 2007 tomcat <webmaster2@tomcat.nyanta.jp> 1.9.5-1
- new upstream release

* Wed May 23 2007 tomcat <webmaster2@tomcat.nyanta.jp> 1.8.8-2
- fix the Help file is not installed

* Wed Apr 04 2007 tomcat <webmaster2@tomcat.nyanta.jp> 1.8.8-1
- new upstream release

* Sat Feb 03 2007 tomcat <webmaster2@tomcat.nyanta.jp> 1.8.5-1
- new upstream release

* Mon Dec 18 2006 tomcat <webmaster2@tomcat.nyanta.jp> 1.8.1-1
- new upstream release

* Thu Nov 30 2006 tomcat <webmaster2@tomcat.nyanta.jp> 1.8.0-1
- initial build for Vine Linux

* Sun Mar  9 2006 Houritsuchu <houritsuchu@hotmail.com>
- Version up.
- add icon

* Sat Feb 25 2006 Houritsuchu <houritsuchu@hotmail.com>
- first