-%bcond_without tests
-
+#
+# Conditional build
+%bcond_without tests # don't perform "make test"
+%bcond_without java # Java binding
+#
%define libjpeg_ver 8c
+%define libjpeg_ver_lt 9-1
Summary: A MMX/SSE2 accelerated library for manipulating JPEG image files
Summary(pl.UTF-8): Biblioteka do obróbki plików obrazów JPEG z akceleracją MMX/SSE2
Name: libjpeg-turbo
-Version: 1.2.0
+Version: 1.3.1
Release: 1
License: wxWidgets
Group: Libraries
Source0: http://downloads.sourceforge.net/libjpeg-turbo/%{name}-%{version}.tar.gz
-# Source0-md5: 5329fa80953938cb4f097afae55059e2
+# Source0-md5: 2c3a68129dac443a72815ff5bb374b05
URL: http://libjpeg-turbo.virtualgl.org/
-Patch0: %{name}-turbojpeg.patch
-BuildRequires: autoconf
+BuildRequires: autoconf >= 2.56
BuildRequires: automake
+%{?with_java:BuildRequires: jdk}
BuildRequires: libstdc++-devel
BuildRequires: libtool
-BuildRequires: libtool
+# x86* SIMD code uses NASM; arm uses gas, no SIMD code for other archs
+%ifarch %{ix86} %{x8664}
BuildRequires: nasm
+%endif
Provides: libjpeg = %{libjpeg_ver}
-Obsoletes: libjpeg >= %{libjpeg_ver}
+Obsoletes: libjpeg < %{libjpeg_ver_lt}
+Obsoletes: libjpegsimd
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
It is based on libjpeg/SIMD but has numerous enhancements.
%description -l pl.UTF-8
-libjpeg-turbo to wersja biblioteki libjpeg, wykorzystująca instrukcje
+libjpeg-turbo to wersja biblioteki libjpeg wykorzystująca instrukcje
SIMD MMX, SSE i SSE2 w celu przyspieszenia kompresji/dekompresji JPEG
o około 2-4 razy na platformach x86 i x86-64. Jest oparta na
libjpeg/SIMD, ale ma wiele rozszerzeń.
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Provides: libjpeg-devel = %{libjpeg_ver}
-Obsoletes: libjpeg-devel >= %{libjpeg_ver}
+Obsoletes: libjpeg-devel < %{libjpeg_ver_lt}
+Obsoletes: libjpegsimd-devel
Conflicts: libjpeg6-devel
%description devel
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
Provides: libjpeg-static = %{libjpeg_ver}
-Obsoletes: libjpeg-static >= %{libjpeg_ver}
+Obsoletes: libjpeg-static < %{libjpeg_ver_lt}
+Obsoletes: libjpegsimd-static
Conflicts: libjpeg-turbo6-static
%description static
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Provides: libjpeg-progs = %{libjpeg_ver}
-Obsoletes: libjpeg-progs >= %{libjpeg_ver}
+Obsoletes: libjpeg-progs < %{libjpeg_ver_lt}
+Obsoletes: libjpegsimd-progs
Conflicts: libjpeg-turbo6-progs
%description progs
przekształcenia na plikach JPEG. rdjpgcom wyświetla komentarze
tekstowe dołączone do pliku JPEG, a wrjpgcom wstawia takie komentarze.
+%package -n java-turbojpeg
+Summary: Java wrapper for the TurboJPEG/OSS library
+Summary(pl.UTF-8): Interfejs Javy do biblioteki TurboJPEG/OSS
+Group: Development/Languages/Java
+Requires: %{name} = %{version}-%{release}
+Requires: jpackage-utils
+
+%description -n java-turbojpeg
+Java wrapper for the TurboJPEG/OSS library.
+
+%description -n java-turbojpeg -l pl.UTF-8
+Interfejs Javy do biblioteki TurboJPEG/OSS.
+
%prep
%setup -q
-%patch0 -p1
%build
%{__libtoolize}
%{__automake}
%configure \
+ %{?with_java:JNI_CFLAGS="-I%{_jvmdir}/java/include -I%{_jvmdir}/java/include/linux"} \
--enable-shared \
--enable-static \
+ %{?with_java:--with-java} \
+%ifnarch %{ix86} %{x8664}
+ --without-simd \
+%endif
--with-jpeg8
-%{__make}
+%{__make} -j1
%{?with_tests:%{__make} test}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
+%if %{with java}
+install -d $RPM_BUILD_ROOT%{_javadir}
+%{__mv} $RPM_BUILD_ROOT%{_datadir}/classes/turbojpeg.jar $RPM_BUILD_ROOT%{_javadir}
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/jpegtran.1*
%{_mandir}/man1/rdjpgcom.1*
%{_mandir}/man1/wrjpgcom.1*
+
+%if %{with java}
+%files -n java-turbojpeg
+%defattr(644,root,root,755)
+%doc java/doc/*
+%{_javadir}/turbojpeg.jar
+%endif