-
Notifications
You must be signed in to change notification settings - Fork 75
/
Makefile
140 lines (112 loc) · 5.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
export PATH := $(PWD)/t/build/sbin:$(PWD)/t/build/bin:$(PATH)
export PERL5LIB := $(PWD)/t/build/lib/perl5
export UNBOUND_PID := $(PWD)/t/build/etc/unbound/unbound.pid
unbound_version=1.4.22
lua_jit_version=2.0.3
lua_nginx_module_version=0.9.13rc1
lua_upstream_nginx_module_version=0.02
nginx_version=1.7.7
nginx_no_pool_version?=$(nginx_version)
nginx_url=http://nginx.org/download/nginx-$(nginx_version).tar.gz
clean:
rm -rf t/build t/servroot t/tmp
prepare: t/build/lib/perl5 t/build/sbin/unbound t/build/sbin/nginx
test: prepare
echo "" > /tmp/nginx_upstream_dynamic_servers_unbound_active_test.conf
echo "" > /tmp/unbound.log
if [ -f $(UNBOUND_PID) ] && ps -p `cat $(UNBOUND_PID)` > /dev/null; then kill -QUIT `cat $(UNBOUND_PID)`; fi
sleep 0.2
env PATH=$(PATH) unbound -c $(PWD)/t/unbound/unbound.conf -vvv
env PATH=$(PATH) PERL5LIB=$(PERL5LIB) UNBOUND_PID=$(UNBOUND_PID) LD_LIBRARY_PATH=$(PWD)/t/build/lib:$(LD_LIBRARY_PATH) prove
STATUS=$$?
if [ -f $(UNBOUND_PID) ] && ps -p `cat $(UNBOUND_PID)` > /dev/null; then kill -QUIT `cat $(UNBOUND_PID)`; fi
exit $$STATUS
grind:
env TEST_NGINX_USE_VALGRIND=1 TEST_NGINX_SLEEP=5 $(MAKE) test
t/tmp:
mkdir -p $@
touch $@
t/tmp/cpanm: | t/tmp
curl -o $@ -L http://cpanmin.us
chmod +x $@
touch $@
t/build/lib/perl5: t/tmp/cpanm
$< -L t/build --notest LWP::Protocol::https
$< -L t/build --notest https://github.com/openresty/test-nginx/archive/8d5c8668364251cdae01ccf1ef933d80b642982d.tar.gz
touch $@
t/tmp/unbound-$(unbound_version).tar.gz: | t/tmp
curl -o $@ "http://unbound.net/downloads/unbound-$(unbound_version).tar.gz"
t/tmp/unbound-$(unbound_version): t/tmp/unbound-$(unbound_version).tar.gz
tar -C t/tmp -xf $<
touch $@
t/tmp/unbound-$(unbound_version)/Makefile: | t/tmp/unbound-$(unbound_version)
cd t/tmp/unbound-$(unbound_version) && ./configure --prefix=$(PWD)/t/build
touch $@
t/tmp/unbound-$(unbound_version)/unbound: t/tmp/unbound-$(unbound_version)/Makefile
cd t/tmp/unbound-$(unbound_version) && make
touch $@
t/build/sbin/unbound: t/tmp/unbound-$(unbound_version)/unbound
cd t/tmp/unbound-$(unbound_version) && make install
touch $@
t/tmp/LuaJIT-$(lua_jit_version).tar.gz: | t/tmp
curl -o $@ "http://luajit.org/download/LuaJIT-$(lua_jit_version).tar.gz"
t/tmp/LuaJIT-$(lua_jit_version): t/tmp/LuaJIT-$(lua_jit_version).tar.gz
tar -C t/tmp -xf $<
touch $@
t/tmp/LuaJIT-$(lua_jit_version)/src/luajit: | t/tmp/LuaJIT-$(lua_jit_version)
cd t/tmp/LuaJIT-$(lua_jit_version) && make PREFIX=$(PWD)/t/build
touch $@
t/build/bin/luajit: t/tmp/LuaJIT-$(lua_jit_version)/src/luajit
cd t/tmp/LuaJIT-$(lua_jit_version) && make install PREFIX=$(PWD)/t/build
touch $@
t/tmp/lua-nginx-module-$(lua_nginx_module_version).tar.gz: | t/tmp
curl -Lo $@ "https://github.com/openresty/lua-nginx-module/archive/v$(lua_nginx_module_version).tar.gz"
t/tmp/lua-nginx-module-$(lua_nginx_module_version): t/tmp/lua-nginx-module-$(lua_nginx_module_version).tar.gz
tar -C t/tmp -xf $<
touch $@
t/tmp/lua-upstream-nginx-module-$(lua_upstream_nginx_module_version).tar.gz: | t/tmp
curl -Lo $@ "https://github.com/openresty/lua-upstream-nginx-module/archive/v$(lua_upstream_nginx_module_version).tar.gz"
t/tmp/lua-upstream-nginx-module-$(lua_upstream_nginx_module_version): t/tmp/lua-upstream-nginx-module-$(lua_upstream_nginx_module_version).tar.gz
tar -C t/tmp -xf $<
touch $@
t/tmp/nginx-$(nginx_version).tar.gz: | t/tmp
curl -o $@ $(nginx_url)
t/tmp/nginx-$(nginx_version): t/tmp/nginx-$(nginx_version).tar.gz
tar -C t/tmp -xf $<
touch $@
t/tmp/nginx-$(nginx_no_pool_version)-no_pool.patch: | t/tmp
curl -o $@ https://raw.githubusercontent.com/openresty/no-pool-nginx/master/nginx-$(nginx_no_pool_version)-no_pool.patch
t/tmp/nginx-$(nginx_version)/.patches-applied: | t/tmp/nginx-$(nginx_version) t/tmp/nginx-$(nginx_no_pool_version)-no_pool.patch
cat t/tmp/nginx-$(nginx_no_pool_version)-no_pool.patch | sed "s,.*nginx_version.*, `cat t/tmp/nginx-$(nginx_version)/src/core/nginx.h | grep nginx_version`," | sed 's,"$(nginx_no_pool_version),"$(nginx_version),' | patch -d t/tmp/nginx-$(nginx_version) -p1 --quiet
touch $@
t/tmp/nginx-$(nginx_version)/Makefile: config | t/tmp/nginx-$(nginx_version) t/tmp/nginx-$(nginx_version)/.patches-applied t/build/bin/luajit t/tmp/lua-nginx-module-$(lua_nginx_module_version) t/tmp/lua-upstream-nginx-module-$(lua_upstream_nginx_module_version)
cd t/tmp/nginx-$(nginx_version) && env \
LUAJIT_LIB=$(PWD)/t/build/lib \
LUAJIT_INC=$(PWD)/t/build/include/luajit-2.0 \
./configure \
--prefix=$(PWD)/t/build \
--with-debug \
--with-ipv6 \
--add-module=$(PWD)/t/tmp/lua-nginx-module-$(lua_nginx_module_version) \
--add-module=$(PWD)/t/tmp/lua-upstream-nginx-module-$(lua_upstream_nginx_module_version) \
--add-module=$(PWD) \
--without-http_charset_module \
--without-http_userid_module \
--without-http_auth_basic_module \
--without-http_autoindex_module \
--without-http_geo_module \
--without-http_split_clients_module \
--without-http_referer_module \
--without-http_fastcgi_module \
--without-http_uwsgi_module \
--without-http_scgi_module \
--without-http_memcached_module \
--without-http_limit_conn_module \
--without-http_limit_req_module \
--without-http_empty_gif_module \
--without-http_browser_module \
--without-http_upstream_ip_hash_module
t/tmp/nginx-$(nginx_version)/objs/nginx: t/tmp/nginx-$(nginx_version)/Makefile *.c
cd t/tmp/nginx-$(nginx_version) && make
t/build/sbin/nginx: t/tmp/nginx-$(nginx_version)/objs/nginx
cd t/tmp/nginx-$(nginx_version) && make install