Merge pull request #312811 from aidalgol/libxnvctrl-shared

linuxPackages.nvidia_x11.libXNVCtrl: make the shared library available
This commit is contained in:
Someone 2024-05-24 13:35:19 +00:00 committed by GitHub
commit 67d54c2e29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 56 additions and 2 deletions

View File

@ -285,7 +285,7 @@ in
KERNEL=="nvidia_uvm", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidia-uvm-tools c $$(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 1'"
'';
hardware.opengl = {
extraPackages = [ nvidia_x11.out ];
extraPackages = [ nvidia_x11.out nvidia_x11.settings.libXNVCtrl ];
extraPackages32 = [ nvidia_x11.lib32 ];
};
environment.systemPackages = [ nvidia_x11.bin ];

View File

@ -0,0 +1,24 @@
--- a/src/libXNVCtrl/Makefile
+++ b/src/libXNVCtrl/Makefile
@@ -33,6 +33,8 @@
LIBXNVCTRL = libXNVCtrl.a
+LIBXNVCTRL_SHARED = $(OUTPUTDIR)/libXNVCtrl.so
+
LIBXNVCTRL_PROGRAM_NAME = "libXNVCtrl"
LIBXNVCTRL_VERSION := $(NVIDIA_VERSION)
@@ -62,6 +64,12 @@
$(LIBXNVCTRL) : $(OBJS)
$(AR) ru $@ $(OBJS)
+$(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 $@
+
# define the rule to build each object file
$(foreach src,$(SRC),$(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src))))

View File

@ -0,0 +1,21 @@
--- 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 $@

View File

@ -43,6 +43,14 @@ let
makeFlags = [
"OUTPUTDIR=." # src/libXNVCtrl
"libXNVCtrl.a"
"libXNVCtrl.so"
];
patches = [
# Patch the Makefile to also produce a shared library.
(if lib.versionOlder nvidia_x11.settingsVersion "400" then ./libxnvctrl-build-shared-3xx.patch
else ./libxnvctrl-build-shared.patch)
];
installPhase = ''
@ -52,6 +60,7 @@ let
cp libXNVCtrl.a $out/lib
cp NVCtrl.h $out/include/NVCtrl
cp NVCtrlLib.h $out/include/NVCtrl
cp -P libXNVCtrl.so* $out/lib
'';
};
@ -138,6 +147,6 @@ stdenv.mkDerivation {
license = licenses.unfreeRedistributable;
platforms = nvidia_x11.meta.platforms;
mainProgram = "nvidia-settings";
maintainers = with maintainers; [ abbradar ];
maintainers = with maintainers; [ abbradar aidalgol ];
};
}