lede-packages-rs

git clone git://archive.git.mtrnord.blog/MTRNord/lede-packages-rs.git
Log | Files | Refs | README | LICENSE

Makefile (8770B)


      1 #
      2 # Copyright (C) 2012-2016 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:=1.10.3
     12 PKG_RELEASE:=1
     13 
     14 PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
     15 PKG_SOURCE_URL:=http://nginx.org/download/
     16 PKG_MD5SUM:=204a20cb4f0b0c9db746c630d89ff4ea
     17 PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
     18 PKG_LICENSE:=2-clause BSD-like license
     19 
     20 PKG_BUILD_DIR:=$(BUILD_DIR)/nginx-$(PKG_VERSION)
     21 
     22 PKG_BUILD_PARALLEL:=1
     23 PKG_INSTALL:=1
     24 
     25 PKG_CONFIG_DEPENDS := \
     26 	CONFIG_NGINX_SSL \
     27 	CONFIG_NGINX_DAV \
     28 	CONFIG_NGINX_FLV \
     29 	CONFIG_NGINX_STUB_STATUS \
     30 	CONFIG_NGINX_HTTP_CHARSET \
     31 	CONFIG_NGINX_HTTP_GZIP \
     32 	CONFIG_NGINX_HTTP_SSI \
     33 	CONFIG_NGINX_HTTP_USERID \
     34 	CONFIG_NGINX_HTTP_ACCESS \
     35 	CONFIG_NGINX_HTTP_AUTH_BASIC \
     36 	CONFIG_NGINX_HTTP_AUTH_REQUEST \
     37 	CONFIG_NGINX_HTTP_AUTOINDEX \
     38 	CONFIG_NGINX_HTTP_GEO \
     39 	CONFIG_NGINX_HTTP_MAP \
     40 	CONFIG_NGINX_HTTP_SPLIT_CLIENTS \
     41 	CONFIG_NGINX_HTTP_REFERER \
     42 	CONFIG_NGINX_HTTP_REWRITE \
     43 	CONFIG_NGINX_HTTP_PROXY \
     44 	CONFIG_NGINX_HTTP_FASTCGI \
     45 	CONFIG_NGINX_HTTP_UWSGI \
     46 	CONFIG_NGINX_HTTP_SCGI \
     47 	CONFIG_NGINX_HTTP_MEMCACHED \
     48 	CONFIG_NGINX_HTTP_LIMIT_CONN \
     49 	CONFIG_NGINX_HTTP_LIMIT_REQ \
     50 	CONFIG_NGINX_HTTP_EMPTY_GIF \
     51 	CONFIG_NGINX_HTTP_BROWSER \
     52 	CONFIG_NGINX_HTTP_UPSTREAM_HASH \
     53 	CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \
     54 	CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN \
     55 	CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE \
     56 	CONFIG_NGINX_HTTP_UPSTREAM_ZONE \
     57 	CONFIG_NGINX_HTTP_CACHE \
     58 	CONFIG_NGINX_HTTP_V2 \
     59 	CONFIG_NGINX_PCRE \
     60 	CONFIG_NGINX_NAXSI \
     61 	CONFIG_NGINX_LUA \
     62 	CONFIG_NGINX_HTTP_REAL_IP \
     63 	CONFIG_NGINX_HTTP_SECURE_LINK
     64 
     65 include $(INCLUDE_DIR)/package.mk
     66 
     67 define Package/nginx
     68   SECTION:=net
     69   CATEGORY:=Network
     70   SUBMENU:=Web Servers/Proxies
     71   TITLE:=Nginx web server
     72   URL:=http://nginx.org/
     73   DEPENDS:=+NGINX_PCRE:libpcre +(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC):libopenssl +NGINX_HTTP_GZIP:zlib +NGINX_LUA:liblua +libpthread
     74   MENU:=1
     75 endef
     76 
     77 define Package/nginx/description
     78  nginx is an HTTP and reverse proxy server, as well as a mail proxy server,
     79  written by Igor Sysoev.
     80 endef
     81 
     82 define Package/nginx/config
     83   source "$(SOURCE)/Config.in"
     84 endef
     85 
     86 config_files=nginx.conf mime.types
     87 
     88 define Package/nginx/conffiles
     89 /etc/nginx/
     90 endef
     91 
     92 ADDITIONAL_MODULES:=
     93 ifeq ($(CONFIG_NGINX_NAXSI),y)
     94   ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src
     95 endif
     96 ifeq ($(CONFIG_NGINX_LUA),y)
     97   ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx
     98 endif
     99 ifeq ($(CONFIG_IPV6),y)
    100   ADDITIONAL_MODULES += --with-ipv6
    101 endif
    102 ifeq ($(CONFIG_NGINX_STUB_STATUS),y)
    103   ADDITIONAL_MODULES += --with-http_stub_status_module
    104 endif
    105 ifeq ($(CONFIG_NGINX_FLV),y)
    106   ADDITIONAL_MODULES += --with-http_flv_module
    107 endif
    108 ifeq ($(CONFIG_NGINX_SSL),y)
    109   ADDITIONAL_MODULES += --with-http_ssl_module
    110 endif
    111 ifeq ($(CONFIG_NGINX_DAV),y)
    112   ADDITIONAL_MODULES += --with-http_dav_module
    113 endif
    114 ifneq ($(CONFIG_NGINX_HTTP_CACHE),y)
    115   ADDITIONAL_MODULES += --without-http-cache
    116 endif
    117 ifneq ($(CONFIG_NGINX_PCRE),y)
    118   ADDITIONAL_MODULES += --without-pcre
    119 endif
    120 ifneq ($(CONFIG_NGINX_HTTP_CHARSET),y)
    121   ADDITIONAL_MODULES += --without-http_charset_module
    122 else
    123   config_files += koi-utf koi-win win-utf
    124 endif
    125 ifneq ($(CONFIG_NGINX_HTTP_GZIP),y)
    126   ADDITIONAL_MODULES += --without-http_gzip_module
    127 endif
    128 ifneq ($(CONFIG_NGINX_HTTP_SSI),y)
    129   ADDITIONAL_MODULES += --without-http_ssi_module
    130 endif
    131 ifneq ($(CONFIG_NGINX_HTTP_USERID),y)
    132   ADDITIONAL_MODULES += --without-http_userid_module
    133 endif
    134 ifneq ($(CONFIG_NGINX_HTTP_ACCESS),y)
    135   ADDITIONAL_MODULES += --without-http_access_module
    136 endif
    137 ifneq ($(CONFIG_NGINX_HTTP_AUTH_BASIC),y)
    138   ADDITIONAL_MODULES += --without-http_auth_basic_module
    139 endif
    140 ifeq ($(CONFIG_NGINX_HTTP_AUTH_REQUEST),y)
    141   ADDITIONAL_MODULES += --with-http_auth_request_module
    142 endif
    143 ifneq ($(CONFIG_NGINX_HTTP_AUTOINDEX),y)
    144   ADDITIONAL_MODULES += --without-http_autoindex_module
    145 endif
    146 ifneq ($(CONFIG_NGINX_HTTP_GEO),y)
    147   ADDITIONAL_MODULES += --without-http_geo_module
    148 endif
    149 ifneq ($(CONFIG_NGINX_HTTP_MAP),y)
    150   ADDITIONAL_MODULES += --without-http_map_module
    151 endif
    152 ifneq ($(CONFIG_NGINX_HTTP_SPLIT_CLIENTS),y)
    153   ADDITIONAL_MODULES += --without-http_split_clients_module
    154 endif
    155 ifneq ($(CONFIG_NGINX_HTTP_REFERER),y)
    156   ADDITIONAL_MODULES += --without-http_referer_module
    157 endif
    158 ifneq ($(CONFIG_NGINX_HTTP_REWRITE),y)
    159   ADDITIONAL_MODULES += --without-http_rewrite_module
    160 endif
    161 ifneq ($(CONFIG_NGINX_HTTP_PROXY),y)
    162   ADDITIONAL_MODULES += --without-http_proxy_module
    163 endif
    164 ifneq ($(CONFIG_NGINX_HTTP_FASTCGI),y)
    165   ADDITIONAL_MODULES += --without-http_fastcgi_module
    166 else
    167   config_files += fastcgi_params
    168 endif
    169 ifneq ($(CONFIG_NGINX_HTTP_UWSGI),y)
    170   ADDITIONAL_MODULES += --without-http_uwsgi_module
    171 endif
    172 ifneq ($(CONFIG_NGINX_HTTP_SCGI),y)
    173   ADDITIONAL_MODULES += --without-http_scgi_module
    174 endif
    175 ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED),y)
    176   ADDITIONAL_MODULES += --without-http_memcached_module
    177 endif
    178 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN),y)
    179   ADDITIONAL_MODULES += --without-http_limit_conn_module
    180 endif
    181 ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ),y)
    182   ADDITIONAL_MODULES += --without-http_limit_req_module
    183 endif
    184 ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF),y)
    185   ADDITIONAL_MODULES += --without-http_empty_gif_module
    186 endif
    187 ifneq ($(CONFIG_NGINX_HTTP_BROWSER),y)
    188   ADDITIONAL_MODULES += --without-http_browser_module
    189 endif
    190 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_HASH),y)
    191   ADDITIONAL_MODULES += --without-http_upstream_hash_module
    192 endif
    193 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH),y)
    194   ADDITIONAL_MODULES += --without-http_upstream_ip_hash_module
    195 endif
    196 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN),y)
    197   ADDITIONAL_MODULES += --without-http_upstream_least_conn_module
    198 endif
    199 ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE),y)
    200   ADDITIONAL_MODULES += --without-http_upstream_keepalive_module
    201 endif
    202 ifeq ($(CONFIG_NGINX_HTTP_V2),y)
    203   ADDITIONAL_MODULES += --with-http_v2_module
    204 endif
    205 ifeq ($(CONFIG_NGINX_HTTP_REAL_IP),y)
    206   ADDITIONAL_MODULES += --with-http_realip_module
    207 endif
    208 ifeq ($(CONFIG_NGINX_HTTP_SECURE_LINK),y)
    209   ADDITIONAL_MODULES += --with-http_secure_link_module
    210 endif
    211 
    212 TARGET_CFLAGS += -fvisibility=hidden -ffunction-sections -fdata-sections -DNGX_LUA_NO_BY_LUA_BLOCK
    213 TARGET_LDFLAGS += -Wl,--gc-sections
    214 
    215 define Build/Configure
    216 	( cd $(PKG_BUILD_DIR) ; \
    217 		$(if $(CONFIG_NGINX_LUA),LUA_INC=$(STAGING_DIR)/usr/include LUA_LIB=$(STAGING_DIR)/usr/lib) \
    218 		./configure \
    219 			--crossbuild=Linux::$(ARCH) \
    220 			--prefix=/usr \
    221 			--conf-path=/etc/nginx/nginx.conf \
    222 			$(ADDITIONAL_MODULES) \
    223 			--error-log-path=/var/log/nginx/error.log \
    224 			--pid-path=/var/run/nginx.pid \
    225 			--lock-path=/var/lock/nginx.lock \
    226 			--http-log-path=/var/log/nginx/access.log \
    227 			--http-client-body-temp-path=/var/lib/nginx/body \
    228 			--http-proxy-temp-path=/var/lib/nginx/proxy \
    229 			--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
    230 			--with-cc="$(TARGET_CC)" \
    231 			--with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
    232 			--with-ld-opt="$(TARGET_LDFLAGS)" \
    233 			--without-http_upstream_zone_module \
    234 	)
    235 endef
    236 
    237 define Package/nginx/install
    238 	$(INSTALL_DIR) $(1)/usr/sbin
    239 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/
    240 	$(INSTALL_DIR) $(1)/etc/nginx
    241 	$(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/
    242 	$(INSTALL_DIR) $(1)/etc/init.d
    243 	$(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx
    244 ifeq ($(CONFIG_NGINX_NAXSI),y)
    245 	$(INSTALL_DIR) $(1)/etc/nginx
    246 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx
    247 	chmod 0640 $(1)/etc/nginx/naxsi_core.rules
    248 endif
    249 	$(if $(CONFIG_NGINX_NAXSI),$($(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx))
    250 	$(if $(CONFIG_NGINX_NAXSI),$(chmod 0640 $(1)/etc/nginx/naxsi_core.rules))
    251 endef
    252 
    253 define Build/Prepare
    254 	$(call Build/Prepare/Default)
    255 	$(if $(CONFIG_NGINX_NAXSI),$(call Prepare/nginx-naxsi))
    256 	$(if $(CONFIG_NGINX_LUA),$(call Prepare/lua-nginx))
    257 endef
    258 
    259 define Download/nginx-naxsi
    260 	VERSION:=cf73f9c8664127252c2a4958d2e169516d3845a1
    261 	SUBDIR:=nginx-naxsi
    262 	FILE:=nginx-naxsi-module-$(PKG_VERSION)-$$(VERSION).tar.gz
    263 	URL:=https://github.com/nbs-system/naxsi.git
    264 	PROTO:=git
    265 endef
    266 
    267 define  Prepare/nginx-naxsi
    268 	$(eval $(call Download,nginx-naxsi))
    269 	gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
    270 endef
    271 
    272 define Download/lua-nginx
    273 	VERSION:=1967998b0eedab1ff51bff8fafa5fc3db47976aa
    274 	SUBDIR:=lua-nginx
    275 	FILE:=lua-nginx-module-$(PKG_VERSION)-$$(VERSION).tar.gz
    276 	URL:=https://github.com/openresty/lua-nginx-module.git
    277 	PROTO:=git
    278 endef
    279 
    280 define  Prepare/lua-nginx
    281 	$(eval $(call Download,lua-nginx))
    282 	gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
    283 	$(call PatchDir,$(PKG_BUILD_DIR),./patches-lua-nginx)
    284 endef
    285 
    286 $(eval $(call BuildPackage,nginx))