dslinux/user/perl/plan9 aperl buildinfo config.plan9 config_h.sample config_sh.sample exclude fndvers genconfig.pl mkfile myconfig.plan9 plan9.c plan9ish.h setup.rc versnum

cayenne dslinux_cayenne at user.in-berlin.de
Mon Dec 4 18:01:28 CET 2006


Update of /cvsroot/dslinux/dslinux/user/perl/plan9
In directory antilope:/tmp/cvs-serv17422/plan9

Added Files:
	aperl buildinfo config.plan9 config_h.sample config_sh.sample 
	exclude fndvers genconfig.pl mkfile myconfig.plan9 plan9.c 
	plan9ish.h setup.rc versnum 
Log Message:
Adding fresh perl source to HEAD to branch from

--- NEW FILE: mkfile ---
APE=/sys/src/ape
< $APE/config
<plan9/buildinfo
sourcedir = /sys/src/cmd/perl/$p9pvers
archname = plan9_$objtype
privlib=/sys/lib/perl
archlib = /$objtype/lib/perl/$p9pvers
sitelib = $privlib/site_perl
sitearch = $archlib/site_perl

CFLAGS =  -B  -D_POSIX_SOURCE -D_BSD_EXTENSION -DMY_UV_MAX=0x7fffffffUL
LDFLAGS = -B 

CCCMD = $CC  -c $CFLAGS 

perllib = $archlib/CORE/libperl.a

perlshr = $archlib/CORE/libperlshr.a

installman1dir = /sys/man/1
installman3dir = /sys/man/2

podnames = perl perlbook perlboot perlbot perldata perldebtut perldiag perldsc perlform perlfunc perlipc perllexwarn perllol perlmod perlmodlib perlmodinstall perlnewmod perlop perlopentut perlpacktut perlpod perlport perlrequick perlretut perlref perlreftut perlrequick perlrun perlsec perlstyle perlsub perlsyn perltie perltoc perltooc perltoot perltrap perlutil perluniintro perlvar
faqpodnames = perlfaq perlfaq1 perlfaq2 perlfaq3 perlfaq4 perlfaq5 perlfaq6 perlfaq7 perlfaq8 perlfaq9
advpodnames = perlapi perlapio perlcall perlclib perlcompile perldebguts perldbmfilter perldebug perldelta perldiag perlebcdic perlembed perlfilter perlfork perlguts perlhack perlintern perliol perllocale perlnumber perlobj perlothrtut perlpodspec perlre perlthrtut perltodo perlunicode perlxs perlxs perlxstut
archpodnames = perlaix perlamiga perlapollo perlbeos perlbs2000 perlce perlcygwin perldgux perldos perlepoc perlfreebsd perlhpux perlhurd perlirix perlmachten perlmacos perlmint perlmpeix perlnetware perlos2 perlos390 perlos400 perlplan9 perlqnx perlsolaris perltru64 perluts perlvmesa perlvms perlvos perlwin32
histpods = perl5004delta perl5005delta perl561delta perl56delta perl570delta perl571delta perl572delta perl573delta perl58delta perlhist

libpods = ${podnames:%=pod/%.pod}

perlpods = $libpods

extensions = IO Socket Opcode DynaLoader Fcntl POSIX
ext_xs = IO.xs Socket.xs Opcode.xs  dl_none.xs Fcntl.xs POSIX.xs
ext_c = ${ext_xs:%.xs=%.c}
ext_obj = ${ext_xs:%.xs=%.$O}

obj = av.$O deb.$O doio.$O doop.$O dump.$O globals.$O gv.$O hv.$O locale.$O malloc.$O mg.$O numeric.$O op.$O pad.$O perlapi.$O perlio.$O perly.$O pp.$O pp_ctl.$O pp_hot.$O pp_pack.$O pp_sort.$O pp_sys.$O reentr.$O regcomp.$O regexec.$O run.$O scope.$O sv.$O taint.$O toke.$O universal.$O utf8.$O util.$O xsutils.$O

OBJS = perl.$O plan9.$O $obj

