[149166] trunk/dports/www/nginx

mps at macports.org mps at macports.org
Fri Jun 3 09:54:15 PDT 2016


Revision: 149166
          https://trac.macports.org/changeset/149166
Author:   mps at macports.org
Date:     2016-06-03 09:54:15 -0700 (Fri, 03 Jun 2016)
Log Message:
-----------
nginx: fix rtmp module build issue.

Modified Paths:
--------------
    trunk/dports/www/nginx/Portfile

Added Paths:
-----------
    trunk/dports/www/nginx/files/patch-ngx_rtmp_core_module.c.diff

Modified: trunk/dports/www/nginx/Portfile
===================================================================
--- trunk/dports/www/nginx/Portfile	2016-06-03 16:07:00 UTC (rev 149165)
+++ trunk/dports/www/nginx/Portfile	2016-06-03 16:54:15 UTC (rev 149166)
@@ -53,6 +53,7 @@
 set auto_activate_confs {nginx.conf mime.types fastcgi.conf}
 
 # portfile-scoped vars for variant routines to re-def and use in port-stages (post-extract, pre-patch, etc)
+set nginx_rtmp_mod_dirname     ""
 set nginx_upload_mod_dirname   ""
 
 # for aforementioned re-defs of portfile-scoped vars in variant routines
@@ -256,7 +257,7 @@
     patchfiles-append       patch-nginx_upload_module.tmp-ngx_http_upload_module.c.diff
 
 
