3 use ExtUtils::MakeMaker;
5 my %tables = (big5_t => ['big5.ucm',
15 NAME => 'Encode::'.$name,
16 VERSION_FROM => "$name.pm",
17 OBJECT => '$(O_FILES)',
19 COMPRESS => 'gzip -9f',
21 DIST_DEFAULT => 'all tardist',
24 # OS 390 winges about line numbers > 64K ???
25 XSOPT => '-nolinenumbers',
34 my $x = $self->{'OBJ_EXT'};
35 # Add the table O_FILES
36 foreach my $e (keys %tables)
41 $self->{'O_FILES'} = [sort keys %o];
42 my @files = ("$name.xs");
43 $self->{'C'} = ["$name.c"];
44 $self->{'H'} = [$self->catfile($self->updir,'Encode', 'encode.h')];
46 foreach my $table (keys %tables) {
47 push (@{$self->{'C'}},"$table.c");
48 # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
50 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
51 push (@files,$table.$ext);
54 $self->{'XS'} = { "$name.xs" => "$name.c" };
55 $self->{'clean'}{'FILES'} .= join(' ',@files);
56 open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
64 foreach my $table (keys %tables) {
65 print XS qq[#include "${table}.h"\n];
70 Encode_XSEncoding(pTHX_ encode_t *enc)
73 HV *stash = gv_stashpv("Encode::XS", TRUE);
74 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
80 const char *name = enc->name[i++];
81 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
84 call_pv("Encode::define_encoding",G_DISCARD);
88 MODULE = Encode::$name PACKAGE = Encode::$name
93 foreach my $table (keys %tables) {
94 print XS qq[#include "${table}.exh"\n];
98 return "# Built $name.xs\n\n";
104 my $dir = $self->catdir($self->updir,'ucm');
105 my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
106 $str .= "$name.c : $name.xs ";
107 foreach my $table (keys %tables)
112 $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
114 my $enc2xs = $self->catfile($self->updir,'bin', 'enc2xs');
115 foreach my $table (keys %tables)
118 my $lengthsofar = length($str);
119 my $continuator = '';
120 $str .= "$table.c : $enc2xs Makefile.PL";
121 foreach my $file (@{$tables{$table}})
123 $str .= $continuator.' '.$self->catfile($dir,$file);
124 if ( length($str)-$lengthsofar > 128*$numlines )
126 $continuator .= " \\\n\t";
132 my $plib = $ENV{PERL_CORE} ? '-I$(PERL_LIB)' : '';
133 my $ucopts = ($^O eq 'VMS') ? '-"Q"' : '-Q'; # VMS tweaks
135 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
136 open (FILELIST, ">$table.fnm")
137 || die "Could not open $table.fnm: $!";
138 foreach my $file (@{$tables{$table}})
140 print FILELIST $self->catfile($dir,$file) . "\n";