1
0
mirror of https://github.com/openresty/openresty synced 2024-11-09 18:35:51 +01:00

now we write Makefile.

This commit is contained in:
agentzh (章亦春) 2011-03-07 02:46:56 +08:00
parent 87277a3eee
commit bff4acbbd4
2 changed files with 42 additions and 3 deletions

@ -198,6 +198,7 @@ cd nginx-0.8.54
--add-module=../auth-request-nginx-module-0.2 \
--add-module=../rds-json-nginx-module-0.11rc2 \
--with-http_ssl_module
cd ../..
@ -232,6 +233,7 @@ cd nginx-0.8.54
--add-module=../auth-request-nginx-module-0.2 \
--add-module=../rds-json-nginx-module-0.11rc2 \
--with-http_ssl_module
cd ../..
@ -251,7 +253,7 @@ cp -r bundle/ build/
cd build
cd LuaJIT-2.0.0-beta6
make PREFIX=/usr/local/openresty/luajit
make PREFIX=/usr/local/openresty/luajit DESTDIR=$OPENRESTY_BUILD_DIR/luajit-root install
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 ..
@ -275,4 +277,5 @@ cd nginx-0.8.54
--add-module=../rds-json-nginx-module-0.11rc2 \
--with-ld-opt='-Wl,-rpath=/usr/local/openresty/luajit/lib' \
--with-http_ssl_module
cd ../..

40
util/configure vendored

@ -12,6 +12,10 @@ sub cd ($);
sub auto_complete ($);
sub usage ($);
my (@make_cmds, @make_install_cmds);
my $ngx_dir;
my @modules = (
[http_iconv => 'iconv-nginx-module', 'disabled'],
[http_echo => 'echo-nginx-module'],
@ -122,6 +126,16 @@ my $cmd = "./configure --prefix=$ngx_prefix"
shell $cmd, $dry_run;
push @make_cmds, "cd build/$ngx_dir && "
. "\$(MAKE)";
push @make_install_cmds, "cd build/$ngx_dir && "
. "\$(MAKE) install DESTDIR=\$(DESTDIR)";
cd '../..'; # to the root
gen_makefile();
sub env ($$) {
my ($name, $val) = @_;
print "export $name='$val'\n";
@ -224,7 +238,13 @@ sub build_resty_opts {
cd $luajit_src;
shell "make PREFIX=$luajit_prefix", $dry_run;
shell "make PREFIX=$luajit_prefix DESTDIR=$luajit_root install", $dry_run;
shell "make install PREFIX=$luajit_prefix DESTDIR=$luajit_root", $dry_run;
push @make_cmds, "cd build/$luajit_src && "
. "\$(MAKE) PREFIX=$luajit_prefix";
push @make_install_cmds, "cd build/$luajit_src && "
. "\$(MAKE) install PREFIX=$luajit_prefix DESTDIR=\$(DESTDIR)";
env LUAJIT_LIB => "$luajit_root$luajit_prefix/lib";
env LUAJIT_INC => "$luajit_root$luajit_prefix/include/luajit-2.0";
@ -234,6 +254,8 @@ sub build_resty_opts {
cd '..';
} elsif ($opts->{lua}) {
# build stdandard lua
my $lua_src = glob('lua-5.*');
if (!defined $lua_src) {
@ -258,12 +280,16 @@ sub build_resty_opts {
env LUA_LIB => "$lua_root$lua_prefix/lib";
env LUA_INC => "$lua_root$lua_prefix/include";
push @make_cmds, "cd build/$lua_src && \$(MAKE) linux";
push @make_install_cmds, "cd build/$lua_src && "
. "\$(MAKE) install INSTALL_TOP=\$(DESTDIR)$lua_prefix";
cd '..';
}
# prepare nginx configure line
my $ngx_dir = auto_complete "nginx";
$ngx_dir = auto_complete "nginx";
cd $ngx_dir;
@ -483,3 +509,13 @@ _EOC_
exit $retval;
}
sub gen_makefile {
open my $out, ">Makefile" or
die "Cannot open Makefile for writing: $!\n";
print $out "all:\n\t" . join("\n\t", @make_cmds) . "\n\n";
print $out "install:\n\t" . join("\n\t", @make_install_cmds) . "\n";
close $out;
}