testlist = base/*.t comp/*.t cmd/*.t io/*.t op/*.t

install:V:	perl preplibrary 
		cp perl /$objtype/bin/perl
		cp plan9/aperl /rc/bin/Perl
		mk man
		
perl:		config.h miniperlmain.$O miniperl $archlib/Config.pm perlmain.$O $perlshr 
		$LD $CFLAGS -o perl perlmain.$O $perllib $perlshr
		
miniperl:	config.h $perllib miniperlmain.$O 
		$LD  $CFLAGS -o miniperl miniperlmain.$O  $perllib 

preplibrary:V:	miniperl $archlib/Config.pm
			cd $privlib
			for (file in *.pm */*.pm $archlib/Config.pm) $sourcedir/miniperl  -e 'use AutoSplit; autosplit(@ARGV)' $file $privlib/auto
	
$perllib(%):N:	%
$perllib: ${OBJS:%=$perllib(%)}
		ar rv $perllib $OBJS
		$RANLIB $perllib
			
miniperlmain.$O:	config.h 
				$CCCMD miniperlmain.c

perlmain.$O:	config.h perlmain.c
			$CCCMD perlmain.c

perlmain.c:	miniperl vms/writemain.pl
			./miniperl vms/writemain.pl $extensions

config.h:		plan9/fndvers
			plan9/fndvers 
			cp config.h $archlib/CORE

$perlshr(%):N:	%
$perlshr:  ${ext_obj:%=$perlshr(%)}
		ar rv $perlshr $ext_obj
		$RANLIB $perlshr

