ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/staticperl/perl/ext/Encode/Symbol/Makefile.PL
Revision: 1.1
Committed: Thu Jun 30 14:26:47 2005 UTC (21 years, 3 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: PERL-5-8-7, HEAD
Branch point for: PERL
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 use 5.7.2;
2     use strict;
3     use ExtUtils::MakeMaker;
4    
5     my $name = 'Symbol';
6     my %tables = (
7     symbol_t => [qw(
8     symbol.ucm
9     dingbats.ucm
10     adobeSymbol.ucm
11     adobeZdingbat.ucm
12     macSymbol.ucm
13     macDingbats.ucm
14     )
15     ],
16     );
17    
18     WriteMakefile(
19     INC => "-I../Encode",
20     NAME => 'Encode::'.$name,
21     VERSION_FROM => "$name.pm",
22     OBJECT => '$(O_FILES)',
23     'dist' => {
24     COMPRESS => 'gzip -9f',
25     SUFFIX => 'gz',
26     DIST_DEFAULT => 'all tardist',
27     },
28     MAN3PODS => {},
29     # OS 390 winges about line numbers > 64K ???
30     XSOPT => '-nolinenumbers',
31     );
32    
33     package MY;
34    
35     sub post_initialize
36     {
37     my ($self) = @_;
38     my %o;
39     my $x = $self->{'OBJ_EXT'};
40     # Add the table O_FILES
41     foreach my $e (keys %tables)
42     {
43     $o{$e.$x} = 1;
44     }
45     $o{"$name$x"} = 1;
46     $self->{'O_FILES'} = [sort keys %o];
47     my @files = ("$name.xs");
48     $self->{'C'} = ["$name.c"];
49     $self->{SOURCE} .= " $name.c"
50     if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
51     $self->{'H'} = [$self->catfile($self->updir,'Encode', 'encode.h')];
52     my %xs;
53     foreach my $table (keys %tables) {
54     push (@{$self->{'C'}},"$table.c");
55     # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
56     # get built.
57     foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
58     push (@files,$table.$ext);
59     }
60     $self->{SOURCE} .= " $table.c"
61     if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
62     }
63     $self->{'XS'} = { "$name.xs" => "$name.c" };
64     $self->{'clean'}{'FILES'} .= join(' ',@files);
65     open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
66     print XS <<'END';
67     #include <EXTERN.h>
68     #include <perl.h>
69     #include <XSUB.h>
70     #define U8 U8
71     #include "encode.h"
72     END
73     foreach my $table (keys %tables) {
74     print XS qq[#include "${table}.h"\n];
75     }
76     print XS <<"END";
77    
78     static void
79     Encode_XSEncoding(pTHX_ encode_t *enc)
80     {
81     dSP;
82     HV *stash = gv_stashpv("Encode::XS", TRUE);
83     SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
84     int i = 0;
85     PUSHMARK(sp);
86     XPUSHs(sv);
87     while (enc->name[i])
88     {
89     const char *name = enc->name[i++];
90     XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
91     }
92     PUTBACK;
93     call_pv("Encode::define_encoding",G_DISCARD);
94     SvREFCNT_dec(sv);
95     }
96    
97     MODULE = Encode::$name PACKAGE = Encode::$name
98     PROTOTYPES: DISABLE
99     BOOT:
100     {
101     END
102     foreach my $table (keys %tables) {
103     print XS qq[#include "${table}.exh"\n];
104     }
105     print XS "}\n";
106     close(XS);
107     return "# Built $name.xs\n\n";
108     }
109    
110     sub postamble
111     {
112     my $self = shift;
113     my $dir = $self->catdir($self->updir,'ucm');
114     my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
115     $str .= "$name.c : $name.xs ";
116     foreach my $table (keys %tables)
117     {
118     $str .= " $table.c";
119     }
120     $str .= "\n\n";
121     $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
122    
123     my $enc2xs = $self->catfile($self->updir,'bin', 'enc2xs');
124     foreach my $table (keys %tables)
125     {
126     my $numlines = 1;
127     my $lengthsofar = length($str);
128     my $continuator = '';
129     $str .= "$table.c : $enc2xs Makefile.PL";
130     foreach my $file (@{$tables{$table}})
131     {
132     $str .= $continuator.' '.$self->catfile($dir,$file);
133     if ( length($str)-$lengthsofar > 128*$numlines )
134     {
135     $continuator .= " \\\n\t";
136     $numlines++;
137     } else {
138     $continuator = '';
139     }
140     }
141     my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
142     $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
143     my $ucopts = '-"Q" -"O"';
144     $str .=
145     qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
146     open (FILELIST, ">$table.fnm")
147     || die "Could not open $table.fnm: $!";
148     foreach my $file (@{$tables{$table}})
149     {
150     print FILELIST $self->catfile($dir,$file) . "\n";
151     }
152     close(FILELIST);
153     }
154     return $str;
155     }
156