nixpkgs/pkgs/applications/editors/poke/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

92 lines
2.2 KiB
Nix
Raw Normal View History

2021-02-27 01:43:34 +00:00
{ lib
, stdenv
, fetchurl
, help2man
, pkg-config
, texinfo
, boehmgc
, readline
, nbdSupport ? !stdenv.isDarwin, libnbd
2024-04-01 01:33:01 +00:00
, textStylingSupport ? true, gettext
2021-02-27 01:43:34 +00:00
, dejagnu
2024-04-01 01:33:01 +00:00
# update script only
, writeScript
2021-02-27 01:43:34 +00:00
}:
2021-02-27 12:10:30 +00:00
let
isCross = stdenv.hostPlatform != stdenv.buildPlatform;
2024-04-01 01:33:01 +00:00
in
stdenv.mkDerivation (finalAttrs: {
2021-02-27 01:43:34 +00:00
pname = "poke";
2024-04-01 01:33:01 +00:00
version = "4.0";
2021-02-27 01:43:34 +00:00
src = fetchurl {
2024-04-01 01:33:01 +00:00
url = "mirror://gnu/poke/poke-${finalAttrs.version}.tar.gz";
hash = "sha256-ArqyLLH6YVOhtqknyLs81Y1QhUPBRIQqbX7nTxmXOnc=";
2021-02-27 01:43:34 +00:00
};
2022-07-26 14:49:49 +00:00
outputs = [ "out" "dev" "info" "lib" ]
2024-04-01 01:33:01 +00:00
# help2man can't cross compile because it runs `poke --help` to
# generate the man page
++ lib.optional (!isCross) "man";
2021-12-03 05:13:08 +00:00
2021-02-27 01:43:34 +00:00
postPatch = ''
patchShebangs .
'';
strictDeps = true;
nativeBuildInputs = [
pkg-config
texinfo
2022-07-26 14:49:49 +00:00
] ++ lib.optionals (!isCross) [
help2man
2022-07-26 13:59:00 +00:00
];
2021-02-27 01:43:34 +00:00
2021-02-27 12:10:30 +00:00
buildInputs = [ boehmgc readline ]
2024-04-01 01:33:01 +00:00
++ lib.optional nbdSupport libnbd
++ lib.optional textStylingSupport gettext
++ lib.optional finalAttrs.finalPackage.doCheck dejagnu;
2021-02-27 01:43:34 +00:00
2021-12-03 05:13:08 +00:00
configureFlags = [
2022-07-26 12:21:13 +00: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 05:13:08 +00:00
"--datadir=${placeholder "lib"}/share"
2021-02-27 01:43:34 +00:00
];
enableParallelBuilding = true;
2024-04-01 01:33:01 +00:00
doCheck = true;
nativeCheckInputs = [ dejagnu ];
2021-02-27 01:43:34 +00:00
2021-12-03 05:13:08 +00:00
postInstall = ''
moveToOutput share/emacs "$out"
2022-07-26 12:21:13 +00:00
moveToOutput share/vim "$out"
2021-12-03 05:13:08 +00: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>')"
2024-04-01 01:33:01 +00:00
update-source-version poke "$new_version"
'';
};
2024-04-01 01:33:01 +00:00
meta = {
2021-02-27 01:43:34 +00:00
description = "Interactive, extensible editor for binary data";
homepage = "http://www.jemarch.net/poke";
2024-04-01 01:33:01 +00:00
changelog = "https://git.savannah.gnu.org/cgit/poke.git/plain/ChangeLog?h=releases/poke-${finalAttrs.version}";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ AndersonTorres kira-bruneau ];
platforms = lib.platforms.unix;
broken = stdenv.isDarwin && stdenv.isAarch64;
2021-02-27 01:43:34 +00:00
};
2024-04-01 01:33:01 +00:00
})