Name:		bluefish
Version:	2.2.7
Release:	1%{?_dist_release}
Summary:	Web development application for experienced users
Summary(ja): 	経験豊富なユーザー向けの Web 開発アプリケーション
Group:		Applications/Editors
License:	GPLv3+
URL:		http://bluefish.openoffice.nl/

Source0:	http://www.bennewitz.com/bluefish/stable/source/%{name}-%{version}.tar.bz2
# Upstream source contains non-free jsmin.py
# To generate clean source, simply rm -rf data/jsmin.py
# We provide a replacement in Source1.
Source1:	https://raw.github.com/v8/v8/master/tools/jsmin.py

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	desktop-file-utils
BuildRequires:	enchant-devel >= 1.4.2
BuildRequires:	gettext
BuildRequires:	glib2-devel >= 2.24
%if "%{?_dist_release}" < "vl7"
BuildRequires:	gtk2-devel >= 2.20
BuildRequires:	gucharmap-devel >= 2.20
%else
BuildRequires:	gtk3-devel >= 3.2
BuildRequires:	gucharmap-devel >= 2.90
%endif
BuildRequires:	intltool
BuildRequires:	libxml2-devel
BuildRequires:	python-devel
# Needed to check man pages
BuildRequires:	/usr/bin/man
# For the Advanced Open function
Requires:	findutils, grep
Requires:	%{name}-shared-data = %{version}-%{release}

# Automatically upgrade bluefish-unstable
Obsoletes:	bluefish-unstable < %{version}-%{release}
Provides:	bluefish-unstable = %{version}-%{release}

# XML Catalog registration
Requires(post): /usr/bin/xmlcatalog, xml-common
Requires(postun): /usr/bin/xmlcatalog, xml-common

# Don't "provide" plugin shared objects
#%{?filter_setup:
#%filter_provides_in %{_libdir}/%{name}/.*\.so$
#%filter_setup
#}

# Move to unversioned documentation directories from F-20
# https://fedoraproject.org/wiki/Changes/UnversionedDocdirs
%global bluefish_docdir %{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}

%description
Bluefish is a powerful editor for experienced web designers and programmers.
Bluefish supports many programming and markup languages, but it focuses on
editing dynamic and interactive websites.

%package shared-data
Summary:	Architecture-independent data for %{name}
Summary(ja):	アーキテクチャに依存しない %{name} 共用データ
Group:		Applications/Editors
BuildArch:	noarch
# For ownership of %%{_datadir}/mime/packages
Requires:	shared-mime-info
# For ownership of %%{_datadir}/icons/hicolor/*/{apps,mimetypes}
Requires:	hicolor-icon-theme

# Automatically upgrade bluefish-unstable-shared-data
Obsoletes:	bluefish-unstable-shared-data < %{version}-%{release}
Provides:	bluefish-unstable-shared-data = %{version}-%{release}

%description shared-data
Files common to every architecture version of %{name}.

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

cp -a %{SOURCE1} data/
sed -i 's|python2.4|python|g' data/jsmin.py

%build
%configure \
    --disable-dependency-tracking \
    --disable-static \
    --disable-update-databases \
    --disable-xml-catalog-update \
    --docdir=%{bluefish_docdir}
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_datadir}/applications
make install DESTDIR=%{buildroot} INSTALL="install -p"

# Make zencoding plugin scripts executable to placate rpmlint
find %{buildroot}%{_datadir}/bluefish/plugins/zencoding -name '*.py' |
	xargs awk '/^#!/ { print FILENAME }' |
	xargs chmod -c +x

%find_lang %{name}
%find_lang %{name}_plugin_about
%find_lang %{name}_plugin_charmap
%find_lang %{name}_plugin_entities
%find_lang %{name}_plugin_htmlbar
%find_lang %{name}_plugin_infbrowser
%find_lang %{name}_plugin_snippets
%find_lang %{name}_plugin_zencoding
cat %{name}_plugin_{about,charmap,entities,htmlbar,infbrowser,snippets,zencoding}.lang >> \
	%{name}.lang

