Skip to content

Commit

Permalink
texinfo: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
afh committed Jun 10, 2024
1 parent 02fae25 commit 0626ef8
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 89 deletions.
23 changes: 0 additions & 23 deletions pkgs/development/tools/misc/texinfo/4.13a.nix

This file was deleted.

4 changes: 0 additions & 4 deletions pkgs/development/tools/misc/texinfo/5.2.nix

This file was deleted.

4 changes: 0 additions & 4 deletions pkgs/development/tools/misc/texinfo/6.5.nix

This file was deleted.

4 changes: 0 additions & 4 deletions pkgs/development/tools/misc/texinfo/6.7.nix

This file was deleted.

8 changes: 0 additions & 8 deletions pkgs/development/tools/misc/texinfo/6.8.nix

This file was deleted.

4 changes: 0 additions & 4 deletions pkgs/development/tools/misc/texinfo/7.0.nix

This file was deleted.

60 changes: 25 additions & 35 deletions pkgs/development/tools/misc/texinfo/common.nix
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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;
Expand All @@ -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}
'';

Expand All @@ -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" ];
Expand All @@ -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"
Expand All @@ -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";
};
}
93 changes: 93 additions & 0 deletions pkgs/development/tools/misc/texinfo/packages.nix
Original file line number Diff line number Diff line change
@@ -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=";
};
}
17 changes: 10 additions & 7 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; };

Expand Down

0 comments on commit 0626ef8

Please sign in to comment.