From 1cab015a482fdf2a2c78aa5bae65199be3b5e3c8 Mon Sep 17 00:00:00 2001 From: "Fifer, Eric" Date: Wed, 2 Jun 1999 16:16:05 +0100 Subject: [PATCH] cygwin32 update Message-Id: <71E287AB0D94D111BBD600600849EC8185EDD9@POST> Subject: [ID 19990602.003] perl5.005_03 (CORE) cygwin32 port p4raw-id: //depot/perl@3582 --- Configure | 20 +- Makefile.SH | 2 +- README.cygwin32 | 431 +++++++++++++++++++++++++--- cygwin32/Makefile.SHs | 21 +- cygwin32/build-instructions.READFIRST | 28 +- cygwin32/build-instructions.charles-wilson | 96 +++++-- cygwin32/build-instructions.sebastien-barre | 9 +- cygwin32/build-instructions.steven-morlock | 100 ++++--- cygwin32/build-instructions.steven-morlock2 | 23 +- doio.c | 2 +- dosish.h | 17 +- ext/POSIX/Makefile.PL | 2 +- ext/POSIX/POSIX.xs | 1 + hints/cygwin32.sh | 10 +- lib/Cwd.pm | 8 +- lib/ExtUtils/MM_Cygwin.pm | 5 + perl.h | 14 +- pp_hot.c | 6 - t/op/magic.t | 8 +- util.c | 36 +++ 20 files changed, 667 insertions(+), 172 deletions(-) diff --git a/Configure b/Configure index 1fca209..ca02f73 100755 --- a/Configure +++ b/Configure @@ -4368,18 +4368,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 0c02a43..bd64d77 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 7c44dbe..9ca078f 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 are B 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 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 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 ('Bthers') will +never be allowed write access, but owner ('Bser') and Broup B +be allowed write access. Everybody (u, g, and o) Bbe allowed +read access. + +In any case, Corinna Vinschen's ntsec patches B 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 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 /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 =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 a675d74..e4beabe 100644 --- a/cygwin32/Makefile.SHs +++ b/cygwin32/Makefile.SHs @@ -29,6 +29,24 @@ $spitshell >>Makefile <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 <>Makefile < 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 /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 /perlld to fix this problem. If you are interested, - write me. + modifying /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 directory as described in the document - /README.cygwin32 + - Run the Configure in the directory as described in the + document /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 /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 directory issue the following command: + fix the problem. From the 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 . diff --git a/cygwin32/build-instructions.steven-morlock2 b/cygwin32/build-instructions.steven-morlock2 index 0370b70..82ff387 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" diff --git a/doio.c b/doio.c index 92a463c..cef75fe 100644 --- a/doio.c +++ b/doio.c @@ -819,7 +819,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; diff --git a/dosish.h b/dosish.h index 4116dec..c936250 100644 --- a/dosish.h +++ b/dosish.h @@ -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/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL index 62a87ca..fda7528 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 33f9b88..9702923 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 bd2dc76..14fb300 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/Cwd.pm b/lib/Cwd.pm index df40649..8a99da9 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('',) || die $@; # quick test diff --git a/lib/ExtUtils/MM_Cygwin.pm b/lib/ExtUtils/MM_Cygwin.pm index ffc72e3..df4ae59 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/perl.h b/perl.h index f61ff9b..3b13318 100644 --- a/perl.h +++ b/perl.h @@ -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 @@ -1576,6 +1576,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) diff --git a/pp_hot.c b/pp_hot.c index 3c91b00..d3a1f5c 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -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 */ diff --git a/t/op/magic.t b/t/op/magic.t index 17246f6..31765e2 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; diff --git a/util.c b/util.c index 687c5a3..c54162c 100644 --- a/util.c +++ b/util.c @@ -1818,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 @@ -1879,6 +1914,7 @@ Perl_my_setenv(pTHX_ char *nam,char *val) } #endif /* WIN32 */ +#endif I32 Perl_setenv_getix(pTHX_ char *nam) -- 2.7.4