%global pkgvers 0
%global scdate0 20240925
%global sctags0 v24.09
%global source0 https://github.com/ARM-software/ComputeLibrary.git

Name:           arm-compute-library
Version:        24.09
Release:        %{scdate0}.%{pkgvers}%{?dist}
Summary:        The ARM Computer Vision and Machine Learning library
License:        MIT

URL:            https://github.com/ARM-software/ComputeLibrary

ExclusiveArch:  x86_64 aarch64 armv7hl

BuildRequires:  gcc-c++
BuildRequires:  git scons ocl-icd-devel
%if 0%{?rhel} == 8
BuildRequires:  gcc-toolset-11-gcc-c++
%endif


%description
The ARM Computer Vision and Machine Learning library

%package        devel
Summary:        Development files for arm
Requires:       %{name} = %{version}-%{release}
Requires:       opencl-headers

%description    devel
This package contains development files for arm.

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

%description    static
This package contains development files for arm.

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

%description    examples
This package contains example files for arm.


%prep
%setup -T -c -n %{name}
git clone --depth 1 -n -b %{sctags0} %{source0} .
git reset --hard %{sctags0}
git log --format=fuller
# fixes
sed -i '1 i\#include <iterator>' include/libnpy/npy.hpp
sed -i '1 i\#include <cstdint>' arm_compute/core/Strides.h
sed -i '1 i\#include <cstdint>' arm_compute/core/utils/misc/Utility.h
sed -i '1 i\#include <cstring>' utils/command_line/CommandLineParser.h


%build
%define build_opt Werror=0 debug=1 asserts=0 os=linux set_soname=1 opencl=1 openmp=1 build=native
%if 0%{?rhel} == 8
. /opt/rh/gcc-toolset-11/enable
%endif
%ifarch aarch64
scons %{build_opt} arch=arm64-v8a neon=1 multi_isa=1 %{?_smp_mflags}
%endif
%ifarch armv7hl
scons %{build_opt} arch=armv7a neon=1 %{?_smp_mflags}
%endif
%ifarch x86_64
scons %{build_opt} arch=x86_64 neon=0 %{?_smp_mflags}
%endif


%install
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_libdir}
# static libs
cp -Pf build/*.a* %{buildroot}/%{_libdir}/
# dynamic libs
cp -Pf build/*.so* %{buildroot}/%{_libdir}/
# include dirs
for f in `find . -type f -regex '.*\.\(h\|hpp\|inl\)'`;
do
  install -D -pm 644 $f %{buildroot}/%{_includedir}/%{name}/$f
done
# examples
for f in `find build/examples/ -type f -exec file {} \; | grep executable | cut -d':' -f1`;
do
  install -D -pm 755 $f %{buildroot}/%{_bindir}/${f##*/}
done
# remove duplicate sys opencl
rm -rf %{buildroot}%{_includedir}/%{name}/include/CL


%files
%doc README.md
%doc examples data
%doc docs support utils
%license LICENSE
%{_libdir}/lib*.so.*

%files devel
%doc support utils
%{_includedir}/*
%{_libdir}/lib*.so

%files static
%{_libdir}/lib*.a

%files examples
%{_bindir}/*


%changelog
* Fri Mar 29 2019 Balint Cristian <cristian.balint@gmail.com>
- github upstream releases