aboutsummaryrefslogtreecommitdiff
path: root/Perl
diff options
context:
space:
mode:
Diffstat (limited to 'Perl')
-rwxr-xr-xPerl/export2cpan86
1 files changed, 86 insertions, 0 deletions
diff --git a/Perl/export2cpan b/Perl/export2cpan
new file mode 100755
index 0000000..1ed383e
--- /dev/null
+++ b/Perl/export2cpan
@@ -0,0 +1,86 @@
+#!/usr/bin/perl
+
+use strict;
+
+sub version4cpan {
+ my $configure_in = "../configure.in";
+
+ $configure_in = $ARGV[0] if ($ARGV[0]);
+
+ open(FD, "<$configure_in") or die "Could not open file $configure_in";
+
+ my ($major, $minor, $patchlevel);
+ while (<FD>) {
+ if ($_ =~ /(MAJOR_VERSION)[ =][0-9]+/)
+ {
+ (undef, $major) = split(/[ =]+/, $_);
+ chomp $major;
+ }
+ elsif ($_ =~ /(MINOR_VERSION)[ =][0-9]+/)
+ {
+ (undef, $minor) = split(/[ =]+/, $_);
+ chomp $minor;
+ }
+ elsif ($_ =~ /(PATCHLEVEL)[ =][0-9]+/)
+ {
+ (undef, $patchlevel) = split(/[ =]+/ ,$_);
+ chomp $patchlevel;
+ }
+ }
+
+ close (FD);
+
+ return "$major.$minor$patchlevel";
+}
+
+sub filesubst {
+ my ($fileIn, $fileOut, $key, $val) = @_;
+
+ open(FDIN, "<$fileIn") or die "Could not open input file $fileIn";
+ open(FDOUT, ">$fileOut") or die "Could not open output file $fileOut";
+
+ while (<FDIN>) {
+ if (/$key/) {
+ s/$key/$val/g;
+ }
+ print FDOUT $_;
+ }
+
+ close(FDIN);
+ close(FDOUT);
+}
+
+my $version = version4cpan;
+
+print "VERSION $version\n";
+
+my $EXPORT_DIR="../export2cpan";
+if (! -d $EXPORT_DIR) {
+ mkdir $EXPORT_DIR;
+}
+
+my $VERSION_DIR="$EXPORT_DIR/tk-zinc-$version";
+
+if (! -d $VERSION_DIR) {
+ mkdir $VERSION_DIR;
+}
+else {
+ system "rm -rf $VERSION_DIR";
+ mkdir $VERSION_DIR;
+}
+
+my @files=('t', 'Zinc.xs', 'trace', 'demos',
+ 'Zinc', 'ZincTrace');
+foreach my $f (@files) {
+ system "cp -r $f $VERSION_DIR";
+}
+filesubst('Zinc.pm', "$VERSION_DIR/Zinc.pm", 'CONF_VERS', $version);
+filesubst('Makefile.PL', "$VERSION_DIR/Makefile.PL", 'CONF_VERS', $version);
+
+#system "echo $version > $VERSION_DIR/VERSION";
+
+system "cp ../libtess/*.c $VERSION_DIR";
+system "cp ../libtess/*.h $VERSION_DIR";
+system "cp ../generic/*.c $VERSION_DIR";
+system "cp ../generic/*.h $VERSION_DIR";
+system "cp ../win/*.c $VERSION_DIR";