root/Encode-JP-Mobile/tags/0.05/Makefile.PL

Revision 2266 (checked in by miyagawa, 13 years ago)

Checking in changes prior to tagging of version 0.04. Changelog diff is:

=== Changes
==================================================================
--- Changes (revision 6706)
+++ Changes (local)
@@ -1,3 +1,7 @@
+0.04 Fri May 25 16:31:03 PDT 2007
+ - Support KDDI/AU <-> NTT DoCoMo? mapping
+ (Thanks to Tokuhiro Matsuno)
+

0.03 Fri Jul 14 15:15:20 JST 2006

- Added 'shift_jis-softbank' as an alias of 'shift_jis-vodafone'


Line 
1 #
2 # This file is auto-generated by:
3 # enc2xs version 2.01
4 # Wed Jun 22 12:01:25 2005
5 #
6 use 5.7.2;
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
15 my %tables = (
16              Mobile_t   => [ 'ucm/shift_jis-airedge.ucm','ucm/shift_jis-imode.ucm','ucm/shift_jis-kddi.ucm' ],
17              );
18
19 #### DO NOT EDIT BEYOND THIS POINT!
20 require File::Spec;
21 my ($enc2xs, $encode_h) = ();
22 PATHLOOP:
23 for my $d (@Config{qw/bin sitebin vendorbin/},
24            (split /$Config{path_sep}/o, $ENV{PATH})){
25     for my $f (qw/enc2xs enc2xs5.7.3/){
26         my $path = File::Spec->catfile($d, $f);
27         -r $path and $enc2xs = $path and last PATHLOOP;
28     }
29 }
30 $enc2xs or die "enc2xs not found!";
31 print "enc2xs is $enc2xs\n";
32 my %encode_h = ();
33 for my $d (@INC){
34     my $dir = File::Spec->catfile($d, "Encode");
35     my $file =  File::Spec->catfile($dir, "encode.h");
36     -f $file and $encode_h{$dir} = -M $file;
37 }
38 %encode_h or die "encode.h not found!";
39 # find the latest one
40 ($encode_h) = sort {$encode_h{$b} <=> $encode_h{$a}} keys %encode_h;
41 print "encode.h is at $encode_h\n";
42
43 WriteMakefile(
44               INC               => "-I$encode_h",
45               NAME              => "Encode::JP::Mobile",
46               VERSION_FROM      => "lib/Encode/JP/Mobile.pm",
47               OBJECT            => '$(O_FILES)',
48               'dist'            => {
49                   COMPRESS      => 'gzip -9f',
50                   SUFFIX        => 'gz',
51                   DIST_DEFAULT => 'all tardist',
52               },
53               MAN3PODS  => {},
54               PREREQ_PM => {
55                             'Encode'     => "1.41",
56                            },
57               # OS 390 winges about line numbers > 64K ???
58               XSOPT => '-nolinenumbers',
59               );
60
61 package MY;
62
63 sub post_initialize
64 {
65     my ($self) = @_;
66     my %o;
67     my $x = $self->{'OBJ_EXT'};
68     # Add the table O_FILES
69     foreach my $e (keys %tables)
70     {
71         $o{$e.$x} = 1;
72     }
73     $o{"$name$x"} = 1;
74     $self->{'O_FILES'} = [sort keys %o];
75     my @files = ("$name.xs");
76     $self->{'C'} = ["$name.c"];
77     # The next two lines to make MacPerl Happy -- dankogai via pudge
78     $self->{SOURCE} .= " $name.c"
79         if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
80     # $self->{'H'} = [$self->catfile($self->updir,'encode.h')];
81     my %xs;
82     foreach my $table (keys %tables) {
83         push (@{$self->{'C'}},"$table.c");
84         # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
85         # get built.
86         foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
87             push (@files,$table.$ext);
88         }
89     }
90     $self->{'XS'} = { "$name.xs" => "$name.c" };
91     $self->{'clean'}{'FILES'} .= join(' ',@files);
92     open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
93     print XS <<'END';
94 #include <EXTERN.h>
95 #include <perl.h>
96 #include <XSUB.h>
97 #define U8 U8
98 #include "encode.h"
99 END
100     foreach my $table (keys %tables) {
101         print XS qq[#include "${table}.h"\n];
102     }
103     print XS <<"END";
104
105 static void
106 Encode_XSEncoding(pTHX_ encode_t *enc)
107 {
108  dSP;
109  HV *stash = gv_stashpv("Encode::XS", TRUE);
110  SV *sv    = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
111  int i = 0;
112  PUSHMARK(sp);
113  XPUSHs(sv);
114  while (enc->name[i])
115   {
116    const char *name = enc->name[i++];
117    XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
118   }
119  PUTBACK;
120  call_pv("Encode::define_encoding",G_DISCARD);
121  SvREFCNT_dec(sv);
122 }
123
124 MODULE = Encode::$modname       PACKAGE = Encode::$modname
125 PROTOTYPES: DISABLE
126 BOOT:
127 {
128 END
129     foreach my $table (keys %tables) {
130         print XS qq[#include "${table}.exh"\n];
131     }
132     print XS "}\n";
133     close(XS);
134     return "# Built $name.xs\n\n";
135 }
136
137 sub postamble
138 {
139     my $self = shift;
140     my $dir  = "."; # $self->catdir('Encode');
141     my $str  = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
142     $str    .= "$name.c : $name.xs ";
143     foreach my $table (keys %tables)
144     {
145         $str .= " $table.c";
146     }
147     $str .= "\n\n";
148     $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
149
150     foreach my $table (keys %tables)
151     {
152         my $numlines = 1;
153         my $lengthsofar = length($str);
154         my $continuator = '';
155         $str .= "$table.c : Makefile.PL";
156         foreach my $file (@{$tables{$table}})
157         {
158             $str .= $continuator.' '.$self->catfile($dir,$file);
159             if ( length($str)-$lengthsofar > 128*$numlines )
160             {
161                 $continuator .= " \\\n\t";
162                 $numlines++;
163             } else {
164                 $continuator = '';
165             }
166         }
167         my $plib   = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
168         my $ucopts = '-"Q"';
169         $str .= 
170             qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
171         open (FILELIST, ">$table.fnm")
172             || die "Could not open $table.fnm: $!";
173         foreach my $file (@{$tables{$table}})
174         {
175             print FILELIST $self->catfile($dir,$file) . "\n";
176         }
177         close(FILELIST);
178     }
179     return $str;
180 }
181
Note: See TracBrowser for help on using the browser.