%{?mingw_package_header}
%global pkgname OpenEXR
Name: mingw-%{pkgname}
Version: 2.2.1
Release: 1%{?dist}
Summary: MinGW Windows %{pkgname} library
License: BSD
URL: http://www.openexr.com/
BuildArch: noarch
Source0: http://download.savannah.nongnu.org/releases/openexr/openexr-%{version}.tar.gz
# install missing headers
Patch0: openexr-2.2.0_headers.patch
# don't autogenerate headers (would require wine BR)
Patch1: openexr-2.2.0_autogen-headers.patch
# Use _aligned_malloc instead of posix_memalign
Patch2: openexr-2.2.0_aligned-malloc.patch
# Fix cast
Patch3: openexr-2.2.0_cast.patch
# Replace obsolete macros in configure.ac
Patch4: openexr-2.2.0_obsolete-macros.patch
BuildRequires: autoconf automake libtool
BuildRequires: mingw32-filesystem >= 95
BuildRequires: mingw32-gcc
BuildRequires: mingw32-ilmbase
BuildRequires: mingw32-zlib
BuildRequires: mingw64-filesystem >= 95
BuildRequires: mingw64-gcc
BuildRequires: mingw64-ilmbase
BuildRequires: mingw64-zlib
%description
MinGW Windows %{pkgname} library.
%package -n mingw32-%{pkgname}
Summary: MinGW Windows %{pkgname} library
%description -n mingw32-%{pkgname}
%{summary}.
%package -n mingw32-%{pkgname}-static
Summary: Static version of the MinGW Windows %{pkgname} library
Requires: mingw32-%{pkgname} = %{version}-%{release}
%description -n mingw32-%{pkgname}-static
%{summary}.
%package -n mingw32-%{pkgname}-tools
Summary: Tools for the MinGW Windows %{pkgname} library
Requires: mingw32-%{pkgname} = %{version}-%{release}
%description -n mingw32-%{pkgname}-tools
%{summary}.
%package -n mingw64-%{pkgname}
Summary: MinGW Windows %{pkgname} library
%description -n mingw64-%{pkgname}
%{summary}.
%package -n mingw64-%{pkgname}-static
Summary: Static version of the MinGW Windows %{pkgname} library
Requires: mingw64-%{pkgname} = %{version}-%{release}
%description -n mingw64-%{pkgname}-static
%{summary}.
%package -n mingw64-%{pkgname}-tools
Summary: Tools for the MinGW Windows %{pkgname} library
Requires: mingw64-%{pkgname} = %{version}-%{release}
%description -n mingw64-%{pkgname}-tools
%{summary}.
%{?mingw_debug_package}
%prep
%setup -q -n openexr-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
./bootstrap
%mingw_configure
%mingw_make %{?_smp_mflags}
%install
%mingw_make install DESTDIR=%{buildroot}
# Delete *.la files
find %{buildroot} -name '*.la' -delete
# Don't install doc
rm -rf %{buildroot}%{mingw32_docdir}/%{pkgname}-%{version}
rm -rf %{buildroot}%{mingw64_docdir}/%{pkgname}-%{version}
%files -n mingw32-%{pkgname}
%doc LICENSE
%{mingw32_bindir}/libIlmImf-2_2-23.dll
%{mingw32_bindir}/libIlmImfUtil-2_2-23.dll
#dir %%{mingw32_includedir}/OpenEXR => It is owned by mingw32-ilmbase, which is a dependency
%{mingw32_includedir}/OpenEXR/*.h
%{mingw32_libdir}/libIlmImf.dll.a
%{mingw32_libdir}/libIlmImfUtil.dll.a
%{mingw32_libdir}/pkgconfig/OpenEXR.pc
%{mingw32_datadir}/aclocal/openexr.m4
%files -n mingw32-%{pkgname}-static
%{mingw32_libdir}/libIlmImf.a
%{mingw32_libdir}/libIlmImfUtil.a
%files -n mingw32-%{pkgname}-tools
%{mingw32_bindir}/*.exe
%files -n mingw64-%{pkgname}
%doc LICENSE
%{mingw64_bindir}/libIlmImf-2_2-23.dll
%{mingw64_bindir}/libIlmImfUtil-2_2-23.dll
#dir %%{mingw64_includedir}/OpenEXR => It is owned by mingw32-ilmbase, which is a dependency
%{mingw64_includedir}/OpenEXR/*.h
%{mingw64_libdir}/libIlmImf.dll.a
%{mingw64_libdir}/libIlmImfUtil.dll.a
%{mingw64_libdir}/pkgconfig/OpenEXR.pc
%{mingw64_datadir}/aclocal/openexr.m4
%files -n mingw64-%{pkgname}-static
%{mingw64_libdir}/libIlmImf.a
%{mingw64_libdir}/libIlmImfUtil.a
%files -n mingw64-%{pkgname}-tools
%{mingw64_bindir}/*.exe
%changelog
* Fri Jan 19 2018 Sandro Mani <manisandro@gmail.com> - 2.2.1-1
- Update to 2.2.1
- Fixes: CVE-2017-9110, CVE-2017-9111, CVE-2017-9112, CVE-2017-9113, CVE-2017-9114, CVE-2017-9115, CVE-2017-9116
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Thu May 25 2017 Sandro Mani <manisandro@gmail.com> - 2.2.0-5
- Improve openexr-2.2.0_aligned-malloc.patch
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Wed Nov 26 2014 Sandro Mani <manisandro@gmail.com> - 2.2.0-1
- Update to 2.2.0
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Tue Jan 14 2014 Sandro Mani <manisandro@gmail.com> - 2.1.0-2
- Add LICENSE to doc
- Add patch to replace obsolete configure.ac macros
* Fri Dec 27 2013 Sandro Mani <manisandro@gmail.com> - 2.1.0-1
- Initial package