Skip to content
Snippets Groups Projects
Commit a27de44e authored by Jason Edward Stewart's avatar Jason Edward Stewart
Browse files

fixed post{Module,Source}.pl to take --in and --out

preparing for DOM split

perl module now builds libxerces if it doesn't exist



git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@437651 13f79535-47bb-0310-9956-ffa450edef68
parent 1b30908f
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,12 @@ ERROR
my $XERCESCROOT = abs_path('../..');
my $XERCES_INCLUDE = "$XERCESCROOT/src";
my $XERCES_LIB = "$XERCESCROOT/obj/.libs";
unless (-d $XERCES_LIB) {
print STDERR "Building Xerces-C\n";
system("make -C $XERCESCROOT");
die "Error building Xerces-C\n$!"
if $?;
}
my $LIBS = '-lpthread';
$INCLUDES = '-I. -IHandler';
......@@ -219,14 +225,19 @@ if ($XERCES_DEVEL) {
my @header_files;
my @handler_headers;
my @interface_files;
my @dom_interface_files;
my @non_dom_interface_files;
chomp(@handler_headers = `$FIND $HANDLER_DIR -name "*.swig.hpp"`);
@OPTIMIZE = (OPTIMIZE => '-g');
sub Xerces_postamble {
chomp(my @import_files = `$FIND $HANDLER_DIR -name "*.i"`);
push(@header_files,@handler_headers,@import_files);
chomp(my @interface_files = `$FIND $INTERFACE_DIR -name "*.i"`);
@interface_files = grep {$_ !~ /shadow\.i/} @interface_files;
@dom_interface_files = grep {$_ =~ /dom/} @interface_files;
@non_dom_interface_files = grep {$_ !~ /dom/} @interface_files;
local $" = ' ';
my $OS_DEF;
my $CC_DEF;
......@@ -258,15 +269,15 @@ Xerces-tmp.pm: $SCRIPTS_DIR/postModule.pl $INTERFACE_DIR/Perl/shadow.i
mv Xerces.pm Xerces-tmp.pm
Xerces.pm: $SCRIPTS_DIR/postModule.pl Xerces-tmp.pm
perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postModule.pl
perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postModule.pl --in=Xerces-tmp.pm --out=Xerces.pm
Xerces.cpp: $SCRIPTS_DIR/postSource.pl Xerces-tmp.cpp
perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postSource.pl
perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postSource.pl --in=Xerces-tmp.cpp --out=Xerces.cpp
Xerces-tmp.cpp: $INTERFACE_DIR/Xerces.i @interface_files @header_files $INTERFACE_DIR/Perl/Xerces-extra.pm
\$(SWIG) $SWIG_ARGS -o Xerces-tmp.cpp $INTERFACE_DIR/Xerces.i
mv Xerces.pm Xerces-tmp.pm
perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postModule.pl
perl -I$SCRIPTS_DIR $SCRIPTS_DIR/postModule.pl --in=Xerces-tmp.pm --out=Xerces.pm
cp -f Xerces.pm blib/lib/XML/Xerces.pm
$HANDLER_LIB:
......
#!/usr/bin/perl -w
use lib '.';
use strict;
use SWIG qw(remove_method skip_to_closing_brace fix_method);
use File::Temp qw/tempfile/;
use File::Copy;
use Getopt::Long;
my $USAGE = <<USAGE;
USAGE: $0 --infile=name --outfile=name
USAGE
my $INFILE = "Xerces-tmp.pm";
my $OUTFILE = "Xerces.pm";
my %OPTIONS;
my $rc = GetOptions(\%OPTIONS,
'infile=s',
'outfile=s',
);
die $USAGE unless $rc;
open(FILE, $INFILE)
or die "Couldn't open $INFILE for reading";
die $USAGE unless exists $OPTIONS{infile};
die $USAGE unless exists $OPTIONS{outfile};
open(FILE, $OPTIONS{infile})
or die "Couldn't open $OPTIONS{infile} for reading";
my ($temp_fh, $temp_filename) = tempfile();
......@@ -41,61 +51,14 @@ print $temp_fh $LICENSE;
my $CURR_CLASS = '';
while ($_ = <FILE>) {
if (/^package/) {
if (m/package\s+XML::Xerces::(\w+);/) {
($CURR_CLASS) = $1;
}
print $temp_fh $_;
next;
}
# # for some reason (I don't want to figure out) SWIG puts a bunch of
# # methods directly in the XML::Xerces namespace that don't belong there
# # and are duplicated within their proper classes, so we delete them
# if (/FUNCTION WRAPPERS/) {
# while ($_ = <FILE>) {
# next unless /\#\#\#\#\#\#\#\#\#\#\#\#\#/;
# last;
# }
# }
#
# # we remove all the enums inherited through DOMNode
# next if /^\*[_A-Z]+_NODE =/ && !/DOMNode/;
#
# # now we set these aliases correctly
# s/\*XML::Xerces::/*XML::Xercesc::/;
#######################################################################
#
# MUNGE MODULE for XMLCh support
#
# CHANGE "$args[0] = tied(%{$args[0]})"
# TO "$args[0] = tied(%{$args[0]}) || $args[0]"
# then we wrap it in a defined $args[0] to remove the irritating warning
# if (m{\$args\[0\]\s+=\s+tied\(\%\{\$args\[0\]\}\)}) {
# print $temp_fh <<'EOT';
# if (defined $args[0]) {
# $args[0] = tied(%{$args[0]}) || $args[0];
# }
# EOT
# next;
# }
# CHANGE "return undef if (!defined($result))"
# TO "return $result unless ref($result) =~ m[XML::Xerces]"
# split on multiple lines to be readable, using s{}{}x
# s{
# return\s*undef\s*if\s*\(\!defined\(\$result\)\)
# }{return \$result unless UNIVERSAL::isa(\$result,'XML::Xerces')}x;
print $temp_fh $_;
}
close(FILE);
close($temp_fh);
copy($temp_filename, $OUTFILE);
copy($temp_filename, $OPTIONS{outfile});
END {unlink($temp_filename)}
exit(0);
#!/usr/bin/perl
use lib '.';
use SWIG qw(remove_method skip_to_closing_brace fix_method);
#!/usr/bin/perl -w
use strict;
use File::Temp qw/tempfile/;
use File::Copy;
use Getopt::Long;
use strict;
my $USAGE = <<USAGE;
USAGE: $0 --infile=name --outfile=name
USAGE
my %OPTIONS;
my $rc = GetOptions(\%OPTIONS,
'infile=s',
'outfile=s',
);
die $USAGE unless $rc;
die $USAGE unless exists $OPTIONS{infile};
die $USAGE unless exists $OPTIONS{outfile};
###
### SWIG has now improved to the point that this file only installs the license
###
my $INFILE = "Xerces-tmp.cpp";
my $OUTFILE = "Xerces.cpp";
open(FILE, $INFILE)
or die "Couldn't open $INFILE for reading";
open(FILE, $OPTIONS{infile})
or die "Couldn't open $OPTIONS{infile} for reading";
my ($temp_fh, $temp_filename) = tempfile();
......@@ -43,15 +53,15 @@ LICENSE
print $temp_fh $LICENSE;
FILE: while(<FILE>) {
while(<FILE>) {
print $temp_fh $_;
}
close FILE;
close $temp_fh;
copy($temp_filename, $OUTFILE)
or die "Couldn't move $temp_filename to $OUTFILE: $!";
copy($temp_filename, $OPTIONS{outfile})
or die "Couldn't move $temp_filename to $OPTIONS{outfile}: $!";
END {unlink($temp_filename)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment