* [gentoo-commits] repo/gentoo:master commit in: sys-libs/libnvidia-container/files/, sys-libs/libnvidia-container/
@ 2024-12-09 22:27 Sam James
0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2024-12-09 22:27 UTC (permalink / raw
To: gentoo-commits
commit: 6dd6c0610e02915fac88967219c77d7ef5921211
Author: Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Thu Dec 5 10:19:35 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 9 22:27:13 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6dd6c061
sys-libs/libnvidia-container: new package (from ::guru)
based on the ::guru ebuild by Huang Rui <vowstar <AT> gmail.com> and many
others, thanks. Changes:
- update version to 1.17.2
- update dependence of x11-drivers/nvidia-drivers on glibc only
- die if compiler is not gcc, because of "-fplan9-extensions"
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/39601
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-libs/libnvidia-container/Manifest | 2 +
...ibnvidia-container-1.17.0-fix-makefile-r1.patch | 220 +++++++++++++++++++++
.../libnvidia-container-1.17.2.ebuild | 129 ++++++++++++
.../libnvidia-container-9999.ebuild | 129 ++++++++++++
sys-libs/libnvidia-container/metadata.xml | 31 +++
5 files changed, 511 insertions(+)
diff --git a/sys-libs/libnvidia-container/Manifest b/sys-libs/libnvidia-container/Manifest
new file mode 100644
index 000000000000..4089b4407e01
--- /dev/null
+++ b/sys-libs/libnvidia-container/Manifest
@@ -0,0 +1,2 @@
+DIST libnvidia-container-1.17.2.tar.gz 1611920 BLAKE2B 571ddc5fda854999cd7d1b2bbc40d34728827bf2e9c26afe6784166db7202d2baa55b0ca0eba50be61b029645735aaf91655bfec55113996eaf8c5278b835cd8 SHA512 a791998012f681805b3cc0a3bd38abc958a523c3eaa13cab36be4e0242cfba095719d5f6fa59423453a81c3fc76c96a4bbfd2eea27d20e2ef2f9a03d3a447fd8
+DIST libnvidia-container-nvidia-modprobe-550.54.14.tar.gz 47147 BLAKE2B 7b334877d98d0c75d5750192dea868436938852443ced14e74e59076ed4d8be9e361cdefbe48295d87bb91ac4565152ec3f3233479b3da19bb8baf8e7ef53cd6 SHA512 279228aa315ff5fd1a23df23527aff58b2319f11f9fc7d939fa285ea933b4cc6d223451e20ecf7f50baba9f6c9c100e57cb77675d0d17fa77f19d3fea2ccc193
diff --git a/sys-libs/libnvidia-container/files/libnvidia-container-1.17.0-fix-makefile-r1.patch b/sys-libs/libnvidia-container/files/libnvidia-container-1.17.0-fix-makefile-r1.patch
new file mode 100644
index 000000000000..d68aa9e84e60
--- /dev/null
+++ b/sys-libs/libnvidia-container/files/libnvidia-container-1.17.0-fix-makefile-r1.patch
@@ -0,0 +1,220 @@
+Base on The patch from Arch[1] but better suited to Gentoo needs.
+
+[1]: https://gitlab.archlinux.org/archlinux/packaging/packages/libnvidia-container/-/raw/a642a3cc488862a8483075ee63f8a8c470860149/fix-makefile.patch
+diff --git a/Makefile b/Makefile
+index 6fb6976..c6f26d3 100644
+--- a/Makefile
++++ b/Makefile
+@@ -18,18 +18,16 @@
+ ##### Global variables #####
+
+ WITH_NVCGO ?= yes
+-WITH_LIBELF ?= no
+-WITH_TIRPC ?= no
++WITH_TIRPC ?= yes
+ WITH_SECCOMP ?= yes
+
+ ##### Global definitions #####
+
+-export prefix = /usr/local
++export prefix ?= /usr
+ export exec_prefix = $(prefix)
+ export bindir = $(exec_prefix)/bin
+-export libdir = $(exec_prefix)/lib
++export libdir ?= $(exec_prefix)/lib64
+ export docdir = $(prefix)/share/doc
+-export libdbgdir = $(prefix)/lib/debug$(libdir)
+ export includedir = $(prefix)/include
+ export pkgconfdir = $(libdir)/pkgconfig
+
+@@ -158,20 +156,17 @@ ifeq ($(WITH_NVCGO), yes)
+ LIB_CPPFLAGS += -DWITH_NVCGO
+ LIB_LDLIBS_SHARED += -lpthread
+ endif
+-ifeq ($(WITH_LIBELF), yes)
++# Build with system libelf unconditionally
+ LIB_CPPFLAGS += -DWITH_LIBELF
+ LIB_LDLIBS_SHARED += -lelf
+-else
+-LIB_LDLIBS_STATIC += -l:libelf.a
+-endif
+ ifeq ($(WITH_TIRPC), yes)
+-LIB_CPPFLAGS += -isystem $(DEPS_DIR)$(includedir)/tirpc -DWITH_TIRPC
+-LIB_LDLIBS_STATIC += -l:libtirpc.a
+-LIB_LDLIBS_SHARED += -lpthread
++LIB_CPPFLAGS += -isystem $(includedir)/tirpc -DWITH_TIRPC
++# dynamically link with system tirpc
++LIB_LDLIBS_SHARED += -lpthread -ltirpc
+ endif
+ ifeq ($(WITH_SECCOMP), yes)
+-LIB_CPPFLAGS += -DWITH_SECCOMP $(shell pkg-config --cflags libseccomp)
+-LIB_LDLIBS_SHARED += $(shell pkg-config --libs libseccomp)
++LIB_CPPFLAGS += -DWITH_SECCOMP $(shell $(PKG_CONFIG) --cflags libseccomp)
++LIB_LDLIBS_SHARED += $(shell $(PKG_CONFIG) --libs libseccomp)
+ endif
+ LIB_CPPFLAGS += $(CPPFLAGS)
+ LIB_CFLAGS += $(CFLAGS)
+@@ -222,22 +217,14 @@ $(BIN_OBJS): %.o: %.c | shared
+ -include $(DEPENDENCIES)
+
+ $(LIB_SHARED): $(LIB_OBJS)
+- $(MKDIR) -p $(DEBUG_DIR)
+ $(CC) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(LIB_LDFLAGS) $(OUTPUT_OPTION) $^ $(LIB_SCRIPT) $(LIB_LDLIBS)
+- $(OBJCPY) --only-keep-debug $@ $(LIB_SONAME)
+- $(OBJCPY) --add-gnu-debuglink=$(LIB_SONAME) $@
+- $(MV) $(LIB_SONAME) $(DEBUG_DIR)
+- $(STRIP) --strip-unneeded -R .comment $@
+
+ $(LIB_STATIC_OBJ): $(LIB_OBJS)
+ # FIXME Handle user-defined LDFLAGS and LDLIBS
+ $(LD) -d -r --exclude-libs ALL -L$(DEPS_DIR)$(libdir) $(OUTPUT_OPTION) $^ $(LIB_LDLIBS_STATIC)
+- $(OBJCPY) --localize-hidden $@
+- $(STRIP) --strip-unneeded -R .comment $@
+
+ $(BIN_NAME): $(BIN_OBJS)
+ $(CC) $(BIN_CFLAGS) $(BIN_CPPFLAGS) $(BIN_LDFLAGS) $(OUTPUT_OPTION) $^ $(BIN_SCRIPT) $(BIN_LDLIBS)
+- $(STRIP) --strip-unneeded -R .comment $@
+
+ ##### Public rules #####
+
+@@ -262,15 +249,9 @@ deps: $(LIB_RPC_SRCS) $(BUILD_DEFS)
+ ifeq ($(WITH_NVCGO), yes)
+ $(MAKE) -f $(MAKE_DIR)/nvcgo.mk DESTDIR=$(DEPS_DIR) MAJOR=$(MAJOR) VERSION=$(VERSION) LIB_NAME=$(LIBGO_NAME) install
+ endif
+-ifeq ($(WITH_LIBELF), no)
+- $(MAKE) -f $(MAKE_DIR)/elftoolchain.mk DESTDIR=$(DEPS_DIR) install
+-endif
+-ifeq ($(WITH_TIRPC), yes)
+- $(MAKE) -f $(MAKE_DIR)/libtirpc.mk DESTDIR=$(DEPS_DIR) install
+-endif
+
+ install: all
+- $(INSTALL) -d -m 755 $(addprefix $(DESTDIR),$(includedir) $(bindir) $(libdir) $(docdir) $(libdbgdir) $(pkgconfdir))
++ $(INSTALL) -d -m 755 $(addprefix $(DESTDIR),$(includedir) $(bindir) $(libdir) $(pkgconfdir))
+ # Install header files
+ $(INSTALL) -m 644 $(LIB_INCS) $(DESTDIR)$(includedir)
+ # Install library files
+@@ -279,18 +260,18 @@ install: all
+ $(LN) -sf $(LIB_SONAME) $(DESTDIR)$(libdir)/$(LIB_SYMLINK)
+ ifeq ($(WITH_NVCGO), yes)
+ $(INSTALL) -m 755 $(DEPS_DIR)$(libdir)/$(LIBGO_SHARED) $(DESTDIR)$(libdir)
++ # FIXME: for some reason ldconfig stopped creating this symlink after applying Arch Linux LDFLAGS
++ $(LN) -sf $(LIBGO_SHARED) $(DESTDIR)$(libdir)/$(LIBGO_SONAME)
+ $(LN) -sf $(LIBGO_SONAME) $(DESTDIR)$(libdir)/$(LIBGO_SYMLINK)
+ endif
+ $(LDCONFIG) -n $(DESTDIR)$(libdir)
+- # Install debugging symbols
+- $(INSTALL) -m 644 $(DEBUG_DIR)/$(LIB_SONAME) $(DESTDIR)$(libdbgdir)
+ # Install configuration files
+ $(MAKE_DIR)/$(LIB_PKGCFG).in "$(strip $(VERSION))" "$(strip $(LIB_LDLIBS_SHARED))" > $(DESTDIR)$(pkgconfdir)/$(LIB_PKGCFG)
+ # Install binary files
+ $(INSTALL) -m 755 $(BIN_NAME) $(DESTDIR)$(bindir)
+ # Install documentation files
+- $(INSTALL) -d -m 755 $(DESTDIR)$(docdir)/$(LIB_NAME)-$(VERSION)
+- $(INSTALL) -m 644 $(DOC_FILES) $(DESTDIR)$(docdir)/$(LIB_NAME)-$(VERSION)
++ # $(INSTALL) -d -m 755 $(DESTDIR)$(docdir)/$(LIB_NAME)-$(VERSION)
++ # $(INSTALL) -m 644 $(DOC_FILES) $(DESTDIR)$(docdir)/$(LIB_NAME)-$(VERSION)
+
+ uninstall:
+ # Uninstall header files
+@@ -300,14 +281,12 @@ uninstall:
+ ifeq ($(WITH_NVCGO), yes)
+ $(RM) $(addprefix $(DESTDIR)$(libdir)/,$(LIBGO_SHARED) $(LIBGO_SONAME) $(LIBGO_SYMLINK))
+ endif
+- # Uninstall debugging symbols
+- $(RM) $(DESTDIR)$(libdbgdir)/$(LIB_SONAME)
+ # Uninstall configuration files
+ $(RM) $(DESTDIR)$(pkgconfdir)/$(LIB_PKGCFG)
+ # Uninstall binary files
+ $(RM) $(DESTDIR)$(bindir)/$(BIN_NAME)
+ # Uninstall documentation files
+- $(RM) -r $(DESTDIR)$(docdir)/$(LIB_NAME)-$(VERSION)
++ # $(RM) -r $(DESTDIR)$(docdir)/$(LIB_NAME)-$(VERSION)
+
+ dist: DESTDIR:=$(DIST_DIR)/$(LIB_NAME)_$(VERSION)$(addprefix -,$(TAG))
+ dist: install
+@@ -320,12 +299,6 @@ depsclean:
+ ifeq ($(WITH_NVCGO), yes)
+ -$(MAKE) -f $(MAKE_DIR)/nvcgo.mk clean
+ endif
+-ifeq ($(WITH_LIBELF), no)
+- -$(MAKE) -f $(MAKE_DIR)/elftoolchain.mk clean
+-endif
+-ifeq ($(WITH_TIRPC), yes)
+- -$(MAKE) -f $(MAKE_DIR)/libtirpc.mk clean
+-endif
+
+ mostlyclean:
+ $(RM) $(LIB_OBJS) $(LIB_STATIC_OBJ) $(BIN_OBJS) $(DEPENDENCIES)
+diff --git a/mk/common.mk b/mk/common.mk
+index f6d5fbf..594ec08 100644
+--- a/mk/common.mk
++++ b/mk/common.mk
+@@ -19,6 +19,7 @@ RPCGEN ?= rpcgen
+ BMAKE ?= MAKEFLAGS= bmake
+ DOCKER ?= docker
+ PATCH ?= patch
++PKG_CONFIG ?= pkg-config
+
+ UID := $(shell id -u)
+ GID := $(shell id -g)
+diff --git a/mk/nvcgo.mk b/mk/nvcgo.mk
+index 0060f0e..877a72b 100644
+--- a/mk/nvcgo.mk
++++ b/mk/nvcgo.mk
+@@ -17,7 +17,7 @@ include $(MAKE_DIR)/common.mk
+ ##### Source definitions #####
+
+ PREFIX := nvcgo
+-SRCS_DIR := $(DEPS_DIR)/src/$(PREFIX)
++SRCS_DIR := $(CURDIR)/src/$(PREFIX)
+ VERSION := $(VERSION)
+
+ ##### Public rules #####
+@@ -25,9 +25,6 @@ VERSION := $(VERSION)
+ .PHONY: all install clean
+
+ build:
+- $(RM) -rf $(SRCS_DIR)
+- $(CP) -R $(CURDIR)/src/$(PREFIX) $(SRCS_DIR)
+- $(MAKE) -C $(SRCS_DIR) VERSION=$(VERSION) clean
+ $(MAKE) -C $(SRCS_DIR) VERSION=$(VERSION) build
+
+ install: build
+diff --git a/mk/nvidia-modprobe.mk b/mk/nvidia-modprobe.mk
+index 3406222..339275f 100644
+--- a/mk/nvidia-modprobe.mk
++++ b/mk/nvidia-modprobe.mk
+@@ -25,7 +25,7 @@ PATCH_FILE := $(MAKE_DIR)/nvidia-modprobe.patch
+
+ ARFLAGS := -rU
+ CPPFLAGS := -D_FORTIFY_SOURCE=2 -DNV_LINUX
+-CFLAGS := -O2 -g -fdata-sections -ffunction-sections -fstack-protector -fno-strict-aliasing -fPIC
++CFLAGS := -fdata-sections -ffunction-sections -fstack-protector -fno-strict-aliasing -fPIC $(CFLAGS)
+
+ ##### Private rules #####
+
+diff --git a/src/nvcgo/Makefile b/src/nvcgo/Makefile
+index eaee95a..7d5bd74 100644
+--- a/src/nvcgo/Makefile
++++ b/src/nvcgo/Makefile
+@@ -31,15 +31,15 @@ OBJ_NAME := $(LIB_NAME).so
+ HDR_NAME := $(LIB_NAME).h
+ CTYPES_H := ctypes.h
+
+-CGO_CFLAGS := -std=gnu11 -O2
+-CGO_LDFLAGS := -Wl,--gc-sections -Wl,-s -Wl,-soname,$(LIB_SONAME)
++CGO_CFLAGS := -std=gnu11 $(CGO_CFLAGS)
++CGO_LDFLAGS := -Wl,--gc-sections -Wl,-soname,$(LIB_SONAME) $(CGO_LDFLAGS)
+
+ build: $(OBJ_NAME)
+
+ $(OBJ_NAME): $(wildcard $(CURDIR)/*.go) $(wildcard */*.go)
+ export CGO_CFLAGS="$(CGO_CFLAGS)"; \
+- export CGO_LDFLAGS="$(CGO_LDFLAGS)"; \
+- $(GO) build -o $(@) -ldflags "-s -w" -buildmode=c-shared .
++ export CGO_LDFLAGS="-Wl,--gc-sections -Wl,-soname,$(LIB_SONAME) $(CGO_LDFLAGS)"; \
++ $(GO) build -o $(@) -ldflags "$(GO_LDFLAGS)" -buildmode=c-shared .
+
+ install: $(OBJ_NAME)
+ $(INSTALL) -d -m 755 $(addprefix $(DESTDIR),$(libdir) $(includedir)/$(PKG_NAME))
diff --git a/sys-libs/libnvidia-container/libnvidia-container-1.17.2.ebuild b/sys-libs/libnvidia-container/libnvidia-container-1.17.2.ebuild
new file mode 100644
index 000000000000..02a66df0cfc1
--- /dev/null
+++ b/sys-libs/libnvidia-container/libnvidia-container-1.17.2.ebuild
@@ -0,0 +1,129 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+# check the VERSION in libnvidia-container/mk/nvidia-modprobe.mk
+NVMODV="550.54.14"
+
+DESCRIPTION="NVIDIA container runtime library"
+HOMEPAGE="https://github.com/NVIDIA/libnvidia-container"
+
+if [[ "${PV}" == "9999" ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/NVIDIA/${PN}.git"
+else
+ SRC_URI="
+ https://github.com/NVIDIA/${PN}/archive/v${PV/_rc/-rc.}.tar.gz -> ${P}.tar.gz
+ "
+ S="${WORKDIR}/${PN}-${PV/_rc/-rc.}"
+ KEYWORDS="~amd64"
+fi
+NVMODS="${WORKDIR}/nvidia-modprobe-${NVMODV}"
+SRC_URI+="
+ https://github.com/NVIDIA/nvidia-modprobe/archive/${NVMODV}.tar.gz -> ${PN}-nvidia-modprobe-${NVMODV}.tar.gz
+"
+
+LICENSE="Apache-2.0"
+SLOT="0/${PV}"
+IUSE="+seccomp static-libs"
+
+# libtirpc
+# NOTE It seams that library also has optional support for net-libs/libtirpc, but I didn't
+# manage to build without it, probably the support for that build-roted away.
+DEPEND="
+ net-libs/libtirpc:=
+ sys-libs/libcap
+ virtual/libelf:=
+ seccomp? ( sys-libs/libseccomp )
+"
+
+RDEPEND="${DEPEND}
+ elibc_glibc? ( x11-drivers/nvidia-drivers )
+"
+
+BDEPEND="
+ dev-lang/go
+ net-libs/rpcsvc-proto
+ sys-apps/lsb-release
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.17.0-fix-makefile-r1.patch"
+)
+
+DOCS=( NOTICE README.md )
+
+src_unpack() {
+ default_src_unpack
+ if [[ "${PV}" == "9999" ]] ; then
+ git-r3_src_unpack
+ fi
+}
+
+src_prepare() {
+ # nvidia-modprobe patching based on libnvidia-container/mk/nvidia-modprobe.mk
+ mkdir -p "${S}"/deps/src/nvidia-modprobe-"${NVMODV}" || die
+ cp -r "${NVMODS}"/modprobe-utils/ "${S}"/deps/src/nvidia-modprobe-"${NVMODV}"/ || die
+ touch "${S}/deps/src/nvidia-modprobe-${NVMODV}/.download_stamp" || die
+ pushd "${S}/deps/src/nvidia-modprobe-${NVMODV}" || die
+ eapply -p1 "${S}"/mk/nvidia-modprobe.patch
+ popd || die
+
+ default
+}
+
+src_configure() {
+ export GOPATH="${S}"
+ export GOFLAGS="-mod=vendor"
+ export CFLAGS="${CFLAGS}"
+ export LDFLAGS="${LDFLAGS}"
+ export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}"
+ export CGO_LDFLAGS="${CGO_LDFLAGS:-$LDFLAGS}"
+
+ tc-export CC LD OBJCOPY PKG_CONFIG
+
+ if ! tc-is-gcc; then
+ eerror "Building ${PN} with clang is not supported because of option \"-fplan9-extensions\"!"
+ die "$(tc-getCC) is not a supported compiler. Please use sys-devel/gcc"
+ fi
+
+ # we could also set GO compiller, but it currently defaults to gccgo, but as for now I believe
+ # most users will prefer dev-lang/go and they usually don't define GO="go" their make.conf either.
+ # tc-export GO
+
+ my_makeopts=(
+ prefix="${EPREFIX}/usr"
+ libdir="${EPREFIX}/usr/$(get_libdir)"
+ GO_LDFLAGS="-compressdwarf=false -linkmode=external"
+ WITH_SECCOMP="$(usex seccomp)"
+ )
+ # WITH_TIRPC="$(usex libtirpc)"
+
+ if [[ "${PV}" != "9999" ]] ; then
+ IFS='_' read -r MY_LIB_VERSION MY_LIB_TAG <<< "${PV}"
+
+ my_makeopts=( "${my_makeopts[@]}"
+ REVISION="${PV}"
+ LIB_VERSION="${MY_LIB_VERSION}"
+ LIB_TAG="${MY_LIB_TAG}"
+ )
+ fi
+}
+
+src_compile() {
+ emake "${my_makeopts[@]}"
+}
+
+src_install() {
+ emake "${my_makeopts[@]}" DESTDIR="${D}" install
+ # Install docs
+ einstalldocs # Bug 831705
+ # Cleanup static libraries
+ if ! use static-libs ; then
+ find "${ED}" -name '*.a' -delete || die # Bug 783984
+ fi
+}
diff --git a/sys-libs/libnvidia-container/libnvidia-container-9999.ebuild b/sys-libs/libnvidia-container/libnvidia-container-9999.ebuild
new file mode 100644
index 000000000000..02a66df0cfc1
--- /dev/null
+++ b/sys-libs/libnvidia-container/libnvidia-container-9999.ebuild
@@ -0,0 +1,129 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+# check the VERSION in libnvidia-container/mk/nvidia-modprobe.mk
+NVMODV="550.54.14"
+
+DESCRIPTION="NVIDIA container runtime library"
+HOMEPAGE="https://github.com/NVIDIA/libnvidia-container"
+
+if [[ "${PV}" == "9999" ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/NVIDIA/${PN}.git"
+else
+ SRC_URI="
+ https://github.com/NVIDIA/${PN}/archive/v${PV/_rc/-rc.}.tar.gz -> ${P}.tar.gz
+ "
+ S="${WORKDIR}/${PN}-${PV/_rc/-rc.}"
+ KEYWORDS="~amd64"
+fi
+NVMODS="${WORKDIR}/nvidia-modprobe-${NVMODV}"
+SRC_URI+="
+ https://github.com/NVIDIA/nvidia-modprobe/archive/${NVMODV}.tar.gz -> ${PN}-nvidia-modprobe-${NVMODV}.tar.gz
+"
+
+LICENSE="Apache-2.0"
+SLOT="0/${PV}"
+IUSE="+seccomp static-libs"
+
+# libtirpc
+# NOTE It seams that library also has optional support for net-libs/libtirpc, but I didn't
+# manage to build without it, probably the support for that build-roted away.
+DEPEND="
+ net-libs/libtirpc:=
+ sys-libs/libcap
+ virtual/libelf:=
+ seccomp? ( sys-libs/libseccomp )
+"
+
+RDEPEND="${DEPEND}
+ elibc_glibc? ( x11-drivers/nvidia-drivers )
+"
+
+BDEPEND="
+ dev-lang/go
+ net-libs/rpcsvc-proto
+ sys-apps/lsb-release
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.17.0-fix-makefile-r1.patch"
+)
+
+DOCS=( NOTICE README.md )
+
+src_unpack() {
+ default_src_unpack
+ if [[ "${PV}" == "9999" ]] ; then
+ git-r3_src_unpack
+ fi
+}
+
+src_prepare() {
+ # nvidia-modprobe patching based on libnvidia-container/mk/nvidia-modprobe.mk
+ mkdir -p "${S}"/deps/src/nvidia-modprobe-"${NVMODV}" || die
+ cp -r "${NVMODS}"/modprobe-utils/ "${S}"/deps/src/nvidia-modprobe-"${NVMODV}"/ || die
+ touch "${S}/deps/src/nvidia-modprobe-${NVMODV}/.download_stamp" || die
+ pushd "${S}/deps/src/nvidia-modprobe-${NVMODV}" || die
+ eapply -p1 "${S}"/mk/nvidia-modprobe.patch
+ popd || die
+
+ default
+}
+
+src_configure() {
+ export GOPATH="${S}"
+ export GOFLAGS="-mod=vendor"
+ export CFLAGS="${CFLAGS}"
+ export LDFLAGS="${LDFLAGS}"
+ export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}"
+ export CGO_LDFLAGS="${CGO_LDFLAGS:-$LDFLAGS}"
+
+ tc-export CC LD OBJCOPY PKG_CONFIG
+
+ if ! tc-is-gcc; then
+ eerror "Building ${PN} with clang is not supported because of option \"-fplan9-extensions\"!"
+ die "$(tc-getCC) is not a supported compiler. Please use sys-devel/gcc"
+ fi
+
+ # we could also set GO compiller, but it currently defaults to gccgo, but as for now I believe
+ # most users will prefer dev-lang/go and they usually don't define GO="go" their make.conf either.
+ # tc-export GO
+
+ my_makeopts=(
+ prefix="${EPREFIX}/usr"
+ libdir="${EPREFIX}/usr/$(get_libdir)"
+ GO_LDFLAGS="-compressdwarf=false -linkmode=external"
+ WITH_SECCOMP="$(usex seccomp)"
+ )
+ # WITH_TIRPC="$(usex libtirpc)"
+
+ if [[ "${PV}" != "9999" ]] ; then
+ IFS='_' read -r MY_LIB_VERSION MY_LIB_TAG <<< "${PV}"
+
+ my_makeopts=( "${my_makeopts[@]}"
+ REVISION="${PV}"
+ LIB_VERSION="${MY_LIB_VERSION}"
+ LIB_TAG="${MY_LIB_TAG}"
+ )
+ fi
+}
+
+src_compile() {
+ emake "${my_makeopts[@]}"
+}
+
+src_install() {
+ emake "${my_makeopts[@]}" DESTDIR="${D}" install
+ # Install docs
+ einstalldocs # Bug 831705
+ # Cleanup static libraries
+ if ! use static-libs ; then
+ find "${ED}" -name '*.a' -delete || die # Bug 783984
+ fi
+}
diff --git a/sys-libs/libnvidia-container/metadata.xml b/sys-libs/libnvidia-container/metadata.xml
new file mode 100644
index 000000000000..006fc2ab915a
--- /dev/null
+++ b/sys-libs/libnvidia-container/metadata.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person" proxied="yes">
+ <email>vowstar@gmail.com</email>
+ <name>Huang Rui</name>
+ </maintainer>
+ <maintainer type="person" proxied="yes">
+ <email>zhixu.liu@gmail.com</email>
+ <name>Z. Liu</name>
+ </maintainer>
+ <maintainer type="project" proxied="proxy">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">NVIDIA/libnvidia-container</remote-id>
+ </upstream>
+ <longdescription lang="en">
+ NVIDIA container runtime library, this repository provides a library and
+ a simple CLI utility to automatically configure GNU/Linux containers
+ leveraging NVIDIA hardware.
+ The implementation relies on kernel primitives and is designed to be
+ agnostic of the container runtime.
+ </longdescription>
+ <longdescription lang="zh">
+ NVIDIA容器运行时库,这个仓库提供了一个库和一个简单的命令行工具,用于自动
+ 配置利用NVIDIA硬件的GNU/Linux容器。这个实现依赖于内核原语,并旨在与容器
+ 运行时无关。
+ </longdescription>
+</pkgmetadata>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-libs/libnvidia-container/files/, sys-libs/libnvidia-container/
@ 2025-03-03 9:35 David Seifert
0 siblings, 0 replies; 2+ messages in thread
From: David Seifert @ 2025-03-03 9:35 UTC (permalink / raw
To: gentoo-commits
commit: 4918bb4f7c45c9ff1d583a3f7f50998514f35064
Author: David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 3 09:35:20 2025 +0000
Commit: David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Mon Mar 3 09:35:20 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4918bb4f
sys-libs/libnvidia-container: add patch for go 1.24
Signed-off-by: David Seifert <soap <AT> gentoo.org>
.../files/libnvidia-container-1.17.4-go-1.24.patch | 48 ++++++++++++++++++++++
.../libnvidia-container-1.17.4.ebuild | 1 +
2 files changed, 49 insertions(+)
diff --git a/sys-libs/libnvidia-container/files/libnvidia-container-1.17.4-go-1.24.patch b/sys-libs/libnvidia-container/files/libnvidia-container-1.17.4-go-1.24.patch
new file mode 100644
index 000000000000..e2439651dd04
--- /dev/null
+++ b/sys-libs/libnvidia-container/files/libnvidia-container-1.17.4-go-1.24.patch
@@ -0,0 +1,48 @@
+https://patch-diff.githubusercontent.com/raw/NVIDIA/libnvidia-container/pull/297.patch
+
+From 1c680195fdc85948d635286b72a6ad9f823b5987 Mon Sep 17 00:00:00 2001
+From: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
+Date: Thu, 13 Feb 2025 10:18:59 +0100
+Subject: [PATCH] Fix building with Go 1.24
+
+Go 1.24 does not allow defining methods on C types anymore, so make convert a function, not a method.
+
+Fixes the following error when building with Go 1.24:
+`./main.go:35:10: cannot define new methods on non-local type CDeviceRule`
+
+Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
+---
+ src/nvcgo/main.go | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/nvcgo/main.go b/src/nvcgo/main.go
+index 1523a06d..ed43be8e 100644
+--- a/src/nvcgo/main.go
++++ b/src/nvcgo/main.go
+@@ -32,7 +32,7 @@ func main() {}
+ type CDeviceRule = C.struct_device_rule
+
+ // Convert a C-based DeviceRule to a Go-based cgroup.DeviceRule
+-func (r *CDeviceRule) convert() cgroup.DeviceRule {
++func convert(r *CDeviceRule) cgroup.DeviceRule {
+ return cgroup.DeviceRule{
+ Allow: bool(r.allow),
+ Type: C.GoString(r._type),
+@@ -67,7 +67,7 @@ func GetDeviceCGroupMountPath(version C.int, procRootPath *C.char, pid C.pid_t,
+ return -1
+ }
+ *cgroupMountPath = C.CString(p)
+- *cgroupRootPrefix= C.CString(r)
++ *cgroupRootPrefix = C.CString(r)
+
+ return 0
+ }
+@@ -100,7 +100,7 @@ func AddDeviceRules(version C.int, cgroupPath *C.char, crules []CDeviceRule, rer
+
+ rules := make([]cgroup.DeviceRule, len(crules))
+ for i, cr := range crules {
+- rules[i] = cr.convert()
++ rules[i] = convert(&cr)
+ }
+
+ err = api.AddDeviceRules(C.GoString(cgroupPath), rules)
diff --git a/sys-libs/libnvidia-container/libnvidia-container-1.17.4.ebuild b/sys-libs/libnvidia-container/libnvidia-container-1.17.4.ebuild
index 5d4b6cda8900..b1e9266e9b98 100644
--- a/sys-libs/libnvidia-container/libnvidia-container-1.17.4.ebuild
+++ b/sys-libs/libnvidia-container/libnvidia-container-1.17.4.ebuild
@@ -53,6 +53,7 @@ BDEPEND="
PATCHES=(
"${FILESDIR}/${PN}-1.17.0-fix-makefile-r1.patch"
+ "${FILESDIR}/${PN}-1.17.4-go-1.24.patch"
)
DOCS=( NOTICE README.md )
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-03 9:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-03 9:35 [gentoo-commits] repo/gentoo:master commit in: sys-libs/libnvidia-container/files/, sys-libs/libnvidia-container/ David Seifert
-- strict thread matches above, loose matches on Subject: below --
2024-12-09 22:27 Sam James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox