nixpkgs/pkgs/os-specific/linux/read-edid/default.nix
Sergei Trofimovich 6b75fe0638 read-edid: fix build on -fno-common toolchains
Without the change build fails on toolchains like clang-13 which
switch to -fno-common by default:

    $ nix build -L --impure --expr 'with import ./. {}; read-edid.override { stdenv = clang13Stdenv; }'
    ...
    read-edid> ld: CMakeFiles/get-edid.dir/classic.c.o:(.bss+0x0):
      multiple definition of `quiet'; CMakeFiles/get-edid.dir/get-edid.c.o:(.bss+0x0): first defined here
    read-edid> ld: CMakeFiles/get-edid.dir/i2c.c.o:(.bss+0x0):
      multiple definition of `quiet'; CMakeFiles/get-edid.dir/get-edid.c.o:(.bss+0x0): first defined here
2022-05-06 08:48:10 +01:00

32 lines
941 B
Nix

{ stdenv, lib, fetchurl, cmake, libx86 }:
stdenv.mkDerivation rec {
pname = "read-edid";
version = "3.0.2";
src = fetchurl {
url = "http://www.polypux.org/projects/read-edid/${pname}-${version}.tar.gz";
sha256 = "0vqqmwsgh2gchw7qmpqk6idgzcm5rqf2fab84y7gk42v1x2diin7";
};
patches = [ ./fno-common.patch ];
postPatch = ''
substituteInPlace CMakeLists.txt --replace 'COPYING' 'LICENSE'
'';
nativeBuildInputs = [ cmake ];
buildInputs = lib.optional stdenv.hostPlatform.isx86 libx86;
cmakeFlags = [ "-DCLASSICBUILD=${if stdenv.hostPlatform.isx86 then "ON" else "OFF"}" ];
meta = with lib; {
description = "Tool for reading and parsing EDID data from monitors";
homepage = "http://www.polypux.org/projects/read-edid/";
license = licenses.bsd2; # Quoted: "This is an unofficial license. Let's call it BSD-like."
maintainers = [ maintainers.dezgeg ];
platforms = platforms.linux;
};
}