File: Makefile.PL

package info (click to toggle)
mapserver 5.0.3-3%2Blenny7
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,556 kB
  • ctags: 12,645
  • sloc: ansic: 168,024; cs: 8,534; python: 4,618; sh: 4,213; cpp: 4,059; perl: 2,781; makefile: 787; lex: 564; java: 415; yacc: 334; tcl: 158; ruby: 53
file content (78 lines) | stat: -rw-r--r-- 2,023 bytes parent folder | download | duplicates (3)
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
68
69
70
71
72
73
74
75
76
77
78
# File : Makefile.PL
use ExtUtils::MakeMaker;

open(STREAM, '../../mapscriptvars') or die('Unable to open mapscriptvars, have you built the MapServer yet?'); 

$home = <STREAM>;
chomp $home;

$define = <STREAM>;
chomp $define;

$inc = <STREAM>;
chomp $inc;
$inc =~ s/\-I\./\-I$home/g;

$libs = <STREAM>;
chomp $libs;
$libs =~ s/\-L\./\-L$home/g;

$static_libs = <STREAM>;
chomp $static_libs;
$static_libs =~ s/\-L\./\-L$home/g;

# Get MapServer version from mapscriptvars
$ms_version_line = <STREAM>;
if ($ms_version_line) {
	$ms_version_line =~ /MS_VERSION "(.+)"/;
	$ms_version = $1;
}
# Default is 4.3
else { $ms_version = '4.3'; }

print $inc."\n";
print $libs."\n";
print $static_libs."\n";
print $ms_version."\n";

my $swigInterfaceFile = "../mapscript.i";
my $swigWrapperFile   = "mapscript_wrap.c";

########################################################################

sub runSwigAutogeneration{
  print "Autogenerating wrappers from SWIG interface " . $swigInterfaceFile . "\n";
  my $command = "swig -perl5 -shadow -outdir . $define -o $swigWrapperFile $swigInterfaceFile";
  system($command);
  if ($?){
      print "An error occurred when generating the wrappers from the SWIG interface :\n$!\n";
      print "The command that was run was:\n\n$command\n\n";
      print "Perl mascript cannot be built.\n";
      exit;
  }
}

########################################################################

sub existsAndUpToDate{
  my ($sourceFile, $destFile) = @_;
  if (!(-e $destFile)) { return 0; }
  my $sourceMtime = (stat $sourceFile)[9];
  my $destMtime = (stat $destFile)[9];
  return $destMtime >= $sourceMtime;
}

########################################################################

runSwigAutogeneration() unless
  existsAndUpToDate($swigInterfaceFile, $swigWrapperFile);

WriteMakefile(
	      'NAME' 		=> 'mapscript',
	      'DEFINE' 		=> $define,
	      'INC' 		=> $inc,
	      'LIBS' 		=> [$libs,$static_libs],
	      'OBJECT' 		=> 'mapscript_wrap.o',
		  'VERSION' 	=> $ms_version
	      );