From a123eb892ee6a30b5910abc29fbccf2386306e08 Mon Sep 17 00:00:00 2001 From: Romano Date: Thu, 25 Jun 2020 15:08:04 -0700 Subject: [PATCH] Plan9/9front i386 fixes --- AUTHORS | 1 + MANIFEST | 9 +- Porting/exec-bit.txt | 3 + plan9/9front.patch | 46 ++++++ plan9/aperl | 3 +- plan9/buildinfo | 2 +- plan9/config.plan9 | 296 ++++++++++++++++++++++++----------- plan9/exclude | 1 + plan9/fndvers | 5 + plan9/genconfig.pl | 52 ++++--- plan9/math.h | 12 ++ plan9/mkfile | 432 ++++++++++++++++++++++++++++++++++++++++++--------- plan9/plan9.c | 53 +++---- plan9/plan9ish.h | 6 +- plan9/setup.rc | 58 ++++--- plan9/uninstall.rc | 25 +++ plan9/versnum | 9 +- sv.c | 6 +- 18 files changed, 756 insertions(+), 263 deletions(-) create mode 100644 plan9/9front.patch mode change 100644 => 100755 plan9/fndvers create mode 100644 plan9/math.h mode change 100644 => 100755 plan9/setup.rc create mode 100755 plan9/uninstall.rc diff --git a/AUTHORS b/AUTHORS index f8a82ff..d2db6fe 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1104,6 +1104,7 @@ Rocco Caputo Roderick Schertler Rodger Anderson Rodolfo Carvalho +Romano Ronald F. Guilmette Ronald J. Kimball Ronald Schmidt diff --git a/MANIFEST b/MANIFEST index 12601e4..8c71995 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5127,20 +5127,23 @@ perly.c parser code (NOT derived from perly.y) perly.h header file for perly.c; derived from perly.y perly.tab parser state tables; derived from perly.y perly.y Yacc grammar for perl -plan9/aperl Shell to make Perl error messages Acme-friendly +plan9/9front.patch Plan9 port: patch for 9front-specific flavor of Plan 9 +plan9/aperl Plan9 port: shell to make Perl error messages Acme-friendly plan9/arpa/inet.h Plan9 port: replacement C header file plan9/buildinfo Plan9 port: configuration information plan9/config.plan9 Plan9 port: config.h template -plan9/config_h.sample Plan9 port: 5.8.0 sample config.h -plan9/config_sh.sample Plan9 port: 5.8.0 sample config.sh +plan9/config_h.sample Plan9 port: 5.32.0 sample config.h +plan9/config_sh.sample Plan9 port: 5.32.0 sample config.sh plan9/exclude Plan9 port: tests to skip plan9/fndvers Plan9 port: update Perl version in config.plan9 plan9/genconfig.pl Plan9 port: generate config.sh +plan9/math.h Plan9 port: Plan9-specific math.h plan9/mkfile Plan9 port: Mk driver for build plan9/myconfig.plan9 Plan9 port: script to print config summary plan9/plan9.c Plan9 port: Plan9-specific C routines plan9/plan9ish.h Plan9 port: Plan9-specific C header file plan9/setup.rc Plan9 port: script for easy build+install +plan9/uninstall.rc Plan9 port: uninstall script plan9/versnum Plan9 port: script to print version number pod/buildtoc Generate pod/perltoc.pod and pod/roffitall pod/Makefile.SH generate Makefile which makes pods into something else diff --git a/Porting/exec-bit.txt b/Porting/exec-bit.txt index d5c727c..c172e8a 100644 --- a/Porting/exec-bit.txt +++ b/Porting/exec-bit.txt @@ -23,6 +23,9 @@ installman makedepend.SH metaconfig.SH myconfig.SH +plan9/fndvers +plan9/setup.rc +plan9/uninstall.rc regen/embed.pl regen/feature.pl regen/keywords.pl diff --git a/plan9/9front.patch b/plan9/9front.patch new file mode 100644 index 0000000..d57d4fc --- /dev/null +++ b/plan9/9front.patch @@ -0,0 +1,46 @@ +diff --git a/dist/IO/poll.h b/dist/IO/poll.h +--- a/dist/IO/poll.h ++++ b/dist/IO/poll.h +@@ -22,10 +22,12 @@ + + #define EMULATE_POLL_WITH_SELECT + ++#ifdef __VMS + #ifdef poll + # undef poll + #endif + #define poll Perl_my_poll ++#endif + + typedef struct pollfd { + int fd; +diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL +--- a/ext/Errno/Errno_pm.PL ++++ b/ext/Errno/Errno_pm.PL +@@ -125,6 +125,8 @@ sub get_files { + # VMS keeps its include files in system libraries + if ($^O eq 'VMS') { + $file{'Sys$Library:DECC$RTLDEF.TLB'} = 1; ++ } elsif ($^O eq 'plan9') { ++ $file{'/sys/include/ape/errno.h'} = 1; + } elsif ($^O eq 'os390') { + # OS/390 C compiler doesn't generate #file or #line directives + $file{'/usr/include/errno.h'} = 1; +diff --git a/sv.c b/sv.c +--- a/sv.c ++++ b/sv.c +@@ -876,10 +876,10 @@ + U8 body_size; /* Size to allocate */ + U8 copy; /* Size of structure to copy (may be shorter) */ + U8 offset; /* Size of unalloced ghost fields to first alloced field*/ +- PERL_BITFIELD8 type : 4; /* We have space for a sanity check. */ +- PERL_BITFIELD8 cant_upgrade : 1;/* Cannot upgrade this type */ +- PERL_BITFIELD8 zero_nv : 1; /* zero the NV when upgrading from this */ +- PERL_BITFIELD8 arena : 1; /* Allocated from an arena */ ++ PERL_BITFIELD8 type; /* We have space for a sanity check. */ ++ PERL_BITFIELD8 cant_upgrade;/* Cannot upgrade this type */ ++ PERL_BITFIELD8 zero_nv; /* zero the NV when upgrading from this */ ++ PERL_BITFIELD8 arena; /* Allocated from an arena */ + U32 arena_size; /* Size of arena to allocate */ + }; + diff --git a/plan9/aperl b/plan9/aperl index 4d032e3..b260973 100644 --- a/plan9/aperl +++ b/plan9/aperl @@ -3,5 +3,6 @@ # aperl: # Executes perl command and alters stderr to produce Acme-friendly error messages # Created 02-JUL-1996, Luther Huffman, lutherh@stratcom.com +# Modified May 2020, David Romano, unobe@cpan.org -/bin/perl $* |[2] /bin/perl -pe 's/ line (\d+)/:$1/' >[1=2] +/bin/perl-_P9P_VERSION $* |[2] /bin/perl-_P9P_VERSION -pe 's/ line (\d+)/:$1/' >[1=2] diff --git a/plan9/buildinfo b/plan9/buildinfo index 881e00e..597dea8 100644 --- a/plan9/buildinfo +++ b/plan9/buildinfo @@ -1 +1 @@ -p9pvers = 5.008 +p9pvers = 5.32.0 diff --git a/plan9/config.plan9 b/plan9/config.plan9 index 0c0c602..9970f64 100644 --- a/plan9/config.plan9 +++ b/plan9/config.plan9 @@ -2,12 +2,12 @@ * This file is mangled by fndvers (and perhaps other scripts) to produce * the config.h for Plan 9. It was handwritten because the standard * configuration scripts were written in a shell dialect incomprehensible - * to Plan 9. + * to Plan 9. * config.h for Plan 9 - * Version: 5.8.0 - */ + * Version: blead + */ -/* Configuration time: 21-Oct-1996 15:11 +/* First configuration time: 21-Oct-1996 15:11 * Configured by: Luther Huffman, lutherh@stratcom.com * Target system: Plan 9 */ @@ -18,19 +18,46 @@ * */ +/* Last configuration time: June 2020 + * Configured by: David Romano, unobe@cpan.org + * Target system: Plan 9/9front + */ + #ifndef _config_h_ #define _config_h_ +/* CHARBITS: + * This symbol contains the size of a char, so that the C preprocessor + * can make decisions based on it. + */ +#define CHARBITS 8 /**/ + + /* CAT2: * This macro catenates 2 tokens together. */ -#define CAT2(a,b)a ## b +#if 42 == 1 +#define CAT2(a,b) a/**/b +#define STRINGIFY(a) "a" + /* If you can get stringification with catify, tell me how! */ +#endif +#if 42 == 42 +#define PeRl_CaTiFy(a, b) a ## b +#define PeRl_StGiFy(a) #a +/* the additional level of indirection enables these macros to be + * used as arguments to other macros. See K&R 2nd ed., page 231. */ +#define CAT2(a,b) PeRl_CaTiFy(a,b) +#define StGiFy(a) PeRl_StGiFy(a) +#define STRINGIFY(a) PeRl_StGiFy(a) +#endif +#if 42 != 1 && 42 != 42 +# include "Bletch: How does this C preprocessor catenate tokens?" +#endif + #define CAT3(a,b,c)a ## b ## c #define CAT4(a,b,c,d)a ## b ## c ## d #define CAT5(a,b,c,d,e)a ## b ## c ## d ## e -#define StGiFy(a)# a -#define STRINGIFY(a)StGiFy(a) #define SCAT2(a,b)StGiFy(a) StGiFy(b) #define SCAT3(a,b,c)StGiFy(a) StGiFy(b) StGiFy(c) #define SCAT4(a,b,c,d)StGiFy(a) StGiFy(b) StGiFy(c) StGiFy(d) @@ -52,16 +79,22 @@ # endif #endif -/* BIN: - * This symbol holds the path of the bin directory where the package will - * be installed. Program must be prepared to deal with ~name substitution. - */ -/* BIN_EXP: - * This symbol is the filename expanded version of the BIN symbol, for - * programs that do not want to deal with that at run-time. +/* BYTEORDER: + * This symbol holds the hexadecimal constant defined in byteorder, + * in a UV, i.e. 0x1234 or 0x4321 or 0x12345678, etc... + * If the compiler supports cross-compiling or multiple-architecture + * binaries (eg. on NeXT systems), use compiler-defined macros to + * determine the byte order. + * On NeXT 3.2 (and greater), you can build "Fat" Multiple Architecture + * Binaries (MAB) on either big endian or little endian machines. + * The endian-ness is available at compile-time. This only matters + * for perl, where the config.h can be generated and installed on + * one system, and used by a different architecture to build an + * extension. Older versions of NeXT that might not have + * defined either *_ENDIAN__ were all on Motorola 680x0 series, + * so the default case (for NeXT) is big endian to catch them. + * This might matter for NeXT 3.0. */ -#define BIN "/_P9P_OBJTYPE/bin" /* */ -#define BIN_EXP "/_P9P_OBJTYPE/bin" /* */ /* LOC_SED: * This symbol holds the complete pathname to the sed program. @@ -202,7 +235,7 @@ #define HAS_GETLOGIN /**/ /* HAS_GETPGID: - * This symbol, if defined, indicates to the C program that + * This symbol, if defined, indicates to the C program that * the getpgid(pid) function is available to get the * process group id. */ @@ -244,7 +277,7 @@ * This symbol, if defined, indicates that the link routine is * available to create hard links. */ -/* #define HAS_LINK / **/ +/* #define HAS_LINK /**/ /* HAS_LOCALECONV: * This symbol, if defined, indicates that the localeconv routine is @@ -262,7 +295,7 @@ * This symbol, if defined, indicates that the lstat routine is * available to do file stats on symbolic links. */ -/*#define HAS_LSTAT / **/ +/*#define HAS_LSTAT /**/ /* HAS_MBLEN: * This symbol, if defined, indicates that the mblen routine is available @@ -382,7 +415,7 @@ * This symbol, if defined, indicates that the readlink routine is * available to read the value of a symbolic link. */ -/*#define HAS_READLINK / **/ +/*#define HAS_READLINK /**/ /* HAS_RENAME: * This symbol, if defined, indicates that the rename routine is available @@ -434,7 +467,7 @@ * This symbol, if defined, indicates that the setpgid(pid, gpid) * routine is available to set process group ID. */ -#define HAS_SETPGID / **/ +#define HAS_SETPGID /**/ /* HAS_SETPGRP2: * This symbol, if defined, indicates that the setpgrp2() (as in DG/UX) @@ -502,7 +535,7 @@ * This symbol, if defined, indicates that the strtod routine is * available to provide better numeric string conversion than atof(). */ -#define HAS_STRTOD /**/ +/*#define HAS_STRTOD /**/ /* HAS_STRTOL: * This symbol, if defined, indicates that the strtol routine is available @@ -520,7 +553,7 @@ * This symbol, if defined, indicates that the symlink routine is available * to create symbolic links. */ -/*#define HAS_SYMLINK / **/ +/*#define HAS_SYMLINK /**/ /* HAS_SYSCALL: * This symbol, if defined, indicates that the syscall routine is @@ -654,7 +687,7 @@ #define I_LOCALE /**/ /* I_NET_ERRNO: - * This symbol, if defined, indicates that exists and + * This symbol, if defined, indicates that exists and * should be included. */ /*#define I_NET_ERRNO /* config-skip */ @@ -865,17 +898,6 @@ */ #define PLAN9 /**/ -/* MEM_ALIGNBYTES: - * This symbol contains the number of bytes required to align a - * double, or a long double when applicable. Usual values are 2, - * 4 and 8. The default is eight, for safety. - */ -#if defined(MULTIARCH) -# define MEM_ALIGNBYTES 8 -#else -#define MEM_ALIGNBYTES 4 -#endif - /* ARCHLIB: * This variable, if defined, holds the name of the directory in * which the user wants to put architecture-dependent public @@ -920,8 +942,8 @@ * This symbol is the filename expanded version of the BIN symbol, for * programs that do not want to deal with that at run-time. */ -#define BIN "/usr/bin" /**/ -#define BIN_EXP "/usr/bin" /**/ +#define BIN "/_P9P_OBJTYPE/bin" /* */ +#define BIN_EXP "/_P9P_OBJTYPE/bin" /* */ /* BYTEORDER: * This symbol holds the hexadecimal constant defined in byteorder, @@ -966,30 +988,6 @@ #define BYTEORDER 0x1234 /* large digits for MSB */ #endif /* NeXT */ -/* CAT2: - * This macro catenates 2 tokens together. - */ -/* STRINGIFY: - * This macro surrounds its token with double quotes. - */ -#if 42 == 1 -#define CAT2(a,b) a/**/b -#define STRINGIFY(a) "a" - /* If you can get stringification with catify, tell me how! */ -#endif -#if 42 == 42 -#define PeRl_CaTiFy(a, b) a ## b -#define PeRl_StGiFy(a) #a -/* the additional level of indirection enables these macros to be - * used as arguments to other macros. See K&R 2nd ed., page 231. */ -#define CAT2(a,b) PeRl_CaTiFy(a,b) -#define StGiFy(a) PeRl_StGiFy(a) -#define STRINGIFY(a) PeRl_StGiFy(a) -#endif -#if 42 != 1 && 42 != 42 -# include "Bletch: How does this C preprocessor concatenate tokens?" -#endif - /* CPPSTDIN: * This symbol contains the first part of the string which will invoke * the C preprocessor on the standard input and produce to standard @@ -1233,7 +1231,7 @@ * This symbol, if defined, indicates that the "fast stdio" * is available to manipulate the stdio buffers directly. */ -/*#define HAS_FAST_STDIO / **/ +/*#define HAS_FAST_STDIO /**/ /* HAS_FCHDIR: * This symbol, if defined, indicates that the fchdir routine is @@ -1311,7 +1309,8 @@ /* HAS_FPCLASSIFY: * This symbol, if defined, indicates that the fpclassify routine is - * available to classify doubles. Available for example in HP-UX. + * available to classify doubles. Available for example in HP-UX and + * Plan9/9front. * The returned values are defined in and are * * FP_NORMAL Normalized @@ -1321,7 +1320,7 @@ * FP_NAN NaN * */ -/*#define HAS_FPCLASSIFY / **/ +#define HAS_FPCLASSIFY / **/ /* HAS_FPOS64_T: * This symbol will be defined if the C compiler supports fpos64_t. @@ -1707,11 +1706,11 @@ * REENTRANT_PROTO_T_ABC macros of reentr.h if d_gmtime_r * is defined. */ -/*#define HAS_GMTIME_R / **/ +#define HAS_GMTIME_R / **/ #define GMTIME_R_PROTO 0 /**/ /* HAS_GNULIBC: - * This symbol, if defined, indicates to the C program that + * This symbol, if defined, indicates to the C program that * the GNU C library is being used. A better check is to use * the __GLIBC__ and __GLIBC_MINOR__ symbols supplied with glibc. */ @@ -1754,7 +1753,7 @@ * This symbol, if defined, indicates that the ilogbl routine is * available. If scalbnl is also present we can emulate frexpl. */ -/*#define HAS_ILOGBL / **/ +/*#define HAS_ILOGBL /**/ /* HAS_INT64_T: * This symbol will defined if the C compiler supports int64_t. @@ -1764,7 +1763,7 @@ #define HAS_INT64_T /**/ /* HAS_ISASCII: - * This manifest constant lets the C program know that isascii + * This manifest constant lets the C program know that isascii * is available. */ /*#define HAS_ISASCII / **/ @@ -1824,29 +1823,68 @@ * REENTRANT_PROTO_T_ABC macros of reentr.h if d_localtime_r * is defined. */ -/*#define HAS_LOCALTIME_R / **/ -/*#define LOCALTIME_R_NEEDS_TZSET / **/ +#define HAS_LOCALTIME_R +#define LOCALTIME_R_NEEDS_TZSET / **/ #define LOCALTIME_R_PROTO 0 /**/ - +#ifdef LOCALTIME_R_NEEDS_TZSET +#define L_R_TZSET tzset(), +#else +#define L_R_TZSET +#endif /* HAS_LONG_DOUBLE: * This symbol will be defined if the C compiler supports long * doubles. */ /* LONG_DOUBLESIZE: - * This symbol contains the size of a long double, so that the + * This symbol contains the size of a long double, so that the * C preprocessor can make decisions based on it. It is only - * defined if the system supports long doubles. - */ -#define HAS_LONG_DOUBLE /**/ + * defined if the system supports long doubles. Note that this + * is sizeof(long double), which may include unused bytes. + */ +/* HAS_LDEXPL: + * This symbol, if defined, indicates that the ldexpl routine is + * available to shift a long double floating-point number + * by an integral power of 2. + */ +/* LONG_DOUBLEKIND: + * LONG_DOUBLEKIND will be one of + * LONG_DOUBLE_IS_DOUBLE + * LONG_DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN + * LONG_DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN + * LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN + * LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN + * LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE + * LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE + * LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE + * LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE + * LONG_DOUBLE_IS_UNKNOWN_FORMAT + * It is only defined if the system supports long doubles. + */ +/*#define HAS_LDEXPL / **/ +#define HAS_LONG_DOUBLE / **/ #ifdef HAS_LONG_DOUBLE #define LONG_DOUBLESIZE 8 /**/ +#define LONG_DOUBLEKIND 0 /**/ +#define LONG_DOUBLE_IS_DOUBLE 0 +#define LONG_DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN 1 +#define LONG_DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN 2 +#define LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN 3 +#define LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN 4 +#define LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE 5 +#define LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE 6 +#define LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE 7 +#define LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE 8 +#define LONG_DOUBLE_IS_UNKNOWN_FORMAT -1 +#define LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LITTLE_ENDIAN LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE /* back-compat */ +#define LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BIG_ENDIAN LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE /* back-compat */ #endif + /* HAS_LONG_LONG: * This symbol will be defined if the C compiler supports long long. */ /* LONGLONGSIZE: - * This symbol contains the size of a long long, so that the + * This symbol contains the size of a long long, so that the * C preprocessor can make decisions based on it. It is only * defined if the system supports long long. */ @@ -1948,7 +1986,7 @@ /*#define OLD_PTHREAD_CREATE_JOINABLE / **/ /* HAS_PTHREAD_YIELD: - * This symbol, if defined, indicates that the pthread_yield + * This symbol, if defined, indicates that the pthread_yield * routine is available to yield the execution of the current * thread. sched_yield is preferable to pthread_yield. */ @@ -2024,7 +2062,7 @@ * This symbol, if defined, indicates that the scalbnl routine is * available. If ilogbl is also present we can emulate frexpl. */ -/*#define HAS_SCALBNL / **/ +/*#define HAS_SCALBNL /**/ /* HAS_SENDMSG: * This symbol, if defined, indicates that the sendmsg routine is @@ -2569,8 +2607,8 @@ * This symbol holds the type used for the second argument to * getgroups() and setgroups(). Usually, this is the same as * gidtype (gid_t) , but sometimes it isn't. - * It can be int, ushort, gid_t, etc... - * It may be necessary to include to get any + * It can be int, ushort, gid_t, etc... + * It may be necessary to include to get any * typedef'ed information. This is only required if you have * getgroups() or setgroups().. */ @@ -2731,6 +2769,12 @@ /*#define PWGECOS / **/ /*#define PWPASSWD / **/ +/* I_QUADMATH: + * This symbol, if defined, indicates that exists and + * should be included. + */ +/*#define I_QUADMATH / **/ + /* I_SHADOW: * This symbol, if defined, indicates that exists and * should be included. @@ -2842,6 +2886,27 @@ */ /*#define INSTALL_USR_BIN_PERL / **/ +/* DOUBLEINFBYTES: + * This symbol, if defined, is a comma-separated list of + * hexadecimal bytes for the double precision infinity. + */ +/* DOUBLENANBYTES: + * This symbol, if defined, is a comma-separated list of + * hexadecimal bytes (0xHH) for the double precision not-a-number. + */ +/* LONGDBLINFBYTES: + * This symbol, if defined, is a comma-separated list of + * hexadecimal bytes for the long double precision infinity. + */ +/* LONGDBLNANBYTES: + * This symbol, if defined, is a comma-separated list of + * hexadecimal bytes (0xHH) for the long double precision not-a-number. + */ +#define DOUBLEINFBYTES 0xe2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f /**/ +#define DOUBLENANBYTES 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f /**/ +#define LONGDBLINFBYTES 0xe2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f /**/ +#define LONGDBLNANBYTES 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /**/ + /* PERL_PRIfldbl: * This symbol, if defined, contains the string used by stdio to * format long doubles (format 'f') for output. @@ -2894,7 +2959,7 @@ #define MYMALLOC /**/ /* Mode_t: - * This symbol holds the type used to declare file modes + * This symbol holds the type used to declare file modes * for systems calls. It is usually mode_t, but may be * int or unsigned short. It may be necessary to include * to get any typedef'ed information. @@ -3044,6 +3109,16 @@ * This symbol contains the number of bits a variable of type NVTYPE * can preserve of a variable of type UVTYPE. */ +/* NV_OVERFLOWS_INTEGERS_AT: + * This symbol gives the largest integer value that NVs can hold. This + * value + 1.0 cannot be stored accurately. It is expressed as constant + * floating point expression to reduce the chance of decimale/binary + * conversion issues. If it can not be determined, the value 0 is given. + */ +/* NV_ZERO_IS_ALLBITS_ZERO: + * This symbol, if defined, indicates that a variable of type NVTYPE + * stores 0.0 in memory as all bits zero. + */ #define IVTYPE long /**/ #define UVTYPE unsigned long /**/ #define I8TYPE char /**/ @@ -3070,8 +3145,10 @@ #define U64SIZE 8 /**/ #endif #define NVSIZE 8 /**/ -/*#define NV_PRESERVES_UV +#define NV_PRESERVES_UV #define NV_PRESERVES_UV_BITS 31 +#define NV_OVERFLOWS_INTEGERS_AT 256.0*256.0*256.0*256.0*256.0*256.0*2.0*2.0*2.0*2.0*2.0 +#undef NV_ZERO_IS_ALLBITS_ZERO /* IVdf: * This symbol defines the format string used for printing a Perl IV @@ -3131,8 +3208,8 @@ * This symbol contains the ~name expanded version of PRIVLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -#define PRIVLIB "/sys/lib/perl/5.33.1" /**/ -#define PRIVLIB_EXP "/sys/lib/perl/5.33.1" /**/ +#define PRIVLIB "/sys/lib/perl/_P9P_VERSION" /**/ +#define PRIVLIB_EXP "/sys/lib/perl/_P9P_VERSION" /**/ /* PTRSIZE: * This symbol contains the size of a pointer, so that the C preprocessor @@ -3179,7 +3256,7 @@ /* Select_fd_set_t: * This symbol holds the type used for the 2nd, 3rd, and 4th * arguments to select. Usually, this is 'fd_set *', if HAS_FD_SET - * is defined, and 'int *' otherwise. This is only useful if you + * is defined, and 'int *' otherwise. This is only useful if you * have select(), of course. */ #define Select_fd_set_t fd_set* /**/ @@ -3205,10 +3282,10 @@ * The signals in the list are separated with commas, and the indices * within that list and the SIG_NAME list match, so it's easy to compute * the signal name from a number or vice versa at the price of a small - * dynamic linear lookup. + * dynamic linear lookup. * Duplicates are allowed, but are moved to the end of the list. * The signal number corresponding to sig_name[i] is sig_number[i]. - * if (i < NSIG) then sig_number[i] == i. + * if (i < NSIG) then sig_number[i] == i. * The last element is 0, corresponding to the 0 at the end of * the sig_name list. */ @@ -3259,9 +3336,9 @@ * removed. The elements in inc_version_list (inc_version_list.U) can * be tacked onto this variable to generate a list of directories to search. */ -#define SITELIB "/sys/lib/perl/5.33.1/site_perl" /**/ -#define SITELIB_EXP "/sys/lib/perl/5.33.1/site_perl" /**/ -#define SITELIB_STEM "/sys/lib/perl/5.33.1/site_perl" /**/ +#define SITELIB "/sys/lib/perl/_P9P_VERSION/site_perl" /**/ +#define SITELIB_EXP "/sys/lib/perl/_P9P_VERSION/site_perl" /**/ +#define SITELIB_STEM "/sys/lib/perl/_P9P_VERSION/site_perl" /**/ /* Size_t_size: * This symbol holds the size of a Size_t in bytes. @@ -3297,7 +3374,7 @@ * script to make sure (one hopes) that it runs with perl and not * some shell. */ -#define STARTPERL "#!/bin/perl" /**/ +#define STARTPERL "#!/bin/perl-_P9P_VERSION" /**/ /* STDCHAR: * This symbol is defined to be the type of char used in stdio.h. @@ -3339,6 +3416,27 @@ */ #define Uid_t uid_t /* UID type */ +/* GMTIME_MAX: + * This symbol contains the maximum value for the time_t offset that + * the system function gmtime () accepts, and defaults to 0 + */ +/* GMTIME_MIN: + * This symbol contains the minimum value for the time_t offset that + * the system function gmtime () accepts, and defaults to 0 + */ +/* LOCALTIME_MAX: + * This symbol contains the maximum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +/* LOCALTIME_MIN: + * This symbol contains the minimum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +#define GMTIME_MAX 2147483647 /**/ +#define GMTIME_MIN 0 /**/ +#define LOCALTIME_MAX 2147483647 /**/ +#define LOCALTIME_MIN 0 /**/ + /* USE_64_BIT_INT: * This symbol, if defined, indicates that 64-bit integers should * be used when available. If not defined, the native integers @@ -3415,6 +3513,14 @@ #define USE_PERLIO /**/ #endif +/* USE_QUADMATH: + * This symbol, if defined, indicates that the quadmath library should + * be used when available. + */ +#ifndef USE_QUADMATH +/*#define USE_QUADMATH / **/ +#endif + /* USE_SOCKS: * This symbol, if defined, indicates that Perl should * be built to use socks. @@ -3452,11 +3558,11 @@ * If defined, this symbol contains the name of a private library. * The library is private in the sense that it needn't be in anyone's * execution path, but it should be accessible by the world. - * It may have a ~ on the front. + * It may have a ~ on the front. * The standard distribution will put nothing in this directory. * Vendors who distribute perl may wish to place their own * architecture-dependent modules and extensions in this directory with - * MakeMaker Makefile.PL INSTALLDIRS=vendor + * MakeMaker Makefile.PL INSTALLDIRS=vendor * or equivalent. See INSTALL for details. */ /* PERL_VENDORARCH_EXP: @@ -3549,13 +3655,13 @@ * This symbol, if defined, indicates that the copysignl routine is * available. If aintl is also present we can emulate modfl. */ -/*#define HAS_COPYSIGNL / **/ +/*#define HAS_COPYSIGNL /**/ /* USE_CPLUSPLUS: * This symbol, if defined, indicates that a C++ compiler was * used to compiled Perl and will be used to compile extensions. */ -/*#define USE_CPLUSPLUS / **/ +/*#define USE_CPLUSPLUS /**/ /* HAS_DBMINIT_PROTO: * This symbol, if defined, indicates that the system provides diff --git a/plan9/exclude b/plan9/exclude index 7d9fc3c..1a6a8b5 100644 --- a/plan9/exclude +++ b/plan9/exclude @@ -16,3 +16,4 @@ op/misc.t op/oct.t op/split.t op/stat.t +.git diff --git a/plan9/fndvers b/plan9/fndvers old mode 100644 new mode 100755 index a848de2..b05a98f --- a/plan9/fndvers +++ b/plan9/fndvers @@ -12,3 +12,8 @@ ed plan9/genconfig.pl<) { push(@ARGV,split(/\|/,$_)); } close ARGS; } +my @extensions = @ARGV; if (-f "config.h") { $infile = "config.h"; $outdir = "../"; } elsif (-f "plan9/config.h") { $infile = "plan9/config.h"; $outdir = "./"; } @@ -54,11 +60,9 @@ $time = localtime; $cf_by = $ENV{'user'}; ($vers = $]) =~ tr/./_/; -# Plan 9 doesn't actually use version numbering. Following the original Unix -# precedent of assigning a Unix edition number based on the edition number -# of the manuals, I am referring to this as Plan 9, 1st edition. -$osvers = '1'; - +# 9front as Plan 9, 5th edition. +$osvers = '5'; + print OUT <) { - next unless m%^#(?!if).*\$%; + # suicide @ regcomp.c:22117 + #next unless m%^#(?!if).*\$%; + next unless !index($_, '#') && index($_, '#if') == -1 && rindex($_, '$') == length($_)-1; s/^#//; s!(.*?)\s*/\*.*!$1!; my(@words) = split; $words[1] =~ s/\(.*//; # Clip off args from macro @@ -195,7 +204,7 @@ if (open(SH,'<',"${outdir}config_h.SH")) { } close SH; } -else { warn "Couldn't read ${outfile}config_h.SH: $!\n"; } +elsif ($VERBOSE) { warn "Couldn't read ${outfile}config_h.SH: $!\n"; } $pp_vars{PLAN9} = 'define'; #Plan 9 specific # OK, now read the C header file, and retcon statements into config.sh @@ -233,7 +242,7 @@ while () { } elsif (not length $val and not $had_val) { # Wups -- should have been shell var for C preprocessor directive - warn "Constant $token not found in config_h.SH\n"; + warn "Constant $token not found in config_h.SH\n" if $VERBOSE; $token =~ tr/A-Z/a-z/; $token = "d_$token" unless $token =~ /^i_/; print OUT "$token='$state'\n"; @@ -248,7 +257,7 @@ while () { delete $val_vars{$token}; } elsif (!$pp_vars{$token}) { # Haven't seen it previously, either - warn "Constant $token not found in config_h.SH (val=|$val|)\n"; + warn "Constant $token not found in config_h.SH (val=|$val|)\n" if $VERBOSE; $token =~ tr/A-Z/a-z/; print OUT "$token='$val'\n"; if ($token =~ s/exp$//) {print OUT "$token='$val'\n";} @@ -256,14 +265,15 @@ while () { } close IN; -foreach (sort keys %pp_vars) { - warn "Didn't see $_ in $infile\n"; -} -foreach (sort keys %val_vars) { - warn "Didn't see $_ in $infile(val)\n"; +if ($VERBOSE) { + foreach (sort keys %pp_vars) { + warn "Didn't see $_ in $infile\n"; + } + foreach (sort keys %val_vars) { + warn "Didn't see $_ in $infile(val)\n"; + } } - # print OUT "libs='",join(' ',@libs),"'\n"; # print OUT "libc='",join(' ',@crtls),"'\n"; @@ -280,10 +290,8 @@ if (open(PL,'<',"${outdir}patchlevel.h")) { } close PL; } -else { warn "Can't read ${outdir}patchlevel.h - skipping 'PERL_VERSION'"; } +elsif ($VERBOSE) { warn "Can't read ${outdir}patchlevel.h - skipping 'PERL_VERSION'" } print OUT "pager='/bin/p'\n"; close OUT; - - diff --git a/plan9/math.h b/plan9/math.h new file mode 100644 index 0000000..fc0d725 --- /dev/null +++ b/plan9/math.h @@ -0,0 +1,12 @@ +/* Our math.h for HAS_FPCLASSIFY in plan9.config + * FP_NORMAL Normalized + * FP_ZERO Zero + * FP_INFINITE Infinity + * FP_SUBNORMAL Denormalized + * FP_NAN NaN + */ +#define FP_NORMAL 1 +#define FP_ZERO 2 +#define FP_INFINITE 3 +#define FP_SUBNORMAL 4 +#define FP_NAN 5 diff --git a/plan9/mkfile b/plan9/mkfile index 245a00c..6bc420e 100644 --- a/plan9/mkfile +++ b/plan9/mkfile @@ -1,21 +1,42 @@ APE=/sys/src/ape < $APE/config $target - cp ext/IO/*.pm $privlib - if (test !-d $privlib/IO) { - mkdir $privlib/IO - cp ext/IO/lib/IO/*.pm $privlib/IO - } - -Socket.$O: config.h Socket.c - $CCCMD -I plan9 Socket.c - -Socket.c: miniperl ext/Socket/Socket.xs - ./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/Socket/Socket.xs > $target - cp ext/Socket/Socket.pm $privlib - -Opcode.c: miniperl ext/Opcode/Opcode.xs - ./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/Opcode/Opcode.xs > $target - cp ext/Opcode/*.pm $privlib - -Fcntl.c: miniperl ext/Fcntl/Fcntl.xs - ./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/Fcntl/Fcntl.xs > $target - cp ext/Fcntl/Fcntl.pm $privlib - -POSIX.c: miniperl ext/POSIX/POSIX.xs - ./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/POSIX/POSIX.xs > $target - cp ext/POSIX/POSIX.pm $privlib - -dl_none.c: miniperl ext/DynaLoader/dl_none.xs - ./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/DynaLoader/dl_none.xs > $target - cp ext/DynaLoader/DynaLoader.pm $privlib - -test:V: - bind -b $privlib $sourcedir/lib - bind -b $archlib $sourcedir/lib - cd $sourcedir/t - rm -f perl - cp /$objtype/bin/perl $sourcedir/t +uudmap.h: generate_uudmap.c + $CCCMD generate_uudmap.c + # This is currently a show-stopper for cross-compilation: find the true $objtype by looking at kernel? + $LD $CFLAGS -o generate_uudmap generate_uudmap.$O + chmod +x generate_uudmap + ./generate_uudmap uudmap.h bitcount.h mg_data.h + +extensions:V: miniperl archlib/Config.pm $ext_c dist/XSLoader/XSLoader.pm + +more_extensions:V: perlnosocket $more_ext_c $more_ext_obj + ext_obj=`{echo $ext_obj $more_ext_obj} + +Socket.$O: Socket.c + $XSCCCMD -I plan9 Socket.c + +attributes.$O: attributes.c + $XSCCCMD -I plan9 attributes.c + +mro.$O: mro.c + $XSCCCMD -I plan9 mro.c + +B.$O: B.c + $XSCCCMD -I plan9 B.c + +Peek.$O: Peek.c + $XSCCCMD -I plan9 Peek.c + +Util.$O: Util.c + $XSCCCMD -I plan9 Util.c + +FieldHash.$O: FieldHash.c + $XSCCCMD -I plan9 FieldHash.c + +re.$O: re.c + $XSCCCMD -DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT -I plan9 re.c + +re_comp.$O: re_comp.c + $XSCCCMD -DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT -I plan9 re_comp.c + +re_exec.$O: re_exec.c + $XSCCCMD -DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT -I plan9 re_exec.c + +Cwd.$O: Cwd.c IO.c + cp dist/IO/ppport.h dist/PathTools + $XSCCCMD -DDOUBLE_SLASHES_SPECIAL^'='^0 -I plan9 Cwd.c + +IO.$O: extensions + $XSCCCMD -I plan9 IO.c + +poll.$O: extensions + $XSCCCMD -I plan9 poll.c + +POSIX.$O: extensions + $XSCCCMD -I plan9 POSIX.c + +Glob.$O: extensions + $XSCCCMD -I plan9 Glob.c + +bsd_glob.$O: extensions + $XSCCCMD -I plan9 -I. bsd_glob.c + +Normalize.$O: extensions + $XSCCCMD -I plan9 -I. Normalize.c + +Dumper.$O: Dumper.c + $XSCCCMD -I plan9 -I. Dumper.c + +HiRes.$O: extensions + $XSCCCMD -I plan9 -I. HiRes.c + +Storable.$O: extensions + $XSCCCMD -I plan9 -I. Storable.c + +ListUtil.$O: extensions + $XSCCCMD -I plan9 -I. ListUtil.c + +Opcode.$O: extensions + $XSCCCMD -I plan9 Opcode.c + +Fcntl.$O: extensions + $XSCCCMD -I plan9 Fcntl.c + +dl_none.$O: extensions + $XSCCCMD -I plan9 dl_none.c + +Glob.c: archlib/Config.pm ext/File-Glob/Glob.xs + cd ext/File-Glob + $miniperl Makefile.PL # to write constants + cd $pwd + $miniperlxs ext/File-Glob/Glob.xs > $target + cp ext/File-Glob/bsd_glob.^(c h) $pwd + mkdir -p archlib/File + cp ext/File-Glob/Glob.pm archlib/File/Glob.pm + +ppport.h: archlib/Config.pm + if (test ! -f /bin/sh) bind -a /386/bin/ape /bin + # specify the list, otherwise suicide + $miniperl mkppport --list mkppport.lst + +Cwd.c: archlib/Config.pm dist/PathTools/Cwd.xs + $miniperlxs dist/PathTools/Cwd.xs > $target + cp dist/PathTools/Cwd.pm archlib + { cd dist/PathTools/lib; tar c . } | { mkdir -p archlib; cd archlib; tar x } + +IO.c: archlib/Config.pm dist/IO/IO.xs ppport.h + $miniperlxs dist/IO/IO.xs > $target + cp dist/IO/poll.^(c h) $pwd + cp dist/IO/IO.pm archlib + { cd dist/IO/lib; tar c . } | { mkdir -p archlib; cd archlib; tar x } + +dist/XSLoader/XSLoader.pm: archlib/Config.pm + cd dist/XSLoader + $miniperl XSLoader_pm.PL + cp XSLoader.pm $pwd/archlib + +ext/Errno/Errno.pm: perlnosocket + cd ext/Errno + $perl Makefile.PL + $perl Errno_pm.PL arch.txt + cp Errno.pm $pwd/archlib + +Socket.c: perlnosocket cpan/Socket/Socket.xs ext/Errno/Errno.pm + cd cpan/Socket + $perl Makefile.PL # to write const-xs.inc + cd $pwd + $perlxs cpan/Socket/Socket.xs > $target + cp cpan/Socket/Socket.pm archlib + +uni.data: archlib/Config.pm lib/unicore/mktables + $miniperl lib/unicore/mktables -C lib/unicore -makelist -p + +Normalize.c: archlib/Config.pm dist/Unicode-Normalize/Normalize.xs uni.data + $miniperl dist/Unicode-Normalize/mkheader + $miniperlxs dist/Unicode-Normalize/Normalize.xs > $target + mkdir -p archlib/Unicode + cp dist/Unicode-Normalize/Normalize.pm archlib/Unicode + +Dumper.c: perlnosocket dist/Data-Dumper/Dumper.xs + $perlxs dist/Data-Dumper/Dumper.xs > $target + mkdir -p archlib/Data + cp dist/Data-Dumper/Dumper.pm archlib/Data + +HiRes.c: archlib/Config.pm dist/Time-HiRes/HiRes.xs + cd dist/Time-HiRes + $miniperl Makefile.PL # to write const-xs.inc + cd $pwd + $miniperlxs dist/Time-HiRes/HiRes.xs > $target + mkdir -p archlib/Time + cp dist/Time-HiRes/HiRes.pm archlib/Time + +ListUtil.c: archlib/Config.pm cpan/Scalar-List-Utils/ListUtil.xs + cp cpan/Scalar-List-Utils/multicall.h $pwd + $miniperlxs cpan/Scalar-List-Utils/ListUtil.xs > $target + { cd cpan/Scalar-List-Utils/lib; tar c . } | { mkdir -p archlib; cd archlib; tar x } + +Storable.c: archlib/Config.pm dist/Storable/Storable.xs + $miniperlxs dist/Storable/Storable.xs > $target + cp dist/Storable/Storable.pm archlib + +Opcode.c: archlib/Config.pm ext/Opcode/Opcode.xs + $miniperlxs ext/Opcode/Opcode.xs > $target + cp ext/Opcode/^(Opcode ops)^.pm archlib + +Fcntl.c: archlib/Config.pm ext/Fcntl/Fcntl.xs + cd ext/Fcntl + $miniperl Makefile.PL # to write const-xs.inc + cd $pwd + $miniperlxs ext/Fcntl/Fcntl.xs > $target + cp ext/Fcntl/Fcntl.pm archlib + +POSIX.c: archlib/Config.pm ext/POSIX/POSIX.xs + cd ext/POSIX + $miniperl Makefile.PL # to write const-xs.inc + cd $pwd + $miniperlxs ext/POSIX/POSIX.xs > $target + cp ext/POSIX/lib/POSIX.pm archlib + +B.c: archlib/Config.pm ext/B/B.xs + cd ext/B + $miniperl Makefile.PL PERL_CORE^'='^1 # to write const-xs.inc + cd $pwd + $miniperlxs ext/B/B.xs > $target + cp ext/B/^(B O)^.pm archlib + +Peek.c: archlib/Config.pm ext/Devel-Peek/Peek.xs + $miniperlxs ext/Devel-Peek/Peek.xs > $target + cp ext/Devel-Peek/Peek.pm archlib + +attributes.c: archlib/Config.pm ext/attributes/attributes.xs + $miniperlxs ext/attributes/attributes.xs > $target + cp ext/attributes/attributes.pm archlib + +mro.c: archlib/Config.pm ext/mro/mro.xs + $miniperlxs ext/mro/mro.xs > $target + cp ext/mro/mro.pm archlib + +Util.c: archlib/Config.pm ext/Hash-Util/Util.xs + $miniperlxs ext/Hash-Util/Util.xs > $target + { cd ext/Hash-Util/lib; tar c . } | { cd archlib; tar x } + +FieldHash.c: archlib/Config.pm ext/Hash-Util-FieldHash/FieldHash.xs + $miniperlxs ext/Hash-Util-FieldHash/FieldHash.xs > $target + { cd ext/Hash-Util-FieldHash/lib; tar c . } | { cd archlib; tar x } + +re.c: archlib/Config.pm ext/re/re.xs + $miniperlxs ext/re/re.xs > $target + cp ext/re/re_^(comp top)^.h $pwd + cp ext/re/re.pm archlib + +re_comp.c: miniperl re.c regcomp.c + cp regcomp.c $target + +re_exec.c: miniperl re.c regexec.c + cp regexec.c $target + +dl_none.c: archlib/Config.pm ext/DynaLoader/dl_none.xs + cd ext/DynaLoader; + $miniperl DynaLoader_pm.PL + cd $pwd + $miniperlxs ext/DynaLoader/dl_none.xs > $target + cp ext/DynaLoader/DynaLoader.pm archlib + +preptest:Q: perl + # Bind the crap out of everything, as different tests expect different INCs + cp perl t/perl + cd t + mntpt=/$objtype/lib/perl + if (test ! -d $mntpt ) { + mkdir $mntpt + rmdir=1 + } + ramfs -m $mntpt + mkdir -p $mntpt/5.32.0/site_perl + echo -n Binding directories + for (l in $pwd/lib $pwd/archlib $icpanlib $idistlib $iextlib ) { + if (test -d $l ) { + if (! ~ `{grep $l <{ns} >[1]/dev/null; echo $status} '') bind -a $l $mntpt/5.32.0/site_perl + echo -n . + } + } + bind $mntpt/5.32.0/site_perl $pwd/lib + echo done + echo Binding sh + if (! ~ `{grep /$objtype/bin/ape <{ns} >[1]/dev/null; echo $status} '') bind -a /$objtype/bin/ape /bin + +minitest:V: preptest + cd t + perl TEST $testlist + unmount $pwd/lib + unmount $mntpt + if (~ $rmdir 1) rm $mntpt + rm t/perl + +test:V: preptest + cd t perl TEST `{ ls */*.t | comm -23 - ../plan9/exclude } + unmount $pwd/lib + unmount $mntpt + if (~ $rmdir 1) rm $mntpt + rm t/perl -plan9.$O: config.h ./plan9/plan9.c - cp ./plan9/plan9.c ./plan9.c +plan9.$O: config.h plan9/plan9.c + cp plan9/plan9.c plan9.c $CCCMD plan9.c %.$O: config.h %.c $CCCMD $stem.c -$archlib/Config.pm: miniperl config.sh - ./miniperl configpm $archlib/Config.pm +archlib/Config.pm: config.sh + $miniperl make_patchnum.pl + $miniperl configpm + cp lib/Config.pm archlib/Config.pm + cp lib/Config_heavy.pl archlib/Config_heavy.pl + cp lib/Config_git.pl archlib/Config_git.pl + -config.sh: miniperl config.h - ./miniperl ./plan9/genconfig.pl +config.sh: miniperl + miniperl plan9/genconfig.pl $extensions $more_extensions installall:V: - for (objtype in 386 mips 68020 sparc) mk install + for (386 68000 68020 arm arm amd64 mips power power64 sparc sparc64 spim) mk install man:V: $perlpods pod/pod2man.PL perl perl pod/pod2man.PL @@ -143,8 +425,8 @@ man:V: $perlpods pod/pod2man.PL perl for (i in $histpodnames) pod/pod2man pod/$i.pod > $installman3dir/$i nuke clean:V: - rm -f *.$O $extensions^.pm config.sh $perllib config.h $perlshr perlmain.c perl miniperl $archlib/Config.pm $ext_c - rm -rf $privlib/IO + rm -f *.$O config.sh $perllib config.h $perlshr perlmain.c perl miniperl git_version.h $ext_c $more_ext_c generate_uudmap uudmap.h bitcount.h mg_data.h plan9.c plan9ish.h math.h bsd_glob.^(c h) poll.^(c h) re_*.^(c h) uni.data multicall.h + rm -rf privlib archlib deleteman:V: rm -f $installman1dir/perl* $installman3dir/perl* diff --git a/plan9/plan9.c b/plan9/plan9.c index ebdac27..02ef76c 100644 --- a/plan9/plan9.c +++ b/plan9/plan9.c @@ -1,20 +1,31 @@ #include "EXTERN.h" #include "perl.h" +#include "./plan9/math.h" -/* Functions mentioned in but not implemented */ +#define _PLAN9_SOURCE +#include -int getsockopt(int a, int b, int c, void *d, int *e) -{ - croak("Function \"getsockopt\" not implemented in this version of perl."); - return (int)NULL; -} +/** Function fpclassify(double) is required by sv.c, which was refactored in perl-5.24 era and uses other libraries to classify floating points. **/ -int setsockopt(int a, int b, int c, void *d, int *e) -{ - croak("Function \"setsockopt\" not implemented in this version of perl."); - return (int)NULL; +/* See /sys/src/lib/port/frexp.c */ +#define SHIFT 20 + +int fpclassify(double d) { + FPdbleword x; + + /* order matters: only isNaN can operate on NaN */ + if ( isNaN(d) ) + return FP_NAN; + else if ( isInf(d, 0) ) + return FP_INFINITE; + else if ( d == 0 ) + return FP_ZERO; + + x.x = fabs(d); + return (x.hi >> SHIFT) ? FP_NORMAL : FP_SUBNORMAL; } +/* Functions mentioned in /sys/include/ape/sys/socket.h but not implemented */ int recvmsg(int a, struct msghdr *b, int c) { @@ -29,7 +40,7 @@ int sendmsg(int a, struct msghdr *b, int c) } -/* Functions mentioned in but not implemented */ +/* Functions mentioned in /sys/include/ape/sys/netdb.h but not implemented */ struct netent *getnetbyname(const char *a) { croak("Function \"getnetbyname\" not implemented in this version of perl."); @@ -112,23 +123,3 @@ void endservent() { croak("Function \"endservent\" not implemented in this version of perl."); } - -int tcdrain(int) -{ -croak("Function \"tcdrain\" not implemented in this version of perl."); -} - -int tcflow(int, int) -{ -croak("Function \"tcflow\" not implemented in this version of perl."); -} - -int tcflush(int, int) -{ -croak("Function \"tcflush\" not implemented in this version of perl."); -} - -int tcsendbreak(int, int) -{ -croak("Function \"tcsendbreak\" not implemented in this version of perl."); -} diff --git a/plan9/plan9ish.h b/plan9/plan9ish.h index fa81502..7fd8c7e 100644 --- a/plan9/plan9ish.h +++ b/plan9/plan9ish.h @@ -25,14 +25,14 @@ * getgrgid() routines are available to get group entries. * The getgrent() has a separate definition, HAS_GETGRENT. */ -/*#define HAS_GROUP / **/ +/*#define HAS_GROUP /**/ /* HAS_PASSWD * This symbol, if defined, indicates that the getpwnam() and * getpwuid() routines are available to get password entries. * The getpwent() has a separate definition, HAS_GETPWENT. */ -/*#define HAS_PASSWD / **/ +/*#define HAS_PASSWD /**/ #define HAS_KILL #define HAS_WAIT @@ -42,7 +42,7 @@ * to remove all versions of a file if unlink() is called. This is * probably only relevant for VMS. */ -/* #define UNLINK_ALL_VERSIONS / **/ +/* #define UNLINK_ALL_VERSIONS /**/ /* PLAN9: * This symbol, if defined, indicates that the program is running under diff --git a/plan9/setup.rc b/plan9/setup.rc old mode 100644 new mode 100755 index dd96c1f..d300966 --- a/plan9/setup.rc +++ b/plan9/setup.rc @@ -1,51 +1,59 @@ #!/bin/rc -# This is an rc shell script which unpacks the perl distribution, builds -# directories, and puts files where they belong. -# To use, just run it from within the plan9 subdirectory with the appropriate -# permissions. -# Last modified 6/30/96 by: +# This is an rc shell script puts files where they belong and does a bit of +# patching in order not to modify some perl core code which might impact other +# OSes. To use, just run it from within the plan9 subdirectory with the +# appropriate permissions. +# First modified 6/30/96 by: # Luther Huffman, Strategic Computer Solutions, Inc., lutherh@stratcom.com +# Last modified May 2020 by: +# David Romano, unobe@cpan.org +# Get the Perl version information awk -f versnum ../patchlevel.h . buildinfo -builddir = `{ cd .. ; pwd } + +builddir = `{ cd .. ; pwd } + +# 'typestr' is used by /sys/src/cmd/cc/lex.c, but not sure when/if it is ever used. +# Patch sv.c from afar, which uses 'typestr' as a variable name, and uses bit-fields. +# Also patch some other things: +status=`{cd $builddir; ape/patch -p1 [1=2] ; exit } -sourcedir=/sys/src/cmd/perl/$p9pvers -privlib=/sys/lib/perl -sitelib=$privlib/site_perl -#Build source directory -if (test ! -d /sys/src/cmd/perl) mkdir /sys/src/cmd/perl -if (test ! -d $sourcedir) mkdir $sourcedir +# Update some files +cp plan9.c plan9ish.h mkfile $builddir -#Populate source directory -echo Building source directories ... -{cd $builddir ; tar c .} | { cd $sourcedir ; tar x} -cp $builddir/plan9/plan9.c $builddir/plan9/plan9ish.h $builddir/plan9/mkfile $sourcedir -cd $sourcedir/lib ; rm -rf * - -#Build library directories +exit; +# Why is this done during setup and not during 'mk install'? +# Build library directories echo Building library directories ... +privroot=/sys/lib/perl +privlib=$privroot/$p9pvers +sitelib=$privlib/site_perl + +if (test ! -d $privroot) mkdir $privroot if (test ! -d $privlib) mkdir $privlib if (test ! -d $privlib/auto) mkdir $privlib/auto if (test ! -d $sitelib) mkdir $sitelib for(i in $platforms){ - archlib=/$i/lib/perl/$p9pvers + archroot=/$i/lib/perl + archlib=$archroot/$p9pvers sitearch=$archlib/site_perl corelib=$archlib/CORE arpalib=$corelib/arpa - if (test ! -d /$i/lib/perl) mkdir /$i/lib/perl + if (test ! -d $archroot) mkdir $archroot if (test ! -d $archlib) mkdir $archlib if (test ! -d $sitearch) mkdir $sitearch if (test ! -d $corelib) mkdir $corelib if (test ! -d $arpalib) mkdir $arpalib - cp $builddir/*.h $builddir/plan9/*.h $corelib - cp $builddir/plan9/arpa/*.h $arpalib + cp $builddir/*.h *.h $corelib + cp arpa/*.h $arpalib } -#Populate library directories +# Populate library directories {cd $builddir/lib ; tar c . } | {cd $privlib ; tar x } diff --git a/plan9/uninstall.rc b/plan9/uninstall.rc new file mode 100755 index 0000000..503991a --- /dev/null +++ b/plan9/uninstall.rc @@ -0,0 +1,25 @@ +#!/bin/rc + +. buildinfo +if (~ $#* 0) platforms = $objtype +if not switch($1) { + case -a ; platforms = (386 68000 68020 arm arm amd64 mips power power64 sparc sparc64 spim) + case * ; echo 'Usage: uninstall.rc [-a]' >[1=2] ; exit +} +sourceroot=/sys/src/cmd/perl +sourcedir=$sourceroot/$p9pvers +privroot=/sys/lib/perl +privlib=$privroot/$p9pvers +sitelib=$privlib/site_perl + +echo Uninstalling perl/$p9pvers +cd $sourceroot + +for(i in $platforms){ + archroot=/$i/lib/perl + archlib=$archroot/$p9pvers + if (test -d $archlib) rm -r $archlib + rm /$i/bin/perl-$p9pvers +} +if (test -d $privlib) rm -r $privlib +if (test -d $sourcedir) rm -r $sourcedir diff --git a/plan9/versnum b/plan9/versnum index 6e579f3..55f80d0 100644 --- a/plan9/versnum +++ b/plan9/versnum @@ -1,8 +1,9 @@ -/PERL_VERSION/ {base = $3} -/PERL_SUBVERSION/ {subvers = $3} +/define PERL_REVISION/ {revision = $3} +/define PERL_VERSION/ {version = $3} +/define PERL_SUBVERSION/ {subvers = $3} END { if (subvers == 0) - printf "p9pvers = 5.%03d\n", base> "buildinfo"; + printf "p9pvers = %d.%d\n", revision, version> "buildinfo"; else - printf "p9pvers = 5.%03d_%02d\n" , base, subvers> "buildinfo"; + printf "p9pvers = %d.%d.%d\n" , revision, version, subvers> "buildinfo"; } diff --git a/sv.c b/sv.c index a3238fc..19b744f 100644 --- a/sv.c +++ b/sv.c @@ -3060,8 +3060,8 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags) return RX_WRAPPED(re); } else { - const char *const typestr = sv_reftype(referent, 0); - const STRLEN typelen = strlen(typestr); + const char *const typestring = sv_reftype(referent, 0); + const STRLEN typelen = strlen(typestring); UV addr = PTR2UV(referent); const char *stashname = NULL; STRLEN stashnamelen = 0; /* hush, gcc */ @@ -3104,7 +3104,7 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags) *--retval = '('; retval -= typelen; - memcpy(retval, typestr, typelen); + memcpy(retval, typestring, typelen); if (stashname) { *--retval = '='; -- 1.8.3.1