From: Alex Waugh Date: Mon, 17 Apr 2006 00:14:26 +0000 (+0100) Subject: Support compiling for RISC OS X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ee146b12403586cf7249a676b2be9b7658f67fd;p=p5sagit%2Fp5-mst-13.2.git Support compiling for RISC OS Message-ID: <2498b2184e.ajw498@caramel.cp15.org> p4raw-id: //depot/perl@27884 --- diff --git a/MANIFEST b/MANIFEST index e45ccad..a09802c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1291,6 +1291,7 @@ hints/powerux.sh Hints for named architecture hints/qnx.sh Hints for named architecture hints/README.hints Notes about hints hints/rhapsody.sh Hints for named architecture +hints/riscos.sh Hints for named architecture hints/sco_2_3_0.sh Hints for named architecture hints/sco_2_3_1.sh Hints for named architecture hints/sco_2_3_2.sh Hints for named architecture @@ -3021,6 +3022,7 @@ README.os390 Perl notes for OS/390 README.os400 Perl notes for OS/400 README.plan9 Perl notes for Plan 9 README.qnx Perl notes for QNX +README.riscos Perl notes for RISC OS README.solaris Perl notes for Solaris README.symbian Perl notes for Symbian README.tru64 Perl notes for Tru64 diff --git a/README.riscos b/README.riscos new file mode 100644 index 0000000..61202fe --- /dev/null +++ b/README.riscos @@ -0,0 +1,63 @@ +If you read this file _as_is_, just ignore the funny characters you +see. It is written in the POD format (see pod/perlpod.pod) which is +specifically designed to be readable as is. + +=head1 NAME + +README.riscos - Perl version 5 for RISC OS + +=head1 DESCRIPTION + +This document give instructions for building Perl for RISC OS. It is +complicated by the need to cross compile. There is a binary version of +perl available from L which you may wish to +use instead of trying to compile it yourself. + +=head1 BUILD + +You need an installed and working gccsdk cross compiler +L and REXEN +L + +Firstly, copy the source and build a native copy of perl for your host +system. +Then, in the source to be cross compiled: + +=over 4 + +=item + + $ ./Configure + +=item + +Select the riscos hint file. The default answers for the rest of the +questions are usually sufficient. + +=item + + $ make miniperl + +=item + +This should build miniperl and then fail when it tries to run it. + +=item + +Copy the miniperl executable from the native build done earlier to +replace the cross compiled miniperl. + +=item + + $ make + +=item + +This will use miniperl to complete the rest of the build. + +=back + +=head1 AUTHOR + +Alex Waugh + diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL index a09f9f6..ac38f39 100644 --- a/ext/Errno/Errno_pm.PL +++ b/ext/Errno/Errno_pm.PL @@ -134,6 +134,12 @@ sub get_files { } elsif ($Config{archname} eq 'epoc') { # Watch out for cross compiling for EPOC (usually done on linux) $file{'/usr/local/epocemx/epocsdk/include/libc/sys/errno.h'} = 1; + } elsif ($Config{archname} eq 'arm-riscos') { + # Watch out for cross compiling for RISC OS + my $dep = `echo "#include " | gcc -E -M -`; + if ($dep =~ /(\S+errno\.h)/) { + $file{$1} = 1; + } } elsif ($^O eq 'linux' && $Config{gccversion} ne '' # might be using, say, Intel's icc ) { diff --git a/hints/riscos.sh b/hints/riscos.sh new file mode 100644 index 0000000..e87e99c --- /dev/null +++ b/hints/riscos.sh @@ -0,0 +1,20 @@ +#! /bin/sh +# riscos.sh - hints for building perl using the gccsdk cross compiler for RISC OS +# + + +cc='gcc' +locincpth="" +ccflags="-mpoke-function-name -DDYNAMIC_ENV_FETCH -DPERL_USE_SAFE_PUTENV" +prefix='/' +osname='riscos' +libpth=' ' +optimize='-O2' +myarchname='' +archname='arm-riscos' +installprefix='~/PerlInst' +mkdir -p $installprefix +startperl="#!/usr/bin/perl" +i_shadow='undef' +ebcdic='undef' + diff --git a/hv.c b/hv.c index d912ccd..09b1b3f 100644 --- a/hv.c +++ b/hv.c @@ -2118,7 +2118,7 @@ Perl_hv_iternext_flags(pTHX_ HV *hv, I32 flags) iter->xhv_eiter = NULL; /* HvEITER(hv) = NULL */ return NULL; } -#ifdef DYNAMIC_ENV_FETCH /* set up %ENV for iteration */ +#if defined(DYNAMIC_ENV_FETCH) && !defined(__riscos__) /* set up %ENV for iteration */ if (!entry && SvRMAGICAL((SV*)hv) && mg_find((SV*)hv, PERL_MAGIC_env)) { prime_env_iter(); #ifdef VMS diff --git a/util.c b/util.c index e27d02e..18a5cd5 100644 --- a/util.c +++ b/util.c @@ -1601,15 +1601,15 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val) } else safesysfree(environ[i]); - nlen = strlen(nam); - vlen = strlen(val); + nlen = strlen(nam); + vlen = strlen(val); - environ[i] = (char*)safesysmalloc((nlen+vlen+2) * sizeof(char)); - /* all that work just for this */ - my_setenv_format(environ[i], nam, nlen, val, vlen); + environ[i] = (char*)safesysmalloc((nlen+vlen+2) * sizeof(char)); + /* all that work just for this */ + my_setenv_format(environ[i], nam, nlen, val, vlen); } else { # endif -# if defined(__CYGWIN__) || defined(EPOC) || defined(__SYMBIAN32__) +# if defined(__CYGWIN__) || defined(EPOC) || defined(__SYMBIAN32__) || defined(__riscos__) # if defined(HAS_UNSETENV) if (val == NULL) { (void)unsetenv(nam);