Skip to content

Commit

Permalink
Find Perl embedding options at configure time
Browse files Browse the repository at this point in the history
This removes the dependency on command interpolation in makefiles, hopefully
unbreaking nmake, and is in any event a neccessary step towards supporting
compilation on non-default Perls.
  • Loading branch information
sorear committed Apr 24, 2010
1 parent 4a310c5 commit d5f00d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
9 changes: 8 additions & 1 deletion Configure.pl
Expand Up @@ -21,6 +21,8 @@ =head1 SYNOPSIS

use Getopt::Long qw(:config auto_help);

use ExtUtils::Embed;

our ( $opt_parrot_config, $opt_gen_parrot);
GetOptions( 'parrot-config=s', 'gen-parrot' );

Expand Down Expand Up @@ -51,6 +53,10 @@ =head1 SYNOPSIS
."Please give me the path to it with the --parrot-config=... option.";
}

$config{p5_ldopts} = ldopts(1);
$config{p5_ccopts} = ccopts(1);
$config{p5_perl} = $^X;

# Create the Makefile using the information we just got
create_makefile('Makefile' => %config);
create_makefile('src/pmc/Makefile' => %config);
Expand Down Expand Up @@ -79,7 +85,8 @@ sub create_makefile {
my $maketext = slurp( "build/$name.in" );

$config{'win32_libparrot_copy'} = $^O eq 'MSWin32' ? 'copy $(PARROT_BIN_DIR)\libparrot.dll .' : '';
$maketext =~ s/@(\w+)@/$config{$1}/g;
$maketext =~ s{#IF\((\w+)\):(.*\n)}{$config{osname} eq $1 ? $2 : ""}eg;
$maketext =~ s/@(\w+)@/exists $config{$1} ? $config{$1} : die("No such config var $1")/eg;
if ($^O eq 'MSWin32') {
$maketext =~ s{/}{\\}g;
$maketext =~ s{\\\*}{\\\\*}g;
Expand Down
2 changes: 1 addition & 1 deletion build/Makefile.in
Expand Up @@ -20,7 +20,7 @@ PMC_DIR = src/pmc

## Setup some commands
MAKE = @make_c@
PERL = @perl@
PERL = @p5_perl@
CAT = @cat@
CHMOD = @chmod@
CP = @cp@
Expand Down
9 changes: 3 additions & 6 deletions build/src/pmc/Makefile.in
Expand Up @@ -10,15 +10,12 @@ STAGING_DIR = ../../dynext
#INSTALL_DIR = $(LIB_DIR)/languages/blizkost/dynext
INSTALL_DIR = $(LIB_DIR)/dynext

EMBLFLAGS := $(shell perl -MExtUtils::Embed -e ldopts)
EMBCFLAGS := $(shell perl -MExtUtils::Embed -e ccopts)

# Set up extensions
LOAD_EXT = @load_ext@
O = @o@

# Setup some commands
PERL = @perl@
PERL = @p5_perl@
RM_F = @rm_f@
MKPATH = @mkpath@
CHMOD = @chmod@
Expand All @@ -27,7 +24,7 @@ CC = @cc@ -c
LD = @ld@
LDFLAGS = @ldflags@ @ld_debug@ @libs@
LD_LOAD_FLAGS = @ld_load_flags@
CFLAGS = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ $(EMBCFLAGS)
CFLAGS = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ @p5_ccopts@
CC_OUT = @cc_o_out@
LD_OUT = @ld_out@
LIBPARROT = @inst_libparrot_ldflags@
Expand All @@ -38,7 +35,7 @@ PMC2CD = $(PMC2C) --dump $(PMC2C_INCLUDES)
PMC2CC = $(PMC2C) -c $(PMC2C_INCLUDES)

INCLUDES = -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/pmc
LINKARGS = $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT) $(EMBLFLAGS)
LINKARGS = $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT) @p5_ldopts@

BLIZKOST_GROUP = blizkost_group

Expand Down

0 comments on commit d5f00d1

Please sign in to comment.