diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 47d455dd55be855e4cc691c32f687f723d9247ee (patch) | |
tree | 52e236aaa2576bdb3840ebede26619692fed6d7d /ksvg/scripts/generate.pl | |
download | tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksvg/scripts/generate.pl')
-rwxr-xr-x | ksvg/scripts/generate.pl | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/ksvg/scripts/generate.pl b/ksvg/scripts/generate.pl new file mode 100755 index 00000000..a9419dcc --- /dev/null +++ b/ksvg/scripts/generate.pl @@ -0,0 +1,69 @@ +#!/usr/bin/perl -w + +my $kalyptusdir = "../../../kdebindings/kalyptus"; + +use File::Basename; + +my $here = `pwd`; +chomp $here; +my $outdir = $here . "/generate.pl.tmpdir"; +my $finaloutdir = $here; + +## Note: outdir and finaloutdir should NOT be the same dir! + +if (! -d $outdir) { mkdir $outdir; } + +mkdir $finaloutdir unless (-d $finaloutdir); + + +# Need to cd to kalyptus's directory so that perl finds Ast.pm etc. +chdir "$kalyptusdir" or die "Couldn't go to $kalyptusdir (edit script to change dir)\n"; + +# Find out which header files we need to parse +my %excludes = ( +); + +# List headers, and exclude the ones listed above +my @headers = (); +my $incdir=$here; +opendir (INCS, $incdir) or die "Couldn't find $incdir"; +foreach $filename (readdir(INCS)) { + $entry = $incdir."/".$filename; + if ( ( -e $entry or -l $entry ) # A real file or a symlink + && ( ! -d _ ) ) # Not a symlink to a dir though + { + push(@headers, $entry) + if ( !defined $excludes{$filename} # Not excluded + && $filename =~ /\.h$/ ); # Not a backup file etc. Only headers. + } +} +closedir INCS; + +# Launch kalyptus +system "perl kalyptus @ARGV -fECMA --name=ksvg --outputdir=$outdir @headers"; +my $exit = $? >> 8; +exit $exit if ($exit); + +# Generate diff for generateddata.cpp +if ( -e "$finaloutdir/generateddata.cpp" ) { + system "diff -u $finaloutdir/generateddata.cpp $outdir/generateddata.cpp > $outdir/generateddata.cpp.diff"; +} + +# Copy changed or new files to finaloutdir +#opendir (OUT, $outdir) or die "Couldn't opendir $outdir"; +#foreach $filename (readdir(OUT)) { +my $filename = "generateddata.cpp"; + #next if ( -d "$outdir/$filename" ); # only files, not dirs + my $docopy = 1; + if ( -f "$finaloutdir/$filename" ) { + # How can I do a fast file compare in perl? + system "cmp -s $outdir/$filename $finaloutdir/$filename"; + $docopy = ($?>>8); # 0 if files identical, 1 if different + } + if ($docopy) { + #print STDERR "Updating $filename...\n"; + system "cp -f $outdir/$filename $finaloutdir/$filename"; + } + +# Delete outdir +system "rm -rf $outdir"; |