%undefine __cmake_in_source_build

Name:           eigen
Version:        3.3.8
Release:        6
Summary:        A lightweight C++ template library for vector and matrix math

License:        MPLv2.0 and LGPLv2+ and BSD
URL:            http://eigen.tuxfamily.org/index.php?title=Main_Page
Source0:        https://gitlab.com/libeigen/eigen/-/archive/%{version}/eigen-%{version}.tar.bz2
Patch0:		0001-rebuild-and-modify-exception-error.patch
Patch1:         eigen-3.3.8-port-to-newer-cmake.patch

Buildarch:  noarch
BuildRequires:  cmake
BuildRequires:  make
BuildRequires:  gcc-c++
BuildRequires:  doxygen

%description
%{summary}.

%package -n eigen3-devel
Summary:        A lightweight C++ template library for vector and matrix math
BuildArch:      noarch
# -devel subpkg only atm, compat with other distros
Provides:       %{name} = %{version}-%{release}
# not *strictly* a -static pkg, but the results are the same
Provides:       %{name}-static = %{version}-%{release}

%description -n eigen3-devel
%{summary}.

%prep
%autosetup -p1 -n eigen-%{version}

%build
%cmake -DINCLUDE_INSTALL_DIR=include/%{name}
%cmake_build

%install
mkdir -p %{buildroot}%{_includedir}/%{name}/
cp -r unsupported %{buildroot}%{_includedir}/%{name}/
cp -r Eigen %{buildroot}%{_includedir}/%{name}/
%cmake_install

%files -n eigen3-devel
%license COPYING.README COPYING.BSD COPYING.MPL2 COPYING.LGPL
%defattr(0644, root, root, 0755)
%{_includedir}/%{name}
%{_datadir}/%{name}3
%{_datadir}/pkgconfig/*.pc

%changelog
* Sun Mar 02 2025 Funda Wang <fundawang@yeah.net> - 3.3.8-6
- try build with cmake 4.0
- rename spec so that packages could be tracked

* Fri Feb 14 2025 sunhailiang <sunhailiang3@huawei.com> - 3.3.8-5
- adopt to new cmake macro

* Mon May 23 2022 tanyulong <tanyulong@kylinos.cn> - 3.3.8-4
- Building opencv,eigen_assert_exception’ is not a member of ‘Eigen’

* Fri Apr 15 2022 tanyulong <tanyulong@kylinos.cn> - 3.3.8-3
- fix cmake build error

* Sat Mar 27 2021 herengui <herengui@uniontech.com> - 3.3.8-2
- fix empty include directory issue

* Tue Dec 1 2020 hubble_zhu<hubble_zhu@qq.com> - 3.3.8-1
- package init