* Add a dot2pdf function.

svn path=/nixpkgs/trunk/; revision=3232
This commit is contained in:
Eelco Dolstra 2005-06-20 22:43:35 +00:00
parent a75aef6c7a
commit 3919b35495
4 changed files with 45 additions and 10 deletions

View File

@ -5,7 +5,6 @@ sub createDirs;
sub createDirs {
my $path = shift;
return unless $path =~ /^(.*)\/([^\/]*)$/;
print "$1 BLA $2\n";
return if -d $1;
createDirs $1;
mkdir $1 or die "cannot create directory `$1'";

View File

@ -6,6 +6,7 @@ rec {
runLaTeX =
{ rootFile
, generatePDF ? true
, extraFiles ? []
}:
pkgs.stdenv.mkDerivation {
@ -14,7 +15,7 @@ rec {
builder = ./run-latex.sh;
copyIncludes = ./copy-includes.pl;
inherit rootFile generatePDF;
inherit rootFile generatePDF extraFiles;
includes = import (findLaTeXIncludes {inherit rootFile;});
@ -37,5 +38,20 @@ rec {
# Forces rebuilds.
hack = __currentTime;
};
dot2pdf =
{ dotGraph
}:
pkgs.stdenv.mkDerivation {
name = "pdf";
builder = ./dot2pdf.sh;
inherit dotGraph;
buildInputs = [
pkgs.perl pkgs.tetex pkgs.graphviz pkgs.ghostscript
];
};
}

View File

@ -0,0 +1,20 @@
. $stdenv/setup
ensureDir $out
dot2pdf() {
sourceFile=$1
targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).pdf
echo "convering $sourceFile to $targetName..."
dot -Tps $sourceFile > tmp.ps
epstopdf --outfile $targetName tmp.ps
}
for i in $dotGraph; do
if test -d $i; then
for j in $i/*; do dot2pdf $j; done
else
dot2pdf $i
fi
done

View File

@ -4,13 +4,13 @@ ensureDir $out
perl $copyIncludes $includes
#for i in $includes; do
# if test -d $i; then
# cp $i/* .
# else
# cp $i $(stripHash $i; echo $strippedName)
# fi
#done
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))
echo "root name is $rootName"