-
Notifications
You must be signed in to change notification settings - Fork 0
/
modpc.pl
43 lines (36 loc) · 959 Bytes
/
modpc.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
#! d:/strawberry/perl/bin/perl.exe
use Config;
$pc_config = $Config{"libpth"};
$pc_config =~ s/(.*)\s+.*/$1/;
if ( ! -d $pc_config){
print "where is your strawberry/c directory?[like: D:/strawberry/c]:";
$pc_config = <>;
}
#$pc_config =~ s/\\/\//g;
#$pc_config =~ s/\/lib//g;
$pc_dir = "ex/lib/pkgconfig";
die "no ex dir. run extract.pl first\n" if ( ! -d "ex");
opendir DH, $pc_dir;
my $file;
foreach $file (readdir DH){
if( $file =~ /.pc$/){
print "Modifying $file ...\n";
open H, "$pc_dir" . "/" . $file;
@l = <H>;
close H;
open H, ">$pc_dir" . "/" . $file;
foreach $line (@l){
if ($line =~ /^prefix=/){
print H "prefix=", $pc_config, "\n";
}else{
if ($file eq "pangocairo.pc" && $line =~ /^Libs\:/ && $line !~ /Cairo.a$/){
chomp $line;
$line .= " \${prefix}/../perl/site/lib/auto/Cairo/Cairo.a\n";
}
print H $line;
}
}
close H;
}
}
closedir DH;