Commit | Line | Data |
---|---|---|
6b09c160 | 1 | package ExtUtils::CBuilder::Platform::darwin; |
c39276c1 | 2 | |
83dcc064 | 3 | use warnings; |
6b09c160 YST |
4 | use strict; |
5 | use ExtUtils::CBuilder::Platform::Unix; | |
e3066f81 | 6 | use Config; |
6b09c160 | 7 | |
8bae84e5 | 8 | our $VERSION = '0.280240'; # VERSION |
1a58b39a | 9 | our @ISA = qw(ExtUtils::CBuilder::Platform::Unix); |
6b09c160 | 10 | |
e3066f81 TC |
11 | my ($osver) = split /\./, $Config{osvers}; |
12 | my $apple_cor = $^X eq "/usr/bin/perl" && $osver >= 18; | |
13 | ||
6b09c160 YST |
14 | sub 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//; | |
7fc0439b CBW |
22 | |
23 | # XCode 12 makes this fatal, breaking tons of XS modules | |
24 | $cf->{ccflags} .= ($cf->{ccflags} ? ' ' : '').'-Wno-error=implicit-function-declaration'; | |
25 | ||
6b09c160 YST |
26 | $self->SUPER::compile(@_); |
27 | } | |
28 | ||
e3066f81 TC |
29 | sub 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 | } | |
6b09c160 YST |
42 | |
43 | 1; |