diff options
-rwxr-xr-x | Configure | 43 | ||||
-rw-r--r-- | MANIFEST | 5 | ||||
-rw-r--r-- | MANIFEST.new | 5 | ||||
-rw-r--r-- | Makefile.SH | 23 | ||||
-rw-r--r-- | U/Oldconfig.pat.2 | 30 | ||||
-rw-r--r-- | U/archlib.U | 140 | ||||
-rw-r--r-- | U/dlsrc.U | 2 | ||||
-rw-r--r-- | config.H | 35 | ||||
-rwxr-xr-x | config_h.SH | 33 | ||||
-rw-r--r-- | hints/dec_osf.sh | 12 | ||||
-rw-r--r-- | hints/mpeix.sh | 2 | ||||
-rw-r--r-- | hints/next_3_0.sh | 43 | ||||
-rw-r--r-- | hints/ultrix_4.sh | 37 | ||||
-rwxr-xr-x | installperl | 3 | ||||
-rw-r--r-- | lib/ExtUtils/MakeMaker.pm | 684 | ||||
-rw-r--r-- | lib/File/Path.pm | 146 | ||||
-rw-r--r-- | makeaperl | 101 | ||||
-rw-r--r-- | minimod.PL | 89 | ||||
-rw-r--r-- | perl.c | 12 | ||||
-rw-r--r-- | proto.h | 2 | ||||
-rw-r--r-- | vms/config.vms | 14 | ||||
-rw-r--r-- | vms/ext/MM_VMS.pm | 668 | ||||
-rw-r--r-- | x2p/a2p.h | 6 |
23 files changed, 1796 insertions, 339 deletions
@@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.6 1994/10/29 15:54:19 ram Exp $ # -# Generated on Mon Feb 6 10:35:10 EST 1995 [metaconfig 3.0 PL50] +# Generated on Sat Feb 11 11:56:23 EST 1995 [metaconfig 3.0 PL50] cat >/tmp/c1$$ <<EOF ARGGGHHHH!!!!! @@ -441,6 +441,7 @@ i_sysparam='' i_sysselct='' i_sysstat='' i_systimes='' +i_systypes='' i_sgtty='' i_termio='' i_termios='' @@ -1581,12 +1582,9 @@ EOM osvers="$3" ;; osf1) case "$5" in - alpha) osname=dec_osf - case "$3" in - [vt]1\.*) osvers=1 ;; - [vt]2\.*) osvers=2 ;; - [vt]3\.*) osvers=3 ;; - esac + alpha) + osname=dec_osf + osvers=`echo "$3" | sed 's/^[vt]//'` ;; hp*) osname=hp_osf1 ;; mips) osname=mips_osf1 ;; @@ -3528,18 +3526,22 @@ prefixup='case "$prefixexp" in esac' : determine where public architecture dependent libraries go -if xxx=`./loc arch blurfl $pth`; test -f "$xxx"; then - tarchname=`arch` - archname="${tarchname}-$osname" -elif xxx=`./loc uname blurfl $pth`; test -f "$xxx" ; then - if uname -m > tmparch 2>&1 ; then - tarchname=`cat tmparch` +case "$archname" in +'') + if xxx=`./loc arch blurfl $pth`; test -f "$xxx"; then + tarchname=`arch` archname="${tarchname}-$osname" + elif xxx=`./loc uname blurfl $pth`; test -f "$xxx" ; then + if uname -m > tmparch 2>&1 ; then + tarchname=`cat tmparch` + archname="${tarchname}-$osname" + fi + $rm -f tmparch + else + archname="$osname" fi - $rm -f tmparch -else - archname="$osname" -fi + ;; +esac set archlib archlib eval $prefixit case "$archlib" in @@ -4181,7 +4183,7 @@ y*) usedl="$define" : Can not go over to $dldir because getfile has path hard-coded in. cd ..; ls -C $dldir/dl*.xs; cd UU rp="Source file to use for dynamic loading" - fn="fne~" + fn="fne" . ./getfile usedl="$define" : emulate basename @@ -7509,6 +7511,10 @@ eval $inhdr set sys/stat.h i_sysstat eval $inhdr +: see if sys/types.h has to be included +set sys/types.h i_systypes +eval $inhdr + : see if this is a unistd.h system set unistd.h i_unistd eval $inhdr @@ -7862,6 +7868,7 @@ i_sysstat='$i_sysstat' i_systime='$i_systime' i_systimek='$i_systimek' i_systimes='$i_systimes' +i_systypes='$i_systypes' i_termio='$i_termio' i_termios='$i_termios' i_time='$i_time' @@ -204,6 +204,7 @@ hints/mpc.sh Hints for named architecture hints/mpeix.sh Hints for named architecture hints/ncr_tower.sh Hints for named architecture hints/netbsd.sh Hints for named architecture +hints/next_3_0.sh Hints for named architecture hints/next_3_2.sh Hints for named architecture hints/opus.sh Hints for named architecture hints/sco_2_3_0.sh Hints for named architecture @@ -246,6 +247,7 @@ lib/ExtUtils/xsubpp External subroutine preprocessor lib/File/Basename.pm A module to emulate the basename program lib/File/CheckTree.pm Perl module supporting wholesale file mode validation lib/File/Find.pm Routines to do a find +lib/File/Path.pm A module to do things like `mkdir -p' and `rm -r' lib/FileHandle.pm FileHandle methods lib/Getopt/Long.pm A module to fetch command options (GetOptions) lib/Getopt/Std.pm A module to fetch command options (getopt, getopts) @@ -315,6 +317,8 @@ makedir.SH Precursor to makedir malloc.c A version of malloc you might not want mg.c Magic code mg.h Magic header +makeaperl perl script that produces a new perl binary +minimod.PL Writes lib/ExtUtils/Miniperl.pm miniperlmain.c Basic perl w/o dynamic loading or extensions mv-if-diff Script to mv a file if it changed myconfig Prints summary of the current configuration @@ -511,6 +515,7 @@ util.c Utility routines util.h Public declarations for the above vms/config.vms VMS port vms/descrip.mms VMS port +vms/ext/MM_VMS.pm VMS port vms/gen_shrfls.pl VMS port vms/genconfig.pl VMS port vms/genopt.com VMS port diff --git a/MANIFEST.new b/MANIFEST.new index fed72db976..3d96dae89a 100644 --- a/MANIFEST.new +++ b/MANIFEST.new @@ -204,6 +204,7 @@ hints/mpc.sh Hints for named architecture hints/mpeix.sh Hints for named architecture hints/ncr_tower.sh Hints for named architecture hints/netbsd.sh Hints for named architecture +hints/next_3_0.sh Hints for named architecture hints/next_3_2.sh Hints for named architecture hints/opus.sh Hints for named architecture hints/sco_2_3_0.sh Hints for named architecture @@ -246,6 +247,7 @@ lib/ExtUtils/xsubpp External subroutine preprocessor lib/File/Basename.pm A module to emulate the basename program lib/File/CheckTree.pm Perl module supporting wholesale file mode validation lib/File/Find.pm Routines to do a find +lib/File/Path.pm A module to do things like `mkdir -p' and `rm -r' lib/FileHandle.pm FileHandle methods lib/Getopt/Long.pm A module to fetch command options (GetOptions) lib/Getopt/Std.pm A module to fetch command options (getopt, getopts) @@ -315,6 +317,8 @@ makedir.SH Precursor to makedir malloc.c A version of malloc you might not want mg.c Magic code mg.h Magic header +makeaperl perl script that produces a new perl binary +minimod.PL Writes lib/ExtUtils/Miniperl.pm miniperlmain.c Basic perl w/o dynamic loading or extensions mv-if-diff Script to mv a file if it changed myconfig Prints summary of the current configuration @@ -511,6 +515,7 @@ util.c Utility routines util.h Public declarations for the above vms/config.vms VMS port vms/descrip.mms VMS port +vms/ext/MM_VMS.pm VMS port vms/gen_shrfls.pl VMS port vms/genconfig.pl VMS port vms/genopt.com VMS port diff --git a/Makefile.SH b/Makefile.SH index df3a65efdc..8e295a85fa 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -70,7 +70,7 @@ $spitshell >Makefile <<'!NO!SUBS!' # Makefile is used to generate makefile. The only difference # is that makefile has the dependencies filled in at the end. # -# +# !NO!SUBS! $spitshell >>Makefile <<!GROK!THIS! @@ -124,7 +124,7 @@ $spitshell >>Makefile <<'!NO!SUBS!' CCCMD = `sh $(shellflags) cflags $(perllib) $@` -private = +private = preplibrary lib/ExtUtils/Miniperl.pm lib/Config.pm scripts = @@ -134,7 +134,7 @@ util = sh = Makefile.SH cflags.SH makedepend.SH makedir.SH writemain.SH -h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h +h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h h4 = regexp.h scope.h sv.h unixish.h util.h @@ -173,7 +173,7 @@ SHELL = /bin/sh .c.o: $(CCCMD) $(PLDLFLAGS) $*.c -all: makefile miniperl preplibrary $(public) $(dynamic_ext) +all: makefile miniperl $(private) $(public) $(dynamic_ext) @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all @echo " "; echo " Making docs"; cd pod; $(MAKE) all; @@ -203,7 +203,7 @@ perlmain.o: perlmain.c # The file ext.libs is a list of libraries that must be linked in # for static extensions, e.g. -lm -lgdbm, etc. The individual # static extension Makefile's add to it. -ext.libs: $(static_ext) +ext.libs: $(static_ext) -@test -f ext.libs || touch ext.libs perl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs @@ -265,6 +265,9 @@ lib/Config.pm: config.sh miniperl ./miniperl configpm tmp sh mv-if-diff tmp lib/Config.pm +lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.PL lib/Config.pm + ./miniperl minimod.PL > tmp && mv tmp $@ + install: all ./perl installperl !NO!SUBS! @@ -274,7 +277,7 @@ install: all : doing can uncomment them and run yacc or bison or whatever. case "$d_byacc" in 'define') - comment1='' + comment1='' comment2='#' ;; *) comment1='#' comment2='' ;; @@ -305,7 +308,7 @@ ${comment2} touch perly.c $spitshell >>Makefile <<'!NO!SUBS!' # Extensions: # Names added to $(dynamic_ext) or $(static_ext) will automatically -# get built. There should ordinarily be no need to change any of +# get built. There should ordinarily be no need to change any of # this part of makefile. # # The dummy dependency is a place holder in case $(dynamic_ext) or @@ -324,7 +327,7 @@ s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE clean: rm -f *.o *.a all perlmain.c - rm -f perl.exp ext.libs ext/util/extlibist + rm -f perl.exp ext.libs -cd x2p; $(MAKE) clean -cd pod; $(MAKE) clean -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \ @@ -341,7 +344,7 @@ realclean: clean rm -rf $(addedbyconf) rm -f Makefile cflags makedepend makedir writemain rm -f config.h makefile makefile.old - rm -f lib/Config.pm + rm -f $(private) rm -rf lib/auto rm -f h2ph h2ph.man c2ph pstruct rm -rf .config @@ -349,7 +352,7 @@ realclean: clean clobber: realclean rm -f config.sh cppstdin - + distclean: clobber # The following lint has practically everything turned on. Unfortunately, diff --git a/U/Oldconfig.pat.2 b/U/Oldconfig.pat.2 new file mode 100644 index 0000000000..015c9510f2 --- /dev/null +++ b/U/Oldconfig.pat.2 @@ -0,0 +1,30 @@ +Index: Oldconfig.U +Prereq: 3.0.1.6 +*** /home2/doughera/lib/dist/U/Oldconfig.U Thu Feb 2 14:42:37 1995 +--- Oldconfig.U Sat Feb 11 10:51:05 1995 +*************** +*** 261,272 **** + osvers="$3" + ;; + osf1) case "$5" in +! alpha) osname=dec_osf +! case "$3" in +! [vt]1\.*) osvers=1 ;; +! [vt]2\.*) osvers=2 ;; +! [vt]3\.*) osvers=3 ;; +! esac + ;; + hp*) osname=hp_osf1 ;; + mips) osname=mips_osf1 ;; +--- 261,271 ---- + osvers="$3" + ;; + osf1) case "$5" in +! alpha) +! ?X: DEC OSF/1 myuname -a output looks like: osf1 xxxx t3.2 123.4 alpha +! ?X: where the version number can be either vn.n or tn.n. +! osname=dec_osf +! osvers=`echo "$3" | sed 's/^[vt]//'` + ;; + hp*) osname=hp_osf1 ;; + mips) osname=mips_osf1 ;; diff --git a/U/archlib.U b/U/archlib.U new file mode 100644 index 0000000000..6f8a3fb5ca --- /dev/null +++ b/U/archlib.U @@ -0,0 +1,140 @@ +?RCS: $Id: archlib.U,v 3.0.1.2 1995/01/30 14:32:22 ram Exp $ +?RCS: +?RCS: Copyright (c) 1991-1993, Raphael Manfredi +?RCS: +?RCS: You may redistribute only under the terms of the Artistic Licence, +?RCS: as specified in the README file that comes with the distribution. +?RCS: You may reuse parts of this distribution only within the terms of +?RCS: that same Artistic Licence; a copy of which may be found at the root +?RCS: of the source tree for dist 3.0. +?RCS: +?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu> +?RCS: +?RCS: $Log: archlib.U,v $ +?RCS: Revision 3.0.1.2 1995/01/30 14:32:22 ram +?RCS: patch49: archname is now systematically recomputed +?RCS: patch49: can now handle installation prefix changes (from WED) +?RCS: +?RCS: Revision 3.0.1.1 1994/10/29 16:02:36 ram +?RCS: patch36: created by ADO +?RCS: +?MAKE:d_archlib archlib archlibexp installarchlib archname: afs spackage \ + cat Getfile Loc Oldconfig prefixexp privlib osname test Prefixit rm \ + Prefixup +?MAKE: -pick add $@ %< +?S:d_archlib: +?S: This variable conditionally defines ARCHLIB to hold the pathname +?S: of architecture-dependent library files for $package. If +?S: $archlib is the same as $privlib, then this is set to undef. +?S:. +?S:archname: +?S: This variable is a short name to characterize the current +?S: architecture. It is used to construct the default archlib. +?S:. +?S:archlib: +?S: This variable holds the name of the directory in which the user wants +?S: to put architecture-dependent public library files for $package. +?S: It is most often a local directory such as /usr/local/lib. +?S: Programs using this variable must be prepared to deal +?S: with filename expansion. +?S:. +?S:archlibexp: +?S: This variable is the same as the archlib variable, but is +?S: filename expanded at configuration time, for convenient use. +?S:. +?S:installarchlib: +?S: This variable is really the same as archlibexp but may differ on +?S: those systems using AFS. For extra portability, only this variable +?S: should be used in makefiles. +?S:. +?C:ARCHLIB: +?C: This variable, if defined, holds the name of the directory in +?C: which the user wants to put architecture-dependent public +?C: library files for $package. It is most often a local directory +?C: such as /usr/local/lib. Programs using this variable must be +?C: prepared to deal with filename expansion. If ARCHLIB is the +?C: same as PRIVLIB, it is not defined, since presumably the +?C: program already searches PRIVLIB. +?C:. +?C:ARCHLIB_EXP: +?C: This symbol contains the ~name expanded version of ARCHLIB, to be used +?C: in programs that are not prepared to deal with ~ expansion at run-time. +?C:. +?H:#$d_archlib ARCHLIB "$archlib" /**/ +?H:#$d_archlib ARCHLIB_EXP "$archlibexp" /**/ +?H:. +?T:xxx tarchname +: determine where public architecture dependent libraries go +?X: Always recompute archname in case osname changes -- RAM +?X: But this prevents us from setting a sensible value in a hints file +?X: or on the command line. -- ADO. +case "$archname" in +'') + if xxx=`./loc arch blurfl $pth`; test -f "$xxx"; then + tarchname=`arch` + archname="${tarchname}-$osname" + elif xxx=`./loc uname blurfl $pth`; test -f "$xxx" ; then + if uname -m > tmparch 2>&1 ; then + tarchname=`cat tmparch` + archname="${tarchname}-$osname" + fi + $rm -f tmparch + else + archname="$osname" + fi + ;; +esac +set archlib archlib +eval $prefixit +case "$archlib" in +'') + case "$privlib" in + '') + dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib` + set dflt + eval $prefixup + ;; + *) dflt="$privlib/$archname";; + esac + ;; +*) dflt="$archlib";; +esac +cat <<EOM + +$spackage contains architecture-dependent library files. If you are +sharing libraries in a heterogeneous environment, you might store +these files in a separate location. Otherwise, you can just include +them with the rest of the public library files. + +EOM +fn=d~ +rp='Where do you want to put the public architecture-dependent libraries?' +. ./getfile +archlib="$ans" +archlibexp="$ansexp" + +if $afs; then + $cat <<EOM + +Since you are running AFS, I need to distinguish the directory in which +private files reside from the directory in which they are installed (and from +which they are presumably copied to the former directory by occult means). + +EOM + case "$installarchlib" in + '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;; + *) dflt="$installarchlib";; + esac + fn=de~ + rp='Where will architecture-dependent library files be installed?' + . ./getfile + installarchlib="$ans" +else + installarchlib="$archlibexp" +fi +if $test X"$archlib" = X"$privlib"; then + d_archlib="$undef" +else + d_archlib="$define" +fi + @@ -114,7 +114,7 @@ y*) usedl="$define" : Can not go over to $dldir because getfile has path hard-coded in. cd ..; ls -C $dldir/dl*.xs; cd UU rp="Source file to use for dynamic loading" - fn="fne~" + fn="fne" . ./getfile usedl="$define" : emulate basename @@ -14,7 +14,7 @@ * $Id: Config_h.U,v 3.0.1.3 1995/01/30 14:25:39 ram Exp $ */ -/* Configuration time: Sat Feb 4 14:42:43 EST 1995 +/* Configuration time: Sat Feb 11 12:02:12 EST 1995 * Configured by: andy * Target system: crystal crystal 3.2 2 i386 */ @@ -28,17 +28,6 @@ */ #define MEM_ALIGNBYTES 4 /**/ -/* ARCHLIB: - * This variable, if defined, holds the name of the directory in - * which the user wants to put architecture-dependent public - * library files for perl5. It is most often a local directory - * such as /usr/local/lib. Programs using this variable must be - * prepared to deal with filename expansion. If ARCHLIB is the - * same as PRIVLIB, it is not defined, since presumably the - * program already searches PRIVLIB. - */ -#define ARCHLIB "/usr/local/lib/perl5/i386-isc" /**/ - /* 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. @@ -1135,6 +1124,12 @@ */ #define I_SYS_TIMES /**/ +/* I_SYS_TYPES: + * This symbol, if defined, indicates to the C program that it should + * include <sys/types.h>. + */ +#define I_SYS_TYPES /**/ + /* I_TERMIO: * This symbol, if defined, indicates that the program should include * <termio.h> rather than <sgtty.h>. There are also differences in @@ -1221,13 +1216,11 @@ */ #define Mode_t mode_t /* file mode parameter for system calls */ -/* PRIVLIB: - * This symbol contains the name of the private library for this package. - * 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. The program - * should be prepared to do ~ expansion. +/* PRIVLIB_EXP: + * 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 "/usr/local/lib/perl5" /**/ +#define PRIVLIB_EXP "/usr/local/lib/perl5" /**/ /* CAN_PROTOTYPE: * If defined, this macro indicates that the C compiler can handle @@ -1354,6 +1347,12 @@ */ #define LOC_SED "/bin/sed" /**/ +/* ARCHLIB_EXP: + * This symbol contains the ~name expanded version of ARCHLIB, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +#define ARCHLIB_EXP "/usr/local/lib/perl5/i386-isc" /**/ + /* CSH: * This symbol, if defined, indicates that the C-shell exists. * If defined, contains the full pathname of csh. diff --git a/config_h.SH b/config_h.SH index 0535350724..aea3abb6a1 100755 --- a/config_h.SH +++ b/config_h.SH @@ -42,17 +42,6 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' */ #define MEM_ALIGNBYTES $alignbytes /**/ -/* ARCHLIB: - * This variable, if defined, holds the name of the directory in - * which the user wants to put architecture-dependent public - * library files for $package. It is most often a local directory - * such as /usr/local/lib. Programs using this variable must be - * prepared to deal with filename expansion. If ARCHLIB is the - * same as PRIVLIB, it is not defined, since presumably the - * program already searches PRIVLIB. - */ -#$d_archlib ARCHLIB "$archlib" /**/ - /* 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. @@ -1149,6 +1138,12 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' */ #$i_systimes I_SYS_TIMES /**/ +/* I_SYS_TYPES: + * This symbol, if defined, indicates to the C program that it should + * include <sys/types.h>. + */ +#$i_systypes I_SYS_TYPES /**/ + /* I_TERMIO: * This symbol, if defined, indicates that the program should include * <termio.h> rather than <sgtty.h>. There are also differences in @@ -1235,13 +1230,11 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' */ #define Mode_t $modetype /* file mode parameter for system calls */ -/* PRIVLIB: - * This symbol contains the name of the private library for this package. - * 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. The program - * should be prepared to do ~ expansion. +/* PRIVLIB_EXP: + * 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 "$privlib" /**/ +#define PRIVLIB_EXP "$privlibexp" /**/ /* CAN_PROTOTYPE: * If defined, this macro indicates that the C compiler can handle @@ -1368,6 +1361,12 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' */ #define LOC_SED "$full_sed" /**/ +/* ARCHLIB_EXP: + * This symbol contains the ~name expanded version of ARCHLIB, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +#$d_archlib ARCHLIB_EXP "$archlibexp" /**/ + /* CSH: * This symbol, if defined, indicates that the C-shell exists. * If defined, contains the full pathname of csh. diff --git a/hints/dec_osf.sh b/hints/dec_osf.sh index 311a786ace..38b48e53e3 100644 --- a/hints/dec_osf.sh +++ b/hints/dec_osf.sh @@ -1,11 +1,3 @@ # hints/dec_osf.sh -case "$optimize" in -'') optimize="-g" ;; -esac -ccflags="$ccflags -DSTANDARD_C -DDEBUGGING" -# Version 1 has problems with -no_archive if only an archive -# lib is available. -case "$osvers" in -1*) lddlflags='-shared -expect_unresolved "*" -s' ;; -*) lddlflags='-shared -no_archive -expect_unresolved "*" -s' ;; -esac +ccflags="$ccflags -DSTANDARD_C" +lddlflags='-shared -expect_unresolved "*" -s' diff --git a/hints/mpeix.sh b/hints/mpeix.sh index 6c548284af..9fc2737893 100644 --- a/hints/mpeix.sh +++ b/hints/mpeix.sh @@ -1,3 +1,5 @@ +# MPE/IX does not have nm, and the linker doesn't complain +# about unresolved symbols, so these are all filled in by hand. osname='mpeix' osvers='5.0' alignbytes='8' diff --git a/hints/next_3_0.sh b/hints/next_3_0.sh new file mode 100644 index 0000000000..a34d621449 --- /dev/null +++ b/hints/next_3_0.sh @@ -0,0 +1,43 @@ +# This file has been put together by Anno Siegel <siegel@zrz.TU-Berlin.DE> +# and Andreas Koenig <k@franz.ww.TU-Berlin.DE>. Comments, questions, and +# improvements welcome! + +# This file was modified to work on NS 3.0 by Kevin White +# <klwhite@magnus.acs.ohio-state.edu>, based on suggestions by Andreas +# Koenig and Andy Dougherty. + +echo With NS 3.0 you won\'t be able to use the POSIX module. +echo Be aware that some of the tests that are run during "make test" +echo will fail due to the lack of POSIX support on this system. +echo +echo Also, if you have the GDBM installed, make sure the header file +echo is located at a place on the system where the C compiler will +echo find it. By default, it is placed in /usr/local/include/gdbm.h. +echo It will not be found there. Try moving it to +echo /NextDeveloper/Headers/bsd/gdbm.h. + +ccflags='-DUSE_NEXT_CTYPE -DNEXT30_NO_ATTRIBUTE' +POSIX_cflags='ccflags="-posix $ccflags"' +useposix='undef' +ldflags='-u libsys_s' +libswanted='dbm gdbm db' +lddlflags='-r' +i_utime='undef' +groupstype='int' +direntrytype='struct direct' +d_strcoll='undef' +# the simple program `for ($i=1;$i<38771;$i++){$t{$i}=123}' fails +# with Larry's malloc on NS 3.2 due to broken sbrk() +usemymalloc='n' +d_uname='define' +d_setpgid='define' +d_setsid='define' +d_tcgetpgrp='define' +d_tcsetpgrp='define' +# +# On some NeXT machines, the timestamp put by ranlib is not correct, and +# this may cause useless recompiles. Fix that by adding a sleep before +# running ranlib. The '5' is an empirical number that's "long enough." +# (Thanks to Andreas Koenig <k@franz.ww.tu-berlin.de>) +ranlib='sleep 5; /bin/ranlib' + diff --git a/hints/ultrix_4.sh b/hints/ultrix_4.sh index 654a6a1e05..f0369c0be7 100644 --- a/hints/ultrix_4.sh +++ b/hints/ultrix_4.sh @@ -1,32 +1,45 @@ # hints/ultrix_4.sh # Last updated by Andy Dougherty <doughera@lafcol.lafayette.edu> -# Wed Nov 2 13:41:14 EST 1994 +# Fri Feb 10 10:04:51 EST 1995 +# +# Use Configure -Dcc=gcc to use gcc. # # I don't know if -g is really needed. (AD) case "$optimize" in '') optimize=-g ;; esac + case "$myuname" in *risc*) cat <<EOF Note that there is a bug in some versions of NFS on the DECStation that may cause utime() to work incorrectly. If so, regression test io/fs may fail if run under NFS. Ignore the failure. EOF +esac + +# Compiler flags that depend on osversion: +case "$cc" in +*gcc*) ;; +*) case "$osvers" in - *4.2*) d_volatile=undef;; + *4.1*) ccflags="$ccflags -DLANGUAGE_C -Olimit 2900" ;; + *4.2*) ccflags="$ccflags -DLANGUAGE_C -Olimit 2900" + case "$myuname" in + *risc*) d_volatile=undef ;; + esac + ;; + *4.3*) ccflags="$ccflags -std1 -DLANGUAGE_C -Olimit 2900" ;; + *) ccflags="$ccflags -std -Olimit 2900" ;; esac ;; esac + +# Other settings that depend on $osvers: case "$osvers" in -*4.1*) ccflags="$ccflags -DLANGUAGE_C -Olimit 2900" - ;; -*4.2*) ccflags="$ccflags -DLANGUAGE_C -Olimit 2900" - libswanted=`echo $libswanted | sed 's/ malloc / /'` - ;; -*4.3*) ccflags="$ccflags -std1 -DLANGUAGE_C -Olimit 2900" - ;; -*4*) ccflags="$ccflags -std -Olimit 2900" - ranlib='ranlib' - ;; +*4.1*) ;; +*4.2*) libswanted=`echo $libswanted | sed 's/ malloc / /'` ;; +*4.3*) ;; +*) ranlib='ranlib' ;; esac + groupstype='int' diff --git a/installperl b/installperl index 38bfef365a..d41ff9978f 100755 --- a/installperl +++ b/installperl @@ -150,6 +150,9 @@ foreach $file (<*.h libperl*.*>) { # AIX needs perl.exp installed as well. cp_if_diff("perl.exp" ,"$installarchlib/CORE/perl.exp") if ($osname eq 'aix'); +# If they have built sperl.o... +cp_if_diff("sperl.o" ,"$installarchlib/CORE/sperl.o") if (-f 'sperl.o'); + # Offer to install perl in a "standard" location diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index e0163d2289..6518bcc921 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -1,6 +1,6 @@ package ExtUtils::MakeMaker; -$Version = 4.03; # Last edited 30th Jan 1995 by Andreas Koenig +$Version = 4.06; # Last edited 10th Feb 1995 by Andreas Koenig use Config; check_hints(); @@ -32,7 +32,7 @@ ExtUtils::MakeMaker - create an extension Makefile C<use ExtUtils::MakeMaker;> -C<WriteMakefile( ATTRIBUTE => VALUE [, ...] );> +C<WriteMakefile( ATTRIBUTE =E<gt> VALUE [, ...] );> =head1 DESCRIPTION @@ -48,9 +48,10 @@ MakeMaker.pm uses the architecture specific information from Config.pm. In addition the extension may contribute to the C<%Config> hash table of Config.pm by supplying hints files in a C<hints/> directory. The hints files are expected to be named like their -counterparts in PERL_SRC/hints (eg. next_3_2.sh). They are both -executed by the shell and parsed by MakeMaker to include the variables -in C<%Config>. If there is no hintsfile for the actual system, but for +counterparts in C<PERL_SRC/hints>, but with an C<.pl> file name +extension (eg. C<next_3_2.sh>). They are simply C<eval>ed by MakeMaker +and can be used to execute commands as well as to include special +variables. If there is no hintsfile for the actual system, but for some previous releases of the same operating system, the latest one of those is used. @@ -94,6 +95,35 @@ set automatically when INST_LIB is given as argument. The generated Makefile does not set any permissions. The installer has to decide, which umask should be in effect. +=head2 Support to Link a New Perl Binary + +An extension that is built with the above steps is ready to use on +systems supporting dynamic loading. On systems that do not support +dynamic loading, any newly created extension has to be linked together +with the available ressources. MakeMaker supports the linking process +by creating appropriate targets in the Makefile whenever an extension +is built. You can invoke the corresponding section of the makefile with + + make perl + +That produces a new perl binary in the current directory with all +extensions that are present on the system (either in the current build +environment or in the perl library) linked in. + +The binary can be installed into the directory where perl normally +resides on your machine with + + make inst_perl + +Note, that there is a C<makeaperl> scipt available, that supports the +linking of a new perl binary in a similar fashion, but with more +options for those, that want to build perl binaries of the +not-quite-everyday type. + +Warning: The perl: and inst_perl: targets are new in MakeMaker v4.06, +and should be watched with care. Watch out for what it does and what +you want! + =head2 Determination of Perl Library and Installation Locations MakeMaker needs to know, or to guess, where certain things are @@ -145,11 +175,11 @@ we default to PERL_SRC/lib, else we default to ./blib. INST_ARCHLIB = Same as above for architecture dependent files -INST_LIBDIR = $(INST_LIB)$(ROOTEXT) +INST_LIBDIR = C<$(INST_LIB)$(ROOTEXT)> -INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT) +INST_AUTODIR = C<$(INST_LIB)/auto/$(FULLEXT)> -INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT) +INST_ARCHAUTODIR = C<$(INST_ARCHLIB)/auto/$(FULLEXT)> =head2 Customizing The Generated Makefile @@ -163,9 +193,12 @@ or as NAME=VALUE pairs on the command line: This description is not yet documented; you can get at the description with the command - C<perl Makefile.PL help> (if you already have a basic Makefile.PL) + +C<perl Makefile.PL help> (if you already have a basic Makefile.PL) + or - C<perl -e 'use ExtUtils::MakeMaker qw(&help); &help;'> + +C<perl -e 'use ExtUtils::MakeMaker qw(&help); &help;'> =head2 Overriding MakeMaker Methods @@ -181,113 +214,9 @@ or you can edit the default by saying something like: sub MY::c_o { $_=MM->c_o; s/old text/new text/; $_ } -If you still need a different solution, try to develop another -subroutine, that fits your needs and submit the diffs to -perl5-porters@nicoh.com or comp.lang.perl as appropriate. - - -=head1 AUTHORS - -Andy Dougherty <doughera@lafcol.lafayette.edu>, Andreas Koenig -<k@franz.ww.TU-Berlin.DE>, Tim Bunce <Tim.Bunce@ig.co.uk> - -=head1 MODIFICATION HISTORY - -v1, August 1994; by Andreas Koenig. Based on Andy Dougherty's Makefile.SH. -v2, September 1994 by Tim Bunce. -v3.0 October 1994 by Tim Bunce. -v3.1 November 11th 1994 by Tim Bunce. -v3.2 November 18th 1994 by Tim Bunce. -v3.3 November 27th 1994 by Andreas Koenig. -v3.4 December 7th 1994 by Andreas Koenig and Tim Bunce. -v3.5 December 15th 1994 by Tim Bunce. -v3.6 December 15th 1994 by Tim Bunce. -v3.7 December 30th 1994 By Tim Bunce -v3.8 January 17th 1995 By Andreas Koenig and Tim Bunce - -v3.9 January 19th 1995 By Tim Bunce - -Added ~ processing to parse_args to allow perl Makefile.PL X=~/path. -Added warning about LDTARGET to LDFROM attribute name change. -Fallback INST_ARCHLIB is INST_LIB, or INST_LIB/$archname if it exists. -Tightened up dependency checking of Makefile against config.sh etc. -INST_STATIC is now INST_ARCHLIBDIR/BASEEXT.a for later make-a-perl. -AUTOSPLITFILE tidied up (AutoSplit patch included in this version). -MKPATH now skips inner loop if directory already exists. -The dynamic_lib section was revised with explicit dec_osf support added. -Make clean now renames Makefile to Makefile.old (make_ext also patched). -The large initialize function has been split into smaller pieces. -Added I_PERL_LIBS to simplify -I paths for PERL_*LIB. - -v3.10 January 23rd 1995 By Tim Bunce - -miniperl now given preference when defining PERL. This improves the -reliability of ext/*/Makefile's recreating themselves if needed. -$(XS), $(C) and $(H) renamed to XS_FILES C_FILES and H_FILES. -INST_STATIC now INST_ARCHLIBDIR/BASEEXT.a (alongside INST_DYNAMIC). -Static lib no longer copied back to local directory. - -v3.11 January 24th 1995 By Andreas Koenig - -DynaLoader.c was not deleted by clean target, now fixed. -Added PMDIR attribute that allows directories to be named that contain -only *.p[pl] files to be installed into INST_LIB. Added some documentation. - -v4.00 January 24th 1995 By Tim Bunce - -Revised some of the documentation. Changed version number to 4.00 to -avoid problems caused by my earlier poor choice of 3.10! Renamed PMDIR -to PMLIBDIRS and restructured find code to use inherited MY->libscan. -Added ability to say: "perl Makefile.PL help" to get help. -Added ability to say: "perl Makefile.PL verbose" to get debugging. -Added MakeMaker version number to generated Makefiles. - -v4.01 January 25th 1995 By Tim Bunce - -Changes in the section that deals with PMLIBDIRS: some pm files were -put into INST_LIB instead of INST_LIBDIR. - -v4.02 January 29th 1995 By Andreas Koenig - -Enabled the use of the XXX_cflags variable from Config.pm for nested -extensions: to change e.g. the $Config{"ccflags"} variable on the NeXT -for the nTk::pTk extension, say - nTk__pTk_cflags='ccflags="-posix $ccflags"' -in the hints-file. - -Hints may now be put in a hints/*.sh file within the the module's -directory tree. Any *.sh file in that directory acts as if it had been -parsed during the perl build process. - -Added O_FILES, which is an array like C_FILES. Done so to add a -dependency O_FILES from H_FILES. This has the effect, that the -extension gets rebuilt after some headerfiles have changed. - -Made life easier in some "I've just edited config.sh" situations and -reduce the risk of "MakeMaker is being pedantic" complaints by letting -the Makefile proceed with a warning if Config.pm is out of date (Tim's -suggestion). - -$Verbose now passed to the findperl routine, to get debugging output -from there, too. - -Make clean now also deletes the ./blib directory. - -Added lots of ideas of Charles Bailey that enable VMS support. - -v4.03 January 30th 1995 By Andreas Koenig - -check_hints() now also called within runsubdirpl(). More VMS code -included. Trivial cosmetics. - -=head1 NOTES - -MakeMaker development work still to be done: - -Needs more complete documentation. - -Add a html: target when there has been found a general solution to -installing html files. +If you still need a different solution, try to develop another +subroutine, that fits your needs and submit the diffs to +F<perl5-porters@nicoh.com> or F<comp.lang.perl> as appropriate. =cut @@ -303,7 +232,7 @@ sub check_hints { opendir DIR, "hints"; while (defined ($_ = readdir DIR)) { next if /^\./; - next unless s/\.sh$//; + next unless s/\.pl$//; next unless /^$Config{'osname'}/; # Don't trust a hintfile for a later OS version: next if $_ gt $hint; @@ -316,24 +245,10 @@ sub check_hints { closedir DIR; return unless @goodhints; # There was no hintsfile # the last one in lexical ordering is our choice: - $hint=(reverse sort @goodhints)[0]; + $hint=(reverse sort @goodhints)[0]; # execute the hintsfile: - system "/bin/sh hints/$hint.sh" unless $Is_VMS; - # Read the hintsfile and process it similarly as in configpm - open HINT, "hints/$hint.sh"; - my(@v_others); - while (<HINT>) { - next if /^\s*$/; # empty lines - next if /^\s*#/; # comments - s/^(\w+)=(true|\d+)\s*$/$1='$2'\n/; - next unless (m/^(\w+)='(.*)'\s*$/); - push @v_others, $_; - } - close HINT; - - # The lines we found take precedence over those in Config.pm: - $Config::config_sh = "@v_others" . $Config::config_sh; + eval `cat hints/$hint.pl`; } # Setup dummy package: @@ -435,7 +350,7 @@ $Attrib_Help = <<'END'; universal symbols. Used only under AIX (export lists) and VMS (linker options) at present. Defaults to []. (e.g. [ qw( Foo_version Foo_numstreams Foo_tree ) ]) - + CONFIG: =>[qw(archname manext)] defines ARCHNAME & MANEXT from config.sh SKIP: =>[qw(name1 name2)] skip (do not write) sections of the Makefile @@ -489,6 +404,7 @@ sub help {print $Attrib_Help;} 'perldepend' => {}, 'makefile' => {}, 'postamble' => {}, + 'staticmake' => {}, ); %MM_Sections = @MM_Sections_spec; # looses section ordering @MM_Sections = grep(!ref, @MM_Sections_spec); # keeps order @@ -507,20 +423,20 @@ foreach(split(/\n/,$Attrib_Help)){ sub skipcheck{ my($section) = @_; if ($section eq 'dynamic') { - warn "Warning (non-fatal): Target 'dynamic' depends on targets " + print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets " . "in skipped section 'dynamic_bs'\n" if $skip{'dynamic_bs'} && $Verbose; - warn "Warning (non-fatal): Target 'dynamic' depends on targets " + print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets " . "in skipped section 'dynamic_lib'\n" if $skip{'dynamic_lib'} && $Verbose; } if ($section eq 'dynamic_lib') { - warn "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on " + print STDOUT "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on " . "targets in skipped section 'dynamic_bs'\n" if $skip{'dynamic_bs'} && $Verbose; } if ($section eq 'static') { - warn "Warning (non-fatal): Target 'static' depends on targets " + print STDOUT "Warning (non-fatal): Target 'static' depends on targets " . "in skipped section 'static_lib'\n" if $skip{'static_lib'} && $Verbose; } @@ -627,9 +543,9 @@ sub parse_args{ if (defined $$attr{'potential_libs'}){ my($msg)="'potential_libs' => '$$attr{potential_libs}' should be"; if ($$attr{'potential_libs'}){ - print STDERR "$msg changed to:\n\t'LIBS' => ['$$attr{potential_libs}']\n"; + print STDOUT "$msg changed to:\n\t'LIBS' => ['$$attr{potential_libs}']\n"; } else { - print STDERR "$msg deleted.\n"; + print STDOUT "$msg deleted.\n"; } $$attr{LIBS} = [$$attr{'potential_libs'}]; delete $$attr{'potential_libs'}; @@ -637,20 +553,20 @@ sub parse_args{ # catch old-style 'ARMAYBE' and inform user how to 'upgrade' if (defined $$attr{'ARMAYBE'}){ my($armaybe) = $$attr{'ARMAYBE'}; - print STDERR "ARMAYBE => '$armaybe' should be changed to:\n", + print STDOUT "ARMAYBE => '$armaybe' should be changed to:\n", "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n"; my(%dl) = %{$$attr{'dynamic_lib'} || {}}; $$attr{'dynamic_lib'} = { %dl, ARMAYBE => $armaybe}; delete $$attr{'ARMAYBE'}; } if (defined $$attr{'LDTARGET'}){ - print STDERR "LDTARGET should be changed to LDFROM\n"; + print STDOUT "LDTARGET should be changed to LDFROM\n"; $$attr{'LDFROM'} = $$attr{'LDTARGET'}; delete $$attr{'LDTARGET'}; } foreach(sort keys %{$attr}){ print STDOUT " $_ => ".neatvalue($$attr{$_}) if ($Verbose); - warn "'$_' is not a known MakeMaker parameter name.\n" + print STDOUT "'$_' is not a known MakeMaker parameter name.\n" unless exists $Recognized_Att_Keys{$_}; } } @@ -658,6 +574,7 @@ sub parse_args{ sub neatvalue{ my($v) = @_; + return "undef" unless defined $v; my($t) = ref $v; return "'$v'" unless $t; return "[ ".join(', ',map("'$_'",@$v))." ]" if ($t eq 'ARRAY'); @@ -717,13 +634,13 @@ sub init_main { } } unless ($att{PERL_SRC}){ - warn "Unable to locate perl source.\n"; # we should also consider $ENV{PERL5LIB} here $att{PERL_LIB} = $Config{'privlib'} unless $att{PERL_LIB}; $att{PERL_ARCHLIB} = $Config{'archlib'} unless $att{PERL_ARCHLIB}; $att{PERL_INC} = "$att{PERL_ARCHLIB}/CORE"; # wild guess for now - die "Try setting PERL_SRC in Makefile.PL or on command line.\n" + die "Unable to locate Perl source. Try setting PERL_SRC in Makefile.PL or on command line.\n" unless (-f "$att{PERL_INC}/perl.h"); + print STDOUT "Using header files found in $att{PERL_INC}" if $Verbose; } else { $att{PERL_LIB} = "$att{PERL_SRC}/lib" unless $att{PERL_LIB}; $att{PERL_ARCHLIB} = $att{PERL_LIB}; @@ -755,10 +672,10 @@ sub init_main { my($archname) = $Config{'archname'}; if (-d "$att{INST_LIB}/$archname"){ $att{INST_ARCHLIB} = "$att{INST_LIB}/$archname"; - warn "Defaulting INST_ARCHLIB to INST_LIB/$archname\n"; + print STDOUT "Defaulting INST_ARCHLIB to INST_LIB/$archname\n"; } else { $att{INST_ARCHLIB} = $att{INST_LIB}; - warn "Warning: Defaulting INST_ARCHLIB to INST_LIB ", + print STDOUT "Warning: Defaulting INST_ARCHLIB to INST_LIB ", "(not architecture independent).\n"; } } @@ -789,7 +706,7 @@ sub init_main { ($att{ROOTEXT} =$att{FULLEXT}) =~ s#/?\Q$att{BASEEXT}\E$## ; # eg. /BSD/Foo $att{ROOTEXT} = ($Is_VMS ? '' : '/') . $att{ROOTEXT} if $att{ROOTEXT}; - ($att{DISTNAME}=$att{NAME}) =~ s#(::)#-#g; + ($att{DISTNAME}=$att{NAME}) =~ s#(::)#-#g unless $att{DISTNAME}; $att{VERSION} = "0.1" unless $att{VERSION}; @@ -799,7 +716,7 @@ sub init_main { # will be working versions of perl 5. miniperl has priority over perl # for PERL to ensure that $(PERL) is usable while building ./ext/* $att{'PERL'} = MY->find_perl(5.0, [ qw(miniperl perl) ], - [ $att{PERL_SRC}, split(":", $ENV{PATH}), $Config{'bin'} ], $Verbose ) + [ grep defined $_, $att{PERL_SRC}, split(":", $ENV{PATH}), $Config{'bin'} ], $Verbose ) unless ($att{'PERL'} && -x $att{'PERL'}); # Define 'FULLPERL' to be a non-miniperl (used in test: target) @@ -872,7 +789,10 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm etc) if ($Verbose >= 2); use File::Find; # try changing to require ! File::Find::find(sub { - return unless m/\.p[ml]$/; +# We now allow any file in PMLIBDIRS to be installed. nTk needs that, and +# we should allow it. +# return unless m/\.p[ml]$/; + return if -d $_; # anything else that Can't be copied? my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)'); $prefix = '$(INST_LIB)' if ($path =~ s:^lib/::); local($_) = "$prefix/$path"; @@ -920,7 +840,7 @@ sub init_others { # --- Initialize Other Attributes } } - warn "CONFIG must be an array ref\n" + print STDOUT "CONFIG must be an array ref\n" if ($att{CONFIG} and ref $att{CONFIG} ne 'ARRAY'); $att{CONFIG} = [] unless (ref $att{CONFIG}); push(@{$att{CONFIG}}, @@ -976,17 +896,21 @@ sub lsdir{ sub find_perl{ my($self, $ver, $names, $dirs, $trace) = @_; my($name, $dir); - print "Looking for perl $ver by these names: @$names, in these dirs: @$dirs\n" - if ($trace); + if ($trace){ + print "Looking for perl $ver by these names: "; + print "@$names, "; + print "in these dirs:"; + print "@$dirs"; + } foreach $dir (@$dirs){ next unless defined $dir; # $att{PERL_SRC} may be undefined foreach $name (@$names){ - print "checking $dir/$name\n" if ($trace >= 2); + print "checking $dir/$name" if ($trace >= 2); if ($Is_VMS) { $name .= ".exe" unless -x "$dir/$name"; } next unless -x "$dir/$name"; - print "executing $dir/$name\n" if ($trace); + print "Executing $dir/$name" if ($trace); my($out); if ($Is_VMS) { my($vmscmd) = 'MCR ' . vmsify("$dir/$name"); @@ -997,7 +921,7 @@ sub find_perl{ return "$dir/$name" if $out =~ /VER_OK/; } } - warn "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; + print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; 0; # false and not empty } @@ -1005,7 +929,7 @@ sub find_perl{ sub post_initialize{ ""; } - + sub constants { my(@m); @@ -1038,10 +962,10 @@ PERL_ARCHLIB = $att{PERL_ARCHLIB} } push @m, " -# Where is the perl source code located? (Eventually we should -# be able to build extensions without requiring the perl source -# but that's a way off yet). -PERL_SRC = $att{PERL_SRC} +# Where is the perl source code located? +PERL_SRC = $att{PERL_SRC}\n" if $att{PERL_SRC}; + + push @m, " # Perl header files (will eventually be under PERL_LIB) PERL_INC = $att{PERL_INC} # Perl binaries @@ -1117,7 +1041,7 @@ sub const_cccmd{ ( $name = $att{NAME} . "_cflags" ) =~ s/:/_/g ; if ($prog = $Config{$name}) { # Expand hints for this extension via the shell - print STDERR "Processing $name hint:\n" if $Verbose; + print STDOUT "Processing $name hint:\n" if $Verbose; my(@o)=`cc=\"$cc\" ccflags=\"$ccflags\" optimize=\"$optimize\" @@ -1135,9 +1059,9 @@ sub const_cccmd{ chomp $line; if ($line =~ /(.*?)=\s*(.*)\s*$/){ $cflags{$1} = $2; - print STDERR " $1 = $2" if $Verbose; + print STDOUT " $1 = $2" if $Verbose; } else { - print STDERR "Unrecognised result from hint: '$line'\n"; + print STDOUT "Unrecognised result from hint: '$line'\n"; } } ($cc,$ccflags,$optimize,$large,$split)=@cflags{qw(cc ccflags optimize large split)}; @@ -1145,7 +1069,7 @@ sub const_cccmd{ my($new) = "$cc -c $ccflags $optimize $large $split"; if (defined($old) and $new ne $old) { - warn "Warning (non-fatal): cflags evaluation in MakeMaker differs from shell output\n" + print STDOUT "Warning (non-fatal): cflags evaluation in MakeMaker differs from shell output\n" ." package: $att{NAME}\n" ." old: $old\n" ." new: $new\n" @@ -1165,7 +1089,7 @@ sub const_config{ my(%once_only); foreach $m (@{$att{'CONFIG'}}){ next if $once_only{$m}; - warn "CONFIG key '$m' does not exist in Config.pm\n" + print STDOUT "CONFIG key '$m' does not exist in Config.pm\n" unless exists $Config{$m}; push @m, "\U$m\E = $Config{$m}\n"; $once_only{$m} = 1; @@ -1220,9 +1144,7 @@ sub tool_autosplit{ $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; q{ # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto -# Remark: the "" around the -I switches are helpful for the VMS support -AUTOSPLITFILE = $(PERL) $(I_PERL_LIBS) -e 'use AutoSplit;}.$asl.q{ \ - AutoSplit::autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;' +AUTOSPLITFILE = $(PERL) $(I_PERL_LIBS) -e 'use AutoSplit;}.$asl.q{autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;' }; } @@ -1267,18 +1189,17 @@ sub post_constants{ # --- Translation Sections --- sub c_o { - ' -$(O_FILES): $(H_FILES) - + push @m, ' .c.o: $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $(INC) $*.c '; + join "", @m; } sub xs_c { ' .xs.c: - $(PERL) $(XSUBPP) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $@ + $(PERL) $(XSUBPP) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@ '; } @@ -1294,13 +1215,18 @@ sub xs_o { # many makes are too dumb to use xs_c then c_o # --- Target Sections --- sub top_targets{ - ' + push @m, ' all :: config linkext $(INST_PM) '.$att{NOOP}.' config :: '.$att{MAKEFILE}.' - @$(MKPATH) $(INST_LIBDIR) $(INST_ARCHAUTODIR) + @ $(MKPATH) $(INST_LIBDIR) $(INST_ARCHAUTODIR) '; + + push @m, ' +$(O_FILES): $(H_FILES) +' if @{$att{O_FILES} || []} && @{$att{H} || []}; + join('',@m); } sub linkext { @@ -1335,8 +1261,10 @@ static :: $att{BASEEXT}.exp push(@m," $att{BASEEXT}.exp: Makefile.PL ",' $(PERL) $(I_PERL_LIBS) -e \'use ExtUtils::MakeMaker; \\ - mksymlists(DL_FUNCS => ',neatvalue($att{DL_FUNCS}),', DL_VARS => ',neatvalue($att{DL_VARS}),')\' -'); + mksymlists(DL_FUNCS => ', + %$funcs ? neatvalue($funcs) : "''",', DL_VARS => ', + @$vars ? neatvalue($vars) : "''",")' +"); join('',@m); } @@ -1364,11 +1292,11 @@ $(BOOTSTRAP): '."$att{MAKEFILE} $att{BOOTDEP}".' $(PERL) $(I_PERL_LIBS) \ -e \'use ExtUtils::MakeMaker; &mkbootstrap("$(BSLOADLIBS)");\' \ INST_LIB=$(INST_LIB) INST_ARCHLIB=$(INST_ARCHLIB) PERL_SRC=$(PERL_SRC) NAME=$(NAME) - @$(TOUCH) $(BOOTSTRAP) + @ $(TOUCH) $(BOOTSTRAP) $(INST_BOOT): $(BOOTSTRAP) - @'.$att{RM_RF}.' $(INST_BOOT) - '.$att{CP}.' $(BOOTSTRAP) $(INST_BOOT) + @ '.$att{RM_RF}.' $(INST_BOOT) + - '.$att{CP}.' $(BOOTSTRAP) $(INST_BOOT) '; } @@ -1388,7 +1316,7 @@ ARMAYBE = '.$armaybe.' OTHERLDFLAGS = '.$otherldflags.' $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) - @$(MKPATH) $(INST_ARCHAUTODIR) + @ $(MKPATH) $(INST_ARCHAUTODIR) '); if ($armaybe ne ':'){ $ldfrom = "tmp.a"; @@ -1408,7 +1336,7 @@ sub static { ' # $(INST_PM) has been moved to the all: target. # It remains here for awhile to allow for old usage: "make static" -static :: '.$att{MAKEFILE}.' $(INST_STATIC) $(INST_PM) +static :: '.$att{MAKEFILE}.' $(INST_STATIC) $(INST_PM) '.$att{NOOP}.' '; } @@ -1417,18 +1345,22 @@ sub static_lib{ my(@m); push(@m, <<'END'); $(INST_STATIC): $(OBJECT) $(MYEXTLIB) + @ $(MKPATH) $(INST_ARCHAUTODIR) END # If this extension has it's own library (eg SDBM_File) # then copy that to $(INST_STATIC) and add $(OBJECT) into it. push(@m, " $att{CP} \$(MYEXTLIB) \$\@\n") if $att{MYEXTLIB}; push(@m, <<'END'); + @ $(MKPATH) $(INST_ARCHAUTODIR) ar cr $@ $(OBJECT) && $(RANLIB) $@ @echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld END + +# Old mechanism - still available: + push(@m, <<'END') if $att{PERL_SRC}; - @: Old mechanism - still needed: - @echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs + @ echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs END join('', "\n",@m); } @@ -1459,10 +1391,10 @@ sub installpm_x { # called by installpm per file my($instdir) = $inst =~ m|(.*)/|; my(@m); push(@m," -$inst: $dist -".' @'.$att{RM_F}.' $@ - @$(MKPATH) '.$instdir.' - '.$att{CP}.' $? $@ +$inst: $dist Makefile +".' @ '.$att{RM_F}.' $@ + @ $(MKPATH) '.$instdir.' + '."$att{CP} $dist".' $@ '); push(@m, "\t\$(AUTOSPLITFILE) \$@ $splitlib/auto\n") if ($splitlib and $inst =~ m/\.pm$/); @@ -1569,7 +1501,8 @@ realclean purge :: clean push(@m, " $att{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n"); push(@m, " $att{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n"); push(@m, " $att{RM_F} \$(INST_STATIC) \$(INST_PM)\n"); - my(@otherfiles) = ($att{MAKEFILE}, "$att{MAKEFILE}.old"); # Makefiles last + my(@otherfiles) = ($att{MAKEFILE}, + "Perl.make", "$att{MAKEFILE}.old"); # Makefiles last push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; push(@m, " $att{RM_RF} @otherfiles\n") if @otherfiles; push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP}; @@ -1585,7 +1518,7 @@ sub distclean { my($compress) = $attribs{COMPRESS} || 'compress'; # eg gzip my($preop) = $attribs{PREOP} || '@:'; # e.g., update MANIFEST my($postop) = $attribs{POSTOP} || '@:'; - my($mkfiles) = join(' ', map("$_/$att{MAKEFILE}", ".", @{$att{DIR}})); + my($mkfiles) = join(' ', map("$_/$att{MAKEFILE} $_/$att{MAKEFILE}.old", ".", @{$att{DIR}})); " distclean: clean $preop @@ -1610,7 +1543,7 @@ test :: all \$(FULLPERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) -e 'use Test::Harness; runtests \@ARGV;' $tests END push(@m, <<'END') if -f "test.pl"; - $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) $(I_PERL_LIBS) test.pl + $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) test.pl END push(@m, map("\tcd $_ && test -f $att{MAKEFILE} && \$(MAKE) test LINKTYPE=\$(LINKTYPE)\n",@{$att{DIR}})); push(@m, "\t\@echo 'No tests defined for \$(NAME) extension.'\n") unless @m > 1; @@ -1628,8 +1561,8 @@ install :: all push(@m, map("\tcd $_ && test -f $att{MAKEFILE} && \$(MAKE) install\n",@{$att{DIR}})); push(@m, "\t: perl5.000 and MM pre 3.8 autosplit into INST_ARCHLIB, we delete these old files here - $att{RM_F} \$(INST_ARCHLIB)/auto/\$(FULLEXT)/*.al \$(INST_ARCHLIB)/auto/\$(FULLEXT)/*.ix - \$(MAKE) INST_LIB=\$(INST_PRIVLIB) INST_ARCHLIB=\$(INST_ARCHLIB) + $att{RM_F} $Config{'installarchlib'}/auto/\$(FULLEXT)/*.al $Config{'installarchlib'}/auto/\$(FULLEXT)/*.ix + \$(MAKE) INST_LIB=$Config{'installprivlib'} INST_ARCHLIB=$Config{'installarchlib'} "); join("",@m); @@ -1686,7 +1619,7 @@ $(OBJECT) : '.$att{MAKEFILE}.' # We take a very conservative approach here, but it\'s worth it. # We move Makefile to Makefile.old here to avoid gnu make looping. -'.$att{MAKEFILE}.': Makefile.PL $(CONFIGDEP) +'.$att{MAKEFILE}.': Makefile.PL $(CONFIGDEP) @echo "Makefile out-of-date with respect to $?" @echo "Cleaning current config before rebuilding Makefile..." -@mv '."$att{MAKEFILE} $att{MAKEFILE}.old".' @@ -1701,20 +1634,176 @@ sub postamble{ ""; } +# --- Make-A-Perl section --- + +sub staticmake { + my($self, %attribs) = @_; + + my(%searchdirs)=($att{PERL_ARCHLIB} => 1, $att{INST_ARCHLIB} => 1); + my(@searchdirs)=keys %searchdirs; + # And as it's not yet built, we add the current extension + my(@static)="$att{INST_ARCHLIB}/auto/$att{FULLEXT}/$att{BASEEXT}.a"; + my(@extra); + push(@extra, split(' ', $att{EXTRALIBS})) if defined $att{EXTRALIBS}; + my(@perlinc) = ($att{INST_ARCHLIB}, $att{INST_LIB}, $att{PERL_ARCHLIB}, $att{PERL_LIB}); + MY->makeaperl('MAKE' => $att{MAKEFILE}, + 'DIRS' => \@searchdirs, + 'STAT' => \@static, + 'EXTRA' => \@extra, + 'INCL' => \@perlinc, + 'TARGET' => "perl", + 'TMP' => "", + 'LIBPERL' => "$att{PERL_INC}/libperl.a" + ); +} + +sub makeaperl { + my($self, %attribs) = @_; + my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) = + @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)}; + my(@m); + my($cccmd, $linkcmd, %map); + + # This emulates cflags to get the compiler invocation... + $cccmd = MY->const_cccmd(); + $cccmd =~ s/^CCCMD\s*=\s*//; + chomp $cccmd; + $cccmd =~ s/\s/ -I$att{PERL_INC} /; + $cccmd .= " $Config{'cccdlflags'}" if ($Config{'d_shrplib'}); + + # The front matter of the linkcommand... + $linkcmd = join ' ', $Config{'cc'}, + grep($_, @Config{qw(large split ldflags ccdlflags)}); + $linkcmd =~ s/\s+/ /g; + + # Which *.a files could we make use of... + local(%static,%libperl); + File::Find::find(sub { + return unless m/\.a$/; + if (m/^libperl/) { + $libperl{$File::Find::name}++; + return; + } + $static{$File::Find::name}++; + }, grep( -d $_, @{$searchdirs || []}) ); + + $extra = [] unless $extra && ref $extra eq 'ARRAY'; + for (sort keys %static) { + next unless /\.a$/; + s#^#./# unless m#/#; # Prepend "./" if it is in the current dir + s#(.*/).*#$1extralibs.ld#; + if (-f $_){ + push @$extra, split(' ',`cat $_`); + } else { + print STDOUT "$0: warning $_ not found"; + } + } + + # These have been handed in explicitly, so we do not read extralibs.ld for them, + # they might not even exist, and extralibs.ld might be outdated. + @static{@{$static || []}} = (1) x @{$static || []}; + grep(s/^/-I/, @$perlinc); + + $target = "perl" unless $target; + $tmp = "." unless $tmp; + + push @m, " +# Fill in the target you want to produce if it's not perl +MAP_TARGET = $target +FULLPERL = $att{'FULLPERL'} +MAP_LINKCMD = $linkcmd +MAP_PERLINC = @{$perlinc} +MAP_STATIC = ", +join(" ", sort keys %static), " +MAP_EXTRA = @{$extra} +MAP_PRELIBS = $Config{'libs'} $Config{'cryptlib'} +"; + + my(@libperl); + if ($libperl) { + @libperl = $libperl; + } else { + @libperl = sort keys %libperl; + if (@libperl==0 && defined $att{PERL_SRC}) { + push @libperl, "$att{PERL_SRC}/libperl.a"; + } + if (@libperl==0 && -f "$INC[0]/CORE/libperl.a") { + push @libperl, "$INC[0]/CORE/libperl.a"; + } + if (@libperl==0){ + push @m, "\nMAP_LIBPERL = ---NOT FOUND---\n\n"; + } + } + + # if we have to work with other libraries than libperl.a... + %map = ( + D => '-DDEBUGGING', + E => '-DEMBED', + DE => '-DDEBUGGING -DEMBED', + M => '-DEMBED -DMULTIPLICITY', + DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY', + ); + for (@libperl) { + my($uc, $thiscccmd); + ( $uc = $_ ) =~ s!.*/libperl(\w*)\.a!uc($1)!e; + + # We have to tamper with the cccmd... + $thiscccmd = $cccmd; + # All perls of flavor D need a compilation with -g instead of + # whatever optimize was before + if ($uc =~ /^D/) { + $thiscccmd =~ s/\B$Config{'optimize'}\b/-g/; + } + $thiscccmd .= $map{$uc} if $uc; + $thiscccmd =~ s/\s+/ /g; + + # If we have to write the Makefile for only one + # target, we do not need the variable $uc + $uc = "" if @libperl == 1; + + push @m, "MAP_LIBPERL$uc = $_ +$target$uc: $tmp/perlmain$uc.o \$(MAP_LIBPERL$uc) \$(MAP_STATIC) + \$(MAP_LINKCMD) -o \$\@ $tmp/perlmain$uc.o \$(MAP_LIBPERL$uc) \$(MAP_STATIC) \$(MAP_EXTRA) \$(MAP_PRELIBS) + +$tmp/perlmain$uc.o: $tmp/perlmain$uc.c +"; + push @m, "\tcd $tmp && $thiscccmd perlmain$uc.c\n"; + + if ($uc) { + push @m, "$tmp/perlmain$uc.c: $tmp/perlmain.c + cp \$< \$\@\n\n"; + } + } + + push @m, qq{ +$tmp/perlmain.c: $makefilename}, q{ + $(FULLPERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\ + writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@ + +}; + + push @m, qq{ +inst_perl: \$(MAP_TARGET) + $att{CP} \$(MAP_TARGET) $Config{'installbin'}/\$(MAP_TARGET) + +}; + + join '', @m; +} # --- Determine libraries to use and how to use them --- sub extliblist{ my($self, $libs) = @_; return ("", "", "") unless $libs; - print STDERR "Potential libraries are '$libs':" if $Verbose; + print STDOUT "Potential libraries are '$libs':" if $Verbose; my(@new) = MY->new_extliblist($libs); if ($att{PERL_SRC}){ my(@old) = MY->old_extliblist($libs); my($oldlibs) = join(" : ",@old); my($newlibs) = join(" : ",@new); - warn "Warning (non-fatal): $att{NAME} extliblist consistency check failed:\n". + print STDOUT "Warning (non-fatal): $att{NAME} extliblist consistency check failed:\n". " old: $oldlibs\n". " new: $newlibs\n". "Using 'new' set. Please notify perl5-porters\@nicoh.com.\n" @@ -1743,12 +1832,12 @@ sub old_extliblist { chomp $line; if ($line =~ /(.*)\s*=\s*(.*)\s*$/){ $attrib{$1} = $2; - print STDERR " $1 = $2" if $Verbose; + print STDOUT " $1 = $2" if $Verbose; }else{ push(@w, $line); } } - print STDERR "Messages from extliblist:\n", join("\n",@w,'') + print STDOUT "Messages from extliblist:\n", join("\n",@w,'') if @w ; @attrib{qw(EXTRALIBS BSLOADLIBS LDLOADLIBS)}; } @@ -1780,12 +1869,12 @@ sub new_extliblist { if ($thislib =~ s/^(-[LR])//){ # save path flag type my($ptype) = $1; unless (-d $thislib){ - warn "$ptype$thislib ignored, directory does not exist\n" + print STDOUT "$ptype$thislib ignored, directory does not exist\n" if $Verbose; next; } if ($thislib !~ m|^/|) { - warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n"; + print STDOUT "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n"; $thislib = "$pwd/$thislib"; } push(@searchpath, $thislib); @@ -1796,7 +1885,7 @@ sub new_extliblist { # Handle possible library arguments. unless ($thislib =~ s/^-l//){ - warn "Unrecognized argument in LIBS ignored: '$thislib'\n"; + print STDOUT "Unrecognized argument in LIBS ignored: '$thislib'\n"; next; } @@ -1810,11 +1899,11 @@ sub new_extliblist { && ($thislib .= "_s") ){ # we must explicitly ask for _s version } elsif (-f ($fullname="$thispth/lib$thislib.a")){ } elsif (-f ($fullname="$thispth/Slib$thislib.a")){ - } else { - warn "$thislib not found in $thispth\n" if $Verbose; + } else { + print STDOUT "$thislib not found in $thispth\n" if $Verbose; next; } - warn "'-l$thislib' found at $fullname\n" if $Verbose; + print STDOUT "'-l$thislib' found at $fullname" if $Verbose; $found_lib++; # Now update library lists @@ -1829,7 +1918,7 @@ sub new_extliblist { unless ( $in_perl || ($Config{'osname'} eq 'next' && $thislib eq 'm') ){ push(@extralibs, "-l$thislib"); } - + # We might be able to load this archive file dynamically if ( $Config{'dlsrc'} =~ /dl_next|dl_dld/){ @@ -1852,7 +1941,7 @@ sub new_extliblist { } last; # found one here so don't bother looking further } - warn "Warning (non-fatal): No library found for -l$thislib\n" unless $found_lib>0; + print STDOUT "Warning (non-fatal): No library found for -l$thislib\n" unless $found_lib>0; } ("@extralibs", "@bsloadlibs", "@ldloadlibs"); } @@ -1862,40 +1951,32 @@ sub new_extliblist { sub mkbootstrap { -=head1 NAME - -mkbootstrap +=head1 USEFUL SUBROUTINES -=head1 DESCRIPTION +=head2 mkbootstrap() -Make a bootstrap file for use by this system's DynaLoader. -It typically gets called from an extension Makefile. +Make a bootstrap file for use by this system's DynaLoader. It +typically gets called from an extension Makefile. -There is no .bs file supplied with the extension. Instead a _BS file -which has code for the special cases, like posix for berkeley db on the -NeXT. +There is no C<*.bs> file supplied with the extension. Instead a +C<*_BS> file which has code for the special cases, like posix for +berkeley db on the NeXT. This file will get parsed, and produce a maybe empty -@DynaLoader::dl_resolve_using array for the current architecture. +C<@DynaLoader::dl_resolve_using> array for the current architecture. That will be extended by $BSLOADLIBS, which was computed by Andy's extliblist script. If this array still is empty, we do nothing, else -we write a .bs file with an @DynaLoader::dl_resolve_using array, but +we write a .bs file with an C<@DynaLoader::dl_resolve_using> array, but without any C<if>s, because there is no longer a need to deal with special cases. -The _BS file can put some code into the generated .bs file by placing -it in $bscode. This is a handy 'escape' mechanism that may prove +The C<*_BS> file can put some code into the generated C<*.bs> file by placing +it in C<$bscode>. This is a handy 'escape' mechanism that may prove useful in complex situations. If @DynaLoader::dl_resolve_using contains C<-L*> or C<-l*> entries then mkbootstrap will automatically add a dl_findfile() call to the -generated .bs file. - -=head1 AUTHORS - -Andreas Koenig <k@otto.ww.TU-Berlin.DE>, Tim Bunce -<Tim.Bunce@ig.co.uk>, Andy Dougherty <doughera@lafcol.lafayette.edu>. -VMS support by Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>. +generated C<*.bs> file. =cut @@ -1903,7 +1984,7 @@ VMS support by Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>. @bsloadlibs = grep($_, @bsloadlibs); # strip empty libs - print STDERR " bsloadlibs=@bsloadlibs\n" if $Verbose; + print STDOUT " bsloadlibs=@bsloadlibs\n" if $Verbose; # We need DynaLoader here because we and/or the *_BS file may # call dl_findfile(). We don't say `use' here because when @@ -1956,16 +2037,6 @@ VMS support by Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>. print BS "\n1;\n"; close BS; } - - # special handling for systems which needs a list of all global - # symbols exported by a modules to be dynamically linked. - if ($Config{'dlsrc'} =~ /^dl_aix/){ - my($bootfunc); - ($bootfunc = $att{NAME}) =~ s/\W/_/g; - open EXP, ">$att{BASEEXT}.exp"; - print EXP "#!\nboot_$bootfunc\n"; - close EXP; - } } sub mksymlists { @@ -1976,7 +2047,7 @@ sub mksymlists { return '' unless $Config{'osname'} eq 'AIX'; init_main(@ARGV) unless defined $att{'BASEEXT'}; - if (!$att{DL_FUNCS}) { + if (! %{$att{DL_FUNCS}}) { (my($bootfunc) = $att{NAME}) =~ s/\W/_/g; $att{DL_FUNCS} = {$att{BASEEXT} => ["boot_$bootfunc"]}; } @@ -2000,7 +2071,140 @@ sub nicetext { # Just return the input - no action needed my($self,$text) = @_; $text; } - + +=head1 AUTHORS + +Andy Dougherty F<E<lt>doughera@lafcol.lafayette.eduE<gt>>, Andreas +Koenig F<E<lt>k@franz.ww.TU-Berlin.DEE<gt>>, Tim Bunce +F<E<lt>Tim.Bunce@ig.co.ukE<gt>>. VMS support by Charles Bailey +F<E<lt>bailey@HMIVAX.HUMGEN.UPENN.EDUE<gt>>. + +=head1 MODIFICATION HISTORY + +v1, August 1994; by Andreas Koenig. Based on Andy Dougherty's Makefile.SH. +v2, September 1994 by Tim Bunce. +v3.0 October 1994 by Tim Bunce. +v3.1 November 11th 1994 by Tim Bunce. +v3.2 November 18th 1994 by Tim Bunce. +v3.3 November 27th 1994 by Andreas Koenig. +v3.4 December 7th 1994 by Andreas Koenig and Tim Bunce. +v3.5 December 15th 1994 by Tim Bunce. +v3.6 December 15th 1994 by Tim Bunce. +v3.7 December 30th 1994 By Tim Bunce +v3.8 January 17th 1995 By Andreas Koenig and Tim Bunce +v3.9 January 19th 1995 By Tim Bunce + +v3.10 January 23rd 1995 By Tim Bunce + +miniperl now given preference when defining PERL. This improves the +reliability of ext/*/Makefile's recreating themselves if needed. +$(XS), $(C) and $(H) renamed to XS_FILES C_FILES and H_FILES. +INST_STATIC now INST_ARCHLIBDIR/BASEEXT.a (alongside INST_DYNAMIC). +Static lib no longer copied back to local directory. + +v3.11 January 24th 1995 By Andreas Koenig + +DynaLoader.c was not deleted by clean target, now fixed. +Added PMDIR attribute that allows directories to be named that contain +only *.p[pl] files to be installed into INST_LIB. Added some documentation. + +v4.00 January 24th 1995 By Tim Bunce + +Revised some of the documentation. Changed version number to 4.00 to +avoid problems caused by my earlier poor choice of 3.10! Renamed PMDIR +to PMLIBDIRS and restructured find code to use inherited MY->libscan. +Added ability to say: "perl Makefile.PL help" to get help. +Added ability to say: "perl Makefile.PL verbose" to get debugging. +Added MakeMaker version number to generated Makefiles. + +v4.01 January 25th 1995 By Tim Bunce + +Changes in the section that deals with PMLIBDIRS: some pm files were +put into INST_LIB instead of INST_LIBDIR. + +v4.02 January 29th 1995 By Andreas Koenig + +Enabled the use of the XXX_cflags variable from Config.pm for nested +extensions: to change e.g. the $Config{"ccflags"} variable on the NeXT +for the nTk::pTk extension, say + nTk__pTk_cflags='ccflags="-posix $ccflags"' +in the hints-file. + +Hints may now be put in a hints/*.sh file within the the module's +directory tree. Any *.sh file in that directory acts as if it had been +parsed during the perl build process. + +Added O_FILES, which is an array like C_FILES. Done so to add a +dependency O_FILES from H_FILES. This has the effect, that the +extension gets rebuilt after some headerfiles have changed. + +Made life easier in some "I've just edited config.sh" situations and +reduce the risk of "MakeMaker is being pedantic" complaints by letting +the Makefile proceed with a warning if Config.pm is out of date (Tim's +suggestion). + +$Verbose now passed to the findperl routine, to get debugging output +from there, too. + +Make clean now also deletes the ./blib directory. + +Added lots of ideas of Charles Bailey that enable VMS support. + +v4.03 January 30th 1995 By Andreas Koenig + +check_hints() now also called within runsubdirpl(). More VMS code +included. Trivial cosmetics. + +v4.04 Februeary 5th 1995 By Andreas Koenig + +Another VMS patch by Charles Bailey added. Documentation restructured. +ext/util/make_ext minor change. + +All *.pm and *.pl files are now touched when MakeMaker finds +them. This inhibits that make omits their installation in +circumstances, where an older version has recently been built. + +installperl: perl.exp now goes into $installarchlib/CORE + +New files: lib/File/Path.pm, minimod.PL, perllink, and +vms/ext/MM_VMS.pm while writemain.SH is gone. minimod.PL writes a +trivial module, ExtUtils::Miniperl, which has the writemain function +in it to write perlmain.c files. perllink was not in the 4.01 patch +(which was 0i in fact), but it was introduced in 3.10. It is much +smaller now than it was -- most of its code has gone into minimod.PL +and MakeMaker. + +MakeMaker now writes a second Makefile that can be perused to make a +new perl binary from some extensions and some libperl libraries. This +Makefile has most likely to be adjusted to needs by hand, but it's a +quite reasonable starting point. The routines related to the writing +of the Makefile are also exploited by a new makeaperl script, that is +not in the patch, but distributed seperately. + +v4.05 February 8th 1995 By Andreas Koenig + +When searching for static extensions makeaperl() now ignores +inexistent directories. Updated documentation (check_hints() now uses +eval instead of running a shell script) + +v4.06 February 10th 1995 By Andreas Koenig + +Cleaning up the new interface. Suggestion to freeze now until 5.001. + +=head1 NOTES + +MakeMaker development work still to be done: + +Needs more complete documentation. + +Add a html: target when there has been found a general solution to +installing html files. + +Create a perllocal.pod somewhere that documents what has been done +on this system. (Thanks to Jarkko Hietaniemi for the idea) + +=cut + # the following keeps AutoSplit happy package ExtUtils::MakeMaker; 1; diff --git a/lib/File/Path.pm b/lib/File/Path.pm new file mode 100644 index 0000000000..bafe10828b --- /dev/null +++ b/lib/File/Path.pm @@ -0,0 +1,146 @@ +package File::Mkpath; + +=head1 NAME + +File::Mkpath - create or remove a series of directories + +=head1 SYNOPSIS + +C<use File::Mkpath> + +C<mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711);> + +C<rmtree(['foo/bar/baz', 'blurfl/quux'], 1, 1);> + +=head1 DESCRIPTION + +The C<mkpath> function provides a convenient way to create directories, even if +your C<mkdir> kernel call won't create more than one level of directory at a +time. C<mkpath> takes three arguments: + +=over 4 + +=item * + +the name of the path to create, or a reference +to a list of paths to create, + +=item * + +a boolean value, which if TRUE will cause C<mkpath> +to print the name of each directory as it is created +(defaults to FALSE), and + +=item * + +the numeric mode to use when creating the directories +(defaults to 0777) + +=back + +It returns a list of all directories (including intermediates, determined using +the Unix '/' separator) created. + +Similarly, the C<rmtree> function provides a convenient way to delete a +subtree from the directory structure, much like the Unix command C<rm -r>. +C<rmtree> takes three arguments: + +=over 4 + +=item * + +the root of the subtree to delete, or a reference to +a list of roots. All of the files and directories +below each root, as well as the roots themselves, +will be deleted. For the moment, C<rmtree> expects +Unix file specification syntax. + +=item * + +a boolean value, which if TRUE will cause C<rmtree> to +print a message each time it tries to delete a file, +giving the name of the file, and indicating whether +it's using C<rmdir> or C<unlink> to remove it. +(defaults to FALSE) + +=item * + +a boolean value, which if TRUE will cause C<rmtree> to +skip any files to which you do not have write access. +This will change in the future when a criterion for +'delete permission' is settled. (defaults to FALSE) + +=back + +It returns the number of files successfully deleted. + +=head1 AUTHORS + +Tim Bunce <Tim.Bunce@ig.co.uk> +Charles Bailey <bailey@genetics.upenn.edu> + +=head1 REVISION + +This document was last revised 29-Jan-1995, for perl 5.001 + +=cut + +require 5.000; +use Config; +use Carp; +require Exporter; +@ISA = qw( Exporter ); +@EXPORT = qw( mkpath rmtree ); + +sub mkpath{ + my($paths, $verbose, $mode) = @_; + # $paths -- either a path string or ref to list of paths + # $verbose -- optional print "mkdir $path" for each directory created + # $mode -- optional permissions, defaults to 0777 + local($")="/"; + $mode = 0777 unless defined($mode); + $paths = [$paths] unless ref $paths; + my(@created); + foreach $path (@$paths){ + next if -d $path; + my(@p); + foreach(split(/\//, $path)){ + push(@p, $_); + next if -d "@p/"; + print "mkdir @p\n" if $verbose; + mkdir("@p",$mode) || croak "mkdir @p: $!"; + push(@created, "@p"); + } + } + @created; +} + +sub rmtree { + my($roots, $verbose, $safe) = @_; + my(@files,$count); + $roots = [$roots] unless ref $roots; + + foreach $root (@{$roots}) { + $root =~ s#/$##; + if (-d $root) { + opendir(D,$root); + @files = map("$root/$_", grep $_!~/^\.{1,2}$/, readdir(D)); + closedir(D); + $count += rmtree(\@files,$verbose,$safe); + next if ($safe && !(-w $root)); + print "rmdir $root\n" if $verbose; + (rmdir $root && ++$count) or carp "Can't remove directory $root: $!"; + } + else { + next if ($safe && !(-w $root)); + print "unlink $root\n" if $verbose; + (unlink($root) && ++$count) or carp "Can't unlink file $root: $!"; + } + } + + $count; +} + +1; + +__END__ diff --git a/makeaperl b/makeaperl new file mode 100644 index 0000000000..91236093d3 --- /dev/null +++ b/makeaperl @@ -0,0 +1,101 @@ +#!/usr/bin/perl + +=head1 NAME + +makeaperl - create a new perl binary from static extensions + +=head1 SYNOPSIS + +C<makeaperl -l library -m makefile -o target -t tempdir [object_files] [static_extensions] [search_directories]> + +=head1 DESCRIPTION + +This utility is designed to build new perl binaries from existing +extensions on the fly. Called without any arguments it produces a new +binary with the name C<perl> in the current directory. Intermediate +files are produced in C</tmp>, if that is writeable, else in the +current directory. The most important intermediate file is a Makefile, +that is used internally to call C<make>. The new perl binary will consist + +The C<-l> switch lets you specify the name of a perl library to be +linked into the new binary. If you do not specify a library, makeaperl +writes targets for any C<libperl*.a> it finds in the search path. The +topmost target will be the one related to C<libperl.a>. + +With the C<-m> switch you can provide a name for the Makefile that +will be written (default C</tmp/Makefile.$$>). Likewise specifies the +C<-o> switch a name for the perl binary (default C<perl>). The C<-t> +switch lets you determine, in which directory the intermediate files +should be stored. + +All object files and static extensions following on the command line +will be linked into the target file. If there are any directories +specified on the command line, these directories are searched for +C<*.a> files, and all of the found ones will be linked in, too. If +there is no directory named, then the contents of $INC[0] are +searched. + +If the command fails, there is currently no other mechanism to adjust +the behaviour of the program than to alter the generated Makefile and +run C<make> by hand. + +=head1 AUTHORS +Tim Bunce <Tim.Bunce@ig.co.uk>, Andreas Koenig +<koenig@franz.ww.TU-Berlin.DE>; + +=head2 STATUS +First version, written 5 Feb 1995, is considered alpha. + +=cut + +use ExtUtils::MakeMaker; +use Getopt::Long; +use strict qw(subs refs); + +$Version = 1.0; +$Verbose = 0; + +sub usage{ + warn <<END; +$0 version $Version + +$0: [options] [object_files] [static_extensions ...] [directories to search through] + -l perllibrary perl library to link from (the first libperl.a found) + -m makefilename name of the makefile to be written (/tmp/Makefile.$$) + -o name name for perl executable (perl) + -t directory directory where intermediate files reside (/tmp) +END + exit 1; +} + +if (-w "/tmp") { + $opt_t = "/tmp"; +} else { + $opt_t = "."; +} +$opt_l = ''; +$opt_m = "$opt_t/Makefile.$$"; +$opt_o = 'perl'; + +$Getopt::Long::ignorecase=0; + +GetOptions('t=s', 'l=s', 'm=s', 'o=s') || die &usage; + +@dirs = grep -d $_, @ARGV; +@fils = grep -f $_, @ARGV; + +@dirs = $INC[0] unless @dirs; + +open MAKE, ">$opt_m"; +MM->init_main(); +MM->init_others(); +print MAKE MM->makeaperl('MAKE' => $opt_m, + 'TARGET' => $opt_o, + 'TMP' => $opt_t, + 'LIBPERL' => $opt_l, + 'DIRS' => [@dirs], + 'STAT' => [@fils], + 'INCL' => [@dirs] +); +close MAKE; +(system "make -f $opt_m") == 0 or die "$0 failed: Please check file $opt_m and run make -f $opt_m\n"; diff --git a/minimod.PL b/minimod.PL new file mode 100644 index 0000000000..740cb2bee0 --- /dev/null +++ b/minimod.PL @@ -0,0 +1,89 @@ +# minimod.PL writes the contents of miniperlmain.c into the module +# ExtUtils::Miniperl for later perusal (when the perl source is +# deleted) +# +# It also writes the subroutine writemain(), which takes as its +# arguments module names that shall be statically linked into perl. +# +# Authors: Andreas Koenig <k@franz.ww.TU-Berlin.DE>, Tim Bunce +# <Tim.Bunce@ig.co.uk> +# +# Version 1.0, Feb 2nd 1995 by Andreas Koenig + +print <<'END'; +# This File keeps the contents of miniperlmain.c. +# +# It was generated automatically by minimod.PL from the contents +# of miniperlmain.c. Don't edit this file! +# +# ANY CHANGES MADE HERE WILL BE LOST! +# + + +package ExtUtils::Miniperl; +require Exporter; +@ISA = qw(Exporter); +@EXPORT = qw(&writemain); + +$head= <<'EOF!HEAD'; +END + +open MINI, "miniperlmain.c"; +while (<MINI>) { + last if /Do not delete this line--writemain depends on it/; + print; +} + +print <<'END'; +EOF!HEAD +$tail=<<'EOF!TAIL'; +END + +while (<MINI>) { + print; +} +close MINI; + +print <<'END'; +EOF!TAIL + +sub writemain{ + my(@exts) = @_; + + my($pname); + my($dl) = canon('/','DynaLoader'); + print $head; + print " char *file = __FILE__;\n"; + foreach $_ (@exts){ + my($pname) = canon('/', $_); + my($mname, $cname); + ($mname = $pname) =~ s!/!::!g; + ($cname = $pname) =~ s!/!__!g; + print "\t{ extern void boot_${cname} _((CV* cv));\n"; + if ($pname eq $dl){ + # Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'! + # boot_DynaLoader is called directly in DynaLoader.pm + print "\t/* DynaLoader is a special case */\n"; + print "\tnewXS(\"${mname}::boot_${cname}\", boot_${cname}, file);\n" + } else { + print "\tnewXS(\"${mname}::bootstrap\", boot_${cname}, file);\n" + } + print "\t}\n"; + } + print $tail; +} + +sub canon{ + my($as, @ext) = @_; + foreach(@ext){ + # might be X::Y or lib/auto/X/Y/Y.a + next if s!::!/!g; + s:^(lib|ext)/(auto/)?::; + s:/\w+\.\w+$::; + } + grep(s:/:$as:, @ext) if ($as ne '/'); + @ext; +} + +1; +END @@ -1132,7 +1132,7 @@ SV *sv; else sprintf(tokenbuf, "%s", cpp); sv_catpv(sv,"-I"); - sv_catpv(sv,PRIVLIB); + sv_catpv(sv,PRIVLIB_EXP); #ifdef MSDOS (void)sprintf(buf, "\ sed %s -e \"/^[^#]/b\" \ @@ -1659,13 +1659,13 @@ init_perllib() incpush(getenv("PERLLIB")); } -#ifdef ARCHLIB - incpush(ARCHLIB); +#ifdef ARCHLIB_EXP + incpush(ARCHLIB_EXP); #endif -#ifndef PRIVLIB -#define PRIVLIB "/usr/local/lib/perl5:/usr/local/lib/perl" +#ifndef PRIVLIB_EXP +#define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl" #endif - incpush(PRIVLIB); + incpush(PRIVLIB_EXP); av_push(GvAVn(incgv),newSVpv(".",1)); } @@ -1,8 +1,10 @@ +#ifndef NEXT30_NO_ATTRIBUTE #ifndef HASATTRIBUTE /* disable GNU-cc attribute checking? */ #ifdef __attribute__ /* Avoid possible redefinition errors */ #undef __attribute__ #endif #define __attribute__(attr) +#endif #endif #ifdef OVERLOAD SV* amagic_call _((SV* left,SV* right,int method,int dir)); diff --git a/vms/config.vms b/vms/config.vms index 3f5b1bf74d..5133266603 100644 --- a/vms/config.vms +++ b/vms/config.vms @@ -30,16 +30,16 @@ */ #define BYTEORDER 0x1234 /* large digits for MSB */ -/* ARCHLIB: +/* ARCHLIB_EXP: * This variable, if defined, holds the name of the directory in * which the user wants to put architecture-dependent public * library files for $package. It is most often a local directory * such as /usr/local/lib. Programs using this variable must be - * prepared to deal with filename expansion. If ARCHLIB is the - * same as PRIVLIB, it is not defined, since presumably the - * program already searches PRIVLIB. + * prepared to deal with filename expansion. If ARCHLIB_EXP is the + * same as PRIVLIB_EXP, it is not defined, since presumably the + * program already searches PRIVLIB_EXP. */ -#undef ARCHLIB /**/ +#undef ARCHLIB_EXP /**/ /* CAT2: * This macro catenates 2 tokens together. @@ -1185,13 +1185,13 @@ #define SSize_t int /* signed count of bytes */ -/* PRIVLIB: +/* PRIVLIB_EXP: * This symbol contains the name of the private library for this package. * 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. The program * should be prepared to do ~ expansion. */ -#define PRIVLIB "/perl_root/lib" /**/ +#define PRIVLIB_EXP "/perl_root/lib" /**/ /* SCRIPTDIR: * This symbol holds the name of the directory in which the user wants diff --git a/vms/ext/MM_VMS.pm b/vms/ext/MM_VMS.pm new file mode 100644 index 0000000000..3ef0233d9a --- /dev/null +++ b/vms/ext/MM_VMS.pm @@ -0,0 +1,668 @@ +# MM_VMS.pm +# MakeMaker default methods for VMS +# This package is inserted into @ISA of MakeMaker's MM before the +# built-in MM_Unix methods if MakeMaker.pm is run under VMS. +# +# Version: 4.03 +# Author: Charles Bailey bailey@genetics.upenn.edu +# Revised: 30-Jan-1995 + +package ExtUtils::MM_VMS; + +use Config; +require Exporter; +use File::VMSspec; +use File::Basename; + +Exporter::import('ExtUtils::MakeMaker', + qw(%att %skip %Recognized_Att_Keys $Verbose &neatvalue)); + + +sub fixpath { + my($path) = @_; + my($head,$macro,$tail); + + while (($head,$macro,$tail) = ($path =~ m#(.*?)\$\((\S+?)\)/(.*)#)) { + ($macro = unixify($att{$macro})) =~ s#/$##; + $path = "$head$macro/$tail"; + } + vmsify($path); +} + + +sub init_others { + &MM_Unix::init_others; + $att{NOOP} = "\tContinue"; + $att{MAKEFILE} = '$(MAKEFILE)'; + $att{RM_F} = '$(PERL) -e "foreach (@ARGV) { -d $_ ? rmdir $_ : unlink $_}"'; + $att{RM_RF} = '$(FULLPERL) -e "use File::Path; use File::VMSspec; @dirs = map(unixify($_),@ARGV); rmtree(\@dirs,0,0)"'; + $att{TOUCH} = '$(PERL) -e "$t=time; utime $t,$t,@ARGV"'; + $att{CP} = 'Copy/NoConfirm'; + $att{MV} = 'Rename/NoConfirm'; +} + +sub constants { + my(@m,$def); + push @m, " +NAME = $att{NAME} +DISTNAME = $att{DISTNAME} +VERSION = $att{VERSION} + +# In which library should we install this extension? +# This is typically the same as PERL_LIB. +# (also see INST_LIBDIR and relationship to ROOTEXT) +INST_LIB = ",vmspath($att{INST_LIB})," +INST_ARCHLIB = ",vmspath($att{INST_ARCHLIB})," + +# Perl library to use when building the extension +PERL_LIB = ",vmspath($att{PERL_LIB})," +PERL_ARCHLIB = ",vmspath($att{PERL_ARCHLIB})," +"; + +# Define I_PERL_LIBS to include the required -Ipaths +# To be cute we only include PERL_ARCHLIB if different +# To be portable we add quotes for VMS +my(@i_perl_libs) = qw{-I$(PERL_ARCHLIB) -I$(PERL_LIB)}; +shift(@i_perl_libs) if ($att{PERL_ARCHLIB} eq $att{PERL_LIB}); +push @m, "I_PERL_LIBS = \"".join('" "',@i_perl_libs)."\"\n"; + + push @m, " +# Where is the perl source code located? (Eventually we should +# be able to build extensions without requiring the perl source +# but that's a long way off yet). +PERL_SRC = ",vmspath($att{PERL_SRC})," +# Perl header files (will eventually be under PERL_LIB) +PERL_INC = ",vmspath($att{PERL_INC})," +# Perl binaries +PERL = $att{PERL} +FULLPERL = $att{FULLPERL} + +# FULLEXT = Pathname for extension directory (eg DBD/Oracle). +# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. +# ROOTEXT = Directory part of FULLEXT with leading slash (e.g /DBD) +FULLEXT = ",vmsify($att{FULLEXT})," +BASEEXT = $att{BASEEXT} +ROOTEXT = ",$att{ROOTEXT} eq '' ? '[]' : vmspath($att{ROOTEXT})," + +INC = "; + + if ($att{'INC'}) { + push @m,'/Include=('; + my(@includes) = split(/\s+/,$att{INC}); + foreach (@includes) { + s/^-I//; + push @m,vmspath($_); + } + push @m, ")\n"; + } + + if ($att{DEFINE} ne '') { + my(@defs) = split(/\s+/,$att{DEFINE}); + foreach $def (@defs) { + $def =~ s/^-D//; + $def = "\"$def\"" if $def =~ /=/; + } + $att{DEFINE} = join ',',@defs; + } + + push @m," +DEFINE = $att{DEFINE} +OBJECT = ",vmsify($att{OBJECT})," +LDFROM = ",vmsify($att{LDFROM})," +LINKTYPE = $att{LINKTYPE} + +# Handy lists of source code files: +XS_FILES = ",join(', ', sort keys %{$att{XS}})," +C_FILES = ",join(', ', @{$att{C}})," +O_FILES = ",join(', ', @{$att{O_FILES}})," +H_FILES = ",join(', ', @{$att{H}})," + +.SUFFIXES : .xs + +# This extension may link to it's own library (see SDBM_File)"; + push @m," +MYEXTLIB = ",vmsify($att{MYEXTLIB})," + +# Here is the Config.pm that we are using/depend on +CONFIGDEP = \$(PERL_ARCHLIB)Config.pm, \$(PERL_INC)config.h + +# Where to put things: +INST_LIBDIR = ",($att{'INST_LIBDIR'} = vmspath(unixpath($att{INST_LIB}) . unixpath($att{ROOTEXT})))," +INST_ARCHLIBDIR = ",($att{'INST_ARCHLIBDIR'} = vmspath(unixpath($att{INST_ARCHLIB}) . unixpath($att{ROOTEXT})))," + +INST_AUTODIR = ",($att{'INST_AUTODIR'} = vmspath(unixpath($att{INST_LIB}) . 'auto/' . unixpath($att{FULLEXT}))),' +INST_ARCHAUTODIR = ',($att{'INST_ARCHAUTODIR'} = vmspath(unixpath($att{INST_ARCHLIB}) . 'auto/' . unixpath($att{FULLEXT}))),' + +INST_STATIC = $(INST_ARCHLIBDIR)$(BASEEXT).olb +INST_DYNAMIC = $(INST_ARCHAUTODIR)$(BASEEXT).$(DLEXT) +INST_BOOT = $(INST_ARCHAUTODIR)$(BASEEXT).bs +INST_PM = ',join(', ',map(fixpath($_),sort values %{$att{PM}})),' +'; + + join('',@m); +} + + +sub const_cccmd { + my($cmd) = $Config{'cc'}; + my($name,$sys,@m); + + ( $name = $att{NAME} . "_cflags" ) =~ s/:/_/g ; + warn "Unix shell script ".$Config{"$att{'BASEEXT'}_cflags"}. + " required to modify CC command for $att{'BASEEXT'}\n" + if ($Config{$name}); + + # Deal with $att{DEFINE} here since some C compilers pay attention + # to only one /Define clause on command line, so we have to + # conflate the ones from $Config{'cc'} and $att{DEFINE} + if ($att{DEFINE} ne '') { + if ($cmd =~ m:/define=\(?([^\(\/\)]+)\)?:i) { + $cmd = $` . "/Define=(" . $1 . ",$att{DEFINE})" . $'; + } + else { $cmd .= "/Define=($att{DEFINE})" } + } + + $sys = ($cmd =~ /^gcc/i) ? 'GNU_CC_Include:[VMS]' : 'Sys$Library'; + push @m,' +.FIRST + @ If F$TrnLnm("Sys").eqs."" Then Define/NoLog SYS ',$sys,' + +'; + push(@m, "CCCMD = $cmd\n"); + + join('',@m); +} + + + +sub const_loadlibs{ + my (@m); + push @m, " +# $att{NAME} might depend on some other libraries. +# +# Dependent libraries are linked in either by the Link command +# at build time or by the DynaLoader at bootstrap time. +# +# These comments may need revising: +# +# EXTRALIBS = Full list of libraries needed for static linking. +# Only those libraries that actually exist are included. +# +# BSLOADLIBS = List of those libraries that are needed but can be +# linked in dynamically. +# +# LDLOADLIBS = List of those libraries which must be statically +# linked into the shared library. +# +EXTRALIBS = ",map(vmsify($_) . ' ',$att{'EXTRALIBS'})," +BSLOADLIBS = ",map(vmsify($_) . ' ',$att{'BSLOADLIBS'})," +LDLOADLIBS = ",map(vmsify($_) . ' ',$att{'LDLOADLIBS'}),"\n"; + + join('',@m); +} + +# --- Tool Sections --- + +sub tool_autosplit{ + my($self, %attribs) = @_; + my($asl) = ""; + $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; + q{ +# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto +AUTOSPLITFILE = $(PERL) $(I_PERL_LIBS) -e "use AutoSplit;}.$asl.q{ AutoSplit::autosplit($ARGV[0], $ARGV[1], 0, 1, 1) ;" +}; +} + +sub tool_xsubpp{ + my($xsdir) = unixpath($att{PERL_LIB}).'ExtUtils'; + # drop back to old location if xsubpp is not in new location yet + $xsdir = unixpath($att{PERL_SRC}).'ext' unless (-f "$xsdir/xsubpp"); + my(@tmdeps) = '$(XSUBPPDIR)typemap'; + push(@tmdeps, "typemap") if -f "typemap"; + my(@tmargs) = map("-typemap $_", @tmdeps); + " +XSUBPPDIR = ".vmspath($xsdir)." +XSUBPP = \$(PERL) \$(XSUBPPDIR)xsubpp +XSUBPPDEPS = @tmdeps +XSUBPPARGS = @tmargs +"; +} + +sub tools_other { + " +# Assumes \$(MMS) invokes MMS or MMK +USEMAKEFILE = /Descrip= +USEMACROS = /Macro=( +MACROEND = ) +MAKEFILE = Descrip.MMS +SHELL = Posix +LD = $att{LD} +TOUCH = $att{TOUCH} +CP = $att{CP} +RM_F = $att{RM_F} +RM_RF = $att{RM_RF} +MKPATH = Create/Directory +"; +} + + +# --- Translation Sections --- + +sub c_o { + ' +.c.obj : + $(CCCMD) $(CCCDLFLAGS) /Include=($(PERL_INC)) $(INC) $(MMS$TARGET_NAME).c +'; +} + +sub xs_c { + ' +.xs.c : + $(XSUBPP) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET) +'; +} + +sub xs_o { # many makes are too dumb to use xs_c then c_o + ' +.xs.obj : + $(XSUBPP) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).c + $(CCCMD) $(CCCDLFLAGS) /Include=($(PERL_INC)) $(INC) $(MMS$TARGET_NAME).c +'; +} + + +# --- Target Sections --- + +sub top_targets{ + ' +all :: config linkext $(INST_PM) +'.$att{NOOP}.' + +config :: '.$att{MAKEFILE}.' + @ $(MKPATH) $(INST_LIBDIR), $(INST_ARCHAUTODIR) +'; +} + +sub dlsyms { + my($self,%attribs) = @_; + my($funcs) = $attribs{DL_FUNCS} || $att{DL_FUNCS} || {}; + my($vars) = $attribs{DL_VARS} || $att{DL_VARS} || []; + my(@m); + + push(@m,' +dynamic :: perlshr.opt $(BASEEXT).opt + ',$att{NOOP},' + +perlshr.opt : makefile.PL + $(FULLPERL) $(I_PERL_LIBS) -e "use ExtUtils::MakeMaker; mksymlists(DL_FUNCS => ', + %$funcs ? neatvalue($funcs) : "' '",', DL_VARS => ', + @$vars ? neatvalue($vars) : "' '",')" +') unless $skip{'dynamic'}; + + push(@m,' +static :: $(BASEEXT).opt + ',$att{NOOP},' +') unless $skip{'static'}; + + push(@m,' +$(BASEEXT).opt : makefile.PL + $(FULLPERL) $(I_PERL_LIBS) -e "use ExtUtils::MakeMaker; mksymlists(DL_FUNCS => ',neatvalue($att{DL_FUNCS}),', DL_VARS => ',neatvalue($att{DL_VARS}),')" +'); + + join('',@m); +} + + +# --- Dynamic Loading Sections --- + +sub dynamic_lib { + my($self, %attribs) = @_; + my($otherldflags) = $attribs{OTHERLDFLAGS} || ""; + my(@m); + push @m," + +OTHERLDFLAGS = $otherldflags + +"; + push @m, ' +$(INST_DYNAMIC) : $(OBJECT) $(MYEXTLIB) $(PERL_INC)perlshr_attr.opt $(PERL_INC)crtl.opt perlshr.opt $(BASEEXT).opt + @ $(MKPATH) $(INST_ARCHAUTODIR) + Link $(LDFLAGS) /Shareable/Executable=$(MMS$TARGET)$(OTHERLDFLAGS) $(OBJECT),$(PERL_INC)perlshr_attr.opt/Option,$(PERL_INC)crtl.opt/Option,[]perlshr.opt/Option,[]$(BASEEXT).opt/Option +'; + + join('',@m); +} + +# --- Static Loading Sections --- + +sub static_lib { + my(@m); + push @m, <<'END'; +$(INST_STATIC) : $(OBJECT), $(MYEXTLIB) + If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET) + Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST) +END + push @m," + $att{CP}",'$(MMS$SOURCE) $(INST_ARCHAUTODIR) + $(PERL) -e "print ""$(MMS$TARGET)\n""" >$(INST_ARCHAUTODIR)extralibs.ld +'; + push @m, <<'END' if $att{PERL_SRC}; + @! Old mechanism - still needed: + $(PERL) -e "print ""$(MMS$TARGET)\n""" >>$(PERL_SRC)ext.libs +END + + join('',@m); +} + + +sub installpm_x { # called by installpm perl file + my($self, $dist, $inst, $splitlib) = @_; + $inst = fixpath($inst); + $dist = vmsify($dist); + my($instdir) = dirname($inst); + my(@m); + + push(@m, " +$inst : $dist +",' @ ',$att{RM_F},' $(MMS$TARGET);* + @ $(MKPATH) ',$instdir,' + @ ',$att{CP},' $(MMS$SOURCE) $(MMS$TARGET) +'); + if ($splitlib and $inst =~ /\.pm$/) { + my($attdir) = $splitlib; + $attdir =~ s/\$\((.*)\)/$1/; + $attdir = $att{$attdir} if $att{$attdir}; + + push(@m, ' $(AUTOSPLITFILE) $(MMS$TARGET) ', + vmspath(unixpath($attdir) . 'auto')."\n"); + push(@m,"\n"); + } + + join('',@m); +} + + +# --- Sub-directory Sections --- + +sub subdir_x { + my($self, $subdir) = @_; + my(@m); + # The intention is that the calling Makefile.PL should define the + # $(SUBDIR_MAKEFILE_PL_ARGS) make macro to contain whatever + # information needs to be passed down to the other Makefile.PL scripts. + # If this does not suit your needs you'll need to write your own + # MY::subdir_x() method to override this one. + push @m, ' +config :: ',vmspath($subdir) . '$(MAKEFILE) + $(MMS) $(USEMAKEFILE) $(MMS$SOURCE) config $(USEMACROS)(INST_LIB=$(INST_LIB),INST_ARCHLIB=$(INST_ARCHLIB),LINKTYPE=$(LINKTYPE)$(MACROEND) + +',vmspath($subdir),'$(MAKEFILE) : ',vmspath($subdir),'Makefile.PL, $(CONFIGDEP) + @Write Sys$Output "Rebuilding $(MMS$TARGET) ..." + $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::MakeMaker; MM->runsubdirpl(qw('.$subdir.'))" \\ + $(SUBDIR_MAKEFILE_PL_ARGS) INST_LIB=$(INST_LIB) INST_ARCHLIB=$(INST_ARCHLIB) + @Write Sys$Output "Rebuild of $(MMS$TARGET) complete." + +# The default clean, realclean and test targets in this Makefile +# have automatically been given entries for $subdir. + +subdirs :: + Set Default ',vmspath($subdir),' + $(MMS) all $(USEMACROS)LINKTYPE=$(LINKTYPE)$(MACROEND) +'; + join('',@m); +} + + +# --- Cleanup and Distribution Sections --- + +sub clean { + my($self, %attribs) = @_; + my(@m); + push @m, ' +# Delete temporary files but do not touch installed files +# We don\'t delete the Makefile here so that a +# later make realclean still has a makefile to work from +clean :: +'; + foreach (@{$att{DIR}}) { # clean subdirectories first + my($vmsdir) = vmspath($_); + push( @m, ' If F$Search("'.$vmsdir.'$(MAKEFILE)") Then $(MMS) $(USEMAKEFILE)'.$vmsdir.'$(MAKEFILE) clean'."\n"); + } + push @m, " + $att{RM_F} *.Map;* *.lis;* *.cpp;* *.Obj;* *.Olb;* \$(BOOTSTRAP);* \$(BASEEXT).bso;* +"; + + my(@otherfiles) = values %{$att{XS}}; # .c files from *.xs files + push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; + push(@otherfiles, "blib.dir"); + push(@m, " $att{RM_F} ".join(";* ", map(fixpath($_),@otherfiles)),";*\n"); + # See realclean and ext/utils/make_ext for usage of Makefile.old + push(@m, " $att{MV} $att{MAKEFILE} $att{MAKEFILE}_old"); + push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP}; + join('', @m); +} + + +sub realclean { + my($self, %attribs) = @_; + my(@m); + push(@m,' +# Delete temporary files (via clean) and also delete installed files +realclean :: clean +'); + foreach(@{$att{DIR}}){ + my($vmsdir) = vmspath($_); + push(@m, ' If F$Search("'."$vmsdir$att{MAKEFILE}".'").nes."" Then $(MMS) $(USEMAKEFILE)'."$vmsdir$att{MAKEFILE}".' realclean'."\n"); + push(@m, ' If F$Search("'."$vmsdir$att{MAKEFILE}".'_old").nes."" Then $(MMS) $(USEMAKEFILE)'."$vmsdir$att{MAKEFILE}".'_old realclean'."\n"); + } + push @m,' + ',$att{RM_RF},' $(INST_AUTODIR) $(INST_ARCHAUTODIR) + ',$att{RM_F},' *.Opt;* $(INST_DYNAMIC);* $(INST_STATIC);* $(INST_BOOT);* $(INST_PM);* + ',$att{RM_F},' $(OBJECT);* $(MAKEFILE);* $(MAKEFILE)_old;* +'; + push(@m, " $att{RM_RF} ".join(";* ", map(fixpath($_),$attribs{'FILES'})),";*\n") if $attribs{'FILES'}; + push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP}; + join('', @m); +} + + +sub distclean { + my($self, %attribs) = @_; + my($preop) = $attribs{PREOP} || '@ !'; # e.g., update MANIFEST + my($zipname) = $attribs{ZIPNAME} || '$(DISTNAME)-$(VERSION)'; + my($zipflags) = $attribs{ZIPFLAGS} || '-Vu'; + my($postop) = $attribs{POSTOP} || ""; + my(@mkfildirs) = map(vmspath($_),@{$att{'DIR'}}); + my(@m,$dir); + + push @m,' +distclean : realclean + ',$preop,' + If F$Search("$(MAKEFILE)").nes."" Then ',$att{RM_F},' $(MAKEFILE);* +'; + foreach $dir (@mkfildirs) { + push(@m,'If F$Search("',$dir,'$(MAKEFILE)") Then Delete/Log/NoConfirm ', + $dir,'$(MAKEFILE);*',"\n"); + } + + push(@m," Zip \"$zipflags\" $zipname \$(BASEEXT).* Makefile.PL + $postop +"); + + join('',@m); +} + + +# --- Test and Installation Sections --- + +sub test { + my($self, %attribs) = @_; + my($tests) = $attribs{TESTS} || ( -d 't' ? 't/*.t' : ''); + my(@m); + push @m,' +test : all +'; + push(@m,' $(FULLPERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" $(I_PERL_LIBS) -e "use Test::Harness; runtests @ARGV;" '.$tests."\n") + if $tests; + push(@m,' $(FULLPERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" test.pl',"\n") + if -f 'test.pl'; + foreach(@{$att{DIR}}){ + my($vmsdir) = vmspath($_); + push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir \'',$vmsdir, + '\'; print `$(MMS) $(USEMAKEFILE)$(MAKEFILE) $(USEMACRO)LINKTYPE=$(LINKTYPE)$(MACROEND) test`'."\n"); + } + push(@m, "\t\@echo 'No tests defined for \$(NAME) extension.'\n") unless @m > 1; + + join('',@m); +} + +sub install { + my($self, %attribs) = @_; + my(@m); + push(@m, " +install :: all +"); + # install subdirectories first + foreach(@{$att{DIR}}){ + my($vmsdir) = vmspath($_); + push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir \'',$vmsdir, + '\'; print `$(MMS) $(USEMAKEFILE)$(MAKEFILE) install`'."\n"); + } + + push(@m, "\t! perl5.000 used to autosplit into INST_ARCHLIB, we delete these old files here + $att{RM_F} ",fixpath('$(INST_ARCHLIB)/auto/$(FULLEXT)/*.al'),";*,",fixpath('$(INST_ARCHLIB)/auto/$(FULLEXT)/*.ix'),';* + $(MMS) $(USEMACROS)INST_LIB=\$(INST_PRIVLIB),INST_ARCHLIB=\$(INST_ARCHLIB)$(MACROEND) +'); + + join("",@m); +} + +sub perldepend { + my(@m); + + push @m, ' +$(OBJECT) : $(PERL_INC)EXTERN.h, $(PERL_INC)INTERN.h, $(PERL_INC)XSUB.h, $(PERL_INC)av.h +$(OBJECT) : $(PERL_INC)cop.h, $(PERL_INC)cv.h, $(PERL_INC)embed.h, $(PERL_INC)form.h +$(OBJECT) : $(PERL_INC)gv.h, $(PERL_INC)handy.h, $(PERL_INC)hv.h, $(PERL_INC)keywords.h +$(OBJECT) : $(PERL_INC)mg.h, $(PERL_INC)op.h, $(PERL_INC)opcode.h, $(PERL_INC)patchlevel.h +$(OBJECT) : $(PERL_INC)perl.h, $(PERL_INC)perly.h, $(PERL_INC)pp.h, $(PERL_INC)proto.h +$(OBJECT) : $(PERL_INC)regcomp.h, $(PERL_INC)regexp.h, $(PERL_INC)scope.h, $(PERL_INC)sv.h +$(OBJECT) : $(PERL_INC)vmsish.h, $(PERL_INC)util.h, $(PERL_INC)config.h +$(O_FILES) : $(H_FILES) + +'; + push(@m,' + +$(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh + @ Write Sys$Error "$(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh" + Set Default $(PERL_SRC) + $(MMS) $(USEMAKEFILE)[.VMS]$(MAKEFILE) [.lib]config.pm +'); + + push(@m, join(" ", map(vmsify($_),values %{$att{XS}}))." : \$(XSUBPPDEPS)\n") + if %{$att{XS}}; + + join('',@m); +} + +sub makefile { + my(@m,@cmd); + @cmd = grep(/^\s/,split(/\n/,MY->c_o())); + push(@m,join("\n",@cmd)); + push(@m,' + +# We take a very conservative approach here, but it\'s worth it. +# We move $(MAKEFILE) to $(MAKEFILE)_old here to avoid gnu make looping. +$(MAKEFILE) : Makefile.PL $(CONFIGDEP) + @ Write Sys$Output "',$att{MAKEFILE},' out-of-date with respect to $(MMS$SOURCE_LIST)" + @ Write Sys$Output "Cleaning current config before rebuilding ',$att{MAKEFILE},'... + - ',"$att{MV} $att{MAKEFILE} $att{MAKEFILE}_old",' + - $(MMS) $(USEMAKEFILE)',$att{MAKEFILE},'_old clean + $(PERL) $(I_PERL_LIBS) Makefile.PL + @ Write Sys$Output "Now you must rerun $(MMS)." +'); + + join('',@m); +} + + +# --- Determine libraries to use and how to use them --- + +sub extliblist { + '','',''; +} + +sub old_extliblist { + '','','' +} + +sub new_extliblist { + '','','' +} + +# --- Write a DynaLoader bootstrap file if required + +# VMS doesn't require a bootstrap file as a rule +sub mkbootstrap { + 1; +} + +sub mksymlists { + my($self,%attribs) = @_; + + MY->init_main() unless $att{BASEEXT}; + + my($vars) = $attribs{DL_VARS} || $att{DL_VARS} || []; + my($procs) = $attribs{DL_FUNCS} || $att{DL_FUNCS}; + my($package,$packprefix,$sym); + if (!%$procs) { + $package = $attribs{NAME} || $att{NAME}; + $package =~ s/\W/_/g; + $procs = { $package => ["boot_$package"] }; + } + my($isvax) = $Config{'arch'} =~ /VAX/i; + # First, a short linker options file to specify PerlShr + # used only when linking dynamic extension + open OPT, ">PerlShr.Opt"; + print OPT "PerlShr/Share\n"; + close OPT; + + # Next, the options file declaring universal symbols + # Used when linking shareable image for dynamic extension, + # or when linking PerlShr into which we've added this package + # as a static extension + # We don't do anything to preserve order, so we won't relax + # the GSMATCH criteria for a dynamic extension + open OPT, ">$att{BASEEXT}.opt"; + foreach $package (keys %$procs) { + ($packprefix = $package) =~ s/\W/_/g; + foreach $sym (@{$$procs{$package}}) { + $sym = "XS_${packprefix}_$sym" unless $sym =~ /^boot_/; + if ($isvax) { print OPT "UNIVERSAL=$sym\n" } + else { print OPT "SYMBOL_VECTOR=($sym=PROCEDURE)\n"; } + } + } + foreach $sym (@$vars) { + print OPT "PSECT_ATTR=${sym},PIC,OVR,RD,NOEXE,WRT,NOSHR\n"; + if ($isvax) { print OPT "UNIVERSAL=$sym\n" } + else { print OPT "SYMBOL_VECTOR=($sym=DATA)\n"; } + } + close OPT; +} + +# --- Output postprocessing section --- + +sub nicetext { + # Insure that colons marking targets are preceded by space - + # most Unix Makes don't need this, but it's necessary under VMS + # to distinguish the target delimiter from a colon appearing as + # part of a filespec. + + my($self,$text) = @_; + $text =~ s/([^\s:])(:+\s)/$1 $2/gs; + $text; +} + +1; + +__END__ @@ -19,12 +19,18 @@ #if defined(STANDARD_C) && defined(I_STDLIB) # include <stdlib.h> #endif /* STANDARD_C */ + #include <stdio.h> #ifdef I_MATH #include <math.h> #endif +#ifdef I_SYS_TYPES +# include <sys/types.h> +#endif + + #ifdef USE_NEXT_CTYPE #include <appkit/NXCType.h> #else |