root/lang/perl/Encode-JP-Mobile/trunk/Makefile.PL

Revision 5258, 4.7 kB (checked in by tokuhirom, 10 months ago)

x-sjis-airh-raw.ucm 復活!!!!

Line 
1#
2# This file is auto-generated by:
3# enc2xs version 2.01
4# Wed Jun 22 12:01:25 2005
5#
6use 5.008_001;
7use strict;
8use ExtUtils::MakeMaker;
9use Config;
10
11# Please edit the following to the taste!
12my $name = 'Mobile';
13my $modname = 'JP::Mobile';
14
15my @ucms = qw(
16    sjis-docomo-raw sjis-kddi-cp932-raw sjis-kddi-auto-raw sjis-softbank-auto-raw sjis-airh-raw
17    utf8-docomo utf8-kddi utf8-softbank
18);
19my %tables = (
20             Mobile_t   => [ map "ucm/x-$_.ucm", @ucms ],
21             );
22
23#### DO NOT EDIT BEYOND THIS POINT!
24require File::Spec;
25my ($enc2xs, $encode_h) = ();
26PATHLOOP:
27for 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!";
35print "enc2xs is $enc2xs\n";
36my %encode_h = ();
37for 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;
45print "encode.h is at $encode_h\n";
46
47WriteMakefile(
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",
61    },
62
63    # OS 390 winges about line numbers > 64K ???
64    XSOPT => '-nolinenumbers',
65);
66
67package MY;
68
69sub post_initialize
70{
71    my ($self) = @_;
72    my %o;
73    my $x = $self->{'OBJ_EXT'};
74    # Add the table O_FILES
75    foreach my $e (keys %tables)
76    {
77        $o{$e.$x} = 1;
78    }
79    $o{"$name$x"} = 1;
80    $self->{'O_FILES'} = [sort keys %o];
81    my @files = ("$name.xs");
82    $self->{'C'} = ["$name.c"];
83    # The next two lines to make MacPerl Happy -- dankogai via pudge
84    $self->{SOURCE} .= " $name.c"
85        if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
86    # $self->{'H'} = [$self->catfile($self->updir,'encode.h')];
87    my %xs;
88    foreach my $table (keys %tables) {
89        push (@{$self->{'C'}},"$table.c");
90        # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
91        # get built.
92        foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
93            push (@files,$table.$ext);
94        }
95    }
96    $self->{'XS'} = { "$name.xs" => "$name.c" };
97    $self->{'clean'}{'FILES'} .= join(' ',@files);
98    open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
99    print XS <<'END';
100#include <EXTERN.h>
101#include <perl.h>
102#include <XSUB.h>
103#define U8 U8
104#include "encode.h"
105END
106    foreach my $table (keys %tables) {
107        print XS qq[#include "${table}.h"\n];
108    }
109    print XS <<"END";
110
111static void
112Encode_XSEncoding(pTHX_ encode_t *enc)
113{
114 dSP;
115 HV *stash = gv_stashpv("Encode::XS", TRUE);
116 SV *sv    = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
117 int i = 0;
118 PUSHMARK(sp);
119 XPUSHs(sv);
120 while (enc->name[i])
121  {
122   const char *name = enc->name[i++];
123   XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
124  }
125 PUTBACK;
126 call_pv("Encode::define_encoding",G_DISCARD);
127 SvREFCNT_dec(sv);
128}
129
130MODULE = Encode::$modname       PACKAGE = Encode::$modname
131PROTOTYPES: DISABLE
132BOOT:
133{
134END
135    foreach my $table (keys %tables) {
136        print XS qq[#include "${table}.exh"\n];
137    }
138    print XS "}\n";
139    close(XS);
140    return "# Built $name.xs\n\n";
141}
142
143sub postamble
144{
145    my $self = shift;
146    my $dir  = "."; # $self->catdir('Encode');
147    my $str  = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
148    $str    .= "$name.c : $name.xs ";
149    foreach my $table (keys %tables)
150    {
151        $str .= " $table.c";
152    }
153    $str .= "\n\n";
154    $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
155
156    foreach my $table (keys %tables)
157    {
158        my $numlines = 1;
159        my $lengthsofar = length($str);
160        my $continuator = '';
161        $str .= "$table.c : Makefile.PL";
162        foreach my $file (@{$tables{$table}})
163        {
164            $str .= $continuator.' '.$self->catfile($dir,$file);
165            if ( length($str)-$lengthsofar > 128*$numlines )
166            {
167                $continuator .= " \\\n\t";
168                $numlines++;
169            } else {
170                $continuator = '';
171            }
172        }
173        my $plib   = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
174        my $ucopts = '-"Q"';
175        $str .= 
176            qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
177        open (FILELIST, ">$table.fnm")
178            || die "Could not open $table.fnm: $!";
179        foreach my $file (@{$tables{$table}})
180        {
181            print FILELIST $self->catfile($dir,$file) . "\n";
182        }
183        close(FILELIST);
184    }
185
186    $str .= <<"...";
187config ::
188\t\$(NOECHO) \$(MOD_INSTALL) \\
189\t\t"dat" \$(INST_AUTODIR)
190...
191
192    return $str;
193}
194
Note: See TracBrowser for help on using the browser.