[package] nginx: packaging enhancements
[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.65
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://sysoev.ru/nginx/
16 PKG_MD5SUM:=abc4f76af450eedeb063158bd963feaa
17
18 include $(INCLUDE_DIR)/package.mk
19
20 define Package/nginx
21 SECTION:=net
22 CATEGORY:=Network
23 TITLE:=Nginx web server
24 URL:=http://nginx.net/
25 DEPENDS:=+libpcre
26 MENU:=1
27 endef
28
29 define Package/nginx/description
30 Nginx is a free, open-source, high-performance HTTP server
31 and reverse proxy, as well as an IMAP/POP3 proxy server,
32 written by Igor Sysoev.
33 endef
34
35 define Package/nginx/config
36 source "$(SOURCE)/Config.in"
37 endef
38
39 config_files=nginx.conf mime.types fastcgi_params koi-utf koi-win win-utf
40
41 define Package/nginx/conffiles
42 /etc/nginx/nginx.conf
43 /etc/nginx/mime.types
44 /etc/nginx/fastcgi_params
45 /etc/nginx/koi-utf
46 /etc/nginx/koi-win
47 /etc/nginx/win-utf
48 endef
49
50 ADDITIONAL_MODULES:=
51
52 ifeq ($(CONFIG_IPV6),y)
53 ADDITIONAL_MODULES += --with-ipv6
54 endif
55 ifeq ($(CONFIG_NGINX_STUB_STATUS),y)
56 ADDITIONAL_MODULES += --with-http_stub_status_module
57 endif
58 ifeq ($(CONFIG_NGINX_FLV),y)
59 ADDITIONAL_MODULES += --with-http_flv_module
60 endif
61 ifeq ($(CONFIG_NGINX_SSL),y)
62 ADDITIONAL_MODULES += --with-http_ssl_module
63 endif
64 ifeq ($(CONFIG_NGINX_DAV),y)
65 ADDITIONAL_MODULES += --with-http_dav_module
66 endif
67
68 define Build/Configure
69 # TODO: fix --crossbuild
70 (cd $(PKG_BUILD_DIR) ;\
71 ./configure \
72 --crossbuild=Linux::$(ARCH) \
73 --prefix=/usr \
74 --conf-path=/etc/nginx/nginx.conf \
75 --error-log-path=/var/log/nginx/error.log \
76 --pid-path=/var/run/nginx.pid \
77 --lock-path=/var/lock/nginx.lock \
78 --http-log-path=/var/log/nginx/access.log \
79 --http-client-body-temp-path=/var/lib/nginx/body \
80 --http-proxy-temp-path=/var/lib/nginx/proxy \
81 --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
82 --with-cc="$(TARGET_CC)" \
83 --with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
84 --with-ld-opt="$(TARGET_LDFLAGS)" \
85 $(ADDITIONAL_MODULES) )
86 endef
87
88 define Build/Compile
89 $(MAKE) -C $(PKG_BUILD_DIR) \
90 DESTDIR=$(PKG_INSTALL_DIR) \
91 build install
92 endef
93
94 define Package/nginx/install
95 $(INSTALL_DIR) $(1)/usr/sbin
96 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/
97 $(INSTALL_DIR) $(1)/etc/nginx
98 $(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx
99 # make nginx bind on both IPv4 and IPv6 by default, when available
100 ifeq ($(CONFIG_IPV6),y)
101 $(SED) 's/listen\( \+\)80;/listen\1[::]:80;/' $(1)/etc/nginx/nginx.conf
102 endif
103 $(INSTALL_DIR) $(1)/etc/init.d
104 $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx
105 endef
106
107 $(eval $(call BuildPackage,nginx))