desktop-file-validate \
	%{buildroot}%{_datadir}/applications/%{name}.desktop

# Manually install docs so that they go into
# %%{bluefish_docdir} even though we put them in the
# shared-data subpackage
install -m 644 -p -t %{buildroot}%{bluefish_docdir}/ \
	AUTHORS ChangeLog COPYING NEWS README TODO

# Unpackaged files
rm -f %{buildroot}%{_libdir}/%{name}/*.la

%clean
rm -rf %{buildroot}

%post
/usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || :
/usr/bin/update-desktop-database &> /dev/null || :
/usr/bin/xmlcatalog --noout --add 'delegateURI' \
	'http://bluefish.openoffice.nl/ns/bflang/2.0/' \
	'%{_datadir}/xml/%{name}' \
	%{_sysconfdir}/xml/catalog &> /dev/null || :

%postun
/usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || :
/usr/bin/update-desktop-database &> /dev/null || :
if [ "$1" = 0 ]; then
	/usr/bin/xmlcatalog --noout --del \
		'http://bluefish.openoffice.nl/ns/bflang/2.0/' \
		%{_sysconfdir}/xml/catalog &> /dev/null || :
fi

%files
%defattr(-,root,root,-)
%{_bindir}/%{name}
%{_libdir}/%{name}/

%files shared-data -f %{name}.lang
%defattr(-,root,root,-)
%doc %{bluefish_docdir}/
%{_datadir}/%{name}/
%{_datadir}/appdata/*.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/mime/packages/%{name}.xml
%{_datadir}/icons/hicolor/*/mimetypes/application-x-bluefish-project.png
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/icons/hicolor/scalable/mimetypes/bluefish-project.svg
%{_datadir}/icons/hicolor/scalable/apps/bluefish-icon.svg
%{_datadir}/pixmaps/application-x-bluefish-project.png
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/xml/%{name}/
%{_mandir}/man1/%{name}.1*

%changelog
* Sun Mar 15 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.2.7-1
- new upstream release

* Fri Nov  7 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.2.6-1
- new upstream release
- moved shared-data subpackage to Applications/Editors Group
- updated Summary

* Thu Jan 23 2014 TANAKA hiroaki <mosaicist@jcom.home.ne.jp> 2.2.4
- all resources renew from fedora bluefish-2.2.4-3.fc20.src.rpm

* Sun Aug 21 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0.3-1
- new upstream release
- built without gucharmap (VineSeed)
- added BR: libxml2-devel

* Tue Oct 12 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0.2-1
- new upstream release

* Sun Jul 25 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0.1-1
- new upstream release

* Fri Mar 19 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0.0-1
- new upstream release
- updated BR

* Thu Jul 30 2009 Munehiro Yamamoto <munepi@vinelinux.org> 1.0.7-2
- added Japanese description

* Fri Sep 19 2008 Shu KONNO <owa@bg.wakwak.com> 1.0.7-1vl5
- applied new versioning policy, spec in utf-8

* Tue Nov  7 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.7-0vl2
- rebuilt for Vine Linux 4.0

* Tue Nov  7 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.7-0vl1
- new upstream release

* Sat Feb 25 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.5-0vl3
- rebuild for VineSeed Plus

* Sat Feb 25 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.5-0vl2
- rebuit for VinePlus/3.0
- dropped Patch0 (fixed at upstream version)

* Wed Feb 15 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.5-0vl1
- new upstream release

* Tue Sep  6 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.4-0vl1.1
- added Patch0 for disable PCRE_UTF8 in highlighting

* Sat Sep  3 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.4-0vl1
- new upstream release

* Thu Aug 25 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.3-0vl2
- rebuild for VineSeed Plus

