## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 3;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global         __cmake_in_source_build 1

%global         with_snapshot   0
#%%global       prerelease      beta
#%%global       commit          40b9aca2668f443cae6bfbfa7cc5a354f1087011
#%%global       shortcommit     %%(c=%%{commit}; echo ${c:0:7})
%bcond          ispc    1
# Don’t build the tutorials in F42 as a temporary workaround for a GCC 15
# internal compiler error (RHBZ#2340123, RHBZ#2342604). We name only Fedora 42
# because we don’t intend this to be permanent, and we expect the GCC bug will
# ultimately be fixed.
%bcond          tutorials %[ %{undefined fc42} ]

Name:           embree
Version:        4.3.3
Release:        %autorelease
Summary:        Collection of high-performance ray tracing kernels

License:        Apache-2.0
URL:            https://embree.github.io
%if %{with_snapshot}
Source:         https://github.com/%{name}/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz#/%{name}-%{version}-%{shortcommit}.tar.gz
%else
Source:         https://github.com/%{name}/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
%endif

BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  giflib-devel
%if %{with ispc} 
BuildRequires:  ispc
%endif
BuildRequires:  pkgconfig(glut)
BuildRequires:  pkgconfig(glfw3)
BuildRequires:  pkgconfig(xmu)
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(OpenImageIO)
BuildRequires:  pkgconfig(tbb)

# Embree only supports these architectures with SSE2 and up enabled
ExclusiveArch:  aarch64 x86_64

%description
A collection of high-performance ray tracing kernels intended to graphics 
application engineers that want to improve the performance of their application.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    devel
The %{name}-devel package contains libraries and header files for
applications that use %{name}.

%prep
%if %{with_snapshot}
%autosetup -n %{name}-%{commit}
%else 
%autosetup -p1 -n %{name}-%{version}
%endif

%build
%cmake \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_CXX_FLAGS="%{optflags} -Wl,--as-needed" \
        -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
        -DCMAKE_INSTALL_PREFIX=%{_prefix} \
        -DEMBREE_COMPACT_POLYS=ON \
        -DEMBREE_IGNORE_CMAKE_CXX_FLAGS=OFF \
%if %{with ispc}
        -DEMBREE_ISPC_SUPPORT=ON \
%endif
        -DEMBREE_MAX_ISA=NONE \
%ifarch x86_64
        -DEMBREE_ISA_SSE2=ON \
        -DEMBREE_ISA_SSE4=ON \
        -DEMBREE_ISA_AVX=ON \
        -DEMBREE_ISA_AVX2=ON \
%else
        -DEMBREE_ARM=ON \
        -DEMBREE_ISA_NEON=ON \
%endif
%if %{with tutorials}
        -DEMBREE_TUTORIALS=ON \
%else
        -DEMBREE_TUTORIALS=OFF \
%endif
        -DEMBREE_TESTING=ON \
        -DEMBREE_STATIC_LIB=OFF
%cmake_build

%check
%ctest

%install
%cmake_install

# Remove installers
rm %{buildroot}%{_prefix}/%{name}-vars.{csh,sh}

# Relocate doc files
mv %{buildroot}%{_docdir}/%{name}4 %{buildroot}%{_docdir}/%{name}
rm %{buildroot}%{_docdir}/%{name}/LICENSE.txt

# Remove the testing products
%if %{with tutorials}
rm -r %{buildroot}%{_prefix}/src
rm -r %{buildroot}%{_bindir}/models
rm %{buildroot}%{_bindir}/embree_*
%endif

