"Fossies" - the Fresh Open Source Software Archive

Member "install-tl-20200916/tlpkg/tlperl/lib/Encode/Makefile_PL.e2x" (26 Apr 2015, 5168 Bytes) of package /windows/misc/install-tl.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #
    2 # This file is auto-generated by:
    3 # enc2xs version $_Version_
    4 # $_Now_
    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 = '$_Name_';
   13 my %tables = (
   14          $_Name__t   => [ $_TableFiles_ ],
   15          );
   16 
   17 #### DO NOT EDIT BEYOND THIS POINT!
   18 require File::Spec;
   19 my ($enc2xs, $encode_h) = ();
   20 my @path_ext = ('');
   21 @path_ext = split(';', $ENV{PATHEXT}) if $^O eq 'MSWin32';
   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         for my $ext (@path_ext) {
   28             my $bin = "$path$ext";
   29             -r "$bin" and $enc2xs = $bin and last PATHLOOP;
   30         }
   31     }
   32 }
   33 $enc2xs or die "enc2xs not found!";
   34 print "enc2xs is $enc2xs\n";
   35 my %encode_h = ();
   36 for my $d (@INC){
   37     my $dir = File::Spec->catfile($d, "Encode");
   38     my $file =  File::Spec->catfile($dir, "encode.h");
   39     -f $file and $encode_h{$dir} = -M $file;
   40 }
   41 %encode_h or die "encode.h not found!";
   42 # find the latest one
   43 ($encode_h) = sort {$encode_h{$b} <=> $encode_h{$a}} keys %encode_h;
   44 print "encode.h is at $encode_h\n";
   45 
   46 WriteMakefile(
   47               INC		=> "-I$encode_h",
   48 #### END_OF_HEADER -- DO NOT EDIT THIS LINE BY HAND! ####
   49           NAME		=> 'Encode::'.$name,
   50           VERSION_FROM	=> "$name.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'     => "1.41",
   60                            },
   61           # OS 390 winges about line numbers > 64K ???
   62           XSOPT => '-nolinenumbers',
   63           );
   64 
   65 package MY;
   66 
   67 sub post_initialize
   68 {
   69     my ($self) = @_;
   70     my %o;
   71     my $x = $self->{'OBJ_EXT'};
   72     # Add the table O_FILES
   73     foreach my $e (keys %tables)
   74     {
   75     $o{$e.$x} = 1;
   76     }
   77     $o{"$name$x"} = 1;
   78     $self->{'O_FILES'} = [sort keys %o];
   79     my @files = ("$name.xs");
   80     $self->{'C'} = ["$name.c"];
   81     # The next two lines to make MacPerl Happy -- dankogai via pudge
   82     $self->{SOURCE} .= " $name.c"
   83         if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/;
   84     # $self->{'H'} = [$self->catfile($self->updir,'encode.h')];
   85     my %xs;
   86     foreach my $table (sort keys %tables) {
   87     push (@{$self->{'C'}},"$table.c");
   88     # Do NOT add $table.h etc. to H_FILES unless we own up as to how they
   89     # get built.
   90     foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) {
   91         push (@files,$table.$ext);
   92     }
   93     }
   94     $self->{'XS'} = { "$name.xs" => "$name.c" };
   95     $self->{'clean'}{'FILES'} .= join(' ',@files);
   96     open(XS,">$name.xs") || die "Cannot open $name.xs:$!";
   97     print XS <<'END';
   98 #include <EXTERN.h>
   99 #include <perl.h>
  100 #include <XSUB.h>
  101 #include "encode.h"
  102 END
  103     foreach my $table (sort keys %tables) {
  104     print XS qq[#include "${table}.h"\n];
  105     }
  106     print XS <<"END";
  107 
  108 static void
  109 Encode_XSEncoding(pTHX_ encode_t *enc)
  110 {
  111  dSP;
  112  HV *stash = gv_stashpv("Encode::XS", TRUE);
  113  SV *iv    = newSViv(PTR2IV(enc));
  114  SV *sv    = sv_bless(newRV_noinc(iv),stash);
  115  int i = 0;
  116  /* with the SvLEN() == 0 hack, PVX won't be freed. We cast away name's
  117  constness, in the hope that perl won't mess with it. */
  118  assert(SvTYPE(iv) >= SVt_PV); assert(SvLEN(iv) == 0);
  119  SvFLAGS(iv) |= SVp_POK;
  120  SvPVX(iv) = (char*) enc->name[0];
  121  PUSHMARK(sp);
  122  XPUSHs(sv);
  123  while (enc->name[i])
  124   {
  125    const char *name = enc->name[i++];
  126    XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
  127   }
  128  PUTBACK;
  129  call_pv("Encode::define_encoding",G_DISCARD);
  130  SvREFCNT_dec(sv);
  131 }
  132 
  133 MODULE = Encode::$name	PACKAGE = Encode::$name
  134 PROTOTYPES: DISABLE
  135 BOOT:
  136 {
  137 END
  138     foreach my $table (sort keys %tables) {
  139     print XS qq[#include "${table}.exh"\n];
  140     }
  141     print XS "}\n";
  142     close(XS);
  143     return "# Built $name.xs\n\n";
  144 }
  145 
  146 sub postamble
  147 {
  148     my $self = shift;
  149     my $dir  = "."; # $self->catdir('Encode');
  150     my $str  = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n";
  151     $str    .= "$name.c : $name.xs ";
  152     foreach my $table (sort keys %tables)
  153     {
  154     $str .= " $table.c";
  155     }
  156     $str .= "\n\n";
  157     $str .= "$name\$(OBJ_EXT) : $name.c\n\n";
  158 
  159     foreach my $table (sort keys %tables)
  160     {
  161     my $numlines = 1;
  162     my $lengthsofar = length($str);
  163     my $continuator = '';
  164     $str .= "$table.c : Makefile.PL";
  165     foreach my $file (@{$tables{$table}})
  166     {
  167         $str .= $continuator.' '.$self->catfile($dir,$file);
  168         if ( length($str)-$lengthsofar > 128*$numlines )
  169         {
  170         $continuator .= " \\\n\t";
  171         $numlines++;
  172         } else {
  173         $continuator = '';
  174         }
  175     }
  176     my $plib   = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
  177     my $ucopts = '-"Q"';
  178     $str .=  
  179         qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
  180     open (FILELIST, ">$table.fnm")
  181         || die "Could not open $table.fnm: $!";
  182     foreach my $file (@{$tables{$table}})
  183     {
  184         print FILELIST $self->catfile($dir,$file) . "\n";
  185     }
  186     close(FILELIST);
  187     }
  188     return $str;
  189 }
  190