diff options
Diffstat (limited to 'pkgs/development/compilers/open-watcom')
-rw-r--r-- | pkgs/development/compilers/open-watcom/bin.nix | 125 | ||||
-rw-r--r-- | pkgs/development/compilers/open-watcom/v2.nix | 132 | ||||
-rw-r--r-- | pkgs/development/compilers/open-watcom/wrapper.nix | 143 |
3 files changed, 0 insertions, 400 deletions
diff --git a/pkgs/development/compilers/open-watcom/bin.nix b/pkgs/development/compilers/open-watcom/bin.nix deleted file mode 100644 index 1f8079908999..000000000000 --- a/pkgs/development/compilers/open-watcom/bin.nix +++ /dev/null @@ -1,125 +0,0 @@ -{ lib, stdenvNoCC, fetchurl, qemu, expect, writeScript, writeScriptBin, ncurses, bash, coreutils }: - -let - - # We execute all OpenWatcom binaries in qemu-user, because otherwise - # some binaries (most notably the installer itself and wlib) fail to - # use the stat() systemcall. The failure mode is that it returns - # EOVERFLOW for completely legitimate requests. This seems like an - # incompatibility of new Linux kernels to run this ancient binary. - wrapLegacyBinary = writeScript "wrapLegacyBinary" '' - #!${bash}/bin/bash - - set -eu - - if [ $# -ne 2 ]; then - echo "Usage: $0 unwrapped-binary wrapped-binary" - exit 1 - fi - - IN="$(${coreutils}/bin/realpath $1)" - OUT="$2" - ARGV0="$(basename $2)" - - cat > "$OUT" <<EOF - #!${bash}/bin/bash - - TERMINFO=${ncurses}/share/terminfo TERM=vt100 exec ${qemu}/bin/qemu-i386 -0 $ARGV0 $IN "\$@" - EOF - - chmod +x "$OUT" - ''; - - wrapInPlace = writeScriptBin "wrapInPlace" '' - #!${bash}/bin/bash - - set -eu - - if [ $# -ne 1 ]; then - echo "Usage: $0 unwrapped-binary" - exit 1 - fi - - TARGET="$1" - - mv "$TARGET" "$TARGET-unwrapped" - chmod +x "$TARGET-unwrapped" - - exec ${wrapLegacyBinary} "$TARGET-unwrapped" "$TARGET" - ''; - - # Do a scripted installation of OpenWatcom with its original installer. - # - # If maintaining this expect script turns out to be too much of a - # hassle, we can switch to just using `unzip' on the installer and - # the correct file permissions manually. - performInstall = writeScriptBin "performInstall" '' - #!${expect}/bin/expect -f - - spawn [lindex $argv 0] - - # Wait for button saying "I agree" with escape sequences. - expect "gree" - - # Navigate to "I Agree!" and hit enter. - send "\t\t\n" - - expect "Install Open Watcom" - - # Where do we want to install to. - send "$env(out)\n" - - expect "will be installed" - - # Select Full Installation, Next - send "fn" - - expect "Setup will now copy" - - # Next - send "n" - - expect "completed successfully" - send "\n" - ''; - -in -stdenvNoCC.mkDerivation rec { - pname = "${passthru.prettyName}-unwrapped"; - version = "1.9"; - - src = fetchurl { - url = "http://ftp.openwatcom.org/install/open-watcom-c-linux-${version}"; - sha256 = "1wzkvc6ija0cjj5mcyjng5b7hnnc5axidz030c0jh05pgvi4nj7p"; - }; - - nativeBuildInputs = [ wrapInPlace performInstall ]; - - dontUnpack = true; - dontConfigure = true; - - buildPhase = '' - cp ${src} install-bin-unwrapped - wrapInPlace install-bin-unwrapped - ''; - - installPhase = '' - performInstall ./install-bin-unwrapped - - for e in $(find $out/binl -type f -executable); do - echo "Wrapping $e" - wrapInPlace "$e" - done - ''; - - passthru.prettyName = "open-watcom-bin"; - - meta = with lib; { - description = "Project to maintain and enhance the Watcom C, C++, and Fortran cross compilers and tools"; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - homepage = "http://www.openwatcom.org/"; - license = licenses.watcom; - platforms = [ "x86_64-linux" "i686-linux" ]; - maintainers = [ maintainers.blitz ]; - }; -} diff --git a/pkgs/development/compilers/open-watcom/v2.nix b/pkgs/development/compilers/open-watcom/v2.nix deleted file mode 100644 index ddd62872d451..000000000000 --- a/pkgs/development/compilers/open-watcom/v2.nix +++ /dev/null @@ -1,132 +0,0 @@ -{ stdenv -, lib -, fetchFromGitHub -, unstableGitUpdater -, dosbox - -# Docs cause an immense increase in build time, up to 2 additional hours -, withDocs ? false -, ghostscript -, withGUI ? false -}: - -stdenv.mkDerivation rec { - pname = "${passthru.prettyName}-unwrapped"; - # nixpkgs-update: no auto update - version = "0-unstable-2024-05-14"; - - src = fetchFromGitHub { - owner = "open-watcom"; - repo = "open-watcom-v2"; - rev = "d3733a7fca1d02ad91b58b377ecb38e1293889db"; - hash = "sha256-gDrmm7hd07lv0KhkP7Bys5qCuCCH+t/XvlftCYlCyI8="; - }; - - postPatch = '' - patchShebangs *.sh - - for dateSource in bld/wipfc/configure; do - substituteInPlace $dateSource \ - --replace '`date ' '`date -ud "@$SOURCE_DATE_EPOCH" ' - done - - substituteInPlace bld/watcom/h/banner.h \ - --replace '__DATE__' "\"$(date -ud "@$SOURCE_DATE_EPOCH" +'%b %d %Y')\"" \ - --replace '__TIME__' "\"$(date -ud "@$SOURCE_DATE_EPOCH" +'%T')\"" - - substituteInPlace build/makeinit \ - --replace '$+$(%__CYEAR__)$-' "$(date -ud "@$SOURCE_DATE_EPOCH" +'%Y')" - '' + lib.optionalString (!stdenv.hostPlatform.isDarwin) '' - substituteInPlace build/mif/local.mif \ - --replace '-static' "" - ''; - - nativeBuildInputs = [ - dosbox - ] ++ lib.optionals withDocs [ - ghostscript - ]; - - configurePhase = '' - runHook preConfigure - - export OWROOT=$(realpath $PWD) - export OWTOOLS=${if stdenv.cc.isClang then "CLANG" else "GCC"} - export OWDOCBUILD=${if withDocs then "1" else "0"} - export OWGHOSTSCRIPTPATH=${lib.optionalString withDocs "${ghostscript}/bin"} - export OWGUINOBUILD=${if withGUI then "0" else "1"} - export OWNOBUILD= - export OWDISTRBUILD=0 - export OWDOSBOX=${dosbox}/bin/dosbox - export OWVERBOSE=0 - export OWRELROOT=$out - - source cmnvars.sh - - runHook postConfigure - ''; - - buildPhase = '' - runHook preBuild - - ./build.sh build - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - ./build.sh cprel - - runHook postInstall - ''; - - # Stripping breaks many tools - dontStrip = true; - - passthru = { - prettyName = "open-watcom-v2"; - updateScript = unstableGitUpdater { - url = "https://github.com/open-watcom/open-watcom-v2.git"; - # no numerical releases, monthly "YYYY-MM-DD-Build" tags and daily "Current-build", "Last-CI-build" & "Coverity-scan" retagging - hardcodeZeroVersion = true; - }; - }; - - meta = with lib; { - 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 - targeting a multitude of architectures (x86, IA-32, Alpha AXP, MIPS, - PowerPC) and operating systems (DOS, OS/2, Windows, Linux). - - Main differences from Open Watcom 1.9: - - - New two-phase build system - Open Watcom can be built by the host's - native C/C++ compiler or by itself - - Code generator properly initializes pointers by DLL symbol addresses - - DOS tools now support long file names (LFN) if appropriate LFN driver - is loaded by DOS - - Open Watcom is ported to 64-bit hosts (Win64, Linux x64) - - Librarian supports x64 CPU object modules and libraries - - RDOS 32-bit C run-time compact memory model libraries are fixed - - Resource compiler and Resource editors support Win64 executables - - Open Watcom text editor is now self-contained, it can be used as - standalone tool without any requirements for any additional files or - configuration - - Broken C++ compiler pre-compiled header template support is fixed - - Many C++ compiler crashes are fixed - - Debugger has no length limit for any used environment variable - '' + lib.optionalString (!withDocs) '' - - The documentation has been excluded from this build for build time reasons. It can be found here: - 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 ++ [ "powerpc64-linux" "powerpc64le-linux" "mips64el-linux" ]; - maintainers = with maintainers; [ OPNA2608 ]; - }; -} diff --git a/pkgs/development/compilers/open-watcom/wrapper.nix b/pkgs/development/compilers/open-watcom/wrapper.nix deleted file mode 100644 index 95752b2c2fe4..000000000000 --- a/pkgs/development/compilers/open-watcom/wrapper.nix +++ /dev/null @@ -1,143 +0,0 @@ -# Arguments that this derivation gets when it is created with `callPackage` -{ stdenv -, lib -, symlinkJoin -, makeWrapper -, runCommand -, file -}: - -open-watcom: - -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 "${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 "${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" - ] - ++ lib.optional isWindows "h/nt" - ++ lib.optional isLinux "lh"; - listToDirs = list: lib.strings.concatMapStringsSep ":" (dir: "${placeholder "out"}/${dir}") list; - name = "${open-watcom.passthru.prettyName}-${open-watcom.version}"; - in - symlinkJoin { - inherit name; - - paths = [ open-watcom ]; - - nativeBuildInputs = [ makeWrapper ]; - - postBuild = '' - mkdir $out/bin - - for binDir in ${lib.strings.concatStringsSep " " binDirs}; do - for exe in $(find ${open-watcom}/$binDir \ - -type f -executable \ - ${lib.optionalString stdenv.hostPlatform.isLinux "-not -iname '*.so' -not -iname '*.exe'"} \ - ); do - if [ ! -f $out/bin/$(basename $exe) ]; then - makeWrapper $exe $out/bin/$(basename $exe) \ - --set WATCOM ${open-watcom} \ - --prefix PATH : ${listToDirs binDirs} \ - --set EDPATH ${open-watcom}/eddat \ - --set INCLUDE ${listToDirs includeDirs} - fi - done - done - ''; - - passthru = { - unwrapped = open-watcom; - tests = let - wrapped = wrapper { }; - in { - simple = runCommand "${name}-test-simple" { nativeBuildInputs = [ wrapped ]; } '' - cat <<EOF >test.c - #include <stdio.h> - int main() { - printf ("Testing OpenWatcom C89 compiler.\n"); - return 0; - } - EOF - cat test.c - wcl386 -fe=test_c 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> - #include <iostream> - int main() { - std::cout << "Testing OpenWatcom C++ library implementation." << std::endl; - watcom::istring HELLO ("HELLO"); - if (HELLO != "hello") { - return 1; - } - if (HELLO.find ("ello") != 1) { - return 2; - } - return 0; - } - EOF - cat test.cpp - wcl386 -fe=test_cpp 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 ]; } '' - cat <<EOF >test.c - #include <stdio.h> - int main() { - printf ("Testing OpenWatcom cross-compilation.\n"); - return 0; - } - EOF - cat test.c - - echo "Test compiling" - wcl386 -bcl=linux -fe=linux test.c - wcl386 -bcl=nt -fe=nt test.c - wcl386 -bcl=dos4g -fe=dos4g test.c - wcl -bcl=windows -fe=windows test.c - wcl -bcl=dos -fe=dos test.c - - echo "Test file format" - file ./linux | grep "32-bit" | grep "Linux" - file ./nt.exe | grep "PE32" | grep "Windows" - file ./dos4g.exe | grep "MS-DOS" | grep "LE executable" - file ./windows.exe | grep "MS-DOS" | grep "Windows 3.x" - file ./dos.exe | grep "MS-DOS" | grep -v "LE" | grep -v "Windows 3.x" - touch $out - ''; - }; - }; - - inherit (open-watcom) meta; - }; -in -lib.makeOverridable wrapper |