mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
More MSYS/MinGW love.
* upgraded ngx_lua to 0.9.18rc1 to support Win32 LuaJIT DLL. * upgraded lua-redis-parser to 0.11rc1 for better Win32 support. * upgraded lua-rds-parser to 0.06rc2 for better Win32 support. * upgraded ngx_rds_csv to 0.07rc1 for better Win32 support. * upgraded lua-resty-cli to 0.04rc1 for better Win32 support. * upgraded lua-resty-core to 0.1.2. * applied a patch to LuaJIT to add "!/lualib/" to the default Lua package search paths. * upgraded lua-cjson to 2.1.0.3rc2 for better Win32 support and a suppressed gcc warning. * use OpenResty's nginx tarballs extracted directly from the official nginx code repos, because we need the win32 support which is excluded in the official nginx release tarballs. Our nginx release tarballs are generated by the util/package-nginx.sh script. * added the util/package-win32.sh script to generate the Win32 OpenResty binary distribution file. * applied a patch to always enable C compiler feature tests in nginx's own build system because the MinGW gcc compiler on Win32 is also powerful enough to support advanced features like variadic macros. * added document README-win32. * util/dist-check: do a partial uninstallation before installing anything new. * added util/build-win32.sh to build OpenResty on Win32 using the MinGW/MSYS toolchain. * ./configure: added support for building on Win32 using the MinGW/MSYS toolchain.
This commit is contained in:
101
util/configure
vendored
101
util/configure
vendored
@ -306,7 +306,12 @@ for my $opt (@ARGV) {
|
||||
|
||||
print "platform: $platform ($OS)\n";
|
||||
|
||||
my $ngx_prefix = "$prefix/nginx";
|
||||
my $ngx_prefix;
|
||||
if ($platform eq 'msys') {
|
||||
$ngx_prefix = "$prefix";
|
||||
} else {
|
||||
$ngx_prefix = "$prefix/nginx";
|
||||
}
|
||||
|
||||
my $postamble = '';
|
||||
|
||||
@ -346,6 +351,12 @@ if ($postamble) {
|
||||
|
||||
sub env ($$) {
|
||||
my ($name, $val) = @_;
|
||||
if (!defined $name) {
|
||||
die "env not defined";
|
||||
}
|
||||
if (!defined $val) {
|
||||
die "env $name takes undef value";
|
||||
}
|
||||
print "export $name='$val'\n";
|
||||
$ENV{$name} = $val;
|
||||
}
|
||||
@ -397,7 +408,7 @@ sub build_resty_opts {
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!$platform ne 'msys' && can_run("gmake")) { # msys has no gmake
|
||||
if (can_run("gmake")) { # msys has no gmake
|
||||
$make = 'gmake';
|
||||
|
||||
} else {
|
||||
@ -617,18 +628,43 @@ _END_
|
||||
shell "${make}$extra_opts PREFIX=$luajit_prefix", $dry_run;
|
||||
}
|
||||
|
||||
shell "${make} install$extra_opts PREFIX=$luajit_prefix DESTDIR=$luajit_root/", $dry_run;
|
||||
my ($lib, $inc);
|
||||
|
||||
if ($platform eq 'msys') {
|
||||
$lib = $luajit_root;
|
||||
shell "install -m 0755 src/luajit.exe src/lua51.dll $lib/", $dry_run;
|
||||
|
||||
my $lua_jit_dir = File::Spec->catfile($luajit_root, "lua", "jit");
|
||||
shell "mkdir -p $lua_jit_dir", $dry_run;
|
||||
|
||||
shell "install -m 0644 src/jit/*.lua $lua_jit_dir/", $dry_run;
|
||||
|
||||
$inc = File::Spec->catfile($luajit_root, "include", "luajit-2.1");
|
||||
shell "mkdir -p $inc", $dry_run;
|
||||
|
||||
shell "cd src && install -m 0644 lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h $inc/",
|
||||
$dry_run;
|
||||
|
||||
} else {
|
||||
shell "${make} install$extra_opts PREFIX=$luajit_prefix DESTDIR=$luajit_root/", $dry_run;
|
||||
|
||||
$lib = File::Spec->catfile($luajit_root, $luajit_prefix, "lib");
|
||||
$inc = File::Spec->catfile($luajit_root, $luajit_prefix, "include", "luajit-2.1");
|
||||
}
|
||||
|
||||
push @make_cmds, "cd $root_dir/build/$luajit_src && "
|
||||
. "\$(MAKE)$extra_opts PREFIX=$luajit_prefix";
|
||||
|
||||
my $abs_luajit_src = File::Spec->rel2abs(File::Spec->catfile($root_dir, "build", $luajit_src), $root_dir);
|
||||
|
||||
push @make_install_cmds, "cd $abs_luajit_src && "
|
||||
. "\$(MAKE) install$extra_opts PREFIX=$luajit_prefix DESTDIR=\$(DESTDIR)";
|
||||
if ($platform eq 'msys') {
|
||||
push @make_install_cmds, "cd $abs_luajit_src && "
|
||||
. "cp -rv $luajit_root/* \$(DESTDIR)$prefix/";
|
||||
|
||||
my $lib = File::Spec->catfile($luajit_root, $luajit_prefix, "lib");
|
||||
my $inc = File::Spec->catfile($luajit_root, $luajit_prefix, "include", "luajit-2.1");
|
||||
} else {
|
||||
push @make_install_cmds, "cd $abs_luajit_src && "
|
||||
. "\$(MAKE) install$extra_opts PREFIX=$luajit_prefix DESTDIR=\$(DESTDIR)";
|
||||
}
|
||||
|
||||
env LUAJIT_LIB => $lib;
|
||||
env LUAJIT_INC => $inc;
|
||||
@ -636,7 +672,9 @@ _END_
|
||||
#unshift @ngx_ld_opts, "-L$lib";
|
||||
#unshift @ngx_cc_opts, "-I$inc";
|
||||
|
||||
push @ngx_rpaths, File::Spec->catfile($luajit_prefix, "lib");
|
||||
if ($platform ne 'msys') {
|
||||
push @ngx_rpaths, File::Spec->catfile($luajit_prefix, "lib");
|
||||
}
|
||||
|
||||
cd '..';
|
||||
|
||||
@ -705,12 +743,23 @@ _END_
|
||||
open my $in, ">>$ngx_lua_dir/config" or
|
||||
die "Cannot open $ngx_lua_dir/config for appending: $!\n";
|
||||
|
||||
print $in <<"_EOC_";
|
||||
{
|
||||
my $path_prefix = $lualib_prefix;
|
||||
|
||||
#if (File::Spec->rel2abs($lualib_prefix) ne File::Spec->canonpath($lualib_prefix)
|
||||
#&& $platform eq 'msys')
|
||||
#{
|
||||
# being a relative path and on MSYS
|
||||
#$path_prefix = "!/$lualib_prefix";
|
||||
#}
|
||||
|
||||
print $in <<"_EOC_";
|
||||
|
||||
ngx_lua_dquote='"'
|
||||
CFLAGS="\$CFLAGS -DLUA_DEFAULT_PATH='\$ngx_lua_dquote$lualib_prefix/?.lua;$lualib_prefix/?/init.lua\$ngx_lua_dquote'"
|
||||
CFLAGS="\$CFLAGS -DLUA_DEFAULT_CPATH='\$ngx_lua_dquote$lualib_prefix/?.so\$ngx_lua_dquote'"
|
||||
CFLAGS="\$CFLAGS -DLUA_DEFAULT_PATH='\$ngx_lua_dquote$path_prefix/?.lua;$path_prefix/?/init.lua\$ngx_lua_dquote'"
|
||||
CFLAGS="\$CFLAGS -DLUA_DEFAULT_CPATH='\$ngx_lua_dquote$path_prefix/?.so\$ngx_lua_dquote'"
|
||||
_EOC_
|
||||
}
|
||||
|
||||
close $in;
|
||||
|
||||
@ -731,6 +780,11 @@ _EOC_
|
||||
my $extra_opts = " DESTDIR=\$(DESTDIR) LUA_INCLUDE_DIR=$lua_inc " .
|
||||
"LUA_CMODULE_DIR=$lualib_prefix LUA_MODULE_DIR=$lualib_prefix";
|
||||
|
||||
if ($platform eq 'msys') {
|
||||
my $luajit_root = File::Spec->rel2abs("luajit-root");
|
||||
$extra_opts .= " CJSON_LDFLAGS=\"-shared -L$luajit_root -llua51\"";
|
||||
}
|
||||
|
||||
if ($on_solaris) {
|
||||
#$extra_opts .= " INSTALL=$root_dir/build/install";
|
||||
if ($opts->{debug}) {
|
||||
@ -782,11 +836,15 @@ _EOC_
|
||||
my $extra_opts = " DESTDIR=\$(DESTDIR) LUA_INCLUDE_DIR=$lua_inc " .
|
||||
"LUA_LIB_DIR=$lualib_prefix";
|
||||
|
||||
if ($platform eq 'msys') {
|
||||
my $luajit_root = File::Spec->rel2abs("luajit-root");
|
||||
$extra_opts .= " LDFLAGS=\"-shared -L$luajit_root -llua51\"";
|
||||
}
|
||||
|
||||
if ($on_solaris) {
|
||||
$extra_opts .= " INSTALL=$root_dir/build/install";
|
||||
if ($opts->{debug}) {
|
||||
$extra_opts .= " CFLAGS=\"-g -O -Wall\"";
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -829,6 +887,11 @@ _EOC_
|
||||
my $extra_opts = " DESTDIR=\$(DESTDIR) LUA_INCLUDE_DIR=$lua_inc " .
|
||||
"LUA_LIB_DIR=$lualib_prefix";
|
||||
|
||||
if ($platform eq 'msys') {
|
||||
my $luajit_root = File::Spec->rel2abs("luajit-root");
|
||||
$extra_opts .= " LDFLAGS=\"-shared -L$luajit_root -llua51\"";
|
||||
}
|
||||
|
||||
if ($on_solaris) {
|
||||
$extra_opts .= " INSTALL=$root_dir/build/install";
|
||||
if ($opts->{debug}) {
|
||||
@ -881,9 +944,17 @@ _EOC_
|
||||
|
||||
# configure resty-cli:
|
||||
|
||||
my $resty_cli_dir = auto_complete 'resty-cli';
|
||||
push @make_install_cmds, "cd $root_dir/build/$resty_cli_dir && "
|
||||
. "$root_dir/build/install resty \$(DESTDIR)$prefix/bin/";
|
||||
{
|
||||
my $resty_cli_dir = auto_complete 'resty-cli';
|
||||
my $target_dir;
|
||||
if ($platform eq 'msys') {
|
||||
$target_dir = "\$(DESTDIR)$prefix/";
|
||||
} else {
|
||||
$target_dir = "\$(DESTDIR)$prefix/bin/";
|
||||
}
|
||||
push @make_install_cmds, "cd $root_dir/build/$resty_cli_dir && "
|
||||
. "$root_dir/build/install resty $target_dir";
|
||||
}
|
||||
|
||||
# prepare nginx configure line
|
||||
|
||||
|
Reference in New Issue
Block a user