File freeimage.spec of Package freeimage

#
# spec file for package freeimage
#
# Copyright (c) 2021 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define so_ver 3
%define tarver 3.18.0
Name:           freeimage
Version:        3.18.0
Release:        0
Summary:        Multi-format Image Decoder Library
License:        GPL-2.0-only OR GPL-3.0-only
URL:            https://freeimage.sourceforge.net/
Source0:        freeimage_%{tarver}.orig.tar.gz
Patch1:         freeimage-no-return-in-nonvoid.patch
Patch2:         CVE-2019-12211_2019-12213.patch
Patch3:         installlinux.patch 
Patch4:         zlib.patch
BuildRequires:  gcc-c++
BuildRequires:  unzip


%description
FreeImage is an Open Source library project for developers who would like to
support popular graphics image formats like PNG, BMP, JPEG, TIFF and others as
needed by today's multimedia applications. FreeImage is easy to use, fast,
multithreading safe.

%package devel
Summary:        Development Files for FreeImage
Requires:       lib%{name}%{so_ver} = %{version}
# libfreeimage-devel was last used at version 3.10.0
Provides:       lib%{name}-devel = %{version}
Obsoletes:      lib%{name}-devel < %{version}

%description devel
This package provides development libraries and headers needed to build
software using FreeImage.

%package -n lib%{name}%{so_ver}
Summary:        Multi-format Image Decoder Library

%description -n lib%{name}%{so_ver}
FreeImage is an Open Source library project for developers who would like to
support popular graphics image formats like PNG, BMP, JPEG, TIFF and others as
needed by today's multimedia applications. FreeImage is easy to use and fast,
multithreading safe.


%prep
%setup -q -n FreeImage
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1



%build
export CFLAGS="%{optflags} -fPIC -fno-strict-aliasing"
export CXXFLAGS="%{optflags} -fPIC -std=gnu++98 -fno-strict-aliasing"
make %{?_smp_mflags}


%install
%make_install INSTALLDIR=%{buildroot}%{_libdir}

# Remove static libraries
rm -f %{buildroot}%{_libdir}/*.a

%post -n lib%{name}%{so_ver} -p /sbin/ldconfig
%postun -n lib%{name}%{so_ver} -p /sbin/ldconfig

%files devel
%{_includedir}/FreeImage.h
%{_libdir}/libfreeimage.so

%files -n lib%{name}%{so_ver}
%{_libdir}/lib%{name}.so.3*
%{_libdir}/lib%{name}-%{version}.so


%changelog
openSUSE Build Service is sponsored by