diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-05 07:28:59 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-05 07:28:59 +0000 |
commit | 8ba9dee36046939ca96a462c19c93dee3e0d9d52 (patch) | |
tree | c7fa86ab6faeb14a87ce6da74ed5bb78320f73b5 | |
parent | 86959918b69bd7566746d776574341f410f68755 (diff) | |
parent | 59c10aa22854831f97f41f8f8237b4d9b2426b0f (diff) | |
download | perl-8ba9dee36046939ca96a462c19c93dee3e0d9d52.tar.gz |
Integrate with mainperl.
p4raw-id: //depot/cfgperl@3585
-rwxr-xr-x | Configure | 20 | ||||
-rw-r--r-- | Makefile.SH | 2 | ||||
-rw-r--r-- | README.cygwin32 | 431 | ||||
-rw-r--r-- | cygwin32/Makefile.SHs | 21 | ||||
-rw-r--r-- | cygwin32/build-instructions.READFIRST | 28 | ||||
-rw-r--r-- | cygwin32/build-instructions.charles-wilson | 96 | ||||
-rw-r--r-- | cygwin32/build-instructions.sebastien-barre | 9 | ||||
-rw-r--r-- | cygwin32/build-instructions.steven-morlock | 100 | ||||
-rw-r--r-- | cygwin32/build-instructions.steven-morlock2 | 23 | ||||
-rw-r--r-- | doio.c | 2 | ||||
-rw-r--r-- | dosish.h | 17 | ||||
-rw-r--r-- | ext/B/B/Bblock.pm | 23 | ||||
-rw-r--r-- | ext/B/B/C.pm | 2 | ||||
-rw-r--r-- | ext/B/B/CC.pm | 40 | ||||
-rw-r--r-- | ext/POSIX/Makefile.PL | 2 | ||||
-rw-r--r-- | ext/POSIX/POSIX.xs | 1 | ||||
-rw-r--r-- | hints/cygwin32.sh | 10 | ||||
-rw-r--r-- | lib/Class/Struct.pm | 1 | ||||
-rw-r--r-- | lib/Cwd.pm | 8 | ||||
-rw-r--r-- | lib/ExtUtils/MM_Cygwin.pm | 5 | ||||
-rw-r--r-- | lib/Test/Harness.pm | 5 | ||||
-rw-r--r-- | perl.h | 14 | ||||
-rw-r--r-- | pp_hot.c | 6 | ||||
-rwxr-xr-x | t/TEST | 3 | ||||
-rwxr-xr-x | t/UTEST | 3 | ||||
-rw-r--r-- | t/harness | 59 | ||||
-rwxr-xr-x | t/io/openpid.t | 5 | ||||
-rwxr-xr-x | t/op/magic.t | 8 | ||||
-rw-r--r-- | util.c | 45 | ||||
-rw-r--r-- | utils/perlcc.PL | 204 |
30 files changed, 903 insertions, 290 deletions
@@ -4369,18 +4369,26 @@ $grep "^[ ]*#.*\$wanted" | \ while read cline; do name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\` case "\$name" in - *[/\\\\]\$wanted) echo "\$name"; exit 0;; - *[\\\\/]\$wanted) echo "\$name"; exit 0;; - *) name='';; + *[/\\\\]\$wanted) echo "\$name"; exit 1;; + *[\\\\/]\$wanted) echo "\$name"; exit 1;; + *) exit 2;; esac; done; +# +#status=0: grep returned 0 lines, case statement not executed +#status=1: headerfile found +#status=2: while loop executed, no headerfile found +# +status=\$? $rm -f foo\$\$.c; -case "\$name" in -'') exit 1;; -esac +if test \$status -eq 1; then + exit 0; +fi +exit 1 EOF chmod +x findhdr + : define an alternate in-header-list? function inhdr='echo " "; td=$define; tu=$undef; yyy=$@; cont=true; xxf="echo \"<\$1> found.\" >&4"; diff --git a/Makefile.SH b/Makefile.SH index d4c51978d2..5d4164a2e2 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -46,7 +46,7 @@ true) rhapsody*) ldlibpth="DYLD_LIBRARY_PATH=`pwd`/Perl:$DYLD_LIBRARY_PATH" ;; - cygwin*) ldlibpth="PATH=`pwd`:$PATH" + cygwin*) ldlibpth="PATH='`pwd`:$PATH'" linklibperl="-lperl" ;; os2*) # OS/2 doesn't need anything special for LD_LIBRARY_PATH. diff --git a/README.cygwin32 b/README.cygwin32 index 7c44dbefd9..9ca078fe96 100644 --- a/README.cygwin32 +++ b/README.cygwin32 @@ -12,18 +12,17 @@ README.cygwin32 - notes about porting Perl to Cygwin32 =item Cygwin32 - The Cygwin tools are ports of the popular GNU development tools for +The Cygwin tools are ports of the popular GNU development tools for Windows NT, 95, and 98. They run thanks to the Cygwin library which provides the UNIX system calls and environment these programs expect. -More info about this project can be found at it's home page +More info about this project can be found at its home page http://sourceware.cygnus.com/cygwin/ =item libperl.dll -These instructions and the default cygwin32 hints build a a shared +These instructions and the default cygwin32 hints build a shared libperl.dll Perl library and enables dynamically loaded extensions. - =back =head1 BUILDING @@ -48,7 +47,109 @@ ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin/egcs-1.1.2/ To make life easier, you should download ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin/porters/Humblet_Pierre_A/install-cygwin-b20.sh, and use it as your install "executable." Just follow the instructions -that are embedding as comments in the .sh file. +that are embedded as comments in the .sh file. + +=item Windows NT notes + +You should execute a 'chmod -R +w *' on the entire perl source directory. +The configuration process creates new files (and thus needs write access +to the directory) and sometimes, especially if you make repeated builds +in the same directory, overwrites old files. If you do not enable write +access, you're just asking for trouble. Reminder for B20.1: unless 'ntea' +is included in the CYGWIN environment variable settings, chmod has no +effect. See "environment," below. + +It is best if you build, test, and install as a normal user, not as +Administrator or as any member of the Administrators group. There is +a well-known NT-ism that affects Cygwin: all files that are created +by any member of the Administrators B<group> are B<NOT> owned by +that member. The ownership of those files is assigned to the +Administrators group, instead. If the default access mode for new files +is -rw-r--r--, then the original creator of the file cannot overwrite +it: he no longer owns the file, no B<user> does. It is owned by the +group, but group members don't have write access to it. This causes +any number of problems, including make test / perl harness failures, +installation failures, etc. + +In some cases, however, it is necessary to install as Administrator. For +instance, if normal users are not allowed write access to the install +directory. My solution, in this case, was to transfer ownership of the +install directory tree (/usr/local) to a single, normal user, and +set permissions to -rw-r--r-- (drwxr-xr-x for directories, of course). +If you read the preceeding paragraph carefully, you might suspect that +changing the permissions on the entire tree to -rw-rw-r--, but allowing +the Administrators group to keep ownership should solve the problem. +However, newly created directories (and the perl install creates a lot +of them) will not allow group write access. Setting umask will not +fix this problem, because umask is a B<negation> operator; it only +specifies the types of accesses that will NOT be allowed on new files. +For instance, umask u=rwx,g=rwx,o=rx means that world ('B<o>thers') will +never be allowed write access, but owner ('B<u>ser') and B<g>roup B<might> +be allowed write access. Everybody (u, g, and o) B<might>be allowed +read access. + +In any case, Corinna Vinschen's ntsec patches B<may> eventually +alleviate this whole mess, and are included in the development +snapshots as of 24 May 1999. You will need to include 'ntsec' as +one of the items in the CYGWIN variable setting. However, initial +tests indicate some incompatibility the 0524 snapshot and this perl +build. + +=item environment + +I (csw) found the following steps necessary for a successful build: + +=over + +=item path + +I set my path so that none of the windows directories showed up - +otherwise Configure found the wrong executables (find, grep, etc). +It is, however, important that '.' be in the path, because otherwise +the build process can't execute the ld2 script that is created. + +=item mounts + +I had to unmount my f: drive. I have cygwin installed under +F:\cygnus\cygwin-b20\, which is mounted as \. I also ordinarily +have F:\ mounted as /f (i.e. mounted onto the empty directory +F:\cygnus\cygwin-b20\f\ ). However, this causes Configure to +"locate" the awk, tr, sed, etc. programs at +/f/cygnus/cygwin-b20/usr/bin instead of /usr/bin. +This ended up causing problems. + +I built and tested perl using all binary mounts. However, Eric Fifer +has built and tested it using text mounts, but reported more failures +during make test and perl harness. Based on his findings, and experiments +performed by Sebastien Barre with the static build of perl, I can +report that these test failures are B<not> due to any differences in +the perl executable. Most of the failures encountered during a make test +on text mounts can be eliminated by remounting as binary, and re-running +the tests using the same executable. These test failures are due to +problems in the test scripts, not the executable. See Appendix. + +One observation from experience with the static build of perl is that +it's a bad idea to a mix a perl executable that was compiled using binary +mounts with modules compiled using text mounts, and vice versa. Make +sure your mount environment matches. This observation has not been +confirmed with respect to the dynamically linked build of perl. + +=item environment variables + +For NT users, the CYGWIN variable should include the 'ntea' setting. +However, if you have FAT drives on your system, as opposed to NTFS, +please read the Cygwin FAQ concerning ntea before including it in +your system settings. If you do not use ntea, you will encounter a +few extra make test and/or perl harness failures. These are not +indicative of a faulty perl executable, but only that your system +settings do not allow the types of file access and ownership checking +that the test scripts are attempting to verify. See Appendix. + +I unset INCLUDE and LIB (these two variables are set by MSVC5, and +inherited from my Windows environment by cygwin). I'm not sure this made +a difference, but it has caused problems in the past... + +=back =item crypt library @@ -57,13 +158,60 @@ libraries ported to cygwin. This has been tested with the libcrypt.tgz by Andy Piper. His home page can be found at http://www.xemacs.freeserve.co.uk/ +=item hacks that should be revisited after the next cygwin release + +Some of the failures we encountered when running make test and/or perl harness +are due to bugs in the cygwin b20.1 distribution. We sometimes found it +necessary to use dirty little hacks to persuade make test and perl harness +to play nicely. Since cygwin is in active development, many of these hacks +may not be necessary in the future. These include: + +=over + +=item fix for pragma/locale + +the line '#undef MB_CUR_MAX' was added to ex/POSIX/POSIX.xs. This fixes +a failure in the pragma/locale.t test, which before this fix resulted in a +coredump. It appears that MB_CUR_MAX is #defined __mb_cur_max, and __mb_cur_max +is declared 'extern' in Cygwin b20.1's stdlib.c, but is never defined. Thus, +the error. + +=item fix for lib/io_sock + +there is a rather extensive patch to t/lib/io_sock.t which works around +a failure related to fork() in the cygwin environment. Cygwin b20.1 does not +properly remap manually loaded DLLs in the child after a fork. + +=item fix for lib/filehand + +during the make test/perl harness steps, a win32 popup complains about +a "perl.exe Application Error - illegal memory access." This is due to to +a test in t/lib/filehand.t, and is related to the fork + dll problem. + +=item fix for environ + +there are a number of changes to miniperlmain.c, util.c, and mg.c that +are there to work around a Cygwin problem relating to environ. + +=item fix for lib/posix + +the following line was added to t/lib/posix.t to work around a Cygwin bug. + +=begin text + +kill 'CONT', $$ if($^O =~ /cygwin/); # XXX: Cygwin bug INT signal gets stuck + +=end text + +=back + =back =head2 Configure Check hints/cygwin32.sh for any system specific settings. In -particular change libpth if Cygwin is installed somewhere other -than /cygnus. +particular change libpth to point to the correct location of +...../i586-cygwin32/lib. run "sh Configure". @@ -87,32 +235,99 @@ collides with some cygwin startup routines. =head2 make -Run "make". After that, run "make test" to see how stable your system is. -For me, at io/taint.t you may see several Win32 "Unable To Locate DLL" -messages (just click Ok) that requires cygwin1.dll to be present in the -build directory or somewhere in system path (/WINNT, /WINNT/System, -/WINNT/System32). And, at lib/io_sock.t you may see several Win32 -"Application Error" messages (just click Ok) and the test waits for a -died child that has to be killed manually. Other test scripts seem to -be more or less harmless. The result of ./perl harness reads: +Run "make". If you're really feeling adventurous, type +"make 2>&1 | tee make-log.txt". -=begin text +=over -Failed Test Status Wstat Total Fail Failed List of failed -------------------------------------------------------------------------------- -lib/anydbm.t 2 512 12 8 66.67% 5-12 -lib/findbin.t 1 1 100.00% 1 -lib/io_sock.t 9 2304 5 4 80.00% 2-5 -lib/sdbm.t 2 512 18 15 83.33% 2, 5-18 -op/magic.t 35 2 5.71% 23, 29 -op/split.t 25 1 4.00% 11 -op/stat.t 58 2 3.45% 9, 26 -op/taint.t 149 3 2.01% 1, 3, 31 -pragma/locale.t 11 2816 102 4 3.92% 99-102 -9 tests skipped, plus 35 subtests skipped. -Failed 9/190 test scripts, 95.26% okay. 40/6452 subtests failed, 99.38% okay. +=item ld2 -=end text +The make script will install ld2 into your $installbin directory (i.e. +wherever you said to put the perl.exe) during the *make* process. It +does not wait until the *make install* process to install the ld2 script. +This is because the remainder of the make refers to ld2 without fully +specifying its path, and does this from multiple subdirectories (so ./ld2 +won't work.) The assumption here is that $installbin is in your current +$PATH. If this is not the case, or if you do not have an install +executable, the make will fail at some point. Don't panic. Just manually +copy ld2 from the source directory to someplace in your path. + +This cannot be done prior to make, because ld2 is created during the +make process. + +=back + +=head2 make test + +Run "make test" to see how stable your system is. I (csw) got the +following errors/warnings: + +=over + +=item op/taint + +Got two "missing cygwin1.dll" warning popups. This is because +op/taint wants cygwin1.dll to be somewhere in the system path +(\WINDOWS\SYSTEM, etc) or in the build directory. Can be ignored. + +=item lib/filehand + +Got an "Application Error - memory could not be read" popup. While +this looks alarming, it can be ignored - just click OK. It is +because Cygwin B20.1 doesn't properly remap manually loaded DLLs +in the child after a fork. + +=item lib/io_sock + +Got an "Application Error - memory could not be read" popup. Again, +just click OK and ignore it. + +=back + +=head2 perl harness + +Once you've run make test, then cd into the t/ subdirectory and +execute './perl harness'. I (csw) got the following results: + +=over + +=item op/taint + +Got four "missing cygwin1.dll" warning popups. Click OK and +ignore. + +=item lib/filehand + +Got an "Application Error - memory could not be read" popup. Again, +click OK and ignore. + +=item lib/io_sock + +Got an "Application Error - memory could not be read" popup. Again, +clock OK and ignore. + +=item final results + +After the ./perl harness, I got the following results summary. + + Failed Test Status Wstat Total Fail Failed List of failed + ------------------------------------------------------------------------------- + op/taint.t 149 3 2.01% 1, 3, 31 + 9 tests skipped, plus 35 subtests skipped. + Failed 1/190 test scripts, 99.47% okay. 3/6452 subtests failed, 99.95% okay. + +=back + +=head2 make install + +Finally, run "make install". In my case, the install process was unable +to copy the files from <SRCDIR>/pod/* to /usr/local/lib/perl5/5.00503/pod/. +I (csw) just copied them by hand after the install finished. I believe +this is because I'm using Sergey Okhapkin's coolview version of the +cygwin1.dll, which provides case sensitivity. The directory is created +as "/usr/local/lib/perl5/5.00503/Pod" but the copy is done into +"/usr/local/lib/perl5/5.00503/pod". This fails -- but probably won't +fail if you're using the default cygwin1.dll. =head1 BUGS @@ -121,11 +336,8 @@ lacking a cast. This is because of __declspec(dllimport). Upon each start, make warns that a rule for perlmain.o is overrided. Yes, it is. In order to use libperl.dll, perlmain needs to import -symbols from there. I saw no better solution than adding an explicit -define to the rule. - -The lib/io_sock.t failure seems to be a problem with a forked child -not having its DLLs remapped. +symbols from there. According to alex smishlajev, there seems to be +no better solution than adding an explicit define to the rule. make clean does not remove library .def and .exe.core files. @@ -140,17 +352,154 @@ alexander smishlajev <als@turnhere.com> =head1 DISCLAIMER -I am not going to maintain this document or this port. I only wanted +I (alex) am not going to maintain this document or this port. I only wanted to make perl porting a bit easier. If failed, I can't be helpful for you. +Contact one of the others listed in the history section. =head1 HISTORY -17..25-apr-1999. perl 5.005_03. cygwin b20.1 egcs 1.1.2. - far 1.60. nescafe classic. +=over + +=item Release 1.4.1: 28-May-1999 + +Charles Wilson - cwilson@ece.gatech.edu + + Configure minor fix for spaces in $PATH + documentation updates + +=item Release 1.4: 26-May-1999 + +Charles Wilson - cwilson@ece.gatech.edu + + From Eric Fifer: + hints/cygwin32.sh -L. and --export-dynamic not needed + cygwin32/Makefile.SHs no value needed for -DUSEIMPORTLIB + t/lib/io_sock.t -I../lib so "make test" works + t/lib/posix.t workaround a Cygwin bug so test works + doio.c/perl.h cleanup gcc warning "doio.c:789: warning: + pointer/integer type mismatch in + conditional expression" + From Charles Wilson: + Configure changes to findhdr script + documentation updates + built binary kit for release + +=item Release 1.3: 26-May-1999 + +Charles Wilson - cwilson@ece.gatech.edu + + Changes to Cwd.pm to correct lib/findbin.t test failure from Eric Fifer + Changes to t/op/magic.t to correct a test failure from Eric Fifer + Changes to miniperlmain.c, util.c, and mg.c to correct t/op/magic.t #29 + test failure, from Eric Fifer + more documentatino updates, patch merging, and a change to + cygwin/Makefile.SHs -- cw. + 99.95% okay!!! + +=item Release 1.2: 25-May-1999 + +Charles Wilson - cwilson@ece.gatech.edu + + fixes for lib/io_sock and pragma/locale from Eric Fifer + fixes for Configure, Makefile.SH, and cygwin32/Makefile.SHs from + alex smishlajev + documentation updates, and other fixes to the fixes from cw. + 99.91% okay!!! + +=item Release 1.1: 21-May-1999 + +Charles Wilson - cwilson@ece.gatech.edu + +minor change to Configure script, reversed a few changes made by +alexander's patch (made DOSISH #undefined again) and moved code +by alexander from dosish.h to perl.h. Reversed a change in +pp_hot.c + +=item Release 1.0: 16-May-1999 + +Charles Wilson - cwilson@ece.gatech.edu -efifer@sanwaint.com - Wed May 12 17:22:42 BST 1999 +Merged alexander's patch and Eric's patch into a single +monolithic patch. Minor cleanup. Built binary for distribution. +perl5.005_03-dynamic-patch-v1.0 - Removed all references to the impure_ptr hack since it is no longer - needed. Some minor cleanup of Alexander's work and a few bug fixes. +=item Pre-release 3: 12-May-1999 + +Eric Fifer - efifer@sanwaint.com + +Removed all references to the impure_ptr hack since it is no longer +needed. Some minor cleanup of alexander smishlajev's work and a few +bug fixes. + +=item Pre-release 2 (initial dynamic build): 17..25-apr-1999 + +alexander smishlajev - als@turnher.com + +perl 5.005_03. cygwin b20.1 egcs 1.1.2. far 1.60. nescafe classic. + +=item Pre-release 1 (static build): 5-Mar-1999 + +Charles Wilson - cwilson@ece.gatech.edu + +Collected various patches that had been floating around the net, along +with build instructions. Original authorship credit for those patches +goes to: + + Steven Morlock - newspost@morlock.net + Sebastien Barre - Sebastien.Barre@utc.fr + Teun Burgers - burgers@ecn.nl + +Created a monolithic patchkit (perl5.005_03-static-patch) and build +instructions for cygwin (beta 20.1). Also created a binary distribution +of the resulting static perl build. + +=back + +=head1 APPENDIX + +Perl harness results from Eric Fifer, under various environments. The same +executable was used in all cases. The last item is a different executable +on a different machine, built by Charles Wilson. + +There are a number of very good questions one could ask about anomalies +in the test results presented below. "Why do the last two show different +results?" "Why did op/stat.t #18 pass in the first two tests and fail in +the third?" Short answer: I don't know. Long answer: I really have no +idea. + +=over + +=item text mounts, no 'ntea' + + Failed Test Status Wstat Total Fail Failed List of failed + ------------------------------------------------------------ + lib/anydbm.t 2 512 12 8 66.67% 5-12 + lib/sdbm.t 2 512 18 15 83.33% 2, 5-18 + op/split.t 25 1 4.00% 11 + op/stat.t 58 3 5.17% 9, 19, 26 + op/taint.t 149 3 2.01% 1, 3, 31 + +=item binary mounts, no 'ntea' + + Failed Test Status Wstat Total Fail Failed List of failed + ------------------------------------------------------------ + lib/sdbm.t 18 1 5.56% 2 + op/stat.t 58 3 5.17% 9, 19, 26 + op/taint.t 149 3 2.01% 1, 3, 31 + +=item binary mounts, 'ntea' + + Failed Test Status Wstat Total Fail Failed List of failed + ------------------------------------------------------------ + op/stat.t 58 3 5.17% 18-19, 26 + op/taint.t 149 3 2.01% 1, 3, 31 + +=item binary mounts, ntea (csw build) + + Failed Test Status Wstat Total Fail Failed List of failed + ------------------------------------------------------------------------------- + op/taint.t 149 3 2.01% 1, 3, 31 + +=back =cut diff --git a/cygwin32/Makefile.SHs b/cygwin32/Makefile.SHs index a675d7433d..e4beabecba 100644 --- a/cygwin32/Makefile.SHs +++ b/cygwin32/Makefile.SHs @@ -29,6 +29,24 @@ $spitshell >>Makefile <<!GROK!THIS! ld2: $& Makefile perlld ${src}/cygwin32/ld2.in @echo "extracting ld2 (with variable substitutions)" @$sed s,@buildpath@,$addtopath,g <${src}/cygwin32/ld2.in >ld2 + @echo "installing ld2 into $installbin" +# install is included in Cygwin distributions, and we make a note of th +# requirement in the README.cygwin32 file. However, let's give them +# a warning. + @if test -n "`type $1 2>&1 | sed -n -e '/'$1'$/p'`" ; then \ + install -c -m 755 ld2 ${installbin}/ld2 ; \ + else \ + echo "*************************************************" ; \ + echo "Oh, no! You didn't read the README.cygwin32" ; \ + echo "file, which stated that \"install\" was required." ; \ + echo "Make will probably fail in a few more steps." ; \ + echo "When it does, copy \"ld2\" to a directory in" ; \ + echo "your path, other than \".\"." ; \ + echo "\"/usr/local/bin\" or something similar will do." ; \ + echo "Then restart make." ; \ + echo "*************************************************" ; \ + fi + !GROK!THIS! $spitshell >>Makefile <<!GROK!THIS! @@ -74,7 +92,6 @@ linklibperl=-l`echo $libperl|sed -e s,^lib,,` $spitshell >>Makefile <<!GROK!THIS! LIBPERL = $libperl LLIBPERL= $linklibperl -LDLIBPTH= PATH=$addtopath:\${PATH} CLDFLAGS= -L$addtopath $ldflags CAT = $cat AWK = $awk @@ -87,7 +104,7 @@ cwobj = $(obj) # override default rule (NB: make croaks!) to force dll usage perlmain$(OBJ_EXT): perlmain.c - $(CCCMD) $(PLDLFLAGS) -DUSEIMPORTLIB=\"$(LIBPERL)$(LIB_EXT)\" $*.c + $(CCCMD) $(PLDLFLAGS) -DUSEIMPORTLIB $*.c # library used to make statically linked executables # miniperl is linked against it to avoid libperl.dll locking diff --git a/cygwin32/build-instructions.READFIRST b/cygwin32/build-instructions.READFIRST index 4cdd1990d7..efbc76008b 100644 --- a/cygwin32/build-instructions.READFIRST +++ b/cygwin32/build-instructions.READFIRST @@ -1,3 +1,8 @@ +This document is obsolete. Refer to README.cygwin32. However, if you want +to build a statically linked perl binary, then you applied the wrong patch. +You want perl5.005_03-static-patch, which will build "Pre-release 1" +according to the nomenclature in README.cygwin32. + The perl source distribution is available from http://www.cpan.org/src/index.html @@ -13,17 +18,21 @@ For the easiest build of perl under Cygwin, do the following: (2) prepare the source (a) unpack perl source distribution in /usr/local/src - (b) copy perl5.005_03.patch into /usr/local/src/perl5.005_03/ + (b) copy perl5.005_03-static-patch into /usr/local/src/perl5.005_03/ (c) cd /usr/local/src/perl5.005_03 (d) chmod -R +w * - (e) patch -p1 < perl5.005_03.patch + (e) patch -p1 < perl5.005_03-static-patch (3) get ready to build - (a) cp cygwin32/* . - (b) cp gcc2 /usr/local/bin - (c) cp ld2 /usr/local/bin - (d) cp hints/cygwin32.sh config.sh - (e) sh Configure -d + (a) cp cygwin32/cw32imp.h . + (b) cp cygwin32/gcc2 . + (c) cp cygwin32/ld2 . + (d) cp cygwin32/perlgcc . + (e) cp cygwin32/perlld . + (f) cp gcc2 /usr/local/bin + (g) cp ld2 /usr/local/bin + (h) cp hints/cygwin32.sh config.sh + (i) sh Configure -d (automatically does a make depend) (4) build and install @@ -31,7 +40,10 @@ For the easiest build of perl under Cygwin, do the following: (c) make test (d) make install -To customize, look around in the patchfile or ignore the patch and follow the build-instructions.* directly. If you want to edit the paths in the patchfile to reflect your system, search for "/usr/" within the patchfile. +To customize, look around in the patchfile or ignore the patch and +follow the build-instructions.* directly. If you want to edit the paths +in the patchfile to reflect your system, search for "/usr/" within the +patchfile. * MUST read. diff --git a/cygwin32/build-instructions.charles-wilson b/cygwin32/build-instructions.charles-wilson index e758d34d23..93c718f0ed 100644 --- a/cygwin32/build-instructions.charles-wilson +++ b/cygwin32/build-instructions.charles-wilson @@ -1,32 +1,66 @@ -DATE: 2 April 99 +This document is obsolete. Refer to README.cygwin32. -Here are a few hints for building perl with cygwin: - -(1) There have been some problems compiling with the default compiler installed with cygwin-b20.1. Some of the patches in perl5.005_03.patch attempt to correct this, but it would probably be a good idea to upgrade your compiler to egcs-1.1.1 (or better) from Mumit Khan's website -- http://www.xraylith.wisc.edu/~khan/software/gnu-win32/ - -(2) To avoid some failures when doing a "make test", use CYGWIN=ntea while testing. However, see the Cygwin FAQ concerning the use of ntea with FAT partitions. The tests that fail are those that deal with file ownership and access. - -(3) Perl should build without trouble under text mounts or binary mounts. However, some tests ("make test") may fail when using text mounts. The tests that fail are those that involve using tie() to attach a hashtable variable to a file. - -(4) As of 3/8/98, building and linking new modules into the perl executable rus into problems when using binary mounts. We're still tracking this one down. +DATE: 13 May 99 -(5) There have been a few hints that some tests may also fail depending on whether you're building, testing, and/or installing as a normal user, or as a member of the Administrators group (NT only). However, we're not sure about this one yet. - -(6) When compiling static modules for perl, don't mix modules compiled under text mounts and modules compiled under binary mounts. - -(7) The sourcefiles in the tarball extract as "-r--r--r--" by default, so you need to "chmod -R +w *' in order to patch successfully. - -(8) To make life easier, you should download ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin/porters/Humblet_Pierre_A/install-cygwin-b20.sh, and use it as your install "executable." Just follow the instructions that are embedding as comments in the .sh file. - -(9) There were a number of failed operations when installing. These were - (a) trying to create man pages whose names had ":" in them -- i.e. man/man3/Tie::Array.3 - (b) for some reason, the installer had difficulty copying the SRCDIR/pod/*.pod files to /usr/local/lib/perl5/perl5.00503/pod/ directory. I did it by hand. It's not really that important - the pod files are converted to man pages, and the man pages are installed successfully. So you don't really need to keep the pod's around. +Here are a few hints for building perl with cygwin: +(1) There have been some problems compiling with the default compiler +installed with cygwin-b20.1. If you're reading this file, then you've +already applied perl5.005_03-static-patch. Some of the patches in +perl5.005_03-static-patch attempt to correct these problems, but it +would probably be a good idea to upgrade your compiler to egcs-1.1.1 +(or better) from Mumit Khan's website -- +http://www.xraylith.wisc.edu/~khan/software/gnu-win32/ + +(2) To avoid some failures when doing a "make test", use CYGWIN=ntea +while testing. However, see the Cygwin FAQ concerning the use of ntea +with FAT partitions. The tests that fail are those that deal with file +ownership and access. + +(3) Perl should build without trouble under text mounts or binary +mounts. However, some tests ("make test") may fail when using text +mounts. The tests that fail are those that involve using tie() to +attach a hashtable variable to a file. + +(4) There have been a few hints that some tests may also fail depending +on whether you're building, testing, and/or installing as a normal +user, or as a member of the Administrators group (NT only). However, +we're not sure about this one yet. + +(5) When compiling static modules for perl, don't mix modules compiled +under text mounts and modules compiled under binary mounts. + +(6) The sourcefiles in the tarball extract as "-r--r--r--" by default. +This may or may not cause problems, depending on your setup. To be safe, +I executed "chmod -R +w *". + +(7) To make life easier, you should download install-cygwin-b20.sh from +ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin/ + porters/Humblet_Pierre_A/ +and use it as your install "executable." Just follow the instructions +that are embedded as comments in that shell script. + +(8) There were a number of failed operations when installing. These +occurred in two cases: first, when trying to create man pages whose +names had ":" in them -- i.e. man/man3/Tie::Array.3, and second, +when copying the pod files from SRCDIR/pod/*.pod to +/usr/local/lib/perl5/perl5.00503/pod/. I'm not sure why, but I just +completed that operation by hand afterwards. RESULTS: **************************************************** -I built and tested as a normal user (not Administrator and not a member of the Administrators group). However, I had to switch to Administrator to install because the permissions on my /usr/local/bin were wrong. +I built and tested as a normal user (not Administrator and not a member +of the Administrators group). However, I had to +'chown -R cwilson /usr/local/*' in order to avoid various NTisms. +(Previously, my /usr/local tree was owned by the Administrators GROUP, +and since I was building as a normal user, I couldn't install +completely. Why didn't I just switch to the Administrator account to +install? Well, that has its own share of problems: basically, the +Administrator couldn't write to those directories either - they were +owned by the Admin group, not the Admin user. And the permissions were +-rw-r--r-- (or -r--r--r--), so group members weren't allowed write +access. Blame MS.) RESULTS: make test ------------------ @@ -42,18 +76,24 @@ most things were "foo/bar............ok" with the following exceptions: base/rs.............ok, 4/14 subtests skipped op/groups...........skipping test on this platform op/magic............FAILED test 23 - Failed 1/35 tests, 97.14% okay (-4 skipped tests: 30 okay, 85.71%) + Failed 1/35 tests, 97.14% okay (-4 skipped tests: 30 okay, +85.71%) op/stat.............ls: /dev: No such file or directory FAILED tests 4, 35 Failed 2/58 tests, 96.55% okay op/taint............FAILED tests 1, 3, 31 - Failed 3/149 tests, 97.99% okay (-12 skipped tests: 134 okay, 89.93%) - (Also got the following popup message four times - "The dynamic link + Failed 3/149 tests, 97.99% okay (-12 skipped tests: 134 okay, +89.93%) + (Also got the following popup message four times - "The dynamic +link library cygwin1.dll could not be found in the specified path F:\cygnus\cygwin-b20\usr\local\src\perl5.005_03\t;.; E:\WINNT\System32;E:\WINNT\system;E:\WINNT;..") lib/findbin.........FAILED test 1 Failed 1/1 tests, 0.00% okay +lib/db-btree........skipping test on this platform +lib/db-hash.........skipping test on this platform +lib/db-recno........skipping test on this platform lib/gdbm............skipping test on this platform lib/ipc_sysv........skipping test on this platform lib/ndbm............skipping test on this platform @@ -62,10 +102,12 @@ lib/posix...........skipping test on this platform lib/thread..........skipping test on this platform Failed Test Status Wstat Total Fail Failed List of failed -------------------------------------------------------------------------------- +------------------------------------------------------------------------ +------- lib/findbin.t 1 1 100.00% 1 op/magic.t 35 1 2.86% 23 op/stat.t 58 2 3.45% 4, 35 op/taint.t 149 3 2.01% 1, 3, 31 10 tests skipped, plus 20 subtests skipped. -Failed 4/190 test scripts, 97.89% okay. 7/6430 subtests failed, 99.89% okay. +Failed 4/190 test scripts, 97.89% okay. 7/6430 subtests failed, 99.89% +okay. diff --git a/cygwin32/build-instructions.sebastien-barre b/cygwin32/build-instructions.sebastien-barre index 3e29b35d66..70e0b154dc 100644 --- a/cygwin32/build-instructions.sebastien-barre +++ b/cygwin32/build-instructions.sebastien-barre @@ -1,4 +1,8 @@ -The included patch, perl5.005_02.patch, implements all of the suggestions below. Results in a static build, 93.85% successful test on NT. +This document is obsolete. Refer to README.cygwin32. + +perl5.005_03-static-patch implements all of the +suggestions below. Results in a static build, 93.85% +successful test on NT. ********************************** @@ -23,7 +27,8 @@ Basically, *) Edit the hints/cygwin32.sh file to reflect your paths. -Here are also a couple of settings I found useful when performing automatic +Here are also a couple of settings I found useful when performing +automatic build (copy hints/cygwin32.sh to config.sh, and do sh Configure -d) usedl='n' diff --git a/cygwin32/build-instructions.steven-morlock b/cygwin32/build-instructions.steven-morlock index 58d19936c3..70b7a55995 100644 --- a/cygwin32/build-instructions.steven-morlock +++ b/cygwin32/build-instructions.steven-morlock @@ -1,4 +1,9 @@ -From comp.lang.perl.misc. The included patch, perl5.005_02.patch, implements most of the suggestions below. My observations during the build process are commented within the body of Mr. Morlock's message, set off by ******CSW****** +This document is obsolete. Refer to README.cygwin32. + +From comp.lang.perl.misc. perl5.005_03-static-patch +implements most of the suggestions below. My observations during the +build process are commented within the body of Mr. Morlock's message, +set off by ******CSW****** ************************************** @@ -12,7 +17,8 @@ Cygwin Win32 ports of the GNU development tools (Cygwin32) you might get something out of my experience of building it. An advantage of the versions Perl built with Cygwin32 is that Cygwin32 -has a POSIX compatible library including support for the fork() function. +has a POSIX compatible library including support for the fork() +function. Steve @@ -51,15 +57,16 @@ directory. <INST> will refer to the perl target/install directory. * Pre-build checklist: - - I found that building Perl on a unmounted partition/drive other than the - root will fail. It appears that the double forward slash that Cygwin32 - uses to reference drives other than the root drive (typically C:) gets - converted to a single forward slash at several points in the build process. - I have not tried, but expect it would work, to mount the non-root drive. - This problem held true for both the drive where the perl source were and - the drive where the Cygwin32 binaries where located. In the build - described in these notes the Perl source and Cygwin32 binaries were located - on the root drive. + - I found that building Perl on a unmounted partition/drive other + than the root will fail. It appears that the double forward slash + that Cygwin32 uses to reference drives other than the root drive + (typically C:) gets converted to a single forward slash at several + points in the build process. I have not tried, but expect it would + work, to mount the non-root drive. This problem held true for both + the drive where the perl source were and the drive where the + Cygwin32 binaries where located. In the build described in these + notes the Perl source and Cygwin32 binaries were located on the + root drive. - Following the instructions in <PERL>/README.cygwin32: *******CSW******** @@ -82,13 +89,13 @@ the patch does this i_stdarg='define' i_varargs='undef' - This change allows us to pick up the right version of va_start(). - Cygwin32 has both a signal and double parameter versions floating - around in their header files. + This change allows us to pick up the right version of + va_start(). Cygwin32 has both a signal and double parameter + versions floating around in their header files. - + Remove support for dynamic linking. I found that all DynaLoader'd - extensions crashed during the running of the test suite. Add or edit - 'usedl' entry to read: + + Remove support for dynamic linking. I found that all + DynaLoader'd extensions crashed during the running of the + test suite. Add or edit 'usedl' entry to read: *******CSW******** the patch does this ****************** @@ -96,19 +103,20 @@ the patch does this If there is enough push I will try to sort out the problems with dynamic loading. I have made several unsuccessful attempts at - modifying <PERL>/perlld to fix this problem. If you are interested, - write me. + modifying <PERL>/perlld to fix this problem. If you are + interested, write me. + Change the path to the Cygwin32 directories. This includes the - entries for 'usrinc', 'libpth', 'lddlflags', 'libc' and 'usrinc'. + entries for 'usrinc', 'libpth', 'lddlflags', 'libc' and + 'usrinc'. *******CSW******** the patch does this ^ ****************** - Edit makedepend.SH. The original version of makedepend.SH produces - dependencies that include double backslashes. This can not be processed - by Cygwin32's 'make'. Apply the following modification to makedepend.SH - to correct these unfortunate filenames: + dependencies that include double backslashes. This can not be + processed by Cygwin32's 'make'. Apply the following modification + to makedepend.SH to correct these unfortunate filenames: *******CSW******** and this, as well \/ ****************** @@ -129,8 +137,9 @@ and this, as well \/ - Edit config_h.SH. The original version of config_h.SH has an bogus #include that gets propagated into the dependency list in Makefile - create from the makedepend script. The Apply the following modification - to config_h.SH to work around this unfortunate filename: + create from the makedepend script. The Apply the following + modification to config_h.SH to work around this unfortunate + filename: *******CSW******** the patch does this, too ****************** @@ -151,23 +160,24 @@ the patch does this, too #endif The real source of the problem appears that the 'make depend' in the - 'x2p' directory has problems. The following messages are generated by - that 'make depend': + 'x2p' directory has problems. The following messages are generated + by that 'make depend': Finding dependencies for hash.o. gcc2: Can't open gcc2 ... [similar messages to above] - You don't seem to have a proper C preprocessor. Using grep instead. + You don't seem to have a proper C preprocessor. Using grep + instead. Updating GNUmakefile... So the grep is pulling the bogus #include from the file. The patch turns the #include'd message into a comment. - - Run the Configure in the <PERL> directory as described in the document - <PERL>/README.cygwin32 + - Run the Configure in the <PERL> directory as described in the + document <PERL>/README.cygwin32 - I receive the message "THIS PACKAGE SEEMS INCOMPLETE.". This does not - appear to be a problem. + I receive the message "THIS PACKAGE SEEMS INCOMPLETE.". This does + not appear to be a problem. When presented with the list of handy defaults, select 'cygwin32' @@ -181,11 +191,11 @@ the patch does this, too *******CSW******** I didn't see this problem \/ ****************** - - I experience problems when building two files 'pp_sys.o' & 'doio.o'. The - build process will crash with a Windows dialog during the build of these two - files. The way I get by the problem is to control-C the make and issue - the build commands for the two files by hand. In the Perl directory issue - the following commands: + - I experience problems when building two files 'pp_sys.o' & + 'doio.o'. The build process will crash with a Windows dialog + during the build of these two files. The way I get by the problem + is to control-C the make and issue the build commands for the two + files by hand. In the Perl directory issue the following commands: `sh cflags libperl.a pp_sys.o` pp_sys.c `sh cflags libperl.a doio.o` doio.c @@ -198,9 +208,9 @@ I didn't see this problem \/ * Testing: I found that the majority of the tests passed. There were no errors - that I thought particularly scary. There were several unexpected results - such as a couple 'A required .DLL file, CYGWIN1.DLL, was not found' dialogs - and 'Perl perform an illegal operation' dialogs. + that I thought particularly scary. There were several unexpected + results such as a couple 'A required .DLL file, CYGWIN1.DLL, was not + found' dialogs and 'Perl perform an illegal operation' dialogs. *******CSW******** saw the "missing dll" during one test @@ -210,7 +220,8 @@ saw the "missing dll" during one test - Renamed or delete the file <PERL>/t/lib/io_sock.t so it will not be executed. This test hangs the system. I have made no attempts to - fix the problem. From the <PERL> directory issue the following command: + fix the problem. From the <PERL> directory issue the following + command: *******CSW******** I didn't do this, and saw no problems. @@ -223,11 +234,12 @@ I didn't do this, and saw no problems. * Installing: - The install seems to work okay. There are problems when install the man - pages, but we don't need any stinkin' man pages, right? + The install seems to work okay. There are problems when install the + man pages, but we don't need any stinkin' man pages, right? *******CSW******** -the man pages that didn't install were those that had "::" in their filename. +the man pages that didn't install were those that had "::" in their +filename. ****************** - Issue the command 'make install' in the directory <PERL>. diff --git a/cygwin32/build-instructions.steven-morlock2 b/cygwin32/build-instructions.steven-morlock2 index 0370b7053c..82ff387279 100644 --- a/cygwin32/build-instructions.steven-morlock2 +++ b/cygwin32/build-instructions.steven-morlock2 @@ -1,4 +1,8 @@ -This is an addendum to Steven Morlock's original post. The patch, perl5.005_02.patch, contains the USEMYBINMODE correction described below. +This document is obsolete. Refer to README.cygwin32. + +This is an addendum to Steven Morlock's original post. +perl5.005_03-static-patch, contains the USEMYBINMODE correction described +below. ***************************** Subject: Re: HOWTO: Builiding Perl under Win95/98 using Cygwin32 @@ -12,9 +16,9 @@ details. I'd like to correct that here. There is a need to address the issue of end of lines being CR/NL or NL on the Windows platform. Cygwin32 by default converts NL to CR/NL during file I/O by non Cygwin32-savvy applications. This means that -Perl, since it does not support 'binmode' for the Cygwin32 platform, will -not be able to read & write untranslated/binary files. There are two -methods of over coming this. The first is to mount the Cygwin32 +Perl, since it does not support 'binmode' for the Cygwin32 platform, +will not be able to read & write untranslated/binary files. There are +two methods of over coming this. The first is to mount the Cygwin32 partitions in binary mode. The second is to enable binmode support in Perl. In the original post I had mounted the partition as binary and neglected to include that fact in the post. @@ -32,10 +36,10 @@ and neglected to include that fact in the post. umount / mount -b c:\\ / - You must also get and install the gzip'd version of the Perl source code - archive. The zip'd version of the archive has all NL converted to CR/NL - pairs in all text files. So you should be downloading the files ending in - '.gz', not '.zip'. + You must also get and install the gzip'd version of the Perl source + code archive. The zip'd version of the archive has all NL converted + to CR/NL pairs in all text files. So you should be downloading the + files ending in '.gz', not '.zip'. * Patching Perl to add Cygwin32 binmode support: @@ -60,7 +64,8 @@ and neglected to include that fact in the post. + */ + #define USEMYBINMODE / **/ + #define my_binmode(fp, iotype) \ -+ (PerlLIO_setmode(PerlIO_fileno(fp), O_BINARY) != -1 ? TRUE : NULL) ++ (PerlLIO_setmode(PerlIO_fileno(fp), O_BINARY) != -1 ? +TRUE : NULL) + #endif + #include "regexp.h" @@ -824,7 +824,7 @@ Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int flag) #endif #else #if defined(USEMYBINMODE) - if (my_binmode(fp,iotype) != NULL) + if (my_binmode(fp,iotype) != FALSE) return 1; else return 0; @@ -23,21 +23,8 @@ # define PERL_SYS_INIT(c,v) Perl_win32_init(c,v) # define BIT_BUCKET "nul" # else -# ifdef CYGWIN32 -# define PERL_SYS_INIT(c,v) \ - MALLOC_INIT; -# define OP_BINARY O_BINARY -# define BIT_BUCKET "nul" -# define HAS_IOCTL -# define HAS_UTIME -# define HAS_KILL -# define HAS_WAIT -# define HAS_CHOWN -# define HAS_GROUP -# else -# define PERL_SYS_INIT(c,v) -# define BIT_BUCKET "\\dev\\nul" /* "wanna be like, umm, Newlined, or somethin?" */ -# endif +# define PERL_SYS_INIT(c,v) Perl_my_setenv_init(&environ) +# define BIT_BUCKET "\\dev\\nul" /* "wanna be like, umm, Newlined, or somethin?" */ # endif #endif /* DJGPP */ diff --git a/ext/B/B/Bblock.pm b/ext/B/B/Bblock.pm index 14001b3c73..ba6293b1ff 100644 --- a/ext/B/B/Bblock.pm +++ b/ext/B/B/Bblock.pm @@ -4,7 +4,7 @@ use Exporter (); @EXPORT_OK = qw(find_leaders); use B qw(peekop walkoptree walkoptree_exec - main_root main_start svref_2object); + main_root main_start svref_2object OPf_SPECIAL OPf_STACKED); use B::Terse; use strict; @@ -17,12 +17,19 @@ sub mark_leader { $bblock->{$$op} = $op; } } +sub remove_sortblocks{ + foreach (keys %$bblock) { + my $leader = $$bblock{$_}; + delete $$bblock{$_} if ( $leader == 0); + } +} sub find_leaders { my ($root, $start) = @_; $bblock = {}; mark_leader($start) if ( ref $start ne "B::NULL" ); walkoptree($root, "mark_if_leader") if ((ref $root) ne "B::NULL") ; + remove_sortblocks(); return $bblock; } @@ -99,14 +106,16 @@ sub B::CONDOP::mark_if_leader { sub B::LISTOP::mark_if_leader { my $op = shift; - mark_leader($op->first); + my $first=$op->first; + $first=$first->next while ($first->ppaddr eq "pp_null"); #remove optimed + mark_leader($op->first) unless (exists( $bblock->{$$first})); mark_leader($op->next); + if ($op->ppaddr eq "pp_sort" && $op->flags + & OPf_SPECIAL && $op->flags & OPf_STACKED){ + my $root=$op->first->sibling->first; + my $leader=$root->first; + $bblock->{$$leader} = 0; } - -sub B::LISTOP::mark_if_leader { - my $op = shift; - mark_leader($op->first); - mark_leader($op->next); } sub B::PMOP::mark_if_leader { diff --git a/ext/B/B/C.pm b/ext/B/B/C.pm index a8f20a923d..7f2954354b 100644 --- a/ext/B/B/C.pm +++ b/ext/B/B/C.pm @@ -1262,7 +1262,7 @@ sub delete_unsaved_hashINC{ my $packname=shift; $packname =~ s/\:\:/\//g; $packname .= '.pm'; - warn "deleting $packname" if $INC{$packname} ;# debug +# warn "deleting $packname" if $INC{$packname} ;# debug delete $INC{$packname}; } sub walkpackages diff --git a/ext/B/B/CC.pm b/ext/B/B/CC.pm index d2aae923f0..059491d354 100644 --- a/ext/B/B/CC.pm +++ b/ext/B/B/CC.pm @@ -92,7 +92,9 @@ sub init_hash { map { $_ => 1 } @_ } # %skip_lexicals = init_hash qw(pp_enter pp_enterloop); %skip_invalidate = init_hash qw(pp_enter pp_enterloop); -%need_curcop = init_hash qw(pp_rv2gv pp_bless pp_repeat pp_sort pp_caller pp_reset pp_rv2cv pp_entereval pp_require pp_dofile pp_entertry pp_enterloop pp_enteriter pp_entersub pp_enter); +%need_curcop = init_hash qw(pp_rv2gv pp_bless pp_repeat pp_sort + pp_caller pp_reset pp_rv2cv pp_entereval pp_require pp_dofile + pp_entertry pp_enterloop pp_enteriter pp_entersub pp_enter); sub debug { if ($debug_runtime) { @@ -585,10 +587,44 @@ sub pp_dbstate { #sub pp_repeat { $curcop->write_back; default_pp(@_) } # The following subs need $curcop->write_back if we decide to support arybase: # pp_pos, pp_substr, pp_index, pp_rindex, pp_aslice, pp_lslice, pp_splice -#sub pp_sort { $curcop->write_back; default_pp(@_) } #sub pp_caller { $curcop->write_back; default_pp(@_) } #sub pp_reset { $curcop->write_back; default_pp(@_) } +sub pp_sort { + my $op = shift; + my $ppname = $op->ppaddr; + if ($op->flags & OPf_SPECIAL && $op->flags & OPf_STACKED){ + #this indicates the "sort BLOCK Array" case + #ugly optree surgery required. + my $root=$op->first->sibling->first; + my $start=$root->first; + $op->first->save; + $op->first->sibling->save; + $root->save; + $start->save; + my $sym=objsym($start); + my $fakeop=cc_queue("pp_sort".$$op,$root,$start); + $init->add(sprintf("($sym)->op_next=%s;",$fakeop)); + } + $curcop->write_back; + write_back_lexicals(); + write_back_stack(); + doop($op); + return $op->next; +} + +sub pp_leavesub{ + my $op = shift; + my $ppname = $op->ppaddr; + write_back_lexicals() unless $skip_lexicals{$ppname}; + write_back_stack() unless $skip_stack{$ppname}; + runtime("if (PL_curstackinfo->si_type == PERLSI_SORT) {"); + runtime("\tPUTBACK;return 0;"); + runtime("}"); + doop($op); + return $op->next; +} + sub pp_gv { my $op = shift; my $gvsym = $op->gv->save; diff --git a/ext/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL index 62a87cacac..fda7528857 100644 --- a/ext/POSIX/Makefile.PL +++ b/ext/POSIX/Makefile.PL @@ -1,7 +1,7 @@ use ExtUtils::MakeMaker; WriteMakefile( NAME => 'POSIX', - ($^O eq 'MSWin32' ? () : ($^O =~ /cygwin/ ? (LIBS => ["-lmsvcrt"]) : + ($^O eq 'MSWin32' ? () : ($^O =~ /cygwin/ ? () : (LIBS => ["-lm -lposix -lcposix"]) )), MAN3PODS => {}, # Pods will be built by installman. diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 33f9b88adb..9702923c6d 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -104,6 +104,7 @@ #else #if defined (CYGWIN32) # define tzname _tzname +# undef MB_CUR_MAX /* XXX: bug in b20.1 */ #endif #if defined (WIN32) # undef mkfifo diff --git a/hints/cygwin32.sh b/hints/cygwin32.sh index bd2dc768bd..14fb300020 100644 --- a/hints/cygwin32.sh +++ b/hints/cygwin32.sh @@ -12,17 +12,17 @@ startsh='#!/bin/sh' archname='cygwin32' cc='gcc' -libpth='/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/lib /usr/local/lib' +libpth='/usr/i586-cygwin32/lib /usr/lib /usr/local/lib' so='dll' -libs='-lcygwin -lm -lc -lkernel32' +libs='-lcygwin -lm -lkernel32' #optimize='-g' -ccflags='-DCYGWIN32' -ldflags='-L. -L/usr/local/lib' +ccflags='-DCYGWIN32 -I/usr/include -I/usr/local/include' +ldflags='-L/usr/i586-cygwin32/lib -L/usr/lib -L/usr/local/lib' usemymalloc='n' dlsrc='dl_cygwin32.xs' cccdlflags=' ' ld='ld2' -lddlflags='--export-dynamic -L. -L/usr/local/lib' +lddlflags='-L/usr/local/lib' useshrplib='true' libperl='libperl.a' dlext='dll' diff --git a/lib/Class/Struct.pm b/lib/Class/Struct.pm index d8327bc7ab..3e08e801d0 100644 --- a/lib/Class/Struct.pm +++ b/lib/Class/Struct.pm @@ -101,6 +101,7 @@ sub struct { $out = "{\n package $class;\n use Carp;\n sub new {\n"; $out .= " my (\$class, \%init) = \@_;\n"; + $out .= " \$class = __PACKAGE__ unless \@_;\n"; my $cnt = 0; my $idx = 0; diff --git a/lib/Cwd.pm b/lib/Cwd.pm index df40649a42..8a99da975a 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -209,8 +209,6 @@ sub abs_path my $start = @_ ? shift : '.'; my($dotdots, $cwd, @pst, @cst, $dir, @tst); - return cwd() if ( $^O =~ /cygwin/ ); - unless (@cst = stat( $start )) { carp "stat($start): $!"; @@ -374,6 +372,12 @@ sub _qnx_abs_path { *abs_path = \&_qnx_abs_path; *fast_abs_path = \&_qnx_abs_path; } + elsif ($^O =~ /cygwin/) { + *getcwd = \&cwd; + *fastgetcwd = \&cwd; + *fastcwd = \&cwd; + *abs_path = \&fast_abs_path; + } } # package main; eval join('',<DATA>) || die $@; # quick test diff --git a/lib/ExtUtils/MM_Cygwin.pm b/lib/ExtUtils/MM_Cygwin.pm index ffc72e349f..df4ae5983a 100644 --- a/lib/ExtUtils/MM_Cygwin.pm +++ b/lib/ExtUtils/MM_Cygwin.pm @@ -115,3 +115,8 @@ replaces strings '::' with '.' in man page names =item perl_archive points to libperl.a + +=back + +=cut + diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index 3cc3749027..db3109a099 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -77,7 +77,8 @@ sub runtests { my $blank = (' ' x 77); my $leader = "$te" . '.' x (20 - length($te)); my $ml = ""; - $ml = "\r$blank\r$leader" if -t STDOUT and not $ENV{HARNESS_NOTTY}; + $ml = "\r$blank\r$leader" + if -t STDOUT and not $ENV{HARNESS_NOTTY} and not $verbose; print $leader; my $fh = new FileHandle; $fh->open($test) or print "can't open $test. $!\n"; @@ -117,7 +118,7 @@ sub runtests { my $this = $next; if (/^not ok\s*(\d*)/){ $this = $1 if $1 > 0; - print "${ml}NOK $this\n" if $ml; + print "${ml}NOK $this" if $ml; if (!$todo{$this}) { push @failed, $this; } else { @@ -281,7 +281,7 @@ register struct op *Perl_op asm(stringify(OP_IN_REGISTER)); */ /* define this once if either system, instead of cluttering up the src */ -#if defined(MSDOS) || defined(atarist) || defined(WIN32) || defined(CYGWIN32) +#if defined(MSDOS) || defined(atarist) || defined(WIN32) #define DOSISH 1 #endif @@ -1580,6 +1580,18 @@ union any { #define ARGSproto #endif /* USE_THREADS */ +#if defined(CYGWIN32) +/* USEMYBINMODE + * This symbol, if defined, indicates that the program should + * use the routine my_binmode(FILE *fp, char iotype) to insure + * that a file is in "binary" mode -- that is, that no translation + * of bytes occurs on read or write operations. + */ +#define USEMYBINMODE / **/ +#define my_binmode(fp, iotype) \ + (PerlLIO_setmode(PerlIO_fileno(fp), O_BINARY) != -1 ? TRUE : FALSE) +#endif + typedef I32 (*filter_t) (pTHXo_ int, SV *, int); #define FILTER_READ(idx, sv, len) filter_read(idx, sv, len) @@ -1265,15 +1265,9 @@ Perl_do_readline(pTHX) sv_setpv(tmpcmd, "/dev/dosglob/"); /* File System Extension */ sv_catsv(tmpcmd, tmpglob); #else -#ifdef CYGWIN32 - sv_setpv(tmpcmd, "for a in "); - sv_catsv(tmpcmd, tmpglob); - sv_catpv(tmpcmd, "; do echo -e \"$a\\0\\c\"; done |"); -#else sv_setpv(tmpcmd, "perlglob "); sv_catsv(tmpcmd, tmpglob); sv_catpv(tmpcmd, " |"); -#endif /* !CYGWIN */ #endif /* !DJGPP */ #endif /* !OS2 */ #else /* !DOSISH */ @@ -43,6 +43,9 @@ TESTING COMPILER -------------------------------------------------------------------------------- EOT + $ENV{COMPILE_TIMEOUT} = 120 + if ($type eq 'compile' && !$ENV{COMPILE_TIMEOUT}); + $bad = 0; $good = 0; $total = @tests; @@ -55,6 +55,9 @@ TESTING COMPILER -------------------------------------------------------------------------------- EOT + $ENV{COMPILE_TIMEOUT} = 120 + if ($type eq 'compile' && !$ENV{COMPILE_TIMEOUT}); + $bad = 0; $good = 0; $total = @tests; @@ -6,13 +6,13 @@ BEGIN { chdir 't' if -d 't'; unshift @INC, '../lib'; - $ENV{PERL5LIB} = '../lib'; # so children will see it too + $ENV{PERL5LIB} = '../lib'; # so children will see it too } use lib '../lib'; use Test::Harness; -$Test::Harness::switches = ""; # Too much noise otherwise +$Test::Harness::switches = ""; # Too much noise otherwise $Test::Harness::verbose = shift if @ARGV && $ARGV[0] eq '-v'; @tests = @ARGV; @@ -21,17 +21,18 @@ $Test::Harness::verbose = shift if @ARGV && $ARGV[0] eq '-v'; Test::Harness::runtests @tests; exit(0) unless -e "../testcompile"; -%infinite = qw( - op/bop.t 1 - lib/hostname.t 1 - ); #fudge DATA for now. +%infinite = qw ( + op/bop.t 1 + lib/hostname.t 1 + ); + %datahandle = qw( - lib/bigint.t 1 - lib/bigintpm.t 1 - lib/bigfloat.t 1 - lib/bigfloatpm.t 1 - ); + lib/bigint.t 1 + lib/bigintpm.t 1 + lib/bigfloat.t 1 + lib/bigfloatpm.t 1 + ); my $dhwrapper = <<'EOT'; open DATA,"<".__FILE__; @@ -40,22 +41,26 @@ EOT @tests = grep (!$infinite{$_}, @tests); @tests = map { - my $new = $_; - if ($datahandle{$_}) { - $new .= '.t'; - local(*F, *T); - open(F,"<$_") or die "Can't open $_: $!"; - open(T,">$new") or die "Can't open $new: $!"; - print T $dhwrapper, <F>; - close F; - close T; - } - $new; - } @tests; - -print "The tests ", join(' ', keys(%infinite)), - " generate infinite loops! Skipping!\n"; -$ENV{'COMPILE_TEST'} = 1; Test::Harness::runtests @tests; + my $new = $_; + if ($datahandle{$_}) { + $new .= '.t'; + local(*F, *T); + open(F,"<$_") or die "Can't open $_: $!"; + open(T,">$new") or die "Can't open $new: $!"; + print T $dhwrapper, <F>; + close F; + close T; + } + $new; + } @tests; + +print "The tests ", join(' ', keys(%infinite)), + " generate infinite loops! Skipping!\n"; + +$ENV{'COMPILE_TEST'} = 1; +$ENV{'COMPILE_TIMEOUT'} = 120 unless $ENV{'COMPILE_TIMEOUT'}; + +Test::Harness::runtests @tests; foreach (keys %datahandle) { unlink "$_.t"; } diff --git a/t/io/openpid.t b/t/io/openpid.t index 2d3ac9f32f..334bc0d65b 100755 --- a/t/io/openpid.t +++ b/t/io/openpid.t @@ -1,4 +1,3 @@ - #!./perl ##################################################################### @@ -55,7 +54,7 @@ chomp($from_pid1 = scalar(<FH1>)); print "# child1 returned [$from_pid1]\nnot " unless $from_pid1 eq 'first process'; print "ok 5\n"; -$kill_cnt = kill STOP, $pid1; +$kill_cnt = kill 'HUP', $pid1; print "not " unless $kill_cnt == 1; print "ok 6\n"; @@ -64,7 +63,7 @@ chomp($from_pid2 = scalar(<FH2>)); print "# child2 returned [$from_pid2]\nnot " unless $from_pid2 eq 'second process'; print "ok 7\n"; -$kill_cnt = kill STOP, $pid2, $pid3; +$kill_cnt = kill 'HUP', $pid2, $pid3; print "not " unless $kill_cnt == 2; print "ok 8\n"; diff --git a/t/op/magic.t b/t/op/magic.t index 17246f6b8a..31765e2c50 100755 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -22,6 +22,7 @@ sub ok { $Is_MSWin32 = $^O eq 'MSWin32'; $Is_VMS = $^O eq 'VMS'; $Is_Dos = $^O eq 'dos'; +$Is_Cygwin = $^O =~ /cygwin/; $PERL = ($Is_MSWin32 ? '.\perl' : './perl'); print "1..35\n"; @@ -111,6 +112,11 @@ ok 18, $$ > 0, $$; if ($^O eq 'qnx') { chomp($wd = `/usr/bin/fullpath -t`); } + elsif($Is_Cygwin) { + # Cygwin turns the symlink into the real file + chomp($wd = `pwd`); + $wd =~ s#/t$##; + } else { $wd = '.'; } @@ -152,7 +158,7 @@ EOF ok 21, close(SCRIPT), $!; ok 22, chmod(0755, $script), $!; $_ = `$script`; - s/\.exe//i if $Is_Dos; + s/\.exe//i if $Is_Dos or $Is_Cygwin; s{\bminiperl\b}{perl}; # so that test doesn't fail with miniperl s{is perl}{is $perl}; # for systems where $^X is only a basename s{\\}{/}g; @@ -66,6 +66,10 @@ long lastxycount[MAXXCOUNT][MAXYCOUNT]; #endif +#if defined(HAS_FCNTL) && defined(F_SETFD) && !defined(FD_CLOEXEC) +# define FD_CLOEXEC 1 /* NeXT needs this */ +#endif + /* paranoid version of system's malloc() */ /* NOTE: Do not call the next three routines directly. Use the macros @@ -80,8 +84,9 @@ Perl_safesysmalloc(MEM_SIZE size) Malloc_t ptr; #ifdef HAS_64K_LIMIT if (size > 0xffff) { - PerlIO_printf(PerlIO_stderr(), "Allocation too large: %lx\n", size) FLUSH; - WITH_THX(my_exit(1)); + PerlIO_printf(PerlIO_stderr(), + "Allocation too large: %lx\n", size) FLUSH; + WITH_THX(my_exit(1)); } #endif /* HAS_64K_LIMIT */ #ifdef DEBUGGING @@ -1813,6 +1818,41 @@ Perl_my_setenv(pTHX_ char *nam, char *val) #endif /* PERL_USE_SAFE_PUTENV */ } +#else /* WIN32 || CYGWIN32 */ +#if defined(CYGWIN32) +/* + * Save environ of perl.exe, currently Cygwin links in separate environ's + * for each exe/dll. Probably should be a member of impure_ptr. + */ +static char ***Perl_main_environ; + +EXTERN_C void +Perl_my_setenv_init(char ***penviron) +{ + Perl_main_environ = penviron; +} + +void +my_setenv(char *nam, char *val) +{ + /* You can not directly manipulate the environ[] array because + * the routines do some additional work that syncs the Cygwin + * environment with the Windows environment. + */ + char *oldstr = environ[setenv_getix(nam)]; + + if (!val) { + if (!oldstr) + return; + unsetenv(nam); + Safefree(oldstr); + return; + } + setenv(nam, val, 1); + environ = *Perl_main_environ; /* environ realloc can occur in setenv */ + if(oldstr && environ[setenv_getix(nam)] != oldstr) + Safefree(oldstr); +} #else /* if WIN32 */ void @@ -1874,6 +1914,7 @@ Perl_my_setenv(pTHX_ char *nam,char *val) } #endif /* WIN32 */ +#endif I32 Perl_setenv_getix(pTHX_ char *nam) diff --git a/utils/perlcc.PL b/utils/perlcc.PL index afad20a2b4..3b7c2af822 100644 --- a/utils/perlcc.PL +++ b/utils/perlcc.PL @@ -48,6 +48,9 @@ $Getopt::Long::bundling_override = 1; $Getopt::Long::passthrough = 0; $Getopt::Long::ignore_case = 0; +my $pathsep = ($Config{'osname'} eq 'MSWin32')? "\\" : "/"; # MAJOR HACK. SHOULD + # BE IN Config.pm + my $options = {}; my $_fh; @@ -202,10 +205,10 @@ sub _getExecutable ($obj = $sourceprog) =~ s"@$ext"$options->{ext}"g; return(0) if (_error('equal', $obj, $sourceprog)); } - elsif (defined ($options->{'run'})) - { - $obj = "perlc$$"; - } + elsif (defined ($options->{'run'})) + { + $obj = "perlc$$"; + } else { ($obj = $sourceprog) =~ s"@$ext""g; @@ -225,17 +228,18 @@ sub _createCode { _print( "$^X -I@INC -MB::Stash -c $file\n", 36); my $stash=`$^X -I@INC -MB::Stash -c $file 2>/dev/null|tail -1`; - chomp $stash; + chomp $stash; + _print( "$^X -I@INC -MO=CC,$stash,-o$generated_cfile $file\n", 36); - $return = _run("$ -I@INC -MO=CC,$stash,-o$generated_cfile $file", 9); + $return = _run("$^X -I@INC -MO=CC,$stash,-o$generated_cfile $file", 9); $return; } else # compiling a shared object { _print( - "$ -I@INC -MO=CC,-m$final_output,-o$generated_cfile $file\n", 36); + "$^X -I@INC -MO=CC,-m$final_output,-o$generated_cfile $file\n", 36); $return = - _run("$ -I@INC -MO=CC,-m$final_output,-o$generated_cfile $file", 9); + _run("$^X -I@INC -MO=CC,-m$final_output,-o$generated_cfile $file", 9); $return; } } @@ -248,7 +252,8 @@ sub _compileCode if (@_ == 3) # just compiling a program { $return[0] = - _ccharness('static', $sourceprog, "-o", $output_executable, $generated_cfile); + _ccharness('static', $sourceprog, "-o", $output_executable, + $generated_cfile); $return[0]; } else @@ -259,7 +264,7 @@ sub _compileCode $return[0] = _ccharness('compile', $sourceprog, "-c", $generated_cfile); $return[1] = _ccharness ( - 'dynamic', + 'dynamic', $sourceprog, "-o", $shared_object, $object_file ); @@ -305,22 +310,26 @@ sub _ccharness $incdir .= " -I$options->{L}" if (defined($options->{L})); my $linkargs = ''; + my $dynaloader = ''; + my $optimize = ''; + my $flags = ''; if (!grep(/^-[cS]$/, @args)) { - my $lperl = $^O eq 'os2' ? '-llibperl' - : $^O eq 'MSWin32' ? "$Config{archlibexp}\\CORE\\perl.lib" - : '-lperl'; - my $flags = $type eq 'dynamic' ? $Config{lddlflags} : $Config{ldflags}; - $linkargs = "$flags $libdir $lperl $Config{libs}"; + my $lperl = $^O eq 'os2' ? '-llibperl' + : $^O eq 'MSWin32' ? "$Config{archlibexp}\\CORE\\perl.lib" + : '-lperl'; + + $optimize = $Config{'optimize'} =~ /-O\d/ ? '' : $Config{'optimize'}; + + $flags = $type eq 'dynamic' ? $Config{lddlflags} : $Config{ldflags}; + $linkargs = "$flags $libdir $lperl @Config{libs}"; } - my @sharedobjects = _getSharedObjects($sourceprog); - my $dynaloader = "$Config{'installarchlib'}/auto/DynaLoader/DynaLoader.a"; - my $optimize = $Config{'optimize'} =~ /-O\d/ ? '' : $Config{'optimize'}; - my $cccmd = - "$Config{cc} $Config{ccflags} $optimize $incdir @sharedobjects @args $dynaloader $linkargs"; + my $libs = _getSharedObjects($sourceprog); + my $cccmd = "$Config{cc} $Config{ccflags} $optimize $incdir " + ."@args $dynaloader $linkargs @$libs"; _print ("$cccmd\n", 36); _run("$cccmd", 18 ); @@ -330,29 +339,31 @@ sub _getSharedObjects { my ($sourceprog) = @_; my ($tmpfile, $incfile); - my (@return); + my (@sharedobjects, @libraries); local($") = " -I"; + my ($tmpprog); + ($tmpprog = $sourceprog) =~ s"(.*)[\\/](.*)"$2"; + + my $tempdir; + + if ($Config{'osname'} eq 'MSWin32') { - my ($tmpprog); - ($tmpprog = $sourceprog) =~ s"(.*)[\/\\](.*)"$2"; - my $tempdir = '/tmp'; - if ($Config{'osname'} eq 'MSWin32') { - $tempdir = $ENV{TEMP}; - $tempdir =~ s[\\][/]g; - } - $tmpfile = "$tempdir/$tmpprog.tst"; - $incfile = "$tempdir/$tmpprog.val"; + $tempdir = $ENV{TEMP}; + $tempdir =~ s[\\][/]g; } + else + { + $tempdir = "/tmp"; + } + $tmpfile = "$tempdir/$tmpprog.tst"; + $incfile = "$tempdir/$tmpprog.val"; my $fd = new FileHandle("> $tmpfile") || die "Couldn't open $tmpfile!\n"; my $fd2 = new FileHandle("$sourceprog") || die "Couldn't open $sourceprog!\n"; - my $perl = <$fd2>; # strip off header; - - print $fd -<<"EOF"; + print $fd <<"EOF"; use FileHandle; my \$fh3 = new FileHandle("> $incfile") || die "Couldn't open $incfile\\n"; @@ -366,8 +377,8 @@ EOF print $fd ( <$fd2> ); close($fd); - _print("$ -I@INC $tmpfile\n", 36); - _run("$ -I@INC $tmpfile", 9 ); + _print("$^X -I@INC $tmpfile\n", 36); + _run("$^X -I@INC $tmpfile", 9 ); $fd = new FileHandle ("$incfile"); my @lines = <$fd>; @@ -378,19 +389,18 @@ EOF my $line; my $autolib; + my @return; + foreach $line (@lines) { chomp($line); + my ($modname, $modpath) = split(':', $line); my ($dir, $file) = ($modpath=~ m"(.*)[\\/]($modname)"); - - if ($autolib = _lookforAuto($dir, $file)) - { - push(@return, $autolib); - } - } - return(@return); + if ($autolib = _lookforAuto($dir, $file)) { push(@return, $autolib); } + } + return(\@return); } sub _maketempfile @@ -416,34 +426,28 @@ sub _lookforAuto { my ($dir, $file) = @_; - my $relshared; + my ($relabs, $relshared); + my ($prefix); my $return; - ($relshared = $file) =~ s"(.*)\.pm"$1"; + ($prefix = $file) =~ s"(.*)\.pm"$1"; - my ($tmp, $modname) = ($relshared =~ m"(?:(.*)[\\/]){0,1}(.*)"s); + my ($tmp, $modname) = ($prefix =~ m"(?:(.*)[\\/]){0,1}(.*)"s); - $relshared .= - ($Config{'osname'} eq 'MSWin32')? "\\$modname.dll" : "/$modname.so"; - + $relshared = "$pathsep$prefix$pathsep$modname.$Config{so}"; + $relabs = "$pathsep$prefix$pathsep$modname$Config{_a}"; + # HACK . WHY DOES _a HAVE A '.' + # AND so HAVE NONE?? - - if (-e ($return = "$Config{'installarchlib'}/auto/$relshared") ) - { - return($return); - } - elsif (-e ($return = "$Config{'installsitearch'}/auto/$relshared")) - { - return($return); - } - elsif (-e ($return = "$dir/arch/auto/$relshared")) - { - return($return); - } - else + my @searchpaths = map("$_${pathsep}auto", @INC); + + my $path; + foreach $path (@searchpaths) { - return(undef); + if (-e ($return = "$path$relshared")) { return($return); } + if (-e ($return = "$path$relabs")) { return($return); } } + return(undef); } sub _getRegexps # make the appropriate regexps for making executables, @@ -459,7 +463,6 @@ sub _getRegexps # make the appropriate regexps for making executables, @$module_ext = ($ENV{PERL_MODULE_EXT})? split(':', $ENV{PERL_MODULE_EXT}) : ('.pm$'); - _mungeRegexp( $program_ext ); _mungeRegexp( $module_ext ); @@ -475,7 +478,6 @@ sub _mungeRegexp grep(s:\x00::g, @$regexp); } - sub _error { my ($type, @args) = @_; @@ -564,7 +566,7 @@ sub _checkopts && $options->{'gen'}) { push(@errors, -"ERROR: The options '-regex', ' -c -run', and '-o' are incompatible with '-gen'. +"ERROR: The options '-regex', '-run', and '-o' are incompatible with '-gen'. '-gen' says to stop at C generation, and the other three modify the compilation and/or running process!\n"); } @@ -679,20 +681,74 @@ sub _run my $doreg = (($regflag & $options->{'verbose'}) || $flag == -1); if ($doreg && !$dolog) - { system("$command"); } - + { + print _interruptrun("$command"); + } elsif ($doreg && $dolog) - { my $text = `$command 2>&1`; print $_fh $text; print STDERR $text;} + { + my $text = _interruptrun($command); + print $_fh $text; + print STDERR $text; + } else - { my $text = `$command 2>&1`; print $_fh $text; } + { + my $text = _interruptrun($command); + print $_fh $text; + } } else { - `$command 2>&1`; + _interruptrun($command); } return($?); } +sub _interruptrun +{ + my ($command) = @_; + my $pid = open (FD, "$command 2>&1 |"); + + local($SIG{HUP}) = sub { +# kill 9, $pid + 1; +# HACK... 2>&1 doesn't propogate +# kill, comment out for quick and dirty +# process killing of child. + + kill 9, $pid; + exit(); + }; + local($SIG{INT}) = sub { +# kill 9, $pid + 1; +# HACK... 2>&1 doesn't propogate +# kill, comment out for quick and dirty +# process killing of child. + kill 9, $pid; + exit(); + }; + + my $needalarm = + ($ENV{'COMPILE_TIMEOUT'} && + $Config{'osname'} ne 'MSWin32' && $command =~ m"^perlc"); + my $text; + + eval + { + local($SIG{ALRM}) = sub { die "INFINITE LOOP"; }; + alarm($ENV{'COMPILE_TIMEOUT'}) if ($needalarm); + $text = join('', <FD>); + alarm(0) if ($needalarm); + }; + + if ($@) + { + eval { kill 'HUP', $pid; }; + _print("SYSTEM TIMEOUT (infinite loop?)\n", 36); + } + + close(FD); + return($text); +} + sub _usage { _print @@ -708,7 +764,7 @@ Usage: $0 <file_list> -o < explicit name of resulting executable > -e < to compile 'one liners'. Need executable name (-o) or '-run'> -regex < rename regex, -regex 's/\.p/\.exe/' compiles a.p to a.exe > - -verbose < verbose level (1-63, or following letters 'gatfcd' > + -verbose < verbose level < 1-63, or following letters 'gatfcd' > -argv < arguments for the executables to be run via '-run' or '-e' > Boolean flags @@ -893,7 +949,7 @@ indicate a perl program, and: .pm$ indicate a library, for the purposes of creating executables. And furthermore, -by default, these extensions will be replaced (and dropped ) in the process of +by default, these extensions will be replaced (and dropped) in the process of creating an executable. To change the extensions which are programs, and which are modules, set the |