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

Source0: %{name}_v1_2.tar.gz
Patch1: %{name}-1.2-fix_build.patch
Patch2: %{name}-1.2-dyn_link_binaries.patch
Patch3: %{name}-1.2-upstream_fixes.patch
Patch4: %{name}-1.2-lib64.patch

%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: openjpeg = %{version}-%{release}

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

%prep
%setup -q -n trunk
%patch1 -p1
%patch2 -p1
%patch3 -p1
if [ "lib64" = %{_lib} ]; then
%patch4 -p1
fi
find . -type f|xargs chmod 644

%build
%ifarch i686
make COMPILERFLAGS="%{optflags} -ffast-math -fPIC \
                    -march=i686 -O3 -fasynchronous-unwind-tables \
		    -ftree-vectorize -ftree-vectorizer-verbose=5" \
     LIBRARIES="-lm" \
     %{?_smp_mflags}
%else
make COMPILERFLAGS="%{optflags} -ffast-math -fPIC" \
     LIBRARIES="-lm" \
     %{?_smp_mflags}
%endif

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} LIBDIR=%{_libdir} INCDIR=%{_includedir}

%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_libdir}/libopenjpeg.so.*

%files devel
%defattr(-,root,root,-)
%doc ChangeLog
%{_includedir}/openjpeg.h
%{_libdir}/libopenjpeg.so
%{_libdir}/libopenjpeg.a

%changelog
* 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
