1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00
nixpkgs/pkgs/os-specific/linux/nvidia-x11/libxnvctrl-build-shared.patch
Aidan Gauland b57aa88291
libXNVCtrl: build shared library
The libXNVCtrl library is used by several programs in nixpkgs to get
Nvidia GPU stats, and they all load the library dynamically, but the
libXNVCtrl package only builds a static library.  There is no build flag
to enable this, so we have to patch the Makefile to produce a shared
library.

Based on a patch by @negativo17 for Fedora.
https://github.com/negativo17/nvidia-settings/blob/master/nvidia-settings-libXNVCtrl.patch
2024-05-24 15:52:48 +12:00

22 lines
562 B
Diff

--- a/src/libXNVCtrl/xnvctrl.mk
+++ b/src/libXNVCtrl/xnvctrl.mk
@@ -39,6 +39,8 @@
LIBXNVCTRL = $(OUTPUTDIR)/libXNVCtrl.a
+LIBXNVCTRL_SHARED = $(OUTPUTDIR)/libXNVCtrl.so
+
LIBXNVCTRL_SRC = $(XNVCTRL_DIR)/NVCtrl.c
LIBXNVCTRL_OBJ = $(call BUILD_OBJECT_LIST,$(LIBXNVCTRL_SRC))
@@ -47,3 +49,9 @@
$(LIBXNVCTRL) : $(LIBXNVCTRL_OBJ)
$(call quiet_cmd,AR) ru $@ $(LIBXNVCTRL_OBJ)
+
+$(LIBXNVCTRL_SHARED): $(LIBXNVCTRL_OBJ)
+ $(RM) $@ $@.*
+ $(CC) -shared -Wl,-soname=$(@F).0 -o $@.0.0.0 $(LDFLAGS) $^ -lXext -lX11
+ ln -s $(@F).0.0.0 $@.0
+ ln -s $(@F).0 $@