Skip to content

Commit

Permalink
Refine init::hints::darwin. Move settings of certtain flags out of au…
Browse files Browse the repository at this point in the history
…to::gcc and into init::defaults or hints files.
  • Loading branch information
jkeenan committed Aug 29, 2011
1 parent 82fc9fd commit 7eaf3f3
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 40 deletions.
28 changes: 14 additions & 14 deletions config/auto/gcc.pm
Expand Up @@ -83,20 +83,20 @@ sub _evaluate_gcc {
$gccversion .= ".$minor" if defined $minor;
$self->set_result("yes, $gccversion");

if ($^O eq 'MSWin32') {
$conf->data->set(
cc_shared => '',
ld_share_flags => '-shared',
ld_load_flags => '-shared',
);
}
else {
$conf->data->set(
cc_shared => '-fPIC',
ld_share_flags => '-shared -fPIC',
ld_load_flags => '-shared -fPIC',
);
}
# if ($^O eq 'MSWin32') {
# $conf->data->set(
# cc_shared => '',
# ld_share_flags => '-shared',
# ld_load_flags => '-shared',
# );
# }
# else {
# $conf->data->set(
# cc_shared => '-fPIC',
# ld_share_flags => '-shared -fPIC',
# ld_load_flags => '-shared -fPIC',
# );
# }

$conf->data->set( noinline => '__attribute__ ((noinline))' );

Expand Down
30 changes: 15 additions & 15 deletions config/init/defaults.pm
Expand Up @@ -176,7 +176,10 @@ sub runstep {

# libparrot library names
libparrot_static => 'libparrot.a',
# libparrot_shared and libparrot_soname may be overwritten in
# OS-specific hints files
libparrot_shared => 'libparrot.so',
libparrot_soname => '',

# does the system know about static/dynamic linking?
has_static_linking => 1,
Expand All @@ -185,8 +188,6 @@ sub runstep {
# default behaviour for linking parrot to a static or shared libparrot
parrot_is_shared => 0,

#avoid a warning during Configure.pl
libparrot_soname => '',

perl => $^X,
test_prog => 'parrot',
Expand All @@ -201,21 +202,20 @@ sub runstep {
rm_rf => '$(PERL) -MExtUtils::Command -e rm_rf',
touch => '$(PERL) -MExtUtils::Command -e touch',

ar => 'ar',
arflags => 'cr',
# tar is currently used only in 'make release'.
tar => which('tar') || '',

ranlib => ':',
ar => 'ar',
arflags => 'cr',
# for Win32
ar_out => '',

ar_out => '',
# for Borland C
ar_extra => '',
ranlib => ':',
rpath => '',
make => $Config{make},
make_set_make => $Config{make_set_make},
make_and => '&&',
ar_extra => '',

# tar is currently used only in 'make release'.
tar => which('tar') || '',
rpath => '',
make => $Config{make},
make_set_make => $Config{make_set_make},
make_and => '&&',

# make_c: Command to emulate GNU make's C<-C directory> option: chdir
# to C<directory> before executing $(MAKE)
Expand Down
20 changes: 14 additions & 6 deletions config/init/hints/darwin.pm
Expand Up @@ -21,7 +21,7 @@ our %defaults = (
sub runstep {
my ( $self, $conf ) = @_;

my $share_ext = $conf->option_or_data('share_ext');
my $share_ext = '.dylib';
my $version = $conf->option_or_data('VERSION');

# The hash referenced by $flagsref is the list of options that have -arch
Expand Down Expand Up @@ -63,15 +63,15 @@ sub runstep {
my $osvers = `/usr/sbin/sysctl -n kern.osrelease`;
chomp $osvers;

$conf->data->set(
my %darwin_hints = (
darwin => 1,
osx_version => $deploy_target,
osvers => $osvers,
ccflags => $flagsref->{ccflags},
ldflags => $flagsref->{ldflags},
ccwarn => "-Wno-shadow",
libs => $libs,
share_ext => '.dylib',
share_ext => $share_ext,
load_ext => '.bundle',
link => 'c++',
linkflags => $flagsref->{linkflags},
Expand All @@ -80,22 +80,30 @@ sub runstep {
ld_load_flags => '-undefined dynamic_lookup -bundle',
memalign => 'some_memalign',
has_dynamic_linking => 1,
ranlib => 'ranlib',

# TT #344: When built against a dynamic libparrot,
# installable_parrot records the path to the blib version
# of the library.

rpath => "-L",
parrot_is_shared => 1,
libparrot_shared => "libparrot.$version$share_ext",
libparrot_shared_alias => "libparrot$share_ext",
rpath => "-L",
libparrot_soname => "-install_name "
. '"'
. $conf->data->get('libdir')
. '/libparrot'
. $conf->data->get('share_ext')
. '"'
. $share_ext
. '"',
);
$conf->data->set( %darwin_hints );
my $verbose_message = '';
foreach my $k (sort keys %darwin_hints) {
$verbose_message .= sprintf(" %-24s => %s\n" =>
($k, $darwin_hints{$k}));
}
$conf->debug($verbose_message);
}

#################### INTERNAL SUBROUTINES ####################
Expand Down
12 changes: 9 additions & 3 deletions config/init/hints/linux.pm
Expand Up @@ -26,8 +26,9 @@ sub runstep {
if ( $libs !~ /-lrt\b/ ) {
$libs .= ' -lrt';
}
my $ld_share_flags = $conf->data->get('ld_share_flags');
my $cc_shared = $conf->data->get('cc_shared');
my $ld_share_flags = $conf->data->get('ld_share_flags');
my $ld_load_flags = $ld_share_flags;;

if ( $cc =~ /icc/ ) {

Expand All @@ -46,6 +47,11 @@ sub runstep {
$cc_shared = '-KPIC';
}
}
elsif ( $cc =~ /g(c|\+){2}/ ) {
$cc_shared = '-fPIC',
$ld_share_flags = '-shared -fPIC',
$ld_load_flags = '-shared -fPIC',
}

if ( $ccflags !~ /-D_GNU_SOURCE/ ) {

Expand All @@ -61,11 +67,11 @@ sub runstep {
$conf->data->set(
ccflags => $ccflags,
libs => $libs,
cc_shared => $cc_shared,
ld_share_flags => $ld_share_flags,
ld_load_flags => $ld_share_flags,
ld_load_flags => $ld_load_flags,
linkflags => $linkflags,
link => $link,
cc_shared => $cc_shared,
rpath => '-Wl,-rpath=',
osvers => $osvers,

Expand Down
6 changes: 4 additions & 2 deletions config/init/optimize.pm
Expand Up @@ -54,8 +54,10 @@ sub runstep {
$conf->debug("optimize options: ", $optimization_level, "\n");

# disable debug flags.
$conf->data->set( cc_debug => '' );
$conf->data->add( ' ', ccflags => "-DDISABLE_GC_DEBUG=1 -DNDEBUG" );
if ($conf->data->get('optimize')) {
$conf->data->set( cc_debug => '' );
$conf->data->add( ' ', ccflags => "-DDISABLE_GC_DEBUG=1 -DNDEBUG" );
}

# TT #405
if ($conf->data->get('cpuarch') eq 'amd64') {
Expand Down

0 comments on commit 7eaf3f3

Please sign in to comment.