1SUMMARY = "HTTP and reverse proxy server" 2 3DESCRIPTION = "Nginx is a web server and a reverse proxy server for \ 4HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high \ 5concurrency, performance and low memory usage." 6 7HOMEPAGE = "http://nginx.org/" 8LICENSE = "BSD-2-Clause" 9 10SECTION = "net" 11 12DEPENDS = "libpcre zlib" 13 14SRC_URI = " \ 15 http://nginx.org/download/nginx-${PV}.tar.gz \ 16 file://nginx-cross.patch \ 17 file://0001-Allow-the-overriding-of-the-endianness-via-the-confi.patch \ 18 file://nginx.conf \ 19 file://default_server.site \ 20 file://proxy_params \ 21 file://nginx.init \ 22 file://nginx-volatile.conf \ 23 file://nginx.service \ 24 file://nginx-fix-pidfile.patch \ 25" 26 27inherit siteinfo update-rc.d useradd systemd 28 29SYSTEMD_SERVICE:${PN} = "nginx.service" 30 31CFLAGS:append = " -fPIE -pie" 32CXXFLAGS:append = " -fPIE -pie" 33 34NGINX_WWWDIR ?= "${localstatedir}/www/localhost" 35NGINX_USER ?= "www" 36 37EXTRA_OECONF = "" 38DISABLE_STATIC = "" 39 40PACKAGECONFIG ??= "ssl" 41 42PACKAGECONFIG[gunzip] = "--with-http_gunzip_module,," 43PACKAGECONFIG[http2] = "--with-http_v2_module,," 44PACKAGECONFIG[ssl] = "--with-http_ssl_module,,openssl" 45PACKAGECONFIG[http-auth-request] = "--with-http_auth_request_module,," 46 47do_configure () { 48 if [ "${SITEINFO_BITS}" = "64" ]; then 49 PTRSIZE=8 50 else 51 PTRSIZE=4 52 fi 53 54 echo $CFLAGS 55 echo $LDFLAGS 56 57 # Add the LDFLAGS to the main nginx link to avoid issues with missing GNU_HASH 58 echo "MAIN_LINK=\"\${MAIN_LINK} ${LDFLAGS}\"" >> auto/cc/conf 59 60 ./configure \ 61 --crossbuild=Linux:${TUNE_ARCH} \ 62 --with-endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ 63 --with-int=4 \ 64 --with-long=${PTRSIZE} \ 65 --with-long-long=8 \ 66 --with-ptr-size=${PTRSIZE} \ 67 --with-sig-atomic-t=${PTRSIZE} \ 68 --with-size-t=${PTRSIZE} \ 69 --with-off-t=8 \ 70 --with-time-t=${PTRSIZE} \ 71 --with-sys-nerr=132 \ 72 --conf-path=${sysconfdir}/nginx/nginx.conf \ 73 --http-log-path=${localstatedir}/log/nginx/access.log \ 74 --error-log-path=${localstatedir}/log/nginx/error.log \ 75 --http-client-body-temp-path=/run/nginx/client_body_temp \ 76 --http-proxy-temp-path=/run/nginx/proxy_temp \ 77 --http-fastcgi-temp-path=/run/nginx/fastcgi_temp \ 78 --http-uwsgi-temp-path=/run/nginx/uwsgi_temp \ 79 --http-scgi-temp-path=/run/nginx/scgi_temp \ 80 --pid-path=/run/nginx/nginx.pid \ 81 --prefix=${prefix} \ 82 --with-threads \ 83 --with-http_gzip_static_module \ 84 ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} 85} 86 87do_install () { 88 oe_runmake 'DESTDIR=${D}' install 89 rm -fr ${D}${localstatedir}/run ${D}/run 90 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then 91 install -d ${D}${sysconfdir}/tmpfiles.d 92 echo "d /run/${BPN} - - - -" \ 93 > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf 94 echo "d ${localstatedir}/log/${BPN} 0755 root root -" \ 95 >> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf 96 fi 97 install -d ${D}${sysconfdir}/${BPN} 98 ln -rs ${D}${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run 99 install -d ${D}${NGINX_WWWDIR} 100 mv ${D}${exec_prefix}/html ${D}${NGINX_WWWDIR}/ 101 chown ${NGINX_USER}:www-data -R ${D}${NGINX_WWWDIR} 102 103 install -d ${D}${sysconfdir}/init.d 104 install -m 0755 ${WORKDIR}/nginx.init ${D}${sysconfdir}/init.d/nginx 105 sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${sysconfdir}/init.d/nginx 106 sed -i 's,/etc/,${sysconfdir}/,g' ${D}${sysconfdir}/init.d/nginx 107 108 install -d ${D}${sysconfdir}/nginx 109 install -m 0644 ${WORKDIR}/nginx.conf ${D}${sysconfdir}/nginx/nginx.conf 110 sed -i 's,/etc/,${sysconfdir}/,g' ${D}${sysconfdir}/nginx/nginx.conf 111 sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/nginx/nginx.conf 112 sed -i 's/^user.*/user ${NGINX_USER};/g' ${D}${sysconfdir}/nginx/nginx.conf 113 install -Dm 0644 ${WORKDIR}/default_server.site ${D}${sysconfdir}/nginx/sites-available/default_server 114 sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/nginx/sites-available/default_server 115 install -d ${D}${sysconfdir}/nginx/sites-enabled 116 ln -s ../sites-available/default_server ${D}${sysconfdir}/nginx/sites-enabled/ 117 118 install -m 0644 ${WORKDIR}/proxy_params ${D}${sysconfdir}/nginx/proxy_params 119 120 install -d ${D}${sysconfdir}/default/volatiles 121 install -m 0644 ${WORKDIR}/nginx-volatile.conf ${D}${sysconfdir}/default/volatiles/99_nginx 122 sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/default/volatiles/99_nginx 123 sed -i 's,@NGINX_USER@,${NGINX_USER},g' ${D}${sysconfdir}/default/volatiles/99_nginx 124 125 # cleanup configuration folder 126 rm ${D}${sysconfdir}/nginx/*.default 127 128 # add additional configuration folders 129 install -d ${D}${sysconfdir}/nginx/modules-available 130 install -d ${D}${sysconfdir}/nginx/modules-enabled 131 install -d ${D}${sysconfdir}/nginx/server-conf.d 132 install -d ${D}${sysconfdir}/nginx/conf.d 133 134 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then 135 install -d ${D}${systemd_unitdir}/system 136 install -m 0644 ${WORKDIR}/nginx.service ${D}${systemd_unitdir}/system/ 137 sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ 138 -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ 139 -e 's,@SBINDIR@,${sbindir},g' \ 140 -e 's,@BASE_BINDIR@,${base_bindir},g' \ 141 ${D}${systemd_unitdir}/system/nginx.service 142 fi 143 144 rm -rf ${D}${localstatedir}/log/ 145} 146 147pkg_postinst:${PN} () { 148 if [ -z "$D" ]; then 149 if type systemd-tmpfiles >/dev/null; then 150 systemd-tmpfiles --create 151 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then 152 ${sysconfdir}/init.d/populate-volatile.sh update 153 fi 154 fi 155} 156 157FILES:${PN} += " \ 158 ${localstatedir}/ \ 159 ${systemd_unitdir}/system/nginx.service \ 160" 161 162CONFFILES:${PN} = " \ 163 ${sysconfdir}/nginx/nginx.conf \ 164 ${sysconfdir}/nginx/fastcgi.conf \ 165 ${sysconfdir}/nginx/fastcgi_params \ 166 ${sysconfdir}/nginx/koi-utf \ 167 ${sysconfdir}/nginx/koi-win \ 168 ${sysconfdir}/nginx/mime.types \ 169 ${sysconfdir}/nginx/scgi_params \ 170 ${sysconfdir}/nginx/uwsgi_params \ 171 ${sysconfdir}/nginx/win-utf \ 172" 173 174INITSCRIPT_NAME = "nginx" 175INITSCRIPT_PARAMS = "defaults 92 20" 176 177USERADD_PACKAGES = "${PN}" 178USERADD_PARAM:${PN} = " \ 179 --system --no-create-home \ 180 --home ${NGINX_WWWDIR} \ 181 --groups www-data \ 182 --user-group ${NGINX_USER}" 183