1 package Wx::build::MakeMaker::Core::Dummy;
3 # to avoid W::b::MM clobbering our wxWriteMakefile
5 use Wx::build::MakeMaker;
7 package Wx::build::MakeMaker::Core;
10 use ExtUtils::MakeMaker;
11 use Wx::build::Utils qw'obj_from_src';
12 use Wx::build::Options;
13 use File::Path 'mkpath';
15 use vars qw(@EXPORT @subdirs);
17 @EXPORT = 'wxWriteMakefile';
19 my @top_level_xs = qw(Wx.xs Constant.xs Controls.xs Event.xs
20 Frames.xs GDI.xs Window.xs);
21 @subdirs = qw(socket dnd filesys grid help html mdi print xrc stc docview
22 calendar datetime media richtext aui dataview);
25 Wx::build::MakeMaker::_set_is_wxPerl_tree( 1 );
26 eval { require Alien::wxWidgets };
27 our $has_alien = $@ ? 0 : 1;
28 my %options = Wx::build::Options->get_makemaker_options if $has_alien;
31 @subdirs{@subdirs} = (1) x @subdirs;
32 my %opt = %{$options{subdirs}};
34 @subdirs{keys %opt} = values %opt;
36 @subdirs = grep { $subdirs{$_} } keys %subdirs;
40 # make symlinks to the source tree
42 if( $options{mksymlinks} ) {
44 require ExtUtils::Manifest;
45 require File::Spec::Functions;
47 local *catfile = \&File::Spec::Functions::catfile;
48 local *splitpath = \&File::Spec::Functions::splitpath;
50 my $manifest = MM->catfile( $FindBin::RealBin, 'MANIFEST' );
51 die "Can't find MANIFEST" unless -e $manifest;
52 my $files = ExtUtils::Manifest::maniread( $manifest );
54 foreach my $f ( keys %$files ) {
55 my( $fr, $to ) = ( catfile( $FindBin::RealBin, $f ), $f );
57 ( undef, $dir, undef ) = splitpath( $to );
58 mkpath( $dir ) if length $dir && !-d $dir;
60 if( -e $to ){ unlink $to or die "unlink '$to' failed: $!" }
61 symlink( $fr, $to ) or die "symlink '$fr' => '$to' failed: $!";
70 mkpath( 'cpp' ) or die "mkpath 'cpp': $!";
74 open OUT, "> cpp/setup.h" or die "open 'cpp/setup.h': $!";
78 // GENERATED BY Makefile.PL, DO NOT EDIT
81 #ifndef __CPP_SETUP_H__
82 #define __CPP_SETUP_H__
86 foreach my $o ( sort keys %subdirs ) {
87 print OUT "#define wxPERL_USE_", uc $o, " ", $subdirs{$o} ,"\n";
92 #endif // __CPP_SETUP_H__
98 Wx::build::Options->write_config_file( 'Opt' ) if $has_alien;
101 # WriteMakefile wrapper
103 sub wxWriteMakefile {
105 local $Wx::build::MakeMaker::is_core = 1;
108 $params{XSOPT} = ' -nolinenumbers -noprototypes ';
109 $params{CONFIGURE} = \&Wx::build::MakeMaker::configure;
110 $params{OBJECT} = join ' ', obj_from_src( @top_level_xs ), '';
113 my $build = Wx::build::MakeMaker::_process_mm_arguments( \%params, $has_alien );
116 WriteMakefile( %params );
117 unless( Alien::wxWidgets->can( 'load' ) ) {
119 ======================================================================
120 Alien::wxWidgets is missing, you will need to re-run Makefile.PL after
122 ======================================================================
125 open my $fh, ">> alien_wxwidgets_missing";
129 ExtUtils::MakeMaker::WriteEmptyMakefile( %params );