diff --git a/net/nginx/Makefile b/net/nginx/Makefile new file mode 100644 index 000000000..0b4932611 --- /dev/null +++ b/net/nginx/Makefile @@ -0,0 +1,73 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=nginx +PKG_VERSION:=0.7.61 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://sysoev.ru/nginx/ +PKG_MD5SUM:=6ebf89b9b00a3b82734e93c32da7df07 + +include $(INCLUDE_DIR)/package.mk + +define Package/nginx + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcre +libopenssl + TITLE:=Nginx web server + URL:=http://nginx.net/ +endef + +define Package/nginx/description + Nginx is a free, open-source, high-performance HTTP server + and reverse proxy, as well as an IMAP/POP3 proxy server, + written by Igor Sysoev. +endef + +config_files=nginx.conf mime.types fastcgi_params koi-utf koi-win win-utf + +define Build/Configure + # fix --crossbuild + (cd $(PKG_BUILD_DIR) ;\ + ./configure \ + --crossbuild=Linux::$(ARCH) \ + --prefix=/usr \ + --conf-path=/etc/nginx/nginx.conf \ + --error-log-path=/var/log/nginx/error.log \ + --pid-path=/var/run/nginx.pid \ + --lock-path=/var/lock/nginx.lock \ + --http-log-path=/var/log/nginx/access.log \ + --http-client-body-temp-path=/var/lib/nginx/body \ + --http-proxy-temp-path=/var/lib/nginx/proxy \ + --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ + --with-cc="$(TARGET_CC)" \ + --with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ + --with-ld-opt="$(TARGET_LDFLAGS)" \ + --with-http_stub_status_module \ + --with-http_ssl_module \ + --with-ipv6 ) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR=$(PKG_INSTALL_DIR) \ + build install +endef + +define Package/nginx/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/nginx + $(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx +endef + +$(eval $(call BuildPackage,nginx)) diff --git a/net/nginx/files/nginx.init b/net/nginx/files/nginx.init new file mode 100644 index 000000000..cfda3c87a --- /dev/null +++ b/net/nginx/files/nginx.init @@ -0,0 +1,24 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009 OpenWrt.org + +START=50 +NGINX_BIN=/usr/sbin/nginx + +start() { + mkdir -p /var/log/nginx + mkdir -p /var/lib/nginx + $NGINX_BIN +} + +stop() { + $NGINX_BIN -s stop +} + +reload() { + $NGINX_BIN -s reload +} + +shutdown() { + $NGINX_BIN -s quit +} + diff --git a/net/nginx/patches/001-feature_test_fix b/net/nginx/patches/001-feature_test_fix new file mode 100644 index 000000000..df49e64e5 --- /dev/null +++ b/net/nginx/patches/001-feature_test_fix @@ -0,0 +1,144 @@ +diff --git a/auto/cc/conf b/auto/cc/conf +index 4823900..1e676f4 100644 +--- a/auto/cc/conf ++++ b/auto/cc/conf +@@ -135,7 +135,8 @@ if [ "$NGX_PLATFORM" != win32 ]; then + ngx_feature_test="char buf[30]; buf[0] = '0'; + var(0, buf, \"%d\", 1); + if (buf[0] != '1') return 1" +- . auto/feature ++ #. auto/feature ++ have=$ngx_feature_name . auto/have + + + if [ "$NGX_CC_NAME" = "ccc" ]; then +@@ -151,7 +152,8 @@ if [ "$NGX_PLATFORM" != win32 ]; then + ngx_feature_test="char buf[30]; buf[0] = '0'; + var(0, buf, \"%d\", 1); + if (buf[0] != '1') return 1" +- . auto/feature ++ #. auto/feature ++ have=$ngx_feature_name . auto/have + fi + + +diff --git a/auto/cc/name b/auto/cc/name +index d197fc5..28b74b0 100644 +--- a/auto/cc/name ++++ b/auto/cc/name +@@ -13,12 +13,12 @@ if [ "$NGX_PLATFORM" != win32 ]; then + ngx_feature_test= + . auto/feature + +- if [ $ngx_found = no ]; then +- echo +- echo $0: error: C compiler $CC is not found +- echo +- exit 1 +- fi ++ #if [ $ngx_found = no ]; then ++ # echo ++ # echo $0: error: C compiler $CC is not found ++ # echo ++ # exit 1 ++ #fi + + fi + +diff --git a/auto/os/linux b/auto/os/linux +index 0bd0488..9cb0aa1 100644 +--- a/auto/os/linux ++++ b/auto/os/linux +@@ -49,7 +49,8 @@ ngx_feature_test="int efd = 0, fd = 1, n; + ee.data.ptr = NULL; + efd = epoll_create(100); + if (efd == -1) return 1;" +-. auto/feature ++#. auto/feature ++have=$ngx_feature_name . auto/have + + if [ $ngx_found = yes ]; then + have=NGX_HAVE_CLEAR_EVENT . auto/have +@@ -73,7 +74,8 @@ ngx_feature_test="int s = 0, fd = 1; + ssize_t n; off_t off = 0; + n = sendfile(s, fd, &off, 1); + if (n == -1 && errno == ENOSYS) return 1" +-. auto/feature ++#. auto/feature ++have=$ngx_feature_name . auto/have + + if [ $ngx_found = yes ]; then + CORE_SRCS="$CORE_SRCS $LINUX_SENDFILE_SRCS" +@@ -94,7 +96,8 @@ ngx_feature_test="int s = 0, fd = 1; + ssize_t n; off_t off = 0; + n = sendfile(s, fd, &off, 1); + if (n == -1 && errno == ENOSYS) return 1" +-. auto/feature ++#. auto/feature ++have=$ngx_feature_name . auto/have + + + ngx_include="sys/prctl.h"; . auto/include +@@ -108,7 +111,8 @@ ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs= + ngx_feature_test="if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) return 1" +-. auto/feature ++#. auto/feature ++have=$ngx_feature_name . auto/have + + + # sched_setaffinity() +diff --git a/auto/unix b/auto/unix +index 687a23a..23e8b78 100755 +--- a/auto/unix ++++ b/auto/unix +@@ -117,7 +117,7 @@ ngx_feature_path= + ngx_feature_libs= + ngx_feature_test="char buf[1024]; long n; n = strerror_r(1, buf, 1024); + if (n < 0 || n > 1024) return 1;" +-. auto/feature ++#. auto/feature + + + # GNU style strerror_r() returns not length, but pointer +@@ -130,7 +130,8 @@ ngx_feature_path= + ngx_feature_libs= + ngx_feature_test="char buf[1024]; long n; n = strerror_r(1, buf, 1024); + if (n >= 0 && n < 1024) return 1;" +-. auto/feature ++#. auto/feature ++have=$ngx_feature_name . auto/have + + + ngx_feature="localtime_r()" +@@ -173,7 +174,8 @@ ngx_feature_test="void *p; + p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_SHARED, -1, 0); + if (p == MAP_FAILED) return 1;" +-. auto/feature ++#. auto/feature ++have=$ngx_feature_name . auto/have + + + ngx_feature='mmap("/dev/zero", MAP_SHARED)' +@@ -188,7 +190,8 @@ ngx_feature_test='void *p; int fd; + fd = open("/dev/zero", O_RDWR); + p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + if (p == MAP_FAILED) return 1;' +-. auto/feature ++#. auto/feature ++have=$ngx_feature_name . auto/have + + + ngx_feature="System V shared memory" +@@ -202,7 +205,8 @@ ngx_feature_test="int id; + id = shmget(IPC_PRIVATE, 4096, (SHM_R|SHM_W|IPC_CREAT)); + if (id == -1) return 1; + shmctl(id, IPC_RMID, NULL);" +-. auto/feature ++#. auto/feature ++have=$ngx_feature_name . auto/have + + + ngx_feature="struct msghdr.msg_control" diff --git a/net/nginx/patches/002-sizeof_test_fix b/net/nginx/patches/002-sizeof_test_fix new file mode 100644 index 000000000..b85caee93 --- /dev/null +++ b/net/nginx/patches/002-sizeof_test_fix @@ -0,0 +1,28 @@ +diff --git a/auto/types/sizeof b/auto/types/sizeof +index 4d65dca..2d5da3e 100644 +--- a/auto/types/sizeof ++++ b/auto/types/sizeof +@@ -23,8 +23,13 @@ $NGX_INCLUDE_UNISTD_H + $NGX_INCLUDE_INTTYPES_H + $NGX_INCLUDE_AUTO_CONFIG_H + ++char object_code_block[] = { ++ '\n', 'e', '4', 'V', 'A', ++ '0', 'x', ('0' + sizeof($ngx_type)), ++ 'Y', '3', 'p', 'M', '\n' ++}; ++ + int main() { +- printf("%d", sizeof($ngx_type)); + return 0; + } + +@@ -38,7 +43,7 @@ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1" + + + if [ -x $NGX_AUTOTEST ]; then +- ngx_size=`$NGX_AUTOTEST` ++ ngx_size=`sed -ne 's/^e4VA0x\(.\)Y3pM$/\1/p' < $NGX_AUTOTEST` + echo " $ngx_size bytes" + fi +