[net] Web Servers/Proxies: Move all web servers, proxies, and related programs into...
[openwrt/svn-archive/archive.git] / net / nginx / Makefile
1 #
2 # Copyright (C) 2009-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=nginx
11 PKG_VERSION:=0.7.67
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://sysoev.ru/nginx/
16 PKG_MD5SUM:=b6e175f969d03a4d3c5643aaabc6a5ff
17
18 PKG_BUILD_PARALLEL:=1
19 PKG_INSTALL:=1
20
21 PKG_CONFIG_DEPENDS:=\
22 CONFIG_NGINX_STUB_STATUS \
23 CONFIG_NGINX_FLV \
24 CONFIG_NGINX_SSL \
25 CONFIG_NGINX_DAV
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/nginx
30 SECTION:=net
31 CATEGORY:=Network
32 SUBMENU:=Web Servers/Proxies
33 TITLE:=Nginx web server
34 URL:=http://nginx.net/
35 DEPENDS:=+libpcre +NGINX_SSL:libopenssl +zlib
36 MENU:=1
37 endef
38
39 define Package/nginx/description
40 Nginx is a free, open-source, high-performance HTTP server
41 and reverse proxy, as well as an IMAP/POP3 proxy server,
42 written by Igor Sysoev.
43 endef
44
45 define Package/nginx/config
46 source "$(SOURCE)/Config.in"
47 endef
48
49 config_files=nginx.conf mime.types fastcgi_params koi-utf koi-win win-utf
50
51 define Package/nginx/conffiles
52 /etc/nginx/nginx.conf
53 /etc/nginx/mime.types
54 /etc/nginx/fastcgi_params
55 /etc/nginx/koi-utf
56 /etc/nginx/koi-win
57 /etc/nginx/win-utf
58 endef
59
60 ADDITIONAL_MODULES:=
61
62 ifeq ($(CONFIG_IPV6),y)
63 ADDITIONAL_MODULES += --with-ipv6
64 endif
65 ifeq ($(CONFIG_NGINX_STUB_STATUS),y)
66 ADDITIONAL_MODULES += --with-http_stub_status_module
67 endif
68 ifeq ($(CONFIG_NGINX_FLV),y)
69 ADDITIONAL_MODULES += --with-http_flv_module
70 endif
71 ifeq ($(CONFIG_NGINX_SSL),y)
72 ADDITIONAL_MODULES += --with-http_ssl_module
73 else
74 ADDITIONAL_MODULES += --without-http-cache
75 endif
76 ifeq ($(CONFIG_NGINX_DAV),y)
77 ADDITIONAL_MODULES += --with-http_dav_module
78 endif
79
80 define Build/Configure
81 # TODO: fix --crossbuild
82 (cd $(PKG_BUILD_DIR) ;\
83 ./configure \
84 --crossbuild=Linux::$(ARCH) \
85 --prefix=/usr \
86 --conf-path=/etc/nginx/nginx.conf \
87 --error-log-path=/var/log/nginx/error.log \
88 --pid-path=/var/run/nginx.pid \
89 --lock-path=/var/lock/nginx.lock \
90 --http-log-path=/var/log/nginx/access.log \
91 --http-client-body-temp-path=/var/lib/nginx/body \
92 --http-proxy-temp-path=/var/lib/nginx/proxy \
93 --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
94 --with-cc="$(TARGET_CC)" \
95 --with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
96 --with-ld-opt="$(TARGET_LDFLAGS)" \
97 $(ADDITIONAL_MODULES) )
98 endef
99
100 define Build/Compile
101 $(call Build/Compile/Default,build)
102 endef
103
104 define Package/nginx/install
105 $(INSTALL_DIR) $(1)/usr/sbin
106 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/
107 $(INSTALL_DIR) $(1)/etc/nginx
108 $(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx
109 # make nginx bind on both IPv4 and IPv6 by default, when available
110 ifeq ($(CONFIG_IPV6),y)
111 $(SED) 's/listen\( \+\)80;/listen\1[::]:80;/' $(1)/etc/nginx/nginx.conf
112 endif
113 $(INSTALL_DIR) $(1)/etc/init.d
114 $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx
115 endef
116
117 $(eval $(call BuildPackage,nginx))