a lot of work on the util/configure script.

This commit is contained in:
agentzh (章亦春)
2011-03-06 15:11:20 +08:00
parent d9ab99217e
commit 64c3ab1146
5 changed files with 256 additions and 28 deletions

82
util/configure vendored
View File

@ -11,8 +11,6 @@ sub cd ($);
sub auto_complete ($);
sub usage ($);
cd "bundle";
my @modules = (
[http_iconv => 'iconv-nginx-module', 'disabled'],
[http_echo => 'echo-nginx-module'],
@ -62,9 +60,6 @@ my $with_resty_mods_regex;
$with_resty_mods_regex = qr/$s/;
}
cd "..";
my $prefix = '/usr/local/openresty';
my %resty_opts;
@ -121,12 +116,18 @@ cd $ngx_dir;
my $ngx_prefix = "$prefix/nginx";
shell "./configure --prefix=$ngx_prefix"
my $cmd = "./configure --prefix=$ngx_prefix"
. " --with-ld-opt='-Wl,-rpath=$ngx_prefix/lib'"
. build_resty_opts(\%resty_opts)
. " " . join(" ", @ngx_opts);
;
warn $cmd;
exit 0;
shell $cmd;
sub shell (@) {
print "@_\n";
system(@_) == 0 or die "failed to run command @_\n";
@ -193,28 +194,59 @@ sub usage ($) {
--with-debug enable the debugging logging and also enable -O0
--without-http_iconv_module disable ngx_http_iconv_module
--without-http_echo_module disable ngx_http_echo_module
--without-http_xss_module disable ngx_http_xss_module
--without-http_set_misc_module disable ngx_http_set_misc_module
--without-http_form_input_module disable ngx_http_form_input_module
--without-http_encrypted_session_module
disable ngx_http_encrypted_session_module
--without-http_drizzle_module disable ngx_http_drizzle_module
--without-http_lua_module disable ngx_http_lua_module
--without-http_headers_more_module disable ngx_http_headers_more_module
--without-http_srcache_module disable ngx_http_srcache_module
--without-http_array_var_module disable ngx_http_array_var_module
--without-http_memc_module disable ngx_http_memc_module
--without-http_upstream_keepalive_module
disable ngx_http_upstream_keepalive_module
--without-http_memc_module disable ngx_http_auth_request_module
--without-http_rds_json_module disable ngx_http_rds_json_module
--without-http_lz_st_module disable ngx_http_lz_st_module
_EOC_
my $opt_max_len = length " --without-ngx_devel_kit_module ";
#warn "opt max len: $opt_max_len";
my $with_resty_opts = '';
for my $mod (@modules) {
my $name = $mod->[0];
if ($name =~ /^http_/) {
if (@$mod == 2) {
my $opt = " --without-${name}_module";
$msg .= $opt;
my $n = $opt_max_len - length $opt;
if ($n > 0) {
$msg .= " " x $n;
} else {
$msg .= "\n" . (" " x $opt_max_len);
}
$msg .= "disable ngx_${name}_module\n";
} else {
my $opt = " --with-${name}_module";
$with_resty_opts .= $opt;
my $n = $opt_max_len - length $opt;
if ($n > 0) {
$with_resty_opts .= " " x $n;
} else {
$with_resty_opts .= "\n" . (" " x $opt_max_len);
}
$with_resty_opts .= "enable ngx_${name}_module\n";
}
}
}
$msg .= <<'_EOC_';
--without-ngx_devel_kit_module disable ngx_devel_kit_module
--without-http_ssl_module disable ngx_http_ssl_module
--with-http_postgres_module enable ngx_http_postgres_module
_EOC_
$msg .= $with_resty_opts;
$msg .= <<'_EOC_';
--with-luajit enable LuaJIT 2.0
Options directly inherited from nginx