Author: Matti Picus <matti.pi...@gmail.com>
Branch: 
Changeset: r97427:849070e3fadb
Date: 2019-09-11 08:43 +0300
http://bitbucket.org/pypy/pypy/changeset/849070e3fadb/

Log:    merge openssl-for-macos which updates _ssl to openssl-1.1.1c and
        binds statically

        also always rebuild cffi modules when packaging

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -70,3 +70,7 @@
 .. branch: compile_ncurses_tcl_tk_suse_latest
 
 Check for headers and runtime libraries in more locations to support other 
linuxes
+
+.. branch: openssl-for-macos
+
+Update _ssl on macos to statically link to openssl-1.1.1c
\ No newline at end of file
diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -351,7 +351,7 @@
             ''' Use cffi to compile cffi interfaces to modules'''
             filename = os.path.join(pypydir, 'tool', 'build_cffi_imports.py')
             status, out, err = run_subprocess(str(driver.compute_exe_name()),
-                                              [filename])
+                                              [filename, 
'--embed-dependencies'])
             sys.stdout.write(out)
             sys.stderr.write(err)
             # otherwise, ignore errors
diff --git a/pypy/tool/build_cffi_imports.py b/pypy/tool/build_cffi_imports.py
--- a/pypy/tool/build_cffi_imports.py
+++ b/pypy/tool/build_cffi_imports.py
@@ -22,9 +22,9 @@
 # for distribution, we may want to fetch dependencies not provided by
 # the OS, such as a recent openssl/libressl.
 cffi_dependencies = {
-    '_ssl': 
('http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.6.2.tar.gz',
-            'b029d2492b72a9ba5b5fcd9f3d602c9fd0baa087912f2aaecc28f52f567ec478',
-            ['--without-openssldir']),
+    '_ssl': ('https://www.openssl.org/source/openssl-1.1.1c.tar.gz',
+            'f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90',
+            ['no-shared']),
     '_gdbm': ('http://ftp.gnu.org/gnu/gdbm/gdbm-1.13.tar.gz',
               
'9d252cbd7d793f7b12bcceaddda98d257c14f4d1890d851c386c37207000a253',
               ['--without-readline']),
@@ -106,12 +106,9 @@
 
     # configure & build it
     status, stdout, stderr = run_subprocess(
-        './configure',
+        './config',
         [
             '--prefix=/usr',
-            '--disable-shared',
-            '--enable-silent-rules',
-            '--disable-dependency-tracking',
         ] + args,
         cwd=sources,
     )
@@ -125,16 +122,25 @@
         'make',
         [
             '-s', '-j' + str(multiprocessing.cpu_count()),
+        ],
+        cwd=sources,
+    )
+    if status != 0:
+        return status, stdout, stderr
+
+    print('installing to', destdir, file=sys.stderr)
+    status, stdout, stderr = run_subprocess(
+        'make',
+        [
             'install', 'DESTDIR={}/'.format(destdir),
         ],
         cwd=sources,
     )
-
     return status, stdout, stderr
 
 
 def create_cffi_import_libraries(pypy_c, options, basedir, only=None,
-                                 embed_dependencies=False):
+                                 embed_dependencies=False, rebuild=False):
     from rpython.tool.runsubprocess import run_subprocess
 
     shutil.rmtree(str(join(basedir,'lib_pypy','__pycache__')),
@@ -153,12 +159,13 @@
             continue
         if module is None or getattr(options, 'no_' + key, False):
             continue
-        # the key is the module name, has it already been built?
-        status, stdout, stderr = run_subprocess(str(pypy_c), ['-c', 'import 
%s' % key])
-        if status  == 0:
-            print('*', ' %s already built' % key, file=sys.stderr)
-            continue
-        
+        if not rebuild:
+            # the key is the module name, has it already been built?
+            status, stdout, stderr = run_subprocess(str(pypy_c), ['-c', 
'import %s' % key])
+            if status  == 0:
+                print('*', ' %s already built' % key, file=sys.stderr)
+                continue
+
         if module.endswith('.py'):
             args = [module]
             cwd = str(join(basedir,'lib_pypy'))
@@ -175,18 +182,7 @@
             shutil.rmtree(destdir, ignore_errors=True)
             os.makedirs(destdir)
 
-            if key == '_ssl' and sys.platform == 'darwin':
-                # this patch is loosely inspired by an Apple and adds
-                # a fallback to the OS X roots when none are available
-                patches = [
-                    os.path.join(curdir,
-                                 '../../lib_pypy/_cffi_ssl/osx-roots.diff'),
-                ]
-            else:
-                patches = []
-
-            status, stdout, stderr = _build_dependency(key, destdir,
-                                                       patches=patches)
+            status, stdout, stderr = _build_dependency(key, destdir)
 
             if status != 0:
                 failures.append((key, module))
@@ -200,10 +196,6 @@
                 '-I{}/usr/include {}'.format(destdir, env.get('CPPFLAGS', ''))
             env['LDFLAGS'] = \
                 '-L{}/usr/lib {}'.format(destdir, env.get('LDFLAGS', ''))
-
-            if key == '_ssl' and sys.platform == 'darwin':
-                # needed for our roots patch
-                env['LDFLAGS'] += ' -framework CoreFoundation -framework 
Security'
         elif sys.platform == 'win32':
             env['INCLUDE'] = r'..\externals\include;' + env.get('INCLUDE', '')
             env['LIB'] = r'..\externals\lib;' + env.get('LIB', '')
@@ -237,6 +229,8 @@
     parser.add_argument('--exefile', dest='exefile', default=sys.executable,
                         help='instead of executing sys.executable' \
                              ' you can specify an alternative pypy vm here')
+    parser.add_argument('--rebuild', dest='rebuild', action='store_true',
+        help='Rebuild the module even if it already appears to have been 
built.')
     parser.add_argument('--only', dest='only', default=None,
                         help='Only build the modules delimited by a colon. 
E.g. _ssl,sqlite')
     parser.add_argument('--embed-dependencies', dest='embed_dependencies', 
action='store_true',
@@ -258,7 +252,8 @@
     else:
         only = set(args.only.split(','))
     failures = create_cffi_import_libraries(exename, options, basedir, 
only=only,
-                                            
embed_dependencies=args.embed_dependencies)
+                                            
embed_dependencies=args.embed_dependencies,
+                                            rebuild=args.rebuild)
     if len(failures) > 0:
         print('*** failed to build the CFFI modules %r' % (
             [f[1] for f in failures],), file=sys.stderr)
diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py
--- a/pypy/tool/release/package.py
+++ b/pypy/tool/release/package.py
@@ -86,6 +86,7 @@
         failures = create_cffi_import_libraries(
             str(pypy_c), options, str(basedir),
             embed_dependencies=options.embed_dependencies,
+            rebuild=True,
         )
 
         for key, module in failures:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to