From e2c8b46d0cee7b9d1e0d9068563474ea9a3fe14d Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Fri, 26 Feb 2021 20:43:34 -0500 Subject: [PATCH 1/2] poke: init at 1.0 --- pkgs/applications/editors/poke/default.nix | 71 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 73 insertions(+) create mode 100644 pkgs/applications/editors/poke/default.nix diff --git a/pkgs/applications/editors/poke/default.nix b/pkgs/applications/editors/poke/default.nix new file mode 100644 index 000000000000..7b56fc03bdce --- /dev/null +++ b/pkgs/applications/editors/poke/default.nix @@ -0,0 +1,71 @@ +{ lib +, stdenv +, fetchurl +, gettext +, help2man +, pkg-config +, texinfo +, makeWrapper +, boehmgc +, readline +, guiSupport ? false, tcl, tcllib, tk +, miSupport ? true, json_c +, nbdSupport ? true, libnbd +, textStylingSupport ? true +, dejagnu +}: + +stdenv.mkDerivation rec { + pname = "poke"; + version = "1.0"; + + src = fetchurl { + url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz"; + hash = "sha256-3pMLhwDAdys8LNDQyjX1D9PXe9+CxiUetRa0noyiWwo="; + }; + + postPatch = '' + patchShebangs . + ''; + + strictDeps = true; + + nativeBuildInputs = [ + gettext + help2man + pkg-config + texinfo + ] ++ lib.optional guiSupport makeWrapper; + + buildInputs = [ boehmgc dejagnu readline ] + ++ lib.optional guiSupport tk + ++ lib.optional miSupport json_c + ++ lib.optional nbdSupport libnbd + ++ lib.optional textStylingSupport gettext; + + configureFlags = lib.optionals guiSupport [ + "--with-tcl=${tcl}/lib" + "--with-tk=${tk}/lib" + "--with-tkinclude=${tk.dev}/include" + ]; + + enableParallelBuilding = true; + + doCheck = true; + checkInputs = [ dejagnu ]; + + postFixup = lib.optionalString guiSupport '' + wrapProgram "$out/bin/poke-gui" \ + --prefix TCLLIBPATH ' ' ${tcllib}/lib/tcllib${tcllib.version} + ''; + + meta = with lib; { + description = "Interactive, extensible editor for binary data"; + homepage = "http://www.jemarch.net/poke"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ AndersonTorres metadark ]; + platforms = platforms.unix; + }; +} + +# TODO: Enable guiSupport by default once it's more than just a stub diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fdc4262a4864..68f55a892ff4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24570,6 +24570,8 @@ in plugin-torture = callPackage ../applications/audio/plugin-torture { }; + poke = callPackage ../applications/editors/poke { }; + polar-bookshelf = callPackage ../applications/misc/polar-bookshelf { }; poezio = python3Packages.poezio; From 594b2147963248f82b93b7ac08491f70f6bcfae3 Mon Sep 17 00:00:00 2001 From: Rick van Schijndel Date: Sat, 27 Feb 2021 13:10:30 +0100 Subject: [PATCH 2/2] poke: cross-compilation support --- pkgs/applications/editors/poke/default.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/editors/poke/default.nix b/pkgs/applications/editors/poke/default.nix index 7b56fc03bdce..1c6f005863b0 100644 --- a/pkgs/applications/editors/poke/default.nix +++ b/pkgs/applications/editors/poke/default.nix @@ -15,7 +15,9 @@ , dejagnu }: -stdenv.mkDerivation rec { +let + isCross = stdenv.hostPlatform != stdenv.buildPlatform; +in stdenv.mkDerivation rec { pname = "poke"; version = "1.0"; @@ -37,11 +39,12 @@ stdenv.mkDerivation rec { texinfo ] ++ lib.optional guiSupport makeWrapper; - buildInputs = [ boehmgc dejagnu readline ] + buildInputs = [ boehmgc readline ] ++ lib.optional guiSupport tk ++ lib.optional miSupport json_c ++ lib.optional nbdSupport libnbd - ++ lib.optional textStylingSupport gettext; + ++ lib.optional textStylingSupport gettext + ++ lib.optional (!isCross) dejagnu; configureFlags = lib.optionals guiSupport [ "--with-tcl=${tcl}/lib" @@ -51,8 +54,8 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - doCheck = true; - checkInputs = [ dejagnu ]; + doCheck = !isCross; + checkInputs = lib.optionals (!isCross) [ dejagnu ]; postFixup = lib.optionalString guiSupport '' wrapProgram "$out/bin/poke-gui" \