From 90c3e1212c91a74bae73567a43a83e0e56a5b669 Mon Sep 17 00:00:00 2001 From: Adrian Pistol Date: Fri, 17 Nov 2023 00:59:58 +0100 Subject: [PATCH] hercules: 3.13 -> 4.6 --- .../emulators/hercules/default.nix | 27 ---- pkgs/by-name/he/hercules/package.nix | 153 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 - 3 files changed, 153 insertions(+), 29 deletions(-) delete mode 100644 pkgs/applications/emulators/hercules/default.nix create mode 100644 pkgs/by-name/he/hercules/package.nix diff --git a/pkgs/applications/emulators/hercules/default.nix b/pkgs/applications/emulators/hercules/default.nix deleted file mode 100644 index 67506d36b63c..000000000000 --- a/pkgs/applications/emulators/hercules/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ lib -, stdenv -, fetchurl -}: - -stdenv.mkDerivation rec { - pname = "hercules"; - version = "3.13"; - - src = fetchurl { - url = "http://downloads.hercules-390.eu/${pname}-${version}.tar.gz"; - sha256 = "0zg6rwz8ib4alibf8lygi8qn69xx8n92kbi8b3jhi1ymb32mf349"; - }; - - meta = with lib; { - homepage = "http://www.hercules-390.eu"; - description = "IBM mainframe emulator"; - longDescription = '' - Hercules is an open source software implementation of the mainframe - System/370 and ESA/390 architectures, in addition to the latest 64-bit - z/Architecture. Hercules runs under Linux, Windows, Solaris, FreeBSD, and - Mac OS X. - ''; - license = licenses.qpl; - maintainers = [ maintainers.anna328p ]; - }; -} diff --git a/pkgs/by-name/he/hercules/package.nix b/pkgs/by-name/he/hercules/package.nix new file mode 100644 index 000000000000..080d3a849beb --- /dev/null +++ b/pkgs/by-name/he/hercules/package.nix @@ -0,0 +1,153 @@ +{ lib +, stdenv +, fetchFromGitHub +, runCommand +, libtool +, cmake +, zlib +, bzip2 +, enableRexx ? stdenv.isLinux, regina +}: +let + herculesCpu = + if stdenv.hostPlatform.isx86 then "x86" + else stdenv.hostPlatform.qemuArch; + herculesBits = if stdenv.hostPlatform.is32bit then "32" else "64"; + + herculesLibDir = + if stdenv.hostPlatform.isx86 then "lib" + else "lib/${herculesCpu}"; + + mkExtPkg = depName: attrFn: (stdenv.mkDerivation { + pname = "hercules-${depName}"; + + postPatch = '' + patchShebangs build + sed -i build \ + -e "s%_tool=.*$%_tool=${cmake}/bin/cmake%" \ + -e "s/CPUS=.*$/CPUS=$NIX_BUILD_CORES/" + ''; + + dontUseCmakeConfigure = true; + + buildPhase = '' + mkdir ../build $out + # In source builds are not allowed. + cd ../build + ../source/build \ + --pkgname ${depName} \ + --cpu ${herculesCpu} \ + --arch ${herculesBits} \ + --install "$out" + ''; + + nativeBuildInputs = [ cmake ]; + + enableParallelBuilding = true; + + meta = with lib; { + description = "Hercules ${depName} library"; + license = lib.licenses.free; # Mixture of Public Domain, ICU (MIT compatible) and others + maintainers = with maintainers; [ anna328p vifino ]; + }; + }).overrideAttrs (default: attrFn default); + + + crypto = mkExtPkg "crypto" (default: { + version = "1.0.0"; + src = fetchFromGitHub { + owner = "SDL-Hercules-390"; + repo = "crypto"; + rev = "a5096e5dd79f46b568806240c0824cd8cb2fcda2"; + hash = "sha256-VWjM8WxPMynyW49Z8U/r6SsF7u7Xbk7Dd0gR35lIw28="; + }; + }); + + decNumber = mkExtPkg "decNumber" (default: { + version = "3.68.0"; + src = fetchFromGitHub { + owner = "SDL-Hercules-390"; + repo = "decNumber"; + rev = "3aa2f4531b5fcbd0478ecbaf72ccc47079c67280"; + hash = "sha256-PfPhnYUSIw1sYiGRM3iHRTbHHbQ+sK7oO12pH/yt+MQ="; + }; + }); + + softFloat = mkExtPkg "SoftFloat" (default: { + version = "3.5.0"; + src = fetchFromGitHub { + owner = "SDL-Hercules-390"; + repo = "SoftFloat"; + rev = "4b0c326008e174610969c92e69178939ed80653d"; + hash = "sha256-DEIT5Xk6IqUXCIGD2Wj0h9xPOR0Mid2Das7aKMQMDaM="; + }; + }); + + telnet = mkExtPkg "telnet" (default: { + version = "1.0.0"; + src = fetchFromGitHub { + owner = "SDL-Hercules-390"; + repo = "telnet"; + rev = "729f0b688c1426018112c1e509f207fb5f266efa"; + hash = "sha256-ED0Cl+VcK6yl59ShgJBZKy25oAFC8eji36pNLwMxTM0="; + }; + }); + + extpkgs = runCommand "hercules-extpkgs" {} '' + OUTINC="$out/include" + OUTLIB="$out/${herculesLibDir}" + mkdir -p "$OUTINC" "$OUTLIB" + for dep in "${crypto}" "${decNumber}" "${softFloat}" "${telnet}"; do + ln -s $dep/include/* "$OUTINC" + ln -s $dep/${herculesLibDir}/* "$OUTLIB" + done + ''; +in +stdenv.mkDerivation rec { + pname = "hercules"; + version = "4.6"; + + src = fetchFromGitHub { + owner = "SDL-Hercules-390"; + repo = "hyperion"; + rev = "Release_${version}"; + hash = "sha256-ZhMTun6tmTsmIiFPTRFudwRXzWydrih61RsLyv0p24U="; + }; + + postPatch = '' + patchShebangs _dynamic_version + ''; + + nativeBuildInputs = [ libtool ]; + buildInputs = [ + (lib.getOutput "lib" libtool) + zlib + bzip2 + extpkgs + ] ++ lib.optionals enableRexx [ + regina + ]; + + configureFlags = [ + "--enable-extpkgs=${extpkgs}" + "--without-included-ltdl" + "--enable-ipv6" + "--enable-cckd-bzip2" + "--enable-het-bzip2" + ] ++ lib.optionals enableRexx [ + "--enable-regina-rexx" + ]; + + meta = with lib; { + homepage = "https://sdl-hercules-390.github.io/html/"; + description = "IBM mainframe emulator"; + longDescription = '' + Hercules is an open source software implementation of the mainframe + System/370 and ESA/390 architectures, in addition to the latest 64-bit + z/Architecture. Hercules runs under Linux, Windows, Solaris, FreeBSD, and + Mac OS X. + ''; + license = licenses.qpl; + maintainers = with maintainers; [ anna328p vifino ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 47e6879dd8aa..c9d47d74d2eb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2735,8 +2735,6 @@ with pkgs; hatari = callPackage ../applications/emulators/hatari { }; - hercules = callPackage ../applications/emulators/hercules { }; - hostapd-mana = callPackage ../tools/networking/hostapd-mana { }; image-analyzer = callPackage ../applications/emulators/cdemu/analyzer.nix { };