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