Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / build / Wx / build / MakeMaker / Win32.pm
1 package Wx::build::MakeMaker::Win32;
2
3 use strict;
4 use base 'Wx::build::MakeMaker::Any_OS';
5 use Wx::build::Utils;
6 use Config;
7
8 sub is_mingw() { $Config{cc} =~ /gcc/ }
9 sub is_msvc() { $Config{cc} =~ /cl/ }
10
11 sub get_flags {
12   my $this = shift;
13   my %config = $this->SUPER::get_flags;
14
15   $config{CC} = Alien::wxWidgets->compiler;
16   $config{LD} = Alien::wxWidgets->linker;
17   # used to be CCFLAGS, but overrode CCFLAGS from MakeMaker
18   $config{CC} .= ' ' . Alien::wxWidgets->c_flags . ' ';
19 #  $config{dynamic_lib}{OTHERLDFLAGS} = Alien::wxWidgets->link_flags;
20   $config{clean}{FILES} .= is_mingw ? ' dll.base dll.exp '
21                                     :' *.pdb *.pdb *_def.old ';
22   $config{DEFINE} .= Alien::wxWidgets->defines . ' ';
23   $config{INC} .= Alien::wxWidgets->include_path;
24
25   if( $this->_debug ) {
26     $config{OPTIMIZE} = ' ';
27   }
28
29   if( is_mingw() ) {
30       # add $MINGWDIR/lib to lib search path, to stop perl from complaining...
31       my $path = Wx::build::Utils::path_search( 'gcc.exe' )
32         or warn "Unable to find gcc";
33       $path =~ s{bin[\\/]gcc\.exe$}{}i;
34       $config{LIBS} = "-L${path}lib " . ( $config{LIBS} || '' );
35   } else {
36       $config{DEFINE} .= '-D_CRT_SECURE_NO_DEPRECATE ';
37   }
38
39   return %config;
40 }
41
42 sub configure_core {
43   my $this = shift;
44   my %config = $this->SUPER::configure_core( @_ );
45
46   my $res = $this->_res_file;
47   $config{depend}      = { $res => 'Wx.rc ' };
48   $config{LDFROM}     .= "\$(OBJECT) $res ";
49   $config{dynamic_lib}{INST_DYNAMIC_DEP} .= " $res";
50   $config{clean}{FILES} .= " $res Wx_def.old";
51
52   return %config;
53 }
54
55 sub postamble_core {
56   my $this = shift;
57   my $text = $this->SUPER::postamble_core( @_ );
58
59   return $text unless $Wx::build::MakeMaker::Core::has_alien;
60
61   my $wxdir = Alien::wxWidgets->wx_base_directory;
62   my $command = $this->_res_command;
63   my $res_file = $this->_res_file;
64
65   $command =~ s/%incdir/$wxdir\\include/;
66   $command =~ s/%src/Wx.rc/;
67   $command =~ s/%dest/$res_file/;
68   my $strip = $this->_strip_command;
69
70   $text .= sprintf <<'EOT', $res_file, $command, $strip;
71
72 %s : Wx.rc
73         %s
74
75 # for compatibility
76 ppmdist : ppm
77
78 ppm : pure_all
79 %s
80         perl script/make_ppm.pl
81
82 EOT
83 }
84
85 1;
86
87 # local variables:
88 # mode: cperl
89 # end: