File libjpeg-turbo.spec of Package libjpeg-turbo

#
# spec file for package libjpeg-turbo
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define srcver   1.3.0
%define major    8
%define minor    0
%define micro    2
%define libver   %{major}.%{minor}.%{micro}
%define tmajor   0
%define tminor   0
%define tmicro   0
%define tlibver  %{tmajor}.%{tminor}.%{tmicro}

Name:           libjpeg-turbo
Version:        %{srcver}
Release:        0
Summary:        A MMX/SSE2 accelerated library for manipulating JPEG image files
License:        BSD-3-Clause
Group:          Productivity/Graphics/Convertors
Url:            http://sourceforge.net/projects/libjpeg-turbo
Source0:        http://downloads.sourceforge.net/project/%{name}/%{version}/libjpeg-turbo-%{version}.tar.gz
Source1:        baselibs.conf
Patch0:         libjpeg-turbo12-noinst.patch
#Patch1:         libjpeg-turbo-header-files.patch
Patch2:         libjpeg-turbo-%{version}-int32.patch
Patch3:         libjpeg-turbo-%{version}-tiff-ojpeg.patch
Patch4:         libjpeg-ocloexec.patch
BuildRequires:  gcc-c++
BuildRequires:  libtool
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  nasm
%if 0%{?fedora} || 0%{?rhel}
Obsoletes:		libjpeg < 6b-47
#Provides:		libjpeg = 6b-47%{?dist}
Provides:		libjpeg = 6b
%else
Provides:       jpeg = %{version}
Obsoletes:      jpeg < %{version}
Conflicts:      jpeg%{major}
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The libjpeg-turbo package contains a library of functions for manipulating
JPEG images.

%if 0%{?fedora} || 0%{?rhel}

%define base  libjpeg-turbo
%define turbo turbojpeg
%define devel %{base}-devel

%else

%define base  libjpeg%{major}
%define turbo libturbojpeg%{tmajor}
%define devel %{base}-devel

%endif

%if 0%{?fedora} || 0%{?rhel}
%else
%package -n %{base}
Version:        %{libver}
Release:        0
Summary:        The MMX/SSE accelerated JPEG compression/decompression library
Group:          System/Libraries
Provides:       libjpeg%{major} = %{version}
Obsoletes:      libjpeg%{major} < %{version}
# bug437293
%ifarch ppc64
Obsoletes:      libjpeg-64bit < %{version}
%endif
#
%endif

%description -n %{base}
This library contains MMX/SSE accelerated functions for manipulating
JPEG images.

%package -n %{turbo}
%if 0%{?fedora} || 0%{?rhel}
%else
Version:        %{version}
Release:        0
%endif
Summary:        The MMX/SSE accelerated JPEG compression/decompression library
Group:          System/Libraries

%description -n %{turbo}
This library contains MMX/SSE accelerated functions for manipulating
JPEG images.

%package -n %{devel}
Summary:        Development Tools for applications which will use the Libjpeg Library
Group:          Development/Libraries/C and C++
%if 0%{?fedora} || 0%{?rhel}
Requires:       %{base} = %{version}-%{release}
Obsoletes:		libjpeg-devel < 6b-47
Provides:		libjpeg-devel = 6b-47%{?dist}
Obsoletes:      libjpeg-turbo-static < %{version}
Provides:       libjpeg-turbo-static = %{version}%{?dist}
%else
Requires:       %{base} = %{version}
Requires:       %{turbo} = %{version}
Version:        %{libver}
Release:        0
Obsoletes:      libjpeg-devel < %{version}
Provides:       libjpeg-devel = %{version}
%endif
Conflicts:      otherproviders(libjpeg-devel)
# bug437293
%ifarch ppc64
Obsoletes:      libjpeg-devel-64bit < %{version}
%endif
#

%description -n %{devel}
The libjpeg-devel package includes the header files and libraries
necessary for compiling and linking programs which will manipulate JPEG
files using the libjpeg library.

