Unverified Commit 3136c4a5 authored by Jörg Thalheim's avatar Jörg Thalheim Committed by GitHub
Browse files

hwinfo: use more up-to-date pci.ids / usb.ids (#339225)

parents 06cd2817 d686ba03
Loading
Loading
Loading
Loading
+30 −3
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
  runCommand,
  validatePkgConfig,
  gitUpdater,
  buildPackages,
  perlPackages,
}:

stdenv.mkDerivation (finalAttrs: {
@@ -30,15 +32,21 @@ stdenv.mkDerivation (finalAttrs: {
  nativeBuildInputs = [
    flex
    validatePkgConfig
    perl
    perlPackages.XMLWriter
    perlPackages.XMLParser
  ];
  depsBuildBuild = [ buildPackages.stdenv.cc ];

  buildInputs = [
    libuuid
    libx86emu
    perl
  ];

  postPatch = ''
    # used by the build system
    echo ${finalAttrs.version} > VERSION

    # Replace /usr paths with Nix store paths
    substituteInPlace Makefile \
      --replace-fail "/sbin" "/bin" \
@@ -56,13 +64,32 @@ stdenv.mkDerivation (finalAttrs: {
      --replace-fail "/sbin/rmmod" "${kmod}/bin/rmmod" \
      --replace-fail "/usr/bin/udevinfo" "${systemdMinimal}/bin/udevinfo" \
      --replace-fail "/usr/bin/udevadm" "${systemdMinimal}/bin/udevadm"

  '';

  # The pci/usb ids in hwinfo are ancient. We can get a more up-to-date list simply by copying from systemd
  preBuild = ''
    # since we don't have .git, we cannot run this.
    rm git2log
    pushd src/ids
    cp ${systemdMinimal.src}/hwdb.d/pci.ids src/pci
    cp ${systemdMinimal.src}/hwdb.d/usb.ids src/usb
    # taken from https://github.com/openSUSE/hwinfo/blob/c87f449f1d4882c71b0a1e6dc80638224a5baeed/src/ids/update_pci_usb
    perl -pi -e 'undef $_ if /^C\s/..1' src/usb
    perl ./convert_hd src/pci
    perl ./convert_hd src/usb
    popd

    # build tools for build arch
    make -C src/ids CC=$CC_FOR_BUILD -j $NIX_BUILD_CORES check_hd
    make -C src/isdn/cdb CC=$CC_FOR_BUILD -j $NIX_BUILD_CORES isdn_cdb mk_isdnhwdb
  '';

  makeFlags = [
    "LIBDIR=/lib"
    "HWINFO_VERSION=${finalAttrs.version}"
    "CC=${stdenv.cc.targetPrefix}cc"
    "ARCH=${stdenv.hostPlatform.uname.processor}"
  ];

  installFlags = [ "DESTDIR=$(out)" ];

  passthru = {
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
    substituteInPlace Makefile --replace "/usr" "/"
  '';

  buildFlags = [ "shared" ];
  buildFlags = [ "shared" "CC=${stdenv.cc.targetPrefix}cc" ];
  enableParallelBuilding = true;

  installFlags = [ "DESTDIR=$(out)" "LIBDIR=/lib" ];