From b2acdc53870eb6e7a38e80ff4585e59b690a2f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?agentzh=20=28=E7=AB=A0=E4=BA=A6=E6=98=A5=29?= Date: Mon, 7 Mar 2011 17:31:59 +0800 Subject: [PATCH] now we support accumulative --with-ld-opt option. --- t/sanity.t | 59 +++++++++++++++++++++++++++++++++++++++++++++++++- util/configure | 27 +++++++++++++++++------ 2 files changed, 78 insertions(+), 8 deletions(-) diff --git a/t/sanity.t b/t/sanity.t index 203bf60..ddf3614 100644 --- a/t/sanity.t +++ b/t/sanity.t @@ -2,7 +2,7 @@ use t::Config; -plan tests => 3 * blocks() + 4; +plan tests => 4 * blocks() - 2; #no_diff(); @@ -404,3 +404,60 @@ install: clean: rm -rf build + + +=== TEST 5: --with-ld-opt +--- cmd: ./configure --with-luajit --with-ld-opt="-llua" --dry-run +--- out +cp -r bundle/ build/ +cd build +cd libdrizzle-0.8 +./configure --prefix=/usr/local/openresty/libdrizzle +make +make install DESTDIR=$OPENRESTY_BUILD_DIR/libdrizzle-root +export LIBDRIZZLE_LIB='$OPENRESTY_BUILD_DIR/libdrizzle-root/usr/local/openresty/libdrizzle/lib' +export LIBDRIZZLE_INC='$OPENRESTY_BUILD_DIR/libdrizzle-root/usr/local/openresty/libdrizzle/include' +cd .. +cd LuaJIT-2.0.0-beta6 +make PREFIX=/usr/local/openresty/luajit +make install PREFIX=/usr/local/openresty/luajit DESTDIR=$OPENRESTY_BUILD_DIR/luajit-root +export LUAJIT_LIB='$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/lib' +export LUAJIT_INC='$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.0' +cd .. +cd nginx-0.8.54 +./configure --prefix=/usr/local/openresty/nginx \ + --with-cc-opt='-O2' \ + --add-module=../echo-nginx-module-0.36rc1 \ + --add-module=../xss-nginx-module-0.03rc2 \ + --add-module=../ngx_devel_kit-0.2.14 \ + --add-module=../set-misc-nginx-module-0.21rc2 \ + --add-module=../form-input-nginx-module-0.07rc4 \ + --add-module=../encrypted-session-nginx-module-0.01 \ + --add-module=../drizzle-nginx-module-0.0.15rc9 \ + --add-module=../lua-nginx-module-0.1.6rc1 \ + --add-module=../headers-more-nginx-module-0.14 \ + --add-module=../srcache-nginx-module-0.12rc1 \ + --add-module=../array-var-nginx-module-0.02 \ + --add-module=../memc-nginx-module-0.12rc1 \ + --add-module=../upstream-keepalive-nginx-module-0.3 \ + --add-module=../auth-request-nginx-module-0.2 \ + --add-module=../rds-json-nginx-module-0.11rc2 \ + --with-ld-opt='-Wl,-rpath=/usr/local/openresty/libdrizzle/lib:/usr/local/openresty/luajit/lib -llua' \ + --with-http_ssl_module +cd ../.. +--- makefile +.PHONY: all install + +all: + cd build/libdrizzle-0.8 && $(MAKE) + cd build/LuaJIT-2.0.0-beta6 && $(MAKE) PREFIX=/usr/local/openresty/luajit + cd build/nginx-0.8.54 && $(MAKE) + +install: + cd build/libdrizzle-0.8 && $(MAKE) install DESTDIR=$(DESTDIR) + cd build/LuaJIT-2.0.0-beta6 && $(MAKE) install PREFIX=/usr/local/openresty/luajit DESTDIR=$(DESTDIR) + cd build/nginx-0.8.54 && $(MAKE) install DESTDIR=$(DESTDIR) + +clean: + rm -rf build + diff --git a/util/configure b/util/configure index 8af5c21..2eb53d3 100755 --- a/util/configure +++ b/util/configure @@ -70,9 +70,9 @@ my $prefix = '/usr/local/openresty'; my %resty_opts; my $dry_run; my @ngx_rpaths; -my @ngx_cc_opts; -my @ngx_opts; +my (@ngx_opts, @ngx_cc_opts, @ngx_ld_opts); + for my $opt (@ARGV) { if ($opt eq '--dry-run') { $dry_run = 1; @@ -91,6 +91,9 @@ for my $opt (@ARGV) { } elsif ($opt =~ /^--with-cc-opt=(.*)/) { push @ngx_cc_opts, $1; + } elsif ($opt =~ /^--with-ld-opt=(.*)/) { + push @ngx_ld_opts, $1; + } elsif ($opt =~ $without_resty_mods_regex) { die "No $1\n"; $resty_opts{"no_http_$1"} = 1; @@ -121,12 +124,22 @@ for my $opt (@ARGV) { my $ngx_prefix = "$prefix/nginx"; +my $resty_opts = build_resty_opts(\%resty_opts); + +if (@ngx_rpaths) { + unshift @ngx_ld_opts, "-Wl,-rpath=" . join(":", @ngx_rpaths); +} + +my $ld_opts = ''; +if (@ngx_ld_opts) { + $ld_opts = " \\\n --with-ld-opt='@ngx_ld_opts'"; +} + my $cmd = "./configure --prefix=$ngx_prefix" - . build_resty_opts(\%resty_opts) - . (@ngx_rpaths ? " \\\n --with-ld-opt='-Wl,-rpath=" - . join(":", @ngx_rpaths) . "'" : "") - . (@ngx_opts ? " \\\n " . join(" ", @ngx_opts) : ""); - ; + . $resty_opts + . $ld_opts + . (@ngx_opts ? " \\\n @ngx_opts" : ""); + ; shell $cmd, $dry_run;