traefik: add djds as maintainer (#377217)
[NixPkgs.git] / pkgs / development / compilers / open-watcom / v2.nix
blobf518605539f0bc967bb2bd2ff500a79dc346382b
2   stdenv,
3   lib,
4   fetchFromGitHub,
5   unstableGitUpdater,
6   dosbox,
8   # Docs cause an immense increase in build time, up to 2 additional hours
9   withDocs ? false,
10   ghostscript,
11   withGUI ? false,
14 stdenv.mkDerivation rec {
15   pname = "${passthru.prettyName}-unwrapped";
16   # nixpkgs-update: no auto update
17   version = "0-unstable-2024-10-13";
19   src = fetchFromGitHub {
20     owner = "open-watcom";
21     repo = "open-watcom-v2";
22     rev = "f0a6465832643ba08b7f94fb814c552804fb395b";
23     hash = "sha256-rT3z0KrkCZ78SbsK2CEHfvJa1TEnRH2kwhzZhi8fZDo=";
24   };
26   postPatch =
27     ''
28       patchShebangs *.sh
30       for dateSource in bld/wipfc/configure; do
31         substituteInPlace $dateSource \
32           --replace '`date ' '`date -ud "@$SOURCE_DATE_EPOCH" '
33       done
35       substituteInPlace bld/watcom/h/banner.h \
36         --replace '__DATE__' "\"$(date -ud "@$SOURCE_DATE_EPOCH" +'%b %d %Y')\"" \
37         --replace '__TIME__' "\"$(date -ud "@$SOURCE_DATE_EPOCH" +'%T')\""
39       substituteInPlace build/makeinit \
40         --replace '$+$(%__CYEAR__)$-' "$(date -ud "@$SOURCE_DATE_EPOCH" +'%Y')"
41     ''
42     + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
43       substituteInPlace build/mif/local.mif \
44         --replace '-static' ""
45     '';
47   nativeBuildInputs =
48     [
49       dosbox
50     ]
51     ++ lib.optionals withDocs [
52       ghostscript
53     ];
55   configurePhase = ''
56     runHook preConfigure
58     export OWROOT=$(realpath $PWD)
59     export OWTOOLS=${if stdenv.cc.isClang then "CLANG" else "GCC"}
60     export OWDOCBUILD=${if withDocs then "1" else "0"}
61     export OWGHOSTSCRIPTPATH=${lib.optionalString withDocs "${ghostscript}/bin"}
62     export OWGUINOBUILD=${if withGUI then "0" else "1"}
63     export OWNOBUILD=
64     export OWDISTRBUILD=0
65     export OWDOSBOX=${dosbox}/bin/dosbox
66     export OWVERBOSE=0
67     export OWRELROOT=$out
69     source cmnvars.sh
71     runHook postConfigure
72   '';
74   buildPhase = ''
75     runHook preBuild
77     ./build.sh build
79     runHook postBuild
80   '';
82   installPhase = ''
83     runHook preInstall
85     ./build.sh cprel
87     runHook postInstall
88   '';
90   # Stripping breaks many tools
91   dontStrip = true;
93   passthru = {
94     prettyName = "open-watcom-v2";
95     updateScript = unstableGitUpdater {
96       url = "https://github.com/open-watcom/open-watcom-v2.git";
97       # no numerical releases, monthly "YYYY-MM-DD-Build" tags and daily "Current-build", "Last-CI-build" & "Coverity-scan" retagging
98       hardcodeZeroVersion = true;
99     };
100   };
102   meta = with lib; {
103     description = "V2 fork of the Open Watcom suite of compilers and tools";
104     longDescription =
105       ''
106         A fork of Open Watcom: A C/C++/Fortran compiler and assembler suite
107         targeting a multitude of architectures (x86, IA-32, Alpha AXP, MIPS,
108         PowerPC) and operating systems (DOS, OS/2, Windows, Linux).
110         Main differences from Open Watcom 1.9:
112         - New two-phase build system - Open Watcom can be built by the host's
113           native C/C++ compiler or by itself
114         - Code generator properly initializes pointers by DLL symbol addresses
115         - DOS tools now support long file names (LFN) if appropriate LFN driver
116           is loaded by DOS
117         - Open Watcom is ported to 64-bit hosts (Win64, Linux x64)
118         - Librarian supports x64 CPU object modules and libraries
119         - RDOS 32-bit C run-time compact memory model libraries are fixed
120         - Resource compiler and Resource editors support Win64 executables
121         - Open Watcom text editor is now self-contained, it can be used as
122           standalone tool without any requirements for any additional files or
123           configuration
124         - Broken C++ compiler pre-compiled header template support is fixed
125         - Many C++ compiler crashes are fixed
126         - Debugger has no length limit for any used environment variable
127       ''
128       + lib.optionalString (!withDocs) ''
130         The documentation has been excluded from this build for build time reasons. It can be found here:
131         https://github.com/open-watcom/open-watcom-v2/wiki/Open-Watcom-Documentation
132       '';
133     homepage = "https://open-watcom.github.io";
134     license = licenses.watcom;
135     platforms = with platforms; windows ++ unix;
136     badPlatforms = platforms.riscv ++ [
137       "powerpc64-linux"
138       "powerpc64le-linux"
139       "mips64el-linux"
140     ];
141     maintainers = with maintainers; [ OPNA2608 ];
142   };