From b7e7398fc904de0d87d916754c0717caffb343eb 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: Sat, 23 Jul 2011 12:37:44 +0800 Subject: [PATCH] =?UTF-8?q?now=20the=20--with-cc=3DCC=20option=20of=20./co?= =?UTF-8?q?nfigure=20also=20controls=20the=20C=20compiler=20used=20by=20Lu?= =?UTF-8?q?a=20and=20LuaJIT.=20thanks=20@=E5=A7=9C=E5=A4=A7=E7=82=AE=20for?= =?UTF-8?q?=20reporting=20the=20issue;=20also=20released=20ngx=5Fopenresty?= =?UTF-8?q?=201.0.4.1rc3.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- t/sanity.t | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ util/configure | 35 +++++++++++++++++++++++++++-------- util/ver | 2 +- 3 files changed, 76 insertions(+), 9 deletions(-) diff --git a/t/sanity.t b/t/sanity.t index a99d7d8..cca845f 100644 --- a/t/sanity.t +++ b/t/sanity.t @@ -871,6 +871,7 @@ The http_drizzle_module is not enabled while --with-libdrizzle is specified. --- exit: 255 + === TEST 16: ngx_drizzle enabled and --with-libdrizzle is specified --- cmd: ./configure --with-libdrizzle=/opt/drizzle --with-http_drizzle_module --dry-run --- out @@ -921,3 +922,50 @@ install: clean: rm -rf build + + +=== TEST 17: --with-cc +--- cmd: ./configure --with-cc=gcc-4.2 --dry-run --platform=solaris +--- out +platform: solaris (solaris) +cp -rp bundle/ build/ +cd build +cd lua-5.1.4 +make CC=gcc-4.2 solaris +make install CC=gcc-4.2 INSTALL_TOP=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua +export LUA_LIB='$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/lib' +export LUA_INC='$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include' +cd .. +cd nginx-1.0.4 +./configure --prefix=/usr/local/openresty/nginx \ + --add-module=../echo-nginx-module-0.37rc1 \ + --add-module=../xss-nginx-module-0.03rc3 \ + --add-module=../ngx_devel_kit-0.2.17 \ + --add-module=../set-misc-nginx-module-0.21 \ + --add-module=../form-input-nginx-module-0.07rc4 \ + --add-module=../encrypted-session-nginx-module-0.01 \ + --add-module=../ngx_lua-0.2.1rc2 \ + --add-module=../headers-more-nginx-module-0.15 \ + --add-module=../srcache-nginx-module-0.12 \ + --add-module=../array-var-nginx-module-0.02 \ + --add-module=../memc-nginx-module-0.12 \ + --add-module=../redis2-nginx-module-0.07 \ + --add-module=../upstream-keepalive-nginx-module-0.3 \ + --add-module=../auth-request-nginx-module-0.2 \ + --add-module=../rds-json-nginx-module-0.12rc1 \ + --with-cc=gcc-4.2 --with-http_ssl_module +cd ../.. +--- makefile +.PHONY: all install clean + +all: + cd build/lua-5.1.4 && $(MAKE) CC=gcc-4.2 solaris + cd build/nginx-1.0.4 && $(MAKE) + +install: + cd build/lua-5.1.4 && $(MAKE) install CC=gcc-4.2 INSTALL_TOP=$(DESTDIR)/usr/local/openresty/lua + cd build/nginx-1.0.4 && $(MAKE) install DESTDIR=$(DESTDIR) + +clean: + rm -rf build + diff --git a/util/configure b/util/configure index 498a360..2da805a 100755 --- a/util/configure +++ b/util/configure @@ -105,12 +105,19 @@ my $prefix = '/usr/local/openresty'; my %resty_opts; my $dry_run; my @ngx_rpaths; +my $cc; my (@ngx_opts, @ngx_cc_opts, @ngx_ld_opts); for my $opt (@ARGV) { next unless defined $opt; + if ($opt =~ /^--with-cc=(.+)/) { + $cc = $1; + push @ngx_opts, $opt; + next; + } + if ($opt eq '--dry-run') { $dry_run = 1; next; @@ -317,14 +324,21 @@ sub build_resty_opts { cd $luajit_src; - shell "make PREFIX=$luajit_prefix", $dry_run; - shell "make install PREFIX=$luajit_prefix DESTDIR=$luajit_root", $dry_run; + my $extra_opts = ''; + + if (defined $cc) { + $extra_opts .= " CC=$cc"; + } + + shell "make$extra_opts PREFIX=$luajit_prefix", $dry_run; + + shell "make install$extra_opts PREFIX=$luajit_prefix DESTDIR=$luajit_root", $dry_run; push @make_cmds, "cd build/$luajit_src && " - . "\$(MAKE) PREFIX=$luajit_prefix"; + . "\$(MAKE)$extra_opts PREFIX=$luajit_prefix"; push @make_install_cmds, "cd build/$luajit_src && " - . "\$(MAKE) install PREFIX=$luajit_prefix DESTDIR=\$(DESTDIR)"; + . "\$(MAKE) install$extra_opts PREFIX=$luajit_prefix DESTDIR=\$(DESTDIR)"; env LUAJIT_LIB => "$luajit_root$luajit_prefix/lib"; env LUAJIT_INC => "$luajit_root$luajit_prefix/include/luajit-2.0"; @@ -354,16 +368,21 @@ sub build_resty_opts { cd $lua_src; - shell "make $platform", $dry_run; - shell "make install INSTALL_TOP=$lua_root$lua_prefix", $dry_run; + my $extra_opts = ''; + if (defined $cc) { + $extra_opts .= " CC=$cc"; + } + + shell "make$extra_opts $platform", $dry_run; + shell "make install$extra_opts INSTALL_TOP=$lua_root$lua_prefix", $dry_run; env LUA_LIB => "$lua_root$lua_prefix/lib"; env LUA_INC => "$lua_root$lua_prefix/include"; - push @make_cmds, "cd build/$lua_src && \$(MAKE) $platform"; + push @make_cmds, "cd build/$lua_src && \$(MAKE)$extra_opts $platform"; push @make_install_cmds, "cd build/$lua_src && " - . "\$(MAKE) install INSTALL_TOP=\$(DESTDIR)$lua_prefix"; + . "\$(MAKE) install$extra_opts INSTALL_TOP=\$(DESTDIR)$lua_prefix"; cd '..'; } diff --git a/util/ver b/util/ver index d3cdf11..acb644f 100755 --- a/util/ver +++ b/util/ver @@ -1,7 +1,7 @@ #!/bin/bash main_ver=1.0.4 -minor_ver=1rc2 +minor_ver=1rc3 version=$main_ver.$minor_ver echo $version