Unverified Commit c4826155 authored by Artemis Tosini's avatar Artemis Tosini
Browse files

openbsd.mkDerivation: Set proper MACHINE variables

OpenBSD values for MACHINE/MACHINE_ARCH/MACHINE_CPU are slightly
different than other BSDs. While fixing these, also set
TARGET_ARCH/TARGET_CPU, needed by a small number of yet-to-be-packaged
programs.
parent d957d402
Loading
Loading
Loading
Loading
+23 −14
Original line number Diff line number Diff line
@@ -27,6 +27,25 @@ lib.makeOverridable (
        stdenvLibcMinimal
      else
        stdenv;

    machineMap = {
      aarch64 = "arm64";
      armv7l = "armv7";
      i486 = "i386";
      i586 = "i386";
      i686 = "i386";
      x86_64 = "amd64";
    };

    archMap = {
      aarch64 = "aarch64";
      armv7l = "arm";
      i486 = "i386";
      i586 = "i386";
      i686 = "i386";
      x86_64 = "amd64";
    };

  in
  stdenv'.mkDerivation (
    rec {
@@ -57,22 +76,12 @@ lib.makeOverridable (

      HOST_SH = stdenv'.shell;

      MACHINE_ARCH =
        {
          # amd64 not x86_64 for this on unlike NetBSD
          x86_64 = "amd64";
          aarch64 = "arm64";
          i486 = "i386";
          i586 = "i386";
          i686 = "i386";
        }
        .${stdenv'.hostPlatform.parsed.cpu.name} or stdenv'.hostPlatform.parsed.cpu.name;

      MACHINE = MACHINE_ARCH;

      MACHINE = machineMap.${stdenv'.hostPlatform.parsed.cpu.name};
      MACHINE_ARCH = archMap.${stdenv'.hostPlatform.parsed.cpu.name};
      MACHINE_CPU = MACHINE_ARCH;

      MACHINE_CPUARCH = MACHINE_ARCH;
      TARGET_MACHINE_ARCH = archMap.${stdenv'.targetPlatform.parsed.cpu.name};
      TARGET_MACHINE_CPU = TARGET_MACHINE_ARCH;

      COMPONENT_PATH = attrs.path or null;