Merge pull request #100121 from veprbl/pr/texlive_2020

texlive: 2019 -> 2020
This commit is contained in:
Dmitry Kalinkin 2020-10-11 13:06:20 -04:00 committed by GitHub
commit 2cdd6d1455
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7728 additions and 6645 deletions

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl, fetchpatch, patchutils
{ stdenv, fetchurl
, texlive
, zlib, libiconv, libpng, libX11
, freetype, gd, libXaw, icu, ghostscript, libXpm, libXmu, libXext
@ -14,78 +14,26 @@
let
withSystemLibs = map (libname: "--with-system-${libname}");
year = "2019";
year = "2020";
version = year; # keep names simple for now
common = {
src = fetchurl {
urls = [
"http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/${year}/texlive-${year}0410-source.tar.xz"
"ftp://tug.ctan.org/pub/tex/historic/systems/texlive/${year}/texlive-${year}0410-source.tar.xz"
"http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/${year}/texlive-${year}0406-source.tar.xz"
"ftp://tug.ctan.org/pub/tex/historic/systems/texlive/${year}/texlive-${year}0406-source.tar.xz"
];
sha256 = "1dfps39q6bdr1zsbp9p74mvalmy3bycihv19sb9c6kg30kprz8nj";
sha256 = "0y4h4j2qg714srhvf1hvn165w7sanr1j2vzrsgc23kxvrc43sbz3";
};
prePatch = let
# The source compatible with Poppler ${popplerVersion} not yet available in TeXLive ${year}
# so we need to use files introduced in https://www.tug.org/svn/texlive?view=revision&revision=52959
popplerVersion = "0.83.0";
pdftoepdf = let
revert-pdfmajorversion = fetchpatch {
name = "pdftoepdf-revert-pdfmajorversion.patch";
url = "https://www.tug.org/svn/texlive/trunk/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc?view=patch&r1=52953&r2=52952&pathrev=52953";
sha256 = "19jiv5xbvnfdk8lj6yd6mdxgs8f313a4dwg8svjj90dd35kjcfh8";
revert = true;
postFetch = ''
# The default file, changed by this patch, contains a branch for vendored Poppler
# The version-specific file replaces the section with an error, so we need to drop that part from the patch.
# Fortunately, there is not anything else in the patch after #else.
sed '/ #else/q' $out > "$tmpfile"
${patchutils}/bin/recountdiff "$tmpfile" > "$out"
'';
};
in fetchurl {
name = "pdftoepdf-poppler${popplerVersion}.cc";
url = "https://www.tug.org/svn/texlive/trunk/Build/source/texk/web2c/pdftexdir/pdftoepdf-poppler${popplerVersion}.cc?revision=52959&view=co&pathrev=52959";
sha256 = "0pngvw1jgnm4cqskrzf5a3z8rj4ssl10007n3wbblj50hvvzjph3";
postFetch = ''
# The trunk added some extra arguments to certain functions so we need to revert that
# https://www.tug.org/svn/texlive?view=revision&revision=52953
patch $out < ${revert-pdfmajorversion}
'';
};
pdftosrc = fetchurl {
name = "pdftosrc-poppler${popplerVersion}.cc";
url = "https://www.tug.org/svn/texlive/trunk/Build/source/texk/web2c/pdftexdir/pdftosrc-poppler${popplerVersion}.cc?revision=52959&view=co&pathrev=52959";
sha256 = "0iq2cmwvf2lxy32sygrafwqgcwvvbdnvxm5l3mrg9cb2a1g06380";
};
in ''
prePatch = ''
for i in texk/kpathsea/mktex*; do
sed -i '/^mydir=/d' "$i"
done
cp -pv ${pdftoepdf} texk/web2c/pdftexdir/pdftoepdf.cc
cp -pv ${pdftosrc} texk/web2c/pdftexdir/pdftosrc.cc
cp -pv texk/web2c/pdftexdir/pdftoepdf{-poppler0.86.0,}.cc
cp -pv texk/web2c/pdftexdir/pdftosrc{-poppler0.83.0,}.cc
'';
patches = [
# poppler 0.84 compat fixups, use 0.83 files otherwise
./poppler84.patch
(fetchpatch {
name = "texlive-poppler-0.86.patch";
url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/texlive-poppler-0.86.patch?h=packages/texlive-bin&id=60244e41bb6f1501e8ed1fc9e6b7ba8d3f283398";
sha256 = "0pdvhaqc3zgz7hp0x3a4qs0nh26fkvgmr6w1cjljqhp1nyiw2f1l";
})
# Needed for ghostscript>=9.50
(fetchpatch {
name = "xdvipdfm-fix.patch";
url = "https://www.tug.org/svn/texlive/trunk/Build/source/texk/dvipdfm-x/spc_dvips.c?view=patch&r1=52765&r2=52764&pathrev=52765";
sha256 = "0qvrc7yxhbl5f4g340z8aql388bwib0m2gxd473skbmviy5bjr3f";
stripLen = 2;
})
];
# remove when removing synctex-missing-header.patch
preAutoreconf = "pushd texk/web2c";
postAutoreconf = "popd";
@ -111,6 +59,8 @@ let
done
'';
};
withLuaJIT = !(stdenv.hostPlatform.isPower && stdenv.hostPlatform.is64bit);
in rec { # un-indented
inherit (common) cleanBrokenLinks;
@ -121,7 +71,7 @@ core = stdenv.mkDerivation rec {
pname = "texlive-bin";
inherit version;
inherit (common) src patches prePatch preAutoreconf postAutoreconf;
inherit (common) src prePatch preAutoreconf postAutoreconf;
outputs = [ "out" "doc" ];
@ -136,7 +86,7 @@ core = stdenv.mkDerivation rec {
preConfigure = ''
rm -r libs/{cairo,freetype2,gd,gmp,graphite2,harfbuzz,icu,libpaper,libpng} \
libs/{mpfr,pixman,poppler,xpdf,zlib,zziplib}
libs/{lua53,luajit,mpfr,pixman,poppler,xpdf,zlib,zziplib}
mkdir WorkDir
cd WorkDir
'';
@ -144,14 +94,13 @@ core = stdenv.mkDerivation rec {
configureFlags = common.configureFlags
++ [ "--without-x" ] # disable xdvik and xpdfopen
++ map (what: "--disable-${what}") ([
++ map (what: "--disable-${what}") [
"chktex"
"dvisvgm" "dvipng" # ghostscript dependency
"luatex" "luajittex" "mp" "pmp" "upmp" "mf" # cairo would bring in X and more
"luatex" "luajittex" "luahbtex" "luajithbtex"
"mp" "pmp" "upmp" "mf" "mflua" "mfluajit" # cairo would bring in X and more
"xetex" "bibtexu" "bibtex8" "bibtex-x" "upmendex" # ICU isn't small
] ++ stdenv.lib.optional (stdenv.hostPlatform.isPower && stdenv.hostPlatform.is64bit) "mfluajit")
++ [ "--without-system-harfbuzz" "--without-system-icu" ] # bogus configure
;
];
enableParallelBuilding = true;
@ -194,9 +143,6 @@ core = stdenv.mkDerivation rec {
mv "$out"/share/{man,info} "$doc"/doc
'' + cleanBrokenLinks;
# needed for poppler and xpdf
CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++14";
setupHook = ./setup-hook.sh; # TODO: maybe texmf-nix -> texmf (and all references)
passthru = { inherit version buildInputs; };
@ -210,12 +156,12 @@ core = stdenv.mkDerivation rec {
};
inherit (core-big) metafont metapost luatex xetex;
inherit (core-big) metafont mflua metapost luatex luahbtex luajittex xetex;
core-big = stdenv.mkDerivation { #TODO: upmendex
pname = "texlive-core-big.bin";
inherit version;
inherit (common) src patches prePatch preAutoreconf postAutoreconf;
inherit (common) src prePatch preAutoreconf postAutoreconf;
hardeningDisable = [ "format" ];
@ -225,21 +171,20 @@ core-big = stdenv.mkDerivation { #TODO: upmendex
configureFlags = common.configureFlags
++ withSystemLibs [ "kpathsea" "ptexenc" "cairo" "harfbuzz" "icu" "graphite2" ]
++ map (prog: "--disable-${prog}") # don't build things we already have
[ "tex" "ptex" "eptex" "uptex" "euptex" "aleph" "pdftex"
([ "tex" "ptex" "eptex" "uptex" "euptex" "aleph" "pdftex"
"web-progs" "synctex"
# luajittex is mostly not needed, see:
# http://tex.stackexchange.com/questions/97999/when-to-use-luajittex-in-favour-of-luatex
"luajittex" "mfluajit"
];
] ++ stdenv.lib.optionals (!withLuaJIT) [ "luajittex" "luajithbtex" "mfluajit" ]);
configureScript = ":";
# we use static libtexlua, because it's only used by a single binary
postConfigure = ''
postConfigure = let
luajit = stdenv.lib.optionalString withLuaJIT ",luajit";
in ''
mkdir ./WorkDir && cd ./WorkDir
for path in libs/{teckit,lua53} texk/web2c; do
for path in libs/{teckit,lua53${luajit}} texk/web2c; do
(
if [[ "$path" =~ "libs/lua5" ]]; then
if [[ "$path" =~ "libs/lua" ]]; then
extraConfig="--enable-static --disable-shared"
else
extraConfig=""
@ -258,17 +203,31 @@ core-big = stdenv.mkDerivation { #TODO: upmendex
# now distribute stuff into outputs, roughly as upstream TL
# (uninteresting stuff remains in $out, typically duplicates from `core`)
outputs = [ "out" "metafont" "metapost" "luatex" "xetex" ];
outputs = [
"out"
"metafont"
"mflua"
"metapost"
"luatex"
"luahbtex"
"luajittex"
"xetex"
];
postInstall = ''
for output in $outputs; do
mkdir -p "''${!output}/bin"
done
mv "$out/bin"/{inimf,mf,mf-nowin} "$metafont/bin/"
mv "$out/bin"/mflua{,-nowin} "$mflua/bin/"
mv "$out/bin"/{*tomp,mfplain,*mpost} "$metapost/bin/"
mv "$out/bin"/{luatex,texlua*} "$luatex/bin/"
mv "$out/bin"/{luatex,texlua,texluac} "$luatex/bin/"
mv "$out/bin"/luahbtex "$luahbtex/bin/"
mv "$out/bin"/xetex "$xetex/bin/"
'';
'' + stdenv.lib.optionalString withLuaJIT ''
mv "$out/bin"/mfluajit{,-nowin} "$mflua/bin/"
mv "$out/bin"/{luajittex,luajithbtex,texluajit,texluajitc} "$luajittex/bin/"
'' ;
};
@ -296,31 +255,12 @@ dvisvgm = stdenv.mkDerivation {
inherit (common) src;
patches = [
# Fix for ghostscript>=9.27
# Backport of
# https://github.com/mgieseki/dvisvgm/commit/bc51951bc90b700c28ea018993bdb058e5271e9b
./dvisvgm-fix.patch
# Needed for ghostscript>=9.50
(fetchpatch {
url = "https://github.com/mgieseki/dvisvgm/commit/7b93a9197b69305429183affd24fa40ee04a663a.patch";
sha256 = "1gmj76ja9xng39wxckhs9q140abixgb8rkrcfv2cdgq786wm3vag";
stripLen = 1;
extraPrefix = "texk/dvisvgm/dvisvgm-src/";
})
];
nativeBuildInputs = [ pkgconfig ];
# TODO: dvisvgm still uses vendored dependencies
buildInputs = [ core/*kpathsea*/ ghostscript zlib freetype /*potrace xxHash*/ ];
preConfigure = "cd texk/dvisvgm";
# configure script has a bug: it refers to $HAVE_LIBGS but sets $have_libgs
# TODO: remove for texlive 2020?
HAVE_LIBGS = 1;
configureFlags = common.configureFlags
++ [ "--with-system-kpathsea" ];
@ -337,15 +277,6 @@ dvipng = stdenv.mkDerivation {
nativeBuildInputs = [ perl pkgconfig ];
buildInputs = [ core/*kpathsea*/ zlib libpng freetype gd ghostscript makeWrapper ];
patches = [
(fetchpatch {
url = "http://git.savannah.nongnu.org/cgit/dvipng.git/patch/?id=f3ff241827a587e3d39eda477041fd3280f5b245";
sha256 = "1a0ixl9mga24p6xk8dy3v60yifvbzd27vs0hv8996rfkp8jqa7is";
stripLen = 1;
extraPrefix = "texk/dvipng/dvipng-src/";
})
];
preConfigure = ''
cd texk/dvipng
patchShebangs doc/texi2pod.pl

View file

@ -2,7 +2,7 @@
- source: ../../../../../doc/languages-frameworks/texlive.xml
- current html: https://nixos.org/nixpkgs/manual/#sec-language-texlive
*/
{ stdenv, lib, fetchurl, fetchpatch, runCommand, writeText, buildEnv
{ stdenv, lib, fetchurl, runCommand, writeText, buildEnv
, callPackage, ghostscriptX, harfbuzz, poppler_min
, makeWrapper, python, ruby, perl
, useFixedHashes ? true
@ -57,21 +57,6 @@ let
collection-plaingeneric = orig.collection-plaingeneric // {
deps = orig.collection-plaingeneric.deps // { inherit (tl) xdvi; };
};
# TODO revert for texlive 2020
arara = lib.recursiveUpdate orig.arara {
postUnpack = let
arara_jar_fix = fetchpatch {
url = "https://github.com/TeX-Live/texlive-source/commit/dbaf12f4a47dcd62bcc96346f65493fda3fec2c8.diff";
sha256 = "148knr8k6sm6fpyj31kdq85yxvzvwp1prjha3f07q24kbar2l830";
};
in ''
if [ -f "$out"/scripts/arara/arara.sh ]; then
cd "$out"/scripts/
patch -p4 <${arara_jar_fix}
fi
'';
};
}); # overrides
# tl =
@ -81,7 +66,7 @@ let
flatDeps = pname: attrs:
let
version = attrs.version or bin.texliveYear;
version = attrs.version or (builtins.toString attrs.revision);
mkPkgV = tlType: let
pkg = attrs // {
sha512 = attrs.sha512.${tlType};
@ -112,15 +97,7 @@ let
fixedHash = fixedHashes.${tlName} or null; # be graceful about missing hashes
urls = args.urls or (if args ? url then [ args.url ] else
lib.concatMap
(up: [
# Only ~11% of packages in texlive 2019 have revisions, so
# the number of requests is nearly doubled if we lookup
# the name with revision
# "${up}/${urlName}.r${toString revision}.tar.xz"
"${up}/${urlName}.tar.xz" # TODO To be removed for texlive 2020?
])
urlPrefixes);
map (up: "${up}/${urlName}.r${toString revision}.tar.xz") urlPrefixes);
# The tarballs on CTAN mirrors for the current release are constantly
# receiving updates, so we can't use those directly. Stable snapshots
@ -129,11 +106,11 @@ let
# (https://tug.org/historic/).
urlPrefixes = args.urlPrefixes or [
# tlnet-final snapshot
"http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2019/tlnet-final/archive"
"ftp://tug.org/texlive/historic/2019/tlnet-final/archive"
#"http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2019/tlnet-final/archive"
#"ftp://tug.org/texlive/historic/2019/tlnet-final/archive"
# Daily snapshots hosted by one of the texlive release managers
#https://texlive.info/tlnet-archive/2019/10/19/tlnet/archive
https://texlive.info/tlnet-archive/2020/10/09/tlnet/archive
];
src = fetchurl { inherit urls sha512; };
@ -192,8 +169,6 @@ in
addMetaAttrs rec {
description = "TeX Live environment for ${pname}";
platforms = lib.platforms.all;
hydraPlatforms = lib.optionals
(!lib.elem pname ["scheme-infraonly"]) platforms;
maintainers = with lib.maintainers; [ veprbl ];
}
(combine {

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff