2 # $Id: Makefile.PL,v 2.8 2009/07/08 13:34:15 dankogai Exp $
7 use ExtUtils::MakeMaker;
11 my %ARGV = map { my @r = split /=/,$_; defined $r[1] or $r[1]=1; @r } @ARGV;
12 $ARGV{DEBUG} and warn "$_ => $ARGV{$_}\n" for keys %ARGV;
13 $ENV{PERL_CORE} ||= $ARGV{PERL_CORE} if $ARGV{PERL_CORE};
17 def_t => ['ascii.ucm',
24 my @exe_files = qw(bin/enc2xs
27 my @more_exe_files = qw(
30 my @pmlibdirs = qw(lib Encode);
32 $ARGV{MORE_SCRIPTS} and push @exe_files, @more_exe_files;
33 $ARGV{INSTALL_UCM} and push @pmlibdirs, "ucm";
37 EXE_FILES => \@exe_files,
38 VERSION_FROM => 'Encode.pm',
39 OBJECT => '$(O_FILES)',
41 COMPRESS => 'gzip -9f',
43 DIST_DEFAULT => 'all tardist',
45 INC => '-I' . File::Spec->catfile( '.', 'Encode' ),
46 PMLIBDIRS => \@pmlibdirs,
47 INSTALLDIRS => 'perl',
57 # Find existing O_FILES
58 foreach my $f (@{$self->{'O_FILES'}})
62 my $x = $self->{'OBJ_EXT'};
63 # Add the table O_FILES
64 foreach my $e (keys %tables)
68 # Trick case-blind filesystems.
69 delete $o{'encode'.$x};
72 $self->{'O_FILES'} = [sort keys %o];
74 foreach my $table (keys %tables)
76 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm))
78 push (@files,$table.$ext);
80 $self->{SOURCE} .= " $table.c"
81 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
83 $self->{'clean'}{'FILES'} .= join(' ',@files);
90 my $dir = $self->catdir($self->curdir,'ucm');
91 my $str = "# Encode\$(OBJ_EXT) does not depend on .c files directly\n";
92 $str .= "# (except Encode.c), but on .h and .exh files written by enc2xs\n";
93 $str .= $^O eq 'MacOS' ? 'Encode.c.{$(MACPERL_BUILD_EXT_STATIC)}.o :' : 'Encode$(OBJ_EXT) :';
95 foreach my $table (keys %tables)
100 foreach my $table (keys %tables)
103 my $lengthsofar = length($str);
104 my $continuator = '';
105 my $enc2xs = $self->catfile('bin', 'enc2xs');
106 $str .= "$table.c : $enc2xs Makefile.PL";
107 foreach my $file (@{$tables{$table}})
109 $str .= $continuator.' '.$self->catfile($dir,$file);
110 if ( length($str)-$lengthsofar > 128*$numlines )
112 $continuator .= " \\\n\t";
118 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
119 $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
120 my $ucopts = '-"Q" -"O"';
122 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
123 open (FILELIST, ">$table.fnm")
124 || die "Could not open $table.fnm: $!";
125 foreach my $file (@{$tables{$table}})
127 print FILELIST $self->catfile($dir,$file) . "\n";