alpine-overlay/kubezero/nvidia-container-toolkit/APKBUILD

79 lines
3.9 KiB
Plaintext

# Contributor: Stefan Reimer <stefan@zero-downtime.net>
# Maintainer: Stefan Reimer <stefan@zero-downtime.net>
# https://github.com/NVIDIA/nvidia-container-toolkit
pkgname=nvidia-container-toolkit
pkgver=1.16.2
pkgrel=0
pkgdesc="NVIDIA Container toolkit incl. cri hooks"
url="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/overview.html"
arch="x86_64"
license="Apache"
makedepends="xz"
depends="glibc-bin nvidia-drivers"
options="!check !tracedeps"
_nv_ver="$pkgver"-1
_libcap=2.44-1
_libseccomp=2.3.3-4
source="https://nvidia.github.io/libnvidia-container/stable/deb/amd64/libnvidia-container1_"$_nv_ver"_amd64.deb
https://nvidia.github.io/libnvidia-container/stable/deb/amd64/libnvidia-container-tools_"$_nv_ver"_amd64.deb
https://nvidia.github.io/libnvidia-container/stable/deb/amd64/nvidia-container-toolkit_"$_nv_ver"_amd64.deb
http://deb.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_"$_libseccomp"_amd64.deb
http://deb.debian.org/debian/pool/main/libc/libcap2/libcap2_"$_libcap"_amd64.deb
config.toml
oci-nvidia-hook.json
"
build() {
return 0
}
package() {
mkdir -p "$pkgdir"/usr/bin "$pkgdir"/usr/glibc-compat/lib/nvidia
# libnvidia-container1
ar -x "$srcdir"/libnvidia-container1_"$_nv_ver"_amd64.deb && tar xfJ data.tar.xz
mv usr/lib/x86_64-linux-gnu/* "$pkgdir"/usr/glibc-compat/lib/nvidia
rm -rf control.tar.xz data.tar.xz debian-binary usr
# libnvidia-container-tools
ar -x "$srcdir"/libnvidia-container-tools_"$_nv_ver"_amd64.deb && tar xfJ data.tar.xz
mv usr/bin/nvidia-container-cli "$pkgdir"/usr/bin
rm -rf control.tar.xz data.tar.xz debian-binary usr
# nvidia-container-toolkit
ar -x "$srcdir"/nvidia-container-toolkit_"$_nv_ver"_amd64.deb && tar xfJ data.tar.xz
mv usr/bin/nvidia* "$pkgdir"/usr/bin
rm -rf control.tar.xz data.tar.xz debian-binary usr
# Add dependencies which also need to be compiled against glibc: libcap, libseccomp
# libcap
ar -x "$srcdir"/libcap2_"$_libcap"_amd64.deb && tar xfJ data.tar.xz
mv lib/x86_64-linux-gnu/libcap.so.* "$pkgdir"/usr/glibc-compat/lib
rm -rf control.tar.xz data.tar.xz debian-binary usr
# libseccomp
ar -x "$srcdir"/libseccomp2_"$_libseccomp"_amd64.deb && tar xfJ data.tar.xz
mv usr/lib/x86_64-linux-gnu/libseccomp.so.* "$pkgdir"/usr/glibc-compat/lib
rm -rf control.tar.xz data.tar.xz debian-binary usr
# Now lets patch the elf binaries to fix library paths and order
doas apk add patchelf@edge-community
patchelf --remove-rpath "$pkgdir"/usr/bin/nvidia-container-cli
patchelf --remove-rpath "$pkgdir"/usr/glibc-compat/lib/nvidia/libnvidia-container.so.1
# Install our runtime config and oci hook
install -Dm644 "$srcdir"/oci-nvidia-hook.json "$pkgdir"/usr/share/containers/oci/hooks.d/oci-nvidia-hook.json
install -Dm644 config.toml "$pkgdir"/etc/nvidia-container-runtime/config.toml
}
sha512sums="
f2fef3ad6df1c246b3a67e984e33b445f6b2e28c8cb8f4708bb7b1f33e48dde2aadfc107ed482a275936eb5c0b92edd8dc3980aa8e1e360fce0760f381a166a1 libnvidia-container1_1.16.2-1_amd64.deb
1b54af4b5276e4e2af737799a88ac482973b96fd84634cc34899fffe189f1a106d5b1dd482f39992ee30bd7bf34c2db558b8fd6664d9102acae0bb27f16567d4 libnvidia-container-tools_1.16.2-1_amd64.deb
58b44681dcfef1f02ff1613410e8a947d45e3142cc5d332a84b4845809c11fa2cec480810bd5665dde61c719e91a45b662cc0bd30ed418a1300714b35ce76df4 nvidia-container-toolkit_1.16.2-1_amd64.deb
5a4eaa96e6e774948889909d618a8ed44a82f649cbba11622dc7b4478098bea006995d5a5a60ca026a57b76ad866d1e2c6caebd154a26eb6bd7e15291b558057 libseccomp2_2.3.3-4_amd64.deb
cc9109cdcf51dc40db732e10ac3eda7e4ac73299ad51d2ec619d7f4cff3f0311be0937530d2175e5486c393bc9e91c709072094fad510573785739afaad831f1 libcap2_2.44-1_amd64.deb
040ac2e3f58549dc09e5bce0d694e4be2f6aae736014bf0ee90042646562d5f1ef1f5990eb9f2c2a2fdf504587b82f4aa0eb99d04c5d3e407670e4012e3edd4e config.toml
0f150ea59b2372bf3ef60e657142b19f46500d1c70cb179d37ce117d6b03e86427dbf356873affb7639e082a07f852a922ae3aea4a8f8885640e43675c4e4add oci-nvidia-hook.json
"