* Thu Aug 25 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.3-0vl1
- new upstream release

* Tue Aug 16 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.2-0vl2
- rebuild for VineSeed Plus

* Tue Aug 16 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.2-0vl1
- new upstream release

* Mon Jun 13 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.1-0vl3
- rebuild for VineSeed Plus

* Mon Jun 13 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.1-0vl2
- rebuild for VinePlus/3.1 
- added BuildRequires: shared-mime-info

* Sun Jun  5 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.1-0vl1
- new upstream release

* Thu May 26 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0-0vl2
- rebuild for VineSeed Plus
- added --disable-update-databases option
- run update-mime-database on %post
- added Prereq: shared-mime-info

* Sun Feb  6 2005 Masaki Shinomiya <shino@pos.to> 1.0-0vl1
- new upstream release, make install, files. desktop, compile ja.po

* Sun Apr 18 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.13-0vl1
- new upstream release
- dropped patch0

* Mon Jul 28 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.11-0vl1
- new upstream release

* Fri Jul 18 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.10-0vl1
- Rebuild with new toolchains and Gnome2 for VineSeedPlus
- add makefile.patch to fix Makefile.in
- modified encodings.default

* Fri Aug 2 2002 Masaki Shinomiya <shino@pos.to>
- 0.7-0vl1 for VinePllus2.1, 0.7-0vl2 for VinePlus2.5/VineSeedPlus
- vine.patch, without perl

* Fri Mar  1 2002 Shingo Akagaki <dora@kondara.org>
- (0.7-8k)
- fix file attributes

* Thu Feb 21 2002 Shingo Akagaki <dora@kondara.org>
- (0.7-6k)
- rebuild against for db3,4

* Thu Feb 07 2002 Motonobu Ichimura <famao@kondara.org>
- (0.7-4k)
- add perl,attrpage,internal-preview support

* Thu Feb 07 2002 Motonobu Ichimura <famao@kondara.org>
- (0.7-2k)
- add xim patch
- up to 0.7

* Thu Oct 18 2001 Motonobu Ichimura <famao@kondara.org>
- (0.6-4k)
- not egcs, but gcc2.95.3

* Thu Oct 18 2001 Motonobu Ichimura <famao@kondara.org>
- (0.6-2k)
- up to 0.6
- add BuildRequires: egcs ...
- include .desktop file

* Wed Oct 17 2001 Toru Hoshina <t@kondara.org>
- (0.4-10k)
- rebuild against gettext 0.10.40.

* Mon Oct 15 2001 Toru Hoshina <t@kondara.org>
- (0.4-8k)
- rebuild against libpng 1.2.0.

* Sat Dec  2 2000 MATSUDA, Daiki <dyky@df-usa.com>
- (0.4-4k)
- modified spec file with macros

* Thu Jul 13 2000 AYUHANA Tomonori <l@kondara.org>
- (0.4-2k)
- SPEC fixed ( BuildRoot )
- missing bluefish.desktop!

* Tue Jun 13 2000 haruka kusumi <haruka76@kondara.org>
  - changed some items for kondara 

* Fri May 5 2000   Bo Forslund  <bo.forslund@abc.se>
  - fine tuning of the spec file
  - possible to build with all processors on smp machines
  - an entry for RedHats wmconfig

* Tue Mar 21 2000 CW Zuckschwerdt <zany@triq.net>
  - complete rewrite of spec file
  - relocateable on build-time
  - no privileges required while building
  - fix for install_location (should really be $(LIBDIR)/bluefish!)
  - included man, locale and lib into RPM (was seriously broken)

* Thu Jan 13 2000 Chris Lea <chrislea@luciddesigns.com>
  - Fixed up spec file some. bluefish-0.3.5

* Wed Nov 17 1999 Chris Lea <chrislea@luciddesigns.com>
  - added spec file. this is my third RPM that I've made a spec
    file for, so please be merciful if I've screwed something up
