Name: openjpeg
Summary: JPEG 2000 codec library
Summary(ja): JPEG 2000 コーデックライブラリ
Version: 1.4
Release: 1%{?_dist_release}
Group: System Environment/Libraries
License: BSD
URL: http://www.openjpeg.org/

Source0: http://openjpeg.googlecode.com/files/%{name}_v1_4_sources_r697.tgz

## upstreamable patches
# libopenjpeg has undefined references, http://bugzilla.redhat.com/467661
# http://groups.google.com/group/openjpeg/browse_thread/thread/fba9ad2a35b12e6a
Patch50: openjpeg-1.4-no_undefined.patch
# fix autoconf buildsys (+DESTDIR support mostly) 
# http://groups.google.com/group/openjpeg/browse_thread/thread/6326363ebb969a99
Patch52: openjpeg-1.4-autoconf.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: automake libtool 
BuildRequires: libtiff-devel
BuildRequires: lcms-devel

%description
The OpenJPEG library is an open-source JPEG 2000 codec written in C language.
It has been developed in order to promote the use of JPEG 2000, the new
still-image compression standard from the Joint Photographic Experts Group
(JPEG).

%package  devel
Summary: Development files for openjpeg
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
The openjpeg-devel package contains libraries and header files for
developing applications that use openjpeg.

%package tools
Summary: Command-line tools using the JPEG 2000 library
Group: Applications/Graphics
Requires: %{name} = %{version}-%{release}

%description tools
The openjpeg-tools package provides with command-line tools allowing 
for conversions between several formats.


%prep
%setup -q -n openjpeg_v1_4_sources_r697 %{?runcheck:-a 1}
# Make sure we use system libraries
rm -rf libs

%patch50 -p1 -b .no_undefined
%patch52 -p1 -b .autoconf
autoreconf -i -f

%build
%configure \
    --enable-shared \
    --disable-static \
    --enable-lcms2=no \
    --enable-lcms1=yes

make

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.la

ln -s openjpeg-1.4 $RPM_BUILD_ROOT%{_includedir}/openjpeg


%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc CHANGES LICENSE 
%{_libdir}/libopenjpeg.so.*
%{_mandir}/man3/*

%files devel
%defattr(-,root,root,-)
%{_includedir}/openjpeg-1.4/
%{_libdir}/libopenjpeg.so
%{_libdir}/pkgconfig/lib*.pc
# legacy/compat header locations
%{_includedir}/openjpeg.h
%{_includedir}/openjpeg/

%files tools
%defattr(-,root,root,-)
%{_bindir}/*
%{_mandir}/man1/*

%changelog
* Thu Apr 14 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.4-1
- updated to 1.4
- built with current VineSeed
- added tools subpackage

* Thu Oct 09 2008 Shu KONNO <owa@bg.wakwak.com> 1.2-1vl5
- applied new versioning policy, spec in utf-8

* Sun Jul 29 2007 NAKAMURA Kenta <kenta@vinelinux.org> 1.2-0vl2
- added lib64 patch for x86_64 architecture

* Wed Jun 27 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2-0vl1
- new upstream release

* Sun Apr 01 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 1.1.1-0vl1
- initial build for Vine Linux
