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
lib/ExtUtils/Installed.pm Information on installed extensions
lib/ExtUtils/Liblist.pm Locates libraries
lib/ExtUtils/MM_OS2.pm MakeMaker methods for OS/2
+lib/ExtUtils/MM_Cygwin.pm MakeMaker methods for Cygwin
lib/ExtUtils/MM_Unix.pm MakeMaker base class for Unix
lib/ExtUtils/MM_VMS.pm MakeMaker methods for VMS
lib/ExtUtils/MM_Win32.pm MakeMaker methods for Win32
More info about this project can be found at it's home page
http://sourceware.cygnus.com/cygwin/
- Cygnus Solutions also made the first set of notes and tools for
-building perl under Cygwin32 beta17.
+=item libperl.dll
-=item als
+These instructions and the default cygwin32 hints build a a shared
+libperl.dll Perl library and enables dynamically loaded extensions.
-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
=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
+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
+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
+=item install executable
-if you are reading this, those are probably applied already.
+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.
=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).
+http://miracle.geol.msu.ru/sos/ points to two different crypt
+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/
=back
=head2 Configure
+Check hints/cygwin32.sh for any system specific settings. In
+particular change libpth if Cygwin is installed somewhere other
+than /cygnus.
+
run "sh Configure".
When confronted with this prompt:
=end text
-guess what system do you have. (hint: select "cygwin32").
+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.
+Do not use the malloc that comes with perl--using the perl malloc
+collides with some cygwin startup routines.
=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:
+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:
=begin text
-------------------------------------------------------------------------------
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/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 3 8.57% 1, 23, 30
-op/stat.t 58 3 5.17% 2, 9, 26
+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
-8 tests skipped, plus 35 subtests skipped.
-Failed 7/190 test scripts, 96.32% okay. 38/6454 subtests failed, 99.41% okay.
+9 tests skipped, plus 35 subtests skipped.
+Failed 9/190 test scripts, 95.26% okay. 40/6452 subtests failed, 99.38% okay.
=end text
=head1 BUGS
-a lot of warnings about incompatible pointer types and comparison
-lacking a cast. this is because of __declspec(dllimport).
+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
+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.
+The lib/io_sock.t failure seems to be a problem with a forked child
+not having its DLLs remapped.
-make clean does not remove library .def and .exe.core files
+make clean does not remove library .def and .exe.core files.
-ld2 script is installed with reference to source directory. you should
+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.
-library man pages are not installed correctly due to file system limitations.
-use perldoc script to read about things like foo::bar.
-
=head1 AUTHOR
alexander smishlajev <als@turnhere.com>
=head1 DISCLAIMER
-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.
+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.
=head1 HISTORY
17..25-apr-1999. perl 5.005_03. cygwin b20.1 egcs 1.1.2.
far 1.60. nescafe classic.
+efifer@sanwaint.com - Wed May 12 17:22:42 BST 1999
+
+ 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.
+
=cut
# else
# 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
$spitshell >>Makefile <<!GROK!THIS!
# shell script feeding perlld to decent perl
-ld2: $& Makefile perlld ${src}/cygwin32/ld2.in ${src}/impure_ptr\$(OBJ_EXT)
+ld2: $& Makefile perlld ${src}/cygwin32/ld2.in
@echo "extracting ld2 (with variable substitutions)"
@$sed s,@buildpath@,$addtopath,g <${src}/cygwin32/ld2.in >ld2
!GROK!THIS!
DEF_EXT = .def
EXP_EXT = .exp
-perlld: $& Makefile ${src}/cygwin32/perlld.in ${src}/impure_ptr\$(OBJ_EXT)
+perlld: $& Makefile ${src}/cygwin32/perlld.in
@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 \\
case "$useshrplib" in
true)
$spitshell >>Makefile <<'!NO!SUBS!'
-# impure pointer initialisation
-cwobj = impure_ptr$(OBJ_EXT) $(obj)
+cwobj = $(obj)
# override default rule (NB: make croaks!) to force dll usage
perlmain$(OBJ_EXT): perlmain.c
$(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) \
+++ /dev/null
-/*
- * 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;
-
-}
$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 ="$DLLWRAP --dllname $dllname";
$command .=" --driver-name $WRAPDRIVER" if $WRAPDRIVER;
$command .=" --dlltool $DLLTOOL" if $DLLTOOL;
$command .=" --export-all-symbols" if $EXPORT_ALL;
# define BIT_BUCKET "nul"
# else
# ifdef CYGWIN32
- extern struct _reent *__imp_reent_data; /* global impure pointer */
# define PERL_SYS_INIT(c,v) \
- MALLOC_INIT; impure_setup(__imp_reent_data);
+ MALLOC_INIT;
# define OP_BINARY O_BINARY
# define BIT_BUCKET "nul"
# define HAS_IOCTL
// modules are dynamically built. This should be similar to the behavoir on sunOS.
// Leaving in the logic would have required changes to the standard perlmain.c code
//
-// // Includes call a dll function to initialize it's impure_ptr.
#include <stdio.h>
-void (*impure_setupptr)(struct _reent *); // pointer to the impure_setup routine
//#include <windows.h>
#define LOAD_WITH_ALTERED_SEARCH_PATH (8)
typedef HANDLE HINSTANCE;
#define STDCALL __attribute__ ((stdcall))
typedef int STDCALL (*FARPROC)();
+#define MAX_PATH 260
HINSTANCE
STDCALL
int flags
PREINIT:
CODE:
+ {
+ char win32_path[MAX_PATH];
+ cygwin_conv_to_full_win32_path(filename, win32_path);
+ filename = win32_path;
+
DLDEBUG(1,PerlIO_printf(PerlIO_stderr(),"dl_load_file(%s):\n", filename));
RETVAL = (void*) LoadLibraryExA(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ) ;
ST(0) = sv_newmortal() ;
if (RETVAL == NULL){
SaveError("%d",GetLastError()) ;
+ } else {
+ sv_setiv( ST(0), (IV)RETVAL);
}
- else{
- // setup the dll's impure_ptr:
- impure_setupptr = GetProcAddress(RETVAL, "impure_setup");
- if( impure_setupptr == NULL){
- printf(
- "Cygwin32 dynaloader error: could not load impure_setup symbol\n");
- RETVAL = NULL;
- }
- else{
- // setup the DLLs impure_ptr:
- (*impure_setupptr)(_impure_ptr);
- sv_setiv( ST(0), (IV)RETVAL);
- }
}
}
# define times(t) vms_times(t)
#else
+#if defined (CYGWIN32)
+# define tzname _tzname
+#endif
#if defined (WIN32)
# undef mkfifo
# define mkfifo(a,b) not_here("mkfifo")
# cygwin32.sh - hintsfile for building perl on Windows NT using the
# Cygnus Win32 Development Kit.
#
-_a='.a'
+
_exe='.exe'
-_o='.o'
+exe_ext='.exe'
+# work around case-insensitive file names
+firstmakefile='GNUmakefile'
+sharpbang='#!'
+startsh='#!/bin/sh'
+
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
+libpth='/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/lib /usr/local/lib'
+so='dll'
+libs='-lcygwin -lm -lc -lkernel32'
+#optimize='-g'
ccflags='-DCYGWIN32'
-clocktype='clock_t'
-cryptlib='-lcrypt'
-dlext='dll'
+ldflags='-L. -L/usr/local/lib'
+usemymalloc='n'
dlsrc='dl_cygwin32.xs'
-exe_ext='.exe'
-# work around case-insensitive file names
-firstmakefile='GNUmakefile'
-gidtype='gid_t'
-installman1dir='/usr/local/man/man1'
-installman3dir='/usr/local/man/man3'
-installscript='/usr/local/bin'
-installsitelib='/usr/local/lib/perl5/site_perl'
-installusrbinperl='undef'
+cccdlflags=' '
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'
-sysman='/usr/local/man/man1'
-usenm='false'
-useperlio='define'
+lddlflags='--export-dynamic -L. -L/usr/local/lib'
useshrplib='true'
-usevfork='true'
-usrinc='/usr/i586-cygwin32/include'
+libperl='libperl.a'
+dlext='dll'
+
+man1dir=/usr/local/man/man1
+man3dir=/usr/local/man/man3
+sitelib=/usr/local/lib/perl5/site_perl
# Convert name from File/Basename.pm to File::Basename.3 format,
# if necessary.
$manpage =~ s#\.p(m|od)$##;
- if ($^O eq 'os2' || $^O eq 'amigaos' || $^O eq 'uwin') {
+ if ($^O eq 'os2' || $^O eq 'amigaos' || $^O eq 'uwin' || $^O =~ /cygwin/) {
$manpage =~ s#/#.#g;
} else {
$manpage =~ s#/#::#g;
# [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') {
--- /dev/null
+package ExtUtils::MM_Cygwin;
+
+use Config;
+#use Cwd;
+#use File::Basename;
+require Exporter;
+
+Exporter::import('ExtUtils::MakeMaker',
+ qw( $Verbose &neatvalue));
+
+unshift @MM::ISA, 'ExtUtils::MM_Cygwin';
+
+sub canonpath {
+ my($self,$path) = @_;
+ $path =~ s|\\|/|g;
+ return $self->ExtUtils::MM_Unix::canonpath($path);
+}
+
+sub cflags {
+ my($self,$libperl)=@_;
+ return $self->{CFLAGS} if $self->{CFLAGS};
+ my $base =$self->ExtUtils::MM_Unix::cflags($libperl);
+ foreach (split /\n/, $base) {
+ / *= */ and $self->{$`} = $';
+ };
+ $self->{CCFLAGS} .= " -DUSEIMPORTLIB" if ($Config{useshrplib} eq 'true');
+ $self->{CCFLAGS} .= " -DCYGWIN32" unless ($self->{CCFLAGS} =~ /\-DCYGWIN32/);
+
+ return $self->{CFLAGS} = qq{
+CCFLAGS = $self->{CCFLAGS}
+OPTIMIZE = $self->{OPTIMIZE}
+PERLTYPE = $self->{PERLTYPE}
+LARGE = $self->{LARGE}
+SPLIT = $self->{SPLIT}
+};
+
+}
+
+sub manifypods {
+ my($self, %attribs) = @_;
+ return "\nmanifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless
+ %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
+ my($dist);
+ my($pod2man_exe);
+ if (defined $self->{PERL_SRC}) {
+ $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
+ } else {
+ $pod2man_exe = $self->catfile($Config{scriptdirexp},'pod2man');
+ }
+ unless ($self->perl_script($pod2man_exe)) {
+ # No pod2man but some MAN3PODS to be installed
+ print <<END;
+
+Warning: I could not locate your pod2man program. Please make sure,
+ your pod2man program is in your PATH before you execute 'make'
+
+END
+ $pod2man_exe = "-S pod2man";
+ }
+ my(@m);
+ push @m,
+qq[POD2MAN_EXE = $pod2man_exe\n],
+qq[POD2MAN = \$(PERL) -we '%m=\@ARGV;for (keys %m){' \\\n],
+q[-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "],
+ $self->{MAKEFILE}, q[";' \\
+-e 'print "Manifying $$m{$$_}\n"; $$m{$$_} =~ s/::/./g;' \\
+-e 'system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
+-e 'chmod(oct($(PERM_RW))), $$m{$$_} or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}'
+];
+ push @m, "\nmanifypods : pure_all ";
+ push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
+
+ push(@m,"\n");
+ if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
+ push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t";
+ push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}};
+ }
+ join('', @m);
+}
+
+sub perl_archive
+{
+ return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a");
+}
+
+1;
+__END__
+
+=head1 NAME
+
+ExtUtils::MM_Cygwin - methods to override UN*X behaviour in ExtUtils::MakeMaker
+
+=head1 SYNOPSIS
+
+ use ExtUtils::MM_Cygwin; # Done internally by ExtUtils::MakeMaker if needed
+
+=head1 DESCRIPTION
+
+See ExtUtils::MM_Unix for a documentation of the methods provided there.
+
+=over
+
+=item canonpath
+
+replaces backslashes with forward ones. then acts as *nixish.
+
+=item cflags
+
+if configured for dynamic loading, triggers #define EXT in EXTERN.h
+
+=item manifypods
+
+replaces strings '::' with '.' in man page names
+
+=item perl_archive
+
+points to libperl.a
#undef PERLVARI
#undef PERLVARIC
-#if defined(HASATTRIBUTE) && defined(WIN32)
+#if defined(HASATTRIBUTE) && defined(WIN32) && !defined(CYGWIN32)
/*
* This provides a layer of functions and macros to ensure extensions will
* get to use the same RTL functions as the core.
}
#ifndef VMS /* VMS' my_setenv() is in VMS.c */
-#ifndef WIN32
+#if !defined(WIN32) && !defined(CYGWIN32)
void
my_setenv(char *nam, char *val)
{