From 0626ef812400f2653a56674d293e4749a7dddc8c Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Wed, 5 Jun 2024 19:11:38 +0200 Subject: [PATCH] texinfo: refactor --- pkgs/development/tools/misc/texinfo/4.13a.nix | 23 ----- pkgs/development/tools/misc/texinfo/5.2.nix | 4 - pkgs/development/tools/misc/texinfo/6.5.nix | 4 - pkgs/development/tools/misc/texinfo/6.7.nix | 4 - pkgs/development/tools/misc/texinfo/6.8.nix | 8 -- pkgs/development/tools/misc/texinfo/7.0.nix | 4 - .../development/tools/misc/texinfo/common.nix | 60 +++++------- .../tools/misc/texinfo/packages.nix | 93 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 17 ++-- 9 files changed, 128 insertions(+), 89 deletions(-) delete mode 100644 pkgs/development/tools/misc/texinfo/4.13a.nix delete mode 100644 pkgs/development/tools/misc/texinfo/5.2.nix delete mode 100644 pkgs/development/tools/misc/texinfo/6.5.nix delete mode 100644 pkgs/development/tools/misc/texinfo/6.7.nix delete mode 100644 pkgs/development/tools/misc/texinfo/6.8.nix delete mode 100644 pkgs/development/tools/misc/texinfo/7.0.nix create mode 100644 pkgs/development/tools/misc/texinfo/packages.nix diff --git a/pkgs/development/tools/misc/texinfo/4.13a.nix b/pkgs/development/tools/misc/texinfo/4.13a.nix deleted file mode 100644 index c6036c069d0ab..0000000000000 --- a/pkgs/development/tools/misc/texinfo/4.13a.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ stdenv, fetchurl, texinfo, ncurses, xz, lib }: - -stdenv.mkDerivation rec { - pname = "texinfo"; - version = "4.13a"; - - src = fetchurl { - url = "mirror://gnu/texinfo/${pname}-${version}.tar.lzma"; - sha256 = "1rf9ckpqwixj65bw469i634897xwlgkm5i9g2hv3avl6mv7b0a3d"; - }; - - buildInputs = [ ncurses ]; - nativeBuildInputs = [ xz ]; - - env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isClang [ - "-Wno-error=implicit-function-declaration" - ]); - - # Disabled because we don't have zdiff in the stdenv bootstrap. - #doCheck = true; - - meta = texinfo.meta // { branch = version; }; -} diff --git a/pkgs/development/tools/misc/texinfo/5.2.nix b/pkgs/development/tools/misc/texinfo/5.2.nix deleted file mode 100644 index d395494984d58..0000000000000 --- a/pkgs/development/tools/misc/texinfo/5.2.nix +++ /dev/null @@ -1,4 +0,0 @@ -import ./common.nix { - version = "5.2"; - sha256 = "1njfwh2z34r2c4r0iqa7v24wmjzvsfyz4vplzry8ln3479lfywal"; -} diff --git a/pkgs/development/tools/misc/texinfo/6.5.nix b/pkgs/development/tools/misc/texinfo/6.5.nix deleted file mode 100644 index 34596f306581b..0000000000000 --- a/pkgs/development/tools/misc/texinfo/6.5.nix +++ /dev/null @@ -1,4 +0,0 @@ -import ./common.nix { - version = "6.5"; - sha256 = "0qjzvbvnv9003xdrcpi3jp7y68j4hq2ciw9frh2hghh698zlnxvp"; -} diff --git a/pkgs/development/tools/misc/texinfo/6.7.nix b/pkgs/development/tools/misc/texinfo/6.7.nix deleted file mode 100644 index 7915d6e3c6bee..0000000000000 --- a/pkgs/development/tools/misc/texinfo/6.7.nix +++ /dev/null @@ -1,4 +0,0 @@ -import ./common.nix { - version = "6.7"; - sha256 = "1aicn1v3czqii08wc91jw089n1x3gfchkf808q2as59dak0h714q"; -} diff --git a/pkgs/development/tools/misc/texinfo/6.8.nix b/pkgs/development/tools/misc/texinfo/6.8.nix deleted file mode 100644 index 992f695bc92ca..0000000000000 --- a/pkgs/development/tools/misc/texinfo/6.8.nix +++ /dev/null @@ -1,8 +0,0 @@ -import ./common.nix { - version = "6.8"; - sha256 = "1i7yb7mrp3inz25zbzv2pllr4y7d58v818f1as7iz8mw53nm7dwf"; - patches = [ - # glibc 2.34 compat - ./fix-glibc-2.34.patch - ]; -} diff --git a/pkgs/development/tools/misc/texinfo/7.0.nix b/pkgs/development/tools/misc/texinfo/7.0.nix deleted file mode 100644 index 01788f40d78d6..0000000000000 --- a/pkgs/development/tools/misc/texinfo/7.0.nix +++ /dev/null @@ -1,4 +0,0 @@ -import ./common.nix { - version = "7.0.3"; - sha256 = "sha256-dLQg0J1/Uo6E+XqjMPDdaamKYFPnpOAXZ+7RFQOIB78="; -} diff --git a/pkgs/development/tools/misc/texinfo/common.nix b/pkgs/development/tools/misc/texinfo/common.nix index f3f2e93892960..45c6e7566c181 100644 --- a/pkgs/development/tools/misc/texinfo/common.nix +++ b/pkgs/development/tools/misc/texinfo/common.nix @@ -1,19 +1,31 @@ -{ version, sha256, patches ? [] }: - -{ lib, stdenv, buildPackages, fetchurl, perl, libintl, bash -, updateAutotoolsGnuConfigScriptsHook, gnulib, gawk, freebsd, libiconv +{ lib +, stdenv +, buildPackages +, fetchurl +, perl +, libintl +, bash +, updateAutotoolsGnuConfigScriptsHook +, gnulib +, gawk +, freebsd +, libiconv +, xz # we are a dependency of gcc, this simplifies bootstraping , interactive ? false, ncurses, procps +, meta }: +{ version, hash, patches ? [] }: + # Note: this package is used for bootstrapping fetchurl, and thus # cannot use fetchpatch! All mutable patches (generated by GitHub or # cgit) that are needed here should be included directly in Nixpkgs as # files. let - inherit (lib) getDev getLib optional optionals optionalString; + inherit (lib) getBin getDev getLib optional optionals optionalString versionOlder; crossBuildTools = stdenv.hostPlatform != stdenv.buildPlatform; in @@ -23,7 +35,7 @@ stdenv.mkDerivation { src = fetchurl { url = "mirror://gnu/texinfo/texinfo-${version}.tar.xz"; - inherit sha256; + inherit hash; }; patches = patches ++ optional crossBuildTools ./cross-tools-flags.patch; @@ -34,7 +46,7 @@ stdenv.mkDerivation { # This patch is needed for IEEE-standard long doubles on # powerpc64; it does not apply cleanly to texinfo 5.x or # earlier. It is merged upstream in texinfo 6.8. - + lib.optionalString (version == "6.7") '' + + optionalString (version == "6.7") '' patch -p1 -d gnulib < ${gnulib.passthru.longdouble-redirect-patch} ''; @@ -58,8 +70,8 @@ stdenv.mkDerivation { # Perl XS modules are difficult to cross-compile and texinfo has pure Perl # fallbacks. # Also prevent the buildPlatform's awk being used in the texindex script - ++ optionals crossBuildTools [ "--enable-perl-xs=no" "TI_AWK=${gawk}/bin/awk" ] - ++ lib.optional stdenv.isSunOS "AWK=${gawk}/bin/awk"; + ++ optionals crossBuildTools [ "--enable-perl-xs=no" "TI_AWK=${getBin gawk}/bin/awk" ] + ++ optional stdenv.isSunOS "AWK=${gawk}/bin/awk"; installFlags = [ "TEXMF=$(out)/texmf-dist" ]; installTargets = [ "install" "install-tex" ]; @@ -71,7 +83,7 @@ stdenv.mkDerivation { && !stdenv.isDarwin && !stdenv.isSunOS; # flaky - checkFlags = lib.optionals (!stdenv.hostPlatform.isMusl && lib.versionOlder version "7") [ + checkFlags = optionals (!stdenv.hostPlatform.isMusl && versionOlder version "7") [ # Test is known to fail on various locales on texinfo-6.8: # https://lists.gnu.org/r/bug-texinfo/2021-07/msg00012.html "XFAIL_TESTS=test_scripts/layout_formatting_fr_icons.sh" @@ -84,31 +96,9 @@ stdenv.mkDerivation { done ''; - meta = with lib; { - description = "GNU documentation system"; - homepage = "https://www.gnu.org/software/texinfo/"; - changelog = "https://git.savannah.gnu.org/cgit/texinfo.git/plain/NEWS"; - license = licenses.gpl3Plus; - platforms = platforms.all; - maintainers = with maintainers; [ vrthra oxij ]; - # see comment above in patches section - broken = stdenv.hostPlatform.isPower64 && lib.strings.versionOlder version "6.0"; - - longDescription = '' - Texinfo is the official documentation format of the GNU project. - It was invented by Richard Stallman and Bob Chassell many years - ago, loosely based on Brian Reid's Scribe and other formatting - languages of the time. It is used by many non-GNU projects as - well. - - Texinfo uses a single source file to produce output in a number - of formats, both online and printed (dvi, html, info, pdf, xml, - etc.). This means that instead of writing different documents - for online information and another for a printed manual, you - need write only one document. And when the work is revised, you - need revise only that one document. The Texinfo system is - well-integrated with GNU Emacs. - ''; + meta = meta // { branch = version; + # see comment above in patches section + broken = stdenv.hostPlatform.isPower64 && versionOlder version "6.0"; }; } diff --git a/pkgs/development/tools/misc/texinfo/packages.nix b/pkgs/development/tools/misc/texinfo/packages.nix new file mode 100644 index 0000000000000..49f3d4f72bf14 --- /dev/null +++ b/pkgs/development/tools/misc/texinfo/packages.nix @@ -0,0 +1,93 @@ +{ lib +, stdenv +, buildPackages +, callPackage +, fetchurl +, perl +, libintl +, bash +, updateAutotoolsGnuConfigScriptsHook +, gnulib +, gawk +, freebsd +, libiconv +, xz + +# we are a dependency of gcc, this simplifies bootstraping +, interactive ? false, ncurses, procps +}: + +let + meta = { + description = "GNU documentation system"; + homepage = "https://www.gnu.org/software/texinfo/"; + changelog = "https://git.savannah.gnu.org/cgit/texinfo.git/plain/NEWS"; + license = lib.licenses.gpl3Plus; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ oxij ]; + + longDescription = '' + Texinfo is the official documentation format of the GNU project. + It was invented by Richard Stallman and Bob Chassell many years + ago, loosely based on Brian Reid's Scribe and other formatting + languages of the time. It is used by many non-GNU projects as + well. + + Texinfo uses a single source file to produce output in a number + of formats, both online and printed (dvi, html, info, pdf, xml, + etc.). This means that instead of writing different documents + for online information and another for a printed manual, you + need write only one document. And when the work is revised, you + need revise only that one document. The Texinfo system is + well-integrated with GNU Emacs. + ''; + mainProgram = "texi2any"; + }; + buildTexinfo = callPackage ./common.nix { + inherit lib stdenv buildPackages updateAutotoolsGnuConfigScriptsHook + fetchurl perl xz libintl libiconv bash gnulib gawk freebsd ncurses procps + meta interactive; + }; +in +{ + texinfo413 = stdenv.mkDerivation (finalAttrs: { + pname = "texinfo"; + version = "4.13a"; + + src = fetchurl { + url = "mirror://gnu/texinfo/texinfo-${finalAttrs.version}.tar.lzma"; + hash = "sha256-bSiwzq6GbjU2FC/FUuejvJ+EyDAxGcJXMbJHju9kyeU="; + }; + + buildInputs = [ ncurses ]; + nativeBuildInputs = [ xz ]; + + # Disabled because we don't have zdiff in the stdenv bootstrap. + #doCheck = true; + + meta = meta // { + branch = finalAttrs.version; + }; + }); + texinfo5 = buildTexinfo { + version = "5.2"; + hash = "sha256-VHHvaDpkWIp8/vRu8r3T+8vKidhH4QgyYSKT8QXkTto="; + }; + texinfo6_5 = buildTexinfo { + version = "6.5"; + hash = "sha256-d3dLP0oGwgcFzC7xyASGRCLjz5UjXpZbHwCkbffaX2I="; + }; + texinfo6_7 = buildTexinfo { + version = "6.7"; + hash = "sha256-mIQDwVQtFa0ERgC5CZl7owebEOAyJMYRiBF/NnawLKo="; + }; + texinfo6 = buildTexinfo { + version = "6.8"; + hash = "sha256-jrdT7Si8oh+PVsGhgDYq7XiSKb1i//WL+DaOm+tZ/sQ="; + patches = [ ./fix-glibc-2.34.patch ]; + }; + texinfo7 = buildTexinfo { + version = "7.0.3"; + hash = "sha256-dLQg0J1/Uo6E+XqjMPDdaamKYFPnpOAXZ+7RFQOIB78="; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index aac84df0d150e..7b90651946197 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19699,13 +19699,16 @@ with pkgs; tesh = callPackage ../tools/text/tesh {}; - texinfo413 = callPackage ../development/tools/misc/texinfo/4.13a.nix { }; - texinfo4 = texinfo413; - texinfo5 = callPackage ../development/tools/misc/texinfo/5.2.nix { }; - texinfo6_5 = callPackage ../development/tools/misc/texinfo/6.5.nix { }; # needed for allegro - texinfo6_7 = callPackage ../development/tools/misc/texinfo/6.7.nix { }; # needed for gpm, iksemel and fwknop - texinfo6 = callPackage ../development/tools/misc/texinfo/6.8.nix { }; - texinfo7 = callPackage ../development/tools/misc/texinfo/7.0.nix { }; + texinfoPackages = callPackages ../development/tools/misc/texinfo/packages.nix { }; + inherit (texinfoPackages) + texinfo413 + texinfo5 # needed for gcc48 + texinfo6_5 # needed for allegro + texinfo6_7 # needed for gpm, iksemel and fwknop + texinfo6 + texinfo7 + ; + texinfo4= texinfo413; # needed for eukleides and singular texinfo = texinfo7; texinfoInteractive = texinfo.override { interactive = true; };