Name:           cln
Version:        1.3.6
Release:        4
Summary:        Class Library for Numbers
License:        GPL-2.0-or-later
URL:            https://www.ginac.de/CLN/
Source0:        https://www.ginac.de/CLN/%{name}-%{version}.tar.bz2
Patch001:	0001-add-support-for-loongarch.patch

BuildRequires:  gcc-c++
BuildRequires:  gmp-devel
BuildRequires:  texi2html
BuildRequires:  texinfo-tex
BuildRequires:  make

%description
A collection of C++ math classes and functions, which are designed for
memory and speed efficiency, and enable type safety and algebraic
syntax.

%package        devel
Summary:        Development files for programs using the CLN library
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       gmp-devel%{?_isa}

%description    devel
A collection of C++ math classes and functions, which are designed for
memory and speed efficiency, and enable type safety and algebraic
syntax.

This package is necessary if you wish to develop software based on
the CLN library.

%ifarch %{arm}
%global XFLAGS %{optflags} -DNO_ASM
%else
%global XFLAGS %{optflags}
%endif

%prep
%setup -q
%patch001 -p1
	
%build
%configure --disable-static CXXFLAGS="%{XFLAGS}" CFLAGS="%{XFLAGS}"
make %{?_smp_mflags}
make pdf
make html

%install
%make_install

find %{buildroot} -type f -name "*.la" -delete -print
rm -f %{buildroot}%{_infodir}/dir
rm -rf %{buildroot}%{_bindir} %{buildroot}%{_mandir}/man1/pi.*

%check
make %{_smp_mflags} check

%ldconfig_scriptlets

%files
%doc COPYING NEWS README TODO
%{_libdir}/*.so.*

%files devel
%{_libdir}/*.so
%{_libdir}/pkgconfig/cln.pc
%{_includedir}/cln/
%{_infodir}/*.info*
%doc doc/cln.pdf doc/cln.html

%changelog
* Wed Jun 19 2024 Wenlong Zhang <zhangwenlong@loongson.cn> - 1.3.6-4
- add support for loongarch

* Wed Oct 11 2023 misaka00251 <liuxin@iscas.ac.cn> - 1.3.6-3
- Fix build on riscv64

* Mon May 08 2023 misaka00251 <liuxin@iscas.ac.cn> - 1.3.6-2
- Remove patch, it's merged upstream

* Tue Nov 15 2022 hkgy <kaguyahatu@outlook.com> - 1.3.6-1
- Upgrade to v1.3.6

* Fri Jul 15 2022 misaka00251 <liuxin@iscas.ac.cn> - 1.3.4-1
- Init package
