mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
* Add a dot2pdf function.
svn path=/nixpkgs/trunk/; revision=3232
This commit is contained in:
parent
a75aef6c7a
commit
3919b35495
@ -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'";
|
||||
|
@ -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
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
}
|
20
pkgs/misc/tex/nix/dot2pdf.sh
Normal file
20
pkgs/misc/tex/nix/dot2pdf.sh
Normal 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
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user