Skip to content

Commit 09b22eb

Browse files
authored
i810switch: fix build on gcc-14 & modernize (#384245)
2 parents 2f93467 + 39a2802 commit 09b22eb

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

pkgs/by-name/i8/i810switch/package.nix

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,49 @@
22
lib,
33
stdenv,
44
fetchurl,
5+
installShellFiles,
56
pciutils,
67
}:
78

8-
stdenv.mkDerivation {
9+
stdenv.mkDerivation (finalAttrs: {
910
pname = "i810switch";
1011
version = "0.6.5";
1112

12-
installPhase = "
13-
sed -i -e 's+/usr++' Makefile
14-
sed -i -e 's+^\\(.*putenv(\"PATH=\\).*$+\\1${pciutils}/sbin\");+' i810switch.c
13+
src = fetchurl {
14+
url = "http://www16.plala.or.jp/mano-a-mano/i810switch/i810switch-${finalAttrs.version}.tar.gz";
15+
hash = "sha256-1xSEDjsU4fqcQyxL4ARLfACNkE3s4NYRVUZVuXnK1MM=";
16+
};
17+
18+
nativeBuildInputs = [ installShellFiles ];
19+
20+
preBuild = ''
1521
make clean
16-
make install DESTDIR=\${out}
22+
23+
substituteInPlace i810switch.c \
24+
--replace-fail 'define CMD_LSPCI "lspci"' 'define CMD_LSPCI "${lib.getExe' pciutils "lspci"}"'
25+
'';
26+
27+
installPhase = "
28+
runHook preInstall
29+
30+
install -Dm755 -t $out/bin i810switch i810rotate
31+
32+
installManPage i810switch.1.gz i810rotate.1.gz
33+
34+
runHook postInstall
1735
";
1836

19-
src = fetchurl {
20-
url = "http://www16.plala.or.jp/mano-a-mano/i810switch/i810switch-0.6.5.tar.gz";
21-
sha256 = "d714840e3b14e1fa9c432c4be0044b7c008d904dece0d611554655b979cad4c3";
22-
};
37+
# Ignore errors since gcc-14.
38+
# i810switch.c:251:34: error: passing argument 2 of 'getline' from incompatible pointer type [-Wincompatible-pointer-types]
39+
# i810switch.c:296:34: error: passing argument 2 of 'getline' from incompatible pointer type [-Wincompatible-pointer-types]
40+
env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
2341

24-
meta = with lib; {
42+
meta = {
2543
description = "Utility for switching between the LCD and external VGA display on Intel graphics cards";
2644
homepage = "http://www16.plala.or.jp/mano-a-mano/i810switch.html";
2745
maintainers = [ ];
28-
license = licenses.gpl2Only;
29-
platforms = platforms.linux;
46+
license = lib.licenses.gpl2Only;
47+
platforms = lib.platforms.linux;
48+
mainProgram = "i810switch";
3049
};
31-
}
50+
})

0 commit comments

Comments
 (0)