Rakudo's --gen-parrot option for Configure.pl defaults to invoking Parrot's
Configure.pl with --optimize. In turn, that flag is documented as adding
the Perl 5 configuration value $Config{optimize} to the C compiler flags.

This is sane.

However, I can't find a way to *not* build with optimisation. Specifically,
I'd like to configure and build all the C files (Parrot, NQP, Rakudo) at -O0
and with -g, for debugging symbols.

I can't see a way to do this, as is.

Specifically, my problems seem to be twofold

1) Macports manages to configure perl 5 like this:

$ perl -V:ccflags
ccflags='-O2  -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp 
-fno-strict-aliasing -pipe -fstack-protector -I/opt/local/include';
$ perl -V:optimize
optimize='-O3';


ie -O2 *by default*, and -O3 for optimisation.

2) Rakudo always *post*fixes the Parrot Configure.pl commandline with
--optimize


The former is a bit daft. The latter, I think, is wrong, because it's
impossible to override, even with --parrot-option.

I belive that a better approach is to remove that default if any
--parrot-option is given, and make it the responsibility of the knowledgeable
end-user to have to specify --optimize. ie:

>From 9c56b18610a77daf96f2d9c521325e5c8ee3376a Mon Sep 17 00:00:00 2001
From: Nicholas Clark <n...@ccl4.org>
Date: Thu, 15 Nov 2012 13:48:37 +0100
Subject: [PATCH] Using --parrot-option should override the default option of
 '--optimize'

Otherwise, it's possible neither to call Parrot's Configure.pl without
enabling optimizations, nor to change the value of the --optimize option.
---
 tools/lib/NQP/Configure.pm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/lib/NQP/Configure.pm b/tools/lib/NQP/Configure.pm
index 02a6bd8..d316bd8 100644
--- a/tools/lib/NQP/Configure.pm
+++ b/tools/lib/NQP/Configure.pm
@@ -307,8 +307,7 @@ sub gen_parrot {
 
     my $prefix     = $options{'prefix'} || cwd()."/install";
     my $gen_parrot = $options{'gen-parrot'};
-    my @opts       = @{ $options{'parrot-option'} || [] };
-    push @opts, "--optimize";
+    my @opts       = @{ $options{'parrot-option'} || ["--optimize"] };
     my $startdir   = cwd();
 
     my $par_exe  = "$options{'prefix'}/bin/parrot$exe";
-- 
1.8.0



With the above patch applied, I'm able to build a non-optimised debugging
Parrot and Rakudo, even with macport's daftness, using the commandline:

perl Configure.pl --parrot-option='--optimize=-O0 -g' --gen-parrot --gen-nqp && 
make all test

Nicholas Clark

Reply via email to