When I follow the instructions what I've published in parrot/README.win32, the builded perl program gives : $ perl -e "print $^O" MSWin32
For me, mingw is not a platform (MSWin32 and cygwin are a platform), just the GCC compiler under MSWin32.
$mingw = ($^O eq 'MSWin32' and $Config{cc} eq 'gcc')
So, the case $is_mingw in config/init/hints/mswin32.pl is the good way to handle this compiler.
README.win32: "As Configure.pl extracts configuration from the perl program, first build/install perl with MinGW (no binary distribution available)."
But more obtainable/common are:
# run: cmd.exe C:\>perl -e "print $^O" MSWin32 C:\>perl -v This is perl, v5.8.4 built for MSWin32-x86-multi-thread Binary build 810 provided by ActiveState Corp. C:\>set PATH=%PATH%;C:\mingw\bin C:\>gcc -v gcc version 3.2.3 (mingw special 20030504-1)
# run: C:\msys\msys.bat $ perl -e "print $^O" msys $ perl -v This is perl, v5.6.1 built for msys $ which gcc /mingw/bin/gcc $ gcc -v gcc version 3.2.3 (mingw special 20030504-1)
# run C:\cygwin\cygwin.bat $ perl -e "print $^O" cygwin $ perl -v This is perl, v5.8.6 built for cygwin-thread-multi-64int $ which gcc /usr/bin/gcc $ gcc -v gcc version 3.3.3 (cygwin special)
See attached win32-env.txt for full listings.
I was thinking about merge cygwin.pl with mswin32.pl. my $O = lc($^O); $O = 'mswin32' if $O =~ /^(msys|cygwin)/; my $hints = "config/init/hints/" . $O . ".pl";
See attached mswin32.pl
See also http://xrl.us/fddn (MJWiki:Build Parrot with MinGW)
S pozdravem Michal Jurosz
C:\usr>perl -e "print $^O" MSWin32
C:\usr>perl -v This is perl, v5.8.4 built for MSWin32-x86-multi-thread (with 3 registered patches, see perl -V for more detail) Copyright 1987-2004, Larry Wall Binary build 810 provided by ActiveState Corp. http://www.ActiveState.com ActiveState is a division of Sophos. Built Jun 1 2004 11:52:21 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. C:\>set PATH=%PATH%;C:\mingw\bin C:\usr>gcc -v Reading specs from C:/mingw/bin/../lib/gcc-lib/mingw32/3.2.3/specs Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host= mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable -languages=c++,f77,objc --disable-win32-registry --disable-shared --enable-sjlj- exceptions Thread model: win32 gcc version 3.2.3 (mingw special 20030504-1) # ---------------------------------------------------------------------------- msys This is perl, v5.6.1 built for msys Copyright 1987-2001, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. /mingw/bin/gcc Reading specs from c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.3/specs Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host= mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable -languages=c++,f77,objc --disable-win32-registry --disable-shared --enable-sjlj -exceptions Thread model: win32 gcc version 3.2.3 (mingw special 20030504-1) # ---------------------------------------------------------------------------- C:\cygwin>perl -e "print $^O" cygwin C:\cygwin>perl -v This is perl, v5.8.6 built for cygwin-thread-multi-64int Copyright 1987-2004, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. C:\cygwin>which gcc /usr/bin/gcc C:\cygwin>gcc -v $ ./env.bat 2>&1 > des Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr --exec-prefi x=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/s hare/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc, pascal --enable-nls --without-included-gettext --enable-libgcj --with-system-zli b --enable-interpreter --enable-threads=posix --enable-java-gc=boehm --enable-sj lj-exceptions --disable-version-specific-runtime-libs --disable-win32-registry Thread model: posix gcc version 3.3.3 (cygwin special)
{
my %args;
@[EMAIL PROTECTED]@_;
my($cc, $ccflags, $libs)=Configure::Data->get(qw(cc ccflags libs));
# Later in the Parrot::Configure::RunSteps->runsteps process,
# inter/progs.pl will merge the command-line overrides with the defaults.
# We do one bit of its work early here, because we need the result now.
$cc = $args{cc} if defined $args{cc};
my $is_msvc = grep { $cc eq $_ } ( qw(cl cl.exe) );
my $is_intel = grep { $cc eq $_ } ( qw(icl icl.exe) );
my $is_bcc = grep { $cc eq $_ } ( qw(bcc32 bcc32.exe) );
my $is_gcc = grep { $cc eq $_ } ( qw(gcc gcc.exe) );
my $is_gnu = $is_gcc && ( lc($^O) ne 'mswin32' ); # cygwin or msys
Configure::Data->set(
PQ => '"',
make_c => '$(PERL) -e "chdir shift @ARGV; system \'$(MAKE)\', @ARGV; exit $$? >> 8;"',
ncilib_link_extra => '-def:src/libnci_test.def',
);
unless ( $is_gnu ) {
Configure::Data->set(
rm_f => '$(PERL) -MExtUtils::Command -e rm_f',
rm_rf => '$(PERL) -MExtUtils::Command -e rm_rf',
);
}
unless ( $is_gcc ) {
Configure::Data->set(
share_ext => '.dll',
load_ext => '.dll',
a => '.lib',
o => '.obj',
slash => '\\',
cp => 'copy',
ar_flags => '',
);
}
if( $is_msvc ) {
# Check the output of cl.exe to see if it contains the
# string 'Standard' and remove the -O1 option if it does.
# This will prevent the 'optimization is not available in the
# standard edition compiler' warning each time we compile.
# The logo gets printed to STDERR; hence the redirection.
my $cc_output = `$cc /? 2>&1`;
$ccflags =~ s/-O1 // if $cc_output =~ m/Standard/ || $cc_output =~ m{/ZI};
$ccflags =~ s/-Gf/-GF/ if $cc_output =~ m/Version (\d+)/ && $1 >= 13;
Configure::Data->set(
cc_o_out => '-Fo',
cc_exe_out => '-out:',
cc_ldflags => '/link',
cc_debug => '-Zi', #ZI messes with __LINE__
ld_debug => '-debug',
ld_share_flags => '-dll -def:libparrot.def',
ld_load_flags => '-dll -def:libparrot.def',
ld_out => '-out:',
ldflags => '-nologo -nodefaultlib',
blib_lib_libparrot_a => 'blib/lib/libparrot_s$(A)',
ar_out => '-out:',
ccflags => $ccflags,
ccwarn => ''
);
# 'link' needs to be link.exe, not cl.exe.
# This makes 'link' and 'ld' the same.
Configure::Data->set('link', Configure::Data->get('ld'));
# We can't use -opt: and -debug together.
if (Configure::Data->get('ld_debug') =~ /-debug/) {
my $linkflags = Configure::Data->get('linkflags');
$linkflags =~ s/-opt:\S+//;
Configure::Data->set('linkflags', $linkflags);
}
}
elsif( $is_intel ) {
Configure::Data->set(
cc_o_out => '-Fo',
cc_exe_out => '-out:',
cc_ldflags => '/link',
cc_debug => '-Zi', #ZI messes with __LINE__
libs => "$libs libircmt.lib",
ld => 'xilink',
ld_debug => '-debug',
ld_share_flags => '-dll -def:libparrot.def',
ld_load_flags => '-dll -def:libparrot.def',
ld_out => '-out:',
ldflags => '-nologo -nodefaultlib',
blib_lib_libparrot_a => 'blib/lib/libparrot_s$(A)',
ar => 'xilib',
ar_out => '-out:',
ccflags => $ccflags,
ccwarn => ''
);
# 'link' needs to be xilink.exe, not icl.exe.
# This makes 'link' and 'ld' the same.
Configure::Data->set('link', Configure::Data->get('ld'));
# We can't use -opt: and -debug together.
if (Configure::Data->get('ld_debug') =~ /-debug/) {
my $linkflags = Configure::Data->get('linkflags');
$linkflags =~ s/-opt:\S+//;
Configure::Data->set('linkflags', $linkflags);
}
}
elsif( $is_bcc ) {
Configure::Data->set(
cc => ${cc},
ccflags => '-O2 -w-8066 -DWIN32 -DNO_STRICT -DNDEBUG -D_CONSOLE',
cc_o_out => '-o',
cc_exe_out => '-e',
cc_debug => '-v',
ld => ${cc},
ldflags => '',
ld_out => '-e',
cc_ldflags => '',
ld_debug => '-v',
ld_share_flags => '-WD',
ld_load_flags => '-WD',
libs => 'import32.lib cw32.lib',
link => ${cc},
linkflags => '',
ar => 'tlib',
ar_out => '',
ar_extra => '/au',
make_and => "\n\t",
blib_lib_libparrot_a => 'blib\lib\libparrot.lib',
);
}
elsif ( $is_gcc && ( lc($^O) eq 'cygwin' ) ) {
# cygwin's perl is compiled with -lutil, which for some reason is not
# in the standard installation, so we get rid of it
$libs =~ s/-lutil\b//g;
# A note about building shared libraries: Perl5 uses the 'ld2' tool, which
# is installed as part of the perl5 installation. So far, it appears
# parrot can get by with simply using gcc -shared, so we override the
# perl5 Configure defaults and use 'gcc -shared' instead of 'ld2'.
# If this later causes problems, it might be worth revisiting.
# A. Dougherty 9/9/2002
Configure::Data->set(
ld => 'gcc',
ld_share_flags => '-shared',
ld_load_flags => '-shared',
libs => $libs,
);
#We need to define inet_aton on Cygwin. The contents of the --define switch
# are in $_[2].
# XXX EVIL EVIL EVIL HACK. If you need to do this elsewhere, please do
# everyone a favor and write a proper interface for modifying the command-line
# args, or even better do something to make the define interface not suck.
unless($_[2]) {
$_[2]='inet_aton';
}
elsif($_[2] !~ /inet_[ap]ton/) {
$_[2]=join(',', 'inet_aton', $_[2]);
}
}
elsif ( $is_gcc && ( lc($^O) eq 'mswin32' ) ) {
# ActivePerl and MinGW
$libs='' if $libs =~ /\.lib\s/i;
Configure::Data->set(
link => 'gcc',
libs => $libs,
slash => '/',
ar => 'ar',
);
}
elsif ( $is_gcc && ( lc($^O) eq 'msys' ) ) {
$libs='' if $libs =~ /\.lib\s/i;
$libs .= ' ' if $libs;
$libs .= '/mingw/lib/libwsock32.a';
Configure::Data->set(
link => 'gcc',
libs => $libs,
slash => '/',
ar => 'ar',
ld => '/bin/perl /bin/perlld',
);
}
}
