* Graphviz updated to 2.20.2. Now built with fontconfig, gd and pango
support. * New function makeFontsConf to generate a fontconfig configuration file. Moved from NixOS. * dot2pdf: use makeFontsConf to generate a fonts.conf containing just the Ghostscript fonts (see NIXPKGS-29). * dot2pdf: generate PDF directly, don't go through PS. Note that this and using fontconfig changes the interpretation of "fontname" attributes in dot graphs. svn path=/nixpkgs/trunk/; revision=12251
This commit is contained in:
parent
18b30f54ce
commit
d051b20a39
6 changed files with 83 additions and 11 deletions
13
pkgs/development/libraries/fontconfig/make-fonts-conf.nix
Normal file
13
pkgs/development/libraries/fontconfig/make-fonts-conf.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{runCommand, libxslt, fontconfig, fontDirectories}:
|
||||
|
||||
runCommand "fonts.conf"
|
||||
{
|
||||
buildInputs = [libxslt];
|
||||
inherit fontDirectories;
|
||||
}
|
||||
''
|
||||
xsltproc --stringparam fontDirectories "$fontDirectories" \
|
||||
--stringparam fontconfig "${fontconfig}" \
|
||||
${./make-fonts-conf.xsl} ${fontconfig}/etc/fonts/fonts.conf \
|
||||
> $out
|
||||
''
|
40
pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
Normal file
40
pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
This script copies the original fonts.conf from the fontconfig
|
||||
distribution, but replaces all <dir> entries with the directories
|
||||
specified in the $fontDirectories parameter.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:str="http://exslt.org/strings"
|
||||
extension-element-prefixes="str"
|
||||
>
|
||||
|
||||
<xsl:output method='xml' encoding="UTF-8" doctype-system="fonts.dtd" />
|
||||
|
||||
<xsl:param name="fontDirectories" />
|
||||
<xsl:param name="fontconfig" />
|
||||
|
||||
<xsl:template match="/fontconfig">
|
||||
|
||||
<fontconfig>
|
||||
<xsl:copy-of select="child::node()[name() != 'dir' and name() != 'cachedir' and name() != 'include']" />
|
||||
|
||||
<include xml:space="preserve"><xsl:value-of select="$fontconfig" />/etc/fonts/conf.d</include>
|
||||
<include ignore_missing="yes" xml:space="preserve">/etc/fonts/conf.d</include>
|
||||
|
||||
<cachedir xml:space="preserve">/var/cache/fontconfig</cachedir>
|
||||
<cachedir xml:space="preserve">~/.fontconfig</cachedir>
|
||||
|
||||
<xsl:for-each select="str:tokenize($fontDirectories)">
|
||||
<dir><xsl:value-of select="." /></dir>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:for-each>
|
||||
|
||||
</fontconfig>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -58,9 +58,9 @@ rec {
|
|||
pkgs.stdenv.mkDerivation {
|
||||
name = "pdf";
|
||||
builder = ./dot2pdf.sh;
|
||||
inherit dotGraph;
|
||||
inherit dotGraph fontsConf;
|
||||
buildInputs = [
|
||||
pkgs.perl pkgs.tetex pkgs.graphviz pkgs.ghostscript
|
||||
pkgs.perl pkgs.tetex pkgs.graphviz
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -180,4 +180,13 @@ rec {
|
|||
};
|
||||
|
||||
|
||||
# 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"
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ dot2pdf() {
|
|||
sourceFile=$1
|
||||
targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).pdf
|
||||
echo "converting $sourceFile to $targetName..."
|
||||
dot -Tps $sourceFile > tmp.ps
|
||||
perl $(type -tp epstopdf) --outfile $targetName tmp.ps
|
||||
export FONTCONFIG_FILE=$fontsConf
|
||||
dot -Tpdf $sourceFile > $targetName
|
||||
}
|
||||
|
||||
for i in $dotGraph; do
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
{stdenv, fetchurl, x11, libpng, libjpeg, expat, libXaw, yacc, libtool}:
|
||||
{ stdenv, fetchurl, pkgconfig, x11, libpng, libjpeg, expat, libXaw
|
||||
, yacc, libtool, fontconfig, pango, gd
|
||||
}:
|
||||
|
||||
assert libpng != null && libjpeg != null && expat != null;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "graphviz-2.16.1";
|
||||
name = "graphviz-2.20.2";
|
||||
|
||||
src = fetchurl {
|
||||
url = http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-2.16.1.tar.gz;
|
||||
sha256 = "1lan1hyar0xbqvnkcmlcvv02g8zfpk94gk04y4sik5irpa2s3h9j";
|
||||
url = http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-2.20.2.tar.gz;
|
||||
sha256 = "13mw0mhr4n14c5q7a6c44cvggl5hiqbx53ynr53s67rldvzcilgm";
|
||||
};
|
||||
|
||||
buildInputs = [x11 libpng libjpeg expat libXaw yacc libtool];
|
||||
buildInputs = [pkgconfig x11 libpng libjpeg expat libXaw yacc libtool fontconfig pango gd];
|
||||
|
||||
configureFlags =
|
||||
[ "--with-pngincludedir=${libpng}/include"
|
||||
"--with-pnglibdir=${libpng}/lib"
|
||||
|
|
|
@ -678,8 +678,10 @@ let pkgs = rec {
|
|||
};
|
||||
|
||||
graphviz = import ../tools/graphics/graphviz {
|
||||
inherit fetchurl stdenv libpng libjpeg expat x11 yacc libtool;
|
||||
inherit fetchurl stdenv pkgconfig libpng libjpeg expat x11 yacc
|
||||
libtool fontconfig gd;
|
||||
inherit (xlibs) libXaw;
|
||||
inherit (gtkLibs) pango;
|
||||
};
|
||||
|
||||
groff = import ../tools/text/groff {
|
||||
|
@ -2520,6 +2522,11 @@ let pkgs = rec {
|
|||
inherit fetchurl stdenv freetype expat;
|
||||
};
|
||||
|
||||
makeFontsConf = let fontconfig_ = fontconfig; in {fontconfig ? fontconfig_, fontDirectories}:
|
||||
import ../development/libraries/fontconfig/make-fonts-conf.nix {
|
||||
inherit runCommand libxslt fontconfig fontDirectories;
|
||||
};
|
||||
|
||||
freealut = import ../development/libraries/freealut {
|
||||
inherit fetchurl stdenv openal;
|
||||
};
|
||||
|
@ -7155,7 +7162,7 @@ let pkgs = rec {
|
|||
*/
|
||||
|
||||
texFunctions = import ../misc/tex/nix {
|
||||
inherit stdenv perl tetex graphviz ghostscript;
|
||||
inherit stdenv perl tetex graphviz ghostscript makeFontsConf;
|
||||
};
|
||||
|
||||
texLiveFun = builderDefsPackage (import ../misc/tex/texlive) {
|
||||
|
|
Loading…
Reference in a new issue