2 # $Id: Makefile.PL,v 2.5 2007/05/29 18:15:32 dankogai Exp dankogai $
7 use ExtUtils::MakeMaker;
10 my %ARGV = map { my @r = split /=/,$_; defined $r[1] or $r[1]=1; @r } @ARGV;
11 $ARGV{DEBUG} and warn "$_ => $ARGV{$_}\n" for keys %ARGV;
12 $ENV{PERL_CORE} ||= $ARGV{PERL_CORE} if $ARGV{PERL_CORE};
16 def_t => ['ascii.ucm',
23 my @exe_files = qw(bin/enc2xs
26 my @more_exe_files = qw(
29 my @pmlibdirs = qw(lib Encode);
31 $ARGV{MORE_SCRIOPTS} and push @exe_files, @more_exe_files;
32 $ARGV{INSTALL_UCM} and push @pmlibdirs, "ucm";
34 @man = ( MAN1PODS => {}, MAN3PODS => {} ) if $ENV{PERL_CORE};
38 EXE_FILES => \@exe_files,
39 VERSION_FROM => 'Encode.pm',
40 OBJECT => '$(O_FILES)',
42 COMPRESS => 'gzip -9f',
44 DIST_DEFAULT => 'all tardist',
48 PMLIBDIRS => \@pmlibdirs,
49 INSTALLDIRS => 'perl',
59 # Find existing O_FILES
60 foreach my $f (@{$self->{'O_FILES'}})
64 my $x = $self->{'OBJ_EXT'};
65 # Add the table O_FILES
66 foreach my $e (keys %tables)
70 # Trick case-blind filesystems.
71 delete $o{'encode'.$x};
74 $self->{'O_FILES'} = [sort keys %o];
76 foreach my $table (keys %tables)
78 foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm))
80 push (@files,$table.$ext);
82 $self->{SOURCE} .= " $table.c"
83 if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$table\.c\b/;
85 $self->{'clean'}{'FILES'} .= join(' ',@files);
92 my $dir = $self->catdir($self->curdir,'ucm');
93 my $str = "# Encode\$(OBJ_EXT) does not depend on .c files directly\n";
94 $str .= "# (except Encode.c), but on .h and .exh files written by enc2xs\n";
95 $str .= $^O eq 'MacOS' ? 'Encode.c.{$(MACPERL_BUILD_EXT_STATIC)}.o :' : 'Encode$(OBJ_EXT) :';
97 foreach my $table (keys %tables)
102 foreach my $table (keys %tables)
105 my $lengthsofar = length($str);
106 my $continuator = '';
107 my $enc2xs = $self->catfile('bin', 'enc2xs');
108 $str .= "$table.c : $enc2xs Makefile.PL";
109 foreach my $file (@{$tables{$table}})
111 $str .= $continuator.' '.$self->catfile($dir,$file);
112 if ( length($str)-$lengthsofar > 128*$numlines )
114 $continuator .= " \\\n\t";
120 my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : '';
121 $plib .= " -MCross=$::Cross::platform" if defined $::Cross::platform;
122 my $ucopts = '-"Q" -"O"';
124 qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n};
125 open (FILELIST, ">$table.fnm")
126 || die "Could not open $table.fnm: $!";
127 foreach my $file (@{$tables{$table}})
129 print FILELIST $self->catfile($dir,$file) . "\n";