1 package Wx::build::MakeMaker::MacOSX_GCC;
4 use base 'Wx::build::MakeMaker::Any_wx_config';
5 use Wx::build::Utils qw(write_string);
7 die "Please set MACOSX_DEPLOYMENT_TARGET to 10.3 or above"
8 if $ENV{MACOSX_DEPLOYMENT_TARGET} && $ENV{MACOSX_DEPLOYMENT_TARGET} < 10.3;
12 my %config = $this->SUPER::configure_core( @_ );
14 $config{depend}{'$(INST_STATIC)'} .= ' wxPerl';
15 $config{depend}{'$(INST_DYNAMIC)'} .= ' wxPerl';
16 $config{clean}{FILES} .= " wxPerl cpp/wxPerl.osx/build cpp/wxPerl.osx/wxPerl.c cpp/wxPerl.osx/wxPerl.r";
22 my $text = shift->SUPER::const_config( @_ );
24 $text =~ s{^(LD(?:DL)?FLAGS\s*=.*?)-L/usr/local/lib/?}{$1}mg;
31 my $text = $this->SUPER::install_core( @_ );
33 $text =~ m/^(install\s*:+)/m and
34 $text .= "\n\n$1 install_wxperl\n\n";
41 my $text = $this->SUPER::postamble_core( @_ );
42 my $wx_config = $ENV{WX_CONFIG} || 'wx-config';
45 return '' unless $Wx::build::MakeMaker::Core::has_alien;
47 if( $Wx::build::MakeMaker::Core::has_alien
48 && Alien::wxWidgets->version < 2.006 ) {
49 my $rsrc = join ' ', grep { /wx/ } split ' ', `$wx_config --rezflags`;
50 $rfile = sprintf <<EOR, $rsrc;
51 echo '#include <Carbon.r>' > cpp/wxPerl.osx/wxPerl.r
52 cat %s >> cpp/wxPerl.osx/wxPerl.r
56 echo '#include <Carbon.r>' > cpp/wxPerl.osx/wxPerl.r
60 my $arch = $this->{INSTALLSITEARCH};
61 $arch =~ s/\$\(SITEPREFIX\)/$this->{PREFIX}/e;
62 $arch =~ s/\$\(INSTALL_BASE\)/$this->{INSTALL_BASE}/e;
63 write_string( 'cpp/wxPerl.osx/wxPerl.c', sprintf <<EOT, $arch );
68 int main( int argc, char **argv )
70 argv[0] = "%s/auto/Wx/wxPerl.app/Contents/MacOS/wxPerl";
71 execv( argv[0], argv );
72 perror( "wxPerl: execv" );
77 my $arch_flags = join ' ',
78 ( Alien::wxWidgets->c_flags =~ /(^|\s)(-arch\s+\w+)/g );
80 $text .= sprintf <<'EOT', $rfile, $arch_flags, $arch_flags;
83 %s # cd cpp/wxPerl.osx && xcodebuild -project wxPerl.xcode
84 cd cpp/wxPerl.osx && make ARCH_FLAGS='%s'
85 cp -p $(PERL) `find cpp -name wxPerl.app`/Contents/MacOS/wxPerl
86 mkdir -p $(INST_ARCHLIB)/auto/Wx
87 cp -rp `find cpp -name wxPerl.app` $(INST_ARCHLIB)/auto/Wx
88 $(CC) %s cpp/wxPerl.osx/wxPerl.c -o wxPerl
91 mkdir -p $(DESTINSTALLBIN)
92 cp -p wxPerl $(DESTINSTALLBIN)