%if 0%{?fedora} || 0%{?rhel}

%package utils
Summary:        Utilities for manipulating JPEG images
Requires:       libjpeg-turbo%{?_isa} = %{version}-%{release}

%description utils
The libjpeg-turbo-utils package contains simple client programs for accessing
the libjpeg functions. It contains cjpeg, djpeg, jpegtran, rdjpgcom and
wrjpgcom. Cjpeg compresses an image file into JPEG format. Djpeg decompresses a
JPEG file into a regular image file. Jpegtran can perform various useful
transformations on JPEG files. Rdjpgcom displays any text comments included in a
JPEG file. Wrjpgcom inserts text comments into a JPEG file.

%package -n turbojpeg-devel
Summary:        Headers for the TurboJPEG library
Requires:       turbojpeg%{?_isa} = %{version}-%{release}

%description -n turbojpeg-devel
This package contains header files necessary for developing programs which will
manipulate JPEG files using the TurboJPEG library.

%endif


%prep
%setup -q 
%patch0
#%patch1
%patch2
%patch3
%patch4

%build
autoreconf -fiv
export LDFLAGS="-Wl,-z,relro,-z,now"
%if 0%{?fedora} || 0%{?rhel}
%configure --disable-static
%else
%configure --disable-static --with-jpeg8
%endif
make %{?_smp_mflags}

%check
make test libdir=%{_libdir}

%install
%makeinstall
# Fix perms
chmod -x README-turbo.txt
# Remove unwanted files
find %{buildroot} -name "*.la" -delete
# Remove docs, we'll select docs manually
rm -rf %{buildroot}%{_datadir}/doc/

%post -n %{base} -p /sbin/ldconfig
%postun -n %{base} -p /sbin/ldconfig

%post -n %{turbo} -p /sbin/ldconfig
%postun -n %{turbo} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README README-turbo.txt change.log ChangeLog.txt
%if 0%{?fedora} || 0%{?rhel}
%else
%doc usage.txt wizard.txt
%{_bindir}/*
%doc %{_mandir}/man1/*
%endif

%files -n %{base}
%defattr(-,root,root)
%if 0%{?fedora} || 0%{?rhel}
%{_libdir}/libjpeg.so.62*
%else
%{_libdir}/libjpeg.so.%{libver}
%{_libdir}/libjpeg.so.%{major}
%endif

%files -n %{turbo}
%defattr(-,root,root)
%if 0%{?fedora} || 0%{?rhel}
%{_libdir}/libturbojpeg.so.0*
%else
%{_libdir}/libturbojpeg.so.%{tmajor}
%{_libdir}/libturbojpeg.so.%{tlibver}
%endif

%files -n %{devel}
%defattr(-,root,root)
%if 0%{?fedora} || 0%{?rhel}
%{_includedir}/jconfig.h
%{_includedir}/jerror.h
%{_includedir}/jmorecfg.h
#%{_includedir}/jpegint.h
%{_includedir}/jpeglib.h
%else
%{_includedir}/*.h
%{_libdir}/libturbojpeg.so
%endif
%{_libdir}/libjpeg.so
%doc coderules.txt jconfig.txt libjpeg.txt structure.txt example.c

%if 0%{?fedora} || 0%{?rhel}

%files utils
%doc usage.txt wizard.txt
%{_bindir}/cjpeg
%{_bindir}/djpeg
%{_bindir}/jpegtran
%{_bindir}/rdjpgcom
%{_bindir}/wrjpgcom
%{_mandir}/man1/cjpeg.1*
%{_mandir}/man1/djpeg.1*
%{_mandir}/man1/jpegtran.1*
%{_mandir}/man1/rdjpgcom.1*
%{_mandir}/man1/wrjpgcom.1*

%files -n turbojpeg-devel
%{_includedir}/turbojpeg.h
%{_libdir}/libturbojpeg.so

%endif


%changelog
openSUSE Build Service is sponsored by