poke: 3.2 -> 4.0

This commit is contained in:
Kira Bruneau 2024-03-31 21:33:01 -04:00
parent 807c549fea
commit 16986ab608

View File

@ -1,37 +1,35 @@
{ lib { lib
, stdenv , stdenv
, fetchurl , fetchurl
, gettext
, help2man , help2man
, pkg-config , pkg-config
, texinfo , texinfo
, boehmgc , boehmgc
, readline , readline
, guiSupport ? false, makeWrapper, tcl, tcllib, tk
, miSupport ? true, json_c
, nbdSupport ? !stdenv.isDarwin, libnbd , nbdSupport ? !stdenv.isDarwin, libnbd
, textStylingSupport ? true , textStylingSupport ? true, gettext
, dejagnu , dejagnu
# update script only # update script only
, writeScript , writeScript
}: }:
let let
isCross = stdenv.hostPlatform != stdenv.buildPlatform; isCross = stdenv.hostPlatform != stdenv.buildPlatform;
in stdenv.mkDerivation rec { in
stdenv.mkDerivation (finalAttrs: {
pname = "poke"; pname = "poke";
version = "3.2"; version = "4.0";
src = fetchurl { src = fetchurl {
url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz"; url = "mirror://gnu/poke/poke-${finalAttrs.version}.tar.gz";
hash = "sha256-dY5VHdU6bM5U7JTY/CH6TWtSon0cJmcgbVmezcdPDZc="; hash = "sha256-ArqyLLH6YVOhtqknyLs81Y1QhUPBRIQqbX7nTxmXOnc=";
}; };
outputs = [ "out" "dev" "info" "lib" ] outputs = [ "out" "dev" "info" "lib" ]
# help2man can't cross compile because it runs `poke --help` to # help2man can't cross compile because it runs `poke --help` to
# generate the man page # generate the man page
++ lib.optional (!isCross) "man"; ++ lib.optional (!isCross) "man";
postPatch = '' postPatch = ''
patchShebangs . patchShebangs .
@ -40,53 +38,33 @@ in stdenv.mkDerivation rec {
strictDeps = true; strictDeps = true;
nativeBuildInputs = [ nativeBuildInputs = [
gettext
pkg-config pkg-config
texinfo texinfo
] ++ lib.optionals (!isCross) [ ] ++ lib.optionals (!isCross) [
help2man help2man
] ++ lib.optionals guiSupport [
makeWrapper
tcl.tclPackageHook
]; ];
buildInputs = [ boehmgc readline ] buildInputs = [ boehmgc readline ]
++ lib.optionals guiSupport [ tcl tcllib tk ] ++ lib.optional nbdSupport libnbd
++ lib.optional miSupport json_c ++ lib.optional textStylingSupport gettext
++ lib.optional nbdSupport libnbd ++ lib.optional finalAttrs.finalPackage.doCheck dejagnu;
++ lib.optional textStylingSupport gettext
++ lib.optional (!isCross) dejagnu;
configureFlags = [ configureFlags = [
# libpoke depends on $datadir/poke, so we specify the datadir in # libpoke depends on $datadir/poke, so we specify the datadir in
# $lib, and later move anything else it doesn't depend on to $out # $lib, and later move anything else it doesn't depend on to $out
"--datadir=${placeholder "lib"}/share" "--datadir=${placeholder "lib"}/share"
] ++ lib.optionals guiSupport [
"--enable-gui"
"--with-tcl=${tcl}/lib"
"--with-tk=${tk}/lib"
"--with-tkinclude=${tk.dev}/include"
]; ];
enableParallelBuilding = true; enableParallelBuilding = true;
doCheck = !isCross; doCheck = true;
nativeCheckInputs = lib.optionals (!isCross) [ dejagnu ]; nativeCheckInputs = [ dejagnu ];
postInstall = '' postInstall = ''
moveToOutput share/emacs "$out" moveToOutput share/emacs "$out"
moveToOutput share/vim "$out" moveToOutput share/vim "$out"
''; '';
# Prevent tclPackageHook from auto-wrapping all binaries, we only
# need to wrap poke-gui
dontWrapTclBinaries = true;
postFixup = lib.optionalString guiSupport ''
wrapProgram "$out/bin/poke-gui" \
--prefix TCLLIBPATH ' ' "$TCLLIBPATH"
'';
passthru = { passthru = {
updateScript = writeScript "update-poke" '' updateScript = writeScript "update-poke" ''
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
@ -97,18 +75,17 @@ in stdenv.mkDerivation rec {
# Expect the text in format of '<a href="...">poke 2.0</a>' # Expect the text in format of '<a href="...">poke 2.0</a>'
new_version="$(curl -s https://www.jemarch.net/poke | new_version="$(curl -s https://www.jemarch.net/poke |
pcregrep -o1 '>poke ([0-9.]+)</a>')" pcregrep -o1 '>poke ([0-9.]+)</a>')"
update-source-version ${pname} "$new_version" update-source-version poke "$new_version"
''; '';
}; };
meta = with lib; { meta = {
description = "Interactive, extensible editor for binary data"; description = "Interactive, extensible editor for binary data";
homepage = "http://www.jemarch.net/poke"; homepage = "http://www.jemarch.net/poke";
changelog = "https://git.savannah.gnu.org/cgit/poke.git/plain/ChangeLog?h=releases/poke-${version}"; changelog = "https://git.savannah.gnu.org/cgit/poke.git/plain/ChangeLog?h=releases/poke-${finalAttrs.version}";
license = licenses.gpl3Plus; license = lib.licenses.gpl3Plus;
maintainers = with maintainers; [ AndersonTorres kira-bruneau ]; maintainers = with lib.maintainers; [ AndersonTorres kira-bruneau ];
platforms = platforms.unix; platforms = lib.platforms.unix;
broken = stdenv.isDarwin && stdenv.isAarch64;
}; };
} })
# TODO: Enable guiSupport by default once it's more than just a stub