darwin.pm revision 1.7
1package ExtUtils::CBuilder::Platform::darwin; 2 3use warnings; 4use strict; 5use ExtUtils::CBuilder::Platform::Unix; 6use Config; 7 8our $VERSION = '0.280238'; # VERSION 9our @ISA = qw(ExtUtils::CBuilder::Platform::Unix); 10 11my ($osver) = split /\./, $Config{osvers}; 12my $apple_cor = $^X eq "/usr/bin/perl" && $osver >= 18; 13 14sub compile { 15 my $self = shift; 16 my $cf = $self->{config}; 17 18 # -flat_namespace isn't a compile flag, it's a linker flag. But 19 # it's mistakenly in Config.pm as both. Make the correction here. 20 local $cf->{ccflags} = $cf->{ccflags}; 21 $cf->{ccflags} =~ s/-flat_namespace//; 22 23 # XCode 12 makes this fatal, breaking tons of XS modules 24 $cf->{ccflags} .= ($cf->{ccflags} ? ' ' : '').'-Wno-error=implicit-function-declaration'; 25 26 $self->SUPER::compile(@_); 27} 28 29sub arg_include_dirs { 30 my $self = shift; 31 32 if ($apple_cor) { 33 my $perl_inc = $self->perl_inc; 34 return map { 35 $_ eq $perl_inc ? ("-iwithsysroot", $_ ) : "-I$_" 36 } @_; 37 } 38 else { 39 return $self->SUPER::arg_include_dirs(@_); 40 } 41} 42 431; 44