2024-06-30 08:16:52 +00:00
{
lib ,
stdenv ,
fetchurl ,
fetchpatch ,
buildPackages ,
texlive ,
zlib ,
libiconv ,
libpng ,
libX11 ,
freetype ,
gd ,
libXaw ,
icu ,
ghostscript ,
libXpm ,
libXmu ,
libXext ,
perl ,
perlPackages ,
python3Packages ,
pkg-config ,
cmake ,
ninja ,
libpaper ,
graphite2 ,
zziplib ,
harfbuzz ,
potrace ,
gmp ,
mpfr ,
mupdf-headless ,
brotli ,
cairo ,
pixman ,
xorg ,
clisp ,
biber ,
woff2 ,
xxHash ,
makeWrapper ,
shortenPerlShebang ,
useFixedHashes ,
asymptote ,
biber-ms ,
tlpdb ,
2024-05-02 00:46:19 +00:00
} @ args :
# Useful resource covering build options:
# http://tug.org/texlive/doc/tlbuild.html
let
withSystemLibs = map ( libname : " - - w i t h - s y s t e m - ${ libname } " ) ;
year = toString ( ( import ./tlpdb.nix ) . " 0 0 t e x l i v e . c o n f i g " ) . year ;
version = year ; # keep names simple for now
# detect and stop redundant rebuilds that may occur when building new fixed hashes
2024-06-30 08:16:52 +00:00
assertFixedHash =
name : src :
if ! useFixedHashes || src ? outputHash then
src
else
throw " T h e T e X L i v e p a c k a g e ' ${ src . pname } ' m u s t h a v e a f i x e d h a s h b e f o r e b u i l d i n g ' ${ name } ' . " ;
2024-05-02 00:46:19 +00:00
# list of packages whose binaries are built in core, core-big
# generated manually by inspecting ${core}/bin
2024-06-30 08:16:52 +00:00
corePackages = [
" a f m 2 p l "
" a l e p h "
" a u t o s p "
" a x o d r a w 2 "
" b i b t e x "
" c j k u t i l s "
" c t i e "
" c w e b "
" d e t e x "
" d t l "
" d v i 2 t t y "
" d v i c o p y "
" d v i d v i "
" d v i l j k "
" d v i o u t - u t i l "
" d v i p d f m x "
" d v i p o s "
" d v i p s "
" f o n t w a r e "
" g r e g o r i o t e x "
" g s f t o p k "
" h i t e x "
" k p a t h s e a "
" l a c h e c k "
" l c d f t y p e t o o l s "
" m - t x "
" m a k e i n d e x "
" m f w a r e "
" m u s i x t n t "
" o m e g a w a r e "
" p a t g e n "
" p d f t e x "
" p d f t o s r c "
" p m x "
" p s 2 e p s "
" p s 2 p k "
" p s u t i l s "
" p t e x "
" s e e t e x k "
" s y n c t e x "
" t 1 u t i l s "
" t e x "
" t e x 4 h t "
" t e x l i v e - s c r i p t s - e x t r a "
" t e x w a r e "
" t i e "
" t p i c 2 p d f t e x "
" t t f u t i l s "
" u p t e x "
" v e l t h u i s "
" v l n a "
" w e b "
" x m l 2 p m x "
] ;
coreBigPackages = [
" m e t a f o n t "
" m f l u a "
" m e t a p o s t "
" l u a t e x "
" l u a h b t e x "
" u p m e n d e x "
" x e t e x "
] ++ lib . optional withLuaJIT " l u a j i t t e x " ;
2024-05-02 00:46:19 +00:00
binPackages = lib . getAttrs ( corePackages ++ coreBigPackages ) tlpdb ;
common = {
src = fetchurl {
urls = [
" h t t p : / / f t p . m a t h . u t a h . e d u / p u b / t e x / h i s t o r i c / s y s t e m s / t e x l i v e / ${ year } / t e x l i v e - ${ year } 0 3 1 3 - s o u r c e . t a r . x z "
2024-06-30 08:16:52 +00:00
" f t p : / / t u g . c t a n . o r g / p u b / t e x / h i s t o r i c / s y s t e m s / t e x l i v e / ${ year } / t e x l i v e - ${ year } 0 3 1 3 - s o u r c e . t a r . x z "
2024-05-02 00:46:19 +00:00
] ;
hash = " s h a 2 5 6 - O H i q D h 7 Q M B w F O w 4 u 5 O m t m Z x E E 0 X 0 i C 5 5 v d H I 9 M 6 e e b k = " ;
} ;
2024-06-30 08:16:52 +00:00
prePatch =
''
for i in texk/kpathsea/mktex * ; do
sed - i ' / ^ mydir = /d ' " $ i "
done
# ST_NLINK_TRICK causes kpathsea to treat folders with no real subfolders
# as leaves, even if they contain symlinks to other folders; must be
# disabled to work correctly with the nix store", see section 5.3.6
# “Subdirectory expansion” of the kpathsea manual
# http://mirrors.ctan.org/systems/doc/kpathsea/kpathsea.pdf for more
# details
sed - i ' / ^ #define ST_NLINK_TRICK/d' texk/kpathsea/config.h
''
+
# when cross compiling, we must use himktables from PATH
# (i.e. from buildPackages.texlive.bin.core.dev)
lib . optionalString ( ! stdenv . buildPlatform . canExecute stdenv . hostPlatform ) ''
sed - i ' s | \ ./himktables | himktables | ' texk/web2c/Makefile.in
'' ;
configureFlags =
[
" - - w i t h - b a n n e r - a d d = / n i x o s . o r g "
" - - d i s a b l e - m i s s i n g "
# terminate if a requested program or feature must be
# disabled, e.g., due to missing libraries
" - - d i s a b l e - n a t i v e - t e x l i v e - b u i l d " # do not build for the TeX Live binary distribution
" - - e n a b l e - s h a r e d " # "--enable-cxx-runtime-hack" # static runtime
" - - e n a b l e - t e x - s y n c t e x "
" - - d i s a b l e - t e x l i v e " # do not build the texlive (TeX Live scripts) package
" - - d i s a b l e - l i n k e d - s c r i p t s " # do not install the linked scripts
" - C " # use configure cache to speed up
]
2024-05-02 00:46:19 +00:00
++ withSystemLibs [
2024-06-30 08:16:52 +00:00
# see "from TL tree" vs. "Using installed" in configure output
" z z i p l i b "
" m p f r "
" g m p "
" p i x m a n "
" p o t r a c e "
" g d "
" f r e e t y p e 2 "
" l i b p n g "
" l i b p a p e r "
" z l i b "
]
++ lib . optional (
stdenv . hostPlatform != stdenv . buildPlatform
) " B U I L D C C = ${ buildPackages . stdenv . cc . targetPrefix } c c " ;
2024-05-02 00:46:19 +00:00
# move binaries to corresponding split outputs, based on content of texlive.tlpdb
2024-06-30 08:16:52 +00:00
binToOutput = lib . listToAttrs (
lib . concatMap (
n :
map ( v : {
name = v ;
value = builtins . replaceStrings [ " - " ] [ " _ " ] n ;
} ) binPackages . ${ n } . binfiles or [ ]
) ( builtins . attrNames binPackages )
) ;
2024-05-02 00:46:19 +00:00
moveBins = ''
for bin in " $ o u t / b i n " /* ; d o
bin = " ' ' ${ bin ##*/}"
package = " ' ' ${ binToOutput [ $ bin ] } "
if [ [ - n " $ p a c k a g e " ] ] ; then
if [ [ - z " ' ' ${ ! package } " ] ] ; then
echo " W A R N I N G : m i s s i n g o u t p u t ' $ p a c k a g e ' f o r b i n a r y ' $ b i n ' , l e a v i n g i n ' o u t ' "
else
mkdir - p " ' ' ${ ! package } " /bin
mv " $ o u t / b i n / $ b i n " " ' ' ${ ! package } " /bin /
fi
else
echo " W A R N I N G : n o o u t p u t k n o w n f o r b i n a r y ' $ b i n ' , l e a v i n g i n ' o u t ' "
fi
done
'' ;
} ;
# RISC-V: https://github.com/LuaJIT/LuaJIT/issues/628
2024-06-30 08:16:52 +00:00
withLuaJIT =
! ( stdenv . hostPlatform . isPower && stdenv . hostPlatform . is64bit ) && ! stdenv . hostPlatform . isRiscV ;
in
rec {
# un-indented
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
texliveYear = year ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
core = stdenv . mkDerivation rec {
pname = " t e x l i v e - b i n " ;
inherit version ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
__structuredAttrs = true ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
inherit ( common ) binToOutput src prePatch ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
patches = [
( fetchpatch {
name = " t t f d u m p - C V E - 2 0 2 4 - 2 5 2 6 2 . p a t c h " ;
url = " h t t p s : / / t u g . o r g / s v n / t e x l i v e / t r u n k / B u i l d / s o u r c e / t e x k / t t f d u m p / l i b t t f / h d m x . c ? r 1 = 5 7 9 1 5 & r 2 = 6 9 5 2 0 & v i e w = p a t c h " ;
stripLen = 2 ;
hash = " s h a 2 5 6 - W H 2 k i o q F A s 3 j a F m u 4 D d E U d r T f 6 e i y m t i W T Z i 3 v W w U 7 k = " ;
} )
2024-05-02 00:46:19 +00:00
] ;
2024-06-30 08:16:52 +00:00
outputs = [
" o u t "
" d e v "
" m a n "
" i n f o "
] ++ ( builtins . map ( builtins . replaceStrings [ " - " ] [ " _ " ] ) corePackages ) ;
nativeBuildInputs =
[ pkg-config ]
++ lib . optionals ( ! stdenv . buildPlatform . canExecute stdenv . hostPlatform ) (
with texlive . bin . core ;
[
# configure: error: tangle was not found but is required when cross-compiling.
# dev (himktables) is used when building hitex to generate the additional source file hitables.c
web # tangle
cweb # ctangle
omegaware # otangle
tie # tie see "Building TeX Live" 6.4.2 Cross problems
dev # himktables
]
) ;
buildInputs = [
# teckit
zziplib
mpfr
gmp
pixman
gd
freetype
libpng
libpaper
zlib
perl
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
hardeningDisable = [ " f o r m a t " ] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
preConfigure = ''
rm - r libs / { cairo , freetype2 , gd , gmp , graphite2 , harfbuzz , icu , libpaper , libpng } \
libs / { lua53 , luajit , mpfr , pixman , pplib , teckit , zlib , zziplib } \
texk / { bibtex-x , chktex , dvipng , dvisvgm , upmendex , xdvik } \
utils / { asymptote , texdoctk , xindy , xpdfopen }
mkdir WorkDir
cd WorkDir
'' ;
configureScript = " . . / c o n f i g u r e " ;
depsBuildBuild = [ buildPackages . stdenv . cc ] ;
configureFlags =
common . configureFlags
++ [ " - - w i t h o u t - x " ] # disable xdvik and xpdfopen
++ map ( what : " - - d i s a b l e - ${ what } " ) [
" c h k t e x "
" d v i s v g m "
" d v i p n g " # ghostscript dependency
" l u a t e x "
" l u a j i t t e x "
" l u a h b t e x "
" l u a j i t h b t e x "
" m p "
" p m p "
" u p m p "
" m f "
" m f l u a "
" m f l u a j i t " # cairo would bring in X and more
" x e t e x "
" b i b t e x u "
" b i b t e x 8 "
" b i b t e x - x "
" u p m e n d e x " # ICU isn't small
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
enableParallelBuilding = true ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
doCheck = false ; # triptest fails, likely due to missing TEXMF tree
preCheck = " p a t c h S h e b a n g s . . / t e x k / w e b 2 c " ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
installTargets = [ " i n s t a l l " ] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
# TODO: perhaps improve texmf.cnf search locations
postInstall =
# remove redundant texmf-dist (content provided by TeX Live packages)
''
rm - fr " $ o u t " /share/texmf-dist
''
# install himktables in separate output for use in cross compilation
+ ''
mkdir - p $ dev/bin
cp texk/web2c/.libs/himktables $ dev/bin/himktables
''
+ common . moveBins ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
passthru = {
inherit version buildInputs ;
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
meta = with lib ; {
description = " B a s i c b i n a r i e s f o r T e X L i v e " ;
homepage = " h t t p : / / w w w . t u g . o r g / t e x l i v e " ;
license = lib . licenses . gpl2Plus ;
maintainers = with maintainers ; [
veprbl
lovek323
raskin
jwiegley
] ;
platforms = platforms . all ;
} ;
2024-05-02 00:46:19 +00:00
} ;
2024-06-30 08:16:52 +00:00
inherit ( core-big )
metafont
mflua
metapost
luatex
luahbtex
xetex
;
luajittex = core . big . luajittex or null ;
core-big = stdenv . mkDerivation {
pname = " t e x l i v e - b i n - b i g " ;
inherit version ;
__structuredAttrs = true ;
inherit ( common ) binToOutput src prePatch ;
patches = [
# improves reproducibility of fmt files
# see discussion at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009196
( fetchpatch {
name = " l u a _ f i x e d _ h a s h . p a t c h " ;
url = " h t t p s : / / b u g s . d e b i a n . o r g / c g i - b i n / b u g r e p o r t . c g i ? a t t = 1 ; b u g = 1 0 0 9 1 9 6 ; f i l e n a m e = l u a _ f i x e d _ h a s h . p a t c h ; m s g = 4 5 " ;
sha256 = " s h a 2 5 6 - F T u 1 e R d 3 A U U 7 I R s 2 / 7 e 7 u w H u v Z s r z T B P y p b c E Z k U 7 y 4 = " ;
} )
# update to LuaTeX 1.16.1 to prepare for 1.17.0 below
( fetchpatch {
name = " l u a t e x - 1 . 1 6 . 1 . p a t c h " ;
url = " h t t p s : / / g i t h u b . c o m / T e X - L i v e / t e x l i v e - s o u r c e / c o m m i t / a d 8 7 0 2 a 4 5 e 3 1 7 f a 9 d 3 9 6 e f 4 d 5 0 4 6 7 c 3 7 9 6 4 a 9 5 4 3 . p a t c h " ;
hash = " s h a 2 5 6 - q f z U f k J U f W 2 8 5 w + f n b p O 8 J L A r M 7 / u j 3 y b 9 P O N g Z r J L E = " ;
} )
# fixes security issues in luatex that allows arbitrary code execution even with shell-escape disabled and network requests, see https://tug.org/~mseven/luatex.html
# fixed in LuaTeX 1.17.0, shipped as a rare binary update in TL 2023
( fetchpatch {
name = " l u a t e x - 1 . 1 7 . 0 . p a t c h " ;
url = " h t t p s : / / g i t h u b . c o m / T e X - L i v e / t e x l i v e - s o u r c e / c o m m i t / 6 a c e 4 6 0 2 3 3 1 1 5 b d 4 2 b 3 6 e 6 3 c 7 d d c e 1 1 c c 9 2 a 1 e b d . p a t c h " ;
hash = " s h a 2 5 6 - 2 f b I d w n w / X Q X c i 9 O q R r b 6 B 5 t H i S R 0 c o 0 8 N y F g M y X C v c = " ;
} )
# 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 = " l u a j i t - f i x - a a r c h 6 4 - l i n u x . p a t c h " ;
url = " h t t p s : / / r a w . g i t h u b u s e r c o n t e n t . c o m / v o i d - l i n u x / v o i d - p a c k a g e s / m a s t e r / s r c p k g s / L u a J I T / p a t c h e s / e 9 a f 1 a b e c 5 4 2 e 6 f 9 8 5 1 f f 2 3 6 8 e 7 f 1 9 6 b 6 3 8 2 a 4 4 c . p a t c h " ;
hash = " s h a 2 5 6 - y s S Z m f p f C F M u k f H m I q w o f A Z u x 1 e 2 k E q / 3 7 l f q p 7 H o W o = " ;
stripLen = 1 ;
extraPrefix = " l i b s / l u a j i t / L u a J I T - s r c / " ;
} )
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
hardeningDisable = [ " f o r m a t " ] ;
inherit ( core ) nativeBuildInputs depsBuildBuild ;
buildInputs = core . buildInputs ++ [
core
cairo
harfbuzz
icu
graphite2
libX11
potrace
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
/*
deleting the unused packages speeds up configure by a considerable margin
and ensures we do not rebuild existing libraries by mistake
* /
preConfigure = ''
rm - r libs / { cairo , freetype2 , gd , gmp , graphite2 , harfbuzz , icu , libpaper , libpng } \
libs / { mpfr , pixman , xpdf , zlib , zziplib } \
texk / { afm2pl , bibtex-x , chktex , cjkutils , detex , dtl , dvi2tty , dvidvi , dviljk , dviout-util } \
texk / { dvipdfm-x , dvipng , dvipos , dvipsk , dvisvgm , gregorio , gsftopk , kpathsea } \
texk / { lcdf-typetools , makeindexk , makejvf , mendexk , musixtnt , ps2pk , psutils , ptexenc } \
texk / { seetexk , tex4htk , texlive , ttf2pk2 , ttfdump , xdvik } \
utils / { asymptote , autosp , axodraw2 , devnag , lacheck , m-tx , pmx , ps2eps , t1utils , texdoctk } \
utils / { tpic2pdftex , vlna , xindy , xml2pmx , xpdfopen }
mkdir WorkDir
cd WorkDir
'' ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
configureFlags =
common . configureFlags
++ withSystemLibs [
" k p a t h s e a "
" p t e x e n c "
" c a i r o "
" h a r f b u z z "
" i c u "
" g r a p h i t e 2 "
]
++
map ( prog : " - - d i s a b l e - ${ prog } " ) # don't build things we already have
# list from texk/web2c/configure
(
[
" t e x "
" p t e x "
" e p t e x "
" u p t e x "
" e u p t e x "
" a l e p h "
" h i t e x "
" p d f t e x "
" w e b - p r o g s "
" s y n c t e x "
]
++ lib . optionals ( ! withLuaJIT ) [
" l u a j i t t e x "
" l u a j i t h b t e x "
" m f l u a j i t "
]
)
# disable all packages, re-enable upmendex, web2c packages
++ [
" - - d i s a b l e - a l l - p k g s "
" - - e n a b l e - u p m e n d e x "
" - - e n a b l e - w e b 2 c "
]
# kpathsea requires specifying the kpathsea location manually
++ [ " - - w i t h - k p a t h s e a - i n c l u d e s = ${ core . dev } / i n c l u d e " ] ;
configureScript = " . . / c o n f i g u r e " ;
enableParallelBuilding = true ;
doCheck = false ; # fails
outputs =
[
" o u t "
" d e v "
" m a n "
" i n f o "
]
++ ( builtins . map ( builtins . replaceStrings [ " - " ] [ " _ " ] ) coreBigPackages )
# some outputs of metapost, omegaware are for ptex/uptex
++ [
" p t e x "
" u p t e x "
]
# unavoidable duplicates from core
++ [
" c t i e "
" c w e b "
" o m e g a w a r e "
" t e x l i v e _ s c r i p t s _ e x t r a "
" t i e "
" w e b "
] ;
postInstall = common . moveBins ;
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
chktex = stdenv . mkDerivation {
pname = " c h k t e x " ;
inherit ( texlive . pkgs . chktex ) version ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
inherit ( common ) src ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
nativeBuildInputs = [ pkg-config ] ;
# perl used in shebang of script bin/deweb
buildInputs = [
core # kpathsea
perl
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
preConfigure = " c d t e x k / c h k t e x " ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
configureFlags = common . configureFlags ++ [ " - - w i t h - s y s t e m - k p a t h s e a " ] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
enableParallelBuilding = true ;
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
# the LuaMetaTeX engine (distributed since TeX Live 2023) must be built separately
# the sources used by TL are stored in the source TL repo
# for details see https://wiki.contextgarden.net/Building_LuaMetaTeX_for_TeX_Live
context = stdenv . mkDerivation rec {
pname = " l u a m e t a t e x " ;
version = " 2 . 1 0 . 0 8 " ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
src = fetchurl {
url = " h t t p s : / / t u g . o r g / s v n / t e x l i v e / t r u n k / M a s t e r / s o u r c e / l u a m e t a t e x - ${ version } . t a r . x z ? r e v i s i o n = 6 7 0 3 4 & v i e w = c o " ;
hash = " s h a 2 5 6 - 3 J e O U Q 6 3 j J O Z W T x F C o y W j f c r s p m d m C / y q g S 1 J a L f T W k = " ;
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
enableParallelBuilding = true ;
nativeBuildInputs = [
cmake
ninja
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
meta = with lib ; {
description = " T h e L U A M E T A T E X e n g i n e i s a f o l l o w u p o n L U A T E X a n d i s a g a i n p a r t o f C O N T E X T d e v e l o p m e n t " ;
homepage = " h t t p s : / / w w w . p r a g m a - a d e . n l / l u a m e t a t e x - 1 . h t m " ;
license = licenses . gpl2Plus ;
maintainers = with lib . maintainers ; [
apfelkuchen6
xworld21
] ;
} ;
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
dvisvgm = stdenv . mkDerivation rec {
pname = " d v i s v g m " ;
version = " 3 . 2 . 2 " ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
src =
assert lib . assertMsg ( version == texlive . pkgs . dvisvgm . version )
" d v i s v g m : T e X L i v e v e r s i o n ( ${ texlive . pkgs . dvisvgm . version } ) d i f f e r e n t f r o m s o u r c e ( ${ version } ) , p l e a s e u p d a t e d v i s v g m " ;
fetchurl {
url = " h t t p s : / / g i t h u b . c o m / m g i e s e k i / d v i s v g m / r e l e a s e s / d o w n l o a d / ${ version } / d v i s v g m - ${ version } . t a r . g z " ;
hash = " s h a 2 5 6 - 8 G K L 6 l q j M U X X W w p q b d G P r Y i b d S c 4 y 8 A c G U G P N U c 6 H Q A = " ;
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
configureFlags = [
" - - d i s a b l e - m a n p a g e " # man pages are provided by the doc container
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
# PDF handling requires mutool (from mupdf) since Ghostscript 10.01
postPatch = ''
substituteInPlace src/PDFHandler.cpp \
- - replace-fail ' Process ( " m u t o o l " ' " P r o c e s s ( \" $ ( P A T H = " $ HOST_PATH " c o m m a n d - v m u t o o l ) \" "
2024-05-02 00:46:19 +00:00
'' ;
2024-06-30 08:16:52 +00:00
nativeBuildInputs = [ pkg-config ] ;
buildInputs = [
core
brotli
ghostscript
zlib
freetype
woff2
potrace
xxHash
mupdf-headless
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
enableParallelBuilding = true ;
2024-05-02 00:46:19 +00:00
} ;
2024-06-30 08:16:52 +00:00
dvipng = stdenv . mkDerivation {
pname = " d v i p n g " ;
inherit ( texlive . pkgs . dvipng ) version ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
inherit ( common ) src ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
nativeBuildInputs = [
perl
pkg-config
makeWrapper
] ;
buildInputs = [
core # kpathsea
zlib
libpng
freetype
gd
ghostscript
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
preConfigure = ''
cd texk/dvipng
patchShebangs doc/texi2pod.pl
'' ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
configureFlags = common . configureFlags ++ [
" - - w i t h - s y s t e m - k p a t h s e a "
" - - w i t h - g s = y e s "
" - - d i s a b l e - d e b u g "
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
GS = " ${ ghostscript } / b i n / g s " ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
enableParallelBuilding = true ;
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
pygmentex = python3Packages . buildPythonApplication rec {
pname = " p y g m e n t e x " ;
inherit ( src ) version ;
format = " o t h e r " ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
src = assertFixedHash pname texlive . pkgs . pygmentex . tex ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
propagatedBuildInputs = with python3Packages ; [
pygments
chardet
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
dontBuild = true ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
doCheck = false ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
installPhase = ''
runHook preInstall
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
install - D ./scripts/pygmentex/pygmentex.py " $ o u t " /bin/pygmentex
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
runHook postInstall
'' ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
meta = with lib ; {
homepage = " h t t p s : / / w w w . c t a n . o r g / p k g / p y g m e n t e x " ;
description = " A u x i l i a r y t o o l f o r t y p e s e t t i n g c o d e l i s t i n g s i n L a T e X d o c u m e n t s u s i n g P y g m e n t s " ;
longDescription = ''
PygmenTeX is a Python-based LaTeX package that can be used for
typesetting code listings in a LaTeX document using Pygments .
Pygments is a generic syntax highlighter for general use in all kinds of
software such as forum systems , wikis or other applications that need to
prettify source code .
'' ;
license = licenses . lppl13c ;
maintainers = with maintainers ; [ romildo ] ;
} ;
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
asymptote = args . asymptote . overrideAttrs (
finalAttrs : prevAttrs : {
version = texlive . pkgs . asymptote . version ;
# keep local src and patches even if duplicated in the top level asymptote
# so that top level updates do not break texlive
src = fetchurl {
url = " m i r r o r : / / s o u r c e f o r g e / a s y m p t o t e / ${ finalAttrs . version } / a s y m p t o t e - ${ finalAttrs . version } . s r c . t g z " ;
hash = " s h a 2 5 6 - D e c a d D + m 7 p O R u H 3 S d c s / 5 M 3 v U b N 6 r h S k F o N N 0 S o q 9 b s = " ;
} ;
texContainer = texlive . pkgs . asymptote . tex ;
texdocContainer = texlive . pkgs . asymptote . texdoc ;
patches = [
( fetchpatch {
# partial fix for macOS XDR/V3D support (LDFLAGS change seems like an unrelated bugfix)
name = " r e s t o r e - L D F L A G S - d o n t - l o o k - f o r - t i r p c - u n d e r - M a c O S . p a t c h " ;
url = " h t t p s : / / g i t h u b . c o m / v e c t o r g r a p h i c s / a s y m p t o t e / c o m m i t / 7 e 1 7 0 9 6 b 2 2 d 1 8 d 1 3 3 d 1 b c 5 9 1 6 b 6 e 3 2 c 0 c b 2 4 a d 1 0 . p a t c h " ;
hash = " s h a 2 5 6 - o l C F z q f Z w W O A j q l B 5 l D P X Y R H U 9 i 3 V Q N g o R 0 c O 5 T m W 9 8 = " ;
} )
] ;
}
) ;
inherit biber ;
inherit biber-ms ;
bibtexu = bibtex8 ;
bibtex8 = stdenv . mkDerivation {
pname = " b i b t e x - x " ;
inherit ( texlive . pkgs . bibtexu ) version ;
inherit ( common ) src ;
nativeBuildInputs = [ pkg-config ] ;
buildInputs = [
core # kpathsea
icu
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
preConfigure = " c d t e x k / b i b t e x - x " ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
configureFlags = common . configureFlags ++ [
" - - w i t h - s y s t e m - k p a t h s e a "
" - - w i t h - s y s t e m - i c u "
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
enableParallelBuilding = true ;
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
xdvi = stdenv . mkDerivation {
pname = " x d v i " ;
inherit ( texlive . pkgs . xdvi ) version ;
inherit ( common ) src ;
nativeBuildInputs = [ pkg-config ] ;
buildInputs =
[
core # kpathsea
freetype
ghostscript
]
++ ( with xorg ; [
libX11
libXaw
libXi
libXpm
libXmu
libXaw
libXext
libXfixes
] ) ;
preConfigure = " c d t e x k / x d v i k " ;
configureFlags = common . configureFlags ++ [
" - - w i t h - s y s t e m - k p a t h s e a "
" - - w i t h - s y s t e m - l i b g s "
] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
enableParallelBuilding = true ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
postInstall = ''
substituteInPlace " $ o u t / b i n / x d v i " \
- - replace-fail " e x e c x d v i - x a w " " e x e c ' $ o u t / b i n / x d v i - x a w ' "
'' ;
# TODO: it's suspicious that mktexpk generates fonts into ~/.texlive2014
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
xpdfopen = stdenv . mkDerivation {
pname = " x p d f o p e n " ;
inherit ( texlive . pkgs . xpdfopen ) version ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
inherit ( common ) src ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
buildInputs = [ libX11 ] ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
preConfigure = " c d u t i l s / x p d f o p e n " ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
enableParallelBuilding = true ;
} ;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
} # un-indented
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
//
lib . optionalAttrs ( ! clisp . meta . broken ) # broken on aarch64 and darwin (#20062)
{
xindy = stdenv . mkDerivation {
pname = " x i n d y " ;
inherit ( texlive . pkgs . xindy ) version ;
inherit ( common ) src ;
# If unset, xindy will try to mkdir /homeless-shelter
HOME = " . " ;
prePatch = " c d u t i l s / x i n d y " ;
# hardcode clisp location
postPatch = ''
substituteInPlace xindy- * /user-commands/xindy.in \
- - replace-fail " o u r \$ c l i s p = ( \$ i s _ w i n d o w s ? ' c l i s p . e x e ' : ' c l i s p ' ) ; " \
" o u r \$ c l i s p = ' $ ( t y p e - P c l i s p ) ' ; " \
- - replace-fail ' die " $ c m d : C a n n o t l o c a t e x i n d y m o d u l e s d i r e c t o r y " ; ' \
' $ modules_dir = " ${ texlive . pkgs . xindy . tex } / x i n d y / m o d u l e s " ; die " $ c m d : C a n n o t l o c a t e x i n d y m o d u l e s d i r e c t o r y " unless - d $ modules_dir ; '
'' ;
nativeBuildInputs = [
pkg-config
perl
] ;
buildInputs = [
clisp
libiconv
perl
] ;
configureFlags = [
" - - w i t h - c l i s p - r u n t i m e = s y s t e m "
" - - d i s a b l e - x i n d y - d o c s "
" - - d i s a b l e - x i n d y - r u l e s "
] ;
preInstall = '' m k d i r - p " $o u t / b i n " '' ;
# fixup various file-location errors of: lib/xindy/{xindy.mem,modules/}
postInstall = ''
mkdir - p " $ o u t / l i b / x i n d y "
mv " $ o u t " / { bin/xindy.mem , lib/xindy / }
'' ;
} ;
}