diff options
41 files changed, 1149 insertions, 786 deletions
@@ -4342,11 +4342,13 @@ echo "Your cpp writes the filename in the $pos field of the line." $cat >findhdr <<EOF $startsh wanted=\$1 -name='' -if test -f $usrinc/\$wanted; then - echo "$usrinc/\$wanted" - exit 0 -fi +for usrincdir in $usrinc +do + if test -f \$usrincdir/\$wanted; then + echo "\$usrincdir/\$wanted" + exit 0 + fi +done awkprg='{ print \$$fieldn }' echo "#include <\$wanted>" > foo\$\$.c $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \ @@ -4354,7 +4356,7 @@ $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='';; esac; done; @@ -40,10 +40,17 @@ # define dEXTCONST const # endif # else -# define EXT extern -# define dEXT -# define EXTCONST extern const -# define dEXTCONST const +# if defined(CYGWIN32) && defined(USEIMPORTLIB) +# define EXT extern __declspec(dllimport) +# define dEXT +# define EXTCONST extern __declspec(dllimport) const +# define dEXTCONST const +# else +# define EXT extern +# define dEXT +# define EXTCONST extern const +# define dEXTCONST const +# endif # endif #endif @@ -72,11 +72,15 @@ configure.com Configure-equivalent for VMS configure.gnu Crude emulation of GNU configure cop.h Control operator header cv.h Code value header -cygwin32/cw32imp.h Cygwin32 port -cygwin32/gcc2 Cygwin32 port -cygwin32/ld2 Cygwin32 port -cygwin32/perlgcc Cygwin32 port -cygwin32/perlld Cygwin32 port +cygwin32/Makefile.SHs Shared library generation for Cygwin32 port +cygwin32/ld2.in ld wrapper template for Cygwin32 port +cygwin32/perlld.in dll generator template for Cygwin32 port +cygwin32/impure_ptr.c impure pointer stub for dlls +cygwin32/build-instructions.charles-wilson Cygwin32 porters notes +cygwin32/build-instructions.READFIRST Cygwin32 porters notes +cygwin32/build-instructions.steven-morlock2 Cygwin32 porters notes +cygwin32/build-instructions.sebastien-barre Cygwin32 porters notes +cygwin32/build-instructions.steven-morlock Cygwin32 porters notes deb.c Debugging routines djgpp/config.over DOS/DJGPP port djgpp/configure.bat DOS/DJGPP port diff --git a/Makefile.SH b/Makefile.SH index ae96f3013d..aa0e3f278e 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -46,6 +46,9 @@ true) rhapsody*) ldlibpth="DYLD_LIBRARY_PATH=`pwd`/Perl:$DYLD_LIBRARY_PATH" ;; + cygwin*) ldlibpth="PATH=`pwd`:$PATH" + linklibperl="-lperl" + ;; os2*) # OS/2 doesn't need anything special for LD_LIBRARY_PATH. ldlibpth='' ;; @@ -296,11 +299,20 @@ ext.libs: $(static_ext) # How to build libperl. This is still rather convoluted. # Load up custom Makefile.SH fragment for shared loading and executables: -if test -r $osname/Makefile.SHs ; then - . $osname/Makefile.SHs +case "$osname" in +cygwin*) + Makefile_s="cygwin32/Makefile.SHs" + ;; +*) + Makefile_s="$osname/Makefile.SHs" + ;; +esac + +if test -r $Makefile_s ; then + . $Makefile_s $spitshell >>Makefile <<!GROK!THIS! -Makefile: $osname/Makefile.SHs +Makefile: $Makefile_s !GROK!THIS! else $spitshell >>Makefile <<'!NO!SUBS!' diff --git a/README.cygwin32 b/README.cygwin32 index 3b89e52d46..fee1fb3bee 100644 --- a/README.cygwin32 +++ b/README.cygwin32 @@ -1,28 +1,93 @@ -The following assumes you have the GNU-Win32 package, version b17.1 or -later, installed and configured on your system. See -http://www.cygnus.com/misc/gnu-win32/ for details on the GNU-Win32 -project and the Cygwin32 API. +If you read this file _as_is_, just ignore the funny characters you +see. It is written in the POD format (see pod/perlpod.pod) which is +specially designed to be readable as is. -1) Copy the contents of the cygwin32 directory to the Perl source - root directory. +=head1 NAME -2) Modify the ld2 and gcc2 scripts by making the PERLPATH variable contain - the Perl source root directory. For example, if you extracted perl to - "/perl5.005", change the scripts so they contain the line: +README.cygwin32 - notes about porting Perl to Cygwin32 - PERLPATH=/perl5.005 +=head1 SYNOPSIS -3) Copy the two scripts ld2 and gcc2 from the cygwin32 subdirectory to a - directory in your PATH environment variable. For example, copy to - /bin, assuming /bin is in your PATH. (These two scripts are 'wrapper' - scripts that encapsulate the multiple-pass dll building steps used by - GNU-Win32 ld/gcc.) +=over -4) Run the perl Configuration script as stated in the perl README file: +=item Cygwin32 - sh Configure + 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 +http://sourceware.cygnus.com/cygwin/ - When confronted with this prompt: + Cygnus Solutions also made the first set of notes and tools for +building perl under Cygwin32 beta17. + +=item als + +no, i am not hunting the patch pumpkin. i just wanted to have working +non-ActiveState perl binaries for Windows NT that can load dynamic +extensions. after several days of internet searching i went to conclusion +that the most promising way is to build it myself. i was wrong. + +=back + +=head1 BUILDING + +=head2 Prerequisites + +=over + +=item Cygwin b20.1 + +since you are willing to build things yourself, you are supposed to use +not-so-archaic tools. the latest stable Cygwin suite is beta20.1. it may be +downloaded from ftp://go.cygnus.com/pub/sourceware.cygnus.com/cygwin/latest/ +or many mirror sites around the world. + +=item egcs-1.1.2 + +i've tried to build with egcs-1.1 that comes with cygwin b20.1, and +had no luck. maybe, if a week ago i was as experienced as now, +things would go different... maybe. but this port was built with +egcs-1.1.2 downloaded from +ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin/egcs-1.1.2/ + +=item my patches + +if you are reading this, those are probably applied already. + +=item crypt library + +you do not want to see messages about excessive paranoia, do you? +well, http://miracle.geol.msu.ru/sos/ points to two different crypt +libraries ported to cygwin. i used libcrypt.tgz by Andy Piper. +his home page can be found at http://www.xemacs.freeserve.co.uk/ + +=item environment + +the locations of cygwin instllation are, well, a little unusual. +Configure will run smoother if you make more common aliases for cygwin +directories. it can be made either by C<mount>ing or by creating +directory symlinks like this: + +ln -s /cygnus/cygwin-b20/H-i586-cygwin32/bin/ $prefix/bin +ln -s /cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/include/ \ + $prefix/include +ln -s /cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/lib/ $prefix/lib + +$prefix may be empty (root), /usr, or /usr/local, as you preffer. +i used /usr. futhermore, t/io/taint.t requires cygwin1.dll to be +present in build directory or somewhere in system path (/WINNT, +/WINNT/System, /WINNT/System32). + +=back + +=head2 Configure + +run "sh Configure". + +When confronted with this prompt: + +=begin text First time through, eh? I have some defaults handy for the following systems: @@ -31,29 +96,76 @@ project and the Cygwin32 API. . Which of these apply, if any? - Select "cygwin32". +=end text + +guess what system do you have. (hint: select "cygwin32"). + +i do not use malloc that comes with perl, but haven't put this setting +to hints file. perl defaults to use own malloc. + +Configure proposes additional -fpic flag for shared library module +compilation. say "none" because gcc complains that -fpic is useless. + +i hope that further defaults are ok. please double-chek it. + +=head2 make + +run "make". after that, run "make test" to see how unstable your system is. +for me, lib/io_sock.t waits for died child that has to be killed manually. +other test scripts seem to be more or less harmless. the result of +./perl harness reads: + +=begin text + +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 1 256 5 4 80.00% 2-5 +lib/sdbm.t 2 512 18 15 83.33% 2, 5-18 +op/magic.t 35 3 8.57% 1, 23, 30 +op/stat.t 58 3 5.17% 2, 9, 26 +pragma/locale.t 11 2816 102 4 3.92% 99-102 +8 tests skipped, plus 35 subtests skipped. +Failed 7/190 test scripts, 96.32% okay. 38/6454 subtests failed, 99.41% okay. + +=end text + +=head1 BUGS + +a lot of warnings about incompatible pointer types and comparison +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. + +as said above, IO::Socket generates access violation. don't know why. +don't need IO::Socket for now. + +make clean does not remove library .def and .exe.core files + +ld2 script is installed with reference to source directory. you should +change this to /usr/local/bin (or whatever) after install. + +.bat wrappers for installed utility scripts are not made during installation. - The defaults should be OK for everything, except for the specific - pathnames for the cygwin32 libs, include files, installation dirs, - etc. on your system; answer those questions appropriately. +library man pages are not installed correctly due to file system limitations. +use perldoc script to read about things like foo::bar. - NOTE: On windows 95, the configuration script only stops every other - time for responses from the command line. In this case you can manually - copy hints/cygwin32.sh to config.sh, edit config.sh for your paths, and - run Configure non-interactively using sh Configure -d. +=head1 AUTHOR -5) Run "make" as stated in the perl README file. +alexander smishlajev <als@turnhere.com> -6) Run "make test". Some tests will fail, but you should get around a - 83% success rate. (Most failures seem to be due to Unixisms that don't - apply to win32.) +=head1 DISCLAIMER -7) Install. If you just run "perl installperl", it appears that perl - can't find itself when it forks because it changes to another directory - during the install process. You can get around this by invoking the - install script using a full pathname for perl, such as: +i 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. - /perl5.004/perl installperl +=head1 HISTORY - This should complete the installation process. +17..25-apr-1999. perl 5.005_03. cygwin b20.1 egcs 1.1.2. + far 1.60. nescafe classic. +=cut @@ -4,7 +4,13 @@ # ifdef PERL_OBJECT # define XS(name) void name(CV* cv, CPerlObj* pPerl) # else -# define XS(name) void name(CV* cv) +# if defined(CYGWIN32) && defined(USE_DYNAMIC_LOADING) +# define XS(name) __declspec(dllexport) void name(CV* cv) + extern struct _reent *_impure_ptr; + void impure_setup(struct _reent *_impure_ptrMain); +# else +# define XS(name) void name(CV* cv) +# endif # endif #else # define XS(name) void name(cv) CV* cv; @@ -76,7 +76,10 @@ for file do : allow variables like toke_cflags to be evaluated - eval 'eval ${'"${file}_cflags"'-""}' + if echo $file | grep -v / >/dev/null + then + eval 'eval ${'"${file}_cflags"'-""}' + fi : or customize here diff --git a/config_h.SH b/config_h.SH index f933c78d23..00388e0fa6 100644 --- a/config_h.SH +++ b/config_h.SH @@ -1449,17 +1449,17 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- * This macro surrounds its token with double quotes. */ #if $cpp_stuff == 1 -#define CAT2(a,b)a/**/b -#define STRINGIFY(a)"a" +# define CAT2(a,b)a/**/b +# define STRINGIFY(a)"a" /* If you can get stringification with catify, tell me how! */ -#endif -#if $cpp_stuff == 42 -#define CAT2(a,b)a ## b -#define StGiFy(a)# a -#define STRINGIFY(a)StGiFy(a) -#endif -#if $cpp_stuff != 1 && $cpp_stuff != 42 -#include "Bletch: How does this C preprocessor catenate tokens?" +#else +# if $cpp_stuff == 42 +# define CAT2(a,b)a ## b +# define StGiFy(a)# a +# define STRINGIFY(a)StGiFy(a) +# else +# include "Bletch: How does this C preprocessor catenate tokens?" +# endif #endif /* CPPSTDIN: diff --git a/cygwin32/Makefile.SHs b/cygwin32/Makefile.SHs new file mode 100644 index 0000000000..fcbc318022 --- /dev/null +++ b/cygwin32/Makefile.SHs @@ -0,0 +1,176 @@ +# This file is read by Makefile.SH to produce rules for $(LIBPERL) (and +# some additional rules as well). + +# Rerun `sh Makefile.SH; make depend' after making any change. + +# Additional rules supported: libperls.a (for static linking), +# ld2, perlld (dynamic linking tools) +# + +#! /bin/sh +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac + +addtopath=`pwd` +$spitshell >>Makefile <<!GROK!THIS! + +# shell script feeding perlld to decent perl +ld2: $& Makefile perlld ${src}/cygwin32/ld2.in ${src}/impure_ptr\$(OBJ_EXT) + @echo "extracting ld2 (with variable substitutions)" + @$sed s,@buildpath@,$addtopath,g <${src}/cygwin32/ld2.in >ld2 +!GROK!THIS! + +$spitshell >>Makefile <<!GROK!THIS! + +# perlld parameters +# +# this one is pretty mandatory +DLLWRAP = 'dllwrap' + +# following are optional. +WRAPDRIVER = gcc +DLLTOOL = dlltool +EXPORT_ALL = 1 + +# if some of extensions are empty, +# no corresponding output will be done. +# most probably, you'd like to have an export library +DEF_EXT = .def +EXP_EXT = .exp + +perlld: $& Makefile ${src}/cygwin32/perlld.in ${src}/impure_ptr\$(OBJ_EXT) + @echo "extracting perlld (with variable substitutions)" + @$sed -e s,@CC@,\${CC}, -e s,@DLLWRAP@,\${DLLWRAP},g \\ + -e s,@WRAPDRIVER@,\${WRAPDRIVER},g -e s,@DLLTOOL@,\${DLLTOOL},g \\ + -e s,@AS@,\${AS},g -e s,@EXPORT_ALL@,\${EXPORT_ALL},g \\ + -e s,@DEF_EXT@,\${DEF_EXT},g -e s,@EXP_EXT@,\${EXP_EXT},g \\ + -e s,@LIB_EXT@,\${LIB_EXT},g \\ + ${src}/cygwin32/perlld.in >perlld + +!GROK!THIS! + +# make sure that all library names are not malformed +libperl=`echo $libperl|sed -e s,\\\..*,,` + +# it would be nice to allow dll to have any name, +# but for now i insist on 'lib<whatever>.dll' +if ( ! ( echo $libperl | grep '^lib' >/dev/null ) ) +then + libperl=lib$libperl +fi +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 +!GROK!THIS! + +case "$useshrplib" in +true) + $spitshell >>Makefile <<'!NO!SUBS!' +# impure pointer initialisation +cwobj = impure_ptr$(OBJ_EXT) $(obj) + +# override default rule (NB: make croaks!) to force dll usage +perlmain$(OBJ_EXT): perlmain.c + $(CCCMD) $(PLDLFLAGS) -DUSEIMPORTLIB=\"$(LIBPERL)$(LIB_EXT)\" $*.c + +# library used to make statically linked executables +# miniperl is linked against it to avoid libperl.dll locking +$(LIBPERL)s$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) + $(AR) rcu $@ perl$(OBJ_EXT) $(cwobj) + +impure_ptr$(OBJ_EXT): cygwin32/impure_ptr.c + $(CCCMD) $(PLDLFLAGS) cygwin32/impure_ptr.c + +# dll and import library +$(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) ld2 + $(LDLIBPTH) ld2 $(SHRPLDFLAGS) -o $(LIBPERL)$(DLSUFFIX) \ + perl$(OBJ_EXT) $(cwobj) $(libs) + +# How to build executables. + +# The miniperl -w -MExporter line is a basic cheap test to catch errors +# before make goes on to run preplibrary and then MakeMaker on extensions. +# This is very handy because later errors are often caused by miniperl +# build problems but that's not obvious to the novice. +# The Module used here must not depend on Config or any extensions. + +miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)s$(LIB_EXT) + $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(LLIBPERL)s $(libs) + $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest + +!NO!SUBS! + ;; +*) +$spitshell >>Makefile <<'!NO!SUBS!' + +# perl library +$(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) + $(AR) rcu $@ perl$(OBJ_EXT) $(cwobj) + +# How to build executables. + +# The miniperl -w -MExporter line is a basic cheap test to catch errors +# before make goes on to run preplibrary and then MakeMaker on extensions. +# This is very handy because later errors are often caused by miniperl +# build problems but that's not obvious to the novice. +# The Module used here must not depend on Config or any extensions. + +miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) + $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(LLIBPERL) $(libs) + $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest + +!NO!SUBS! + ;; +esac + +# libperl.a is _the_ library both in dll and static cases +# $(LIBPERL)$(LIB_EXT) expands to this name dependless of build model +# +$spitshell >>Makefile <<'!NO!SUBS!' + +perl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + +pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + +purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + +quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + +!NO!SUBS! + +# suid perl is removed - i've never seen suid scripts for win32 + +############################################## +# additional targets + +$spitshell >>Makefile <<'!NO!SUBS!' + +DIST_DIRECTORY = .dist + +distdir: miniperl + -mkdir $(DIST_DIRECTORY) + ./miniperl '-MExtUtils::Manifest' \ + -e "ExtUtils::Manifest::manicopy(ExtUtils::Manifest::maniread(),'$(DIST_DIRECTORY)')" + +!NO!SUBS! diff --git a/cygwin32/build-instructions.READFIRST b/cygwin32/build-instructions.READFIRST new file mode 100644 index 0000000000..4cdd1990d7 --- /dev/null +++ b/cygwin32/build-instructions.READFIRST @@ -0,0 +1,37 @@ +The perl source distribution is available from + http://www.cpan.org/src/index.html + +For the easiest build of perl under Cygwin, do the following: + +(1) read + *(a) README.cygwin from the perl source distribution + *(b) read build-instructions.charles-wilson + (b) read build-instructions.sebastien-barre + (c) read build-instructions.steven-morlock + (d) read build-instructions.steven-morlock2 + (e) read build-instructions.teun-burgers + +(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/ + (c) cd /usr/local/src/perl5.005_03 + (d) chmod -R +w * + (e) patch -p1 < perl5.005_03.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 + (automatically does a make depend) + +(4) build and install + (b) make + (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. + +* MUST read. + diff --git a/cygwin32/build-instructions.charles-wilson b/cygwin32/build-instructions.charles-wilson new file mode 100644 index 0000000000..e758d34d23 --- /dev/null +++ b/cygwin32/build-instructions.charles-wilson @@ -0,0 +1,71 @@ +DATE: 2 April 99 + +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. + +(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. + + +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. + +RESULTS: make test +------------------ + +Failed 4 test scripts out of 190, 92.63% okay. +u=2.143 s=4.897 cu=120.165 cs=159.697 scripts=180 tests=6430 + +RESULTS: ./perl harness +----------------------- +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%) +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 + 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/gdbm............skipping test on this platform +lib/ipc_sysv........skipping test on this platform +lib/ndbm............skipping test on this platform +lib/odbm............skipping test on this platform +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. diff --git a/cygwin32/build-instructions.sebastien-barre b/cygwin32/build-instructions.sebastien-barre new file mode 100644 index 0000000000..3e29b35d66 --- /dev/null +++ b/cygwin32/build-instructions.sebastien-barre @@ -0,0 +1,69 @@ +The included patch, perl5.005_02.patch, implements all of the suggestions below. Results in a static build, 93.85% successful test on NT. + + +********************************** +Subject: Re: Compiling Perl under b20.1 + Date: Fri, 05 Mar 1999 16:41:52 +0100 + From: Sebastien Barre <Sebastien.Barre@utc.fr> + To: Allan Peda <allan@interport.net> + CC: Cygwin Mailing List <cygwin@sourceware.cygnus.com> + +At 22:04 04/03/99 -0500, Allan Peda wrote: + +>Has there been much success with this? I've done it with MSVC + nmake, +>but I'd get more of a thrill using cygwin. + +I did (5.005_002 static build, 91.4% successfull test). + +As many people from this list helped me, I'd glad to offer the same. + +Basically, + +*) Read the README.cywin32 + +*) Edit the hints/cygwin32.sh file to reflect your paths. + +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' +i_stdarg='define' +i_varargs='undef' +osname='cygwin_nt-4.0' +osvers='20.1' +archname='cygwin32' +signal_t='int' +d_voidsig='define' +i_sysselct='undef' +signal_t='void' + +*) Browse Usenet archives (DejaNews), and find "HOWTO: Builiding Perl +under Win95/98 using Cygwin32 " +Steven Morlock <newspost@morlock.net> +1998/12/21 +comp.lang.perl.misc + +*) Then apply this patch (Thanks to Todd Goodman) + +This is my change in Cwd.pm: +--- cwd.pm Fri Feb 26 21:52:42 1999 ++++ cwd.pm.orig Fri Jan 22 20:49:54 1999 +@@ -208,8 +208,6 @@ + my $start = @_ ? shift : '.'; + my($dotdots, $cwd, @pst, @cst, $dir, @tst); + +- return cwd() if ( $^O =~ /cygwin/ ); +- + unless (@cst = stat( $start )) + { + +And tell me (email) if it fails. + +______________________________________________________________ +Sebastien Barre http://www.hds.utc.fr/~barre/ + +-- +Want to unsubscribe from this list? +Send a message to cygwin-unsubscribe@sourceware.cygnus.com + + diff --git a/cygwin32/build-instructions.steven-morlock b/cygwin32/build-instructions.steven-morlock new file mode 100644 index 0000000000..58d19936c3 --- /dev/null +++ b/cygwin32/build-instructions.steven-morlock @@ -0,0 +1,235 @@ +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****** + + +************************************** +Subject: HOWTO: Builiding Perl under Win95/98 using Cygwin32 +Author: Steven Morlock <newspost@morlock.net> +Date: 1998/12/21 +Forum: comp.lang.perl.misc + +If you have a desire to build Perl under Windows 95/98 using Cygnus' +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. + +Steve + +-- +Steven Morlock +Foliage Software Systems +aka The Nerd Farm +http://www.foliage.com +== + +These are the steps I took to build the latest development +version of Perl (5.005.53) under the Windows 95 & Window 98 +operating system using Cygnus' Cygwin Win32 ports of the GNU +development tools. + +The release of the Cygwin32 tools used was B20.1. These tools +can be found at: + + http://sourceware.cygnus.com/cygwin + +Install Cygwin32 as described on the Cygnus web site. Additionally +you should mount /bin as described in the following document: + + http://sourceware.cygnus.com/cygwin/cygwin-ug-net/setup-mount.html + +Note that the mount command shown in their example should appear on a +single line: + + mount C:/cygnus/cygwin-b20/H-i586-cygwin32/bin /bin + +You must run the described build process below under the Cygwin32 +'bash' shell. + +In the following <PERL> will refer to the perl source/build +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. + + - Following the instructions in <PERL>/README.cygwin32: +*******CSW******** +apply the patch, first +****************** + + + Copy the contents of the <PERL>cygwin32 directory to <PERL> + + + Edit the 'ld2' & 'gcc2' scripts to reflect the build path <PERL> + + + Either move 'ld2' & 'gcc2' to a directory on your path or add + <PERL> to you path. + + - Edit <PERL>/hints/cygwin32.sh: + + + Add the following lines to the script: +*******CSW******** +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. + + + 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 +****************** + usedl='n' + + 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. + + + Change the path to the Cygwin32 directories. This includes the + 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: +*******CSW******** +and this, as well \/ +****************** + +*** makedepend.SH.ORIG Wed Sep 23 09:51:56 1998 +--- makedepend.SH Mon Dec 21 09:27:30 1998 +*************** +*** 100,105 **** +--- 100,107 ---- + # for file in `cat /dev/null`; do + if [ "$osname" = uwin ]; then + uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g" ++ elif [ "$archname" = cygwin32 ]; then ++ uwinfix="-e s,\\\\\\\\,/,g" + else + uwinfix= + fi + + - 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: +*******CSW******** +the patch does this, too +****************** + +*** config_h.SH.ORIG Wed Oct 28 23:16:10 1998 +--- config_h.SH Mon Dec 21 10:14:28 1998 +*************** +*** 1412,1416 **** + #endif + #if $cpp_stuff != 1 && $cpp_stuff != 42 +! #include "Bletch: How does this C preprocessor catenate tokens?" + #endif + +--- 1412,1416 ---- + #endif + #if $cpp_stuff != 1 && $cpp_stuff != 42 +! #include "#Bletch: How does this C preprocessor catenate tokens?" + #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': + + 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. + 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 + + 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' + + You can use the defaults for the remainder of the prompts. + +* Building: + + - Issue the command 'make' in the directory <PERL>. + Cross fingers, wait and be patient. + +*******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: + + `sh cflags libperl.a pp_sys.o` pp_sys.c + `sh cflags libperl.a doio.o` doio.c + + This appears to be a problem with Cygwin32's make. + + Hopefully if you follow the instructions above you will experience no + problems building Perl. + +* 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. + +*******CSW******** +saw the "missing dll" during one test +****************** + + As long as I can run all my own scripts, things are fine by me... + + - 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: + +*******CSW******** +I didn't do this, and saw no problems. +****************** + + mv t/lib/io_sock.t t/lib/io_sock.t.ORIG + + - Issue the command 'make test' in the directory <PERL>. + Cross fingers, wait and be patient. + +* 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? + +*******CSW******** +the man pages that didn't install were those that had "::" in their filename. +****************** + + - Issue the command 'make install' in the directory <PERL>. + +Configuration files available by request to perl@morlock.net diff --git a/cygwin32/build-instructions.steven-morlock2 b/cygwin32/build-instructions.steven-morlock2 new file mode 100644 index 0000000000..0370b7053c --- /dev/null +++ b/cygwin32/build-instructions.steven-morlock2 @@ -0,0 +1,76 @@ +This is an addendum to Steven Morlock's original post. The patch, perl5.005_02.patch, contains the USEMYBINMODE correction described below. + +***************************** +Subject: Re: HOWTO: Builiding Perl under Win95/98 using Cygwin32 +Author: Steven Morlock <newspost@morlock.net> +Date: 1998/12/22 +Forum: comp.lang.perl.misc + +I realized that in my original post I left out a couple important +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 +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. + +* Using a binary partition: + + Mount the Perl source & installation destination partitions in binary + mode. Refer to the Cygnus documentation on 'mount' for details: + + http://sourceware.cygnus.com/cygwin/cygwin-ug-net/mount.html + + On my system since everything was in the root partition I issued the + following commands from the bash shell: + + 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'. + +* Patching Perl to add Cygwin32 binmode support: + + For this method you can use either the gzip'd or zip'd version of the + Perl source archive. + + Apply the following patch to <PERL>/perl.h: + +*** perl.h.ORIG Tue Dec 22 09:22:42 1998 +--- perl.h Tue Dec 22 09:43:10 1998 +*************** +*** 1480,1483 **** +--- 1480,1495 ---- + #endif + ++ #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 : NULL) ++ #endif ++ + #include "regexp.h" + #include "sv.h" + +Regards, +Steve + +-- +Steven Morlock +Foliage Software Systems +aka The Nerd Farm +http://www.foliage.com diff --git a/cygwin32/cw32imp.h b/cygwin32/cw32imp.h deleted file mode 100644 index 885cbb1202..0000000000 --- a/cygwin32/cw32imp.h +++ /dev/null @@ -1,355 +0,0 @@ -/* include file for building of extension libs using GNU-Win32 toolkit, - which is based on the Cygnus Cygwin32 API. This file is included by - the extension dlls when they are built. Global vars defined in perl - exe are referenced by the extension module dll by using __imp_varName, - where varName is the name of the global variable in perl.exe. - GNU-Win32 has no equivalent to MSVC's __declspec(dllimport) keyword to - define a imported global, so we have to use this approach to access - globals exported by perl.exe. - -jc 4/1/97 -*/ - -#define impure_setupptr (*__imp_impure_setupptr) -#define Perl_reall_srchlen (*__imp_Perl_reall_srchlen) -#define Perl_yychar (*__imp_Perl_yychar) -#define Perl_yycheck (*__imp_Perl_yycheck) -#define Perl_yydebug (*__imp_Perl_yydebug) -#define Perl_yydefred (*__imp_Perl_yydefred) -#define Perl_yydgoto (*__imp_Perl_yydgoto) -#define Perl_yyerrflag (*__imp_Perl_yyerrflag) -#define Perl_yygindex (*__imp_Perl_yygindex) -#define Perl_yylen (*__imp_Perl_yylen) -#define Perl_yylhs (*__imp_Perl_yylhs) -#define Perl_yylval (*__imp_Perl_yylval) -#define Perl_yynerrs (*__imp_Perl_yynerrs) -#define Perl_yyrindex (*__imp_Perl_yyrindex) -#define Perl_yysindex (*__imp_Perl_yysindex) -#define Perl_yytable (*__imp_Perl_yytable) -#define Perl_yyval (*__imp_Perl_yyval) -#define Perl_regarglen (*__imp_Perl_regarglen) -#define Perl_regdummy (*__imp_Perl_regdummy) -#define Perl_regkind (*__imp_Perl_regkind) -#define Perl_simple (*__imp_Perl_simple) -#define Perl_varies (*__imp_Perl_varies) -#define Perl_watchaddr (*__imp_Perl_watchaddr) -#define Perl_watchok (*__imp_Perl_watchok) -#define Argv (*__imp_Argv) -#define Cmd (*__imp_Cmd) -#define DBgv (*__imp_DBgv) -#define DBline (*__imp_DBline) -#define DBsignal (*__imp_DBsignal) -#define DBsingle (*__imp_DBsingle) -#define DBsub (*__imp_DBsub) -#define DBtrace (*__imp_DBtrace) -#define Error (*__imp_Error) -#define Perl_AMG_names (*__imp_Perl_AMG_names) -#define Perl_No (*__imp_Perl_No) -#define Perl_Sv (*__imp_Perl_Sv) -#define Perl_Xpv (*__imp_Perl_Xpv) -#define Perl_Yes (*__imp_Perl_Yes) -#define Perl_amagic_generation (*__imp_Perl_amagic_generation) -#define Perl_an (*__imp_Perl_an) -#define Perl_buf (*__imp_Perl_buf) -#define Perl_bufend (*__imp_Perl_bufend) -#define Perl_bufptr (*__imp_Perl_bufptr) -#define Perl_check (*__imp_Perl_check) -#define Perl_collation_ix (*__imp_Perl_collation_ix) -#define Perl_collation_name (*__imp_Perl_collation_name) -#define Perl_collation_standard (*__imp_Perl_collation_standard) -#define Perl_collxfrm_base (*__imp_Perl_collxfrm_base) -#define Perl_collxfrm_mult (*__imp_Perl_collxfrm_mult) -#define Perl_compcv (*__imp_Perl_compcv) -#define Perl_compiling (*__imp_Perl_compiling) -#define Perl_comppad (*__imp_Perl_comppad) -#define Perl_comppad_name (*__imp_Perl_comppad_name) -#define Perl_comppad_name_fill (*__imp_Perl_comppad_name_fill) -#define Perl_cop_seqmax (*__imp_Perl_cop_seqmax) -#define Perl_curcop (*__imp_Perl_curcop) -#define Perl_curcopdb (*__imp_Perl_curcopdb) -#define Perl_curinterp (*__imp_Perl_curinterp) -#define Perl_curpad (*__imp_Perl_curpad) -#define Perl_dc (*__imp_Perl_dc) -#define Perl_di (*__imp_Perl_di) -#define Perl_ds (*__imp_Perl_ds) -#define Perl_egid (*__imp_Perl_egid) -#define Perl_envgv (*__imp_Perl_envgv) -#define Perl_error_count (*__imp_Perl_error_count) -#define Perl_euid (*__imp_Perl_euid) -#define Perl_evalseq (*__imp_Perl_evalseq) -#define Perl_expect (*__imp_Perl_expect) -#define Perl_fold_locale (*__imp_Perl_fold_locale) -#define Perl_gid (*__imp_Perl_gid) -#define Perl_he_root (*__imp_Perl_he_root) -#define Perl_hexdigit (*__imp_Perl_hexdigit) -#define Perl_hints (*__imp_Perl_hints) -#define Perl_in_my (*__imp_Perl_in_my) -#define Perl_last_lop (*__imp_Perl_last_lop) -#define Perl_last_lop_op (*__imp_Perl_last_lop_op) -#define Perl_last_uni (*__imp_Perl_last_uni) -#define Perl_lex_brackets (*__imp_Perl_lex_brackets) -#define Perl_lex_brackstack (*__imp_Perl_lex_brackstack) -#define Perl_lex_casemods (*__imp_Perl_lex_casemods) -#define Perl_lex_casestack (*__imp_Perl_lex_casestack) -#define Perl_lex_defer (*__imp_Perl_lex_defer) -#define Perl_lex_dojoin (*__imp_Perl_lex_dojoin) -#define Perl_lex_expect (*__imp_Perl_lex_expect) -#define Perl_lex_fakebrack (*__imp_Perl_lex_fakebrack) -#define Perl_lex_formbrack (*__imp_Perl_lex_formbrack) -#define Perl_lex_inpat (*__imp_Perl_lex_inpat) -#define Perl_lex_inwhat (*__imp_Perl_lex_inwhat) -#define Perl_lex_op (*__imp_Perl_lex_op) -#define Perl_lex_repl (*__imp_Perl_lex_repl) -#define Perl_lex_starts (*__imp_Perl_lex_starts) -#define Perl_lex_state (*__imp_Perl_lex_state) -#define Perl_lex_stuff (*__imp_Perl_lex_stuff) -#define Perl_linestr (*__imp_Perl_linestr) -#define Perl_markstack (*__imp_Perl_markstack) -#define Perl_markstack_max (*__imp_Perl_markstack_max) -#define Perl_markstack_ptr (*__imp_Perl_markstack_ptr) -#define Perl_max_intro_pending (*__imp_Perl_max_intro_pending) -#define Perl_maxo (*__imp_Perl_maxo) -#define Perl_min_intro_pending (*__imp_Perl_min_intro_pending) -#define Perl_multi_close (*__imp_Perl_multi_close) -#define Perl_multi_end (*__imp_Perl_multi_end) -#define Perl_multi_open (*__imp_Perl_multi_open) -#define Perl_multi_start (*__imp_Perl_multi_start) -#define Perl_na (*__imp_Perl_na) -#define Perl_nexttoke (*__imp_Perl_nexttoke) -#define Perl_nexttype (*__imp_Perl_nexttype) -#define Perl_nextval (*__imp_Perl_nextval) -#define Perl_nomemok (*__imp_Perl_nomemok) -#define Perl_numeric_local (*__imp_Perl_numeric_local) -#define Perl_numeric_name (*__imp_Perl_numeric_name) -#define Perl_numeric_standard (*__imp_Perl_numeric_standard) -#define Perl_oldbufptr (*__imp_Perl_oldbufptr) -#define Perl_oldoldbufptr (*__imp_Perl_oldoldbufptr) -#define Perl_op (*__imp_Perl_op) -#define Perl_op_desc (*__imp_Perl_op_desc) -#define Perl_op_name (*__imp_Perl_op_name) -#define Perl_op_seqmax (*__imp_Perl_op_seqmax) -#define Perl_opargs (*__imp_Perl_opargs) -#define Perl_origalen (*__imp_Perl_origalen) -#define Perl_origenviron (*__imp_Perl_origenviron) -#define Perl_osname (*__imp_Perl_osname) -#define Perl_padix (*__imp_Perl_padix) -#define Perl_patleave (*__imp_Perl_patleave) -#define Perl_pidstatus (*__imp_Perl_pidstatus) -#define Perl_ppaddr (*__imp_Perl_ppaddr) -#define Perl_profiledata (*__imp_Perl_profiledata) -#define Perl_psig_name (*__imp_Perl_psig_name) -#define Perl_psig_ptr (*__imp_Perl_psig_ptr) -#define Perl_regbol (*__imp_Perl_regbol) -#define Perl_regcode (*__imp_Perl_regcode) -#define Perl_regendp (*__imp_Perl_regendp) -#define Perl_regeol (*__imp_Perl_regeol) -#define Perl_reginput (*__imp_Perl_reginput) -#define Perl_reglastparen (*__imp_Perl_reglastparen) -#define Perl_regnaughty (*__imp_Perl_regnaughty) -#define Perl_regnpar (*__imp_Perl_regnpar) -#define Perl_regparse (*__imp_Perl_regparse) -#define Perl_regprecomp (*__imp_Perl_regprecomp) -#define Perl_regprev (*__imp_Perl_regprev) -#define Perl_regsawback (*__imp_Perl_regsawback) -#define Perl_regsize (*__imp_Perl_regsize) -#define Perl_regstartp (*__imp_Perl_regstartp) -#define Perl_regtill (*__imp_Perl_regtill) -#define Perl_regxend (*__imp_Perl_regxend) -#define Perl_retstack (*__imp_Perl_retstack) -#define Perl_retstack_ix (*__imp_Perl_retstack_ix) -#define Perl_retstack_max (*__imp_Perl_retstack_max) -#define Perl_rsfp (*__imp_Perl_rsfp) -#define Perl_rsfp_filters (*__imp_Perl_rsfp_filters) -#define Perl_savestack (*__imp_Perl_savestack) -#define Perl_savestack_ix (*__imp_Perl_savestack_ix) -#define Perl_savestack_max (*__imp_Perl_savestack_max) -#define Perl_scopestack (*__imp_Perl_scopestack) -#define Perl_scopestack_ix (*__imp_Perl_scopestack_ix) -#define Perl_scopestack_max (*__imp_Perl_scopestack_max) -#define Perl_sh_path (*__imp_Perl_sh_path) -#define Perl_sig_name (*__imp_Perl_sig_name) -#define Perl_sig_num (*__imp_Perl_sig_num) -#define Perl_siggv (*__imp_Perl_siggv) -#define Perl_stack_base (*__imp_Perl_stack_base) -#define Perl_stack_max (*__imp_Perl_stack_max) -#define Perl_stack_sp (*__imp_Perl_stack_sp) -#define Perl_statbuf (*__imp_Perl_statbuf) -#define Perl_sub_generation (*__imp_Perl_sub_generation) -#define Perl_subline (*__imp_Perl_subline) -#define Perl_subname (*__imp_Perl_subname) -#define Perl_sv_no (*__imp_Perl_sv_no) -#define Perl_sv_undef (*__imp_Perl_sv_undef) -#define Perl_sv_yes (*__imp_Perl_sv_yes) -#define Perl_tainting (*__imp_Perl_tainting) -#define Perl_thisexpr (*__imp_Perl_thisexpr) -#define Perl_timesbuf (*__imp_Perl_timesbuf) -#define Perl_tokenbuf (*__imp_Perl_tokenbuf) -#define Perl_uid (*__imp_Perl_uid) -#define Perl_vert (*__imp_Perl_vert) -#define Perl_vtbl_amagic (*__imp_Perl_vtbl_amagic) -#define Perl_vtbl_amagicelem (*__imp_Perl_vtbl_amagicelem) -#define Perl_vtbl_arylen (*__imp_Perl_vtbl_arylen) -#define Perl_vtbl_bm (*__imp_Perl_vtbl_bm) -#define Perl_vtbl_collxfrm (*__imp_Perl_vtbl_collxfrm) -#define Perl_vtbl_dbline (*__imp_Perl_vtbl_dbline) -#define Perl_vtbl_env (*__imp_Perl_vtbl_env) -#define Perl_vtbl_envelem (*__imp_Perl_vtbl_envelem) -#define Perl_vtbl_fm (*__imp_Perl_vtbl_fm) -#define Perl_vtbl_glob (*__imp_Perl_vtbl_glob) -#define Perl_vtbl_isa (*__imp_Perl_vtbl_isa) -#define Perl_vtbl_isaelem (*__imp_Perl_vtbl_isaelem) -#define Perl_vtbl_itervar (*__imp_Perl_vtbl_itervar) -#define Perl_vtbl_mglob (*__imp_Perl_vtbl_mglob) -#define Perl_vtbl_nkeys (*__imp_Perl_vtbl_nkeys) -#define Perl_vtbl_pack (*__imp_Perl_vtbl_pack) -#define Perl_vtbl_packelem (*__imp_Perl_vtbl_packelem) -#define Perl_vtbl_pos (*__imp_Perl_vtbl_pos) -#define Perl_vtbl_sig (*__imp_Perl_vtbl_sig) -#define Perl_vtbl_sigelem (*__imp_Perl_vtbl_sigelem) -#define Perl_vtbl_substr (*__imp_Perl_vtbl_substr) -#define Perl_vtbl_sv (*__imp_Perl_vtbl_sv) -#define Perl_vtbl_taint (*__imp_Perl_vtbl_taint) -#define Perl_vtbl_uvar (*__imp_Perl_vtbl_uvar) -#define Perl_vtbl_vec (*__imp_Perl_vtbl_vec) -#define Perl_xiv_arenaroot (*__imp_Perl_xiv_arenaroot) -#define Perl_xiv_root (*__imp_Perl_xiv_root) -#define Perl_xnv_root (*__imp_Perl_xnv_root) -#define Perl_xpv_root (*__imp_Perl_xpv_root) -#define Perl_xrv_root (*__imp_Perl_xrv_root) -#define ampergv (*__imp_ampergv) -#define argvgv (*__imp_argvgv) -#define argvoutgv (*__imp_argvoutgv) -#define basetime (*__imp_basetime) -#define beginav (*__imp_beginav) -#define bodytarget (*__imp_bodytarget) -#define cddir (*__imp_cddir) -#define chopset (*__imp_chopset) -#define comppad_name_floor (*__imp_comppad_name_floor) -#define copline (*__imp_copline) -#define curpm (*__imp_curpm) -#define curstack (*__imp_curstack) -#define curstash (*__imp_curstash) -#define curstname (*__imp_curstname) -#define cxstack (*__imp_cxstack) -#define cxstack_ix (*__imp_cxstack_ix) -#define cxstack_max (*__imp_cxstack_max) -#define dbargs (*__imp_dbargs) -#define debdelim (*__imp_debdelim) -#define debname (*__imp_debname) -#define debstash (*__imp_debstash) -#define debug (*__imp_debug) -#define defgv (*__imp_defgv) -#define defoutgv (*__imp_defoutgv) -#define defstash (*__imp_defstash) -#define delaymagic (*__imp_delaymagic) -#define diehook (*__imp_diehook) -#define dirty (*__imp_dirty) -#define dlevel (*__imp_dlevel) -#define dlmax (*__imp_dlmax) -#define do_undump (*__imp_do_undump) -#define doextract (*__imp_doextract) -#define doswitches (*__imp_doswitches) -#define dowarn (*__imp_dowarn) -#define dumplvl (*__imp_dumplvl) -#define e_fp (*__imp_e_fp) -#define e_tmpname (*__imp_e_tmpname) -#define endav (*__imp_endav) -#define errgv (*__imp_errgv) -#define eval_root (*__imp_eval_root) -#define eval_start (*__imp_eval_start) -#define fdpid (*__imp_fdpid) -#define filemode (*__imp_filemode) -#define firstgv (*__imp_firstgv) -#define forkprocess (*__imp_forkprocess) -#define formfeed (*__imp_formfeed) -#define formtarget (*__imp_formtarget) -#define gensym (*__imp_gensym) -#define in_eval (*__imp_in_eval) -#define incgv (*__imp_incgv) -#define inplace (*__imp_inplace) -#define last_in_gv (*__imp_last_in_gv) -#define lastfd (*__imp_lastfd) -#define lastscream (*__imp_lastscream) -#define lastsize (*__imp_lastsize) -#define lastspbase (*__imp_lastspbase) -#define laststatval (*__imp_laststatval) -#define laststype (*__imp_laststype) -#define leftgv (*__imp_leftgv) -#define lineary (*__imp_lineary) -#define localizing (*__imp_localizing) -#define localpatches (*__imp_localpatches) -#define main_cv (*__imp_main_cv) -#define main_root (*__imp_main_root) -#define main_start (*__imp_main_start) -#define mainstack (*__imp_mainstack) -#define maxscream (*__imp_maxscream) -#define maxsysfd (*__imp_maxsysfd) -#define minus_F (*__imp_minus_F) -#define minus_a (*__imp_minus_a) -#define minus_c (*__imp_minus_c) -#define minus_l (*__imp_minus_l) -#define minus_n (*__imp_minus_n) -#define minus_p (*__imp_minus_p) -#define multiline (*__imp_multiline) -#define mystack_base (*__imp_mystack_base) -#define mystack_max (*__imp_mystack_max) -#define mystack_sp (*__imp_mystack_sp) -#define mystrk (*__imp_mystrk) -#define nice_chunk (*__imp_nice_chunk) -#define nice_chunk_size (*__imp_nice_chunk_size) -#define nrs (*__imp_nrs) -#define ofmt (*__imp_ofmt) -#define ofs (*__imp_ofs) -#define ofslen (*__imp_ofslen) -#define oldlastpm (*__imp_oldlastpm) -#define oldname (*__imp_oldname) -#define op_mask (*__imp_op_mask) -#define origargc (*__imp_origargc) -#define origargv (*__imp_origargv) -#define origfilename (*__imp_origfilename) -#define ors (*__imp_ors) -#define orslen (*__imp_orslen) -#define pad_reset_pending (*__imp_pad_reset_pending) -#define padix_floor (*__imp_padix_floor) -#define parsehook (*__imp_parsehook) -#define patchlevel (*__imp_patchlevel) -#define perl_destruct_level (*__imp_perl_destruct_level) -#define perldb (*__imp_perldb) -#define preambleav (*__imp_preambleav) -#define preambled (*__imp_preambled) -#define preprocess (*__imp_preprocess) -#define regflags (*__imp_regflags) -#define restartop (*__imp_restartop) -#define rightgv (*__imp_rightgv) -#define rs (*__imp_rs) -#define runlevel (*__imp_runlevel) -#define sawampersand (*__imp_sawampersand) -#define sawstudy (*__imp_sawstudy) -#define sawvec (*__imp_sawvec) -#define screamfirst (*__imp_screamfirst) -#define screamnext (*__imp_screamnext) -#define secondgv (*__imp_secondgv) -#define signalstack (*__imp_signalstack) -#define sortcop (*__imp_sortcop) -#define sortstack (*__imp_sortstack) -#define sortstash (*__imp_sortstash) -#define splitstr (*__imp_splitstr) -#define statcache (*__imp_statcache) -#define statgv (*__imp_statgv) -#define statname (*__imp_statname) -#define statusvalue (*__imp_statusvalue) -#define stdingv (*__imp_stdingv) -#define strchop (*__imp_strchop) -#define strtab (*__imp_strtab) -#define sv_arenaroot (*__imp_sv_arenaroot) -#define sv_count (*__imp_sv_count) -#define sv_objcount (*__imp_sv_objcount) -#define sv_root (*__imp_sv_root) -#define tainted (*__imp_tainted) -#define tmps_floor (*__imp_tmps_floor) -#define tmps_ix (*__imp_tmps_ix) -#define tmps_max (*__imp_tmps_max) -#define tmps_stack (*__imp_tmps_stack) -#define top_env (*__imp_top_env) -#define toptarget (*__imp_toptarget) -#define unsafe (*__imp_unsafe) -#define warnhook (*__imp_warnhook) diff --git a/cygwin32/gcc2 b/cygwin32/gcc2 deleted file mode 100644 index 6751348bd3..0000000000 --- a/cygwin32/gcc2 +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# -# gcc wrapper for building dynamic lib version of perl -# if -buildperl found on command line, then all args passed to -# perlgcc, else pass all args to gcc. -# jc 3/24/97 -# - -PERLPATH=/perl5.005 - -case "$*" in -*-buildperl*) $PERLPATH/miniperl perlgcc "$@" ;; -*) gcc "$@" ;; -esac diff --git a/cygwin32/impure_ptr.c b/cygwin32/impure_ptr.c new file mode 100644 index 0000000000..bbe98714fe --- /dev/null +++ b/cygwin32/impure_ptr.c @@ -0,0 +1,18 @@ +/* + * impure_ptr initialization routine. This is needed + * for any DLL that needs to output to the main (calling) + * executable's stdout, stderr, etc. + */ + +struct _reent *_impure_ptr; /* this will be the Dlls local copy of impure ptr */ + +/********************************************* + * Function to set our local (in this dll) + * copy of impure_ptr to the main's + * (calling executable's) impure_ptr + */ +void impure_setup(struct _reent *_impure_ptrMain){ + + _impure_ptr = _impure_ptrMain; + +} diff --git a/cygwin32/ld2 b/cygwin32/ld2 deleted file mode 100644 index 0bc98bd36e..0000000000 --- a/cygwin32/ld2 +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# -# ld wrapper for building dynamic lib version of perl; -# passes all args to ld. -# - -PERLPATH=/perl5.005 - -$PERLPATH/perl $PERLPATH/perlld -L$PERLPATH "$@" diff --git a/cygwin32/ld2.in b/cygwin32/ld2.in new file mode 100644 index 0000000000..3776c71f87 --- /dev/null +++ b/cygwin32/ld2.in @@ -0,0 +1,20 @@ +#!/bin/sh +# +# ld wrapper for building dynamic lib version of perl; +# passes all args to perlld +# + +# own miniperl is first candidate 'cause it doesn not lock libperl.dll +for trythis in @buildpath@/miniperl @buildpath@/perl perl +do + if [ -x $trythis ] + then + $trythis @buildpath@/perlld "$@" + exit $? + fi +done +# hard luck! +echo i see no perl executable around there +echo perl is required to build dynamic libraries +echo go fetch one or build this one static +exit 1 diff --git a/cygwin32/perlgcc b/cygwin32/perlgcc deleted file mode 100644 index 202ed29a4f..0000000000 --- a/cygwin32/perlgcc +++ /dev/null @@ -1,84 +0,0 @@ -# - -# Perl script be a wrapper around the gnu gcc. the exportable perl.exe -# is built, special processing is done. -# This script is caled by the gcc2 shell script when the flag -# -buildperl is passed to gcc2 - -print "perlgcc: building exportable perl...\n"; - -# get all libs: -my @libobs; -my @obs; -my @libFlags; -my $libstring; -foreach (@ARGV){ - if( /\.[a]$/){ - push @libobs,$_; - } - elsif(/^\-l/){ - push @libFlags,$_; - } - if( /\.[o]$/){ - push @obs,$_; - } -} -$libstring = join(" ",@libobs); -$obsString = join(" ",@obs); -$libflagString = join(" ",@libFlags); - -# make exports file -my $command = "echo EXPORTS > perl.def"; -print "$command\n"; -system($command) == 0 or die "system() failed.\n"; - -$command ="nm $libstring | grep '^........ [TCD] _'| grep -v _impure_ptr | sed 's/[^_]*_//' >> perl.def"; -print "$command\n"; -system($command) == 0 or die "system() failed.\n"; - -# Build the perl.a lib to link to: -$command ="dlltool --as=as --dllname perl.exe --def perl.def --output-lib perl.a"; -print "$command\n"; -system($command) == 0 or die "system() failed.\n"; - -# change name of export lib to libperlexp so that is can be understood by ld2/perlld -$command ="mv perl.a libperlexp.a"; -print "$command\n"; -system($command) == 0 or die "system() failed.\n"; - -# get the full path name of a few libs: -my $crt0 = `gcc -print-file-name=crt0.o`; -chomp $crt0; -my $libdir = `gcc -print-file-name=libcygwin.a`; -chomp $libdir; -$libdir =~ s/libcygwin\.a//g; - -# when $crt0 and $libdir get used in the system calls below, the \'s -# from the gcc -print-file-name get used to create special characters, -# such as \n, \t. Replace the \'s with /'s so that this does not -# happen: -$crt0 =~ s:\\:/:g; -$libdir =~ s:\\:/:g; - -# Link exe: -$command = "ld --base-file perl.base -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString"; -print "$command\n"; -system($command) == 0 or die "system() failed.\n"; - -$command = "dlltool --as=as --dllname perl.exe --def perl.def --base-file perl.base --output-exp perl.exp"; -print "$command\n"; -system($command) == 0 or die "system() failed.\n"; - -$command = "ld --base-file perl.base perl.exp -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString"; -print "$command\n"; -system($command) == 0 or die "system() failed.\n"; - -$command = "dlltool --as=as --dllname perl.exe --def perl.def --base-file perl.base --output-exp perl.exp"; -print "$command\n"; -system($command) == 0 or die "system() failed.\n"; - -$command = "ld perl.exp -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString"; -print "$command\n"; -system($command) == 0 or die "system() failed.\n"; - -print "perlgcc: Completed\n"; diff --git a/cygwin32/perlld b/cygwin32/perlld deleted file mode 100644 index 97edfd64dd..0000000000 --- a/cygwin32/perlld +++ /dev/null @@ -1,192 +0,0 @@ -# -# Perl script be a wrapper around the gnu ld. When a dll is specified to -# to be built, special processing is done, else the standard ld is called. -# -# Modified 3/14/97 to include the impure_ptr setup routine in init.cc -# Modified to make dll in current directory then copy to another dir if -# a path name specified on the command name with the -o parm. -# - -my $args = join(" ",@ARGV); # get args -my $arg; - -my @objs; -my @flags; -my $libname; -my $init = "init"; -my $fixup = "fixup"; - -my $path; - - -sub writefixup; -sub writeInit; - -if( $args=~/\-o (.+?)\.dll/i){ - $libname = $1; - # print "libname = <$libname>\n"; - # Check for path: - if( $libname =~ /($\.+?\/)(\w+$)/){ - $path = $1; - $libname = $2; - # print "<$path> <$libname>\n"; - } - - foreach $arg(@ARGV){ - if( $arg=~/\.[oa]$/){ - push @objs,$arg; - next; - } - if( $arg =~/\-o/ or $arg =~ /.+?\.dll/i ){ - next; - } - push @flags,$arg; - } - - writefixup(); - writeInit(); - $command = "gcc -c $fixup.c\n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - $command = "gcc -c $init.cc\n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - - $command = "echo EXPORTS > $libname.def\n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - $command = "nm ".join(" ",@objs)." $init.o $fixup.o | grep '^........ [TCD] _' | sed 's/[^_]*_//' >> $libname.def\n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - - $command = "ld --base-file $libname.base --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o "; - $command .= join(" ",@flags)." -e _dll_entry\@12 \n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - - $command = "dlltool --as=as --dllname $libname.dll --def $libname.def --base-file $libname.base --output-exp $libname.exp\n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - - $command = "ld --base-file $libname.base $libname.exp --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o "; - $command .= join(" ",@flags)." -e _dll_entry\@12 \n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - - $command = "dlltool --as=as --dllname $libname.dll --def $libname.def --base-file $libname.base --output-exp $libname.exp\n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - - $command = "ld $libname.exp --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o "; - $command .= join(" ",@flags)." -e _dll_entry\@12 \n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - - print "Build the import lib\n"; - $command = "dlltool --as=as --dllname $libname.dll --def $libname.def --output-lib $libname.a\n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - - # if there was originally a path, copy the dll and a to that location: - if($path && $path ne "./" && $path."\n" ne "`pwd`"){ - $command = "mv $libname.dll $path".$libname.".dll\n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - $command = "mv $libname.a $path".$libname.".a\n"; - print $command; - system($command) == 0 or die "system() failed.\n"; - - } - -} -else{ # no special processing, just call ld - $command = "ld $args\n"; - print $command; - system($command) == 0 or die "system() failed.\n"; -} - -#--------------------------------------------------------------------------- -sub writeInit{ - -open(OUTFILE,">$init.cc") or die("Can't open $init.cc\n"); - -print OUTFILE <<'EOF'; -/* init.cc for WIN32. - - Copyright 1996 Cygnus Solutions - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -// Added impure_ptr initialization routine. This is needed for any DLL that needs -// to output to the main (calling) executable's stdout, stderr, etc. This routine -// needs to be called from the executable using the DLL before any other DLL -// routines are called. jc 3/14/97 - -#include <windows.h> - -extern "C" -{ - int WINAPI dll_entry (HANDLE h, DWORD reason, void *ptr); - void impure_setup(struct _reent *_impure_ptrMain); -}; - -struct _reent *_impure_ptr; // this will be the Dlls local copy of impure ptr - -int WINAPI dll_entry (HANDLE , - DWORD reason, - void *) -{ - switch (reason) - { - case DLL_PROCESS_ATTACH: - break; - case DLL_PROCESS_DETACH: - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - } - return 1; -} - - -//******************************************** -// Function to set our local (in this dll) copy of impure_ptr to the -// main's (calling executable's) impure_ptr -void impure_setup(struct _reent *_impure_ptrMain){ - - _impure_ptr = _impure_ptrMain; - -} -EOF - -close OUTFILE; - -} - -#--------------------------------------------------------------------------- -sub writefixup{ - -open(OUTFILE,">$fixup.c") or die("Can't open $fixup.c\n"); - -print OUTFILE <<'EOF'; -/* This is needed to terminate the list of inport stuff */ -/* Copied from winsup/dcrt0.cc in the cygwin32 source distribution. */ - asm(".section .idata$3\n" ".long 0,0,0,0, 0,0,0,0"); - -EOF -close OUTFILE; -} diff --git a/cygwin32/perlld.in b/cygwin32/perlld.in new file mode 100644 index 0000000000..1e82877178 --- /dev/null +++ b/cygwin32/perlld.in @@ -0,0 +1,89 @@ +# +# Perl script being a wrapper around the gnu ld. When a dll is specified to +# to be built, special processing is done, else the standard ld is called. +# + +# theese are pretty mandatory +my $CC = '@CC@'; +my $DLLWRAP = '@DLLWRAP@'; + +# following are optional. +my $WRAPDRIVER = '@WRAPDRIVER@'; +my $AS = '@AS@'; +my $DLLTOOL = '@DLLTOOL@'; +my $EXPORT_ALL = @EXPORT_ALL@; +# if some of extensions are undefined, +# no corresponding output will be done. +# most probably, you'd like to have an export library +my $DEF_EXT = '@DEF_EXT@'; +# my $EXP_EXT = '@EXP_EXT@'; +my $LIB_EXT = '@LIB_EXT@'; + +#my $DEBUG ="perlld.out"; +my $DEBUG =undef; + +my $args = join(" ",@ARGV); # get args +my $verbose =grep(/^\-(v|\-verbose)$/, @ARGV); + +sub shellexec; + +if ($DEBUG) { + open DEBUGFILE, ">>$DEBUG"; + print DEBUGFILE "\n--- " .localtime() ."\nargs:\n$args\n\nenvironment:\n"; + foreach (keys(%ENV)) { print DEBUGFILE $_, "=", $ENV{$_}, "\n"; }; +} + +if ($args !~ /\-o (\S+)/) { + print DEBUGFILE "+ no dll output -- passing to gcc\n\n" if $DEBUG; + shellexec("$CC $args\n"); +} else { + my ($path, $command, $dllname, $libname) =''; + + $dllname =$1; + print DEBUGFILE "output file: $dllname\n" if $DEBUG; + # remove -o from args + $args =~ s/(^| )\-o \S+/$1/; + + # Check for path: + if( $dllname =~ /.*[\/\\]/){ + $dllname = $'; + $path = $&; + $path =~ s,[/\\](\.[/\\])*,/,g; + } + if ($dllname =~ /\./) { $libname =$`; } else { $libname =$dllname; }; + $dllname ="$libname.dll"; + $libname ="lib$libname" unless ($libname =~ /^lib/); + print DEBUGFILE "dll name: $dllname\nimport library: $libname\npath: $path\n" if $DEBUG; + + $command ="$DLLWRAP --dllname $dllname --exclude-symbol=_impure_ptr"; + $command .=" --driver-name $WRAPDRIVER" if $WRAPDRIVER; + $command .=" --dlltool $DLLTOOL" if $DLLTOOL; + $command .=" --export-all-symbols" if $EXPORT_ALL; + $command .=" --as $AS" if $AS; + $command .=" --verbose" if $verbose; + + $command .=" --output-def $libname$DEF_EXT" if $DEF_EXT; + $command .=" --output-exp $libname$EXP_EXT" if $EXP_EXT; + $command .=" --output-lib $libname$LIB_EXT" if $LIB_EXT; + + # other args are passed through + shellexec("$command \\\n$args\n"); + + if ($path) { + $command ="mv $dllname"; + $command .=" $libname$LIB_EXT" if $LIB_EXT; + shellexec("$command $path\n"); + }; +}; +close DEBUGFILE if $DEBUG; + +#--------------------------------------------------------------------------- +sub shellexec{ + my $command =shift; + print $command; + print DEBUGFILE $command if $DEBUG; + system($command) == 0 + or die "perlld: *** system() failed to execute\n$command\n"; +}; + +1; @@ -23,8 +23,22 @@ # define PERL_SYS_INIT(c,v) Perl_win32_init(c,v) # define BIT_BUCKET "nul" # else -# define PERL_SYS_INIT(c,v) -# define BIT_BUCKET "\\dev\\nul" /* "wanna be like, umm, Newlined, or somethin?" */ +# ifdef CYGWIN32 + extern struct _reent *__imp_reent_data; /* global impure pointer */ +# define PERL_SYS_INIT(c,v) \ + MALLOC_INIT; impure_setup(__imp_reent_data); +# 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 # endif #endif /* DJGPP */ diff --git a/ext/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL index d379fdb908..62a87cacac 100644 --- a/ext/POSIX/Makefile.PL +++ b/ext/POSIX/Makefile.PL @@ -1,7 +1,9 @@ use ExtUtils::MakeMaker; WriteMakefile( NAME => 'POSIX', - ($^O eq 'MSWin32' ? () : (LIBS => ["-lm -lposix -lcposix"])), + ($^O eq 'MSWin32' ? () : ($^O =~ /cygwin/ ? (LIBS => ["-lmsvcrt"]) : + (LIBS => ["-lm -lposix -lcposix"]) + )), MAN3PODS => {}, # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? VERSION_FROM => 'POSIX.pm', diff --git a/ext/SDBM_File/sdbm/pair.c b/ext/SDBM_File/sdbm/pair.c index d03bfb30a7..24deb772de 100644 --- a/ext/SDBM_File/sdbm/pair.c +++ b/ext/SDBM_File/sdbm/pair.c @@ -8,7 +8,12 @@ */ #include "config.h" -#include "EXTERN.h" +#ifdef CYGWIN32 +# define EXT extern +# define EXTCONST extern const +#else +# include "EXTERN.h" +#endif #include "sdbm.h" #include "tune.h" #include "pair.h" diff --git a/hints/cygwin32.sh b/hints/cygwin32.sh index 5853499954..ced980069f 100644 --- a/hints/cygwin32.sh +++ b/hints/cygwin32.sh @@ -1,50 +1,59 @@ #! /bin/sh # cygwin32.sh - hintsfile for building perl on Windows NT using the # Cygnus Win32 Development Kit. -# See "http://www.cygnus.com/misc/gnu-win32/" to learn about the kit. # -path_sep=\; +_a='.a' +_exe='.exe' +_o='.o' +archname='cygwin32' +# hmm... why Configure doesn't look for this? +#bash='/usr/bin/bash' +bin='/usr/local/bin' +binexp='/usr/local/bin' +byteorder='1234' +cc='gcc' +cccdlflags='' +# ccflags='-I/usr/local/include -ggdb3 -DCYGWIN32 -DDEBUGGING' +# ok, debugging may be not appropriate for everyone +ccflags='-DCYGWIN32' +clocktype='clock_t' +cryptlib='-lcrypt' +dlext='dll' +dlsrc='dl_cygwin32.xs' exe_ext='.exe' +# work around case-insensitive file names firstmakefile='GNUmakefile' -if test -f $sh.exe; then sh=$sh.exe; fi -startsh="#!$sh" -cc='gcc2' -ld='ld2' -usrinc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/include' -libpth='/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib /gnuwin32/H-i386-cygwin32/lib' -libs='-lcygwin -lm -lc -lkernel32' -# dynamic lib stuff -so='dll' -#i_dlfcn='define' -dlsrc='dl_cygwin32.xs' -usedl='y' -# flag to include the perl.exe export variable translation file cw32imp.h -# when building extension libs -cccdlflags='-DCYGWIN32 -DDLLIMPORT ' -# flag that signals gcc2 to build exportable perl -ccdlflags='-buildperl ' -lddlflags='-L../.. -L/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib -lperlexp -lcygwin' -d_voidsig='undef' -extensions='Fcntl IO Opcode SDBM_File' -lns='cp' -signal_t='int' -useposix='false' -rd_nodata='0' -eagain='EAGAIN' -archname='cygwin32' -# - -installbin='/usr/local/bin' -installman1dir='' -installman3dir='' -installprivlib='/usr/local/lib/perl5' +gidtype='gid_t' +installman1dir='/usr/local/man/man1' +installman3dir='/usr/local/man/man3' installscript='/usr/local/bin' - installsitelib='/usr/local/lib/perl5/site_perl' -libc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib/libc.a' - -perlpath='/usr/local/bin/perl' - +installusrbinperl='undef' +ld='ld2' +lddlflags='-DCYGWIN32 --export-dynamic --strip-debug' +ldflags="-L. -L`pwd`" +lib_ext='.a' +libperl='libperl.a' +libpth='/usr/lib /usr/local/lib /cygnus/cygwin-b20/H-i586-cygwin32/lib' +libs='-lcygwin -lm -lc -lkernel32' +man1dir='/usr/local/man/man1' +man1direxp='/usr/local/man/man1' +man1ext='1' +man3dir='/usr/local/man/man3' +man3direxp='/usr/local/man/man3' +man3ext='3' +obj_ext='.o' +optimize='-O' +path_sep=':' +prefix='/usr/local' +prefixexp='/usr/local' +scriptdir='/usr/local/bin' +scriptdirexp='/usr/local/bin' sitelib='/usr/local/lib/perl5/site_perl' sitelibexp='/usr/local/lib/perl5/site_perl' -usrinc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/include' +sysman='/usr/local/man/man1' +usenm='false' +useperlio='define' +useshrplib='true' +usevfork='true' +usrinc='/usr/i586-cygwin32/include' diff --git a/installperl b/installperl index 4e9b391aa8..7689005edd 100755 --- a/installperl +++ b/installperl @@ -8,12 +8,13 @@ BEGIN { } use strict; -use vars qw($Is_VMS $Is_W32 $Is_OS2 $nonono $versiononly $depth); +use vars qw($Is_VMS $Is_W32 $Is_OS2 $Is_Cygwin $nonono $versiononly $depth); BEGIN { $Is_VMS = $^O eq 'VMS'; $Is_W32 = $^O eq 'MSWin32'; $Is_OS2 = $^O eq 'os2'; + $Is_Cygwin = $^O =~ /cygwin/i; if ($Is_VMS) { eval 'use VMS::Filespec;' } } @@ -141,10 +142,24 @@ if ($d_dosuid && $>) { die "You must run as root to install suidperl\n"; } || warn "WARNING: You've never run 'make test'!!!", " (Installing anyway.)\n"; -if ($Is_W32) { - -my $perldll = 'perl.' . $dlext; -$perldll = 'perlcore.' . $dlext if $Config{'ccflags'} =~ /PERL_OBJECT/i; +if ($Is_W32 or $Is_Cygwin) { + my $perldll; + +if ($Is_Cygwin) { + $perldll = $libperl; + $perldll =~ s/(\..*)?$/.$dlext/; + if ($Config{useshrplib} eq 'true') { + # install ld2 and perlld as well + foreach ('ld2', 'perlld') { + safe_unlink("$installbin/$_"); + copy("$_", "$installbin/$_"); + chmod(0755, "$installbin/$_"); + }; + }; +} else { + $perldll = 'perl.' . $dlext; + $perldll = 'perlcore.' . $dlext if $Config{'ccflags'} =~ /PERL_OBJECT/i; +} -f $perldll || die "No perl DLL built\n"; @@ -227,7 +242,13 @@ if ($Is_VMS) { # We did core file selection during build @corefiles = <$coredir/*.*>; } else { + # [als] hard-coded 'libperl' name... not good! @corefiles = <*.h libperl*.*>; + + # cygwin needs special stub for dll loading + push @corefiles, 'impure_ptr.o' + if ($Is_Cygwin and $Config{useshrplib} eq 'true'); + # AIX needs perl.exp installed as well. push(@corefiles,'perl.exp') if $^O eq 'aix'; if ($^O eq 'mpeix') { @@ -439,7 +460,7 @@ sub unlink { foreach my $name (@names) { next unless -e $name; - chmod 0777, $name if ($Is_OS2 || $Is_W32); + chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_Cygwin); print STDERR " unlink $name\n"; ( CORE::unlink($name) and ++$cnt or warn "Couldn't unlink $name: $!\n" ) unless $nonono; diff --git a/lib/Cwd.pm b/lib/Cwd.pm index 655782145b..df40649a42 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -209,6 +209,8 @@ 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): $!"; diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index 430462bea0..95477fa9c4 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -70,6 +70,7 @@ $Is_VMS = $^O eq 'VMS'; $Is_OS2 = $^O eq 'os2'; $Is_Mac = $^O eq 'MacOS'; $Is_Win32 = $^O eq 'MSWin32'; +$Is_Cygwin= $^O =~ /cygwin/i; require ExtUtils::MM_Unix; @@ -86,6 +87,9 @@ if ($Is_Mac) { if ($Is_Win32) { require ExtUtils::MM_Win32; } +if ($Is_Cygwin) { + require ExtUtils::MM_Cygwin; +} # The SelfLoader would bring a lot of overhead for MakeMaker, because # we know for sure we will use most of the autoloaded functions once diff --git a/lib/perl5db.pl b/lib/perl5db.pl index 18196278d9..f6b0ecbc95 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -296,7 +296,10 @@ if ($notty) { #require Term::ReadLine; - if (-e "/dev/tty") { + if ($^O =~ /cygwin/) { + # /dev/tty is binary. use stdin for textmode + undef $console; + } elsif (-e "/dev/tty") { $console = "/dev/tty"; } elsif ($^O eq 'dos' or -e "con" or $^O eq 'MSWin32') { $console = "con"; diff --git a/makedepend.SH b/makedepend.SH index ba90d72abb..e1c28468bd 100755 --- a/makedepend.SH +++ b/makedepend.SH @@ -105,7 +105,11 @@ for file in `$cat .clist`; do if [ "$osname" = os2 ]; then uwinfix="-e s,\\\\\\\\,/,g" else - uwinfix= + if [ "$archname" = cygwin32 ]; then + uwinfix="-e s,\\\\\\\\,/,g" + else + uwinfix= + fi fi fi case "$file" in @@ -218,7 +218,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) +#if defined(MSDOS) || defined(atarist) || defined(WIN32) || defined(CYGWIN32) #define DOSISH 1 #endif @@ -1495,11 +1495,7 @@ union any { #define ARGSproto void #endif /* USE_THREADS */ -/* Work around some cygwin32 problems with importing global symbols */ #if defined(CYGWIN32) -# if defined(DLLIMPORT) -# include "cw32imp.h" -# endif /* USEMYBINMODE * This symbol, if defined, indicates that the program should * use the routine my_binmode(FILE *fp, char iotype) to insure @@ -2308,7 +2304,7 @@ struct perl_vars { EXT struct perl_vars PL_Vars; EXT struct perl_vars *PL_VarsPtr INIT(&PL_Vars); #else /* PERL_CORE */ -#if !defined(__GNUC__) || !defined(WIN32) +#if !defined(__GNUC__) || !(defined(WIN32) || defined(CYGWIN32)) EXT #endif /* WIN32 */ struct perl_vars *PL_VarsPtr; diff --git a/perlvars.h b/perlvars.h index 174747884f..67dc7c181f 100644 --- a/perlvars.h +++ b/perlvars.h @@ -138,7 +138,7 @@ PERLVAR(Gcryptseen, I32) /* has fast crypt() been initialized? */ PERLVAR(Ghints, U32) /* pragma-tic compile-time flags */ -PERLVAR(Gdo_undump, bool) /* -u or dump seen? */ +PERLVARI(Gdo_undump, bool, FALSE) /* -u or dump seen? */ PERLVAR(Gdebug, VOL U32) /* flags given to -D switch */ PERLVAR(Gamagic_generation, long) @@ -1232,9 +1232,15 @@ do_readline(void) 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 */ @@ -3510,7 +3510,7 @@ PP(pp_fork) PP(pp_wait) { -#if !defined(DOSISH) || defined(OS2) || defined(WIN32) +#if !defined(DOSISH) || defined(OS2) || defined(WIN32) || defined(CYGWIN32) djSP; dTARGET; Pid_t childpid; int argflags; @@ -3526,7 +3526,7 @@ PP(pp_wait) PP(pp_waitpid) { -#if !defined(DOSISH) || defined(OS2) || defined(WIN32) +#if !defined(DOSISH) || defined(OS2) || defined(WIN32) || defined(CYGWIN32) djSP; dTARGET; Pid_t childpid; int optype; @@ -3203,7 +3203,12 @@ re_croak2(const char* pat1,const char* pat2,...) Copy(pat2, buf + l1, l2 , char); buf[l1 + l2] = '\n'; buf[l1 + l2 + 1] = '\0'; +#ifdef I_STDARG + /* ANSI variant takes additional second argument */ va_start(args, pat2); +#else + va_start(args); +#endif msv = mess(buf, &args); va_end(args); message = SvPV(msv,l1); @@ -10,7 +10,7 @@ BEGIN { use Config; $Is_Dosish = ($^O eq 'MSWin32' or $^O eq 'dos' or - $^O eq 'os2' or $^O eq 'mint'); + $^O eq 'os2' or $^O eq 'mint' or $^O =~ /cygwin/); print "1..28\n"; diff --git a/t/io/tell.t b/t/io/tell.t index afcfcb5800..8df0228c31 100755 --- a/t/io/tell.t +++ b/t/io/tell.t @@ -6,8 +6,11 @@ print "1..21\n"; $TST = 'tst'; +$Is_Dosish = ($^O eq 'MSWin32' or $^O eq 'dos' or + $^O eq 'os2' or $^O eq 'mint' or $^O =~ /cygwin/); + open($TST, '../Configure') || (die "Can't open ../Configure"); -binmode $TST if $^O eq 'MSWin32'; +binmode $TST if $Is_Dosish; if (eof(tst)) { print "not ok 1\n"; } else { print "ok 1\n"; } $firstline = <$TST>; diff --git a/t/lib/anydbm.t b/t/lib/anydbm.t index 4d33e2233a..a38b5f680e 100755 --- a/t/lib/anydbm.t +++ b/t/lib/anydbm.t @@ -12,6 +12,9 @@ use Fcntl; print "1..12\n"; +$Is_Dosish = ($^O eq 'amigaos' || $^O eq 'MSWin32' or $^O eq 'dos' or + $^O eq 'os2' or $^O eq 'mint' or $^O =~ /cygwin/); + unlink <Op_dbmx*>; umask(0); @@ -22,7 +25,7 @@ $Dfile = "Op_dbmx.pag"; if (! -e $Dfile) { ($Dfile) = <Op_dbmx*>; } -if ($^O eq 'amigaos' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'dos') { +if ($Is_Dosish) { print "ok 2 # Skipped: different file permission semantics\n"; } else { diff --git a/t/op/stat.t b/t/op/stat.t index 6f2d00b7e6..ae627f6070 100755 --- a/t/op/stat.t +++ b/t/op/stat.t @@ -13,7 +13,7 @@ print "1..58\n"; $Is_MSWin32 = $^O eq 'MSWin32'; $Is_Dos = $^O eq 'dos'; -$Is_Dosish = $Is_Dos || $^O eq 'os2' || $Is_MSWin32; +$Is_Dosish = $Is_Dos || $^O eq 'os2' || $Is_MSWin32 || $^O =~ /cygwin/; chop($cwd = ($Is_MSWin32 ? `cd` : `pwd`)); $DEV = `ls -l /dev` unless $Is_Dosish; @@ -93,6 +93,9 @@ foreach ((12,13,14,15,16,17)) { print "ok $_\n"; #deleted tests } +# in ms windows, Op.stat.tmp inherits owner uid from directory +# not sure about os/2, but chown is harmless anyway +chown $>,'Op.stat.tmp'; chmod 0700,'Op.stat.tmp'; if (-r 'Op.stat.tmp') {print "ok 18\n";} else {print "not ok 18\n";} if (-w 'Op.stat.tmp') {print "ok 19\n";} else {print "not ok 19\n";} @@ -2209,7 +2209,7 @@ my_pclose(PerlIO *ptr) } #endif /* !DOSISH */ -#if !defined(DOSISH) || defined(OS2) || defined(WIN32) +#if !defined(DOSISH) || defined(OS2) || defined(WIN32) || defined(CYGWIN32) I32 wait4pid(int pid, int *statusp, int flags) { |