1N/A#
1N/A# CDDL HEADER START
1N/A#
1N/A# The contents of this file are subject to the terms of the
1N/A# Common Development and Distribution License, Version 1.0 only
1N/A# (the "License"). You may not use this file except in compliance
1N/A# with the License.
1N/A#
1N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1N/A# or http://www.opensolaris.org/os/licensing.
1N/A# See the License for the specific language governing permissions
1N/A# and limitations under the License.
1N/A#
1N/A# When distributing Covered Code, include this CDDL HEADER in each
1N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1N/A# If applicable, add the following below this CDDL HEADER, with the
1N/A# fields enclosed by brackets "[]" replaced with your own identifying
1N/A# information: Portions Copyright [yyyy] [name of copyright owner]
1N/A#
1N/A# CDDL HEADER END
1N/A#
1N/Ause 5.7.2;
1N/Ause strict;
1N/Ause ExtUtils::MakeMaker;
1N/A
1N/Amy $name = 'Symbol';
1N/Amy %tables = (
1N/A symbol_t => [qw(
1N/A symbol.ucm
1N/A dingbats.ucm
1N/A adobeSymbol.ucm
1N/A adobeZdingbat.ucm
1N/A macSymbol.ucm
1N/A macDingbats.ucm
1N/A )
1N/A ],
1N/A );
1N/A
1N/AWriteMakefile(
1N/A INC => "-I../Encode",
1N/A NAME => 'Encode::'.$name,
1N/A VERSION_FROM => "$name.pm",
1N/A OBJECT => '$(O_FILES)',
1N/A 'dist' => {
1N/A COMPRESS => 'gzip -9f',
1N/A SUFFIX => 'gz',
1N/A DIST_DEFAULT => 'all tardist',
1N/A },
1N/A MAN3PODS => {},
1N/A # OS 390 winges about line numbers > 64K ???
1N/A XSOPT => '-nolinenumbers',
1N/A );
1N/A
1N/Apackage MY;
1N/A
1N/Asub post_initialize
1N/A{
1N/A my ($self) = @_;
1N/A my %o;
1N/A my $x = $self->{'OBJ_EXT'};
1N/A # Add the table O_FILES
1N/A foreach my $e (keys %tables)
1N/A {
1N/A $o{$e.$x} = 1;
1N/A }
1N/A $o{"$name$x"} = 1;
1N/A $self->{'O_FILES'} = [sort keys %o];
1N/A my @files = ("$name.xs");
1N/A $self->{'C'} = ["$name.c"];
1N/A $self->{SOURCE} .= " $name.c"
1N/A if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
1N/A $self->{'H'} = [$self->catfile($self->updir,'Encode', 'encode.h')];
1N/A my %xs;
1N/A foreach my $table (keys %tables) {
1N/A push (@{$self->{'C'}},"$table.c");
1N/A # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
1N/A # get built.
1N/A foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
1N/A push (@files,$table.$ext);
1N/A }
1N/A $self->{SOURCE} .= " $table.c"
1N/A if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
1N/A }
1N/A $self->{'XS'} = { "$name.xs" => "$name.c" };
1N/A $self->{'clean'}{'FILES'} .= join(' ',@files);
1N/A open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
1N/A print XS <<'END';
1N/A#include <EXTERN.h>
1N/A#include <perl.h>
1N/A#include <XSUB.h>
1N/A#define U8 U8
1N/A#include "encode.h"
1N/AEND
1N/A foreach my $table (keys %tables) {
1N/A print XS qq[#include "${table}.h"\n];
1N/A }
1N/A print XS <<"END";
1N/A
1N/Astatic void
1N/AEncode_XSEncoding(pTHX_ encode_t *enc)
1N/A{
1N/A dSP;
1N/A HV *stash = gv_stashpv("Encode::XS", TRUE);
1N/A SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
1N/A int i = 0;
1N/A PUSHMARK(sp);
1N/A XPUSHs(sv);
1N/A while (enc->name[i])
1N/A {
1N/A const char *name = enc->name[i++];
1N/A XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
1N/A }
1N/A PUTBACK;
1N/A call_pv("Encode::define_encoding",G_DISCARD);
1N/A SvREFCNT_dec(sv);
1N/A}
1N/A
1N/AMODULE = Encode::$name PACKAGE = Encode::$name
1N/APROTOTYPES: DISABLE
1N/ABOOT:
1N/A{
1N/AEND
1N/A foreach my $table (keys %tables) {
1N/A print XS qq[#include "${table}.exh"\n];
1N/A }
1N/A print XS "}\n";
1N/A close(XS);
1N/A return "# Built $name.xs\n\n";
1N/A}
1N/A
1N/Asub postamble
1N/A{
1N/A my $self = shift;
1N/A my $dir = $self->catdir($self->updir,'ucm');
1N/A my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
1N/A $str .= "$name.c : $name.xs ";
1N/A foreach my $table (keys %tables)
1N/A {
1N/A $str .= " $table.c";
1N/A }
1N/A $str .= "\n\n";
1N/A $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
1N/A
1N/A my $enc2xs = $self->catfile($self->updir,'bin', 'enc2xs');
1N/A foreach my $table (keys %tables)
1N/A {
1N/A my $numlines = 1;
1N/A my $lengthsofar = length($str);
1N/A my $continuator = '';
1N/A $str .= "$table.c : $enc2xs Makefile.PL";
1N/A foreach my $file (@{$tables{$table}})
1N/A {
1N/A $str .= $continuator.' '.$self->catfile($dir,$file);
1N/A if ( length($str)-$lengthsofar > 128*$numlines )
1N/A {
1N/A $continuator .= " \\\n\t";
1N/A $numlines++;
1N/A } else {
1N/A $continuator = '';
1N/A }
1N/A }
1N/A my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
1N/A $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
1N/A my $ucopts = '-"Q" -"O"';
1N/A $str .=
1N/A qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
1N/A open (FILELIST, ">$table.fnm")
1N/A || die "Could not open $table.fnm: $!";
1N/A foreach my $file (@{$tables{$table}})
1N/A {
1N/A print FILELIST $self->catfile($dir,$file) . "\n";
1N/A }
1N/A close(FILELIST);
1N/A }
1N/A return $str;
1N/A}
1N/A