1{ lib
2, stdenv
3, fetchurl
4, perl
5}:
6
7stdenv.mkDerivation rec {
8 pname = "cpuid";
9 version = "20230614";
10
11 src = fetchurl {
12 url = "http://etallen.com/cpuid/${pname}-${version}.src.tar.gz";
13 sha256 = "sha256-scgwRe/CYHYwd1HgZi1YAnf1+b+JzwJyMaeBIAPDpOg=";
14 };
15
16 # For pod2man during the build process.
17 nativeBuildInputs = [
18 perl
19 ];
20
21 # As runtime dependency for cpuinfo2cpuid.
22 buildInputs = [
23 perl
24 ];
25
26 # The Makefile hardcodes $(BUILDROOT)/usr as installation
27 # destination. Just nuke all mentions of /usr to get the right
28 # installation location.
29 patchPhase = ''
30 sed -i -e 's,/usr/,/,' Makefile
31 '';
32
33 installPhase = ''
34 make install BUILDROOT=$out
35
36 if [ ! -x $out/bin/cpuid ]; then
37 echo Failed to properly patch Makefile.
38 exit 1
39 fi
40 '';
41
42 meta = with lib; {
43 description = "Linux tool to dump x86 CPUID information about the CPU";
44 longDescription = ''
45 cpuid dumps detailed information about the CPU(s) gathered from the CPUID
46 instruction, and also determines the exact model of CPU(s). It supports
47 Intel, AMD, VIA, Hygon, and Zhaoxin CPUs, as well as older Transmeta,
48 Cyrix, UMC, NexGen, Rise, and SiS CPUs.
49 '';
50 homepage = "http://etallen.com/cpuid.html";
51 license = licenses.gpl2Plus;
52 maintainers = with maintainers; [ blitz ];
53 platforms = [ "i686-linux" "x86_64-linux" ];
54 };
55}