From c26e7f9aac4a12bc206d4461efd228697e1dd3a7 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Wed, 22 Apr 2020 12:43:20 +0200 Subject: [PATCH 1/2] open-watcom-bin: init at 1.9 This is a derivation for the binary distribution of the Open Watcom C/C++ compiler. --- .../compilers/open-watcom-bin/default.nix | 67 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 69 insertions(+) create mode 100644 pkgs/development/compilers/open-watcom-bin/default.nix diff --git a/pkgs/development/compilers/open-watcom-bin/default.nix b/pkgs/development/compilers/open-watcom-bin/default.nix new file mode 100644 index 00000000000..0cd80b6e1df --- /dev/null +++ b/pkgs/development/compilers/open-watcom-bin/default.nix @@ -0,0 +1,67 @@ +{ stdenvNoCC, fetchurl, qemu, expect, writeScript, ncurses }: + +let + + # We execute the installer in qemu-user, because otherwise the + # installer fails to open itself due to a failed stat() call. This + # seems like an incompatibility of new Linux kernels to run this + # ancient binary. + performInstall = writeScript "perform-ow-install" '' + #!${expect}/bin/expect -f + + spawn env TERMINFO=${ncurses}/share/terminfo TERM=vt100 ${qemu}/bin/qemu-i386 [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 = "open-watcom-bin"; + version = "1.9"; + + src = fetchurl { + url = "http://ftp.openwatcom.org/install/open-watcom-c-linux-${version}"; + sha256 = "1wzkvc6ija0cjj5mcyjng5b7hnnc5axidz030c0jh05pgvi4nj7p"; + }; + + dontUnpack = true; + dontBuild = true; + dontConfigure = true; + + installPhase = '' + cp ${src} install-bin + chmod +x install-bin + + ${performInstall} install-bin + ''; + + meta = with stdenvNoCC.lib; { + description = "A C/C++ Compiler (binary distribution)"; + homepage = "http://www.openwatcom.org/"; + license = licenses.watcom; + platforms = [ "x86_64-linux" "i686-linux" ]; + maintainers = [ maintainers.blitz ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f182b6d250c..16962f5996f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8996,6 +8996,8 @@ in inherit (ocaml-ng.ocamlPackages_4_05) ocaml; }; + open-watcom-bin = callPackage ../development/compilers/open-watcom-bin { }; + pforth = callPackage ../development/compilers/pforth {}; picat = callPackage ../development/compilers/picat { }; From 7c995a453220b0269ffd844344982fcc195212ef Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Wed, 22 Apr 2020 13:13:59 +0200 Subject: [PATCH 2/2] virtualbox: build BIOS from C instead of alternative sources VirtualBox ships with "alternative BIOS sources" for its virtual BIOS. These are generated by first compiling the BIOS C sources with the Open Watcom toolchain, disassembling the output and checking in the disassembly into the VirtualBox repo. The result means that the BIOS C code cannot be patched, because it's not compiled from the C sources, if Open Watcom is not there. As Open Watcom is now available in nixpkgs, we can just ignore the alternative BIOS sources and compile it from C directly. --- pkgs/applications/virtualization/virtualbox/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix index df7b81a43c8..7b7929d9f1d 100644 --- a/pkgs/applications/virtualization/virtualbox/default.nix +++ b/pkgs/applications/virtualization/virtualbox/default.nix @@ -3,6 +3,9 @@ , libpng, glib, lvm2, libXrandr, libXinerama, libopus, qtbase, qtx11extras , qttools, qtsvg, qtwayland, pkgconfig, which, docbook_xsl, docbook_xml_dtd_43 , alsaLib, curl, libvpx, nettools, dbus, substituteAll, fetchpatch +# If open-watcom-bin is not passed, VirtualBox will fall back to use +# the shipped alternative sources (assembly). +, open-watcom-bin ? null , makeself, perl , javaBindings ? true, jdk ? null # Almost doesn't affect closure size , pythonBindings ? false, python3 ? null @@ -148,6 +151,7 @@ in stdenv.mkDerivation { ${optionalString (!pulseSupport) "--disable-pulse"} \ ${optionalString (!enableHardening) "--disable-hardening"} \ ${optionalString (!enable32bitGuests) "--disable-vmmraw"} \ + ${optionalString (open-watcom-bin != null) "--with-ow-dir=${open-watcom-bin}"} \ --disable-kmods sed -e 's@PKG_CONFIG_PATH=.*@PKG_CONFIG_PATH=${libIDL}/lib/pkgconfig:${glib.dev}/lib/pkgconfig ${libIDL}/bin/libIDL-config-2@' \ -i AutoConfig.kmk