changeset 95:4fb07ef1f4b4

FIX: Allow to compile the uwsgi.h header with cffi. Replace `#include <pcre.h>' with `#include "/usr/local/include/pcre.h"`. It seems that the cffi-related C compiler does not search for include files in "/usr/local/include" on FreeBSD.
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 17 Jun 2020 22:04:54 +0200
parents 0ce5411a47ef
children 73e2dc29ce8d
files uwsginl-plugin-lang-pypy3/files/extra/patch-plugins_pypy_pypy__setup.py
diffstat 1 files changed, 24 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/uwsginl-plugin-lang-pypy3/files/extra/patch-plugins_pypy_pypy__setup.py	Wed Jun 17 00:32:49 2020 +0200
+++ b/uwsginl-plugin-lang-pypy3/files/extra/patch-plugins_pypy_pypy__setup.py	Wed Jun 17 22:04:54 2020 +0200
@@ -1,5 +1,5 @@
---- plugins/pypy/pypy_setup.py.orig	2020-06-16 22:35:02.597340000 +0200
-+++ plugins/pypy/pypy_setup.py	2020-06-16 23:41:10.094554000 +0200
+--- plugins/pypy/pypy_setup.py.orig	2020-06-14 11:50:00.000000000 +0200
++++ plugins/pypy/pypy_setup.py	2020-06-17 21:51:53.458217000 +0200
 @@ -33,6 +33,12 @@
  extern void (*uwsgi_pypy_post_fork_hook)(void);
  '''
@@ -22,16 +22,23 @@
  for cflag in uwsgi_cflags:
      if cflag.startswith('-D'):
          line = cflag[2:]
-@@ -271,7 +277,7 @@
- extern struct uwsgi_server uwsgi;
- extern struct uwsgi_plugin pypy_plugin;
+@@ -57,8 +63,14 @@
+         else:
+             uwsgi_cdef.append('#define %s ...' % line)
+             uwsgi_defines.append('#define %s 1' % line)
+-uwsgi_dot_h = ffi.string(lib0.uwsgi_get_dot_h())
++uwsgi_dot_h = n(ffi.string(lib0.uwsgi_get_dot_h()))
+ 
++#
++# Replace #include <pcre.h> on FreeBSD because it is found on a non-standard
++# location for cffi.
++#
++uwsgi_dot_h = uwsgi_dot_h.replace('#include <pcre.h>', '#include "/usr/local/include/pcre.h"')
++
+ # uwsgi definitions
+ cdefines = '''
  %s
--''' % ('\n'.join(uwsgi_defines), uwsgi_dot_h, hooks)
-+''' % ('\n'.join(uwsgi_defines), n(uwsgi_dot_h), hooks)
- 
- ffi.cdef(cdefines)
- lib = ffi.verify(cverify)
-@@ -286,7 +292,7 @@
+@@ -286,7 +298,7 @@
  
  # fix argv if needed
  if len(sys.argv) == 0:
@@ -40,7 +47,7 @@
  
  
  @ffi.callback("void(char *)")
-@@ -305,7 +311,7 @@
+@@ -305,7 +317,7 @@
      load a wsgi module
      """
      global wsgi_application
@@ -49,7 +56,7 @@
      c = 'application'
      if ':' in m:
          m, c = m.split(':')
-@@ -322,7 +328,7 @@
+@@ -322,7 +334,7 @@
      load a mod_wsgi compliant .wsgi file
      """
      global wsgi_application
@@ -58,7 +65,7 @@
      c = 'application'
      mod = imp.load_source('uwsgi_file_wsgi', w)
      wsgi_application = getattr(mod, c)
-@@ -334,7 +340,7 @@
+@@ -334,7 +346,7 @@
      load a .ini paste app
      """
      global wsgi_application
@@ -67,7 +74,7 @@
      if c.startswith('config:'):
          c = c[7:]
      if c[0] != '/':
-@@ -363,7 +369,7 @@
+@@ -363,7 +375,7 @@
      """
      add an item to the pythonpath
      """
@@ -76,7 +83,7 @@
      sys.path.append(path)
      print("added %s to pythonpath" % path)
  
-@@ -470,15 +476,17 @@
+@@ -470,15 +482,17 @@
      def start_response(status, headers, exc_info=None):
          if exc_info:
              traceback.print_exception(*exc_info)
@@ -95,7 +102,7 @@
  
      environ['wsgi.version'] = (1, 0)
      scheme = 'http'
-@@ -598,8 +606,8 @@
+@@ -598,8 +612,8 @@
  
  def uwsgi_pypy_call(func, *args):
      node = None