IO.c:		miniperl ext/IO/IO.xs
			./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/IO/IO.xs > $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
			perl TEST `{ ls */*.t | comm -23 - ../plan9/exclude }

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

config.sh:	miniperl config.h
		./miniperl ./plan9/genconfig.pl

installall:V:	
			for (objtype in 386 mips 68020 sparc) mk install

man:V:		$perlpods pod/pod2man.PL perl
			perl pod/pod2man.PL
			for (i in $podnames) pod/pod2man pod/$i.pod > $installman3dir/$i
			for (i in $faqpodnames) pod/pod2man pod/$i.pod > $installman3dir/$i
			for (i in $advpodnames) pod/pod2man pod/$i.pod > $installman3dir/$i
			for (i in $archpodnames) pod/pod2man pod/$i.pod > $installman3dir/$i
			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

deleteman:V:
			rm -f $installman1dir/perl* $installman3dir/perl*

--- NEW FILE: myconfig.plan9 ---
#!/bin/rc

# This script is designed to provide a handy summary of the configuration
# information being used to build perl. This is especially useful if you
# are requesting help from comp.lang.perl.misc on usenet or via mail.

#This script is the "myconfig" script altered to run on Plan 9. 
#Last Modified: 28-Jun-96 Luther Huffman  lutherh at stratcom.com


. config.sh

# Note that the text lines /^Summary of/ .. /^\s*$/ are copied into Config.pm.
# XXX Add d_sigaction (?) once it's defined.

$spitshell<<!GROK!THIS!

Summary of my $package ($baserev version $PERL_VERSION subversion $PERL_SUBVERSION) configuration:
  Platform:
    osname=$osname, osver=$osvers, archname=$archname
    uname='$myuname'
    hint=$hint, useposix=$useposix 
  Compiler:
    cc='$cc', optimize='$optimize', gccversion=$gccversion
    cppflags='$cppflags'
    ccflags ='$ccflags'
    stdchar='$stdchar', d_stdstdio=$d_stdstdio, usevfork=$usevfork
    voidflags=$voidflags, castflags=$castflags, d_casti32=$d_casti32, d_castneg=$d_castneg
    intsize=$intsize, alignbytes=$alignbytes, usemymalloc=$usemymalloc, randbits=$randbits
  Linker and Libraries:
    ld='$ld', ldflags ='$ldflags'
    libpth=$libpth
    libs=$libs
    libc=$libc, so=$so
  Dynamic Linking:
    dlsrc=$dlsrc, dlext=$dlext, d_dlsymun=$d_dlsymun, ccdlflags='$ccdlflags'
    cccdlflags='$cccdlflags', lddlflags='$lddlflags'

!GROK!THIS!

--- NEW FILE: config.plan9 ---
/*
 * 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. 
 * config.h for Plan 9
 * Version: 5.8.0
 */                 

/* Configuration time: 21-Oct-1996 15:11
 * Configured by: Luther Huffman, lutherh at stratcom.com
 * Target system: Plan 9
 */

/*
 * Mangled by Jarkko Hietaniemi 2003-02-02 based on Russ Cox'
 * blood, sweat, and tears.
 *
 */
[...4267 lines suppressed...]
 *	REENTRANT_PROTO_T_ABC macros of reentr.h if d_setservent_r
 *	is defined.
 */
/*#define HAS_SETSERVENT_R	   / **/
#define SETSERVENT_R_PROTO 0	   /**/

/* HAS_TTYNAME_R:
 *	This symbol, if defined, indicates that the ttyname_r routine
 *	is available to ttyname re-entrantly.
 */
/* TTYNAME_R_PROTO:
 *	This symbol encodes the prototype of ttyname_r.
 *	It is zero if d_ttyname_r is undef, and one of the
 *	REENTRANT_PROTO_T_ABC macros of reentr.h if d_ttyname_r
 *	is defined.
 */
/*#define HAS_TTYNAME_R	   / **/
#define TTYNAME_R_PROTO 0	   /**/

#endif

--- NEW FILE: versnum ---
/PERL_VERSION/ {base = $3}
/PERL_SUBVERSION/ {subvers = $3}
END {
if (subvers == 0) 
	printf "p9pvers = 5.%03d\n", base> "buildinfo";
else
	printf "p9pvers = 5.%03d_%02d\n" , base, subvers> "buildinfo";
}

--- NEW FILE: buildinfo ---
p9pvers = 5.008

--- NEW FILE: fndvers ---
#!/bin/rc

. plan9/buildinfo

ed plan9/config.plan9 <<!
g/_P9P_VERSION/s//$p9pvers/g
g/_P9P_OBJTYPE/s//$objtype/g
w config.h
!

ed plan9/genconfig.pl<<!
g/_P9P_VERSION/s//$p9pvers/g
w plan9/genconfig.pl
!

--- NEW FILE: plan9ish.h ---
#ifndef __PLAN9ISH_H__
#define __PLAN9ISH_H__

/*
 * 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.
 *	The getgrent() has a separate definition, HAS_GETGRENT.
 */
/*#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_KILL
#define HAS_WAIT
  
/* 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		/**/

/* PLAN9:
 *	This symbol, if defined, indicates that the program is running under
 *	Plan 9.  
 */
#ifndef PLAN9
#define PLAN9		/**/
#endif

/* USEMYBINMODE
 *	This symbol, if defined, indicates that the program should
 *	use the routine my_binmode(FILE *fp, char iotype, int mode) 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 <sys/stat.h> and <sys/types.h> 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
*/
#undef 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.
 */
#define ACME_MESS	/**/

/* 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 "#!" / **/

#include <signal.h>

#ifndef SIGABRT
#    define SIGABRT SIGILL
#endif
#ifndef SIGILL
#    define SIGILL 6         /* blech */
#endif
#define ABORT() kill(PerlProc_getpid(),SIGABRT);

#define BIT_BUCKET "/dev/null"
#define PERL_SYS_INIT(c,v)	MALLOC_CHECK_TAINT2(*c,*v) MALLOC_INIT
#define dXSUB_SYS
#define PERL_SYS_TERM()		MALLOC_TERM

/*
 * 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))

/* getenv related stuff */
#define my_getenv(var) getenv(var)
/* Plan 9 prefers getenv("home") to getenv("HOME")
#define HOME home

/* For use by POSIX.xs */
extern int tcsendbreak(int, int);

#define CONDOP_SIZE 4 /* The Plan 9 compiler cannot return quads from ?: */

#undef HAS_SYMLINK	/* Plan 9 doesn't really have these. */
#undef HAS_LSTAT
#undef HAS_READLINK

#endif /* __PLAN9ISH_H__ */

--- NEW FILE: plan9.c ---
#include "EXTERN.h"
#include "perl.h"

/* Functions mentioned in <sys/socket.h> but not implemented */

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; 
}

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;
}


int recvmsg(int a, struct msghdr *b, int c)
{
    croak("Function \"recvmsg\" not implemented in this version of perl.");
    return (int)NULL;
} 

int sendmsg(int a, struct msghdr *b, int c)
{
    croak("Function \"sendmsg\" not implemented in this version of perl.");
    return (int)NULL;
} 


/* Functions mentioned in <netdb.h> but not implemented */
struct netent *getnetbyname(const char *a)
{
    croak("Function \"getnetbyname\" not implemented in this version of perl.");
    return (struct netent *)NULL;
}

struct netent *getnetbyaddr(long a, int b)
{
    croak("Function \"getnetbyaddr\" not implemented in this version of perl.");
    return (struct netent *)NULL;
}

struct netent *getnetent()
{
    croak("Function \"getnetent\" not implemented in this version of perl.");
    return (struct netent *)NULL;
}

struct protoent *getprotobyname(const char *a)
{
    croak("Function \"getprotobyname\" not implemented in this version of perl.");
    return (struct protoent *)NULL;
}

struct protoent *getprotobynumber(int a)
{
    croak("Function \"getprotobynumber\" not implemented in this version of perl.");
    return (struct protoent *)NULL;
}

struct protoent *getprotoent()
{
    croak("Function \"getprotoent\" not implemented in this version of perl.");
    return (struct protoent *)NULL;
}

struct servent *getservbyport(int a, const char *b)
{
    croak("Function \"getservbyport\" not implemented in this version of perl.");
    return (struct servent *)NULL;
}

struct servent *getservent()
{
    croak("Function \"getservent\" not implemented in this version of perl.");
    return (struct servent *)NULL;
}

void sethostent(int a)
{
    croak("Function \"sethostent\" not implemented in this version of perl.");
}

void setnetent(int a)
{
    croak("Function \"setnetent\" not implemented in this version of perl.");
}

void setprotoent(int a)
{
    croak("Function \"setprotoent\" not implemented in this version of perl.");
}

void setservent(int a)
{
    croak("Function \"setservent\"  not implemented in this version of perl.");
}

void endnetent()
{
    croak("Function \"endnetent\" not implemented in this version of perl.");
}

void endprotoent()
{
    croak("Function \"endprotoent\" not implemented in this version of perl.");
}

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.");
}

--- NEW FILE: config_sh.sample ---
#!/bin/sh
#
# This file was produced by running the Configure script. It holds all the
# definitions figured out by Configure. Should you modify one of these values,
# do not forget to propagate your changes by running "Configure -der". You may
# instead choose to run each of the .SH files by yourself, or "Configure -S".
#

# Package name      : perl5
# Source directory  : .
# Configuration time: Sun Nov 24 20:57:48 EST 2002
# Configured by     : unknown
# Target system     : plan9 17genr 1 0 generic pcfl 

Author=''
Date='$Date'
Header=''
Id='$Id'
Locker=''
[...965 lines suppressed...]
versiononly='undef'
vi=''
voidflags='15'
xlibpth=''
yacc='yacc'
yaccflags=''
zcat=''
zip='zip'
# Configure command line arguments.
config_arg0='./Configure'
config_args=''
config_argc=0
PERL_REVISION=5
PERL_VERSION=8
PERL_SUBVERSION=0
PERL_API_REVISION=5
PERL_API_VERSION=8
PERL_API_SUBVERSION=0
PERL_PATCHLEVEL=
PERL_CONFIG_SH=true

--- NEW FILE: exclude ---
comp/cpp.t
io/dup.t
io/fs.t
lib/anydbm.t
lib/complex.t
lib/filefind.t
lib/io_dup.t
lib/io_pipe.t
lib/io_sock.t
lib/io_udp.t
lib/posix.t
lib/socket.t
op/exec.t
op/goto.t
op/misc.t
op/oct.t
op/split.t
op/stat.t

--- NEW FILE: setup.rc ---
#!/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:
# Luther Huffman, Strategic Computer Solutions, Inc., lutherh at stratcom.com

awk -f versnum ../patchlevel.h
. buildinfo
builddir = `{ cd .. ; pwd } 
if (~ $#* 0) platforms = $objtype
if not switch($1) {
	case -a ; platforms = (386 mips sparc 68020)
	case * ; echo 'Usage: setup.rc [-a]' >[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

#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
echo Building library directories ...
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
	sitearch=$archlib/site_perl
	corelib=$archlib/CORE
	arpalib=$corelib/arpa
	if (test ! -d /$i/lib/perl) mkdir /$i/lib/perl
	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
}

#Populate library directories
{cd $builddir/lib ; tar c . } | {cd $privlib ; tar x }

--- NEW FILE: aperl ---
#!/bin/rc

# aperl:   
# Executes perl command and alters stderr to produce Acme-friendly error messages
# Created 02-JUL-1996, Luther Huffman,  lutherh at stratcom.com

/bin/perl $* |[2]  /bin/perl -pe 's/ line (\d+)/:$1/'  >[1=2]

--- NEW FILE: genconfig.pl ---
#!../miniperl
# Habit . . .
#
# Extract info from config.h, and add extra data here, to generate config.sh
# Edit the static information after __END__ to reflect your site and options
# that went into your perl binary.  In addition, values which change from run
# to run may be supplied on the command line as key=val pairs.
#
# Last Modified: 28-Jun-1996  Luther Huffman  lutherh at stratcom.com
#

#==== Locations of installed Perl components
$p9pvers="_P9P_VERSION";
$prefix='';
$p9p_objtype=$ENV{'objtype'};
$builddir="/sys/src/cmd/perl/$p9pvers";
$installbin="/$p9p_objtype/bin";
$installman1dir="/sys/man/1";
$installman3dir="/sys/man/2";
$installprivlib="/sys/lib/perl";
$installarchlib = "/$p9p_objtype/lib/perl/$p9pvers";
$archname="plan9_$p9p_objtype";
$installsitelib="$installprivlib/site_perl";
$installsitearch="$installarchlib/site_perl";
$installscript="/bin";

unshift(@INC,'lib');  # In case someone didn't define Perl_Root
                      # before the build

if ($ARGV[0] eq '-f') {
  open(ARGS,$ARGV[1]) or die "Can't read data from $ARGV[1]: $!\n";
  @ARGV = ();
  while (<ARGS>) {
    push(@ARGV,split(/\|/,$_));
  }
  close ARGS;
}

if (-f "config.h") { $infile = "config.h"; $outdir = "../"; }
elsif (-f "plan9/config.h") { $infile = "plan9/config.h";  $outdir = "./"; }

if ($infile) { print "Generating config.sh from $infile . . .\n"; }
else { die <<EndOfGasp;
Can't find config.h to read!
	Please run this script from the perl source directory or
	the plan9 subdirectory in the distribution.
EndOfGasp
}
$outdir = '';
open(IN,"$infile") || die "Can't open $infile: $!\n";
open(OUT,">${outdir}config.sh") || die "Can't open ${outdir}config.sh: $!\n";

$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';

print OUT <<EndOfIntro;
# This file generated by genconfig.pl on a Plan 9 system.
# Input obtained from:
#     $infile
#     $0
# Time: $time

package='perl5'
CONFIG='true'
cf_time='$time'
cf_by='$cf_by'
ccdlflags=''
cccdlflags=''
libpth='$installprivlib'
ld='pcc'
lddlflags=''
ranlib=''
ar='ar'
nroff='/bin/nroff'
eunicefix=':'
hint='none'
hintfile=''
intsize='4'
longsize='4'
shortsize='2'
shrplib='define'
usemymalloc='n'
usevfork='true'
useposix='true'
spitshell='cat'
dlsrc='dl_none.c'
binexp='$installbin'
man1ext=''
man3ext=''
arch='$archname'
archname='$archname'
osname='plan9'
extensions='IO Socket Opcode Fcntl POSIX DynaLoader FileHandle'
osvers='$osvers'
sig_maxsig='19'
sig_name='ZERO HUP INT QUIT ILL ABRT FPE KILL SEGV PIPE ALRM TERM USR1 USR2 CHLD CONT STOP TSTP TTIN TTOU'
sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19'
sig_numsig='20'
prefix='$prefix'
builddir='$builddir'
installbin='$installbin'
installman1dir='$installman1dir'
installman3dir='$installman3dir'
installprivlib='$installprivlib'
installarchlib='$installarchlib'
installsitelib='$installsitelib'
installsitearch='$installsitearch'
installscript='$installscript'
scriptdir='$installscript'
scriptdirexp='$installscript'
EndOfIntro

# Plan 9 compiler stuff
print OUT "cc='pcc'\n";
print OUT "d_attribute_format='undef'\n";
print OUT "d_attribute_malloc='undef'\n";
print OUT "d_attribute_nonnull='undef'\n";
print OUT "d_attribute_noreturn='undef'\n";
print OUT "d_attribute_pure='undef'\n";
print OUT "d_attribute_unused='undef'\n";
print OUT "d_attribute_warn_unused_result='undef'\n";
print OUT "d_socket='define'\n";
print OUT "d_sockpair='define'\n";
print OUT "d_sigsetjmp='define'\n";
print OUT "sigjmp_buf='sigjmp_buf'\n";
print OUT "sigsetjmp='sigsetjmp(buf,save_mask)'\n";
print OUT "siglongjmp='siglongjmp(buf,retval) '\n";
print OUT "exe_ext=''\n";
if ($p9p_objtype eq '386') {
	$objext = '.8';
	$alignbytes = '4';
	$cstflags = 2;
}
elsif ($p9p_objtype eq '68020') {
	$objext = '.2';
	$alignbytes = '2';
	$cstflags = 0;
}
elsif ($p9p_objtype eq 'mips') {
	$objext = '.v';
	$alignbytes = '8';
	$cstflags = 0;
}
elsif ($p9p_objtype eq 'sparc') {
	$objext = '.k';
	$alignbytes = '4';
	$cstflags = 0;
}
print OUT "obj_ext='$objext'\n";
print OUT "alignbytes='$alignbytes'\n";
print OUT "castflags='$cstflags'\n";

$myname = $ENV{'site'} ;
($myhostname,$mydomain) = split(/\./,$myname,2);
print OUT "myhostname='$myhostname'\n" if $myhostname;
if ($mydomain) {
  print OUT "mydomain='.$mydomain'\n";
  print OUT "perladmin='$cf_by\@$myhostname.$mydomain'\n";
  print OUT "cf_email='$cf_by\@$myhostname.$mydomain'\n";
}
else {
  print OUT "perladmin='$cf_by'\n";
  print OUT "cf_email='$cf_by'\n";
}
print OUT "myuname='Plan9 $myname $osvers $p9p_objtype'\n";

# Before we read the C header file, find out what config.sh constants are
# equivalent to the C preprocessor macros
if (open(SH,"${outdir}config_h.SH")) {
  while (<SH>) {
    next unless m%^#(?!if).*\$%;
    s/^#//; s!(.*?)\s*/\*.*!$1!;
    my(@words) = split;
    $words[1] =~ s/\(.*//;  # Clip off args from macro
    # Did we use a shell variable for the preprocessor directive?
    if ($words[0] =~ m!^\$(\w+)!) { $pp_vars{$words[1]} = $1; }
    if (@words > 2) {  # We may also have a shell var in the value
      shift @words;              #  Discard preprocessor directive
      my($token) = shift @words; #  and keep constant name
      my($word);
      foreach $word (@words) {
        next unless $word =~ m!\$(\w+)!;
        $val_vars{$token} = $1;
        last;
      }
    }
  }
  close SH;
}
else { 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
while (<IN>) {  # roll through the comment header in config.h
  last if /config-start/;
}

while (<IN>) {
  chop;
  while (/\\\s*$/) {  # pick up contination lines
    my $line = $_;
    $line =~ s/\\\s*$//;
    $_ = <IN>;
    s/^\s*//;
    $_ = $line . $_;
  }              
  next unless my ($blocked,$un,$token,$val) =
                 m%^(\/\*)?\s*\#\s*(un)?def\w*\s+([A-Za-z0-9]\w+)\S*\s*(.*)%;
  if (/config-skip/) {
    delete $pp_vars{$token} if exists $pp_vars{$token};
    delete $val_vars{$token} if exists $val_vars{$token};
    next;
  }
  $val =~ s!\s*/\*.*!!; # strip off trailing comment
  my($had_val); # Maybe a macro with args that we just #undefd or commented
  if (!length($val) and $val_vars{$token} and ($un || $blocked)) {
    print OUT "$val_vars{$token}=''\n";
    delete $val_vars{$token};
    $had_val = 1;
  }
  $state = ($blocked || $un) ? 'undef' : 'define';
  if ($pp_vars{$token}) {
    print OUT "$pp_vars{$token}='$state'\n";
    delete $pp_vars{$token};
  }
  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";
    $token =~ tr/A-Z/a-z/;
    $token = "d_$token" unless $token =~ /^i_/;
    print OUT "$token='$state'\n";
  }
  next unless length $val;
  $val =~ s/^"//; $val =~ s/"$//;               # remove end quotes
  $val =~ s/","/ /g;                            # make signal list look nice
 
 if ($val_vars{$token}) {
    print OUT "$val_vars{$token}='$val'\n";
    if ($val_vars{$token} =~ s/exp$//) {print OUT "$val_vars{$token}='$val'\n";}
    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";
    $token =~ tr/A-Z/a-z/;
    print OUT "$token='$val'\n";
    if ($token =~ s/exp$//) {print OUT "$token='$val'\n";}
  }
}
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";
}


# print OUT "libs='",join(' ', at libs),"'\n";
# print OUT "libc='",join(' ', at crtls),"'\n";

if (open(PL,"${outdir}patchlevel.h")) {
  while (<PL>) {
    if    (/^#define PERL_VERSION\s+(\S+)/) {
      print OUT "PERL_VERSION='$1'\n";
      print OUT "PATCHLEVEL='$1'\n";		# XXX compat
    }
    elsif (/^#define PERL_SUBVERSION\s+(\S+)/) {
      print OUT "PERL_SUBVERSION='$1'\n";
      print OUT "SUBVERSION='$1'\n";		# XXX compat
    }
  }
  close PL;
}
else { warn "Can't read ${outdir}patchlevel.h - skipping 'PERL_VERSION'"; }

print OUT "pager='/bin/p'\n";

close OUT;



--- NEW FILE: config_h.sample ---
/*
 * This file was produced by running the config_h.SH script, which
 * gets its values from config.sh, which is generally produced by
 * running Configure.
 *
 * Feel free to modify any of this as the need arises.  Note, however,
 * that running config_h.SH again will wipe out any changes you've made.
 * For a more permanent change edit config.sh and rerun config_h.SH.
 *
 * $Id: config_h.sample,v 1.1 2006-12-04 17:01:26 dslinux_cayenne Exp $
 */

/*
 * Package name      : perl
 * Source directory  : .
 * Configuration time: Sun Nov 24 20:57:48 EST 2002
 * Configured by     : 9trouble
 * Target system     : plan9 17genr 1 0 generic pcfl 
 */
[...4225 lines suppressed...]
 *	is defined.
 */
/*#define HAS_SETSERVENT_R	   / **/
#define SETSERVENT_R_PROTO 0	   /**/

/* HAS_TTYNAME_R:
 *	This symbol, if defined, indicates that the ttyname_r routine
 *	is available to ttyname re-entrantly.
 */
/* TTYNAME_R_PROTO:
 *	This symbol encodes the prototype of ttyname_r.
 *	It is zero if d_ttyname_r is undef, and one of the
 *	REENTRANT_PROTO_T_ABC macros of reentr.h if d_ttyname_r
 *	is defined.
 */
/*#define HAS_TTYNAME_R	   / **/
#define TTYNAME_R_PROTO 0	   /**/

#endif





More information about the dslinux-commit mailing list