about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/typesetting/tex/texlive/bin.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/typesetting/tex/texlive/bin.nix')
-rw-r--r--nixpkgs/pkgs/tools/typesetting/tex/texlive/bin.nix81
1 files changed, 26 insertions, 55 deletions
diff --git a/nixpkgs/pkgs/tools/typesetting/tex/texlive/bin.nix b/nixpkgs/pkgs/tools/typesetting/tex/texlive/bin.nix
index d77bc836464d..21e916f66429 100644
--- a/nixpkgs/pkgs/tools/typesetting/tex/texlive/bin.nix
+++ b/nixpkgs/pkgs/tools/typesetting/tex/texlive/bin.nix
@@ -5,7 +5,7 @@
 , perl, perlPackages, python3Packages, pkg-config
 , libpaper, graphite2, zziplib, harfbuzz, potrace, gmp, mpfr
 , brotli, cairo, pixman, xorg, clisp, biber, woff2, xxHash
-, makeWrapper, shortenPerlShebang
+, makeWrapper, shortenPerlShebang, useFixedHashes, asymptote
 }:
 
 # Useful resource covering build options:
@@ -17,6 +17,10 @@ let
   year = toString ((import ./tlpdb.nix)."00texlive.config").year;
   version = year; # keep names simple for now
 
+  # detect and stop redundant rebuilds that may occur when building new fixed hashes
+  assertFixedHash = name: src:
+    if ! useFixedHashes || src ? outputHash then src else throw "The TeX Live package '${src.pname}' must have a fixed hash before building '${name}'.";
+
   common = {
     src = fetchurl {
       urls = [
@@ -98,6 +102,12 @@ core = stdenv.mkDerivation rec {
     perl
   ];
 
+  patches = [
+    # Fix implicit `int` on `main`, which results in an error when building with clang 16.
+    # This is fixed upstream and can be dropped with the 2023 release.
+    ./fix-implicit-int.patch
+  ];
+
   hardeningDisable = [ "format" ];
 
   preConfigure = ''
@@ -210,6 +220,19 @@ core-big = stdenv.mkDerivation { #TODO: upmendex
       excludes = [  "build.sh" ];
       stripLen = 1;
     })
+    # Fixes texluajitc crashes on aarch64, backport of the upstream fix
+    # https://github.com/LuaJIT/LuaJIT/commit/e9af1abec542e6f9851ff2368e7f196b6382a44c
+    # to the version vendored by texlive (2.1.0-beta3)
+    (fetchpatch {
+      name = "luajit-fix-aarch64-linux.patch";
+      url = "https://raw.githubusercontent.com/void-linux/void-packages/master/srcpkgs/LuaJIT/patches/e9af1abec542e6f9851ff2368e7f196b6382a44c.patch";
+      hash = "sha256-ysSZmfpfCFMukfHmIqwofAZux1e2kEq/37lfqp7HoWo=";
+      stripLen = 1;
+      extraPrefix = "libs/luajit/LuaJIT-src/";
+    })
+    # Fix implicit `int` on `main`, which results in an error when building with clang 16.
+    # This is fixed upstream and can be dropped with the 2023 release.
+    ./fix-implicit-int.patch
   ];
 
   hardeningDisable = [ "format" ];
@@ -364,44 +387,12 @@ dvipng = stdenv.mkDerivation {
   enableParallelBuilding = true;
 };
 
-
-latexindent = perlPackages.buildPerlPackage rec {
-  pname = "latexindent";
-  inherit (src) version;
-
-  src = lib.head (builtins.filter (p: p.tlType == "run") texlive.latexindent.pkgs);
-
-  outputs = [ "out" ];
-
-  nativeBuildInputs = lib.optional stdenv.isDarwin shortenPerlShebang;
-  propagatedBuildInputs = with perlPackages; [ FileHomeDir LogDispatch LogLog4perl UnicodeLineBreak YAMLTiny ];
-
-  postPatch = ''
-    substituteInPlace scripts/latexindent/LatexIndent/GetYamlSettings.pm \
-      --replace '$FindBin::RealBin/defaultSettings.yaml' ${src}/scripts/latexindent/defaultSettings.yaml
-  '';
-
-  # Dirty hack to apply perlFlags, but do no build
-  preConfigure = ''
-    touch Makefile.PL
-  '';
-  dontBuild = true;
-  installPhase = ''
-    install -D ./scripts/latexindent/latexindent.pl "$out"/bin/latexindent
-    mkdir -p "$out"/${perl.libPrefix}
-    cp -r ./scripts/latexindent/LatexIndent "$out"/${perl.libPrefix}/
-  '' + lib.optionalString stdenv.isDarwin ''
-    shortenPerlShebang "$out"/bin/latexindent
-  '';
-};
-
-
 pygmentex = python3Packages.buildPythonApplication rec {
   pname = "pygmentex";
   inherit (src) version;
   format = "other";
 
-  src = lib.head (builtins.filter (p: p.tlType == "run") texlive.pygmentex.pkgs);
+  src = assertFixedHash pname (lib.head (builtins.filter (p: p.tlType == "run") texlive.pygmentex.pkgs));
 
   propagatedBuildInputs = with python3Packages; [ pygments chardet ];
 
@@ -433,27 +424,7 @@ pygmentex = python3Packages.buildPythonApplication rec {
   };
 };
 
-
-texlinks = stdenv.mkDerivation rec {
-  name = "texlinks";
-
-  src = lib.head (builtins.filter (p: p.tlType == "run") texlive.texlive-scripts-extra.pkgs);
-
-  dontBuild = true;
-  doCheck = false;
-
-  installPhase = ''
-    runHook preInstall
-
-    # Patch texlinks.sh back to 2015 version;
-    # otherwise some bin/ links break, e.g. xe(la)tex.
-    patch --verbose -R scripts/texlive-extra/texlinks.sh < '${./texlinks.diff}'
-    install -Dm555 scripts/texlive-extra/texlinks.sh "$out"/bin/texlinks
-
-    runHook postInstall
-  '';
-};
-
+inherit asymptote;
 
 inherit biber;
 bibtexu = bibtex8;