MM_MacOS.pm revision 7c478bd95313f5f23a4c958a745db2134aa03244
# MakeMaker default methods for MacOS
# This package is inserted into @ISA of MakeMaker's MM before the
# built-in ExtUtils::MM_Unix methods if MakeMaker.pm is run under MacOS.
#
# Author: Matthias Neeracher <neeracher@mac.com>
# Maintainer: Chris Nandor <pudge@pobox.com>
use vars qw($VERSION);
$VERSION = '1.07';
use Config;
use Cwd 'cwd';
require Exporter;
use vars qw(%make_data);
=head1 NAME
ExtUtils::MM_MacOS - methods to override UN*X behaviour in ExtUtils::MakeMaker
=head1 SYNOPSIS
use ExtUtils::MM_MacOS; # Done internally by ExtUtils::MakeMaker if needed
=head1 DESCRIPTION
MM_MacOS currently only produces an approximation to the correct Makefile.
=over 4
=cut
sub new {
my($key);
if (-f "MANIFEST" && ! -f "Makefile.mk"){
}
mkdir("Obj", 0777) unless -d "Obj";
check_hints($self);
} else {
require Carp;
Carp::croak("Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n");
}
}
local @ExtUtils::MakeMaker::Parent = @ExtUtils::MakeMaker::Parent; # Protect against non-local exits
{
no strict 'refs';
@{"$newclass\:\:ISA"} = 'MM';
}
my $key;
} else {
# PERL or FULLPERL will be a command verb or even a
# command with an argument instead of a full file
# specification under VMS. So, don't turn the command
# into a filespec, but do add a level to the path of
# the argument if not already absolute.
}
}
{
# inherit, but only if already unspecified
}
}
}
} else {
}
$self->init_dirscan();
$self->init_others();
# This Makefile is for the $self->{NAME} extension to perl.
#
# It was generated automatically by MakeMaker version
# $ExtUtils::MakeMaker::VERSION (Revision: $ExtUtils::MakeMaker::Revision) from the contents of
# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
#
# ANY CHANGES MADE HERE WILL BE LOST!
#
# MakeMaker Parameters:
END
foreach $key (sort keys %initial_att){
$v =~ tr/\n/ /s;
}
# turn the SKIP array into a SKIPHASH hash
}
# We skip many sections for MacOS, but we don't say anything about it in the Makefile
for (qw/ const_config tool_autosplit
/)
{
}
}
}
# We run all the subdirectories now. They don't have much to query
# from the parent, but the parent has to query them: if they need linking!
}
my $section;
if $self->{ABSTRACT_FROM};
if ($skipit){
} else {
}
}
pop @Parent;
$self;
}
sub skipcheck {
my($self) = shift;
my($section) = @_;
return '';
}
=item maybe_command
Returns true, if the argument is likely to be a command.
=cut
sub maybe_command {
return;
}
=item guess_name
Guess the name of this package by examining the working directory's
name. MakeMaker calls this only if the developer has not supplied a
NAME attribute.
=cut
sub guess_name {
my($self) = @_;
$name =~ s#:#::#g;
$name =~ s#[\-_][\d.\-]+$##; # this is new with MM 5.00
$name;
}
=item macify
Translate relative Unix filepaths into Mac names.
=cut
sub macify {
my($unix) = @_;
my(@mac);
foreach (split(/[ \t\n]+/, $unix)) {
if (m|/|) {
if ($Mac_FS) { # should always be true
} else {
s|^\./||;
s|/|:|g;
$_ = ":$_";
}
}
push(@mac, $_);
}
return "@mac";
}
=item patternify
Translate Unix filepaths and shell globs to Mac style.
=cut
sub patternify {
my($unix) = @_;
my(@mac);
foreach (split(/[ \t\n]+/, $unix)) {
if (m|/|) {
$_ = ":$_";
s|/|:|g;
s|\*|�|g;
$_ = "'$_'" if /[?�]/;
push(@mac, $_);
}
}
return "@mac";
}
=item init_main
Initializes some of NAME, FULLEXT, BASEEXT, DLBASE, PERL_SRC,
PERL_LIB, PERL_ARCHLIB, PERL_INC, INSTALLDIRS, INST_*, INSTALL*,
PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, MAP_TARGET,
LIBPERL_A, VERSION_FROM, VERSION, DISTNAME, VERSION_SYM.
=cut
sub init_main {
my($self) = @_;
# --- Initialize Module Name and Paths
# NAME = The perl module name for this extension (eg DBD::Oracle).
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
# --- Initialize PERL_LIB, INST_LIB, PERL_SRC
# *Real* information: where did we get these two from? ...
my($dir);
foreach $dir (qw(:: ::: :::: ::::: ::::::)){
if (-f "${dir}perl.h") {
last;
}
}
# Mac pathnames may be very nasty, so we'll install symlinks
unlink(":PerlCore", ":PerlLib");
symlink("$ENV{MACPERL}CORE:", "PerlCore");
symlink("$ENV{MACPERL}lib:", "PerlLib");
}
}
} else {
# hmmmmmmm ... ?
}
# make a simple check if we find Exporter
# hm ... do we really care? at all?
# warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory
# (Exporter.pm not found)"
# unless -f $self->catfile("$self->{PERL_LIB}","Exporter.pm") ||
# $self->{NAME} eq "ExtUtils::MakeMaker";
# Determine VERSION and VERSION_FROM
if ($self->{VERSION_FROM}){
# XXX replace with parse_version() override
local *FH;
die "Could not open '$self->{VERSION_FROM}' (attribute VERSION_FROM): $!";
while (<FH>) {
chop;
next unless /\$([\w:]*\bVERSION)\b.*=/;
my($eval) = "$_;";
eval $eval;
die "Could not eval '$eval': $@" if $@;
print "$self->{NAME} VERSION is $self->{VERSION} (from $self->{VERSION_FROM})\n" if $Verbose;
} else {
# XXX this should probably croak
print "WARNING: Setting VERSION via file '$self->{VERSION_FROM}' failed\n";
}
last;
}
close FH;
}
}
# Graham Barr and Paul Marquess had some ideas how to ensure
# version compatibility between the *.pm file and the
# corresponding *.xs file. The bottomline was, that we need an
# XS_VERSION macro that defaults to VERSION:
# Preprocessor definitions may be useful
# UN*X includes probably are not useful
# UN*X includes probably are not useful
}
# --- Initialize Perl Binary Locations
# Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL'
# will be working versions of perl 5. miniperl has priority over perl
# for PERL to ensure that $(PERL) is usable while building ./ext/*
}
}
=item init_others
Initializes LDLOADLIBS, LIBS
=cut
sub init_others { # --- Initialize Other Attributes
my($self) = shift;
# init_dirscan should have found out, if we have C files
} else {
}
my($src);
$src .= " $self->{BASEEXT}.c";
} elsif (/^(.*\..*)\.o$/) {
$src .= " $1";
if (-f "$1.cp") {
$src .= " $1.cp";
} else {
$src .= " $1.c";
}
} else {
$src .= " $_";
}
}
return 1;
}
=item init_platform
Add MACPERL_SRC MACPERL_LIB
=item platform_constants
Add MACPERL_SRC MACPERL_LIB MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC
MACLIBS_ALL_68K MACLIBS_ALL_PPC MACLIBS_SHARED
XXX Few are initialized. How many of these are ever used?
=cut
sub init_platform {
my $self = shift;
}
sub platform_constants {
my $self = shift;
{
$make_frag .= "$macro = $self->{$macro}\n";
}
return $make_frag;
}
=item init_dirscan
Initializes DIR, XS, PM, C, O_FILES, H, PL_FILES, MAN*PODS, EXE_FILES.
=cut
sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
my($self) = @_;
local(%pm); #the sub in find() has to see this hash
# in case we don't find it below!
if ($self->{VERSION_FROM}) {
$version_from);
}
if (-d $name){
$c{$c} = 1;
$c{$name} = 1
} elsif ($name =~ /\.h$/i){
$h{$name} = 1;
}
}
# files into the library in various locations.
# The attribute PMLIBDIRS holds an array reference which lists
# subdirectories which we should search for library files to
# install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We
# recursively search through the named directories (skipping any
# which don't exist or contain Makefile.PL files).
# For each *.pm or *.pl file found $self->libscan() is called with
# the default installation path in $_[1]. The return value of
# libscan defines the actual installation location. The default
# libscan function simply returns the path. The file is skipped
# if libscan returns false.
# The default installation location passed to libscan in $_[1] is:
#
# ./*.pm => $(INST_LIBDIR)/*.pm
# ./xyz/... => $(INST_LIBDIR)/xyz/...
# ./lib/... => $(INST_LIB)/...
#
# In this way the 'lib' directory is seen as the root of the actual
# perl library whereas the others are relative to INST_LIBDIR
# This is a subtle distinction but one that's important for nested
# modules.
#only existing directories that aren't in $dir are allowed
my ($pmlibdir);
}
print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
if ($Verbose >= 2);
if (-d $_){
}
return;
}
my($striplibpath,$striplibname);
local($_) = $inst; # for backwards compatibility
return unless $inst;
}
# Set up names of manual pages to generate from pods
}
}
}
=item init_VERSION (o)
Change DEFINE_VERSION and XS_DEFINE_VERSION
=cut
sub init_VERSION {
my $self = shift;
}
=item special_targets (o)
Add .INCLUDE
=cut
sub special_targets {
my $self = shift;
return $make_frag . <<'MAKE_FRAG';
}
=item static (o)
Defines the static target.
=cut
sub static {
# --- Static Loading Sections ---
my($self) = shift;
'
' . $extlib;
}
=item dlsyms (o)
Used by MacOS to define DL_FUNCS and DL_VARS and write the *.exp
files.
=cut
sub dlsyms {
my(@m);
push(@m,"
") unless $self->{SKIPHASH}{'dynamic'};
push(@m,"
');
join('',@m);
}
=item dynamic (o)
Defines the dynamic target.
=cut
sub dynamic {
# --- dynamic Loading Sections ---
my($self) = shift;
'
';
}
=item clean (o)
Defines the clean target.
=cut
sub clean {
# --- Cleanup and Distribution Sections ---
my(@m,$dir);
push(@m, '
# Delete temporary files but do not touch installed files. We don\'t delete
# the Makefile here so a later make realclean still has a makefile to use.
');
push @m, "\t\$(RM_RF) @otherfiles\n";
push(@m,
"\t\$(MV) \$(FIRST_MAKEFILE) \$(MAKEFILE_OLD)\n");
push(@m,
join("", @m);
}
=item clean_subdirs_target
MacOS semantics for changing directories and checking for existence
very different than everyone else.
=cut
sub clean_subdirs_target {
my($self) = shift;
# No subdirectories, no cleaning.
my $clean = "clean_subdirs :\n";
Directory %s
}
return $clean;
}
=item realclean (o)
Defines the realclean target.
=cut
sub realclean {
my(@m);
push(@m,'
# Delete temporary files (via clean) and also delete installed files
');
push(@m, "\t\$(RM_RF) @otherfiles\n") if @otherfiles;
join("", @m);
}
=item realclean_subdirs_target
MacOS semantics for changing directories and checking for existence
very different than everyone else.
=cut
sub realclean_subdirs_target {
my $self = shift;
my $rclean = "realclean_subdirs :\n";
Directory %s
If \"\`Exists -f $(FIRST_MAKEFILE)\`\" != \"\"
}
return $rclean;
}
=item rulez (o)
=cut
sub rulez {
my($self) = shift;
qq'
';
}
=item processPL (o)
Defines targets to run *.PL files.
=cut
sub processPL {
my($self) = shift;
my(@m, $plfile);
push @m, "
";
}
}
join "", @m;
}
sub cflags {
my $optimize = '';
}
}
sub _include { # for Unix-style includes, with -I instead of -i
my($inc) = @_;
# allow only relative paths
return '';
} else {
}
}
=item os_flavor
MacOS Classic is MacOS and MacOS Classic.
=cut
sub os_flavor {
return('MacOS', 'MacOS Classic');
}
=back
=cut
1;