/
install.pl
45 lines (34 loc) · 1.12 KB
/
install.pl
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
#!/usr/bin/perl
use strict;
use warnings;
use Config;
use FindBin qw/$Bin/;
##################################################
chdir("$Bin/src");
BUILD_SWIG: {
die "You must have SWIG (www.swig.org) installed to build this module. \n" unless `which swig`;
print "Building SWIG wrapper...\n";
`swig -perl5 linear.i`;
}
BUILD_SO: {
print "Building shared object...\n";
my $arch = $Config{archlib};
my $flags = $Config{ccflags};
# Compile
die "You must have gcc installed to build this module. \n" unless `which gcc`;
`gcc -fpic -c -Dbool=char -I$arch/CORE linear.c linear_wrap.c $flags`;
# Link
die "You must have ld installed to build this module. \n" unless `which ld`;
`ld -G linear.o linear_wrap.o -o linear.so`;
}
COPY_LIB: {
print "Copying files to lib/Algorithm/LinearFit/Random/...\n";
`mv $Bin/src/linear.so $Bin/lib/auto/Algorithm/LinearFit/Random/SWIG/SWIG.so`;
`mv $Bin/src/SWIG.pm $Bin/lib/Algorithm/LinearFit/Random/SWIG.pm`;
}
CLEAN_UP: {
print "Cleaning up...\n";
`rm $Bin/src/linear_wrap.c`;
`rm $Bin/src/linear.o`;
`rm $Bin/src/linear_wrap.o`;
}