%global pkgvers 0
%global scdate0 20250310
%global schash0 3ea601bb413074c49a77c4ce3218bc08f8c4703c
%global branch0 main
%global source0 https://github.com/dmlc/dlpack.git

%global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}}

Name:           dlpack
Version:        1.0
Release:        %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist}
Summary:        DLPack: Open In Memory Tensor Structure
License:        Apache

URL:            https://github.com/dmlc/dlpack

BuildRequires:  doxygen cmake gcc-c++ git

%global  __cmake_in_source_build 1

%description
Open deep learning compiler stack for cpu, gpu and specialized accelerators.

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

%description devel
This package contains development files for %{name}.


%prep
%setup -T -c -n %{name}
git clone --depth 1 -n -b %{branch0} %{source0} .
git fetch --depth 1 origin %{schash0}
git reset --hard %{schash0}
git log --format=fuller


%build
mkdir -p build
pushd build
%cmake .. \
       -DCMAKE_SKIP_RPATH=ON \
       -DCMAKE_VERBOSE_MAKEFILE=OFF \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo

make %{?_smp_mflags}
popd


%install
rm -rf %{buildroot}

pushd build
make install DESTDIR=%{buildroot}
popd

mkdir -p %{buildroot}/%{_bindir}
install -pm 0755 bin/mock %{buildroot}/%{_bindir}/dlpack-mock


%files
%doc README.md NEWS.md
%license LICENSE
%{_bindir}/*

%files devel
%{_includedir}/*
%{_libdir}/*


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