Merge pull request #285313 from drupol/displaylink/refactor

displaylink, evdi: refactor
This commit is contained in:
Pol Dellaiera 2024-02-06 06:44:39 +01:00 committed by GitHub
commit 119232480d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 18 deletions

View file

@ -4,10 +4,8 @@
, util-linux
, libusb1
, evdi
, systemd
, makeWrapper
, makeBinaryWrapper
, requireFile
, substituteAll
}:
let
@ -17,9 +15,8 @@ let
else if stdenv.hostPlatform.system == "aarch64-linux" then "aarch64-linux-gnu"
else throw "Unsupported architecture";
libPath = lib.makeLibraryPath [ stdenv.cc.cc util-linux libusb1 evdi ];
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "displaylink";
version = "5.8.0-63.33";
@ -41,15 +38,21 @@ stdenv.mkDerivation rec {
'';
};
nativeBuildInputs = [ unzip makeWrapper ];
nativeBuildInputs = [
makeBinaryWrapper
unzip
];
unpackPhase = ''
runHook preUnpack
unzip $src
chmod +x displaylink-driver-${version}.run
./displaylink-driver-${version}.run --target . --noexec --nodiskspace
chmod +x displaylink-driver-${finalAttrs.version}.run
./displaylink-driver-${finalAttrs.version}.run --target . --noexec --nodiskspace
runHook postUnpack
'';
installPhase = ''
runHook preInstall
install -Dt $out/lib/displaylink *.spkg
install -Dm755 ${bins}/DisplayLinkManager $out/bin/DisplayLinkManager
mkdir -p $out/lib/udev/rules.d $out/share
@ -63,6 +66,7 @@ stdenv.mkDerivation rec {
# We introduce a dependency on the source file so that it need not be redownloaded everytime
echo $src >> "$out/share/workspace_dependencies.pin"
runHook postInstall
'';
dontStrip = true;
@ -71,10 +75,11 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "DisplayLink DL-5xxx, DL-41xx and DL-3x00 Driver for Linux";
homepage = "https://www.displaylink.com/";
hydraPlatforms = [];
license = licenses.unfree;
mainProgram = "DisplayLinkManager";
maintainers = with maintainers; [ abbradar ];
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
hydraPlatforms = [];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
}
})

View file

@ -1,17 +1,23 @@
{ lib, stdenv, fetchFromGitHub, kernel, libdrm, python3 }:
{ lib
, stdenv
, fetchFromGitHub
, kernel
, libdrm
, python3
}:
let
python3WithLibs = python3.withPackages (ps: with ps; [
pybind11
]);
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "evdi";
version = "1.14.1-unstable-2024-01-30";
src = fetchFromGitHub {
owner = "DisplayLink";
repo = pname;
repo = "evdi";
rev = "d21a6ea3c69ba180457966a04b6545d321cf46ca";
hash = "sha256-Txa9yX9h3GfmHRRNvhrfrsUoQhqRWbBt4gJYAZTNe0w=";
};
@ -24,7 +30,11 @@ stdenv.mkDerivation rec {
nativeBuildInputs = kernel.moduleBuildDependencies;
buildInputs = [ kernel libdrm python3WithLibs ];
buildInputs = [
kernel
libdrm
python3WithLibs
];
makeFlags = kernel.makeFlags ++ [
"KVER=${kernel.modDirVersion}"
@ -34,19 +44,21 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" "pic" "fortify" ];
installPhase = ''
runHook preInstall
install -Dm755 module/evdi.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/evdi/evdi.ko
install -Dm755 library/libevdi.so $out/lib/libevdi.so
runHook postInstall
'';
enableParallelBuilding = true;
meta = with lib; {
broken = kernel.kernelOlder "4.19";
changelog = "https://github.com/DisplayLink/evdi/releases/tag/v${version}";
description = "Extensible Virtual Display Interface";
homepage = "https://www.displaylink.com/";
license = with licenses; [ lgpl21Only gpl2Only ];
maintainers = with maintainers; [ ];
platforms = platforms.linux;
license = with licenses; [ lgpl21Only gpl2Only ];
homepage = "https://www.displaylink.com/";
broken = kernel.kernelOlder "4.19";
};
}
})