%define inchi_so_ver 1.02.00

Summary: The IUPAC International Chemical Identifier library
Summary(ja): IUPAC International Chemical Identifier (InChI)ライブラリ
Name: inchi
Version: 1.0.2
Release: 1%{?_dist_release}
Group: System Environment/Libraries
License: LGPLv2+
URL: http://www.iupac.org/inchi/
Source0: http://www.iupac.org/inchi/download/inchi102b.zip
Patch0: %{name}-rpm.patch

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

%description
The IUPAC International Chemical Identifier (InChITM) is a non-proprietary
identifier for chemical substances that can be used in printed and
electronic data sources thus enabling easier linking of diverse data
compilations. It was developed under IUPAC Project 2000-025-1-800 during
the period 2000-2004. Details of the project and the history of its
progress are available from the project web site.

%package devel
Summary: Development headers for the InChI library
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
The inchi-devel package includes the header files and libraries
necessary for developing programs using the InChI library.

If you are going to develop programs which will use this library
you should install inchi-devel.  You'll also need to have the
inchi package installed.

%prep
%setup -q -n InChI-1-software-1-02-beta
%patch0 -p1 -b .r

%build
pushd INCHI_API/gcc_so_makefile
make OPTFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
popd

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT{%{_libdir},%{_includedir}/inchi}
install -p INCHI_API/gcc_so_makefile/result/libinchi.so.%{inchi_so_ver} $RPM_BUILD_ROOT%{_libdir}
ln -s libinchi.so.%{inchi_so_ver} $RPM_BUILD_ROOT%{_libdir}/libinchi.so.1
ln -s libinchi.so.1               $RPM_BUILD_ROOT%{_libdir}/libinchi.so
sed -i 's/\r//' INCHI_API/INCHI_DLL/inchi_api.h
install -pm644 INCHI_API/INCHI_DLL/inchi_api.h $RPM_BUILD_ROOT%{_includedir}/inchi
sed -i 's/\r//' LICENSE readme.txt

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc LICENSE readme.txt Software-1-02-beta.pdf
%{_libdir}/libinchi.so.*

%files devel
%defattr(-,root,root,-)
%{_includedir}/inchi
%{_libdir}/libinchi.so

%changelog
* Wed Aug 26 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 1.0.2-1
- Initial build for Vine Linux

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-0.5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-0.4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.0.2-0.3
- Autorebuild for GCC 4.3

* Mon Oct 01 2007 Dominik Mierzejewski <rpm@greysector.net> 1.0.2-0.2
- updated license tag
- fixed non-Unix EOLs in docs
- fixed dangling symlinks

* Thu Sep 06 2007 Dominik Mierzejewski <rpm@greysector.net> 1.0.2-0.1
- updated to 1.02b
- dropped WDI patch (upstream'd)
- updated license tag

* Sun Jul 01 2007 Dominik Mierzejewski <rpm@greysector.net> 1.0.1-8
- initial build