1 package Module::Build::Platform::MacOS;
6 $VERSION = eval $VERSION;
7 use Module::Build::Base;
9 @ISA = qw(Module::Build::Base);
11 use ExtUtils::Install;
13 sub have_forkpipe { 0 }
17 my $self = $class->SUPER::new(@_);
19 # $Config{sitelib} and $Config{sitearch} are, unfortunately, missing.
20 foreach ('sitelib', 'sitearch') {
21 $self->config($_ => $self->config("install$_"))
22 unless $self->config($_);
25 # For some reason $Config{startperl} is filled with a bunch of crap.
26 (my $sp = $self->config('startperl')) =~ s/.*Exit \{Status\}\s//;
27 $self->config(startperl => $sp);
36 MacPerl::SetFileInfo('McPL', 'TEXT', $_);
43 if( !@_ and !@ARGV ) {
46 # What comes first in the action list.
47 my @action_list = qw(build test install);
48 my %actions = map {+($_, 1)} $self->known_actions;
49 delete @actions{@action_list};
50 push @action_list, sort { $a cmp $b } keys %actions;
52 my %toolserver = map {+$_ => 1} qw(test disttest diff testdb);
53 foreach (@action_list) {
54 $_ .= ' *' if $toolserver{$_};
57 my $cmd = MacPerl::Pick("What build command? ('*' requires ToolServer)", @action_list);
58 return unless defined $cmd;
62 my $args = MacPerl::Ask('Any extra arguments? (ie. verbose=1)', '');
63 return unless defined $args;
64 push @ARGV, $self->split_like_shell($args);
67 $self->SUPER::dispatch(@_);
70 sub ACTION_realclean {
72 chmod 0666, $self->{properties}{build_script};
73 $self->SUPER::ACTION_realclean;
76 # ExtUtils::Install has a hard-coded '.' directory in versions less
77 # than 1.30. We use a sneaky trick to turn that into ':'.
79 # Note that we do it here in a cross-platform way, so this code could
80 # actually go in Module::Build::Base. But we put it here to be less
81 # intrusive for other platforms.
86 return $self->SUPER::ACTION_install(@_)
87 if eval {ExtUtils::Install->VERSION('1.30'); 1};
89 local $^W = 0; # Avoid a 'redefine' warning
90 local *ExtUtils::Install::find = sub {
91 my ($code, @dirs) = @_;
93 @dirs = map { $_ eq '.' ? File::Spec->curdir : $_ } @dirs;
95 return File::Find::find($code, @dirs);
98 return $self->SUPER::ACTION_install(@_);
106 Module::Build::Platform::MacOS - Builder class for MacOS platforms
110 The sole purpose of this module is to inherit from
111 C<Module::Build::Base> and override a few methods. Please see
112 L<Module::Build> for the docs.
114 =head2 Overriden Methods
120 MacPerl doesn't define $Config{sitelib} or $Config{sitearch} for some
121 reason, but $Config{installsitelib} and $Config{installsitearch} are
122 there. So we copy the install variables to the other location
124 =item make_executable()
126 On MacOS we set the file type and creator to MacPerl so it will run
131 Because there's no easy way to say "./Build test" on MacOS, if
132 dispatch is called with no arguments and no @ARGV a dialog box will
133 pop up asking what action to take and any extra arguments.
135 Default action is "test".
137 =item ACTION_realclean()
139 Need to unlock the Build program before deleting.
145 Michael G Schwern <schwern@pobox.com>
150 perl(1), Module::Build(3), ExtUtils::MakeMaker(3)