2 use ExtUtils::MakeMaker;
5 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
6 # the contents of the Makefile that is written.
8 'NAME' => 'Win32API::File',
9 'VERSION_FROM' => 'File.pm', # finds $VERSION
10 ( $Config{archname} =~ /-object\b/i ? ( 'CAPI' => 'TRUE' ) : () ),
12 ( 'AUTHOR' => 'Tye McQueen <tye@metronet.com>',
13 'ABSTRACT_FROM' => 'File.pm' )
15 'postamble' => { IMPORT_LIST => [qw(/._/ !/[a-z]/ :MEDIA_TYPE)],
16 IFDEF => "!/[a-z\\d]/",
19 # Comment out next line to rebuild constants defs:
22 ( ! $Config{libperl} ? () : ( LIBPERL_A => $Config{libperl} ) ),
25 # Replacement for MakeMaker's "const2perl section" for versions
26 # of MakeMaker prior to the addition of this functionality:
29 my( $self, %attribs )= @_;
31 # Don't do anything if MakeMaker has const2perl
32 # that already took care of all of this:
33 return unless %attribs;
35 # Don't require these here if we just C<return> above:
36 eval "use ExtUtils::Myconst2perl qw(ParseAttribs); 1" or die "$@";
37 eval "use ExtUtils::MakeMaker qw(neatvalue); 1" or die "$@";
39 # If only one module, can skip one level of indirection:
40 my $hvAttr= \%attribs;
41 if( $attribs{IMPORT_LIST} ) {
42 $hvAttr= { $self->{NAME} => \%attribs };
45 my( $module, @m, $_final, @clean, @realclean );
46 foreach $module ( keys %$hvAttr ) {
47 my( $outfile, @perlfiles, @cfiles, $bin, $obj, $final, $noreb );
49 # Translate user-friendly options into coder-friendly specifics:
50 ParseAttribs( $module, $hvAttr->{$module}, { OUTFILE => \$outfile,
51 C_FILE_LIST => \@perlfiles, PERL_FILE_LIST => \@cfiles,
52 OBJECT => \$obj, BINARY => \$bin, FINAL_PERL => \$final,
53 NO_REBUILD => \$noreb } );
54 die "IFDEF option in Makefile.PL must be string, not code ref.\n"
55 if ref $hvAttr->{$module}->{IFDEF};
56 die qq{IFDEF option in Makefile.PL must not contain quotes (").\n}
57 if ref $hvAttr->{$module}->{IFDEF};
59 # How to create F<$outfile> via ExtUtils::Myconst2perl::Myconst2perl:
61 $outfile: @perlfiles @cfiles Makefile" . '
62 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Myconst2perl \\
65 $m[-1] =~ s/^/##/gm if $noreb;
67 while( ( $key, $value )= each %{$hvAttr->{$module}} ) {
68 push @m, '-e "$$attribs{' . $key . '}= '
69 . neatvalue($value) . qq[;" \\\n\t ];
70 $m[-1] =~ s/^/##/gm if $noreb;
72 push @m, '-e "Myconst2perl(' . neatvalue($module) . ",%attribs)\"\n";
74 # If requested extra work to generate Perl instead of XS code:
76 my @path= split /::/, $module;
80 # How to compile F<$outfile> and then run it to produce F<$final>:
83 $(CC) $(INC) $(CCFLAGS) $(OPTIMIZE) $(PERLTYPE) $(LARGE) \\
84 $(SPLIT) $(DEFINE_VERSION) $(XS_DEFINE_VERSION) -I$(PERL_INC) \\
85 $(DEFINE)' . $outfile . " "
86 . $self->catfile(qw[ $(PERL_INC) $(LIBPERL_A) ]) . " -o $bin
89 " . $self->catfile(".",$bin) . " >$final\n";
90 $m[-1] =~ s/^/##/gm if $noreb;
92 # Make sure the rarely-used $(INST_ARCHLIB) directory exists:
93 push @m, $self->dir_target('$(INST_ARCHLIB)');
95 ##warn qq{$path[-1].pm should C<require "},
96 ## join("/",@path,$final), qq{">.\n};
97 # Install F<$final> whenever regular pm_to_blib target is built:
99 pm_to_blib: ${_final}_to_blib
101 ${_final}_to_blib: $final
102 " . '@$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \\
103 "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \\
104 -e "pm_to_blib({ ',neatvalue($final),',',
105 neatvalue($self->catfile('$(INST_ARCHLIB)',@path,$final)), ' },',
106 neatvalue($self->catfile(qw[$(INST_LIB) auto])), ')"
107 @$(TOUCH) ', $_final, "_to_blib\n";
109 push( @clean, $outfile, $bin, $obj, $_final . "_to_blib" );
110 push( @realclean, $final ) unless $noreb;
113 ##my $name= ( split /::/, $module )[-1];
114 ##warn qq{$name.xs should C<#include "$final"> },
115 ## qq{in the C<BOOT:> section\n};
116 push( @realclean, $outfile ) unless $noreb;
122 $self->{RM_F} @clean\n" if @clean;
125 $self->{RM_F} @realclean\n" if @realclean;