Unverified Commit 4d77b915 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #203943 from OPNA2608/update/open-watcom-v2

parents 600adcfd a6ae9718
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -13,19 +13,19 @@
stdenv.mkDerivation rec {
  pname = "${passthru.prettyName}-unwrapped";
  # nixpkgs-update: no auto update
  version = "unstable-2022-10-03";
  version = "unstable-2023-01-30";

  src = fetchFromGitHub {
    owner = "open-watcom";
    repo = "open-watcom-v2";
    rev = "61538429a501a09f369366d832799f2e3b196a02";
    sha256 = "sha256-YvqRw0klSqOxIuO5QFKjcUp6aRWlO2j3L+T1ekx8SfA=";
    rev = "996740acdbb173499ec1bf2ba6c8942f2a374220";
    sha256 = "sha256-9m+0e2v1Hk8jYZHqJwb1mN02WgGDArsWbF7Ut3Z5OIg=";
  };

  postPatch = ''
    patchShebangs *.sh

    for dateSource in cmnvars.sh bld/wipfc/configure; do
    for dateSource in bld/wipfc/configure; do
      substituteInPlace $dateSource \
        --replace '`date ' '`date -ud "@$SOURCE_DATE_EPOCH" '
    done
@@ -35,14 +35,17 @@ stdenv.mkDerivation rec {
      --replace '__TIME__' "\"$(date -ud "@$SOURCE_DATE_EPOCH" +'%T')\""

    substituteInPlace build/makeinit \
      --replace '%__CYEAR__' '%OWCYEAR'
      --replace '$+$(%__CYEAR__)$-' "$(date -ud "@$SOURCE_DATE_EPOCH" +'%Y')"
  '' + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
    substituteInPlace build/mif/local.mif \
      --replace '-static' ""
  '';

  nativeBuildInputs = [ dosbox ]
    ++ lib.optional withDocs ghostscript;
  nativeBuildInputs = [
    dosbox
  ] ++ lib.optionals withDocs [
    ghostscript
  ];

  configurePhase = ''
    runHook preConfigure
@@ -120,7 +123,8 @@ stdenv.mkDerivation rec {
    '';
    homepage = "https://open-watcom.github.io";
    license = licenses.watcom;
    platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "x86_64-windows" "i686-windows" ];
    platforms = with platforms; windows ++ unix;
    badPlatforms = platforms.riscv ++ [ "powerpc64-linux" "powerpc64le-linux" "mips64el-linux" ];
    maintainers = with maintainers; [ OPNA2608 ];
  };
}
+24 −11
Original line number Diff line number Diff line
@@ -13,16 +13,29 @@ let
  wrapper =
    {}:
    let
      archToBindir = with stdenv.hostPlatform; if isx86 then
        "bin"
      else if isAarch then
        "arm"
      # we don't support running on AXP
      # don't know what MIPS, PPC bindirs are called
      else throw "Don't know where ${system} binaries are located!";

      binDirs = with stdenv.hostPlatform; if isWindows then [
        (lib.optionalString is64bit "binnt64")
        "binnt"
        (lib.optionalString is32bit "binw")
      ] else if (isDarwin && is64bit) then [
        "bino64"
        (lib.optionalString is64bit "${archToBindir}nt64")
        "${archToBindir}nt"
        (lib.optionalString is32bit "${archToBindir}w")
      ] else if (isDarwin) then [
        (lib.optionalString is64bit "${archToBindir}o64")
        # modern Darwin cannot execute 32-bit code anymore
        (lib.optionalString is32bit "${archToBindir}o")
      ] else [
        (lib.optionalString is64bit "binl64")
        "binl"
        (lib.optionalString is64bit "${archToBindir}l64")
        "${archToBindir}l"
      ];
      # TODO
      # This works good enough as-is, but should really only be targetPlatform-specific
      # but we don't support targeting DOS, OS/2, 16-bit Windows etc Nixpkgs-wide so this needs extra logic
      includeDirs = with stdenv.hostPlatform; [
        "h"
      ]
@@ -71,9 +84,9 @@ let
            }
            EOF
            cat test.c
            # Darwin target not supported, only host
            wcl386 -fe=test_c test.c
            ${lib.optionalString (!stdenv.hostPlatform.isDarwin) "./test_c"}
            # Only test execution if hostPlatform is targetable
            ${lib.optionalString (!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isAarch) "./test_c"}

            cat <<EOF >test.cpp
            #include <string>
@@ -91,9 +104,9 @@ let
            }
            EOF
            cat test.cpp
            # Darwin target not supported, only host
            wcl386 -fe=test_cpp test.cpp
            ${lib.optionalString (!stdenv.hostPlatform.isDarwin) "./test_cpp"}
            # Only test execution if hostPlatform is targetable
            ${lib.optionalString (!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isAarch) "./test_cpp"}
            touch $out
          '';
          cross = runCommand "${name}-test-cross" { nativeBuildInputs = [ wrapped file ]; } ''