Author: allison
Date: Sun Jan 4 13:25:29 2009
New Revision: 34940
Modified:
trunk/config/auto/opengl.pm
trunk/config/gen/opengl.pm
trunk/config/init/defaults.pm
trunk/config/init/hints/cygwin.pm
trunk/config/init/hints/mswin32.pm
trunk/lib/Parrot/Configure/Step/Methods.pm
trunk/tools/build/cygchkdll.sh
Log:
[pdd30install] Build enhancements specific to Cygwin. Extracted from
pdd30install branch (Reini Urban).
Modified: trunk/config/auto/opengl.pm
==============================================================================
--- trunk/config/auto/opengl.pm (original)
+++ trunk/config/auto/opengl.pm Sun Jan 4 13:25:29 2009
@@ -114,14 +114,16 @@
The Cygwin/w32api for native opengl support
-F<-lglut32 -lglu32 -lopengl32>
-
+F<opengl>, F<w32api>
=head3 Cygwin/X
Requires a X server.
-F<freeglut>, F<libglut-devel>
+F<freeglut>, F<libglut-devel>, F<xorg-x11-devel>
+
+This is detected if freeglut is installed and DISPLAY is set.
+It requires an X server.
=cut
@@ -168,24 +170,20 @@
my $osname = $conf->data->get_p5('OSNAME');
# Prefer Cygwin/w32api over Cygwin/X, but use X when DISPLAY is set
- if ($^O eq 'cygwin' and $ENV{DISPLAY}) {
- $self->_add_to_libs( {
- conf => $conf,
- osname => $osname,
- cc => $cc,
- cygwin => '-lglut -L/usr/X11R6/lib -lGLU -lGL'
- } )
- }
- else {
- $self->_add_to_libs( {
+ $self->_add_to_libs( {
conf => $conf,
osname => $osname,
cc => $cc,
+ # Prefer Cygwin/w32api over Cygwin/X, but use X when DISPLAY is set
+ ($^O eq 'cygwin') ?
+ ($ENV{DISPLAY} ? (cygwin => '-lglut -L/usr/X11R6/lib -lGLU -lGL')
+ : (cygwin => '-lglut32 -lglu32 -lopengl32'))
+ : (),
win32_gcc => '-lglut32 -lglu32 -lopengl32',
win32_nongcc => 'opengl32.lib glu32.lib glut32.lib',
darwin => '-framework OpenGL -framework GLUT',
default => '-lglut -lGLU -lGL',
- } ) };
+ } );
# On OS X check the presence of the OpenGL headers in the standard
# Fink/macports locations.
Modified: trunk/config/gen/opengl.pm
==============================================================================
--- trunk/config/gen/opengl.pm (original)
+++ trunk/config/gen/opengl.pm Sun Jan 4 13:25:29 2009
@@ -448,6 +448,9 @@
# "$ENV{HOME}/src/osx-insane/usr/X11R6 1/include/GL/*.h",
);
+ # X freeglut only if DISPLAY is set, otherwise use native w32api GLUT
+ shift @header_globs if $^O eq 'cygwin' and !$ENV{DISPLAY};
+
print "\nChecking for OpenGL headers using the following globs:\n\t",
join("\n\t", @header_globs), "\n"
if $verbose;
Modified: trunk/config/init/defaults.pm
==============================================================================
--- trunk/config/init/defaults.pm (original)
+++ trunk/config/init/defaults.pm Sun Jan 4 13:25:29 2009
@@ -200,9 +200,6 @@
make_set_make => $Config{make_set_make},
make_and => '&&',
- # for cygwin
- cygchkdll => '',
-
# make_c: Command to emulate GNU make's C<-C directory> option: chdir
# to C<directory> before executing $(MAKE)
make_c => '$(PERL) -e \'chdir shift @ARGV; system q{$(MAKE)}, @ARGV;
exit $$? >> 8;\'',
Modified: trunk/config/init/hints/cygwin.pm
==============================================================================
--- trunk/config/init/hints/cygwin.pm (original)
+++ trunk/config/init/hints/cygwin.pm Sun Jan 4 13:25:29 2009
@@ -13,19 +13,31 @@
# in the standard installation, so we get rid of it
my $libs = $conf->data->get('libs');
$libs =~ s/-lutil\b//g;
+ # same for -lm and -dl
+ $libs =~ s/-lm\b//g;
+ $libs =~ s/-ldl\b//g;
my $build_dir = $conf->data->get('build_dir');
$build_dir =~ s/ /\\ /g;
+ my $libparrot_shared = $conf->data->get('libparrot_shared');
+ # force cyg prefix
+ $libparrot_shared =~ s/^lib/cyg/g;
+ # force the dll versioning
+ my @parrot_version = Parrot::BuildUtil::parrot_version();
+ my $dllsuffix = join("_",@parrot_version);
+ $libparrot_shared =~ s/parrot\.dll/parrot$dllsuffix\.dll/;
- # 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
+ # An old note about building shared libraries: Perl5 used the 'ld2' tool
until
+ # 5.8.8-4, 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
$conf->data->set(
build_dir => $build_dir,
- ld => 'gcc',
+ ld => $conf->data->get('ld') eq 'ld2'
+ ? 'gcc' # do not use old perl5 linker helper
+ : $conf->data->get('ld'), # gcc or g++
ld_share_flags => '-shared',
ld_load_flags => '-shared',
libs => $libs,
@@ -34,7 +46,10 @@
parrot_is_shared => 1,
sym_export => '__declspec(dllexport)',
sym_import => '__declspec(dllimport)',
- cygchkdll => 'tools/build/cygchkdll.sh $(MINIPARROT)
$(LIBPARROT)',
+ #cygchkdll => 'tools/build/cygchkdll.sh $(MINIPARROT)
$(LIBPARROT)',
+ libparrot_shared => $libparrot_shared,
+ blib_dir => '.',
+ libparrot_ldflags => '-L' . $build_dir . ' -lparrot',
);
# inet_aton needs to be defined on Cygwin.
Modified: trunk/config/init/hints/mswin32.pm
==============================================================================
--- trunk/config/init/hints/mswin32.pm (original)
+++ trunk/config/init/hints/mswin32.pm Sun Jan 4 13:25:29 2009
@@ -100,9 +100,7 @@
# If we are building shared, need to include dynamic libparrot.lib,
otherwise
# the static libparrot.lib.
- if ( $conf->data->get('parrot_is_shared') ) {
- $conf->data->set( libparrot_ldflags =>
$conf->data->get('build_dir') . '/libparrot.lib' );
- }
+ $conf->data->set( libparrot_ldflags => 'libparrot.lib' );
# 'link' needs to be link.exe, not cl.exe.
# This makes 'link' and 'ld' the same.
@@ -232,7 +230,7 @@
has_dynamic_linking => 1,
ld_load_flags => '-shared ',
ld_share_flags => '-shared ',
- libparrot_ldflags => $conf->data->get('build_dir') .
'/libparrot.dll',
+ libparrot_ldflags => 'libparrot.dll',
ncilib_link_extra => 'src/libnci_test.def',
sym_export => '__declspec(dllexport)',
sym_import => '__declspec(dllimport)',
Modified: trunk/lib/Parrot/Configure/Step/Methods.pm
==============================================================================
--- trunk/lib/Parrot/Configure/Step/Methods.pm (original)
+++ trunk/lib/Parrot/Configure/Step/Methods.pm Sun Jan 4 13:25:29 2009
@@ -119,6 +119,7 @@
cc => $cc,
win32_gcc => '-lalpha32 -lalpha32 -lopenalpha32',
win32_nongcc => 'alpha.lib',
+ cygwin => '-lalpha32 -lXalpha32', # optional
darwin => 'alphadarwin.lib',
default => '-lalpha',
} );
@@ -138,6 +139,8 @@
=item * MSWin32 with any C-compiler other than F<gcc>.
+=item * Cygwin to override Mingw.
+
=item * Darwin.
=back
@@ -173,7 +176,7 @@
=item * C<win32_gcc>
-Libraries to be added where OS is mswin32 and C-compiler is F<gcc>.
+Libraries to be added where OS is mswin32 or cygwin and C-compiler is F<gcc>.
Single whitespace-delimited string.
=item * C<win32_nongcc>
@@ -181,6 +184,12 @@
Libraries to be added where OS is mswin32 and C-compiler is not F<gcc>.
Single whitespace-delimited string.
+=item * C<cygwin>
+
+Optional libraries to be added where OS is cygwin. This overrides C<win32_gcc>
+if defined.
+Single whitespace-delimited string.
+
=item * C<darwin>
Libraries to be added where OS is Darwin. Do not supply a value if the value
@@ -197,7 +206,8 @@
my $args = shift;
croak "_add_to_libs() takes hashref: $!" unless ref($args) eq 'HASH';
my $platform =
- (($args->{osname} =~ /mswin32/i ||
+ $args->{osname} =~ /cygwin/i ? 'cygwin'
+ :(($args->{osname} =~ /mswin32/i ||
$args->{osname} =~ /cygwin/i) &&
$args->{cc} =~ /^gcc/i) ? 'win32_gcc'
: $args->{osname} =~ /mswin32/i ? 'win32_nongcc'
Modified: trunk/tools/build/cygchkdll.sh
==============================================================================
--- trunk/tools/build/cygchkdll.sh (original)
+++ trunk/tools/build/cygchkdll.sh Sun Jan 4 13:25:29 2009
@@ -1,5 +0,0 @@
-libname=${2##*/}
-if cygcheck ./$1 | egrep "Error.*find.*$libname" >/dev/null ; then
- echo "Could not find $2. Guessing you need to add `pwd`/blib/lib to
PATH."
- exit 1
-fi