home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Acorn User 10
/
AU_CD10.iso
/
Updates
/
Perl
/
Non-RPC
/
!Perl
/
riscos
/
ExtUtils
/
MM_RISCOS.pm
Wrap
Text File
|
1999-02-20
|
9KB
|
307 lines
package ExtUtils::MM_RISCOS;
unshift @MM::ISA, 'ExtUtils::MM_RISCOS';
use vars qw($Revision);
$Revision = '0.01 (3-May-1998)';
Exporter::import('ExtUtils::MakeMaker',
qw( $Verbose &neatvalue));
=item dlsyms (o)
Used by AIX and VMS to define DL_FUNCS and DL_VARS and write the *.exp
files.
=cut
sub dlsyms {
my($self,%attribs) = @_;
return '' unless $self->needs_linking();
my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
my(@m);
push(@m,"
dynamic :: $self->{BASEEXT}.map
") unless $self->{SKIPHASH}{'dynamic'}; # dynamic and static are subs, so...
push(@m,"
static :: $self->{BASEEXT}.map
") unless $self->{SKIPHASH}{'static'}; # we avoid a warning if we tick them
push(@m,"
$self->{BASEEXT}.map: Makefile.PL
",' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ',
neatvalue($funcs),', "DL_VARS" => ', neatvalue($vars), ');\'
');
join('',@m);
}
=item dynamic_lib (o)
Defines how to produce the *.so (or equivalent) files.
=cut
sub dynamic_lib {
my($self, %attribs) = @_;
return '' unless $self->needs_linking(); #might be because of a subdir
return '' unless $self->has_link_code;
my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":";
my($ldfrom) = '$(LDFROM)';
$armaybe = 'ar' if ($^O eq 'dec_osf' and $armaybe eq ':');
my(@m);
push(@m,'
# This section creates the dynamically loadable $(INST_DYNAMIC)
# from $(OBJECT) and possibly $(MYEXTLIB).
ARMAYBE = '.$armaybe.'
OTHERLDFLAGS = '.$otherldflags.'
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
');
if ($armaybe ne ':'){
$ldfrom = 'tmp$(LIB_EXT)';
push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n");
push(@m,' $(RANLIB) '."$ldfrom\n");
}
$ldfrom = "-all $ldfrom -none" if ($^O eq 'dec_osf');
# Brain dead solaris linker does not use LD_RUN_PATH?
# This fixes dynamic extensions which need shared libs
my $ldrun = '';
$ldrun = join ' ', map "-R$_", split /:/, $self->{LD_RUN_PATH}
if ($^O eq 'solaris');
# The IRIX linker also doesn't use LD_RUN_PATH
$ldrun = qq{-rpath "$self->{LD_RUN_PATH}"}
if ($^O eq 'irix' && $self->{LD_RUN_PATH});
push(@m,' miniperl /PerlDev:dynamic_ld -o $@ '.$ldrun.' $(LDDLFLAGS) '.$ldfrom.
' $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(EXPORT_LIST)');
push @m, '
$(CHMOD) $(PERM_RWX) $@
';
push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
if (defined $self->{PERL_SRC} and $self->{INSTALLDIRS} eq "perl") {
my $wanted = "$self->{PERL_SRC}/$self->{NAME}.wanted";
$wanted =~ s/::/./g;
push(@m,"
dynamic_externals: $wanted
$wanted:".' $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
miniperl /perldev:extractsym_wrapper -o $@ '.$ldrun.' $(LDDLFLAGS) '.$ldfrom.
' $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS)');
}
join('',@m);
}
# push(@m,' miniperl /PerlDev:dynamic_obj $(LD) $@ $(LDFROM) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(EXPORT_LIST)');
sub init_others {
my($self) = @_;
$self->{FIRST_MAKEFILE} ||= "Makefile";
$self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
$self->{MAKE_APERL_FILE} ||= "Makefile.aperl";
$self->{TOUCH} ||= "touch";
$self->{TEST_F} ||= "test -f";
$self->{CP} ||= "cp";
$self->{MV} ||= "mv";
$self->{CHMOD} ||= "chmod";
$self->{UMASK_NULL} ||= "umask 0";
$self->{NOOP} = '*| noop';
$self->{CP} = "miniperl -S unix_cp";
$self->{MV} = "miniperl -S unix_mv";
$self->{RM_F} = "miniperl -S unix_rm -f"; # Keep CLI length below 256
$self->{RM_RF} = "miniperl -S unix_rm -rf";
$self->{NOECHO} = '@';
$self->{DEV_NULL} = "> null: 2>&1";
&ExtUtils::MM_Unix::init_others;
}
sub constants {
# Hack *only* the bit that gets written to the makefile, as MakeMaker itself
# calls $self->{PERL} and expects it to be Unix style
my $self = $_[0];
local $self->{PERL} = RISCOS::Filespec::riscosify $self->{PERL};
&ExtUtils::MM_Unix::constants;
}
=item tools_other (o)
Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in
the Makefile. Also defines the perl programs MKPATH,
WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.
=cut
sub tools_other {
my($self) = shift;
my @m;
my $bin_sh = $Config{sh} || '/bin/sh';
push @m, qq{
SHELL = $bin_sh
};
for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) {
push @m, "$_ = $self->{$_}\n";
}
push @m, q{
# The following is a portable way to say mkdir -p
# To see which directories are created, change the if 0 to if 1
MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath
# This helps us to minimize the effect of the .exists files A yet
# better solution would be to have a stable file in the perl
# distribution with a timestamp of zero. But this solution doesn't
# need any changes to the core distribution and works with older perls
EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime
};
return join "", @m if $self->{PARENT};
push @m, q{
# Here we warn users that an old packlist file was found somewhere,
# and that they should call some uninstall routine
WARN_IF_OLD_PACKLIST = $(PERL) -we 'exit unless -f $$ARGV[0];' \
-e 'print qq{WARNING: I have found an old package in\n};' \
-e 'print qq{\t$$ARGV[0].\n};' \
-e 'print qq{Please make sure the two installations are not conflicting\n};'
UNINST=0
VERBINST=1
MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
-e "install({@ARGV},'$(VERBINST)',0,'$(UNINST)');"
DOC_INSTALL = $(PERL) -e '$$\=qq{\n\n};' \
-e 'print qq{=head2 }, scalar(localtime), qq{: C<}, shift, qq{>}, qq{ L<}, shift, qq{>};' \
-e 'print qq{=over 4};' \
-e 'while (defined($$key = shift) and defined($$val = shift)){print qq{=item *};print qq{C<$$key: $$val>};}' \
-e 'print qq{=back};'
UNINSTALL = $(PERL) -MExtUtils::Install \
-e 'uninstall($$ARGV[0],1,1); print "\nUninstall is deprecated. Please check the";' \
-e 'print " packlist above carefully.\n There may be errors. Remove the";' \
-e 'print " appropriate files manually.\n Sorry for the inconveniences.\n"'
};
return join "", @m;
}
=item test_via_harness (o)
Helper method to write the test targets
=cut
# Sort this not to ../erpl
sub test_via_harness {
my($self, $perl, $tests) = @_;
# $perl = RISCOS::Filespec::riscosify $perl;
"\t$perl".q! -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' !."$tests\n";
}
1;
=item subdir_x (o)
Helper subroutine for subdirs
=cut
sub subdir_x {
my($self, $subdir) = @_;
my(@m);
qq{
subdirs ::
$self->{NOECHO}dumbshell -c "cd $subdir && \$(MAKE) all \$(PASTHRU)"
};
}
=item export_list
This is internal method that returns name of a file that is
passed to linker to define symbols to be exported.
UNIX does not have one but OS2 and Win32 do.
=cut
sub export_list
{
my ($self) = @_;
return "$self->{BASEEXT}.map";
}
=item static_lib (o)
Defines how to produce the *.a (or equivalent) files.
=cut
sub static_lib {
my($self) = @_;
# Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC
# return '' unless $self->needs_linking(); #might be because of a subdir
return '' unless $self->has_link_code;
my(@m);
push(@m, <<'END');
$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)/.exists
$(RM_RF) $@
END
# If this extension has it's own library (eg SDBM_File)
# then copy that to $(INST_STATIC) and add $(OBJECT) into it.
push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
push @m,
q{ $(AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@
$(CHMOD) $(PERM_RWX) $@
}.$self->{NOECHO}.q{miniperl -le 'print "$(EXTRALIBS)"' > $(INST_ARCHAUTODIR)/extralibs.ld
};
# Old mechanism - still available:
push @m,
"\t$self->{NOECHO}".q{miniperl -le 'print "$(EXTRALIBS)"' >> $(PERL_SRC)/ext.libs
} if $self->{PERL_SRC} && $self->{EXTRALIBS};
push @m, "\n";
push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
join('', "\n",@m);
}
__END__
=head1 NAME
ExtUtils::MM_RISCOS - methods to override UN*X behaviour in ExtUtils::MakeMaker
=head1 SYNOPSIS
use ExtUtils::MM_RISCOS; # Done internally by ExtUtils::MakeMaker if needed
=head1 DESCRIPTION
See ExtUtils::MM_Unix for a documentation of the methods provided
there. This package overrides the implementation of these methods, not
the semantics.