Name:           bist
Version:        0.4.7
Release:        1%{?dist}
Summary:        Chemical drawing tool
Group:          Applications/Editors
License:        GPLv3
URL:            http://www.autistici.org/interzona/index.php
Source0:        http://www.autistici.org/ftrack.php?url=sections/06_Download/%{name}-%{version}.tar.bz2
Patch0:		bist-config.patch
Patch1:		bist-makefile.patch
Patch2:		bist-po-update.patch
Patch3:		bist-wrapbracket.patch	
Source1:	bist.png
Source2:	bist.desktop
BuildRequires: 	fltk-devel openbabel-devel qt-devel plotutils-devel expat-devel
BuildRequires:	libXpm-devel libcurl-devel glibc-headers gsl-devel 
BuildRequires:	libjpeg-devel libpng-devel shared-mime-info
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
Bist stands for bidimensional structures and is a chemical drawing
tool. It is focused on organic chemistry but it may be useful for
chemists or teachers as well

%package plugins
Summary:	Plugins for bist
Group:		Applications/Editors
Requires:	%{name} = %{version}-%{release}

%description plugins
Plugins for bist

%prep
%setup -q -n %{name}-%{version}
sed -i -e 's!@libdir@!%{_libdir}!' %{PATCH0}
sed -i -e 's!@lib@!%{_lib}!' %{PATCH1}
%patch0 -p1 -b .original
%patch1 -p1 -b .original
sed -i -e 's!%{_libdir}!@libdir@!' %{PATCH0}
sed -i -e 's!%{_lib}!@lib@!' %{PATCH1}
%patch2 -p1 -b .original
%patch3 -p1 -b .original
cp %{SOURCE1} .

%build
%configure --disable-static
make

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%find_lang %{name}

mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/%{name}
install -m0644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/%{name}.png

mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
cp %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor fedora \
        --dir %{buildroot}%{_datadir}/applications \
        --add-category X-Fedora \
        --delete-original \
        %{buildroot}%{_datadir}/applications/bist.desktop

rm -f $RPM_BUILD_ROOT%{_datadir}/locale/bist/*.original

%post
update-desktop-database &> /dev/null || :

%postun
update-desktop-database &> /dev/null || :

%clean
rm -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc BUGS README TODO doc/about.html doc/bistlogo.png doc/index.html doc/scr0.3.jpg
%{_bindir}/bist
%{_datadir}/bist
%{_datadir}/locale/bist
%{_mandir}/man1/bist.1.gz
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{_datadir}/applications/fedora-bist.desktop
%exclude %{_datadir}/doc/%{name}

%files plugins
%{_libdir}/bist

%changelog
* Tue Apr 22 2008 Paul F. Johnson <paul@all-the-johnsons.co.uk> 0.4.7-1
- Initial import
