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

Source0: http://openjpeg.googlecode.com/files/%{name}-%{version}.tar.gz

## upstreamable patches

# Security

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: automake libtool 
BuildRequires: libtiff-devel
BuildRequires: lcms2-devel
BuildRequires: libjpeg-devel, libpng-devel

Vendor: Project Vine
Distribution: Vine Linux

%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
# Make sure we use system libraries
rm -rf libs

autoreconf -i -f

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

make

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

rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.la
rm -f $RPM_BUILD_ROOT%{_docdir}/openjpeg-1.5/LICENSE


%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.5
%{_libdir}/libopenjpeg.so
%{_libdir}/pkgconfig/lib*.pc

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

%changelog
* Sun Aug 03 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.5.2-1
- update to 1.5.2
- remove old patches
- change BuildRequires: lcms2-devel instead of lcms-devel

* Tue Dec 24 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4-4
- fix %%files devel

* Tue Feb 26 2013 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.4-3
- add patch110 for fix CVE-2009-5030 (Gray16 TIFF)
- add patch120 for fix CVE-2012-3358 (j2k)
  (Both patches are based on RHEL6, thanks)

* Thu Sep 20 2012 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.4-2
- add patch100 for fix CVE-2012-3535 (sanity-check an image header)
  (based on RHEL6, thanks)
- add Vendor/Distri tags
- add BR: libjpeg-devel, libpng-devel

* 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
