'openssl/ssl.h', 'openssl/err.h', 'openssl/rand.h', 'openssl/evp.h', 'openssl/ossl_typ.h', 'openssl/x509v3.h' ] eci = ExternalCompilationInfo( libraries=libraries, includes=includes, post_include_bits=[ # Unnamed structures are not supported by rffi_platform. # So we replace an attribute access with a macro call. '#define pypy_GENERAL_NAME_dirn(name) (name->d.dirn)', ], ) eci = rffi_platform.configure_external_library('openssl', eci, [ dict(prefix='openssl-', include_dir='inc32', library_dir='out32'), ]) ASN1_STRING = lltype.Ptr(lltype.ForwardReference()) ASN1_ITEM = rffi.COpaquePtr('ASN1_ITEM') X509_NAME = rffi.COpaquePtr('X509_NAME') class CConfigBootstrap: _compilation_info_ = eci OPENSSL_EXPORT_VAR_AS_FUNCTION = rffi_platform.Defined( "OPENSSL_EXPORT_VAR_AS_FUNCTION") if rffi_platform.configure(CConfigBootstrap)["OPENSSL_EXPORT_VAR_AS_FUNCTION"]: ASN1_ITEM_EXP = lltype.Ptr(lltype.FuncType([], ASN1_ITEM))
from rpython.translator.tool.cbuild import ExternalCompilationInfo from rpython.translator.platform import platform as compiler from rpython.rlib.rarithmetic import intmask, r_longlong import sys if compiler.name == "msvc": libname = 'libbz2' else: libname = 'bz2' eci = ExternalCompilationInfo( includes = ['stdio.h', 'sys/types.h', 'bzlib.h'], libraries = [libname], ) eci = platform.configure_external_library( 'bz2', eci, [dict(prefix='bzip2-')]) if not eci: raise ImportError("Could not find bzip2 library") class CConfig: _compilation_info_ = eci calling_conv = 'c' CHECK_LIBRARY = platform.Has('dump("x", (long)&BZ2_bzCompress)') off_t = platform.SimpleType("off_t", rffi.LONGLONG) size_t = platform.SimpleType("size_t", rffi.ULONG) BUFSIZ = platform.ConstantInteger("BUFSIZ") _alloc_type = lltype.FuncType([rffi.VOIDP, rffi.INT, rffi.INT], rffi.VOIDP) _free_type = lltype.FuncType([rffi.VOIDP, rffi.VOIDP], lltype.Void)
eci = ExternalCompilationInfo( libraries=libraries, includes=includes, post_include_bits=[ # Unnamed structures are not supported by rffi_platform. # So we replace an attribute access with a macro call. "#define pypy_GENERAL_NAME_dirn(name) (name->d.dirn)", "#define pypy_GENERAL_NAME_uri(name) (name->d.uniformResourceIdentifier)", "#define pypy_X509_OBJECT_data_x509(obj) (obj->data.x509)", "#define pypy_DIST_POINT_fullname(obj) (obj->distpoint->name.fullname)", ], ) eci = rffi_platform.configure_external_library( "openssl", eci, [dict(prefix="openssl-", include_dir="inc32", library_dir="out32")] ) ASN1_STRING = lltype.Ptr(lltype.ForwardReference()) ASN1_IA5STRING = ASN1_STRING ASN1_ITEM = rffi.COpaquePtr("ASN1_ITEM") ASN1_OBJECT = rffi.COpaquePtr("ASN1_OBJECT") X509_NAME = rffi.COpaquePtr("X509_NAME") X509_VERIFY_PARAM = rffi.COpaquePtr("X509_VERIFY_PARAM") stack_st_X509_OBJECT = rffi.COpaquePtr("STACK_OF(X509_OBJECT)") DIST_POINT = rffi.COpaquePtr("DIST_POINT") stack_st_DIST_POINT = rffi.COpaquePtr("STACK_OF(X509_OBJECT)") DH = rffi.COpaquePtr("DH") EC_KEY = rffi.COpaquePtr("EC_KEY") AUTHORITY_INFO_ACCESS = rffi.COpaquePtr("AUTHORITY_INFO_ACCESS") GENERAL_NAME = lltype.Ptr(lltype.ForwardReference())
libname = 'libexpat' pre_include_bits = ["#define XML_STATIC"] else: libname = 'expat' pre_include_bits = [] eci = ExternalCompilationInfo( libraries=[libname], library_dirs=platform.preprocess_library_dirs([]), includes=['expat.h'], include_dirs=platform.preprocess_include_dirs([]), pre_include_bits = pre_include_bits, ) eci = rffi_platform.configure_external_library( libname, eci, [dict(prefix='expat-', include_dir='lib', library_dir='win32/bin/release'), ]) XML_Content_Ptr = lltype.Ptr(lltype.ForwardReference()) XML_Parser = rffi.COpaquePtr(typedef='XML_Parser') xml_error_list = [ "XML_ERROR_NO_MEMORY", "XML_ERROR_SYNTAX", "XML_ERROR_NO_ELEMENTS", "XML_ERROR_INVALID_TOKEN", "XML_ERROR_UNCLOSED_TOKEN", "XML_ERROR_PARTIAL_CHAR", "XML_ERROR_TAG_MISMATCH", "XML_ERROR_DUPLICATE_ATTRIBUTE",
link_files=link_files, testonly_libraries=['ffi'], ) elif _MINGW: includes = ['ffi.h'] libraries = ['libffi-5'] eci = ExternalCompilationInfo( libraries=libraries, includes=includes, separate_module_sources=separate_module_sources, post_include_bits=post_include_bits, ) eci = rffi_platform.configure_external_library('ffi-5', eci, [ dict(prefix='libffi-', include_dir='include', library_dir='.libs'), dict(prefix=r'c:\\mingw64', include_dir='include', library_dir='lib'), ]) else: eci = ExternalCompilationInfo( includes=['ffi.h', 'windows.h'], libraries=['kernel32', 'libffi-8'], separate_module_sources=separate_module_sources, post_include_bits=post_include_bits, ) FFI_TYPE_P = lltype.Ptr(lltype.ForwardReference()) FFI_TYPE_PP = rffi.CArrayPtr(FFI_TYPE_P) FFI_TYPE_NULL = lltype.nullptr(FFI_TYPE_P.TO) class CConfig:
link_files = link_files, testonly_libraries = ['ffi'], ) elif _MINGW: includes = ['ffi.h'] libraries = ['libffi-5'] eci = ExternalCompilationInfo( libraries = libraries, includes = includes, separate_module_sources = separate_module_sources, ) eci = rffi_platform.configure_external_library( 'ffi-5', eci, [dict(prefix='libffi-', include_dir='include', library_dir='.libs'), dict(prefix=r'c:\\mingw64', include_dir='include', library_dir='lib'), ]) else: USE_C_LIBFFI_MSVC = True libffidir = py.path.local(cdir).join('src', 'libffi_msvc') if not _WIN64: asm_ifc = 'win32.c' else: asm_ifc = 'win64.asm' eci = ExternalCompilationInfo( includes = ['ffi.h', 'windows.h'], libraries = ['kernel32'], include_dirs = [libffidir, cdir], separate_module_sources = separate_module_sources, separate_module_files = [libffidir.join('ffi.c'),
if sys.platform == "win32": libname = 'libexpat' pre_include_bits = ["#define XML_STATIC"] else: libname = 'expat' pre_include_bits = [] eci = ExternalCompilationInfo( libraries=[libname], library_dirs=platform.preprocess_library_dirs([]), includes=['expat.h'], include_dirs=platform.preprocess_include_dirs([]), pre_include_bits=pre_include_bits, ) eci = rffi_platform.configure_external_library(libname, eci, [ dict(prefix='expat-', include_dir='lib', library_dir='win32/bin/release'), ]) XML_Content_Ptr = lltype.Ptr(lltype.ForwardReference()) XML_Parser = rffi.COpaquePtr(typedef='XML_Parser') xml_error_list = [ "XML_ERROR_NO_MEMORY", "XML_ERROR_SYNTAX", "XML_ERROR_NO_ELEMENTS", "XML_ERROR_INVALID_TOKEN", "XML_ERROR_UNCLOSED_TOKEN", "XML_ERROR_PARTIAL_CHAR", "XML_ERROR_TAG_MISMATCH", "XML_ERROR_DUPLICATE_ATTRIBUTE", "XML_ERROR_JUNK_AFTER_DOC_ELEMENT",
'openssl/x509v3.h'] eci = ExternalCompilationInfo( libraries = libraries, includes = includes, export_symbols = [], post_include_bits = [ # Unnamed structures are not supported by rffi_platform. # So we replace an attribute access with a macro call. '#define pypy_GENERAL_NAME_dirn(name) (name->d.dirn)', ], ) eci = rffi_platform.configure_external_library( 'openssl', eci, [dict(prefix='openssl-', include_dir='inc32', library_dir='out32'), ]) # WinSock does not use a bitmask in select, and uses # socket handles greater than FD_SETSIZE if sys.platform == 'win32': MAX_FD_SIZE = None else: from rpython.rlib._rsocket_rffi import FD_SETSIZE as MAX_FD_SIZE ASN1_STRING = lltype.Ptr(lltype.ForwardReference()) ASN1_ITEM = rffi.COpaquePtr('ASN1_ITEM') X509_NAME = rffi.COpaquePtr('X509_NAME') class CConfigBootstrap:
from pypy.interpreter.gateway import interp2app, unwrap_spec from rpython.rlib.streamio import Stream from rpython.translator.tool.cbuild import ExternalCompilationInfo from rpython.translator.platform import platform as compiler from rpython.rlib.rarithmetic import intmask, r_longlong import sys if compiler.name == "msvc": libname = 'libbz2' else: libname = 'bz2' eci = ExternalCompilationInfo( includes=['stdio.h', 'sys/types.h', 'bzlib.h'], libraries=[libname], ) eci = platform.configure_external_library('bz2', eci, [dict(prefix='bzip2-')]) if not eci: raise ImportError("Could not find bzip2 library") class CConfig: _compilation_info_ = eci calling_conv = 'c' CHECK_LIBRARY = platform.Has('dump("x", (long)&BZ2_bzCompress)') off_t = platform.SimpleType("off_t", rffi.LONGLONG) size_t = platform.SimpleType("size_t", rffi.ULONG) BUFSIZ = platform.ConstantInteger("BUFSIZ") _alloc_type = lltype.FuncType([rffi.VOIDP, rffi.INT, rffi.INT], rffi.VOIDP) _free_type = lltype.FuncType([rffi.VOIDP, rffi.VOIDP], lltype.Void)
from rpython.rtyper.tool import rffi_platform from rpython.translator.platform import platform as compiler, CompilationError from rpython.translator.tool.cbuild import ExternalCompilationInfo if compiler.name == "msvc": libname = 'zlib1' # since version 1.1.4 and later, see http://www.zlib.net/DLL_FAQ.txt else: libname = 'z' eci = ExternalCompilationInfo( libraries=[libname], includes=['zlib.h'] ) try: eci = rffi_platform.configure_external_library( libname, eci, [dict(prefix='zlib-'), ]) except CompilationError: raise ImportError("Could not find a zlib library") constantnames = ''' Z_OK Z_STREAM_ERROR Z_BUF_ERROR Z_MEM_ERROR Z_STREAM_END Z_DATA_ERROR Z_DEFLATED Z_DEFAULT_STRATEGY Z_DEFAULT_COMPRESSION Z_NO_FLUSH Z_FINISH Z_SYNC_FLUSH Z_FULL_FLUSH MAX_WBITS MAX_MEM_LEVEL Z_BEST_SPEED Z_BEST_COMPRESSION Z_DEFAULT_COMPRESSION Z_FILTERED Z_HUFFMAN_ONLY Z_DEFAULT_STRATEGY '''.split() class SimpleCConfig:
from rpython.rtyper.lltypesystem.rstr import copy_string_to_raw from rpython.rtyper.tool import rffi_platform from rpython.translator.platform import platform as compiler, CompilationError from rpython.translator.tool.cbuild import ExternalCompilationInfo if compiler.name == "msvc": libname = 'zlib' # use the static lib, not zlib1 which is dll import lib testonly_libraries = ['zlib1'] else: libname = 'z' testonly_libraries = [] eci = ExternalCompilationInfo(libraries=[libname], includes=['zlib.h'], testonly_libraries=testonly_libraries) eci = rffi_platform.configure_external_library(libname, eci, [ dict(prefix='zlib-'), ]) constantnames = ''' Z_OK Z_STREAM_ERROR Z_BUF_ERROR Z_MEM_ERROR Z_STREAM_END Z_DATA_ERROR Z_DEFLATED Z_DEFAULT_STRATEGY Z_DEFAULT_COMPRESSION Z_NO_FLUSH Z_FINISH Z_SYNC_FLUSH Z_FULL_FLUSH MAX_WBITS MAX_MEM_LEVEL Z_BEST_SPEED Z_BEST_COMPRESSION Z_DEFAULT_COMPRESSION Z_FILTERED Z_HUFFMAN_ONLY Z_DEFAULT_STRATEGY Z_NEED_DICT '''.split() class SimpleCConfig: """ Definitions for basic types defined by zlib.
if sys.platform == "win32": libname = "libexpat" pre_include_bits = ["#define XML_STATIC"] else: libname = "expat" pre_include_bits = [] eci = ExternalCompilationInfo( libraries=[libname], library_dirs=platform.preprocess_library_dirs([]), includes=["expat.h"], include_dirs=platform.preprocess_include_dirs([]), pre_include_bits=pre_include_bits, ) eci = rffi_platform.configure_external_library( libname, eci, [dict(prefix="expat-", include_dir="lib", library_dir="win32/bin/release")] ) XML_Content_Ptr = lltype.Ptr(lltype.ForwardReference()) XML_Parser = rffi.COpaquePtr(typedef="XML_Parser") xml_error_list = [ "XML_ERROR_NO_MEMORY", "XML_ERROR_SYNTAX", "XML_ERROR_NO_ELEMENTS", "XML_ERROR_INVALID_TOKEN", "XML_ERROR_UNCLOSED_TOKEN", "XML_ERROR_PARTIAL_CHAR", "XML_ERROR_TAG_MISMATCH", "XML_ERROR_DUPLICATE_ATTRIBUTE", "XML_ERROR_JUNK_AFTER_DOC_ELEMENT",
from rpython.rtyper.tool import rffi_platform from rpython.translator.platform import platform as compiler, CompilationError from rpython.translator.tool.cbuild import ExternalCompilationInfo from rpython.tool.version import rpythonroot import py libname = 'miniz_oxide_c_api' ROOT = rpythonroot + '/lib_rust/miniz_oxide' testonly_libraries = [] eci = ExternalCompilationInfo(libraries=[libname], library_dirs=[ROOT + '/target/release'], includes=[ROOT + '/miniz.h'], include_dirs=[ROOT], testonly_libraries=testonly_libraries) eci = rffi_platform.configure_external_library(libname, eci, [ dict(prefix='miniz_oxide-'), ]) constantnames = ''' Z_OK Z_STREAM_ERROR Z_BUF_ERROR Z_MEM_ERROR Z_STREAM_END Z_DATA_ERROR Z_DEFLATED Z_DEFAULT_STRATEGY Z_DEFAULT_COMPRESSION Z_NO_FLUSH Z_FINISH Z_SYNC_FLUSH Z_FULL_FLUSH MAX_WBITS MAX_MEM_LEVEL Z_BEST_SPEED Z_BEST_COMPRESSION Z_DEFAULT_COMPRESSION Z_FILTERED Z_HUFFMAN_ONLY Z_DEFAULT_STRATEGY Z_NEED_DICT '''.split() class SimpleCConfig: """ Definitions for basic types defined by zlib.