From 495569a6bf40b33c88f15bd2dac8f72e2febf509 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 15 Nov 2025 19:16:38 +0100 Subject: [PATCH] open-watcom-v2-unwrapped: Do abit of housekeeping - rec -> finalAttrs - Drop meta-wide with lib - GUI tool building can default to stdenv.hostPlatform.isWindows, prolly closer to correct than defaulting to false - substituteInPlace accepts multiple files, for loop not necessary - Just to be safe, reject non-GNU & non-Clang compilers. Who knows what Watcom needs to build on those... - Use lib functions for path-related stuff (makeBinPath, getExe) (cherry picked from commit 13b7a967c8935fdb019911f563f62197bb1f2ee9) --- pkgs/development/compilers/open-watcom/v2.nix | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/pkgs/development/compilers/open-watcom/v2.nix b/pkgs/development/compilers/open-watcom/v2.nix index ea2dd7b091b8..17b426340bd7 100644 --- a/pkgs/development/compilers/open-watcom/v2.nix +++ b/pkgs/development/compilers/open-watcom/v2.nix @@ -8,11 +8,13 @@ # Docs cause an immense increase in build time, up to 2 additional hours withDocs ? false, 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-11-15"; @@ -26,10 +28,8 @@ stdenv.mkDerivation rec { postPatch = '' patchShebangs *.sh - for dateSource in bld/wipfc/configure; do - substituteInPlace $dateSource \ - --replace-fail '`date ' '`date -ud "@$SOURCE_DATE_EPOCH" ' - done + substituteInPlace bld/wipfc/configure \ + --replace-fail '`date ' '`date -ud "@$SOURCE_DATE_EPOCH" ' substituteInPlace bld/watcom/h/banner.h \ --replace-fail '__DATE__' "\"$(date -ud "@$SOURCE_DATE_EPOCH" +'%b %d %Y')\"" \ @@ -54,13 +54,20 @@ stdenv.mkDerivation rec { 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 +104,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 +135,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 ]; }; -} +})