Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 196 lines (181 sloc) 4.883 kb
bd1cb07 r969@rock (orig r1601): miyagawa | 2005-06-22 00:18:10 -0700
miyagawa authored
1 #
2 # This file is auto-generated by:
3 # enc2xs version 2.01
4 # Wed Jun 22 12:01:25 2005
5 #
9cbb8b3 stop testing this module prior to 5.8
miyagawa authored
6 use 5.008_001;
bd1cb07 r969@rock (orig r1601): miyagawa | 2005-06-22 00:18:10 -0700
miyagawa authored
7 use strict;
8 use ExtUtils::MakeMaker;
9 use Config;
10
11 # Please edit the following to the taste!
12 my $name = 'Mobile';
13 my $modname = 'JP::Mobile';
14
a392491 lang/perl/Encode-JP-Mobile: merge branches/feature-convert-pictogram-ucm...
tomi-ru authored
15 my @ucms = qw(
806d325 x-sjis-airh-raw.ucm 復活!!!!
tokuhirom authored
16 sjis-docomo-raw sjis-kddi-cp932-raw sjis-kddi-auto-raw sjis-softbank-auto-raw sjis-airh-raw
9c7442c remove airh from Makefile
miyagawa authored
17 utf8-docomo utf8-kddi utf8-softbank
a392491 lang/perl/Encode-JP-Mobile: merge branches/feature-convert-pictogram-ucm...
tomi-ru authored
18 );
bd1cb07 r969@rock (orig r1601): miyagawa | 2005-06-22 00:18:10 -0700
miyagawa authored
19 my %tables = (
a392491 lang/perl/Encode-JP-Mobile: merge branches/feature-convert-pictogram-ucm...
tomi-ru authored
20 Mobile_t => [ map "ucm/x-$_.ucm", @ucms ],
bd1cb07 r969@rock (orig r1601): miyagawa | 2005-06-22 00:18:10 -0700
miyagawa authored
21 );
22
23 #### DO NOT EDIT BEYOND THIS POINT!
24 require File::Spec;
25 my ($enc2xs, $encode_h) = ();
26 PATHLOOP:
27 for my $d (@Config{qw/bin sitebin vendorbin/},
28 (split /$Config{path_sep}/o, $ENV{PATH})){
29 for my $f (qw/enc2xs enc2xs5.7.3/){
30 my $path = File::Spec->catfile($d, $f);
31 -r $path and $enc2xs = $path and last PATHLOOP;
32 }
33 }
34 $enc2xs or die "enc2xs not found!";
35 print "enc2xs is $enc2xs\n";
36 my %encode_h = ();
37 for my $d (@INC){
38 my $dir = File::Spec->catfile($d, "Encode");
39 my $file = File::Spec->catfile($dir, "encode.h");
40 -f $file and $encode_h{$dir} = -M $file;
41 }
42 %encode_h or die "encode.h not found!";
43 # find the latest one
44 ($encode_h) = sort {$encode_h{$b} <=> $encode_h{$a}} keys %encode_h;
45 print "encode.h is at $encode_h\n";
46
47 WriteMakefile(
6abf6e5 perltidy
tokuhirom authored
48 INC => "-I$encode_h",
49 NAME => "Encode::JP::Mobile",
50 VERSION_FROM => "lib/Encode/JP/Mobile.pm",
51 OBJECT => '$(O_FILES)',
52 'dist' => {
53 COMPRESS => 'gzip -9f',
54 SUFFIX => 'gz',
55 DIST_DEFAULT => 'all tardist',
56 },
57 MAN3PODS => {},
58 PREREQ_PM => {
59 'Encode' => "2.23",
60 'File::ShareDir' => "0.05",
43141d9 fixed missing deps for MIME::Words
tokuhirom authored
61 'MIME::Words' => '5.428',
6abf6e5 perltidy
tokuhirom authored
62 },
63
64 # OS 390 winges about line numbers > 64K ???
65 XSOPT => '-nolinenumbers',
66 );
bd1cb07 r969@rock (orig r1601): miyagawa | 2005-06-22 00:18:10 -0700
miyagawa authored
67
68 package MY;
69
70 sub post_initialize
71 {
72 my ($self) = @_;
73 my %o;
74 my $x = $self->{'OBJ_EXT'};
75 # Add the table O_FILES
76 foreach my $e (keys %tables)
77 {
78 $o{$e.$x} = 1;
79 }
80 $o{"$name$x"} = 1;
81 $self->{'O_FILES'} = [sort keys %o];
82 my @files = ("$name.xs");
83 $self->{'C'} = ["$name.c"];
84 # The next two lines to make MacPerl Happy -- dankogai via pudge
85 $self->{SOURCE} .= " $name.c"
86 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
87 # $self->{'H'} = [$self->catfile($self->updir,'encode.h')];
88 my %xs;
89 foreach my $table (keys %tables) {
90 push (@{$self->{'C'}},"$table.c");
91 # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
92 # get built.
93 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
94 push (@files,$table.$ext);
95 }
96 }
97 $self->{'XS'} = { "$name.xs" => "$name.c" };
98 $self->{'clean'}{'FILES'} .= join(' ',@files);
99 open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
100 print XS <<'END';
101 #include <EXTERN.h>
102 #include <perl.h>
103 #include <XSUB.h>
104 #define U8 U8
105 #include "encode.h"
106 END
107 foreach my $table (keys %tables) {
108 print XS qq[#include "${table}.h"\n];
109 }
110 print XS <<"END";
111
112 static void
113 Encode_XSEncoding(pTHX_ encode_t *enc)
114 {
115 dSP;
116 HV *stash = gv_stashpv("Encode::XS", TRUE);
117 SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
118 int i = 0;
119 PUSHMARK(sp);
120 XPUSHs(sv);
121 while (enc->name[i])
122 {
123 const char *name = enc->name[i++];
124 XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
125 }
126 PUTBACK;
127 call_pv("Encode::define_encoding",G_DISCARD);
128 SvREFCNT_dec(sv);
129 }
130
131 MODULE = Encode::$modname PACKAGE = Encode::$modname
132 PROTOTYPES: DISABLE
133 BOOT:
134 {
135 END
136 foreach my $table (keys %tables) {
137 print XS qq[#include "${table}.exh"\n];
138 }
139 print XS "}\n";
140 close(XS);
141 return "# Built $name.xs\n\n";
142 }
143
144 sub postamble
145 {
146 my $self = shift;
147 my $dir = "."; # $self->catdir('Encode');
148 my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
149 $str .= "$name.c : $name.xs ";
150 foreach my $table (keys %tables)
151 {
152 $str .= " $table.c";
153 }
154 $str .= "\n\n";
155 $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
156
157 foreach my $table (keys %tables)
158 {
159 my $numlines = 1;
160 my $lengthsofar = length($str);
161 my $continuator = '';
162 $str .= "$table.c : Makefile.PL";
163 foreach my $file (@{$tables{$table}})
164 {
165 $str .= $continuator.' '.$self->catfile($dir,$file);
166 if ( length($str)-$lengthsofar > 128*$numlines )
167 {
168 $continuator .= " \\\n\t";
169 $numlines++;
170 } else {
171 $continuator = '';
172 }
173 }
174 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
175 my $ucopts = '-"Q"';
176 $str .=
177 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
178 open (FILELIST, ">$table.fnm")
179 || die "Could not open $table.fnm: $!";
180 foreach my $file (@{$tables{$table}})
181 {
182 print FILELIST $self->catfile($dir,$file) . "\n";
183 }
184 close(FILELIST);
185 }
be1533b Encode-JP-Mobile: merge to trunk
tokuhirom authored
186
187 $str .= <<"...";
188 config ::
189 \t\$(NOECHO) \$(MOD_INSTALL) \\
190 \t\t"dat" \$(INST_AUTODIR)
191 ...
192
bd1cb07 r969@rock (orig r1601): miyagawa | 2005-06-22 00:18:10 -0700
miyagawa authored
193 return $str;
194 }
195
Something went wrong with that request. Please try again.