… | |
… | |
64 | |
64 | |
65 | package ExtUtils::CXX; |
65 | package ExtUtils::CXX; |
66 | |
66 | |
67 | use common::sense; |
67 | use common::sense; |
68 | |
68 | |
69 | our $VERSION = 0.02; |
69 | our $VERSION = 0.03; |
70 | |
70 | |
71 | use parent Exporter::; |
71 | use Exporter 'import'; |
72 | |
72 | |
73 | our @EXPORT = qw(extutils_cxx); |
73 | our @EXPORT = qw(extutils_cxx); |
|
|
74 | |
|
|
75 | use ExtUtils::MakeMaker::Config (); |
74 | |
76 | |
75 | =item extutils_cxx BLOCK; |
77 | =item extutils_cxx BLOCK; |
76 | |
78 | |
77 | This function temporarily does hideous things so you can call |
79 | This function temporarily does hideous things so you can call |
78 | C<WriteMakefile> or similar functions in the BLOCK normally. See the |
80 | C<WriteMakefile> or similar functions in the BLOCK normally. See the |
… | |
… | |
124 | |
126 | |
125 | my $tie = tied %Config; |
127 | my $tie = tied %Config; |
126 | |
128 | |
127 | # now dive into internals of Config and temporarily patch those values |
129 | # now dive into internals of Config and temporarily patch those values |
128 | |
130 | |
129 | $tie->{ld} = "/uasr/bin/gcc-4.6 -O"; |
|
|
130 | local $tie->{cc} = $Config{cc}; _ccrepl cc => "CXX"; |
131 | local $tie->{cc} = $Config{cc}; _ccrepl cc => "CXX"; |
131 | local $tie->{ld} = $Config{ld}; _ccrepl ld => ($ENV{PERL_CXXLD} ? "CXXLD" : "CXX"); |
132 | local $tie->{ld} = $Config{ld}; _ccrepl ld => ($ENV{PERL_CXXLD} ? "CXXLD" : "CXX"); |
|
|
133 | |
|
|
134 | local $ExtUtils::MakeMaker::Config::Config{cc} = $tie->{cc}; |
|
|
135 | local $ExtUtils::MakeMaker::Config::Config{ld} = $tie->{ld}; |
132 | |
136 | |
133 | eval { |
137 | eval { |
134 | $cb->(); |
138 | $cb->(); |
135 | }; |
139 | }; |
136 | die if $@; |
140 | die if $@; |