%files
%license LICENSE.txt
%doc README.md CHANGELOG.md readme.pdf third-party-programs{,-TBB,-DPCPP,-OIDN,-oneAPI-DPCPP}.txt
%{_libdir}/lib%{name}4.so.4
%{_mandir}/man3/*

%files devel
%{_libdir}/lib%{name}4.so
%{_includedir}/%{name}4/
%{_libdir}/cmake/%{name}-%{version}/

%changelog
## START: Generated by rpmautospec
* Tue Jan 28 2025 Benjamin A. Beasley <code@musicinmybrain.net> - 4.3.3-3
- Don’t build the tutorials in F42
- This is a temporary workaround for a GCC internal compiler error
- Fixes RHBZ#2340123, FTBFS in Fedora rawhide/f42

* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild

* Tue Jul 23 2024 Luya Tshimbalanga <luya@fedoraproject.org> - 4.3.3-1
- Update to 4.3.3 (rhbz#2292486)

* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Sat Jun 15 2024 Luya Tshimbalanga <luya@fedoraproject.org> - 4.3.2-2
- Update source file

* Sat Jun 15 2024 Luya Tshimbalanga <luya@fedoraproject.org> - 4.3.2-1
- Update to embree 4.3.2 (rhbz#2292486)

* Tue May 28 2024 Luya Tshimbalanga <luya@fedoraproject.org> - 4.3.1-2
- Rebuild for ispc 1.24.0

* Mon Feb 12 2024 Ali Erdinc Koroglu <aekoroglu@linux.intel.com> - 4.3.1-1
- update to 4.3.1

* Mon Jan 29 2024 Richard Shaw <hobbes1069@gmail.com> - 4.3.0-6
- Rebuild for OpenImageIO 2.5.x.

* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Wed Jan 17 2024 Jonathan Wakely <jwakely@redhat.com> - 4.3.0-3
- Rebuilt for TBB 2021.11

* Sat Sep 30 2023 Luya Tshimbalanga <luya@fedoraproject.org> - 4.3.0-2
- Upload missing source

* Sat Sep 30 2023 Luya Tshimbalanga <luya@fedoraproject.org> - 4.3.0-1
- Update to 4.3.0 (rhbz#2241288)

* Thu Aug 31 2023 Ali Erdinc Koroglu <aekoroglu@linux.intel.com> - 4.2.0-1
- Update to 4.2.0 (RHBZ #2228110)

* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Sat May 13 2023 Luya Tshimbalanga <luya@fedoraproject.org> - 4.1.0-1
- Update to 4.1.0 (rhbz#2203355)

* Tue Mar 21 2023 aekoroglu <aekoroglu@linux.intel.com> - 4.0.1-4
- cpu condition changed and patch renamed

* Mon Mar 20 2023 aekoroglu <aekoroglu@linux.intel.com> - 4.0.1-3
- testing enabled

* Sun Mar 19 2023 aekoroglu <aekoroglu@linux.intel.com> - 4.0.1-2
- required ISA changes for ospray

* Sat Mar 11 2023 Luya Tshimbalanga <luya@fedoraproject.org> - 4.0.1-1
- Update to 4.0.1 (#2168502)

* Thu Feb 09 2023 Luya Tshimbalanga <luya@fedoraproject.org> - 4.0.0-2
- Add missing patch

* Thu Feb 09 2023 Luya Tshimbalanga <luya@fedoraproject.org> - 4.0.0-1
- Update to 4.0.0

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.13.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Sun Jan 08 2023 Luya Tshimbalanga <luya@fedoraproject.org> - 3.13.5-2
- Migrate license to SPDX standard

* Fri Nov 25 2022 Luya Tshimbalanga <luya@fedoraproject.org> - 3.13.5-1
- Update to 3.13.5 (#2126963)

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.13.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Sat Jul 02 2022 Luya Tshimbalanga <luya@fedoraproject.org> - 3.13.3-1
- Update to embree 3.13.3

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.13.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Sat Nov 13 2021 Luya Tshimbalanga <luya@fedoraproject.org> - 3.13.2-1
- Update to embre 3.13.2 - Resolves rhbz#1993527

* Tue Jun 15 2021 Luya Tshimbalanga <luya@fedoraproject.org> - 3.13.0-2
- Rebuild for ispc 1.6.0

* Tue May 11 2021 Luya Tshimbalanga <luya@fedoraproject.org> - 3.13.0-1
- Update to 3.13.0 Set Max ISA detection to SSE4.2 (AVX support is broken)
  Enable aarch64 architecture support without ISA Exclude ar Resolves:
  #1958600

* Fri Feb 26 2021 Luya Tshimbalanga <luya@fedoraproject.org> - 3.12.2-2
- Update to 3.12.2 (#1920141)

* Fri Feb 26 2021 Luya Tshimbalanga <luya@fedoraproject.org> - 3.12.2-1
- Update to 3.12.2 (#1920141)

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.12.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Sat Dec 19 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.12.1-3
- Rebuild for ispc 1.5.0

* Sat Nov 28 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.12.1-2
- Update to 3.12.1 (#1880382) Set Max ISA detection to default Drop support
  for EOL Fedora 31

* Sun Nov 01 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.12.1-1
- Update to 3.12.1 (#1880382)

* Sat Aug 29 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.11.0-4
- Rebuild for ispc 1.14.1 (#1855915)

* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.11.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Fri Jul 24 2020 Jeff Law <law@redhat.com> - 3.11.0-2
- Use __cmake_in_source_build

* Fri Jun 26 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.11.0-1
- Update to 3.11.0 (#1850917)

* Tue Jun 09 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.10.0-3
- Rebuild for ispc 1.13.0 and Blender 2.83.0

* Tue May 12 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.10.0-2
- Update to 3.10.0 (#1834394)

* Tue May 12 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.10.0-1
- Update to 3.10.0 (#1834394)

* Sat Apr 11 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.9.0-1
- Update to 3.9.0

* Wed Feb 12 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.8.0-2
- Update to 3.8.0 (#1792573)

* Wed Feb 12 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.8.0-1
- Update to 3.8.0 (#1792573)

* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Sat Jan 11 2020 Luya Tshimbalanga <luya@fedoraproject.org> - 3.7.0-1
- Update to 3.7.0 (#1747113)

* Thu Sep 26 2019 Luya Tshimbalanga <luya@fedoraproject.org> - 3.6.1-2
- Drop renaming libraries parameter on cmake

* Sat Sep 07 2019 Luya Tshimbalanga <luya@fedoraproject.org> - 3.6.1-1
- Update to 3.6.1 Rebuild for ispc 1.12.0

* Wed Aug 21 2019 Luya Tshimbalanga <luya@fedoraproject.org> - 3.6.0-3
- Update to 3.6.0

* Sat Aug 17 2019 Luya Tshimbalanga <luya@fedoraproject.org> - 3.6.0-2
- RPMAUTOSPEC: unresolvable merge
## END: Generated by rpmautospec