File nvidia-container-toolkit.spec of Package nvidia-container-toolkit.41631

#
# spec file for package nvidia-container-toolkit
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define project github.com/NVIDIA/nvidia-container-toolkit
Name:           nvidia-container-toolkit
Version:        1.18.0
Release:        0
Summary:        NVIDIA Container Toolkit
License:        Apache-2.0
Group:          Development/Tools/Other
URL:            https://github.com/NVIDIA/nvidia-container-toolkit
Source0:        nvidia-container-toolkit-%{version}.tar.gz
Source1:        vendor.tar.gz
BuildRequires:  libcontainers-common
BuildRequires:  go-go-md2man
BuildRequires:  golang(API) >= 1.16
BuildRequires:  golang-packaging
Requires:       libnvidia-container-tools
Provides:       nvidia-container-runtime = %version
ExclusiveArch:	x86_64 ppc64le s390x aarch64
Obsoletes:      nvidia-container-runtime < %version
%{go_nostrip}
%{go_provides}

%description
Build and run containers leveraging NVIDIA GPUs.

%prep
%setup -q -a1

%build
%{goprep} github.com/NVIDIA/nvidia-container-toolkit
export GOPATH=$HOME/go
mkdir -pv $HOME/go/src/%{project}
rm -rf $HOME/go/src/%{project}/*
cp -avr * $HOME/go/src/%{project}
cd $HOME/go/src/%{project}

for i in nvidia-ctk nvidia-ctk-installer nvidia-container-runtime-hook nvidia-container-runtime nvidia-cdi-hook nvidia-container-runtime.cdi nvidia-container-runtime.legacy
do
	go build -v -ldflags "-s -w" -o bin/$i ./cmd/$i
done

%install
mkdir -p %{buildroot}/%{_bindir}/
install -m 0755 $HOME/go/src/%{project}/bin/* %{buildroot}/%{_bindir}/

#install -D -m 0644 oci-nvidia-hook.json %{buildroot}/usr/share/containers/oci/hooks.d/oci-nvidia-hook.json
#install -D -m 0644 config/config.toml.opensuse-leap %{buildroot}/etc/nvidia-container-runtime/config.toml

%files
%license LICENSE
%{_bindir}/nvidia-ctk
%{_bindir}/nvidia-ctk-installer
%{_bindir}/nvidia-cdi-hook
%{_bindir}/nvidia-container-runtime
%{_bindir}/nvidia-container-runtime.legacy
%{_bindir}/nvidia-container-runtime.cdi
%{_bindir}/nvidia-container-runtime-hook
#/usr/share/containers/oci/hooks.d/oci-nvidia-hook.json
#/etc/nvidia-container-runtime
#config(noreplace) /etc/nvidia-container-runtime/config.toml

%changelog
openSUSE Build Service is sponsored by