2 # This file is auto-generated by:
3 # enc2xs version $_Version_
8 use ExtUtils::MakeMaker;
11 # Please edit the following to the taste!
14 $_Name__t => [ $_TableFiles_ ],
17 #### DO NOT EDIT BEYOND THIS POINT!
19 my ($enc2xs, $encode_h) = ();
21 for my $d (@Config{qw/bin sitebin vendorbin/},
22 (split /$Config{path_sep}/o, $ENV{PATH})){
23 for my $f (qw/enc2xs enc2xs5.7.3/){
24 my $path = File::Spec->catfile($d, $f);
25 -r $path and $enc2xs = $path and last PATHLOOP;
28 $enc2xs or die "enc2xs not found!";
29 print "enc2xs is $enc2xs\n";
32 my $dir = File::Spec->catfile($d, "Encode");
33 my $file = File::Spec->catfile($dir, "encode.h");
34 -f $file and $encode_h{$dir} = -M $file;
36 %encode_h or die "encode.h not found!";
38 ($encode_h) = sort {$encode_h{$b} <=> $encode_h{$a}} keys %encode_h;
39 print "encode.h is at $encode_h\n";
43 #### END_OF_HEADER -- DO NOT EDIT THIS LINE BY HAND! ####
44 NAME => 'Encode::'.$name,
45 VERSION_FROM => "$name.pm",
46 OBJECT => '$(O_FILES)',
48 COMPRESS => 'gzip -9f',
50 DIST_DEFAULT => 'all tardist',
56 # OS 390 winges about line numbers > 64K ???
57 XSOPT => '-nolinenumbers',
66 my $x = $self->{'OBJ_EXT'};
67 # Add the table O_FILES
68 foreach my $e (keys %tables)
73 $self->{'O_FILES'} = [sort keys %o];
74 my @files = ("$name.xs");
75 $self->{'C'} = ["$name.c"];
76 # The next two lines to make MacPerl Happy -- dankogai via pudge
77 $self->{SOURCE} .= " $name.c"
78 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
79 # $self->{'H'} = [$self->catfile($self->updir,'encode.h')];
81 foreach my $table (keys %tables) {
82 push (@{$self->{'C'}},"$table.c");
83 # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
85 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
86 push (@files,$table.$ext);
89 $self->{'XS'} = { "$name.xs" => "$name.c" };
90 $self->{'clean'}{'FILES'} .= join(' ',@files);
91 open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
99 foreach my $table (keys %tables) {
100 print XS qq[#include "${table}.h"\n];
105 Encode_XSEncoding(pTHX_ encode_t *enc)
108 HV *stash = gv_stashpv("Encode::XS", TRUE);
109 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
115 const char *name = enc->name[i++];
116 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
119 call_pv("Encode::define_encoding",G_DISCARD);
123 MODULE = Encode::$name PACKAGE = Encode::$name
128 foreach my $table (keys %tables) {
129 print XS qq[#include "${table}.exh"\n];
133 return "# Built $name.xs\n\n";
139 my $dir = "."; # $self->catdir('Encode');
140 my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
141 $str .= "$name.c : $name.xs ";
142 foreach my $table (keys %tables)
147 $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
149 foreach my $table (keys %tables)
152 my $lengthsofar = length($str);
153 my $continuator = '';
154 $str .= "$table.c : Makefile.PL";
155 foreach my $file (@{$tables{$table}})
157 $str .= $continuator.' '.$self->catfile($dir,$file);
158 if ( length($str)-$lengthsofar > 128*$numlines )
160 $continuator .= " \\\n\t";
166 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
169 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
170 open (FILELIST, ">$table.fnm")
171 || die "Could not open $table.fnm: $!";
172 foreach my $file (@{$tables{$table}})
174 print FILELIST $self->catfile($dir,$file) . "\n";