diff options
Diffstat (limited to 'pkgs/tools/typesetting')
35 files changed, 1435 insertions, 0 deletions
diff --git a/pkgs/tools/typesetting/tex/auctex/default.nix b/pkgs/tools/typesetting/tex/auctex/default.nix new file mode 100644 index 0000000000000..6ca85167aedab --- /dev/null +++ b/pkgs/tools/typesetting/tex/auctex/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchurl, emacs, texLive }: + +stdenv.mkDerivation ( rec { + pname = "auctex"; + version = "11.85"; + name = "${pname}-${version}"; + + meta = { + description = "AUCTeX is an extensible package for writing and formatting TeX files in GNU Emacs and XEmacs."; + homepage = http://www.gnu.org/software/auctex; + }; + + src = fetchurl { + url = "http://ftp.gnu.org/pub/gnu/${pname}/${name}.tar.gz"; + sha256 = "aebbea00431f8fd1e6be6519d9cc28e974942000737f956027da2c952a6d304e"; + }; + + buildInputs = [ emacs texLive ]; + + configureFlags = [ + "--with-lispdir=\${out}/share/emacs/site-lisp" + "--disable-preview" + ]; +}) diff --git a/pkgs/tools/typesetting/tex/dblatex/default.nix b/pkgs/tools/typesetting/tex/dblatex/default.nix new file mode 100644 index 0000000000000..05f4bd7a9fa14 --- /dev/null +++ b/pkgs/tools/typesetting/tex/dblatex/default.nix @@ -0,0 +1,22 @@ +{ stdenv, fetchurl, python, libxslt, tetex }: + +stdenv.mkDerivation rec { + name = "dblatex-0.3.2"; + + src = fetchurl { + url = "mirror://sourceforge/dblatex/${name}.tar.bz2"; + sha256 = "0jg2acv2lyrbw06l8rr0id75lj1pws7xbsmryq58r3n13xzb1p7b"; + }; + + buildPhase = "true"; + + installPhase = "python ./setup.py install --prefix=$out"; + + buildInputs = [ python libxslt tetex ]; + + meta = { + description = "A program to convert DocBook to DVI, PostScript or PDF via LaTeX or ConTeXt"; + homepage = http://dblatex.sourceforge.net/; + license = "GPL"; + }; +} diff --git a/pkgs/tools/typesetting/tex/disser/default.nix b/pkgs/tools/typesetting/tex/disser/default.nix new file mode 100644 index 0000000000000..eee695ea3e9c9 --- /dev/null +++ b/pkgs/tools/typesetting/tex/disser/default.nix @@ -0,0 +1,56 @@ +x@{builderDefsPackage + , unzip, texLive, texLiveCMSuper, texLiveAggregationFun + , ...}: +builderDefsPackage +(a : +let + helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ + ["texLive" "texLiveCMSuper" "texLiveAggregationFun"]; + + buildInputs = map (n: builtins.getAttr n x) + (builtins.attrNames (builtins.removeAttrs x helperArgNames)) + ++ [(a.texLiveAggregationFun {paths=[a.texLive a.texLiveCMSuper];})]; + sourceInfo = rec { + baseName="disser"; + version="1.1.8"; + name="${baseName}-${version}"; + project="${baseName}"; + url="mirror://sourceforge/project/${project}/${baseName}/${version}/${name}.zip"; + hash="15509hfcvkk5kfcza149c74qpamwgw88dg0ra749axs8xj8qmlw8"; + }; +in +rec { + src = a.fetchurl { + url = sourceInfo.url; + sha256 = sourceInfo.hash; + }; + + inherit (sourceInfo) name version; + inherit buildInputs; + + /* doConfigure should be removed if not needed */ + phaseNames = ["setVars" "doMakeInstall"]; + + setVars = a.noDepEntry '' + export HOME="$TMPDIR" + ''; + + makeFlags = ["DESTDIR=$out/share/texmf-dist"]; + + meta = { + description = "Russian PhD thesis LaTeX package"; + maintainers = with a.lib.maintainers; + [ + raskin + ]; + platforms = with a.lib.platforms; + linux; # platform-independent + license = "free"; # LaTeX Project Public License + }; + passthru = { + updateInfo = { + downloadPage = "http://sourceforge.net/projects/disser/files/disser/"; + }; + }; +}) x + diff --git a/pkgs/tools/typesetting/tex/latex2html/default.nix b/pkgs/tools/typesetting/tex/latex2html/default.nix new file mode 100644 index 0000000000000..354cb6d22b0e5 --- /dev/null +++ b/pkgs/tools/typesetting/tex/latex2html/default.nix @@ -0,0 +1,23 @@ +{stdenv, fetchurl, tex, perl, netpbm, ghostscript}: + +stdenv.mkDerivation { + name = "latex2html-2002-1"; + + buildInputs = [ tex perl ghostscript netpbm ]; + + preConfigure = '' + configureFlags="--with-texpath=$out/share/texmf-nix"; + ''; + + src = fetchurl { + url = mirror://ubuntu/pool/multiverse/l/latex2html/latex2html_2002-2-1-20050114.orig.tar.gz; + sha256 = "22049a77cf88a647776e61e06800ace4f9a06afc6ffe2590574487f023d0881f"; + }; + + meta = { + homepage = http://www.latex2html.org/; + license = "unfree-redistributable"; + description = "Convertor written in Perl that converts LaTeX documents to HTML"; + }; + +} diff --git a/pkgs/tools/typesetting/tex/lazylist/builder.sh b/pkgs/tools/typesetting/tex/lazylist/builder.sh new file mode 100644 index 0000000000000..140b07f7be70e --- /dev/null +++ b/pkgs/tools/typesetting/tex/lazylist/builder.sh @@ -0,0 +1,13 @@ +source $stdenv/setup + +buildPhase=true + +installPhase=myInstallPhase +myInstallPhase() { + ensureDir "$out/share/texmf-nix/tex/latex/lazylist" + cp lazylist.sty "$out/share/texmf-nix/tex/latex/lazylist" +} + +genericBuild + + diff --git a/pkgs/tools/typesetting/tex/lazylist/default.nix b/pkgs/tools/typesetting/tex/lazylist/default.nix new file mode 100644 index 0000000000000..19637793b00d6 --- /dev/null +++ b/pkgs/tools/typesetting/tex/lazylist/default.nix @@ -0,0 +1,15 @@ +{stdenv, fetchurl, tetex}: + +stdenv.mkDerivation { + name = "lazylist-1.0a"; + builder = ./builder.sh; + + src = fetchurl { + url = http://www.iai.uni-bonn.de/~loeh/lhs2tex/lazylist-1.0a.tar.bz2; + md5 = "8ef357df5845bd8d6075fca6e1f214ab"; + }; + + buildInputs = [tetex]; + + inherit tetex; +} diff --git a/pkgs/tools/typesetting/tex/lkproof/default.nix b/pkgs/tools/typesetting/tex/lkproof/default.nix new file mode 100644 index 0000000000000..2d3a1e5f19cc2 --- /dev/null +++ b/pkgs/tools/typesetting/tex/lkproof/default.nix @@ -0,0 +1,17 @@ +{stdenv, fetchurl, unzip}: + +stdenv.mkDerivation { + name = "lkproof-3.1"; + + src = fetchurl { + url = http://mirror.ctan.org/macros/latex/contrib/lkproof.zip; + sha256 = "1qjkjhpc4rm62qxn18r83zdlwnj1wvnkcpdiqlv7w4bakh0gvjly"; + }; + + buildInputs = [ unzip ]; + + installPhase = " + ensureDir $out/share/texmf-nix/tex/generic/lkproof + cp -prd *.sty $out/share/texmf-nix/tex/generic/lkproof + "; +} diff --git a/pkgs/tools/typesetting/tex/nix/animatedot.sh b/pkgs/tools/typesetting/tex/nix/animatedot.sh new file mode 100644 index 0000000000000..2e1868d4bebdd --- /dev/null +++ b/pkgs/tools/typesetting/tex/nix/animatedot.sh @@ -0,0 +1,9 @@ +source $stdenv/setup + +ensureDir $out + +for ((i = 1; i <= $nrFrames; i++)); do + echo "producing frame $i..."; + targetName=$out/$(basename $(stripHash $dotGraph; echo $strippedName) .dot)-f-$i.dot + cpp -DFRAME=$i < $dotGraph > $targetName +done diff --git a/pkgs/tools/typesetting/tex/nix/copy-includes.pl b/pkgs/tools/typesetting/tex/nix/copy-includes.pl new file mode 100644 index 0000000000000..2cec62fc7cb66 --- /dev/null +++ b/pkgs/tools/typesetting/tex/nix/copy-includes.pl @@ -0,0 +1,43 @@ +use strict; +use File::Basename; + +sub createDirs; +sub createDirs { + my $path = shift; + return unless $path =~ /^(.*)\/([^\/]*)$/; + my $dir = $1; + return if -d $dir; + return if -e $dir; + createDirs $dir; + mkdir $dir or die "cannot create directory `$dir'"; +} + +my $maxParents = 0; +for (my $n = 0; $n < @ARGV; $n += 2) { + my $fullPath = $ARGV[$n]; + my $relPath = $ARGV[$n + 1]; + my $parents = 0; + foreach my $comp (split /\//, $relPath) { + $parents++ if ($comp eq "..") + } + $maxParents = $parents if $parents > $maxParents; +} + +my $startDir = "./"; +for (my $n = 0; $n < $maxParents; $n++) { + $startDir .= "dotdot/"; + mkdir "$startDir" or die "cannot create directory `$startDir': $!"; +} + +chdir $startDir or die; + +for (my $n = 0; $n < @ARGV; $n += 2) { + my $fullPath = $ARGV[$n]; + my $relPath = $ARGV[$n + 1]; + + createDirs $relPath; + + symlink $fullPath, $relPath or die "cannot create symlink `$relPath'"; +} + +print "$startDir\n"; diff --git a/pkgs/tools/typesetting/tex/nix/default.nix b/pkgs/tools/typesetting/tex/nix/default.nix new file mode 100644 index 0000000000000..f5a34fb67a2c3 --- /dev/null +++ b/pkgs/tools/typesetting/tex/nix/default.nix @@ -0,0 +1,244 @@ +pkgs: + +rec { + + + runLaTeX = + { rootFile + , generatePDF ? true # generate PDF, not DVI + , generatePS ? false # generate PS in addition to DVI + , extraFiles ? [] + , compressBlanksInIndex ? true + , packages ? [] + , copySources ? false + }: + + assert generatePDF -> !generatePS; + + pkgs.stdenv.mkDerivation { + name = "doc"; + + builder = ./run-latex.sh; + copyIncludes = ./copy-includes.pl; + + inherit rootFile generatePDF generatePS extraFiles + compressBlanksInIndex copySources; + + includes = map (x: [x.key (baseNameOf (toString x.key))]) + (findLaTeXIncludes {inherit rootFile;}); + + buildInputs = [ pkgs.tetex pkgs.perl ] ++ packages; + }; + + + # Returns the closure of the "dependencies" of a LaTeX source file. + # Dependencies are other LaTeX source files (e.g. included using + # \input{}), images (e.g. \includegraphics{}), bibliographies, and + # so on. + findLaTeXIncludes = + { rootFile + }: + + builtins.genericClosure { + startSet = [{key = rootFile;}]; + + operator = + {key, ...}: + + let + + # `find-includes.pl' returns the dependencies of the current + # source file (`key') as a list, e.g. [{type = "tex"; name = + # "introduction.tex";} {type = "img"; name = "example"}]. + # The type denotes the kind of dependency, which determines + # what extensions we use to look for it. + deps = import (pkgs.runCommand "latex-includes" + { rootFile = baseNameOf (toString rootFile); src = key; } + "${pkgs.perl}/bin/perl ${./find-includes.pl}"); + + # Look for the dependencies of `key', trying various + # extensions determined by the type of each dependency. + # TODO: support a search path. + foundDeps = dep: xs: + let + exts = + if dep.type == "img" then [".pdf" ".png" ".ps" ".jpg"] + else if dep.type == "tex" then [".tex" ""] + else [""]; + fn = pkgs.lib.findFirst (fn: builtins.pathExists fn) null + (map (ext: "${dirOf key}/${dep.name}${ext}") exts); + in if fn != null then [{key = fn;}] ++ xs + else xs; + + in pkgs.lib.fold foundDeps [] deps; + }; + + + findLhs2TeXIncludes = + { rootFile + }: + + builtins.genericClosure { + startSet = [{key = rootFile;}]; + + operator = + {key, ...}: + + let + + deps = import (pkgs.runCommand "lhs2tex-includes" + { src = key; } + "${pkgs.stdenv.bash}/bin/bash ${./find-lhs2tex-includes.sh}"); + + in pkgs.lib.concatMap (x : if builtins.pathExists x then [{key = x;}] else []) + (map (x : "${dirOf key}/${x}") deps); + }; + + dot2pdf = + { dotGraph + }: + + pkgs.stdenv.mkDerivation { + name = "pdf"; + builder = ./dot2pdf.sh; + inherit dotGraph fontsConf; + buildInputs = [ + pkgs.perl pkgs.tetex pkgs.graphviz + ]; + }; + + + dot2ps = + { dotGraph + }: + + pkgs.stdenv.mkDerivation { + name = "ps"; + builder = ./dot2ps.sh; + inherit dotGraph; + buildInputs = [ + pkgs.perl pkgs.tetex pkgs.graphviz pkgs.ghostscript + ]; + }; + + lhs2tex = + { source, flags ? null } : + pkgs.stdenv.mkDerivation { + name = "tex"; + builder = ./lhs2tex.sh; + inherit source flags; + buildInputs = [ pkgs.lhs2tex pkgs.perl ]; + copyIncludes = ./copy-includes.pl; + includes = map (x: [x.key (baseNameOf (toString x.key))]) + (findLhs2TeXIncludes {rootFile = source;}); + }; + + animateDot = dotGraph: nrFrames: pkgs.stdenv.mkDerivation { + name = "dot-frames"; + builder = ./animatedot.sh; + inherit dotGraph nrFrames; + }; + + + # Wrap a piece of TeX code in a document. Useful when generating + # inline images from TeX code. + wrapSimpleTeX = + { preamble ? null + , body + , name ? baseNameOf (toString body) + }: + + pkgs.stdenv.mkDerivation { + inherit name preamble body; + buildCommand = '' + touch $out + echo '\documentclass{article}' >> $out + echo '\pagestyle{empty}' >> $out + if test -n "$preamble"; then cat $preamble >> $out; fi + echo '\begin{document}' >> $out + cat $body >> $out + echo '\end{document}' >> $out + ''; + }; + + + # Convert a Postscript file to a PNG image, trimming it so that + # there is no unnecessary surrounding whitespace. + postscriptToPNG = + { postscript + }: + + pkgs.stdenv.mkDerivation { + name = "png"; + inherit postscript; + + buildInputs = [pkgs.imagemagick pkgs.ghostscript]; + + buildCommand = '' + if test -d $postscript; then + input=$(ls $postscript/*.ps) + else + input=$(stripHash $postscript; echo $strippedName) + ln -s $postscript $input + fi + + ensureDir $out + convert -units PixelsPerInch \ + -density 600 \ + -trim \ + -matte \ + -transparent '#ffffff' \ + -type PaletteMatte \ + +repage \ + $input \ + "$out/$(basename $input .ps).png" + ''; # */ + }; + + + # Convert a piece of TeX code to a PNG image. + simpleTeXToPNG = + { preamble ? null + , body + , name ? baseNameOf (toString body) + , packages ? [] + }: + + postscriptToPNG { + postscript = runLaTeX { + rootFile = wrapSimpleTeX { + inherit body preamble; + }; + inherit packages; + generatePDF = false; + generatePS = true; + }; + }; + + + # Convert a piece of TeX code to a PDF. + simpleTeXToPDF = + { preamble ? null + , body + , name ? baseNameOf (toString body) + , packages ? [] + }: + + runLaTeX { + rootFile = wrapSimpleTeX { + inherit body preamble; + }; + inherit packages; + }; + + + # Some tools (like dot) need a fontconfig configuration file. + # This should be extended to allow the called to add additional + # fonts. + fontsConf = pkgs.makeFontsConf { + fontDirectories = [ + "${pkgs.ghostscript}/share/ghostscript/fonts" + ]; + }; + +} diff --git a/pkgs/tools/typesetting/tex/nix/dot2pdf.sh b/pkgs/tools/typesetting/tex/nix/dot2pdf.sh new file mode 100644 index 0000000000000..0a9610c00ff21 --- /dev/null +++ b/pkgs/tools/typesetting/tex/nix/dot2pdf.sh @@ -0,0 +1,20 @@ +source $stdenv/setup + +ensureDir $out + +dot2pdf() { + sourceFile=$1 + targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).pdf + echo "converting $sourceFile to $targetName..." + export FONTCONFIG_FILE=$fontsConf + dot -Tpdf $sourceFile > $targetName +} + +for i in $dotGraph; do + if test -d $i; then + for j in $i/*; do dot2pdf $j; done + else + dot2pdf $i + fi +done + diff --git a/pkgs/tools/typesetting/tex/nix/dot2ps.sh b/pkgs/tools/typesetting/tex/nix/dot2ps.sh new file mode 100644 index 0000000000000..1269108d6f521 --- /dev/null +++ b/pkgs/tools/typesetting/tex/nix/dot2ps.sh @@ -0,0 +1,19 @@ +source $stdenv/setup + +ensureDir $out + +dot2ps() { + sourceFile=$1 + targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).ps + echo "converting $sourceFile to $targetName..." + dot -Tps $sourceFile > $targetName +} + +for i in $dotGraph; do + if test -d $i; then + for j in $i/*; do dot2ps $j; done + else + dot2ps $i + fi +done + diff --git a/pkgs/tools/typesetting/tex/nix/find-includes.pl b/pkgs/tools/typesetting/tex/nix/find-includes.pl new file mode 100644 index 0000000000000..41675e939f60c --- /dev/null +++ b/pkgs/tools/typesetting/tex/nix/find-includes.pl @@ -0,0 +1,69 @@ +use strict; +use File::Basename; + +my $src = $ENV{"src"}; +my $out = $ENV{"out"}; +my $path = $ENV{"searchRelativeTo"}; + +open OUT, ">$out" or die; +print OUT "[\n"; + +open FILE, "< $src" or die; + +sub addName { + my ($type, $name) = @_; + print OUT "{ type = \"$type\"; name = \"$name\"; }\n"; +} + +while (<FILE>) { + if (/\\input\{(.*)\}/) { + my $fn2 = $1; + die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; + addName "tex", "$fn2"; + } elsif (/\\input (.*)$/) { + my $fn2 = $1; + die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; + addName "tex", "$fn2"; + } elsif (/\\RequirePackage(\[.*\])?\{(.*)\}/) { + my $fn2 = $2; + die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; + addName "misc", "$fn2.sty"; + } elsif (/\\usepackage(\[.*\])?\{(.*)\}/) { + my $fn2 = $2; + die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; + addName "misc", "$fn2.sty"; + } elsif (/\\documentclass(\[.*\])?\{(.*)\}/) { + my $fn2 = $2; + die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; + addName "misc", "$fn2.cls"; + } elsif (/\\bibliographystyle\{(.*)\}/) { + my $fn2 = $1; + die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; + addName "misc", "$fn2.bst"; + } elsif (/\\bibliography\{(.*)\}/) { + foreach my $bib (split /,/, $1) { + $bib =~ s/^\s+//; # remove leading / trailing whitespace + $bib =~ s/\s+$//; + addName "misc", "$bib.bib"; + addName "misc", (basename($ENV{"rootFile"}, ".tex", ".ltx") . ".bbl"); + } + } elsif (/\\includegraphics(\[.*\])?\{(.*)\}/) { + my $fn2 = $2; + die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; + addName "img", "$fn2"; + } elsif (/\\pgfdeclareimage(\[.*\])?\{.*\}\{(.*)\}/) { + my $fn2 = $2; + die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; + addName "img", "$fn2"; + } elsif (/\\pgfimage(\[.*\])?\{(.*)\}/) { + my $fn2 = $2; + die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; + addName "img", "$fn2"; + } + # !!! also support \usepackage +} + +close FILE; + +print OUT "]\n"; +close OUT; diff --git a/pkgs/tools/typesetting/tex/nix/find-lhs2tex-includes.sh b/pkgs/tools/typesetting/tex/nix/find-lhs2tex-includes.sh new file mode 100644 index 0000000000000..2dc12aa517a74 --- /dev/null +++ b/pkgs/tools/typesetting/tex/nix/find-lhs2tex-includes.sh @@ -0,0 +1,3 @@ +echo '[' > $out +grep '^%include ' $src | cut -d ' ' -f 2 | sed 's/^\(.*\)$/"\1"/' >> $out +echo ']' >> $out diff --git a/pkgs/tools/typesetting/tex/nix/lhs2tex.sh b/pkgs/tools/typesetting/tex/nix/lhs2tex.sh new file mode 100644 index 0000000000000..6edca4baf8a02 --- /dev/null +++ b/pkgs/tools/typesetting/tex/nix/lhs2tex.sh @@ -0,0 +1,19 @@ +source $stdenv/setup + +ensureDir $out + +mkdir root +cd root + +startDir=$(perl $copyIncludes $includes) +cd $startDir + +lhstex() { + sourceFile=$1 + targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .lhs).tex + echo "converting $sourceFile to $targetName..." + lhs2TeX -o "$targetName" $flags "$sourceFile" +} + +lhstex $source + diff --git a/pkgs/tools/typesetting/tex/nix/run-latex.sh b/pkgs/tools/typesetting/tex/nix/run-latex.sh new file mode 100644 index 0000000000000..6c18721eed6ba --- /dev/null +++ b/pkgs/tools/typesetting/tex/nix/run-latex.sh @@ -0,0 +1,165 @@ +source $stdenv/setup + +ensureDir $out + +export TEXMFCNF=$TMPDIR: +echo 'max_print_line = 8192' >> $TMPDIR/texmf.cnf + +mkdir root +cd root + +startDir=$(perl $copyIncludes $includes) +cd $startDir + +for i in $extraFiles; do + if test -d $i; then + ln -s $i/* . + else + ln -s $i $(stripHash $i; echo $strippedName) + fi +done + +rootName=$(basename $(stripHash "$rootFile"; echo $strippedName)) + +rootNameBase=$(echo "$rootName" | sed 's/\..*//') + +if test -n "$generatePDF"; then + latex=pdflatex +else + latex=latex +fi + +latexFlags="-file-line-error" +tmpFile=$out/log + +showError() { + echo + echo "LATEX ERROR (LAST LOG LINES SHOWN):" + tail -n 20 $tmpFile + bzip2 $tmpFile + exit 1 +} + +runLaTeX() { + if ! $latex $latexFlags $rootName >$tmpFile 2>&1; then showError; fi + runNeeded= + if fgrep -q \ + -e "LaTeX Warning: Label(s) may have changed." \ + -e "Rerun to get citations correct." \ + "$tmpFile"; then + runNeeded=1 + fi +} + +echo + + +if test -n "$copySources"; then + cp -prd $TMPDIR/root $out/tex-srcs +fi + + +echo "PASS 1..." +runLaTeX +echo + + +for auxFile in $(find . -name "*.aux"); do + # Run bibtex to process all bibliographies. There may be several + # when we're using the multibib package. + if grep -q '\\citation' $auxFile; then + auxBase=$(basename $auxFile .aux) + if [ -e $auxBase.bbl ]; then + echo "SKIPPING BIBTEX ON $auxFile!" + else + echo "RUNNING BIBTEX ON $auxFile..." + bibtex --terse $auxBase + cp $auxBase.bbl $out + runNeeded=1 + fi + echo + fi + + # "\pgfsyspdfmark" in the aux file seems to indicate that PGF/TikZ + # requires a second run (e.g. to resolve arrows between pictures). + if grep -q pgfsyspdfmark $auxFile; then + runNeeded=1 + fi +done + + +if test "$runNeeded"; then + echo "PASS 2..." + runLaTeX + echo +fi + + +if test -f $rootNameBase.idx; then + echo "MAKING INDEX..." + if test -n "$compressBlanksInIndex"; then + makeindexFlags="$makeindexFlags -c" + fi + makeindex $makeindexFlags $rootNameBase.idx + runNeeded=1 + echo +fi + + +if test "$runNeeded"; then + echo "PASS 3..." + runLaTeX + echo +fi + + +if test "$runNeeded"; then + echo "PASS 4..." + runLaTeX + echo +fi + + +if test "$runNeeded"; then + echo "Hm, still not done :-(" + echo +fi + + +if test -n "$generatePDF"; then + cp $rootNameBase.pdf $out +else + cp $rootNameBase.dvi $out + if test -n "$generatePS"; then + echo "CONVERTING TO POSTSCRIPT..." + dvips $rootNameBase.dvi -o $out/$rootNameBase.ps + echo + fi +fi + + +echo "WARNINGS:" +cat $tmpFile | grep "Warning:" | grep -v "Citation.*undefined" || true + +echo +echo "OVERFULL/UNDERFULL:" +cat $tmpFile | egrep "Overfull|Underfull" || true + +echo +echo "UNDEFINED REFERENCES:" +cat $tmpFile | grep "Reference.*undefined" || true + +echo +echo "UNDEFINED CITATIONS:" +cat $tmpFile | grep "Citation.*undefined" || true + +echo +echo "STATS:" +printf "%5d overfull/underfull h/vboxes\n" $(cat $tmpFile | egrep -c "Overfull|Underfull" || true) +printf "%5d undefined references\n" $(cat $tmpFile | grep -c "Reference.*undefined" || true) +printf "%5d undefined citations\n" $(cat $tmpFile | grep -c "Citation.*undefined" || true) +printf "%5d pages\n" \ + $(cat $tmpFile | grep "Output written.*(.*pages" | sed "s/.*(\([0-9]*\) pages.*/\1/" || true) +echo + +bzip2 $tmpFile diff --git a/pkgs/tools/typesetting/tex/pgf/1.x.nix b/pkgs/tools/typesetting/tex/pgf/1.x.nix new file mode 100644 index 0000000000000..672ae6fdfce4d --- /dev/null +++ b/pkgs/tools/typesetting/tex/pgf/1.x.nix @@ -0,0 +1,16 @@ +{stdenv, fetchurl}: + +stdenv.mkDerivation { + name = "pgf-1.10"; + + src = fetchurl { + url = mirror://sourceforge/pgf/pgf-1.10.tar.gz; + sha256 = "1y605wmjxryphh0y5zgzvdq6xjxb2bjb95j36d4wg1a7n93ksswl"; + }; + + buildPhase = "true"; + installPhase = " + ensureDir $out/share/texmf-nix + cp -prd * $out/share/texmf-nix + "; +} diff --git a/pkgs/tools/typesetting/tex/pgf/2.x.nix b/pkgs/tools/typesetting/tex/pgf/2.x.nix new file mode 100644 index 0000000000000..5e73d12959c6d --- /dev/null +++ b/pkgs/tools/typesetting/tex/pgf/2.x.nix @@ -0,0 +1,17 @@ +{stdenv, fetchurl}: + +stdenv.mkDerivation { + name = "pgf-2.00"; + + src = fetchurl { + url = mirror://sourceforge/pgf/pgf-2.00.tar.gz; + sha256 = "0j57niag4jb2k0iyrvjsannxljc3vkx0iag7zd35ilhiy4dh6264"; + }; + + buildPhase = "true"; + + installPhase = " + ensureDir $out/share/texmf-nix + cp -prd * $out/share/texmf-nix + "; +} diff --git a/pkgs/tools/typesetting/tex/polytable/builder.sh b/pkgs/tools/typesetting/tex/polytable/builder.sh new file mode 100644 index 0000000000000..1138b8e67896d --- /dev/null +++ b/pkgs/tools/typesetting/tex/polytable/builder.sh @@ -0,0 +1,18 @@ +source $stdenv/setup + +buildPhase=true + +installPhase=myInstallPhase +myInstallPhase() { + ensureDir "$out/share/texmf-nix/tex/latex/polytable" + ensureDir "$out/share/texmf-nix/doc/latex/polytable" + latex polytable.ins + pdflatex polytable.dtx + pdflatex polytable.dtx + cp polytable.sty "$out/share/texmf-nix/tex/latex/polytable" + cp polytable.pdf "$out/share/texmf-nix/doc/latex/polytable" + ensureDir "$out/nix-support" + echo "$propagatedUserEnvPackages" > "$out/nix-support/propagated-user-env-packages" +} + +genericBuild diff --git a/pkgs/tools/typesetting/tex/polytable/default.nix b/pkgs/tools/typesetting/tex/polytable/default.nix new file mode 100644 index 0000000000000..71674d85b0421 --- /dev/null +++ b/pkgs/tools/typesetting/tex/polytable/default.nix @@ -0,0 +1,19 @@ +{stdenv, fetchurl, tetex, lazylist}: + +#assert tetex == lazylist.tetex; + +stdenv.mkDerivation { + name = "polytable-0.8.2"; + builder = ./builder.sh; + + src = fetchurl { + url = http://www.iai.uni-bonn.de/~loeh/polytable-0.8.2.tar.gz; + md5 = "c59edf035ae6e19b64b1ae920fea28e7"; + }; + + buildInputs = [tetex]; + propagatedBuildInputs = [lazylist]; + propagatedUserEnvPackages = [lazylist]; + + inherit tetex; +} diff --git a/pkgs/tools/typesetting/tex/tetex/default.nix b/pkgs/tools/typesetting/tex/tetex/default.nix new file mode 100644 index 0000000000000..5e0fb38c3bd50 --- /dev/null +++ b/pkgs/tools/typesetting/tex/tetex/default.nix @@ -0,0 +1,44 @@ +{ stdenv, fetchurl, flex, bison, zlib, libpng, ncurses, ed }: + +stdenv.mkDerivation { + name = "tetex-3.0"; + + src = fetchurl { + url = ftp://cam.ctan.org/tex-archive/systems/unix/teTeX/current/distrib/tetex-src-3.0.tar.gz; + md5 = "944a4641e79e61043fdaf8f38ecbb4b3"; + }; + + texmf = fetchurl { + url = ftp://cam.ctan.org/tex-archive/systems/unix/teTeX/current/distrib/tetex-texmf-3.0.tar.gz; + md5 = "11aa15c8d3e28ee7815e0d5fcdf43fd4"; + }; + + buildInputs = [ flex bison zlib libpng ncurses ed ]; + + patches = [ ./environment.patch ./getline.patch ]; + + setupHook = ./setup-hook.sh; + + configureFlags = + [ "--disable-multiplatform" + "--without-x11" + "--without-xdvik" + "--without-oxdvik" + "--without-texinfo" + "--without-texi2html" + "--with-system-zlib" + "--with-system-pnglib" + "--with-system-ncurses" + ]; + + postUnpack = + '' + ensureDir $out/share/texmf + ensureDir $out/share/texmf-dist + gunzip < $texmf | (cd $out/share/texmf-dist && tar xvf -) + ''; + + meta = { + description = "A full-featured (La)TeX distribution"; + }; +} diff --git a/pkgs/tools/typesetting/tex/tetex/environment.patch b/pkgs/tools/typesetting/tex/tetex/environment.patch new file mode 100644 index 0000000000000..6e652849b773b --- /dev/null +++ b/pkgs/tools/typesetting/tex/tetex/environment.patch @@ -0,0 +1,35 @@ +diff -rc --exclude=texmf.in tetex-src-3.0.orig/texk/kpathsea/texmf.in-teTeX tetex-src-3.0/texk/kpathsea/texmf.in-teTeX +*** tetex-src-3.0.orig/texk/kpathsea/texmf.in-teTeX 2006-01-27 17:33:11.000000000 +0100 +--- tetex-src-3.0/texk/kpathsea/texmf.in-teTeX 2006-01-27 17:38:35.000000000 +0100 +*************** +*** 104,109 **** +--- 104,115 ---- + % TEXMFCONFIG = @texmf@-config + TEXMFCONFIG = $HOME/.texmf-config + ++ % TEXMFNIX is supposed to be unset. It's used by the Nix ++ % system to add trees during the build of nix-expressions. ++ ++ % TEXMFNIXHOME, for packages in the user environment. ++ TEXMFNIXHOME = $HOME/.nix-profile/share/texmf-nix ++ + % Now, list all the texmf trees. If you have multiple trees you can + % use shell brace notation, like this: + % TEXMF = {$TEXMFHOME,!!$TEXMFLOCAL,!!$TEXMFMAIN} +*************** +*** 111,117 **** + % + % For texconfig to work properly, TEXMFCONGIG and TEXMFVAR should be named + % explicitly and before all other trees. +! TEXMF = {!!$TEXMFCONFIG,!!$TEXMFVAR,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFMAIN,!!$TEXMFLOCAL,!!$TEXMFDIST} + + % The system trees. These are the trees that are shared by all the users. + SYSTEXMF = $TEXMFLOCAL;$TEXMFMAIN;$TEXMFDIST +--- 117,123 ---- + % + % For texconfig to work properly, TEXMFCONGIG and TEXMFVAR should be named + % explicitly and before all other trees. +! TEXMF = {!!$TEXMFCONFIG,!!$TEXMFVAR,$TEXMFNIX,$TEXMFHOME,$TEXMFNIXHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFMAIN,!!$TEXMFLOCAL,!!$TEXMFDIST} + + % The system trees. These are the trees that are shared by all the users. + SYSTEXMF = $TEXMFLOCAL;$TEXMFMAIN;$TEXMFDIST diff --git a/pkgs/tools/typesetting/tex/tetex/getline.patch b/pkgs/tools/typesetting/tex/tetex/getline.patch new file mode 100644 index 0000000000000..c82c1b3ac360f --- /dev/null +++ b/pkgs/tools/typesetting/tex/tetex/getline.patch @@ -0,0 +1,96 @@ +Glibc 2.10 has a `getline' symbol that clashes with teTeX's. +Taken from http://lists.ibiblio.org/pipermail/sm-commit/2009-July/024831.html + +diff -rc -x '*~' tetex-src-3.0-orig/texk/dvipsk/afm2tfm.c tetex-src-3.0/texk/dvipsk/afm2tfm.c +*** tetex-src-3.0-orig/texk/dvipsk/afm2tfm.c 2005-01-30 14:17:09.000000000 +0100 +--- tetex-src-3.0/texk/dvipsk/afm2tfm.c 2010-02-03 13:50:21.000000000 +0100 +*************** +*** 257,263 **** + } + + int +! getline P1H(void) { + register char *p ; + register int c ; + +--- 257,263 ---- + } + + int +! tetex_getline P1H(void) { + register char *p ; + register int c ; + +*************** +*** 606,612 **** + ai = newchar() ; + ai->adobenum = -1 ; + ai->adobename = "||" ; /* boundary character name */ +! while (getline()) { + switch(interest(paramstring())) { + case FontName: + fontname = paramnewstring() ; +--- 606,612 ---- + ai = newchar() ; + ai->adobenum = -1 ; + ai->adobename = "||" ; /* boundary character name */ +! while (tetex_getline()) { + switch(interest(paramstring())) { + case FontName: + fontname = paramnewstring() ; +*************** +*** 1882,1888 **** + + while (1) { + while (param == 0 || *param == 0) { +! if (getline() == 0) + error("! premature end in encoding file") ; + for (p=buffer; *p; p++) + if (*p == '%') { +--- 1882,1888 ---- + + while (1) { + while (param == 0 || *param == 0) { +! if (tetex_getline() == 0) + error("! premature end in encoding file") ; + for (p=buffer; *p; p++) + if (*p == '%') { +*************** +*** 1973,1979 **** + p = gettoken() ; + if (strcmp(p, "]")) + error("! token 258 in encoding must be make-array (])") ; +! while (getline()) { + for (p=buffer; *p; p++) + if (*p == '%') { + if (ignoreligkern == 0) +--- 1973,1979 ---- + p = gettoken() ; + if (strcmp(p, "]")) + error("! token 258 in encoding must be make-array (])") ; +! while (tetex_getline()) { + for (p=buffer; *p; p++) + if (*p == '%') { + if (ignoreligkern == 0) +diff -rc -x '*~' tetex-src-3.0-orig/texk/web2c/cpascal.h tetex-src-3.0/texk/web2c/cpascal.h +*** tetex-src-3.0-orig/texk/web2c/cpascal.h 2004-08-28 22:49:59.000000000 +0200 +--- tetex-src-3.0/texk/web2c/cpascal.h 2010-02-03 13:51:04.000000000 +0100 +*************** +*** 240,245 **** +--- 240,255 ---- + #undef getname + #define getname vms_getname + #endif ++ ++ /* Apparently POSIX 2008 has getline and glibc 2.9.90 exports it. ++ * tangle, weave, et al. use that symbol; try to define it away so ++ * something that a standard won't usurp. ++ * From http://tutimura.ath.cx/ptetex/?%C6%B0%BA%EE%CA%F3%B9%F0%2F134 */ ++ #ifdef getline ++ #undef getline ++ #endif ++ #define getline web2c_getline ++ + + /* Declarations for the routines we provide ourselves in lib/. */ + diff --git a/pkgs/tools/typesetting/tex/tetex/setup-hook.sh b/pkgs/tools/typesetting/tex/tetex/setup-hook.sh new file mode 100644 index 0000000000000..d79c4fae4196b --- /dev/null +++ b/pkgs/tools/typesetting/tex/tetex/setup-hook.sh @@ -0,0 +1,7 @@ +addTeXMFPath () { + if test -d "$1/share/texmf-nix"; then + export TEXINPUTS="${TEXINPUTS}${TEXINPUTS:+:}$1/share/texmf-nix//:" + fi +} + +envHooks=(${envHooks[@]} addTeXMFPath) diff --git a/pkgs/tools/typesetting/tex/tex4ht/default.nix b/pkgs/tools/typesetting/tex/tex4ht/default.nix new file mode 100644 index 0000000000000..90d134fcd4e7f --- /dev/null +++ b/pkgs/tools/typesetting/tex/tex4ht/default.nix @@ -0,0 +1,38 @@ +{stdenv, fetchurl, tetex, unzip}: + +stdenv.mkDerivation rec { + name = "tex4ht-1.0.2009_06_11_1038"; + + src = fetchurl { + url = "http://www.tug.org/applications/tex4ht/tex4ht.zip"; + # http://www.cse.ohio-state.edu/~gurari/TeX4ht/fix/${name}.tar.gz"; + sha1 = "2970cec5f4afc9039b82d6a4210f21d70ded2f5a"; + }; + + buildInputs = [ tetex unzip ]; + + buildPhase = '' + cd src + for f in tex4ht t4ht htcmd ; do + # -DENVFILE="$out/share/texmf-nix/tex4ht/base/unix/tex4ht.env" + gcc -o $f $f.c -I${tetex}/include -L${tetex}/lib -DHAVE_DIRENT_H -DHAVE_DIRENT_H -DKPATHSEA -lkpathsea + done + cd - + ''; + + installPhase = '' + ensureDir $out/bin + for f in src/tex4ht src/t4ht src/htcmd bin/unix/*; do # */ + mv $f $out/bin/. + done + + ensureDir $out/share + cp -r texmf $out/share/. + ''; + + meta = { + homepage = http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html; + # LaTeX Project Public License + license = "LPPL"; + }; +} \ No newline at end of file diff --git a/pkgs/tools/typesetting/tex/texlive/aggregate.nix b/pkgs/tools/typesetting/tex/texlive/aggregate.nix new file mode 100644 index 0000000000000..1723f48190625 --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/aggregate.nix @@ -0,0 +1,70 @@ +args : with args; +rec { + phaseNames = ["doAggregate"]; + name = "TeXLive-linkdir"; + + buildInputs = lib.closePropagation paths; + + doAggregate = fullDepEntry ('' + + ensureDir $out/bin + for currentPath in ${lib.concatStringsSep " " buildInputs}; do + echo Symlinking "$currentPath" + find $currentPath/share/info $currentPath/share/man $(echo $currentPath/texmf*/) ! -type d | while read; do + REPLY="''${REPLY#$currentPath}" + ensureDir $out/"$(dirname "$REPLY")" + ln -fs $currentPath/"$REPLY" $out/"$REPLY" + echo + done | while read; do head -n 99 >/dev/null; echo -n .; done + + for i in "$currentPath/bin/"* :; do + test "$i" != : || continue + echo -ne "#! $SHELL\\nexec $i \"\$@\"" > "$out/bin/$(basename "$i")" && \ + chmod a+x "$out/bin/$(basename "$i")" + done + + echo + + cp -Trfp $currentPath/libexec $out/libexec || true + done + + ln -s $out/texmf* $out/share/ + + rm -r $out/texmf-config + find $out/texmf/ -type d | while read; do + REPLY="''${REPLY#$out/texmf}" + ensureDir $out/texmf-config/"$REPLY" + done + + for i in $out/libexec/*/* :; do + test "$i" = : && continue; + test -f "$i" && \ + test -x "$i" && \ + echo -ne "#! $SHELL\\nexec $i \"\$@\"" >$out/bin/$(basename $i) && \ + chmod a+x $out/bin/$(basename $i) + done + + rm $out/texmf*/ls-R + for i in web2c texconfig fonts/map; do + cp -r $out/texmf/$i/* $out/texmf-config/$i || true + done + + TEXMFCONFIG=$out/texmf-config HOME=$PWD PATH=$PATH:$out/bin updmap --syncwithtrees + PATH=$PATH:$out/bin mktexlsr $out/texmf* + TEXMFCONFIG=$out/texmf-config HOME=$PWD PATH=$PATH:$out/bin updmap --syncwithtrees + PATH=$PATH:$out/bin mktexlsr $out/texmf* + '') ["minInit" "defEnsureDir" "addInputs"]; + + meta = { + description = "TeX distribution directory"; + longDescription = '' + Here all the files from different TeX-related + packages are collected in one directory. Of + course, mktexlsr is called. Later placed + directories take precedence. It is supposed that + share and libexec are symlinked, and bin is + recreated with wrappers for libexec-located + linked binaries. + ''; + }; +} diff --git a/pkgs/tools/typesetting/tex/texlive/beamer.nix b/pkgs/tools/typesetting/tex/texlive/beamer.nix new file mode 100644 index 0000000000000..5ff2c89316a10 --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/beamer.nix @@ -0,0 +1,24 @@ +args: with args; +rec { + name = "texlive-beamer-2007"; + src = fetchurl { + url = mirror://debian/pool/main/l/latex-beamer/latex-beamer_3.07.orig.tar.gz; + sha256 = "07ldhg5f0hcnhjgzg5g8ailqacn8zhqc8nl2jkxc43c2qxbvswbv"; + }; + + buildInputs = [texLive]; + propagatedBuildInputs = [texLiveLatexXColor texLivePGF]; + phaseNames = ["doCopy"]; + doCopy = fullDepEntry ('' + ensureDir $out/share/ + + ensureDir $out/texmf-dist/tex/latex/beamer + cp -r * $out/texmf-dist/tex/latex/beamer + + ln -s $out/texmf* $out/share/ + '') ["minInit" "doUnpack" "defEnsureDir" "addInputs"]; + + meta = { + description = "Extra components for TeXLive: beamer class"; + }; +} diff --git a/pkgs/tools/typesetting/tex/texlive/cm-super.nix b/pkgs/tools/typesetting/tex/texlive/cm-super.nix new file mode 100644 index 0000000000000..4f15afdc38141 --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/cm-super.nix @@ -0,0 +1,35 @@ +args: with args; +rec { + name = "texlive-cm-super-2009"; + src = fetchurl { + url = mirror://debian/pool/main/c/cm-super/cm-super_0.3.4.orig.tar.gz; + sha256 = "0zrq4sr9ank35svkz3cfd7f978i9c8xbzdqm2c8kvxia2753v082"; + }; + + phaseNames = ["doCopy"]; + doCopy = fullDepEntry ('' + ensureDir $out/share/ + + ensureDir $out/texmf/fonts/enc + ensureDir $out/texmf/fonts/map + ensureDir $out/texmf/fonts/type1/public/cm-super + cp pfb/*.pfb $out/texmf/fonts/type1/public/cm-super + ensureDir $out/texmf/dvips/cm-super + cp dvips/*.{map,enc} $out/texmf/dvips/cm-super + cp dvips/*.enc $out/texmf/fonts/enc + cp dvips/*.map $out/texmf/fonts/map + ensureDir $out/texmf/dvipdfm/config + cp dvipdfm/*.map $out/texmf/dvipdfm/config + + ln -s $out/texmf* $out/share/ + '') ["minInit" "doUnpack" "defEnsureDir" "addInputs"]; + buildInputs = [texLive]; + + meta = { + description = "Extra components for TeXLive: CM-Super fonts"; + maintainers = [ args.lib.maintainers.raskin ]; + + # Actually, arch-independent.. + platforms = [] ; + }; +} diff --git a/pkgs/tools/typesetting/tex/texlive/context.nix b/pkgs/tools/typesetting/tex/texlive/context.nix new file mode 100644 index 0000000000000..b502b0f2108aa --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/context.nix @@ -0,0 +1,25 @@ +args: with args; +rec { + name = "context-2009.11.26"; + src = fetchurl { + url = mirror://debian/pool/main/c/context/context_2009.11.26.orig.tar.gz; + sha256 = "1qv3h97cyhjyvivs30fz9bqr77j348azagm7ijiyfrclvjjlwav9"; + }; + + buildInputs = [texLive]; + phaseNames = ["doCopy"]; + doCopy = fullDepEntry ('' + ensureDir $out/share/ + + ensureDir $out/texmf + cp -r * $out/texmf + + ln -s $out/texmf* $out/share/ + '') ["minInit" "doUnpack" "defEnsureDir" "addInputs"]; + + meta = { + description = "ConTEXt TeX wrapper"; + }; + +} + diff --git a/pkgs/tools/typesetting/tex/texlive/default.nix b/pkgs/tools/typesetting/tex/texlive/default.nix new file mode 100644 index 0000000000000..69fb5d7e415f2 --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/default.nix @@ -0,0 +1,97 @@ +args : with args; +rec { + src = fetchurl { + url = mirror://debian/pool/main/t/texlive-bin/texlive-bin_2009.orig.tar.gz; + sha256 = "0ywc8h4jnig53fs0bji2ivw5f9j6zlgdy477jqw7xvpc7migjpw7"; + }; + + texmfSrc = fetchurl { + url = mirror://debian/pool/main/t/texlive-base/texlive-base_2009.orig.tar.gz; + sha256 = "130z907xcxr10yrzbbmp9l8a00dabvi4bi702s5jxamjzav17cmf"; + }; + + langTexmfSrc = fetchurl { + url = mirror://debian/pool/main/t/texlive-lang/texlive-lang_2009.orig.tar.gz; + sha256 = "10shnsc71n95zy9ys938pljdid9ampmc50k4lji9wv53hm14laic"; + }; + + setupHook = ./setup-hook.sh; + + doMainBuild = fullDepEntry ('' + ensureDir $out + ensureDir $out/nix-support + cp ${setupHook} $out/nix-support/setup-hook.sh + ensureDir $out/share + tar xf ${texmfSrc} -C $out --strip-components=1 + tar xf ${langTexmfSrc} -C $out --strip-components=1 + + sed -e s@/usr/bin/@@g -i $(grep /usr/bin/ -rl . ) + + sed -e 's@\<env ruby@${ruby}/bin/ruby@' -i $(grep 'env ruby' -rl . ) + sed -e 's@\<env perl@${perl}/bin/perl@' -i $(grep 'env perl' -rl . ) + sed -e 's@\<env python@${python}/bin/python@' -i $(grep 'env python' -rl . ) + + sed -e '/ubidi_open/i#include <unicode/urename.h>' -i $(find . -name configure) + sed -e s@ncurses/curses.h@curses.h@g -i $(grep ncurses/curses.h -rl . ) + sed -e '1i\#include <string.h>\n\#include <stdlib.h>' -i $( find libs/teckit -name '*.cpp' -o -name '*.c' ) + + NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${freetype}/include/freetype2" + NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${icu}/include/layout"; + + ./Build --prefix="$out" --datadir="$out/share" --mandir "$out/share/man" --infodir "$out/share/info" \ + ${args.lib.concatStringsSep " " configureFlags} + cd Work + '') ["minInit" "doUnpack" "addInputs" "defEnsureDir"]; + + doPostInstall = fullDepEntry('' + mv $out/bin $out/libexec + ensureDir $out/bin + for i in "$out/libexec/"*"/"*; do + test \( \! -d "$i" \) -a -x "$i" || continue + echo -ne "#! $SHELL\\nexec $i \"\$@\"" >$out/bin/$(basename $i) + chmod a+x $out/bin/$(basename $i) + done + [ -d $out/texmf-config ] || ln -s $out/texmf $out/texmf-config + ln -s "$out/"*texmf* "$out/share/" + + sed -e 's/.*pyhyph.*/=&/' -i $out/texmf-config/tex/generic/config/language.dat + + PATH=$PATH:$out/bin mktexlsr $out/texmf* + + HOME=. PATH=$PATH:$out/bin updmap-sys --syncwithtrees + + # Prebuild the format files, as it used to be done with TeXLive 2007. + # Luatex currently fails this way: + # + # This is a summary of all `failed' messages: + # `luatex -ini -jobname=luatex -progname=luatex luatex.ini' failed + # `luatex -ini -jobname=dviluatex -progname=dviluatex dviluatex.ini' failed + # + # I find it acceptable, hence the "|| true". + echo "building format files..." + ensureDir "$out/texmf-var/web2c" + PATH="$PATH:$out/bin" fmtutil-sys --all || true + + PATH=$PATH:$out/bin mktexlsr $out/texmf* + '') ["minInit" "defEnsureDir" "doUnpack" "doMakeInstall"]; + + buildInputs = [ + zlib bzip2 ncurses libpng flex bison libX11 libICE + xproto freetype t1lib gd libXaw icu ghostscript ed + libXt libXpm libXmu libXext xextproto perl libSM + ruby expat curl libjpeg python fontconfig + ]; + + configureFlags = [ "--with-x11" + "--enable-ipc" "--with-mktexfmt" + ]; + + phaseNames = ["addInputs" "doMainBuild" "doMakeInstall" "doPostInstall"]; + + name = "texlive-core-2009"; + meta = { + description = "A TeX distribution"; + maintainers = [ args.lib.maintainers.raskin ]; + platforms = args.lib.platforms.linux ++ args.lib.platforms.freebsd ; + }; +} diff --git a/pkgs/tools/typesetting/tex/texlive/extra.nix b/pkgs/tools/typesetting/tex/texlive/extra.nix new file mode 100644 index 0000000000000..598bdd08aef5d --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/extra.nix @@ -0,0 +1,24 @@ +args: with args; +rec { + name = "texlive-extra-2009"; + src = fetchurl { + url = mirror://debian/pool/main/t/texlive-extra/texlive-extra_2009.orig.tar.gz; + sha256 = "04k48lxy76bad1270gb9k4aza2q13can2dbcf2hj0a3byls099kp"; + }; + + buildInputs = [texLive]; + phaseNames = ["doCopy"]; + doCopy = fullDepEntry ('' + ensureDir $out/share + cp -r texmf* $out/ + ln -s $out/texmf* $out/share + '') ["minInit" "doUnpack" "defEnsureDir" "addInputs"]; + + meta = { + description = "Extra components for TeXLive"; + maintainers = [ args.lib.maintainers.raskin ]; + + # Actually, arch-independent.. + platforms = [] ; + }; +} diff --git a/pkgs/tools/typesetting/tex/texlive/moderncv.nix b/pkgs/tools/typesetting/tex/texlive/moderncv.nix new file mode 100644 index 0000000000000..9e3f68f36b108 --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/moderncv.nix @@ -0,0 +1,25 @@ +args: with args; +rec { + name = "moderncv-2012.01.16"; + src = fetchurl { + url = "http://mirror.ctan.org/macros/latex/contrib/moderncv.zip"; + sha256 = "1sfpj76p0z128rvxw0svh7dfrvf3zhmi3v7bkzfkll4byij34ni0"; + }; + + buildInputs = [texLive unzip]; + phaseNames = ["doCopy"]; + doCopy = fullDepEntry ('' + ensureDir $out/texmf/tex/latex/moderncv $out/texmf/doc $out/share + mv *.cls *.sty $out/texmf/tex/latex/moderncv/ + mv examples $out/texmf/doc/moderncv + ln -s $out/texmf* $out/share/ + '') ["minInit" "addInputs" "doUnpack" "defEnsureDir"]; + + meta = { + description = "the moderncv class for TeXLive"; + maintainers = [ args.lib.maintainers.simons ]; + + # Actually, arch-independent.. + platforms = [] ; + }; +} diff --git a/pkgs/tools/typesetting/tex/texlive/pgf.nix b/pkgs/tools/typesetting/tex/texlive/pgf.nix new file mode 100644 index 0000000000000..fac520290f003 --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/pgf.nix @@ -0,0 +1,40 @@ +args: with args; + +rec { + name = "texlive-pgf-2007"; + + src = fetchurl { + url = "mirror://sourceforge/pgf/pgf-2.00.tar.gz"; + sha256 = "0j57niag4jb2k0iyrvjsannxljc3vkx0iag7zd35ilhiy4dh6264"; + }; + + propagatedBuildInputs = [texLiveLatexXColor texLive]; + + phaseNames = ["doCopy"]; + doCopy = fullDepEntry ('' + ensureDir $out/share/ + ensureDir $out/texmf/tex/generic/pgf + cp -r * $out/texmf/tex/generic/pgf + ln -s $out/texmf* $out/share/ + '') ["minInit" "doUnpack" "defEnsureDir" "addInputs"]; + + meta = { + description = "Extra components for TeXLive: graphics package"; + + longDescription = '' + PGF is a macro package for creating graphics. It is platform- + and format-independent and works together with the most + important TeX backend drivers, including pdftex and dvips. It + comes with a user-friedly syntax layer called TikZ. + + Its usage is similar to pstricks and the standard picture + environment. PGF works with plain (pdf-)TeX, (pdf-)LaTeX, and + ConTeXt. Unlike pstricks , it can produce either PostScript or + PDF output. + ''; + + license = [ "GPLv2" "LPPLv1.3c" ]; + + homepage = http://tug.ctan.org/tex-archive/graphics/pgf/; + }; +} diff --git a/pkgs/tools/typesetting/tex/texlive/setup-hook.sh b/pkgs/tools/typesetting/tex/texlive/setup-hook.sh new file mode 100644 index 0000000000000..d79c4fae4196b --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/setup-hook.sh @@ -0,0 +1,7 @@ +addTeXMFPath () { + if test -d "$1/share/texmf-nix"; then + export TEXINPUTS="${TEXINPUTS}${TEXINPUTS:+:}$1/share/texmf-nix//:" + fi +} + +envHooks=(${envHooks[@]} addTeXMFPath) diff --git a/pkgs/tools/typesetting/tex/texlive/xcolor.nix b/pkgs/tools/typesetting/tex/texlive/xcolor.nix new file mode 100644 index 0000000000000..4e8d5eeb30b39 --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/xcolor.nix @@ -0,0 +1,37 @@ +args: with args; +rec { + name = "texlive-latex-xcolor-2007"; + src = fetchurl { + url = mirror://debian/pool/main/l/latex-xcolor/latex-xcolor_2.11.orig.tar.gz; + sha256 = "0z78xfn5iq5ncg82sd6v2qrxs8p9hs3m4agaz90p4db5dvk2w0mn"; + }; + + buildInputs = [texLive]; + phaseNames = ["doCopy"]; + doCopy = fullDepEntry ('' + export HOME=$PWD + ensureDir $out/share/ + + ensureDir $out/texmf/tex/latex/xcolor + ensureDir $out/texmf/dvips/xcolor + latex xcolor.ins + cp *.sty *.def $out/texmf/tex/latex/xcolor + cp *.pro $out/texmf/dvips/xcolor + + #latex xcolor.dtx + #latex xcolor.dtx + #makeindex -s gind.ist xcolor.idx + #latex xcolor.dtx + #latex xcolor.dtx + + rm *.sty *.pro *.ins *.def *.dtx + ensureDir $out/texmf/doc/latex-xcolor + cp * $out/texmf/doc/latex-xcolor + + ln -s $out/texmf* $out/share/ + '') ["minInit" "doUnpack" "defEnsureDir" "addInputs"]; + + meta = { + description = "Extra components for TeXLive: LaTeX color support"; + }; +} |