-    nginx_set_portfile_var   nginx_upload_mod_dirname    "${upload_distname}"
+    nginx_set_portfile_var  nginx_upload_mod_dirname    "${upload_distname}"
 
     pre-fetch {
         ui_error "The +upload variant is currently broken, because the upload module is not compatible with nginx 1.9.0."
@@ -319,6 +320,17 @@
                             rmd160  3b7510fba6f6e572f0fb0b3676fe1eb4d4caecb1 \
                             sha256  7922b0e3d5f3d9c4b275e4908cfb8f5fb1bfb3ac2df77f4c262cda56df21aab3
     configure.args-append   --add-module=${workpath}/${rtmp_distname}
+    patchfiles-append       patch-ngx_rtmp_core_module.c.diff
+
+    nginx_set_portfile_var  nginx_rtmp_mod_dirname    "${rtmp_distname}"
+
+    # patch routine balks on file names with "../", but rel-paths in patchfiles start from $worksrcpath
+    pre-patch {
+        ln -s   "${workpath}/${nginx_rtmp_mod_dirname}" "${worksrcpath}/nginx_rtmp_module.tmp"
+    }
+    post-patch {
+        file delete   "${worksrcpath}/nginx_rtmp_module.tmp"
+    }
 }
 
 variant http_push description {Enable Ngx HTTP Push module (https://github.com/slact/nchan)} {

Added: trunk/dports/www/nginx/files/patch-ngx_rtmp_core_module.c.diff
===================================================================
--- trunk/dports/www/nginx/files/patch-ngx_rtmp_core_module.c.diff	                        (rev 0)
+++ trunk/dports/www/nginx/files/patch-ngx_rtmp_core_module.c.diff	2016-06-03 16:54:15 UTC (rev 149166)
@@ -0,0 +1,129 @@
+--- nginx_rtmp_module.tmp/ngx_rtmp_core_module.c.orig	2015-03-23 14:30:37.000000000 -0500
++++ nginx_rtmp_module.tmp/ngx_rtmp_core_module.c	2016-06-03 11:27:21.000000000 -0500
+@@ -332,6 +332,7 @@
+     void                       *mconf;
+     ngx_uint_t                  m;
+     ngx_conf_t                  pcf;
++    ngx_module_t              **modules;
+     ngx_rtmp_module_t          *module;
+     ngx_rtmp_conf_ctx_t        *ctx, *rtmp_ctx;
+     ngx_rtmp_core_srv_conf_t   *cscf, **cscfp;
+@@ -357,12 +358,17 @@
+         return NGX_CONF_ERROR;
+     }
+ 
+-    for (m = 0; ngx_modules[m]; m++) {
+-        if (ngx_modules[m]->type != NGX_RTMP_MODULE) {
++#if defined(nginx_version) && nginx_version >= 1009011
++    modules = cf->cycle->modules;
++#else
++    modules = ngx_modules;
++#endif
++    for (m = 0; modules[m]; m++) {
++        if (modules[m]->type != NGX_RTMP_MODULE) {
+             continue;
+         }
+ 
+-        module = ngx_modules[m]->ctx;
++        module = modules[m]->ctx;
+ 
+         if (module->create_srv_conf) {
+             mconf = module->create_srv_conf(cf);
+@@ -370,7 +376,7 @@
+                 return NGX_CONF_ERROR;
+             }
+ 
+-            ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
++            ctx->srv_conf[modules[m]->ctx_index] = mconf;
+         }
+ 
+         if (module->create_app_conf) {
+@@ -379,7 +385,7 @@
+                 return NGX_CONF_ERROR;
+             }
+ 
+-            ctx->app_conf[ngx_modules[m]->ctx_index] = mconf;
++            ctx->app_conf[modules[m]->ctx_index] = mconf;
+         }
+     }
+ 
+@@ -419,6 +425,7 @@
+     ngx_int_t                   i;
+     ngx_str_t                  *value;
+     ngx_conf_t                  save;
++    ngx_module_t              **modules;
+     ngx_rtmp_module_t          *module;
+     ngx_rtmp_conf_ctx_t        *ctx, *pctx;
+     ngx_rtmp_core_srv_conf_t   *cscf;
+@@ -438,17 +445,22 @@
+         return NGX_CONF_ERROR;
+     }
+ 
+-    for (i = 0; ngx_modules[i]; i++) {
+-        if (ngx_modules[i]->type != NGX_RTMP_MODULE) {
++#if defined(nginx_version) && nginx_version >= 1009011
++    modules = cf->cycle->modules;
++#else
++    modules = ngx_modules;
++#endif
++    for (i = 0; modules[i]; i++) {
++        if (modules[i]->type != NGX_RTMP_MODULE) {
+             continue;
+         }
+ 
+-        module = ngx_modules[i]->ctx;
++        module = modules[i]->ctx;
+ 
+         if (module->create_app_conf) {
+-            ctx->app_conf[ngx_modules[i]->ctx_index] =
++            ctx->app_conf[modules[i]->ctx_index] =
+                                 module->create_app_conf(cf);
+-            if (ctx->app_conf[ngx_modules[i]->ctx_index] == NULL) {
++            if (ctx->app_conf[modules[i]->ctx_index] == NULL) {
+                 return NGX_CONF_ERROR;
+             }
+         }
+@@ -488,7 +500,7 @@
+     in_port_t                   port;
+     ngx_str_t                  *value;
+     ngx_url_t                   u;
+-    ngx_uint_t                  i, m;
++    ngx_uint_t                  i;
+     struct sockaddr            *sa;
+     ngx_rtmp_listen_t          *ls;
+     struct sockaddr_in         *sin;
+@@ -545,7 +557,11 @@
+             break;
+         }
+ 
++#if (nginx_version >= 1011000)
++        if (ngx_memcmp(ls[i].sockaddr + off, &u.sockaddr + off, len) != 0) {
++#else
+         if (ngx_memcmp(ls[i].sockaddr + off, u.sockaddr + off, len) != 0) {
++#endif
+             continue;
+         }
+ 
+@@ -565,18 +581,16 @@
+ 
+     ngx_memzero(ls, sizeof(ngx_rtmp_listen_t));
+ 
++#if (nginx_version >= 1011000)
++    ngx_memcpy(ls->sockaddr, &u.sockaddr, u.socklen);
++#else
+     ngx_memcpy(ls->sockaddr, u.sockaddr, u.socklen);
++#endif
+ 
+     ls->socklen = u.socklen;
+     ls->wildcard = u.wildcard;
+     ls->ctx = cf->ctx;
+ 
+-    for (m = 0; ngx_modules[m]; m++) {
+-        if (ngx_modules[m]->type != NGX_RTMP_MODULE) {
+-            continue;
+-        }
+-    }
+-
+     for (i = 2; i < cf->args->nelts; i++) {
+ 
+         if (ngx_strcmp(value[i].data, "bind") == 0) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160603/19d271dc/attachment-0001.html>


More information about the macports-changes mailing list