Unverified Commit dcab162b authored by Cosima Neidahl's avatar Cosima Neidahl Committed by GitHub
Browse files

[Backport release-25.11] open-watcom-v2-unwrapped: 0-unstable-2025-05-07 ->...

[Backport release-25.11] open-watcom-v2-unwrapped: 0-unstable-2025-05-07 -> 0-unstable-2025-11-15, housekeeping, init full variant (#465255)
parents 1bcb754f 7767c778
Loading
Loading
Loading
Loading
+39 −25
Original line number Diff line number Diff line
@@ -3,33 +3,36 @@
  lib,
  fetchFromGitHub,
  unstableGitUpdater,
  dosbox,

  # Docs cause an immense increase in build time, up to 2 additional hours
  withDocs ? false,
  dosbox,
  mesa,
  ghostscript,
  withGUI ? false,

  # GUI tools aren't ported to non-MS platforms, building them usually just wastes time
  withGUI ? stdenv.hostPlatform.isWindows,
}:

stdenv.mkDerivation rec {
  pname = "${passthru.prettyName}-unwrapped";
stdenv.mkDerivation (finalAttrs: {
  pname = "${finalAttrs.passthru.prettyName}-unwrapped";
  # nixpkgs-update: no auto update
  version = "0-unstable-2025-05-07";
  version = "0-unstable-2025-11-15";

  src = fetchFromGitHub {
    owner = "open-watcom";
    repo = "open-watcom-v2";
    rev = "b168de07a7c32ad82b77dd56671b6a51a11dab70";
    hash = "sha256-9NNJcDHxOo+NKZraGqsHqK5whO3nL0QTeh+imzhThTg=";
    rev = "fe2ddbd2e5833a85d9ccd3937b304f3f41e44f98";
    hash = "sha256-jv7d5DopGZDnVFQX/t0D9cZSTwgMvcb4kqCnLJSWmNI=";
  };

  postPatch = ''
    patchShebangs *.sh

    for dateSource in bld/wipfc/configure; do
      substituteInPlace $dateSource \
  ''
  # Patch references to current time & date into SOURCE_DATE_EPOCH-respecting ones
  + ''
    substituteInPlace bld/wipfc/configure \
      --replace-fail '`date ' '`date -ud "@$SOURCE_DATE_EPOCH" '
    done

    substituteInPlace bld/watcom/h/banner.h \
      --replace-fail '__DATE__' "\"$(date -ud "@$SOURCE_DATE_EPOCH" +'%b %d %Y')\"" \
@@ -38,29 +41,40 @@ stdenv.mkDerivation rec {
    substituteInPlace build/makeinit \
      --replace-fail '$+$(%__CYEAR__)$-' "$(date -ud "@$SOURCE_DATE_EPOCH" +'%Y')"
  ''
  # (SDL? DOSBox?) needs OpenGL now, and that doesn't seem to play nicely anymore with the dummy driver
  + ''
    substituteInPlace build/mif/wgmlcmd.mif \
      --replace-fail 'SDL_VIDEODRIVER=dummy' 'SDL_VIDEODRIVER=offscreen'
  ''
  + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
    substituteInPlace build/mif/local.mif \
      --replace-fail '-static' ""
  '';

  nativeBuildInputs = [
    dosbox
  ]
  ++ lib.optionals withDocs [
  nativeBuildInputs = lib.optionals withDocs [
    dosbox # running prebuilt WGML tool to create docs
    ghostscript
    mesa.llvmpipeHook # DOSBox doesn't seem to launch without OpenGL available, even on SDL dummy platform
  ];

  configurePhase = ''
    runHook preConfigure

    export OWROOT=$(realpath $PWD)
    export OWTOOLS=${if stdenv.cc.isClang then "CLANG" else "GCC"}
    export OWTOOLS=${
      if stdenv.cc.isClang then
        "CLANG"
      else if stdenv.cc.isGNU then
        "GCC"
      else
        throw "Don't know what compiler ID to use for ${stdenv.cc.name} in open-watcom-v2 build"
    }
    export OWDOCBUILD=${if withDocs then "1" else "0"}
    export OWGHOSTSCRIPTPATH=${lib.optionalString withDocs "${ghostscript}/bin"}
    export OWGHOSTSCRIPTPATH=${lib.optionalString withDocs "${lib.makeBinPath [ ghostscript ]}"}
    export OWGUINOBUILD=${if withGUI then "0" else "1"}
    export OWNOBUILD=
    export OWDISTRBUILD=0
    export OWDOSBOX=${dosbox}/bin/dosbox
    export OWDOSBOX=${lib.getExe dosbox}
    export OWVERBOSE=0
    export OWRELROOT=$out

@@ -97,7 +111,7 @@ stdenv.mkDerivation rec {
    };
  };

  meta = with lib; {
  meta = {
    description = "V2 fork of the Open Watcom suite of compilers and tools";
    longDescription = ''
      A fork of Open Watcom: A C/C++/Fortran compiler and assembler suite
@@ -128,13 +142,13 @@ stdenv.mkDerivation rec {
      https://github.com/open-watcom/open-watcom-v2/wiki/Open-Watcom-Documentation
    '';
    homepage = "https://open-watcom.github.io";
    license = licenses.watcom;
    platforms = with platforms; windows ++ unix;
    badPlatforms = platforms.riscv ++ [
    license = lib.licenses.watcom;
    platforms = with lib.platforms; windows ++ unix;
    badPlatforms = lib.platforms.riscv ++ [
      "powerpc64-linux"
      "powerpc64le-linux"
      "mips64el-linux"
    ];
    maintainers = with maintainers; [ OPNA2608 ];
    maintainers = with lib.maintainers; [ OPNA2608 ];
  };
}
})
+5 −5
Original line number Diff line number Diff line
@@ -151,15 +151,15 @@ let

                  echo "Test file format"
                  file ./linux
                  file ./linux | grep "32-bit" | grep -q "Linux"
                  file ./linux | grep "ELF 32-bit" | grep -q "Linux"
                  file ./nt.exe
                  file ./nt.exe | grep "PE32" | grep -q "Windows"
                  file ./nt.exe | grep "PE32 executable" | grep -q "Windows"
                  file ./dos4g.exe
                  file ./dos4g.exe | grep "MS-DOS" | grep -q "executable, LE"
                  file ./dos4g.exe | grep "MS-DOS executable" | grep -q "LE executable"
                  file ./windows.exe
                  file ./windows.exe | grep "MS-DOS" | grep -q "Windows 3.00"
                  file ./windows.exe | grep "MS-DOS executable" | grep -q "NE for MS Windows 3."
                  file ./dos.exe
                  file ./dos.exe | grep "MS-DOS" | grep -v "LE" | grep -qv "Windows 3."
                  file ./dos.exe | grep "MS-DOS executable" | grep -q "MZ for MS-DOS"
                  touch $out
                '';
          };
+8 −1
Original line number Diff line number Diff line
@@ -5195,9 +5195,16 @@ with pkgs;
  opam-installer = callPackage ../development/tools/ocaml/opam/installer.nix { };

  wrapWatcom = callPackage ../development/compilers/open-watcom/wrapper.nix { };

  open-watcom-v2-unwrapped = callPackage ../development/compilers/open-watcom/v2.nix { };
  open-watcom-v2 = wrapWatcom open-watcom-v2-unwrapped { };
  open-watcom-v2-full-unwrapped = open-watcom-v2-unwrapped.override {
    withDocs = true;
    withGUI = true;
  };
  open-watcom-bin-unwrapped = callPackage ../development/compilers/open-watcom/bin.nix { };

  open-watcom-v2 = wrapWatcom open-watcom-v2-unwrapped { };
  open-watcom-v2-full = wrapWatcom open-watcom-v2-full-unwrapped { };
  open-watcom-bin = wrapWatcom open-watcom-bin-unwrapped { };

  rml = callPackage ../development/compilers/rml {