diff options
| -rw-r--r-- | meta-webserver/recipes-httpd/nginx/nginx.inc | 137 | ||||
| -rw-r--r-- | meta-webserver/recipes-httpd/nginx/nginx_1.9.12.bb | 135 |
2 files changed, 138 insertions, 134 deletions
diff --git a/meta-webserver/recipes-httpd/nginx/nginx.inc b/meta-webserver/recipes-httpd/nginx/nginx.inc new file mode 100644 index 0000000000..53e32352d0 --- /dev/null +++ b/meta-webserver/recipes-httpd/nginx/nginx.inc | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | SUMMARY = "HTTP and reverse proxy server" | ||
| 2 | |||
| 3 | DESCRIPTION = "Nginx is a web server and a reverse proxy server for \ | ||
| 4 | HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high \ | ||
| 5 | concurrency, performance and low memory usage." | ||
| 6 | |||
| 7 | HOMEPAGE = "http://nginx.org/" | ||
| 8 | LICENSE = "BSD-2-Clause" | ||
| 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=0bb58ed0dfd4f5dbece3b52aba79f023" | ||
| 10 | SECTION = "net" | ||
| 11 | |||
| 12 | DEPENDS = "libpcre gzip openssl" | ||
| 13 | |||
| 14 | SRC_URI = " \ | ||
| 15 | http://nginx.org/download/nginx-${PV}.tar.gz \ | ||
| 16 | file://nginx-cross.patch \ | ||
| 17 | file://nginx.conf \ | ||
| 18 | file://nginx.init \ | ||
| 19 | file://nginx-volatile.conf \ | ||
| 20 | file://nginx.service \ | ||
| 21 | " | ||
| 22 | |||
| 23 | inherit update-rc.d useradd | ||
| 24 | |||
| 25 | CFLAGS_append = " -fPIE -pie" | ||
| 26 | CXXFLAGS_append = " -fPIE -pie" | ||
| 27 | |||
| 28 | NGINX_WWWDIR ?= "${localstatedir}/www/localhost" | ||
| 29 | NGINX_USER ?= "www" | ||
| 30 | |||
| 31 | EXTRA_OECONF = "" | ||
| 32 | DISABLE_STATIC = "" | ||
| 33 | |||
| 34 | do_configure () { | ||
| 35 | if [ "${SITEINFO_BITS}" = "64" ]; then | ||
| 36 | PTRSIZE=8 | ||
| 37 | else | ||
| 38 | PTRSIZE=4 | ||
| 39 | fi | ||
| 40 | |||
| 41 | echo $CFLAGS | ||
| 42 | echo $LDFLAGS | ||
| 43 | |||
| 44 | ./configure \ | ||
| 45 | --crossbuild=Linux:${TUNE_ARCH} \ | ||
| 46 | --with-endian=${@base_conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ | ||
| 47 | --with-int=4 \ | ||
| 48 | --with-long=${PTRSIZE} \ | ||
| 49 | --with-long-long=8 \ | ||
| 50 | --with-ptr-size=${PTRSIZE} \ | ||
| 51 | --with-sig-atomic-t=${PTRSIZE} \ | ||
| 52 | --with-size-t=${PTRSIZE} \ | ||
| 53 | --with-off-t=${PTRSIZE} \ | ||
| 54 | --with-time-t=${PTRSIZE} \ | ||
| 55 | --with-sys-nerr=132 \ | ||
| 56 | --conf-path=${sysconfdir}/nginx/nginx.conf \ | ||
| 57 | --http-log-path=${localstatedir}/log/nginx/access.log \ | ||
| 58 | --error-log-path=${localstatedir}/log/nginx/error.log \ | ||
| 59 | --pid-path=/run/nginx/nginx.pid \ | ||
| 60 | --prefix=${prefix} \ | ||
| 61 | --with-http_ssl_module \ | ||
| 62 | --with-http_gzip_static_module \ | ||
| 63 | ${EXTRA_OECONF} | ||
| 64 | } | ||
| 65 | |||
| 66 | do_install () { | ||
| 67 | oe_runmake 'DESTDIR=${D}' install | ||
| 68 | rm -fr ${D}${localstatedir}/run ${D}/run | ||
| 69 | if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
| 70 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
| 71 | echo "d /run/${BPN} - - - -" \ | ||
| 72 | > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf | ||
| 73 | fi | ||
| 74 | install -d ${D}${sysconfdir}/${BPN} | ||
| 75 | ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run | ||
| 76 | install -d ${D}${NGINX_WWWDIR} | ||
| 77 | mv ${D}/usr/html ${D}${NGINX_WWWDIR}/ | ||
| 78 | chown ${NGINX_USER}:www-data -R ${D}${NGINX_WWWDIR} | ||
| 79 | |||
| 80 | install -d ${D}${sysconfdir}/init.d | ||
| 81 | install -m 0755 ${WORKDIR}/nginx.init ${D}${sysconfdir}/init.d/nginx | ||
| 82 | sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${sysconfdir}/init.d/nginx | ||
| 83 | sed -i 's,/etc/,${sysconfdir}/,g' ${D}${sysconfdir}/init.d/nginx | ||
| 84 | |||
| 85 | install -d ${D}${sysconfdir}/nginx | ||
| 86 | install -m 0644 ${WORKDIR}/nginx.conf ${D}${sysconfdir}/nginx/nginx.conf | ||
| 87 | sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/nginx/nginx.conf | ||
| 88 | install -d ${D}${sysconfdir}/nginx/sites-enabled | ||
| 89 | |||
| 90 | install -d ${D}${sysconfdir}/default/volatiles | ||
| 91 | install -m 0644 ${WORKDIR}/nginx-volatile.conf ${D}${sysconfdir}/default/volatiles/99_nginx | ||
| 92 | sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/default/volatiles/99_nginx | ||
| 93 | |||
| 94 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then | ||
| 95 | install -d ${D}${systemd_unitdir}/system | ||
| 96 | install -m 0644 ${WORKDIR}/nginx.service ${D}${systemd_unitdir}/system/ | ||
| 97 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | ||
| 98 | -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ | ||
| 99 | -e 's,@BASEBINDIR@,${base_bindir},g' \ | ||
| 100 | ${D}${systemd_unitdir}/system/nginx.service | ||
| 101 | fi | ||
| 102 | } | ||
| 103 | |||
| 104 | pkg_postinst_${PN} () { | ||
| 105 | if [ -z "$D" ]; then | ||
| 106 | if type systemd-tmpfiles >/dev/null; then | ||
| 107 | systemd-tmpfiles --create | ||
| 108 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then | ||
| 109 | ${sysconfdir}/init.d/populate-volatile.sh update | ||
| 110 | fi | ||
| 111 | fi | ||
| 112 | } | ||
| 113 | |||
| 114 | FILES_${PN} += "${localstatedir}/ \ | ||
| 115 | ${systemd_unitdir}/system/nginx.service \ | ||
| 116 | " | ||
| 117 | |||
| 118 | CONFFILES_${PN} = "${sysconfdir}/nginx/nginx.conf \ | ||
| 119 | ${sysconfdir}/nginx/fastcgi.conf\ | ||
| 120 | ${sysconfdir}/nginx/fastcgi_params \ | ||
| 121 | ${sysconfdir}/nginx/koi-utf \ | ||
| 122 | ${sysconfdir}/nginx/koi-win \ | ||
| 123 | ${sysconfdir}/nginx/mime.types \ | ||
| 124 | ${sysconfdir}/nginx/scgi_params \ | ||
| 125 | ${sysconfdir}/nginx/uwsgi_params \ | ||
| 126 | ${sysconfdir}/nginx/win-utf \ | ||
| 127 | " | ||
| 128 | |||
| 129 | INITSCRIPT_NAME = "nginx" | ||
| 130 | INITSCRIPT_PARAMS = "defaults 92 20" | ||
| 131 | |||
| 132 | USERADD_PACKAGES = "${PN}" | ||
| 133 | USERADD_PARAM_${PN} = " \ | ||
| 134 | --system --no-create-home \ | ||
| 135 | --home ${NGINX_WWWDIR} \ | ||
| 136 | --groups www-data \ | ||
| 137 | --user-group ${NGINX_USER}" | ||
diff --git a/meta-webserver/recipes-httpd/nginx/nginx_1.9.12.bb b/meta-webserver/recipes-httpd/nginx/nginx_1.9.12.bb index d18f82b617..821a28c9f4 100644 --- a/meta-webserver/recipes-httpd/nginx/nginx_1.9.12.bb +++ b/meta-webserver/recipes-httpd/nginx/nginx_1.9.12.bb | |||
| @@ -1,139 +1,6 @@ | |||
| 1 | SUMMARY = "HTTP and reverse proxy server" | 1 | require nginx.inc |
| 2 | 2 | ||
| 3 | DESCRIPTION = "Nginx is a web server and a reverse proxy server for \ | ||
| 4 | HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high \ | ||
| 5 | concurrency, performance and low memory usage." | ||
| 6 | |||
| 7 | HOMEPAGE = "http://nginx.org/" | ||
| 8 | LICENSE = "BSD-2-Clause" | ||
| 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=0bb58ed0dfd4f5dbece3b52aba79f023" | ||
| 10 | SECTION = "net" | ||
| 11 | |||
| 12 | DEPENDS = "libpcre gzip openssl" | ||
| 13 | |||
| 14 | SRC_URI = " \ | ||
| 15 | http://nginx.org/download/nginx-${PV}.tar.gz \ | ||
| 16 | file://nginx-cross.patch \ | ||
| 17 | file://nginx.conf \ | ||
| 18 | file://nginx.init \ | ||
| 19 | file://nginx-volatile.conf \ | ||
| 20 | file://nginx.service \ | ||
| 21 | " | ||
| 22 | SRC_URI[md5sum] = "0afe4a7e589a0de43b7b54aa055a4351" | 3 | SRC_URI[md5sum] = "0afe4a7e589a0de43b7b54aa055a4351" |
| 23 | SRC_URI[sha256sum] = "1af2eb956910ed4b11aaf525a81bc37e135907e7127948f9179f5410337da042" | 4 | SRC_URI[sha256sum] = "1af2eb956910ed4b11aaf525a81bc37e135907e7127948f9179f5410337da042" |
| 24 | 5 | ||
| 25 | inherit update-rc.d useradd | ||
| 26 | |||
| 27 | CFLAGS_append = " -fPIE -pie" | ||
| 28 | CXXFLAGS_append = " -fPIE -pie" | ||
| 29 | |||
| 30 | NGINX_WWWDIR ?= "${localstatedir}/www/localhost" | ||
| 31 | NGINX_USER ?= "www" | ||
| 32 | |||
| 33 | EXTRA_OECONF = "" | ||
| 34 | DISABLE_STATIC = "" | 6 | DISABLE_STATIC = "" |
| 35 | |||
| 36 | do_configure () { | ||
| 37 | if [ "${SITEINFO_BITS}" = "64" ]; then | ||
| 38 | PTRSIZE=8 | ||
| 39 | else | ||
| 40 | PTRSIZE=4 | ||
| 41 | fi | ||
| 42 | |||
| 43 | echo $CFLAGS | ||
| 44 | echo $LDFLAGS | ||
| 45 | |||
| 46 | ./configure \ | ||
| 47 | --crossbuild=Linux:${TUNE_ARCH} \ | ||
| 48 | --with-endian=${@base_conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ | ||
| 49 | --with-int=4 \ | ||
| 50 | --with-long=${PTRSIZE} \ | ||
| 51 | --with-long-long=8 \ | ||
| 52 | --with-ptr-size=${PTRSIZE} \ | ||
| 53 | --with-sig-atomic-t=${PTRSIZE} \ | ||
| 54 | --with-size-t=${PTRSIZE} \ | ||
| 55 | --with-off-t=${PTRSIZE} \ | ||
| 56 | --with-time-t=${PTRSIZE} \ | ||
| 57 | --with-sys-nerr=132 \ | ||
| 58 | --conf-path=${sysconfdir}/nginx/nginx.conf \ | ||
| 59 | --http-log-path=${localstatedir}/log/nginx/access.log \ | ||
| 60 | --error-log-path=${localstatedir}/log/nginx/error.log \ | ||
| 61 | --pid-path=/run/nginx/nginx.pid \ | ||
| 62 | --prefix=${prefix} \ | ||
| 63 | --with-http_ssl_module \ | ||
| 64 | --with-http_gzip_static_module \ | ||
| 65 | ${EXTRA_OECONF} | ||
| 66 | } | ||
| 67 | |||
| 68 | do_install () { | ||
| 69 | oe_runmake 'DESTDIR=${D}' install | ||
| 70 | rm -fr ${D}${localstatedir}/run ${D}/run | ||
| 71 | if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
| 72 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
| 73 | echo "d /run/${BPN} - - - -" \ | ||
| 74 | > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf | ||
| 75 | fi | ||
| 76 | install -d ${D}${sysconfdir}/${BPN} | ||
| 77 | ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run | ||
| 78 | install -d ${D}${NGINX_WWWDIR} | ||
| 79 | mv ${D}/usr/html ${D}${NGINX_WWWDIR}/ | ||
| 80 | chown ${NGINX_USER}:www-data -R ${D}${NGINX_WWWDIR} | ||
| 81 | |||
| 82 | install -d ${D}${sysconfdir}/init.d | ||
| 83 | install -m 0755 ${WORKDIR}/nginx.init ${D}${sysconfdir}/init.d/nginx | ||
| 84 | sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${sysconfdir}/init.d/nginx | ||
| 85 | sed -i 's,/etc/,${sysconfdir}/,g' ${D}${sysconfdir}/init.d/nginx | ||
| 86 | |||
| 87 | install -d ${D}${sysconfdir}/nginx | ||
| 88 | install -m 0644 ${WORKDIR}/nginx.conf ${D}${sysconfdir}/nginx/nginx.conf | ||
| 89 | sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/nginx/nginx.conf | ||
| 90 | install -d ${D}${sysconfdir}/nginx/sites-enabled | ||
| 91 | |||
| 92 | install -d ${D}${sysconfdir}/default/volatiles | ||
| 93 | install -m 0644 ${WORKDIR}/nginx-volatile.conf ${D}${sysconfdir}/default/volatiles/99_nginx | ||
| 94 | sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/default/volatiles/99_nginx | ||
| 95 | |||
| 96 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then | ||
| 97 | install -d ${D}${systemd_unitdir}/system | ||
| 98 | install -m 0644 ${WORKDIR}/nginx.service ${D}${systemd_unitdir}/system/ | ||
| 99 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | ||
| 100 | -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ | ||
| 101 | -e 's,@BASEBINDIR@,${base_bindir},g' \ | ||
| 102 | ${D}${systemd_unitdir}/system/nginx.service | ||
| 103 | fi | ||
| 104 | } | ||
| 105 | |||
| 106 | pkg_postinst_${PN} () { | ||
| 107 | if [ -z "$D" ]; then | ||
| 108 | if type systemd-tmpfiles >/dev/null; then | ||
| 109 | systemd-tmpfiles --create | ||
| 110 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then | ||
| 111 | ${sysconfdir}/init.d/populate-volatile.sh update | ||
| 112 | fi | ||
| 113 | fi | ||
| 114 | } | ||
| 115 | |||
| 116 | FILES_${PN} += "${localstatedir}/ \ | ||
| 117 | ${systemd_unitdir}/system/nginx.service \ | ||
| 118 | " | ||
| 119 | |||
| 120 | CONFFILES_${PN} = "${sysconfdir}/nginx/nginx.conf \ | ||
| 121 | ${sysconfdir}/nginx/fastcgi.conf\ | ||
| 122 | ${sysconfdir}/nginx/fastcgi_params \ | ||
| 123 | ${sysconfdir}/nginx/koi-utf \ | ||
| 124 | ${sysconfdir}/nginx/koi-win \ | ||
| 125 | ${sysconfdir}/nginx/mime.types \ | ||
| 126 | ${sysconfdir}/nginx/scgi_params \ | ||
| 127 | ${sysconfdir}/nginx/uwsgi_params \ | ||
| 128 | ${sysconfdir}/nginx/win-utf \ | ||
| 129 | " | ||
| 130 | |||
| 131 | INITSCRIPT_NAME = "nginx" | ||
| 132 | INITSCRIPT_PARAMS = "defaults 92 20" | ||
| 133 | |||
| 134 | USERADD_PACKAGES = "${PN}" | ||
| 135 | USERADD_PARAM_${PN} = " \ | ||
| 136 | --system --no-create-home \ | ||
| 137 | --home ${NGINX_WWWDIR} \ | ||
| 138 | --groups www-data \ | ||
| 139 | --user-group ${NGINX_USER}" | ||
