1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#!perl -w
# Makefile.pl for Inline::Octave
# $Id: Makefile.PL,v 1.7 2003/11/30 14:33:02 aadler Exp $
use strict;
use ExtUtils::MakeMaker;
#
# Find the octave interpreter
#
my $octave= "octave";
my $octave_validated= 0;
# check if interpreter was specified on cmd line
foreach (@ARGV) {
if (/^OCTAVE=(.+)/) {
$octave= $1;
$octave_validated= 1;
$_= "";
}
}
while (not $octave_validated) {
$octave_validated= 1 if `$octave -v` =~ /Octave, version ([2-9]\.\d+\.\d+)/;
my $octave_version= $1;
if ($octave_validated) {
print "Found GNU Octave interpreter:[$octave] (version $octave_version)\n";
print "Enter new executable path or <RETURN> to accept: ";
} else {
print "Unable to find GNU Octave interpreter at:[$octave]\n";
print "Please enter new path to executable: " ;
}
chomp( my $inp= <STDIN> );
if ($inp) {
$octave_validated= 0;
$octave= $inp;
}
}
#
# Rewrite Octave.pm
#
print "\nFixing Octave.pm for octave path...\n" ;
open(OCTAVE, "<Octave.pm") or die "Can't open Octave.pm for reading" ;
my @lines = <OCTAVE> ;
close(OCTAVE) ;
open(OCTAVE, ">Octave.pm") or die "Can't open Octave.pm for writing" ;
foreach my $line (@lines) {
$line =~
s{(\$octave_interpreter_bin\s*=\s*)'.+?'(\s*#\s*_EDITLINE_MARKER_)}
{$1\'$octave\'$2};
print OCTAVE $line ;
}
close(OCTAVE) ;
WriteMakefile(
'NAME' => 'Inline::Octave',
'VERSION_FROM' => 'Octave.pm',
'PREREQ_PM' => { Inline => 0.43 },
'clean' => {FILES => '_Inline/'},
);
|