2021-02-27 02:43:34 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, gettext
|
|
|
|
, help2man
|
|
|
|
, pkg-config
|
|
|
|
, texinfo
|
|
|
|
, boehmgc
|
|
|
|
, readline
|
2022-07-26 14:22:32 +02:00
|
|
|
, guiSupport ? false, makeWrapper, tcl, tcllib, tk
|
2021-02-27 02:43:34 +01:00
|
|
|
, miSupport ? true, json_c
|
2021-03-20 12:41:01 +01:00
|
|
|
, nbdSupport ? !stdenv.isDarwin, libnbd
|
2021-02-27 02:43:34 +01:00
|
|
|
, textStylingSupport ? true
|
|
|
|
, dejagnu
|
2022-01-28 22:04:54 +01:00
|
|
|
|
|
|
|
# update script only
|
|
|
|
, writeScript
|
2021-02-27 02:43:34 +01:00
|
|
|
}:
|
|
|
|
|
2021-02-27 13:10:30 +01:00
|
|
|
let
|
|
|
|
isCross = stdenv.hostPlatform != stdenv.buildPlatform;
|
|
|
|
in stdenv.mkDerivation rec {
|
2021-02-27 02:43:34 +01:00
|
|
|
pname = "poke";
|
2023-05-22 10:52:01 +02:00
|
|
|
version = "3.2";
|
2021-02-27 02:43:34 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
|
2023-05-22 10:52:01 +02:00
|
|
|
hash = "sha256-dY5VHdU6bM5U7JTY/CH6TWtSon0cJmcgbVmezcdPDZc=";
|
2021-02-27 02:43:34 +01:00
|
|
|
};
|
|
|
|
|
2022-07-26 16:49:49 +02:00
|
|
|
outputs = [ "out" "dev" "info" "lib" ]
|
|
|
|
# help2man can't cross compile because it runs `poke --help` to
|
|
|
|
# generate the man page
|
|
|
|
++ lib.optional (!isCross) "man";
|
2021-12-03 06:13:08 +01:00
|
|
|
|
2021-02-27 02:43:34 +01:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs .
|
|
|
|
'';
|
|
|
|
|
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
gettext
|
|
|
|
pkg-config
|
|
|
|
texinfo
|
2022-07-26 16:49:49 +02:00
|
|
|
] ++ lib.optionals (!isCross) [
|
|
|
|
help2man
|
2022-07-26 15:59:00 +02:00
|
|
|
] ++ lib.optionals guiSupport [
|
|
|
|
makeWrapper
|
|
|
|
tcl.tclPackageHook
|
|
|
|
];
|
2021-02-27 02:43:34 +01:00
|
|
|
|
2021-02-27 13:10:30 +01:00
|
|
|
buildInputs = [ boehmgc readline ]
|
2022-07-26 15:59:00 +02:00
|
|
|
++ lib.optionals guiSupport [ tcl tcllib tk ]
|
2021-02-27 02:43:34 +01:00
|
|
|
++ lib.optional miSupport json_c
|
|
|
|
++ lib.optional nbdSupport libnbd
|
2021-02-27 13:10:30 +01:00
|
|
|
++ lib.optional textStylingSupport gettext
|
|
|
|
++ lib.optional (!isCross) dejagnu;
|
2021-02-27 02:43:34 +01:00
|
|
|
|
2021-12-03 06:13:08 +01:00
|
|
|
configureFlags = [
|
2022-07-26 14:21:13 +02:00
|
|
|
# libpoke depends on $datadir/poke, so we specify the datadir in
|
|
|
|
# $lib, and later move anything else it doesn't depend on to $out
|
2021-12-03 06:13:08 +01:00
|
|
|
"--datadir=${placeholder "lib"}/share"
|
|
|
|
] ++ lib.optionals guiSupport [
|
2022-07-26 15:59:00 +02:00
|
|
|
"--enable-gui"
|
2021-02-27 02:43:34 +01:00
|
|
|
"--with-tcl=${tcl}/lib"
|
|
|
|
"--with-tk=${tk}/lib"
|
|
|
|
"--with-tkinclude=${tk.dev}/include"
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-02-27 13:10:30 +01:00
|
|
|
doCheck = !isCross;
|
2023-01-21 13:00:00 +01:00
|
|
|
nativeCheckInputs = lib.optionals (!isCross) [ dejagnu ];
|
2021-02-27 02:43:34 +01:00
|
|
|
|
2021-12-03 06:13:08 +01:00
|
|
|
postInstall = ''
|
|
|
|
moveToOutput share/emacs "$out"
|
2022-07-26 14:21:13 +02:00
|
|
|
moveToOutput share/vim "$out"
|
2021-12-03 06:13:08 +01:00
|
|
|
'';
|
|
|
|
|
2023-01-19 10:46:13 +01:00
|
|
|
# Prevent tclPackageHook from auto-wrapping all binaries, we only
|
|
|
|
# need to wrap poke-gui
|
|
|
|
dontWrapTclBinaries = true;
|
|
|
|
|
2022-07-26 14:22:32 +02:00
|
|
|
postFixup = lib.optionalString guiSupport ''
|
|
|
|
wrapProgram "$out/bin/poke-gui" \
|
|
|
|
--prefix TCLLIBPATH ' ' "$TCLLIBPATH"
|
|
|
|
'';
|
|
|
|
|
2022-01-28 22:04:54 +01:00
|
|
|
passthru = {
|
|
|
|
updateScript = writeScript "update-poke" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl pcre common-updater-scripts
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
# Expect the text in format of '<a href="...">poke 2.0</a>'
|
|
|
|
new_version="$(curl -s https://www.jemarch.net/poke |
|
|
|
|
pcregrep -o1 '>poke ([0-9.]+)</a>')"
|
|
|
|
update-source-version ${pname} "$new_version"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-02-27 02:43:34 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Interactive, extensible editor for binary data";
|
|
|
|
homepage = "http://www.jemarch.net/poke";
|
2022-07-26 17:04:00 +02:00
|
|
|
changelog = "https://git.savannah.gnu.org/cgit/poke.git/plain/ChangeLog?h=releases/poke-${version}";
|
2021-02-27 02:43:34 +01:00
|
|
|
license = licenses.gpl3Plus;
|
2021-05-22 16:47:40 +02:00
|
|
|
maintainers = with maintainers; [ AndersonTorres kira-bruneau ];
|
2021-02-27 02:43:34 +01:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
# TODO: Enable guiSupport by default once it's more than just a stub
|