mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
bugfix: ./configure --prefix=PATH did not work when PATH is relative. also added experimental support for the MinGW MSYS environment on Win32.
This commit is contained in:
56
util/configure
vendored
56
util/configure
vendored
@ -45,7 +45,9 @@ if ($OS =~ /solaris|sunos/i) {
|
||||
$platform = $OS;
|
||||
|
||||
} elsif ($OS eq 'MSWin32') {
|
||||
die "MS Windows not supported. Abort.\n";
|
||||
die "MS Windows not supported. Abort.\n",
|
||||
"(You need to use the MSYS toolchain, ",
|
||||
"including MinGW gcc, MSYS perl, MSYS bash, and etc.\n";
|
||||
|
||||
} elsif ($OS =~ /^(?:MacOS|darwin|rhapsody)$/) {
|
||||
$platform = 'macosx';
|
||||
@ -56,6 +58,9 @@ if ($OS =~ /solaris|sunos/i) {
|
||||
} elsif ($OS =~ /^(?:openbsd|netbsd|dragonfly)$/) {
|
||||
$platform = 'bsd';
|
||||
|
||||
} elsif ($OS eq 'msys') {
|
||||
$platform = 'msys';
|
||||
|
||||
} else {
|
||||
$platform = 'posix';
|
||||
}
|
||||
@ -155,6 +160,9 @@ for my $opt (@ARGV) {
|
||||
|
||||
if ($opt =~ /^--prefix=(.*)/) {
|
||||
$prefix = $1;
|
||||
if ($prefix eq '') {
|
||||
$prefix = '.';
|
||||
}
|
||||
|
||||
} elsif ($opt eq '--without-lua51') {
|
||||
undef $resty_opts{lua};
|
||||
@ -389,7 +397,7 @@ sub build_resty_opts {
|
||||
}
|
||||
|
||||
} else {
|
||||
if (can_run("gmake")) {
|
||||
if (!$platform ne 'msys' && can_run("gmake")) { # msys has no gmake
|
||||
$make = 'gmake';
|
||||
|
||||
} else {
|
||||
@ -537,8 +545,8 @@ _END_
|
||||
if ($opts->{luajit_path}) {
|
||||
my $luajit_prefix = $opts->{luajit_path};
|
||||
|
||||
my $lib = "$luajit_prefix/lib";
|
||||
my $inc = "$luajit_prefix/include/luajit-2.1";
|
||||
my $lib = File::Spec->catfile($luajit_prefix, "lib");
|
||||
my $inc = File::Spec->catfile($luajit_prefix, "include", "luajit-2.1");
|
||||
|
||||
env LUAJIT_LIB => $lib;
|
||||
env LUAJIT_INC => $inc;
|
||||
@ -550,7 +558,7 @@ _END_
|
||||
|
||||
} elsif ($opts->{luajit}) {
|
||||
my $luajit_src = auto_complete 'LuaJIT';
|
||||
my $luajit_prefix = "$prefix/luajit";
|
||||
my $luajit_prefix = File::Spec->catfile($prefix, "luajit");
|
||||
my $luajit_root = File::Spec->rel2abs("luajit-root");
|
||||
|
||||
if (-d $luajit_root) {
|
||||
@ -609,16 +617,18 @@ _END_
|
||||
shell "${make}$extra_opts PREFIX=$luajit_prefix", $dry_run;
|
||||
}
|
||||
|
||||
shell "${make} install$extra_opts PREFIX=$luajit_prefix DESTDIR=$luajit_root", $dry_run;
|
||||
shell "${make} install$extra_opts PREFIX=$luajit_prefix DESTDIR=$luajit_root/", $dry_run;
|
||||
|
||||
push @make_cmds, "cd $root_dir/build/$luajit_src && "
|
||||
. "\$(MAKE)$extra_opts PREFIX=$luajit_prefix";
|
||||
|
||||
push @make_install_cmds, "cd $root_dir/build/$luajit_src && "
|
||||
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)";
|
||||
|
||||
my $lib = "$luajit_root$luajit_prefix/lib";
|
||||
my $inc = "$luajit_root$luajit_prefix/include/luajit-2.1";
|
||||
my $lib = File::Spec->catfile($luajit_root, $luajit_prefix, "lib");
|
||||
my $inc = File::Spec->catfile($luajit_root, $luajit_prefix, "include", "luajit-2.1");
|
||||
|
||||
env LUAJIT_LIB => $lib;
|
||||
env LUAJIT_INC => $inc;
|
||||
@ -626,16 +636,16 @@ _END_
|
||||
#unshift @ngx_ld_opts, "-L$lib";
|
||||
#unshift @ngx_cc_opts, "-I$inc";
|
||||
|
||||
push @ngx_rpaths, "$luajit_prefix/lib";
|
||||
push @ngx_rpaths, File::Spec->catfile($luajit_prefix, "lib");
|
||||
|
||||
cd '..';
|
||||
|
||||
} elsif ($opts->{lua_path}) {
|
||||
my $lua_prefix = $opts->{lua_path};
|
||||
env LUA_LIB => "$lua_prefix/lib";
|
||||
env LUA_INC => "$lua_prefix/include";
|
||||
env LUA_LIB => File::Spec->catfile($lua_prefix, "lib");
|
||||
env LUA_INC => File::Spec->catfile($lua_prefix, "include");
|
||||
|
||||
push @ngx_rpaths, "$lua_prefix/lib";
|
||||
push @ngx_rpaths, File::Spec->catfile($lua_prefix, "lib");
|
||||
|
||||
} elsif ($opts->{lua}) {
|
||||
# build stdandard lua
|
||||
@ -646,7 +656,7 @@ _END_
|
||||
die "No lua5 found";
|
||||
}
|
||||
|
||||
my $lua_prefix = "$prefix/lua";
|
||||
my $lua_prefix = File::Spec->catfile($prefix, "lua");
|
||||
my $lua_root = File::Spec->rel2abs("lua-root");
|
||||
|
||||
if (-d $lua_root) {
|
||||
@ -669,10 +679,11 @@ _END_
|
||||
shell "${make}$extra_opts $platform", $dry_run;
|
||||
}
|
||||
|
||||
shell "${make} install$extra_opts INSTALL_TOP=$lua_root$lua_prefix", $dry_run;
|
||||
my $install_top = File::Spec->catfile($lua_root, $lua_prefix);
|
||||
shell "${make} install$extra_opts INSTALL_TOP=$install_top/", $dry_run;
|
||||
|
||||
env LUA_LIB => "$lua_root$lua_prefix/lib";
|
||||
env LUA_INC => "$lua_root$lua_prefix/include";
|
||||
env LUA_LIB => File::Spec->catfile($lua_root, $lua_prefix, "lib");
|
||||
env LUA_INC => File::Spec->catfile($lua_root, $lua_prefix, "include");
|
||||
|
||||
push @make_cmds, "cd $root_dir/build/$lua_src && \$(MAKE)$extra_opts $platform";
|
||||
|
||||
@ -687,7 +698,7 @@ _END_
|
||||
{
|
||||
# build lua modules
|
||||
|
||||
my $lualib_prefix = "$prefix/lualib";
|
||||
my $lualib_prefix = File::Spec->catfile($prefix, "lualib");
|
||||
|
||||
my $ngx_lua_dir = auto_complete 'ngx_lua';
|
||||
|
||||
@ -872,7 +883,7 @@ _EOC_
|
||||
|
||||
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/";
|
||||
. "$root_dir/build/install resty \$(DESTDIR)$prefix/bin/";
|
||||
|
||||
# prepare nginx configure line
|
||||
|
||||
@ -1153,9 +1164,14 @@ sub gen_makefile {
|
||||
print $out "export $line\n";
|
||||
}
|
||||
|
||||
if (File::Spec->rel2abs($prefix) ne File::Spec->canonpath($prefix)) {
|
||||
# prefix is a relative path.
|
||||
print $out "DESTDIR ?= $root_dir/\n\n";
|
||||
}
|
||||
|
||||
print $out ".PHONY: all install clean\n\n";
|
||||
|
||||
print $out "all:\n\t" . join("\n\t", @make_cmds) . "\n\n";
|
||||
print $out "all:\n\t" . join("\n\t", @make_cmds) . "\n\n";
|
||||
|
||||
print $out "install: all\n\t" . join("\n\t", @make_install_cmds) . "\n\n";
|
||||
|
||||
|
@ -523,6 +523,8 @@ $root/util/get-tarball "https://github.com/openresty/lua-cjson/archive/$ver.tar.
|
||||
tar -xzf lua-cjson-$ver.tar.gz || exit 1
|
||||
cd lua-cjson-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
@ -531,6 +533,11 @@ ver=0.10
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-redis-parser/tarball/v$ver" -O "lua-redis-parser-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-redis-parser-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-redis-parser-* lua-redis-parser-$ver || exit 1
|
||||
cd lua-redis-parser-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -538,6 +545,11 @@ ver=0.05
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-rds-parser/tarball/v$ver" -O "lua-rds-parser-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-rds-parser-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-rds-parser-* lua-rds-parser-$ver || exit 1
|
||||
cd lua-rds-parser-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -545,6 +557,11 @@ ver=0.14
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-dns/tarball/v$ver" -O "lua-resty-dns-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-dns-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-dns-* lua-resty-dns-$ver || exit 1
|
||||
cd lua-resty-dns-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -552,6 +569,11 @@ ver=0.13
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-memcached/tarball/v$ver" -O "lua-resty-memcached-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-memcached-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-memcached-* lua-resty-memcached-$ver || exit 1
|
||||
cd lua-resty-memcached-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -559,6 +581,11 @@ ver=0.21
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-redis/tarball/v$ver" -O "lua-resty-redis-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-redis-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-redis-* lua-resty-redis-$ver || exit 1
|
||||
cd lua-resty-redis-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -566,6 +593,11 @@ ver=0.15
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-mysql/tarball/v$ver" -O "lua-resty-mysql-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-mysql-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-mysql-* lua-resty-mysql-$ver || exit 1
|
||||
cd lua-resty-mysql-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -573,6 +605,11 @@ ver=0.09
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-upload/tarball/v$ver" -O "lua-resty-upload-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-upload-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-upload-* lua-resty-upload-$ver || exit 1
|
||||
cd lua-resty-upload-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -580,6 +617,11 @@ ver=0.09
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-string/tarball/v$ver" -O "lua-resty-string-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-string-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-string-* lua-resty-string-$ver || exit 1
|
||||
cd lua-resty-string-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -587,6 +629,11 @@ ver=0.05
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-websocket/tarball/v$ver" -O "lua-resty-websocket-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-websocket-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-websocket-* lua-resty-websocket-$ver || exit 1
|
||||
cd lua-resty-websocket-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -594,6 +641,11 @@ ver=0.04
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-lock/tarball/v$ver" -O "lua-resty-lock-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-lock-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-lock-* lua-resty-lock-$ver || exit 1
|
||||
cd lua-resty-lock-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -601,6 +653,11 @@ ver=0.04
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-lrucache/tarball/v$ver" -O "lua-resty-lrucache-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-lrucache-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-lrucache-* lua-resty-lrucache-$ver || exit 1
|
||||
cd lua-resty-lrucache-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -608,6 +665,11 @@ ver=0.1.1
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-core/tarball/v$ver" -O "lua-resty-core-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-core-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-core-* lua-resty-core-$ver || exit 1
|
||||
cd lua-resty-core-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
@ -615,6 +677,11 @@ ver=0.03
|
||||
$root/util/get-tarball "https://github.com/openresty/lua-resty-upstream-healthcheck/tarball/v$ver" -O "lua-resty-upstream-healthcheck-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-upstream-healthcheck-$ver.tar.gz || exit 1
|
||||
mv openresty-lua-resty-upstream-healthcheck-* lua-resty-upstream-healthcheck-$ver || exit 1
|
||||
cd lua-resty-upstream-healthcheck-$ver || exit 1
|
||||
#patch -p1 < $root/patches/lua_cjson-$ver-array_detection_fix.patch || exit 1
|
||||
sed 's/\$(DESTDIR)\//$(DESTDIR)/g' Makefile > mk || exit 1
|
||||
mv mk Makefile || exit 1
|
||||
cd ..
|
||||
|
||||
#################################
|
||||
|
||||
|
Reference in New Issue
Block a user