From: Jarkko Hietaniemi Date: Tue, 14 Jul 1998 00:07:30 +0000 (+0300) Subject: add files and tweaks needed for MPE/iX port (via PM) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1d84e8dfc14d5303f4e9e567bd263f6b4d88e584;p=p5sagit%2Fp5-mst-13.2.git add files and tweaks needed for MPE/iX port (via PM) Message-Id: <199807132107.AAA20603@alpha.hut.fi> Subject: MPE/iX patches for _73 p4raw-id: //depot/perl@1478 --- diff --git a/MANIFEST b/MANIFEST index bf6b725..ee50413 100644 --- a/MANIFEST +++ b/MANIFEST @@ -28,6 +28,7 @@ README.amiga Notes about AmigaOS port README.beos Notes about BeOS port README.cygwin32 Notes about Cygwin32 port README.dos Notes about dos/djgpp port +README.mpeix Notes about MPE/iX port README.os2 Notes about OS/2 port README.plan9 Notes about Plan9 port README.qnx Notes about QNX port @@ -193,6 +194,7 @@ ext/DynaLoader/dl_cygwin32.xs Cygwin32 implementation ext/DynaLoader/dl_dld.xs GNU dld style implementation ext/DynaLoader/dl_dlopen.xs BSD/SunOS4&5 dlopen() style implementation ext/DynaLoader/dl_hpux.xs HP-UX implementation +ext/DynaLoader/dl_mpeix.xs MPE/iX implementation ext/DynaLoader/dl_next.xs Next implementation ext/DynaLoader/dl_none.xs Stub implementation ext/DynaLoader/dl_vms.xs VMS implementation @@ -324,6 +326,7 @@ ext/attrs/Makefile.PL attrs extension makefile writer ext/attrs/attrs.pm attrs extension Perl module ext/attrs/attrs.xs attrs extension external subroutines ext/re/Makefile.PL re extension makefile writer +ext/re/hints/mpeix.pl Hints for re for named architecture ext/re/re.pm re extension Perl module ext/re/re.xs re extension external subroutines ext/util/make_ext Used by Makefile to execute extension Makefiles @@ -594,6 +597,9 @@ mg.c Magic code mg.h Magic header minimod.pl Writes lib/ExtUtils/Miniperl.pm miniperlmain.c Basic perl w/o dynamic loading or extensions +mpeix/mpeixish.h MPE/iX port +mpeix/nm MPE/iX port +mpeix/relink MPE/iX port mv-if-diff Script to mv a file if it changed myconfig Prints summary of the current configuration nostdio.h Cause compile error on stdio calls diff --git a/README.mpeix b/README.mpeix new file mode 100644 index 0000000..bb81fb1 --- /dev/null +++ b/README.mpeix @@ -0,0 +1,258 @@ + +Perl/iX for HP 3000 MPE + +http://www.cccd.edu/~markb/perlix.html +Perl language for MPE +Last updated July 8, 1998 @ 2030 UTC + + ------------------------------------------------------------------------ + +What's New + + * July 8, 1998 + o Updated to version 5.004_70 (internal developer release) which is + now MPE-ready. The next public freeware release of Perl should + compile "straight out of the box" on MPE. Note that this version + of Perl/iX was strictly internal to me and never publicly + released. + * November 6, 1997 + o Updated to version 5.004_04. No changes in MPE-specific + functionality. + * October 16, 1997 + o Added Demos section to the Perl/iX home page so you can see some + sample Perl applications running on my 3000. + + ------------------------------------------------------------------------ + +Welcome + +This is the official home page for the HP 3000 MPE port of the Perl +scripting language which gives you all of the power of C, awk, sed, and sh +in a single language. Check here for the latest news, implemented +functionality, known bugs, to-do list, etc. Status reports about major +milestones will also be posted to the HP3000-L mailing list and its +associated gatewayed newsgroup comp.sys.hp.mpe. + +I'm doing this port because I can't live without Perl on the HPUX machines +that I administer for the Coast Community College District, and I want to +have the same power available to me on MPE. + +Please send your comments, questions, and bug reports directly to me, Mark +Bixby, by e-mailing to markb@cccd.edu. Or just post them to HP3000-L. You +can also telephone me at +1 714 438-4647 Monday-Friday 0815-1745 PDT +(1615-0145 UTC). + +The platform I'm using to do this port is an HP 3000 969KS200 running +MPE/iX 5.5 and using the gcc 2.8 compiler from +http://www.interex.org/sources/freeware.html. + +The combined porting wisdom from all of my ports can be found in my MPE/iX +Porting Guide. + + ------------------------------------------------------------------------ + +System Requirements + + * MPE/iX 5.5 or later. This version of Perl/iX does NOT run on MPE/iX + 5.0 or earlier, nor does it run on "classic" MPE/V machines. + * The Perl binary requires that you must have converted your NMRL + libraries in /lib/lib*.a and /usr/lib/lib*.a to NMXL libraries + /lib/lib*.sl and /usr/lib/lib*.sl via the LIBSHP3K script that comes + with the GNUCORE portion of the FREEWARE tape. + * If you wish to recompile Perl, you must install both GNUCORE and + GNUGCC from the FREEWARE tape. + * Perl/iX will be happier if you install the MPEKX76A additional POSIX + filename characters patch, but this is optional. + * If you will be compiling Perl/iX yourself, you will also need the + /BIND/PUB/include and /BIND/PUB/lib portions of BIND/iX. + + ------------------------------------------------------------------------ + +Demos + +Here is a brief selection of some sample Perl/iX uses: + + * A web feedback CGI form that lets a web browser user enter some data + and send e-mail to the person responsible for reading the feedback + comments. The CGI is written in Perl and requires Sendmail/iX. + + ------------------------------------------------------------------------ + +How to Obtain Perl/iX + + 1. Download Perl using either FTP.ARPA.SYS or some other client + 2. Extract the installation script + 3. Edit the installation script + 4. Run the installation script + +Download Perl using FTP.ARPA.SYS from your HP 3000 (the preferred +method)..... + +:HELLO MANAGER.SYS +:XEQ FTP.ARPA.SYS +open ftp.cccd.edu +anonymous +your@email.address +bytestream +cd /pub/mpe +get perl5.004_70.tar.Z /tmp/perl.tar.Z +exit + +.....Or download using some other generic web or ftp client (the alternate +method) + +Download the following files (make sure that you use "binary mode" or +whatever client feature that is 8-bit clean): + + * Perl from http://www.cccd.edu/ftp/pub/mpe/perl5.004_70.tar.Z or + ftp://ftp.cccd.edu/pub/mpe/perl5.004_70.tar.Z + +Upload those files to your HP 3000 in an 8-bit clean bytestream manner to: + + * /tmp/perl.tar.Z + +Then extract the installation script (after both download methods) + +:CHDIR /tmp +:XEQ TAR.HPBIN.SYS 'xvfopz /tmp/perl.tar.Z INSTALL' + +Edit the installation script + +Examine the accounting structure creation commands and modify if necessary +(adding additional capabilities, choosing a non-system volume set, etc). + +:XEQ VI.HPBIN.SYS /tmp/INSTALL + +Run the installation script + +The accounting structure will be created and then all files will be +extracted from the archive. + +:XEQ SH.HPBIN.SYS /tmp/INSTALL + + ------------------------------------------------------------------------ + +Distribution Contents Highlights + +README + The file you're reading now. +INSTALL + Perl/iX Installation script. +PERL + Perl NMPRG executable. A version-numbered backup copy also exists. + You might wish to "ln -s /PERL/PUB/PERL /usr/local/bin/perl". +lib/ + Perl libraries, both core and add-on. +man/ + Perl man page documentation. +public_html/feedback.cgi + Sample feedback CGI form written in Perl. +src/perl5.004_70 + Source code. + + ------------------------------------------------------------------------ + +How to Compile Perl/iX + + 1. cd src/perl5.004_70 + 2. Read the INSTALL file for the official instructions + 3. ./Configure + 4. make + 5. ./mpeix/relink + 6. make test (expect 31 out of 5899 subtests to fail, mostly due to MPE + not supporting hard links and handling exit() return codes improperly) + 7. make install + 8. Optionally create symbolic links that point to the Perl executable, + i.e. ln -s /usr/local/bin/perl /PERL/PUB/PERL + +The summary test results from "cd t; ./perl -I../lib harness": + +Failed Test Status Wstat Total Fail Failed List of failed +------------------------------------------------------------------------------- +io/fs.t 26 8 30.77% 2-5, 7-9, 11 +io/pipe.t 12 2 16.67% 11-12 +lib/posix.t 18 1 5.56% 12 +op/die_exit.t 16 16 100.00% 1-16 +op/exec.t 8 2 25.00% 5-6 +op/stat.t 58 2 3.45% 3, 35 +Failed 6/183 test scripts, 96.72% okay. 31/5899 subtests failed, 99.47% okay. + + ------------------------------------------------------------------------ + +Getting Started with Perl/iX + +Create your Perl script files with "#!/PERL/PUB/PERL" (or an equivalent +symbolic link) as the first line. Use the chmod command to make sure that +your script has execute permission. Run your script! + +If you want to use Perl to write web server CGI scripts, obtain and install +CGI.pm. Build CGI.pm and all other add-on modules below /PERL/PUB/src/. + +Be sure to take a look at the CPAN module list. A wide variety of free Perl +software is available. + + ------------------------------------------------------------------------ + +MPE/iX Implementation Considerations + +There some minor functionality issues to be aware of when comparing Perl +for Unix (Perl/UX) to Perl/iX: + + * MPE gcc/ld doesn't properly support linking NMPRG executables against + NMXL dynamic libraries, so you must manually run mpeix/relink after + each re-build of Perl. + * Perl/iX File::Copy will use MPE's /bin/cp command to copy files by + name in order to preserve file attributes like file code. + * MPE (and thus Perl/iX) lacks support for setgrent(), endgrent(), + setpwent(), endpwent(). + * MPE (and thus Perl/iX) lacks support for hard links. + * MPE requires GETPRIVMODE() in order to bind() to ports less than + 1024. Perl/iX will call GETPRIVMODE() automatically on your behalf if + you attempt to bind() to these low-numbered ports. Note that the + Perl/iX executable and the PERL account do not normally have CAP=PM, + so if you will be bind()-ing to these privileged ports, you will + manually need to add PM capability as appropriate. + * MPE requires that you bind() to an IP address of zero. Perl/iX + automatically replaces the IP address that you pass to bind() with a + zero. + * If you use Perl/iX fcntl() against a socket it will fail, because MPE + requires that you use sfcntl() instead. Perl/iX does not presently + support sfcntl(). + * MPE requires GETPRIVMODE() in order to setuid(). There are too many + calls to setuid() within Perl/iX, so I have not attempted an automatic + GETPRIVMODE() solution similar to bind(). + + ------------------------------------------------------------------------ + +Known Bugs Under Investigation + + * None + + ------------------------------------------------------------------------ + +To-Do List + + * Make setuid()/setgid() support work. + * Make sure that fcntl() against a socket descriptor is redirected to + sfcntl(). + * Add support for Berkeley DB once I've finished porting Berkeley DB. + * Write an MPE XS extension library containing miscellaneous important + MPE functions like GETPRIVMODE(), GETUSERMODE(), and sfcntl(). + + ------------------------------------------------------------------------ + +Change History + + * October 3, 1997 + o Added System Requirements section to the Perl/iX home page just + so the prerequisites stand out more. Various other home page + tweaks. + * October 2, 1997 + o Initial public release. + * September 1997 + o Porting begins. + + ------------------------------------------------------------------------ + +Mark Bixby, markb@cccd.edu + diff --git a/ext/DynaLoader/dl_mpeix.xs b/ext/DynaLoader/dl_mpeix.xs new file mode 100644 index 0000000..808c3b0 --- /dev/null +++ b/ext/DynaLoader/dl_mpeix.xs @@ -0,0 +1,128 @@ +/* + * Author: Mark Klein (mklein@dis.com) + * Version: 2.1, 1996/07/25 + * Version: 2.2, 1997/09/25 Mark Bixby (markb@cccd.edu) + */ + +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#ifdef __GNUC__ +extern void HPGETPROCPLABEL( int parms, + char * procname, + int * plabel, + int * status, + char * firstfile, + int casesensitive, + int symboltype, + int * datasize, + int position, + int searchpath, + int binding); +#else +#pragma intrinsic HPGETPROCPLABEL +#endif +#include "dlutils.c" /* for SaveError() etc */ + +typedef struct { + char filename[PATH_MAX + 3]; + } t_mpe_dld, *p_mpe_dld; + +static AV *dl_resolve_using = Nullav; + +static void +dl_private_init() +{ + (void)dl_generic_private_init(); + dl_resolve_using = perl_get_av("DynaLoader::dl_resolve_using", 0x4); +} + +MODULE = DynaLoader PACKAGE = DynaLoader + +BOOT: + (void)dl_private_init(); + +void * +dl_load_file(filename, flags=0) + char * filename + int flags + PREINIT: + char buf[PATH_MAX + 3]; + p_mpe_dld obj = NULL; + int i; + CODE: + DLDEBUG(1,PerlIO_printf(PerlIO_stderr(), "dl_load_file(%s,%x):\n", filename, +flags)); + if (flags & 0x01) + warn("Can't make loaded symbols global on this platform while loading %s +",filename); + obj = (p_mpe_dld) safemalloc(sizeof(t_mpe_dld)); + memzero(obj, sizeof(t_mpe_dld)); + if (filename[0] == '.') + { + getcwd(buf,sizeof(buf)); + sprintf(obj->filename,"$%s/%s$",buf,filename); + } + else + sprintf(obj->filename,"$%s$",filename); + + DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," libref=%x\n", obj)); + + ST(0) = sv_newmortal() ; + if (obj == NULL) + SaveError("%s",Strerror(errno)); + else + sv_setiv( ST(0), (IV)obj); + +void * +dl_find_symbol(libhandle, symbolname) + void * libhandle + char * symbolname + CODE: + int datalen; + p_mpe_dld obj = (p_mpe_dld) libhandle; + char symname[PATH_MAX + 3]; + void * symaddr = NULL; + int status; + DLDEBUG(2,PerlIO_printf(PerlIO_stderr(),"dl_find_symbol(handle=%x, symbol=%s)\n", + libhandle, symbolname)); + ST(0) = sv_newmortal() ; + errno = 0; + + sprintf(symname, "$%s$", symbolname); + HPGETPROCPLABEL(8, symname, &symaddr, &status, obj->filename, 1, + 0, &datalen, 1, 0, 0); + + DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," symbolref(PROCEDURE) = %x\n", symaddr)); + + if (status != 0) { + SaveError("%s",(errno) ? Strerror(errno) : "Symbol not found") ; + } else { + sv_setiv( ST(0), (IV)symaddr); + } + +void +dl_undef_symbols() + PPCODE: + +# These functions should not need changing on any platform: + +void +dl_install_xsub(perl_name, symref, filename="$Package") + char * perl_name + void * symref + char * filename + CODE: + DLDEBUG(2,PerlIO_printf(PerlIO_stderr(),"dl_install_xsub(name=%s, symref=%x)\n", + perl_name, symref)); + ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)())symref, filename))); + +char * +dl_error() + CODE: + RETVAL = LastError ; + OUTPUT: + RETVAL + +# end. diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs index ec0f633..9c80c3d 100644 --- a/ext/Socket/Socket.xs +++ b/ext/Socket/Socket.xs @@ -7,6 +7,11 @@ # include # endif #include +#ifdef MPE +# define PF_INET AF_INET +# define PF_UNIX AF_UNIX +# define SOCK_RAW 3 +#endif #ifdef I_SYS_UN #include #endif diff --git a/ext/re/hints/mpeix.pl b/ext/re/hints/mpeix.pl new file mode 100644 index 0000000..d1fbb91 --- /dev/null +++ b/ext/re/hints/mpeix.pl @@ -0,0 +1,3 @@ +# Fall back to -O optimization to avoid known gcc 2.8.0 -O2 problems on MPE/iX. +# Mark Bixby +$self->{OPTIMIZE} = '-O'; diff --git a/hints/mpeix.sh b/hints/mpeix.sh index e952f0e..de3adca 100644 --- a/hints/mpeix.sh +++ b/hints/mpeix.sh @@ -1,70 +1,104 @@ -# MPE/IX does not have nm, and the linker doesn't complain -# about unresolved symbols, so these are all filled in by hand. +# The MPE/iX linker doesn't complain about unresolved symbols, and so the only +# way to test for unresolved symbols in a program is by attempting to run it. +# But this is slow, and fraught with problems, so the better solution is to use +# nm. +# +# MPE/iX lacks a fully functional native nm, so we need to use our fake nm +# script which will extract the symbol info from the native link editor and +# reformat into something nm-like. +# +# Created for 5.003 by Mark Klein, mklein@dis.com. +# Substantially revised for 5.004_01 by Mark Bixby, markb@cccd.edu. +# Revised again for 5.004_69 by Mark Bixby, markb@cccd.edu. +# osname='mpeix' -osvers='5.0' -alignbytes='8' -ccflags='-D_POSIX_SOURCE -D_SOCKET_SOURCE -D_POSIX_JOB_CONTROL' -cc='c89' -optimize='none' -d_safebcpy='undef' -d_safemcpy='undef' -intsize='8' -usemymalloc='y' -d_casti32='undef' -d_castneg='undef' -prefix='/PERL' -privlib='/PERL/PERL/lib' -archlib='/PERL/PERL/lib/mpeix' -clocktype='clock_t' -gidtype='gid_t' -groupstype='gid_t' -lseektype='off_t' -modetype='mode_t' -randbits='15' -ssizetype='ssize_t' -uidtype='uid_t' -d_stdstdio='undef' -i_pwd='undef' -i_grp='undef' -#d_fd_set='undef' -#d_fds_bits='undef' -d_chroot='undef' -d_fchmod='undef' -d_fchown='undef' -d_flock='undef' -d_Gconvert='sprintf((b),"%.*g",(n),(x))' -d_getpgrp2='undef' -d_getprior='undef' -d_killpg='undef' -d_lstat='undef' -d_seekdir='undef' -d_telldir='undef' -d_setpgrp2='undef' -d_setprior='undef' -d_setresgid='undef' -d_setresuid='undef' -d_setrgid='undef' -d_setruid='undef' -d_syscall='undef' -d_truncate='undef' -d_setregid='undef' -d_setreuid='undef' -d_setpgrp='undef' -d_chsize='undef' -d_group='undef' -d_bcmp='undef' -d_bcopy='undef' -d_bzero='undef' -d_attrib='undef' -d_dirnamlen='define' +osvers='5.5' +# +# Force Configure to use our wrapper mpeix/nm script +# +PATH="$PWD/mpeix:$PATH" +nm="$PWD/mpeix/nm" +_nm=$nm +nm_opt='-configperl' +usenm='true' +# +# Various directory locations. +# +prefix='/PERL/PUB' +archname='PA-RISC1.1' +bin="$prefix" +installman1dir="$prefix/man/man1" +installman3dir="$prefix/man/man3" +man1dir="$prefix/man/man1" +man3dir="$prefix/man/man3" +perlpath="$prefix/PERL" +scriptdir="$prefix" +startperl="#!$perlpath" +startsh='#!/bin/sh' +# +# Compiling. +# +cc='gcc' +cccdlflags='none' +ccflags='-DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -D_POSIX_JOB_CONTROL -DIS_SOCKET_CLIB_ITSELF' +locincpth='/usr/local/include /usr/contrib/include /BIND/PUB/include' +optimize='-O2' +ranlib='/bin/true' +# Special compiling options for certain source files. +regcomp_cflags='optimize=-O' +toke_cflags='ccflags="$ccflags -DARG_ZERO_IS_SCRIPT"' +# +# Linking. +# +lddlflags='-b' +libs='-lbind -lsvipc -lsocket -lm -lc' +loclibpth='/usr/local/lib /usr/contrib/lib /BIND/PUB/lib' +# +# External functions and data items. +# +d_crypt='define' +d_difftime='define' +d_dlerror='undef' +d_dlopen='undef' +d_Gconvert='gcvt((x),(n),(b))' +d_inetaton='undef' d_link='undef' -d_passwd='undef' +d_mblen='define' +d_mbstowcs='define' +d_mbtowc='define' +d_memcmp='define' +d_memcpy='define' +d_memmove='define' +d_memset='define' +d_pwage='undef' d_pwcomment='undef' +d_pwgecos='undef' +d_pwpasswd='undef' +d_setpgid='undef' +d_setsid='undef' +d_setvbuf='define' d_statblks='undef' -libs='-lsvipc -lsocket -lm -lc' -ranlib='/bin/true' -d_nice='undef' -d_cuserid='undef' +d_strchr='define' +d_strcoll='define' +d_strerrm='strerror(e)' +d_strerror='define' +d_strtod='define' +d_strtol='define' +d_strtoul='define' +d_strxfrm='define' +d_syserrlst='define' +d_time='define' +d_wcstombs='define' +d_wctomb='define' +# +# Include files. +# i_termios='undef' -d_tcgetpgrp='undef' -d_tcsetpgrp='undef' +i_time='define' +i_systime='undef' +i_systimek='undef' +timeincl='/usr/include/time.h' +# +# Data types. +# +timetype='time_t' diff --git a/installperl b/installperl index 8bb8d14..d462333 100755 --- a/installperl +++ b/installperl @@ -163,7 +163,18 @@ elsif ($^O ne 'dos') { safe_unlink("$installbin/$perl$ver$exe_ext"); copy("perl$exe_ext", "$installbin/$perl$ver$exe_ext"); chmod(0755, "$installbin/$perl$ver$exe_ext"); -} else { +} +elsif ($^O eq 'mpeix') { + # MPE lacks hard links and requires that executables with special + # capabilities reside in the MPE namespace. + safe_unlink("$installbin/perl$ver$exe_ext", $Config{perlpath}); + # Install the primary executable into the MPE namespace as perlpath. + copy("perl$exe_ext", $Config{perlpath}); + chmod(0755, $Config{perlpath}); + # Create a backup copy with the version number. + link($Config{perlpath}, "$installbin/perl$ver$exe_ext"); +} +else { safe_unlink("$installbin/$perl.exe"); copy("perl.exe", "$installbin/$perl.exe"); } @@ -225,7 +236,13 @@ foreach my $file (@corefiles) { if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) { safe_unlink("$installbin/$perl$exe_ext", "$installbin/suid$perl$exe_ext"); - link("$installbin/$perl$ver$exe_ext", "$installbin/$perl$exe_ext"); + if ($^O eq 'mpeix') { + # MPE doesn't support hard links, so use a symlink. + # We don't want another cloned copy. + symlink($Config{perlpath}, "$installbin/perl$exe_ext"); + } else { + link("$installbin/$perl$ver$exe_ext", "$installbin/$perl$exe_ext"); + } link("$installbin/s$perl$ver$exe_ext", "$installbin/suid$perl$exe_ext") if $d_dosuid; } @@ -256,11 +273,13 @@ if (!$versiononly && !$nonono && !$Is_W32 && !$Is_VMS && -t STDIN && -t STDERR (yn("Many scripts expect perl to be installed as $usrbinperl.\n" . "Do you wish to have $usrbinperl be the same as\n" . "$expinstperl? [y] "))) - { + { unlink($usrbinperl); - eval { CORE::link $instperl, $usrbinperl } || - eval { symlink $expinstperl, $usrbinperl } || - copy($instperl, $usrbinperl); + ( $Config{'d_link'} eq 'define' && + eval { CORE::link $instperl, $usrbinperl } ) || + eval { symlink $expinstperl, $usrbinperl } || + copy($instperl, $usrbinperl); + $mainperl_is_instperl = 1; } } diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm index e95168e..21473a6 100644 --- a/lib/File/Copy.pm +++ b/lib/File/Copy.pm @@ -62,7 +62,9 @@ sub copy { if (defined &syscopy && \&syscopy != \© && !$to_a_handle - && !($from_a_handle && $^O eq 'os2')) # OS/2 cannot handle handles + && !($from_a_handle && $^O eq 'os2' ) # OS/2 cannot handle handles + && !($from_a_handle && $^O eq 'mpeix') # and neither can MPE/iX. + ) { return syscopy($from, $to); } @@ -174,7 +176,20 @@ sub move { *mv = \&move; # &syscopy is an XSUB under OS/2 -*syscopy = ($^O eq 'VMS' ? \&rmscopy : \©) unless defined &syscopy; +unless (defined &syscopy) { + if ($^O eq 'VMS') { + *syscopy = \&rmscopy; + } elsif ($^O eq 'mpeix') { + *syscopy = sub { + return 0 unless @_ == 0; + # Use the MPE cp program in order to + # preserve MPE file attributes. + return system('/bin/cp', '-f', $_[0], $_[1]) == 0; + }; + } else { + *syscopy = \© + } +} 1; diff --git a/mpeix/mpeixish.h b/mpeix/mpeixish.h new file mode 100644 index 0000000..2311171 --- /dev/null +++ b/mpeix/mpeixish.h @@ -0,0 +1,139 @@ +/* + * The following symbols are defined if your operating system supports + * functions by that name. All Unixes I know of support them, thus they + * are not checked by the configuration script, but are directly defined + * here. + */ + +/* HAS_IOCTL: + * This symbol, if defined, indicates that the ioctl() routine is + * available to set I/O characteristics + */ +#define HAS_IOCTL / **/ + +/* HAS_UTIME: + * This symbol, if defined, indicates that the routine utime() is + * available to update the access and modification times of files. + */ +#define HAS_UTIME / **/ + +/* HAS_GROUP + * This symbol, if defined, indicates that the getgrnam() and + * getgrgid() routines are available to get group entries. + */ +#define HAS_GROUP / **/ + +/* HAS_PASSWD + * This symbol, if defined, indicates that the getpwnam() and + * getpwuid() routines are available to get password entries. + */ +#define HAS_PASSWD / **/ + +#define HAS_KILL +#define HAS_WAIT + +/* USEMYBINMODE + * This symbol, if defined, indicates that the program should + * use the routine my_binmode(FILE *fp, char iotype) to insure + * that a file is in "binary" mode -- that is, that no translation + * of bytes occurs on read or write operations. + */ +#undef USEMYBINMODE + +/* Stat_t: + * This symbol holds the type used to declare buffers for information + * returned by stat(). It's usually just struct stat. It may be necessary + * to include and to get any typedef'ed + * information. + */ +#define Stat_t struct stat + +/* USE_STAT_RDEV: + * This symbol is defined if this system has a stat structure declaring + * st_rdev + */ +#define USE_STAT_RDEV / **/ + +/* ACME_MESS: + * This symbol, if defined, indicates that error messages should be + * should be generated in a format that allows the use of the Acme + * GUI/editor's autofind feature. + */ +#undef ACME_MESS /**/ + +/* UNLINK_ALL_VERSIONS: + * This symbol, if defined, indicates that the program should arrange + * to remove all versions of a file if unlink() is called. This is + * probably only relevant for VMS. + */ +/* #define UNLINK_ALL_VERSIONS / **/ + +/* VMS: + * This symbol, if defined, indicates that the program is running under + * VMS. It is currently automatically set by cpps running under VMS, + * and is included here for completeness only. + */ +/* #define VMS / **/ + +/* ALTERNATE_SHEBANG: + * This symbol, if defined, contains a "magic" string which may be used + * as the first line of a Perl program designed to be executed directly + * by name, instead of the standard Unix #!. If ALTERNATE_SHEBANG + * begins with a character other then #, then Perl will only treat + * it as a command line if if finds the string "perl" in the first + * word; otherwise it's treated as the first line of code in the script. + * (IOW, Perl won't hand off to another interpreter via an alternate + * shebang sequence that might be legal Perl code.) + */ +/* #define ALTERNATE_SHEBANG "#!" / **/ + +#if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX) +# include +#endif + +#ifndef SIGABRT +# define SIGABRT SIGILL +#endif +#ifndef SIGILL +# define SIGILL 6 /* blech */ +#endif +#define ABORT() kill(getpid(),SIGABRT); + +/* + * fwrite1() should be a routine with the same calling sequence as fwrite(), + * but which outputs all of the bytes requested as a single stream (unlike + * fwrite() itself, which on some systems outputs several distinct records + * if the number_of_items parameter is >1). + */ +#define fwrite1 fwrite + +#define Stat(fname,bufptr) stat((fname),(bufptr)) +#define Fstat(fd,bufptr) fstat((fd),(bufptr)) +#define Fflush(fp) fflush(fp) +#define Mkdir(path,mode) mkdir((path),(mode)) + +#ifndef PERL_SYS_INIT +#ifdef PERL_SCO5 +/* this should be set in a hint file, not here */ +# define PERL_SYS_INIT(c,v) fpsetmask(0); MALLOC_INIT +#else +# define PERL_SYS_INIT(c,v) MALLOC_INIT +#endif +#endif + +#ifndef PERL_SYS_TERM +#define PERL_SYS_TERM() MALLOC_TERM +#endif + +#define BIT_BUCKET "/dev/null" + +#define dXSUB_SYS + +/* pw_passwd, pw_gecos, pw_age, pw_comment exist in the struct passwd + * but they contain uninitialized (as in "accessing them will crash perl") + * pointers. Stay away from them. */ + +#undef PWGECOS +#undef PRPASSWD +#undef PWAGE +#undef PWCOMMENT diff --git a/mpeix/nm b/mpeix/nm new file mode 100644 index 0000000..b2eb58d --- /dev/null +++ b/mpeix/nm @@ -0,0 +1,33 @@ +#!/bin/sh + +# MPE doesn't have a native nm, and the gcc nm isn't quite fully functional. +# +# If Perl Configure is calling us, then use the native linker to extract the +# symbol table and reformat it into something nm-like. +# +# Else it must be gcc calling us during the final link phase, so call gcc nm. + +if [ "$1" != "-configperl" ]; then + # Oops, the caller must be expecting gcc nm. Give it to them. + /usr/local/bin/nm $@ + exit $? +fi + +case $2 in + *.a) LIST="LISTRL RL=$2;DATA;ENTRYSYM" ;; + *.sl) LIST="LISTXL XL=$2;DATA;ENTRYSYM" ;; + *) exit 0 ;; +esac + +# I wanted to pipe this into awk, but it fell victim to a known pipe/streams +# bug on my multiprocessor machine. + +callci xeq linkedit.pub.sys \"$LIST\" >/tmp/nm.$$ + +awk '\ + / data univ / { printf "%-20s|%10s|%-6s|%-7s|%s\n",$1,$5,"extern","data","?"} \ + / entry univ / { printf "%-20s|%10s|%-6s|%-7s|%s\n",$1,$7,"extern","entry","?"}' /tmp/nm.$$ + +rm -f /tmp/nm.$$ + +exit 0 diff --git a/mpeix/relink b/mpeix/relink new file mode 100644 index 0000000..7760fdd --- /dev/null +++ b/mpeix/relink @@ -0,0 +1,8 @@ +#!/bin/sh + +# MPE/iX as of 5.5 does not yet properly support linking against dynamic +# libraries via gcc or ld. For now, re-run gcc without the external library +# list, and then run the native linker with the list of dynamic libraries. + +gcc -o perl perlmain.o lib/auto/DynaLoader/DynaLoader.a libperl.a `cat ext.libs` -L/BIND/PUB/lib -lbind +callci 'linkedit "altprog ./perl;xl=/lib/libsvipc.sl,/usr/lib/libsocket.sl,/lib/libm.sl,/lib/libc.sl"' diff --git a/perl.c b/perl.c index 329575a..9e29975 100644 --- a/perl.c +++ b/perl.c @@ -1721,6 +1721,9 @@ moreswitches(char *s) #ifdef __BEOS__ printf("BeOS port Copyright Tom Spindler, 1997-1998\n"); #endif +#ifdef MPE + printf("MPE/iX port Copyright by Mark Klein and Mark Bixby, 1996-1998\n"); +#endif #ifdef BINARY_BUILD_NOTICE BINARY_BUILD_NOTICE; #endif diff --git a/perl.h b/perl.h index 6be93a8..a9aaa4d 100644 --- a/perl.h +++ b/perl.h @@ -1106,7 +1106,11 @@ typedef I32 (*filter_t) _((int, SV *, int)); # if defined(PLAN9) # include "./plan9/plan9ish.h" # else -# include "unixish.h" +# if defined(MPE) +# include "mpeix/mpeixish.h" +# else +# include "unixish.h" +# endif # endif # endif #endif diff --git a/pod/perldelta.pod b/pod/perldelta.pod index c5104b0..4b49498 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -279,6 +279,8 @@ BeOS is now supported. See L. DOS is now supported under the DJGPP tools. See L. +MPE/iX is now supported. See L. + =head2 Changes in existing support Win32 support has been vastly enhanced. Support for Perl Object, a C++