def _build_linux(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) _patch_sources(source_folder_path, 'patch.diff') env = build_utils.get_autotools_linux_env() install_dir = os.path.join(working_directory_path, 'gen/install_linux') configure_args = list(_configure_args) configure_args.append('linux-x86_64') build_utils.build_with_autotools(source_folder_path, configure_args, install_dir, env=env, configure_exec_name='Configure', shell_prefix='perl', make_targets=['depend', 'all', 'install'], postclean=False) shutil.copyfile( os.path.join(install_dir, 'lib/libssl.a'), os.path.join(root_project_path, 'Libs/lib_CMake/linux/libssl.a')) shutil.copyfile( os.path.join(install_dir, 'lib/libcrypto.a'), os.path.join(root_project_path, 'Libs/lib_CMake/linux/libcrypto.a')) _copy_headers(install_dir, root_project_path, 'linux')
def _build_android(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) additional_defines = ' -D__ANDROID__ -DHAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC=1' # ARM toolchain_path_arm = build_utils.android_ndk_get_toolchain_arm() env_arm = build_utils.get_autotools_android_arm_env(toolchain_path_arm) env_arm['CFLAGS'] = env_arm['CFLAGS'] + additional_defines env_arm['CPPFLAGS'] = env_arm['CPPFLAGS'] + additional_defines install_dir_android_arm = os.path.join( working_directory_path, 'gen/install_android_arm') build_utils.run_process( ['sh', 'autogen.sh'], process_cwd=source_folder_path, environment=env_arm) build_utils.build_with_autotools( source_folder_path, ['--host=arm-linux-androideabi', '--disable-shared', '--enable-static'], install_dir_android_arm, env=env_arm) # x86 toolchain_path_x86 = build_utils.android_ndk_get_toolchain_x86() env_x86 = build_utils.get_autotools_android_x86_env(toolchain_path_x86) env_x86['CFLAGS'] = env_x86['CFLAGS'] + additional_defines env_x86['CPPFLAGS'] = env_x86['CPPFLAGS'] + additional_defines install_dir_android_x86 = os.path.join( working_directory_path, 'gen/install_android_x86') build_utils.run_process( ['sh', 'autogen.sh'], process_cwd=source_folder_path, environment=env_x86) build_utils.build_with_autotools( source_folder_path, ['--host=i686-linux-android', '--disable-shared', '--enable-static'], install_dir_android_x86, env=env_x86) libs_android_root = os.path.join(root_project_path, 'Libs/lib_CMake/android') lib_path_arm = os.path.join(install_dir_android_arm, 'lib/libuv.a') shutil.copyfile( lib_path_arm, os.path.join(libs_android_root, 'armeabi-v7a/libuv.a')) lib_path_x86 = os.path.join(install_dir_android_x86, 'lib/libuv.a') shutil.copyfile( lib_path_x86, os.path.join(libs_android_root, 'x86/libuv.a')) _copy_headers_from_install(install_dir_android_arm, root_project_path)
def _build_macos(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path, 'others', '_macos') install_dir_macos = os.path.join(working_directory_path, 'gen/install_macos') build_utils.build_with_autotools( os.path.join(source_folder_path, 'source'), ['--host=x86_64-apple-darwin', '--disable-shared', '--enable-static'], install_dir_macos, env=build_utils.get_autotools_macos_env(), postclean=False)
def _build_android(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) _patch_sources(source_folder_path, working_directory_path) build_utils.run_process(['autoreconf', '-i'], process_cwd=source_folder_path) # ARM toolchain_path_arm = build_utils.android_ndk_get_toolchain_arm() env = build_utils.get_autotools_android_arm_env(toolchain_path_arm) env['CFLAGS'] += ' -DNDEBUG' env['CPPFLAGS'] += ' -DNDEBUG' install_dir_android_arm = os.path.join(working_directory_path, 'gen/install_android_arm') build_utils.build_with_autotools( source_folder_path, ['--host=arm-linux-androideabi', '--disable-shared', '--enable-static'], install_dir_android_arm, env=env) # x86 toolchain_path_x86 = build_utils.android_ndk_get_toolchain_x86() env = build_utils.get_autotools_android_x86_env(toolchain_path_x86) env['CFLAGS'] += ' -DNDEBUG' env['CPPFLAGS'] += ' -DNDEBUG' install_dir_android_x86 = os.path.join(working_directory_path, 'gen/install_android_x86') build_utils.build_with_autotools( source_folder_path, ['--host=i686-linux-android', '--disable-shared', '--enable-static'], install_dir_android_x86, env=env) libs_android_root = os.path.join( root_project_path, 'Libs/lib_CMake/android') libunibreak_lib_path_arm = os.path.join( install_dir_android_arm, 'lib/libunibreak.a') shutil.copyfile( libunibreak_lib_path_arm, os.path.join(libs_android_root, 'armeabi-v7a/libunibreak.a')) libunibreak_lib_path_x86 = os.path.join( install_dir_android_x86, 'lib/libunibreak.a') shutil.copyfile( libunibreak_lib_path_x86, os.path.join(libs_android_root, 'x86/libunibreak.a')) _copy_headers_from_install(install_dir_android_arm, root_project_path)
def _build_linux(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path, 'others', '_linux') env = build_utils.get_autotools_linux_env() install_dir = os.path.join(working_directory_path, 'gen/install_linux') build_utils.build_with_autotools(os.path.join(source_folder_path, 'source'), ['--disable-shared', '--enable-static'], install_dir, env=env, postclean=False)
def _build_android(working_directory_path, root_project_path): # https://wiki.openssl.org/index.php/Android source_folder_path = _download_and_extract(working_directory_path) _patch_sources(source_folder_path, 'patch.diff') install_dir_arm = os.path.join(working_directory_path, 'gen/install_android_arm') build_utils.build_with_autotools(source_folder_path, _configure_args, install_dir_arm, configure_exec_name='config', shell_prefix='perl', env=_get_android_env_arm( source_folder_path, root_project_path)) install_dir_x86 = os.path.join(working_directory_path, 'gen/install_android_x86') build_utils.build_with_autotools(source_folder_path, _configure_args, install_dir_x86, configure_exec_name='config', shell_prefix='perl', env=_get_android_env_x86( source_folder_path, root_project_path)) libssl_path_android_arm = os.path.join(install_dir_arm, 'lib/libssl.a') libcrypto_path_android_arm = os.path.join(install_dir_arm, 'lib/libcrypto.a') libssl_path_android_x86 = os.path.join(install_dir_x86, 'lib/libssl.a') libcrypto_path_android_x86 = os.path.join(install_dir_x86, 'lib/libcrypto.a') librariess_android_root = os.path.join(root_project_path, 'Libs/lib_CMake/android') shutil.copyfile( libssl_path_android_arm, os.path.join(librariess_android_root, 'armeabi-v7a/libssl.a')) shutil.copyfile( libcrypto_path_android_arm, os.path.join(librariess_android_root, 'armeabi-v7a/libcrypto.a')) shutil.copyfile(libssl_path_android_x86, os.path.join(librariess_android_root, 'x86/libssl.a')) shutil.copyfile(libcrypto_path_android_x86, os.path.join(librariess_android_root, 'x86/libcrypto.a')) _copy_headers(install_dir_arm, root_project_path, 'android')
def _build_ios(working_directory_path, root_project_path): _build_macos(working_directory_path, root_project_path) source_folder_path = _download_and_extract(working_directory_path, 'others') install_dir_ios = os.path.join(working_directory_path, 'gen/install_ios') build_utils.build_with_autotools(os.path.join( source_folder_path, 'source'), [ '--with-cross-build=' + os.path.abspath(source_folder_path + '_macos/source'), '--host=armv7-apple-darwin', '--disable-shared', '--enable-static' ], install_dir_ios, env=build_utils.get_autotools_ios_env())
def _build_ios(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) _patch_sources(source_folder_path, 'patch.diff') install_dir_armv7 = os.path.join(working_directory_path, 'gen/install_ios_armv7') ios_configure_args = list(_configure_args) ios_configure_args.insert(0, 'ios-cross') build_utils.build_with_autotools(source_folder_path, ios_configure_args, install_dir_armv7, configure_exec_name='Configure', shell_prefix='perl', env=_get_ios_env()) install_dir_arm64 = os.path.join(working_directory_path, 'gen/install_ios_arm64') ios_configure_args = list(_configure_args) ios_configure_args.insert(0, 'ios64-cross') build_utils.build_with_autotools(source_folder_path, ios_configure_args, install_dir_arm64, configure_exec_name='Configure', shell_prefix='perl', env=_get_ios_env()) libssl_fat_path = os.path.join(working_directory_path, 'gen/fat_ios/libssl.a') libcrypto_fat_path = os.path.join(working_directory_path, 'gen/fat_ios/libcrypto.a') build_utils.make_fat_darwin_binary([ os.path.join(install_dir_armv7, 'lib/libssl.a'), os.path.join(install_dir_arm64, 'lib/libssl.a') ], libssl_fat_path) build_utils.make_fat_darwin_binary([ os.path.join(install_dir_armv7, 'lib/libcrypto.a'), os.path.join(install_dir_arm64, 'lib/libcrypto.a') ], libcrypto_fat_path) shutil.copyfile( libssl_fat_path, os.path.join(root_project_path, 'Libs/lib_CMake/ios/libssl.a')) shutil.copyfile( libcrypto_fat_path, os.path.join(root_project_path, 'Libs/lib_CMake/ios/libcrypto.a')) _copy_headers(install_dir_armv7, root_project_path, 'ios')
def _build_linux(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path, 'others') env = build_utils.get_autotools_linux_env() install_dir = os.path.join(working_directory_path, 'gen/install_linux') build_utils.build_with_autotools(source_folder_path, ['--disable-shared', '--enable-static'], install_dir, env=env) shutil.copyfile( os.path.join(install_dir, 'lib/libjpeg.a'), os.path.join(root_project_path, 'Libs/lib_CMake/linux/libjpeg.a')) _copy_headers_from_install(install_dir, root_project_path)
def _build_ios(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path, 'others') install_dir_ios = os.path.join(working_directory_path, 'gen/install_ios') build_utils.build_with_autotools( source_folder_path, ['--host=armv7-apple-darwin', '--disable-shared', '--enable-static'], install_dir_ios, env=build_utils.get_autotools_ios_env()) lib_path = os.path.join(install_dir_ios, 'lib/libjpeg.a') shutil.copyfile( lib_path, os.path.join(root_project_path, 'Libs/lib_CMake/ios/libjpeg_ios.a')) _copy_headers_from_install(install_dir_ios, root_project_path)
def _build_android(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) _patch_sources_android(source_folder_path, working_directory_path) gen_folder_path = os.path.join(working_directory_path, 'gen') if not os.path.exists(gen_folder_path): os.makedirs(gen_folder_path) # ARM toolchain_path_arm = build_utils.android_ndk_get_toolchain_arm() arm_env = build_utils.get_autotools_android_arm_env(toolchain_path_arm) install_dir_android_arm = os.path.join(working_directory_path, 'gen/install_android_arm') build_utils.build_with_autotools(source_folder_path, [ '--host=arm-linux-androideabi', '--disable-shared', '--enable-static', '--without-lzma', '--without-python' ], install_dir_android_arm, env=arm_env) # x86 toolchain_path_x86 = build_utils.android_ndk_get_toolchain_x86() x86_env = build_utils.get_autotools_android_x86_env(toolchain_path_x86) install_dir_android_x86 = os.path.join(working_directory_path, 'gen/install_android_x86') build_utils.build_with_autotools(source_folder_path, [ '--host=i686-linux-android', '--disable-shared', '--enable-static', '--without-lzma', '--without-python' ], install_dir_android_x86, env=x86_env) libraries_android_root = os.path.join(root_project_path, 'Libs/lib_CMake/android') lib_path_arm = os.path.join(install_dir_android_arm, 'lib/libxml2.a') shutil.copyfile( lib_path_arm, os.path.join(libraries_android_root, 'armeabi-v7a/libxml.a')) lib_path_x86 = os.path.join(install_dir_android_x86, 'lib/libxml2.a') shutil.copyfile(lib_path_x86, os.path.join(libraries_android_root, 'x86/libxml.a')) _copy_headers_from_install(install_dir_android_x86, root_project_path)
def _build_macos(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) install_dir_macos = os.path.join(working_directory_path, 'gen/install_macos') build_utils.build_with_autotools(source_folder_path, [ '--host=x86_64-apple-darwin', '--disable-shared', '--enable-static', '--without-lzma', '--without-python' ], install_dir_macos, env=build_utils.get_autotools_macos_env()) lib_path = os.path.join(install_dir_macos, 'lib/libxml2.a') shutil.copyfile( lib_path, os.path.join(root_project_path, 'Libs/lib_CMake/mac/libxml_macos.a')) _copy_headers_from_install(install_dir_macos, root_project_path)
def _build_linux(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) env = build_utils.get_autotools_linux_env() build_utils.run_process(['autoreconf', '-i'], process_cwd=source_folder_path) install_dir = os.path.join(working_directory_path, 'gen/install_linux') build_utils.build_with_autotools( source_folder_path, ['--disable-shared', '--enable-static'], install_dir, env=env) lib_path = os.path.join(install_dir, 'lib/libunibreak.a') shutil.copyfile( lib_path, os.path.join(root_project_path, 'Libs/lib_CMake/linux/libunibreak.a')) _copy_headers_from_install(install_dir, root_project_path)
def _build_macos(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) env = build_utils.get_autotools_macos_env() install_dir_macos = os.path.join( working_directory_path, 'gen/install_macos') build_utils.run_process( ['sh', 'autogen.sh'], process_cwd=source_folder_path, environment=env) build_utils.build_with_autotools( source_folder_path, ['--host=x86_64-apple-darwin', '--disable-shared', '--enable-static'], install_dir_macos, env=env) lib_path = os.path.join(install_dir_macos, 'lib/libuv.a') shutil.copyfile( lib_path, os.path.join(root_project_path, 'Libs/lib_CMake/mac/libuv_macos.a')) _copy_headers_from_install(install_dir_macos, root_project_path)
def _build_android(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path, 'others') # ARM toolchain_path_arm = build_utils.android_ndk_get_toolchain_arm() install_dir_android_arm = os.path.join(working_directory_path, 'gen/install_android_arm') build_utils.build_with_autotools( source_folder_path, [ '--host=arm-linux-androideabi', '--disable-shared', '--enable-static' ], install_dir_android_arm, env=build_utils.get_autotools_android_arm_env(toolchain_path_arm)) # x86 toolchain_path_x86 = build_utils.android_ndk_get_toolchain_x86() install_dir_android_x86 = os.path.join(working_directory_path, 'gen/install_android_x86') build_utils.build_with_autotools( source_folder_path, ['--host=i686-linux-android', '--disable-shared', '--enable-static'], install_dir_android_x86, env=build_utils.get_autotools_android_x86_env(toolchain_path_x86)) libs_android_root = os.path.join(root_project_path, 'Libs/lib_CMake/android') lib_path_arm = os.path.join(install_dir_android_arm, 'lib/libjpeg.a') shutil.copyfile(lib_path_arm, os.path.join(libs_android_root, 'armeabi-v7a/libjpeg.a')) lib_path_x86 = os.path.join(install_dir_android_x86, 'lib/libjpeg.a') shutil.copyfile(lib_path_x86, os.path.join(libs_android_root, 'x86/libjpeg.a')) _copy_headers_from_install(install_dir_android_arm, root_project_path)
def _build_android(working_directory_path, root_project_path): _build_macos(working_directory_path, root_project_path) source_folder_path = _download_and_extract(working_directory_path, 'others') # ARM toolchain_path_arm = build_utils.android_ndk_get_toolchain_arm() install_dir_android_arm = os.path.join(working_directory_path, 'gen/install_android_arm') build_utils.build_with_autotools( os.path.join(source_folder_path, 'source'), [ '--with-cross-build=' + os.path.abspath(source_folder_path + '_macos/source'), '--host=arm-linux-androideabi', '--disable-shared', '--enable-static' ], install_dir_android_arm, env=build_utils.get_autotools_android_arm_env(toolchain_path_arm, enable_stl=True)) # x86 toolchain_path_x86 = build_utils.android_ndk_get_toolchain_x86() install_dir_android_x86 = os.path.join(working_directory_path, 'gen/install_android_x86') build_utils.build_with_autotools( os.path.join(source_folder_path, 'source'), [ '--with-cross-build=' + os.path.abspath(source_folder_path + '_macos/source'), '--host=i686-linux-android', '--disable-shared', '--enable-static' ], install_dir_android_x86, env=build_utils.get_autotools_android_x86_env(toolchain_path_x86, enable_stl=True))
def _build_macos(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) _patch_sources(source_folder_path, 'patch.diff') install_dir = os.path.join(working_directory_path, 'gen/install_macos') macos_configure_args = list(_configure_args) macos_configure_args.insert(0, 'darwin64-x86_64-cc') build_utils.build_with_autotools(source_folder_path, macos_configure_args, install_dir, configure_exec_name='Configure', shell_prefix='perl') libssl_path = os.path.join(install_dir, 'lib/libssl.a') libcrypto_path = os.path.join(install_dir, 'lib/libcrypto.a') shutil.copyfile( libssl_path, os.path.join(root_project_path, 'Libs/lib_CMake/mac/libssl.a')) shutil.copyfile( libcrypto_path, os.path.join(root_project_path, 'Libs/lib_CMake/mac/libcrypto.a')) _copy_headers(install_dir, root_project_path, 'mac')
def _build_ios(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) _patch_sources(source_folder_path, working_directory_path) install_dir_ios = os.path.join(working_directory_path, 'gen/install_ios') build_utils.run_process(['autoreconf', '-i'], process_cwd=source_folder_path) env=build_utils.get_autotools_ios_env() env['CFLAGS'] += ' -DNDEBUG' env['CXXFLAGS'] += ' -DNDEBUG' build_utils.build_with_autotools( source_folder_path, ['--host=armv7-apple-darwin', '--disable-shared', '--enable-static'], install_dir_ios, env=env) libunibreak_lib_path = os.path.join(install_dir_ios, 'lib/libunibreak.a') shutil.copyfile( libunibreak_lib_path, os.path.join( root_project_path, 'Libs/lib_CMake/ios/libunibreak_ios.a')) _copy_headers_from_install(install_dir_ios, root_project_path)
def _build_linux(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) env = build_utils.get_autotools_linux_env() install_dir = os.path.join(working_directory_path, 'gen/install_linux') build_utils.build_with_autotools( source_folder_path, # exclude python bindings as make install requires sudo # also exclude lzma support as it requires lzma library [ '--disable-shared', '--enable-static', '--without-python', '--without-lzma' ], install_dir, env=env) lib_path = os.path.join(install_dir, 'lib/libxml2.a') shutil.copyfile( lib_path, os.path.join(root_project_path, 'Libs/lib_CMake/linux/libxml.a')) _copy_headers_from_install(install_dir, root_project_path)
def _build_linux(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) env = build_utils.get_autotools_linux_env() install_dir = os.path.join(working_directory_path, 'gen/install_linux') openssl_install_dir = os.path.abspath( os.path.join(working_directory_path, '../openssl/gen/install_linux/')) configure_args = [ '--disable-shared', '--enable-threaded-resolver', '--enable-ipv6', '--disable-rtsp', '--disable-ftp', '--disable-file', '--disable-ldap', '--disable-ldaps', '--disable-rtsp', '--disable-dict', '--disable-telnet', '--disable-tftp', '--disable-pop3', '--disable-imap', '--disable-smtp', '--disable-gopher', '--with-ssl=' + openssl_install_dir ] build_utils.build_with_autotools(source_folder_path, configure_args, install_dir, env) shutil.copyfile( os.path.join(install_dir, 'lib/libcurl.a'), os.path.join(root_project_path, 'Libs/lib_CMake/linux/libcurl.a')) _copy_headers(source_folder_path, root_project_path)
def _build_android(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) _patch_sources(source_folder_path, working_directory_path, 'patch_android.diff') # copy headers _copy_headers(source_folder_path, root_project_path) env = os.environ.copy() original_path_var = env["PATH"] # ARM toolchain_path_arm = build_utils.android_ndk_get_toolchain_arm() env_arm = build_utils.get_autotools_android_arm_env(toolchain_path_arm) install_dir_android_arm = os.path.join(working_directory_path, 'gen/install_android_arm') configure_args = [ '--host=arm-linux-androideabi', '--enable-threaded-resolver', '--enable-ipv6', '--disable-shared', '--disable-rtsp', '--disable-ftp', '--disable-file', '--disable-ldap', '--disable-ldaps', '--disable-rtsp', '--disable-dict', '--disable-telnet', '--disable-tftp', '--disable-pop3', '--disable-imap', '--disable-smtp', '--disable-gopher', '--with-ssl=' + os.path.abspath( os.path.join(working_directory_path, '../openssl/gen/install_android_arm/')) ] build_utils.build_with_autotools(source_folder_path, configure_args, install_dir_android_arm, env_arm) # x86 toolchain_path_x86 = build_utils.android_ndk_get_toolchain_x86() env_x86 = build_utils.get_autotools_android_x86_env(toolchain_path_x86) install_dir_android_x86 = os.path.join(working_directory_path, 'gen/install_android_x86') configure_args = [ '--host=i686-linux-android', '--enable-threaded-resolver', '--enable-ipv6', '--disable-shared', '--disable-rtsp', '--disable-ftp', '--disable-file', '--disable-ldap', '--disable-ldaps', '--disable-rtsp', '--disable-dict', '--disable-telnet', '--disable-tftp', '--disable-pop3', '--disable-imap', '--disable-smtp', '--disable-gopher', '--with-ssl=' + os.path.abspath( os.path.join(working_directory_path, '../openssl/gen/install_android_x86/')) ] build_utils.build_with_autotools(source_folder_path, configure_args, install_dir_android_x86, env_x86) # intermediate libs lib_android_arm_itm = os.path.join(install_dir_android_arm, 'lib/libcurl.a') lib_android_x86_itm = os.path.join(install_dir_android_x86, 'lib/libcurl.a') # ready libs libs_android_root = os.path.join(root_project_path, 'Libs/lib_CMake/android') lib_android_arm = os.path.join(libs_android_root, 'armeabi-v7a/libcurl.a') lib_android_x86 = os.path.join(libs_android_root, 'x86/libcurl.a') shutil.copyfile(lib_android_arm_itm, lib_android_arm) shutil.copyfile(lib_android_x86_itm, lib_android_x86)