diff options
Diffstat (limited to 'Perl/export2cpan')
-rwxr-xr-x | Perl/export2cpan | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/Perl/export2cpan b/Perl/export2cpan index f40950e..6e385f9 100755 --- a/Perl/export2cpan +++ b/Perl/export2cpan @@ -112,31 +112,60 @@ else { print "VERSION $VERSION\n"; +# using rsync if available rather than cp +my $CP = 'cp -r'; +my $CPonlyIfDifferent = 'cp -r'; +my $RSYNC = 0; +if (-x '/usr/bin/rsync') { + $CP = '/usr/bin/rsync -rp'; # the --delete option has been removed to avoid deleting Makefile in demos + $CPonlyIfDifferent = '/usr/bin/rsync -rc'; +# print "\$CP = '$CP'\n"; + $RSYNC = 1; +} elsif (-x '/usr/local/bin/rsync') { + $CP = '/usr/local/bin/rsync -rp'; # the --delete option has been removed to avoid deleting Makefile in demos + $CPonlyIfDifferent = '/usr/local/bin/rsync -rc'; +# print "\$CP = '$CP'\n"; + $RSYNC = 1; +} + my $EXPORT_DIR = '../export2cpan'; my $VERSION_DIR = "$ZINC_PREFIX-$VERSION"; + +if (-d "$EXPORT_DIR/$VERSION_DIR" and !$RSYNC) { + system("rm -rf $EXPORT_DIR/$VERSION_DIR"); +} + if (! -d $EXPORT_DIR) { mkdir($EXPORT_DIR); } -if (-d "$EXPORT_DIR/$VERSION_DIR") { - system("rm -rf $EXPORT_DIR/$VERSION_DIR"); +if (! -d "$EXPORT_DIR/$VERSION_DIR") { + mkdir("$EXPORT_DIR/$VERSION_DIR"); } -mkdir("$EXPORT_DIR/$VERSION_DIR"); symlink ("$EXPORT_DIR/$VERSION_DIR", "$EXPORT_DIR/$ZINC_PREFIX"); my @files=('t', 'Zinc.xs', 'demos', 'README', 'Zinc'); + + foreach my $f (@files) { - system("cp -r $f $EXPORT_DIR/$VERSION_DIR"); + system("$CP $f $EXPORT_DIR/$VERSION_DIR"); } -filesubst('Zinc.pm', "$EXPORT_DIR/$VERSION_DIR/Zinc.pm", 'CONF_VERS', $VERSION); -filesubst('Makefile.PL', "$EXPORT_DIR/$VERSION_DIR/Makefile.PL", 'CONF_VERS', $VERSION); - -system("cp ../libtess/*.c $EXPORT_DIR/$VERSION_DIR"); -system("cp ../libtess/*.h $EXPORT_DIR/$VERSION_DIR"); -system("cp ../generic/*.c $EXPORT_DIR/$VERSION_DIR"); -system("cp ../generic/*.h $EXPORT_DIR/$VERSION_DIR"); -system("cp ../win/*.c $EXPORT_DIR/$VERSION_DIR"); -system("cp ../debian/changelog $EXPORT_DIR/$VERSION_DIR/Changes"); -system("cp ../debian/copyright $EXPORT_DIR/$VERSION_DIR/COPYRIGHT"); + +filesubst('Zinc.pm', "$EXPORT_DIR/$VERSION_DIR/Zinc.pm-new", 'CONF_VERS', $VERSION); +system("$CPonlyIfDifferent $EXPORT_DIR/$VERSION_DIR/Zinc.pm-new $EXPORT_DIR/$VERSION_DIR/Zinc.pm"); +unlink "$EXPORT_DIR/$VERSION_DIR/Zinc.pm-new"; + +filesubst('Makefile.PL', "$EXPORT_DIR/$VERSION_DIR/Makefile.PL-new", 'CONF_VERS', $VERSION); +system("$CPonlyIfDifferent $EXPORT_DIR/$VERSION_DIR/Makefile.PL-new $EXPORT_DIR/$VERSION_DIR/Makefile.PL"); +unlink "$EXPORT_DIR/$VERSION_DIR/Makefile.PL-new"; + + +system("$CP ../libtess/*.c $EXPORT_DIR/$VERSION_DIR"); +system("$CP ../libtess/*.h $EXPORT_DIR/$VERSION_DIR"); +system("$CP ../generic/*.c $EXPORT_DIR/$VERSION_DIR"); +system("$CP ../generic/*.h $EXPORT_DIR/$VERSION_DIR"); +system("$CP ../win/*.c $EXPORT_DIR/$VERSION_DIR"); +system("$CP ../debian/changelog $EXPORT_DIR/$VERSION_DIR/Changes"); +system("$CP ../debian/copyright $EXPORT_DIR/$VERSION_DIR/COPYRIGHT"); # # If working for an exported copy, build a tarball in the |