#%global debug_package %{nil}

Name:    freeimage
Version: 3.18.0
Release: 1
Summary: FreeImage is a library project for developers who would like to support popular graphics image formats (PNG, JPEG, TIFF, BMP and others)
License: GPLv2 or GPLv3 and FIPL
URL:	 https://freeimage.sourceforge.io/
Source0: http://downloads.sourceforge.net/freeimage/FreeImage3180.zip

Patch0: CVE-2019-12211_2019-12213.patch

BuildRequires: 	gcc autoconf automake doxygen

%description
FreeImage is a library project for developers who would like to support popular graphics image formats (PNG, JPEG, TIFF, BMP and others). Some highlights are: extremely simple in use, not limited to the local PC (unique FreeImageIO) and Plugin driven!

%package devel
Summary: FreeImage is a library project for developers who would like to support popular graphics image formats (PNG, JPEG, TIFF, BMP and others)
Requires: %{name} = %{version}-%{release}
%description devel
FreeImage is a library project for developers who would like to support popular graphics image formats (PNG, JPEG, TIFF, BMP and others). Some highlights are: extremely simple in use, not limited to the local PC (unique FreeImageIO) and Plugin driven!

%prep
%setup -q -n FreeImage 
%patch0 -p1

%build
%make_build -f Makefile.gnu DESTDIR=%{buildroot}
%make_build -f Makefile.fip DESTDIR=%{buildroot}

pushd Wrapper/FreeImagePlus/doc
doxygen FreeImagePlus.dox
popd


%install
install -Dpm 755 Dist/lib%{name}-%{version}.so %{buildroot}%{_libdir}/lib%{name}-%{version}.so
ln -s lib%{name}-%{version}.so %{buildroot}%{_libdir}/lib%{name}.so

install -Dpm 755 Dist/lib%{name}plus-%{version}.so %{buildroot}%{_libdir}/lib%{name}plus-%{version}.so
ln -s lib%{name}plus-%{version}.so %{buildroot}%{_libdir}/lib%{name}plus.so
install -Dpm 644 Source/FreeImage.h %{buildroot}%{_includedir}/FreeImage.h
install -Dpm 644 Wrapper/FreeImagePlus/FreeImagePlus.h %{buildroot}%{_includedir}/FreeImagePlus.h

# install missing symlink (was giving no-ldconfig-symlink rpmlint errors)
ldconfig -n %{buildroot}%{_libdir}

%pre
%preun
%post
%postun

%check

%files
%license license-*.txt 
%doc README.linux README.md Whatsnew.txt
%{_libdir}/lib%{name}-%{version}.so
%{_libdir}/lib%{name}.so.*
%{_libdir}/lib%{name}plus-%{version}.so
%{_libdir}/lib%{name}plus.so.*

%files devel
%doc Examples Wrapper/FreeImagePlus/html
%{_includedir}/FreeImage.h
%{_libdir}/lib%{name}.so
%{_includedir}/FreeImagePlus.h
%{_libdir}/lib%{name}plus.so


%changelog
* Mon May 4 2020 Wei Xiong <myeuler@163.com>
- Package init

