From 23a0de7300a78c434a3de833715e07c92ff0ed8b Mon Sep 17 00:00:00 2001 From: Gilver Date: Wed, 30 Apr 2025 13:03:28 -0500 Subject: [PATCH] add: Some more NVIDIA stuff (#4553) * add: Some more NVIDIA stuff * fix: Add arches in anda.hcl Signed-off-by: Gilver --------- Signed-off-by: Gilver --- anda/lib/nvidia/libnvjitlink/anda.hcl | 9 ++ .../lib/nvidia/libnvjitlink/libnvjitlink.spec | 82 +++++++++++++++++ anda/lib/nvidia/libnvjitlink/nvjitlink.pc | 8 ++ anda/lib/nvidia/libnvjitlink/update.rhai | 3 + anda/lib/nvidia/libnvjpeg2k/anda.hcl | 9 ++ anda/lib/nvidia/libnvjpeg2k/libnvjpeg2k.spec | 91 +++++++++++++++++++ anda/lib/nvidia/libnvjpeg2k/nvjpeg2k.pc | 8 ++ anda/lib/nvidia/libnvjpeg2k/update.rhai | 5 + anda/lib/nvidia/nv-codec-headers/anda.hcl | 9 ++ .../nv-codec-headers/nv-codec-headers.spec | 37 ++++++++ anda/lib/nvidia/nv-codec-headers/update.rhai | 1 + 11 files changed, 262 insertions(+) create mode 100644 anda/lib/nvidia/libnvjitlink/anda.hcl create mode 100644 anda/lib/nvidia/libnvjitlink/libnvjitlink.spec create mode 100644 anda/lib/nvidia/libnvjitlink/nvjitlink.pc create mode 100644 anda/lib/nvidia/libnvjitlink/update.rhai create mode 100644 anda/lib/nvidia/libnvjpeg2k/anda.hcl create mode 100644 anda/lib/nvidia/libnvjpeg2k/libnvjpeg2k.spec create mode 100644 anda/lib/nvidia/libnvjpeg2k/nvjpeg2k.pc create mode 100644 anda/lib/nvidia/libnvjpeg2k/update.rhai create mode 100644 anda/lib/nvidia/nv-codec-headers/anda.hcl create mode 100644 anda/lib/nvidia/nv-codec-headers/nv-codec-headers.spec create mode 100644 anda/lib/nvidia/nv-codec-headers/update.rhai diff --git a/anda/lib/nvidia/libnvjitlink/anda.hcl b/anda/lib/nvidia/libnvjitlink/anda.hcl new file mode 100644 index 0000000000..76093f29e6 --- /dev/null +++ b/anda/lib/nvidia/libnvjitlink/anda.hcl @@ -0,0 +1,9 @@ +project pkg { + rpm { + spec = "libnvjitlink.spec" + } + labels { + subrepo = "nvidia" + updbranch = 1 + } +} diff --git a/anda/lib/nvidia/libnvjitlink/libnvjitlink.spec b/anda/lib/nvidia/libnvjitlink/libnvjitlink.spec new file mode 100644 index 0000000000..0b71abe311 --- /dev/null +++ b/anda/lib/nvidia/libnvjitlink/libnvjitlink.spec @@ -0,0 +1,82 @@ +%global debug_package %{nil} +%global __strip /bin/true +%global _missing_build_ids_terminate_build 0 +%global _build_id_links none +%global major_package_version 12-8 + +Name: libnvjitlink +Epoch: 1 +Version: 12.8.61 +Release: 1%{?dist} +Summary: NVIDIA compiler library for JIT LTO functionality +License: CUDA Toolkit +URL: https://developer.nvidia.com/cuda-toolkit +ExclusiveArch: x86_64 aarch64 + +Source0: https://developer.download.nvidia.com/compute/cuda/redist/%{name}/linux-x86_64/%{name}-linux-x86_64-%{version}-archive.tar.xz +Source1: https://developer.download.nvidia.com/compute/cuda/redist/%{name}/linux-sbsa/%{name}-linux-sbsa-%{version}-archive.tar.xz +Source3: nvjitlink.pc + +Conflicts: %{name}-%{major_package_version} < %{?epoch:%{epoch}:}%{version}-%{release} + +%description +NVJIT link compiler LTO functionality native runtime library. +Just-in-time link-time-optimization (JIT LTO) allows developers to proved +runtime linking of specialized kernel functions with no-call overhead. + +%package devel +Summary: Development files for NVIDIA compiler library for JIT LTO functionality +Requires: %{name}%{_isa} = %{?epoch:%{epoch}:}%{version}-%{release} +Conflicts: %{name}-devel-%{major_package_version} < %{?epoch:%{epoch}:}%{version} + +%description devel +This package provides development files for the CUDA NVIDIA compiler library for +JIT LTO functionality. + +%package static +Summary: Static libraries for NVIDIA compiler library for JIT LTO functionality +Requires: %{name}-devel%{_isa} = %{?epoch:%{epoch}:}%{version}-%{release} + +%description static +This package contains static libraries for NVIDIA compiler library for JIT LTO +functionality. + +%prep +%ifarch x86_64 +%setup -q -n %{name}-linux-x86_64-%{version}-archive +%endif + +%ifarch aarch64 +%setup -q -T -b 1 -n %{name}-linux-sbsa-%{version}-archive +%endif + +%install +mkdir -p %{buildroot}%{_includedir} +mkdir -p %{buildroot}%{_libdir} +mkdir -p %{buildroot}%{_libdir}/pkgconfig/ + +cp -fr include/* %{buildroot}%{_includedir}/ +cp -fr lib/lib* %{buildroot}%{_libdir}/ +cp -fr %{SOURCE3} %{buildroot}/%{_libdir}/pkgconfig/ + +# Set proper variables +sed -i \ + -e 's|CUDA_VERSION|%{version}|g' \ + -e 's|LIBDIR|%{_libdir}|g' \ + -e 's|INCLUDE_DIR|%{_includedir}|g' \ + %{buildroot}/%{_libdir}/pkgconfig/*.pc + +%files +%license LICENSE +%{_libdir}/libnvJitLink.so.* + +%files devel +%{_includedir}/nvJitLink.h +%{_libdir}/libnvJitLink.so +%{_libdir}/pkgconfig/nvjitlink.pc + +%files static +%{_libdir}/libnvJitLink_static.a + +%changelog +%autochangelog diff --git a/anda/lib/nvidia/libnvjitlink/nvjitlink.pc b/anda/lib/nvidia/libnvjitlink/nvjitlink.pc new file mode 100644 index 0000000000..cf0c87d5ad --- /dev/null +++ b/anda/lib/nvidia/libnvjitlink/nvjitlink.pc @@ -0,0 +1,8 @@ +libdir=LIBDIR +includedir=INCLUDE_DIR + +Name: NVIDIA compiler library for JIT LTO functionality +Description: NVIDIA JIT LTO +Version: CUDA_VERSION +Libs: -L${libdir} -lnvjitlink +Cflags: -I${includedir} diff --git a/anda/lib/nvidia/libnvjitlink/update.rhai b/anda/lib/nvidia/libnvjitlink/update.rhai new file mode 100644 index 0000000000..1c6cb5c513 --- /dev/null +++ b/anda/lib/nvidia/libnvjitlink/update.rhai @@ -0,0 +1,3 @@ +import "andax/nvidia.rhai" as nvidia; + +rpm.version(nvidia::nvidia_component_version("libnvjitlink")); diff --git a/anda/lib/nvidia/libnvjpeg2k/anda.hcl b/anda/lib/nvidia/libnvjpeg2k/anda.hcl new file mode 100644 index 0000000000..04a60b590e --- /dev/null +++ b/anda/lib/nvidia/libnvjpeg2k/anda.hcl @@ -0,0 +1,9 @@ +project pkg { + rpm { + spec = "libnvjpeg2k.spec" + } + labels { + subrepo = "nvidia" + updbranch = 1 + } +} diff --git a/anda/lib/nvidia/libnvjpeg2k/libnvjpeg2k.spec b/anda/lib/nvidia/libnvjpeg2k/libnvjpeg2k.spec new file mode 100644 index 0000000000..81865dbd4e --- /dev/null +++ b/anda/lib/nvidia/libnvjpeg2k/libnvjpeg2k.spec @@ -0,0 +1,91 @@ +%global debug_package %{nil} +%global __strip /bin/true +%global _missing_build_ids_terminate_build 0 + +Name: libnvjpeg2k +Version: 0.8.1.40 +Release: 1%{?dist} +Summary: NVIDIA JPEG 2K decoder (nvJPEG2000) +License: NVIDIA EULA +URL: https://developer.nvidia.com/nvjpeg +ExclusiveArch: aarch64 x86_64 + +# https://developer.nvidia.com/nvjpeg2000/downloads +Source0: https://developer.download.nvidia.com/compute/nvjpeg2000/redist/libnvjpeg_2k/linux-x86_64/libnvjpeg_2k-linux-x86_64-%{version}-archive.tar.xz +Source1: https://developer.download.nvidia.com/compute/nvjpeg2000/redist/libnvjpeg_2k/linux-sbsa/libnvjpeg_2k-linux-sbsa-%{version}-archive.tar.xz +Source2: nvjpeg2k.pc + +Obsoletes: cuda-nvjpeg2k < %{?epoch:%{epoch}:}%{version}-%{release} +Provides: cuda-nvjpeg2k = %{?epoch:%{epoch}:}%{version}-%{release} + +Conflicts: libnvjpeg2k0 < %{?epoch:%{epoch}:}%{version}-%{release} + +%description +The nvJPEG2000 library accelerates the decoding of JPEG 2000 images on NVIDIA +GPUs. The library utilizes both CPU and GPU for decoding. Tier 2 decode stage +(First stage of decode, refer to the JPEG 2000 specification for details.) is +run on the CPU. All other stages of the decoding process are offloaded to the +GPU. + +%package devel +Summary: Development files for NVIDIA JPEG 2K decoder (nvJPEG2000) +Requires: %{name}%{_isa} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: cuda-devel%{_isa} >= 1:11 +Conflicts: libnvjpeg2k-devel < %{?epoch:%{epoch}:}%{version} + +%description devel +This package provides development files for the NVIDIA JPEG 2K decoder (nvJPEG2000). + +%package static +Summary: Static libraries for NVIDIA JPEG 2K decoder (nvJPEG2000) +Requires: pkgconf-pkg-config +Requires: %{name}-devel%{_isa} = %{?epoch:%{epoch}:}%{version}-%{release} + +%description static +This package contains static libraries for NVIDIA JPEG 2K decoder (nvJPEG2000). + +%prep +%ifarch x86_64 +%setup -q -n libnvjpeg_2k-linux-x86_64-%{version}-archive +%endif + +%ifarch aarch64 +%setup -q -T -b 1 -n libnvjpeg_2k-linux-sbsa-%{version}-archive +%endif + +%build + +%install +mkdir -p %{buildroot}/%{_libdir}/pkgconfig/ +mkdir -p %{buildroot}/%{_includedir}/cuda/ + +cp -a lib/12/* %{buildroot}/%{_libdir}/ +chmod 755 %{buildroot}/%{_libdir}/*.so* + +cp -a include/* %{buildroot}/%{_includedir}/ +chmod 644 %{buildroot}/%{_includedir}/* + +install -pm 644 %{SOURCE2} %{buildroot}/%{_libdir}/pkgconfig/ + +# Set proper variables +sed -i \ + -e 's|VERSION|%{version}|g' \ + -e 's|LIBDIR|%{_libdir}|g' \ + -e 's|INCLUDE_DIR|%{_includedir}/cuda|g' \ + %{buildroot}/%{_libdir}/pkgconfig/*.pc + +%files +%license LICENSE +%{_libdir}/libnvjpeg2k.so.* + +%files static +%{_libdir}/libnvjpeg2k_static.a + +%files devel +%{_includedir}/nvjpeg2k.h +%{_includedir}/nvjpeg2k_version.h +%{_libdir}/libnvjpeg2k.so +%{_libdir}/pkgconfig/nvjpeg2k.pc + +%changelog +%autochangelog diff --git a/anda/lib/nvidia/libnvjpeg2k/nvjpeg2k.pc b/anda/lib/nvidia/libnvjpeg2k/nvjpeg2k.pc new file mode 100644 index 0000000000..1bb7a610ba --- /dev/null +++ b/anda/lib/nvidia/libnvjpeg2k/nvjpeg2k.pc @@ -0,0 +1,8 @@ +libdir=LIBDIR +includedir=INCLUDE_DIR + +Name: nvjpeg2k +Description: NVIDIA JPEG 2K decoder +Version: VERSION +Libs: -L${libdir} -lnvjpeg2k +Cflags: -I${includedir} diff --git a/anda/lib/nvidia/libnvjpeg2k/update.rhai b/anda/lib/nvidia/libnvjpeg2k/update.rhai new file mode 100644 index 0000000000..5704b3666b --- /dev/null +++ b/anda/lib/nvidia/libnvjpeg2k/update.rhai @@ -0,0 +1,5 @@ +let url = "https://developer.download.nvidia.com/compute/nvjpeg2000/redist/"; +let matches = find_all("redistrib_[\\d.]+.json", get(url)); +let series = `${url}${matches[matches.len - 1][0]}`; +let json = get(series).json(); +rpm.version(json["libnvjpeg_2k"]["version"]); diff --git a/anda/lib/nvidia/nv-codec-headers/anda.hcl b/anda/lib/nvidia/nv-codec-headers/anda.hcl new file mode 100644 index 0000000000..d2d4b12019 --- /dev/null +++ b/anda/lib/nvidia/nv-codec-headers/anda.hcl @@ -0,0 +1,9 @@ +project pkg { + arches = ["x86_64"] + rpm { + spec = "nv-codec-headers.spec" + } + labels { + subrepo = "nvidia" + } +} diff --git a/anda/lib/nvidia/nv-codec-headers/nv-codec-headers.spec b/anda/lib/nvidia/nv-codec-headers/nv-codec-headers.spec new file mode 100644 index 0000000000..dedf277a7c --- /dev/null +++ b/anda/lib/nvidia/nv-codec-headers/nv-codec-headers.spec @@ -0,0 +1,37 @@ +Name: nv-codec-headers +Version: 13.0.19.0 +Release: 1%{?dist} +Summary: FFmpeg version of Nvidia Codec SDK headers +License: MIT +URL: https://github.com/FFmpeg/nv-codec-headers +BuildArch: noarch + +Source0: %url/archive/n%{version}/%{name}-n%{version}.tar.gz + +BuildRequires: make + +%description +FFmpeg version of headers required to interface with Nvidias codec APIs. + +%prep +%autosetup -n %{name}-n%{version} +sed -i -e 's@/include@/include/ffnvcodec@g' ffnvcodec.pc.in + +# Extract license +sed -n '4,25p' include/ffnvcodec/nvEncodeAPI.h > LICENSE +sed -i '1,22s/^.\{,3\}//' LICENSE + +%build +%make_build PREFIX=%{_prefix} LIBDIR=/share + +%install +%make_install PREFIX=%{_prefix} LIBDIR=/share + +%files +%doc README +%license LICENSE +%{_includedir}/ffnvcodec/ +%{_datadir}/pkgconfig/ffnvcodec.pc + +%changelog +%autochangelog diff --git a/anda/lib/nvidia/nv-codec-headers/update.rhai b/anda/lib/nvidia/nv-codec-headers/update.rhai new file mode 100644 index 0000000000..fe990f0086 --- /dev/null +++ b/anda/lib/nvidia/nv-codec-headers/update.rhai @@ -0,0 +1 @@ +rpm.version(gh("FFmpeg/nv-codec-headers"));