1#!perl -w
2
3use strict;
4use Fatal qw(chdir);
5use Config;
6
7my $cs_dir = shift(@ARGV) || die "Usage: $0 CS_BUILD_DIRECTRY\n";
8
9my @configure_args = qw(
10    --disable-compression
11    --disable-apache
12    --disable-python
13    --disable-perl
14    --disable-ruby
15    --disable-java
16    --disable-csharp
17    --disable-gettext
18);
19
20chdir $cs_dir;
21
22# for configure
23$ENV{CC}      = $Config{cc};
24$ENV{CFLAGS}  = $Config{ccflags} . ' ' . $Config{optimize};
25$ENV{LDFLAGS} = $Config{ldflags};
26#$ENV{LIBS}    = $Config{libs};
27
28eval {
29    xsystem('./configure', @configure_args);
30} or do {
31    warn $@;
32    if(open my $in, '<', "config.log"){
33        while(<$in>){
34            warn "!!! $_" if /\b cannot \b/xms;
35        }
36        close $in;
37    }
38    die "$0 stopped";
39};
40xsystem('gmake');
41
42sub xsystem {
43    print "@_\n";
44    system(@_) == 0
45        or die "Fail!\n";
46}
47