Permalink
Browse files

* Tidy up multiple -arch flags so the -S stage of GHC works.

  • Loading branch information...
1 parent 4034f2e commit 19d282aa83df40303195256fe24fea037603aec0 @audreyt audreyt committed Apr 13, 2010
Showing with 16 additions and 7 deletions.
  1. +16 −6 HsPerl5/Configure.PL
  2. +0 −1 HsPerl5/src/Language/Perl5.hs
View
22 HsPerl5/Configure.PL
@@ -6,12 +6,22 @@ use Cwd;
use Config;
use ExtUtils::Embed;
+sub tidy {
+ my $str = shift;
+ # If compiling for multiple archs, compile for none.
+ if ($str =~ /-arch \S+ +.*-arch \S+/) {
+ $str =~ s/-arch \S+//g;
+ }
+ return $str;
+}
+
my $embed_flags = "-I" . cwd();
my $ccdlflags = "";
-my $flags = "$Config{ccflags} $Config{ccdlflags} ";
+my $flags = tidy("$Config{ccflags} $Config{ccdlflags} ");
if ($flags =~ /\S/) {
$flags =~ s{([\\"'])}{\\$1}g;
+
my @flags = grep { length $_ } split /\s+/, $flags;
if ($^O eq 'MSWin32') {
@@ -39,7 +49,7 @@ if ($flags =~ /\S/) {
$flags = "$Config{ccflags} $Config{ccdlflags}";
$flags =~ s{([\\"'])}{\\$1}g;
- @flags = grep { length $_ } split /\s+/, $flags;
+ @flags = grep { length $_ } split /\s+/, tidy($flags);
}
else {
warn "Unrecognized libperl shared library: $Config{libperl}, proceeding anyway...\n";
@@ -49,12 +59,12 @@ if ($flags =~ /\S/) {
$embed_flags .= " -optc-Ddirent=DIRENT";
}
else {
- $embed_flags .= " -optc$_" for grep length, split(/\s+/, ccopts());
- $embed_flags .= " -optl$_" for grep length, split(/\s+/, ldopts());
+ $embed_flags .= " -optc$_" for grep length, split(/\s+/, tidy(ccopts()));
+ $embed_flags .= " -optl$_" for grep length, split(/\s+/, tidy(ldopts()));
}
- $embed_flags .= " $_" for grep { /-[DIL]/ } split(/\s+/, ccopts());
- $embed_flags .= " $_" for grep { /-[DIL]/ } split(/\s+/, ldopts());
+ $embed_flags .= " $_" for grep { /-[DIL]/ } split(/\s+/, tidy(ccopts()));
+ $embed_flags .= " $_" for grep { /-[DIL]/ } split(/\s+/, tidy(ldopts()));
if ($Config{osname} eq 'cygwin') {
my $cygpath = sub {
View
1 HsPerl5/src/Language/Perl5.hs
@@ -1,4 +1,3 @@
-{-# INCLUDE "p5embed.h" #-}
module Language.Perl5
( Context(..)
, ToSV(..)

0 comments on commit 19d282a

Please sign in to comment.