Exemplo n.º 1
0
def setup_desktop_template(env: dict, opts: DesktopOpts, product: str, target_platform: str, target: str):
    host_triple = host_triples[target_platform] % target

    CONFIGURE_FLAGS = [
        '--disable-boehm',
        '--disable-iconv',
        '--disable-mcs-build',
        '--disable-nls',
        '--enable-dynamic-btls',
        '--enable-maintainer-mode',
        '--with-sigaltstack=yes',
        '--with-tls=pthread',
        '--without-ikvm-native'
    ]

    if target_platform == 'windows':
        mxe_bin = path_join(opts.mxe_prefix, 'bin')

        env['_%s-%s_PATH' % (product, target)] = mxe_bin

        name_fmt = path_join(mxe_bin, target + '-w64-mingw32-%s')

        env['_%s-%s_AR' % (product, target)] = name_fmt % 'ar'
        env['_%s-%s_AS' % (product, target)] = name_fmt % 'as'
        env['_%s-%s_CC' % (product, target)] = name_fmt % 'gcc'
        env['_%s-%s_CXX' % (product, target)] = name_fmt % 'g++'
        env['_%s-%s_DLLTOOL' % (product, target)] = name_fmt % 'dlltool'
        env['_%s-%s_LD' % (product, target)] = name_fmt % 'ld'
        env['_%s-%s_OBJDUMP' % (product, target)] = name_fmt % 'objdump'
        env['_%s-%s_RANLIB' % (product, target)] = name_fmt % 'ranlib'
        env['_%s-%s_STRIP' % (product, target)] = name_fmt % 'strip'

        CONFIGURE_FLAGS += [
            '--enable-static-gcc-libs'
        ]
    elif target_platform == 'osx' and 'OSXCROSS_ROOT' in os.environ:
        osxcross_root = os.environ['OSXCROSS_ROOT']
        osxcross_bin = path_join(osxcross_root, 'target', 'bin')
        osxcross_sdk = get_osxcross_sdk(target, osxcross_bin)

        env['_%s-%s_PATH' % (product, target)] = osxcross_bin

        name_fmt = path_join(osxcross_bin, target + ('-apple-darwin%s-' % osxcross_sdk) + '%s')

        env['_%s-%s_AR' % (product, target)] = name_fmt % 'ar'
        env['_%s-%s_AS' % (product, target)] = name_fmt % 'as'
        env['_%s-%s_CC' % (product, target)] = name_fmt % 'cc'
        env['_%s-%s_CXX' % (product, target)] = name_fmt % 'c++'
        env['_%s-%s_LD' % (product, target)] = name_fmt % 'ld'
        env['_%s-%s_RANLIB' % (product, target)] = name_fmt % 'ranlib'
        env['_%s-%s_CMAKE' % (product, target)] = name_fmt % 'cmake'
        env['_%s-%s_STRIP' % (product, target)] = name_fmt % 'strip'
    else:
        env['_%s-%s_CC' % (product, target)] = 'cc'

    env['_%s-%s_CONFIGURE_FLAGS' % (product, target)] = CONFIGURE_FLAGS

    llvm = llvm_table[target_platform][target] if opts.with_llvm else ''

    runtime.setup_runtime_template(env, opts, product, target, host_triple, llvm=llvm)
Exemplo n.º 2
0
def setup_ios_device_template(env: dict, opts: iOSOpts, target: str):
    ios_sysroot_path = opts.ios_sdk_path

    if not ios_sysroot_path and sys.platform == 'darwin':
        # Auto-detect on macOS
        ios_sysroot_path = xcrun_find_sdk('iphoneos')

    if not ios_sysroot_path:
        raise RuntimeError(
            'Cannot find iOS SDK; specify one manually with \'--ios-sdk\'.')

    sysroot_flags = [
        '-isysroot', ios_sysroot_path,
        '-miphoneos-version-min=%s' % opts.ios_version_min
    ]

    arch = iOSTargetTable.archs[target]
    host_triple = iOSTargetTable.host_triples[target]
    osxcross_tool_triple = iOSTargetTable.osxcross_tool_triples[target]

    tools_path = path_join(opts.ios_toolchain_path, 'usr', 'bin')

    if sys.platform != 'darwin':
        wrapper_path = create_osxcross_wrapper(opts, 'ios', target,
                                               opts.ios_toolchain_path)
        name_fmt = path_join(tools_path, osxcross_tool_triple + '-%s')
        name_fmt = "%s %s" % (wrapper_path, name_fmt)
    else:
        name_fmt = path_join(tools_path, '%s')

    AR = name_fmt % 'ar'
    AS = name_fmt % 'as'
    CC = name_fmt % 'clang'
    CXX = name_fmt % 'clang++'
    LD = name_fmt % 'ld'
    RANLIB = name_fmt % 'ranlib'
    STRIP = name_fmt % 'strip'

    ccache_path = os.environ.get('CCACHE', '')
    if ccache_path:
        CC = '%s %s' % (ccache_path, CC)
        CXX = '%s %s' % (ccache_path, CXX)

    AC_VARS = [
        'ac_cv_c_bigendian=no', 'ac_cv_func_fstatat=no',
        'ac_cv_func_readlinkat=no', 'ac_cv_func_getpwuid_r=no',
        'ac_cv_func_posix_getpwuid_r=yes', 'ac_cv_header_curses_h=no',
        'ac_cv_header_localcharset_h=no', 'ac_cv_header_sys_user_h=no',
        'ac_cv_func_getentropy=no', 'ac_cv_func_futimens=no',
        'ac_cv_func_utimensat=no', 'ac_cv_func_shm_open_working_with_mmap=no',
        'mono_cv_sizeof_sunpath=104', 'mono_cv_uscore=yes'
    ]

    bitcode_marker = env.get('ios-%s_BITCODE_MARKER' % target, '')

    CFLAGS = sysroot_flags + [
        '-arch %s' % arch, '-Wl,-application_extension', '-fexceptions'
    ]
    CFLAGS += [bitcode_marker] if bitcode_marker else []

    CXXFLAGS = sysroot_flags + [
        '-arch %s' % arch, '-Wl,-application_extension'
    ]
    CXXFLAGS += [bitcode_marker] if bitcode_marker else []

    CPPFLAGS = sysroot_flags + [
        '-DMONOTOUCH=1',
        '-arch %s' % arch, '-DSMALL_CONFIG', '-D_XOPEN_SOURCE', '-DHOST_IOS',
        '-DHAVE_LARGE_FILE_SUPPORT=1'
    ]

    LDFLAGS = []

    # https://github.com/mono/mono/issues/19393
    if os.environ.get('DISABLE_NO_WEAK_IMPORTS', '0') != '1':
        LDFLAGS += ['-Wl,-no_weak_imports']

    LDFLAGS += [
        '-arch %s' % arch, '-framework', 'CoreFoundation', '-lobjc', '-lc++'
    ]

    CONFIGURE_FLAGS = [
        '--disable-boehm',
        '--disable-btls',
        '--disable-executables',
        '--disable-icall-tables',
        '--disable-iconv',
        '--disable-mcs-build',
        '--disable-nls',
        '--disable-visibility-hidden',
        '--enable-dtrace=no',
        '--enable-icall-export',
        '--enable-maintainer-mode',
        '--enable-minimal=ssa,com,interpreter,jit,portability,assembly_remapping,attach,verifier,'
        +
        'full_messages,appdomains,security,sgen_remset,sgen_marksweep_par,sgen_marksweep_fixed,'
        +
        'sgen_marksweep_fixed_par,sgen_copying,logging,remoting,shared_perfcounters,gac',
        '--enable-monotouch',
        # We don't need this. Comment it so we don't have to call 'mono_gc_init_finalizer_thread' from Godot.
        #'--with-lazy-gc-thread-creation=yes',
        '--with-tls=pthread',
        '--without-ikvm-native',
        '--without-sigaltstack',
        '--disable-cooperative-suspend',
        '--disable-hybrid-suspend',
        '--disable-crash-reporting'
    ]

    env['_ios-%s_AR' % target] = AR
    env['_ios-%s_AS' % target] = AS
    env['_ios-%s_CC' % target] = CC
    env['_ios-%s_CXX' % target] = CXX
    env['_ios-%s_LD' % target] = LD
    env['_ios-%s_RANLIB' % target] = RANLIB
    env['_ios-%s_STRIP' % target] = STRIP

    env['_ios-%s_AC_VARS' % target] = AC_VARS
    env['_ios-%s_CFLAGS' % target] = CFLAGS
    env['_ios-%s_CXXFLAGS' % target] = CXXFLAGS
    env['_ios-%s_CPPFLAGS' % target] = CPPFLAGS
    env['_ios-%s_LDFLAGS' % target] = LDFLAGS
    env['_ios-%s_CONFIGURE_FLAGS' % target] = CONFIGURE_FLAGS

    # Runtime template
    runtime.setup_runtime_template(env, opts, 'ios', target, host_triple)
Exemplo n.º 3
0
def setup_ios_simulator_template(env: dict, opts: iOSOpts, target: str):
    ios_sysroot_path = opts.ios_sdk_path

    if not ios_sysroot_path and sys.platform == 'darwin':
        # Auto-detect on macOS
        ios_sysroot_path = xcrun_find_sdk('iphonesimulator')

    if not ios_sysroot_path:
        raise RuntimeError(
            'Cannot find iOS SDK; specify one manually with \'--ios-sdk\'.')

    sysroot_flags = [
        '-isysroot', ios_sysroot_path,
        '-miphoneos-version-min=%s' % opts.ios_version_min
    ]

    arch = iOSTargetTable.archs[target]
    host_triple = iOSTargetTable.host_triples[target]
    osxcross_tool_triple = iOSTargetTable.osxcross_tool_triples[target]

    tools_path = path_join(opts.ios_toolchain_path, 'usr', 'bin')

    if sys.platform != 'darwin':
        wrapper_path = create_osxcross_wrapper(opts, 'ios', target,
                                               opts.ios_toolchain_path)
        name_fmt = path_join(tools_path, osxcross_tool_triple + '-%s')
        name_fmt = "%s %s" % (wrapper_path, name_fmt)
    else:
        name_fmt = path_join(tools_path, '%s')

    AR = name_fmt % 'ar'
    AS = name_fmt % 'as'
    CC = name_fmt % 'clang'
    CXX = name_fmt % 'clang++'
    LD = name_fmt % 'ld'
    RANLIB = name_fmt % 'ranlib'
    STRIP = name_fmt % 'strip'

    ccache_path = os.environ.get('CCACHE', '')
    if ccache_path:
        CC = '%s %s' % (ccache_path, CC)
        CXX = '%s %s' % (ccache_path, CXX)

    AC_VARS = [
        'ac_cv_func_clock_nanosleep=no', 'ac_cv_func_fstatat=no',
        'ac_cv_func_readlinkat=no', 'ac_cv_func_system=no',
        'ac_cv_func_getentropy=no', 'ac_cv_func_futimens=no',
        'ac_cv_func_utimensat=no', 'ac_cv_func_shm_open_working_with_mmap=no',
        'mono_cv_uscore=yes'
    ]

    CFLAGS = sysroot_flags + ['-arch %s' % arch, '-Wl,-application_extension']

    CXXFLAGS = sysroot_flags + [
        '-arch %s' % arch, '-Wl,-application_extension'
    ]

    CPPFLAGS = sysroot_flags + [
        '-DMONOTOUCH=1',
        '-arch %s' % arch, '-Wl,-application_extension', '-DHOST_IOS'
    ]

    LDFLAGS = []

    CONFIGURE_FLAGS = [
        '--disable-boehm', '--disable-btls', '--disable-executables',
        '--disable-iconv', '--disable-mcs-build', '--disable-nls',
        '--disable-visibility-hidden', '--enable-maintainer-mode',
        '--enable-minimal=com,remoting,shared_perfcounters,gac',
        '--enable-monotouch', '--with-tls=pthread', '--without-ikvm-native',
        '--disable-cooperative-suspend', '--disable-hybrid-suspend',
        '--disable-crash-reporting'
    ]

    if sys.platform != 'darwin':
        # DTrace is not available when building with OSXCROSS
        CONFIGURE_FLAGS += ['--enable-dtrace=no']

    env['_ios-%s_AR' % target] = AR
    env['_ios-%s_AS' % target] = AS
    env['_ios-%s_CC' % target] = CC
    env['_ios-%s_CXX' % target] = CXX
    env['_ios-%s_LD' % target] = LD
    env['_ios-%s_RANLIB' % target] = RANLIB
    env['_ios-%s_STRIP' % target] = STRIP

    env['_ios-%s_AC_VARS' % target] = AC_VARS
    env['_ios-%s_CFLAGS' % target] = CFLAGS
    env['_ios-%s_CXXFLAGS' % target] = CXXFLAGS
    env['_ios-%s_CPPFLAGS' % target] = CPPFLAGS
    env['_ios-%s_LDFLAGS' % target] = LDFLAGS
    env['_ios-%s_CONFIGURE_FLAGS' % target] = CONFIGURE_FLAGS

    # Runtime template
    runtime.setup_runtime_template(env, opts, 'ios', target, host_triple)
Exemplo n.º 4
0
def setup_desktop_template(env: dict, opts: DesktopOpts, product: str, target_platform: str, target: str):
    host_triple = host_triples[target_platform] % target_arch[target_platform][target]

    CONFIGURE_FLAGS = [
        '--disable-boehm',
        '--disable-mcs-build',
        '--enable-maintainer-mode',
        '--with-tls=pthread',
        '--without-ikvm-native'
    ]

    if target_platform == 'windows':
        CONFIGURE_FLAGS += [
            '--with-libgdiplus=%s' % opts.mxe_prefix
        ]
    else:
        CONFIGURE_FLAGS += [
            '--disable-iconv',
            '--disable-nls',
            '--enable-dynamic-btls',
            '--with-sigaltstack=yes',
        ]

    if target_platform == 'windows':
        mxe_bin = path_join(opts.mxe_prefix, 'bin')

        env['_%s-%s_PATH' % (product, target)] = mxe_bin

        name_fmt = path_join(mxe_bin, target_arch[target_platform][target] + '-w64-mingw32-%s')

        env['_%s-%s_AR' % (product, target)] = name_fmt % 'ar'
        env['_%s-%s_AS' % (product, target)] = name_fmt % 'as'
        env['_%s-%s_CC' % (product, target)] = name_fmt % 'gcc'
        env['_%s-%s_CXX' % (product, target)] = name_fmt % 'g++'
        env['_%s-%s_DLLTOOL' % (product, target)] = name_fmt % 'dlltool'
        env['_%s-%s_LD' % (product, target)] = name_fmt % 'ld'
        env['_%s-%s_OBJDUMP' % (product, target)] = name_fmt % 'objdump'
        env['_%s-%s_RANLIB' % (product, target)] = name_fmt % 'ranlib'
        env['_%s-%s_STRIP' % (product, target)] = name_fmt % 'strip'

        CONFIGURE_FLAGS += [
            #'--enable-static-gcc-libs'
        ]
    elif target_platform == 'osx':
        if is_cross_compiling(target_platform):
            osxcross_root = os.environ['OSXCROSS_ROOT']
            osx_toolchain_path = path_join(osxcross_root, 'target')
            osxcross_bin = path_join(osx_toolchain_path, 'bin')
            osx_triple_abi = 'darwin%s' % get_osxcross_sdk(osxcross_bin, arch=target_arch[target_platform][target]) # TODO: Replace with '--osx-triple-abi' as in ios.py

            env['_%s-%s_PATH' % (product, target)] = osxcross_bin

            wrapper_path = create_osxcross_wrapper(opts, product, target, osx_toolchain_path)
            name_fmt = path_join(osxcross_bin, target_arch[target_platform][target] + '-apple-' + osx_triple_abi + '-%s')
            name_fmt = "%s %s" % (wrapper_path, name_fmt)

            env['_%s-%s_AR' % (product, target)] = name_fmt % 'ar'
            env['_%s-%s_AS' % (product, target)] = name_fmt % 'as'
            env['_%s-%s_CC' % (product, target)] = name_fmt % 'clang'
            env['_%s-%s_CXX' % (product, target)] = name_fmt % 'clang++'
            env['_%s-%s_LD' % (product, target)] = name_fmt % 'ld'
            env['_%s-%s_RANLIB' % (product, target)] = name_fmt % 'ranlib'
            env['_%s-%s_CMAKE' % (product, target)] = name_fmt % 'cmake'
            env['_%s-%s_STRIP' % (product, target)] = name_fmt % 'strip'

            # DTrace is not available when building with OSXCROSS
            CONFIGURE_FLAGS += ['--enable-dtrace=no']
        else:
            env['_%s-%s_CC' % (product, target)] = 'cc'

    env['_%s-%s_CONFIGURE_FLAGS' % (product, target)] = CONFIGURE_FLAGS

    llvm = llvm_table[target_platform][target] if opts.with_llvm else ''

    runtime.setup_runtime_template(env, opts, product, target, host_triple, llvm=llvm)
Exemplo n.º 5
0
def setup_android_target_template(env: dict, opts: AndroidOpts, target: str):
    extra_target_envs = {
        'armeabi-v7a': {
            'android-armeabi-v7a_CFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-march=armv7-a', '-mtune=cortex-a8', '-mfpu=vfp', '-mfloat-abi=softfp'],
            'android-armeabi-v7a_CXXFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-march=armv7-a', '-mtune=cortex-a8', '-mfpu=vfp', '-mfloat-abi=softfp'],
            'android-armeabi-v7a_LDFLAGS': ['-Wl,--fix-cortex-a8']
        },
        'arm64-v8a': {
            'android-arm64-v8a_CFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-DL_cuserid=9', '-DANDROID64'],
            'android-arm64-v8a_CXXFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-DL_cuserid=9', '-DANDROID64']
        },
        'x86': {},
        'x86_64': {
            'android-x86_64_CFLAGS': ['-DL_cuserid=9'],
            'android-x86_64_CXXFLAGS': ['-DL_cuserid=9']
        }
    }

    if target in extra_target_envs:
        env.update(extra_target_envs[target])

    android_new_ndk = True

    with open(path_join(opts.android_ndk_root, 'source.properties')) as file:
        for line in file:
            line = line.strip()
            if line.startswith('Pkg.Revision ') or line.startswith('Pkg.Revision='):
                pkg_revision = line.split('=')[1].strip()
                mayor = int(pkg_revision.split('.')[0])
                android_new_ndk = mayor >= 18
                break

    arch = AndroidTargetTable.archs[target]
    abi_name = AndroidTargetTable.abi_names[target]
    host_triple = AndroidTargetTable.host_triples[target]
    api = env['ANDROID_API_VERSION']

    toolchain_path = path_join(opts.android_toolchains_prefix, opts.toolchain_name_fmt % (target, api))

    tools_path = path_join(toolchain_path, 'bin')
    name_fmt = abi_name + '-%s'

    sdk_cmake_dir = path_join(opts.android_sdk_root, 'cmake', get_android_cmake_version(opts))
    if not os.path.isdir(sdk_cmake_dir):
        print('Android CMake directory \'%s\' not found' % sdk_cmake_dir)

    AR = path_join(tools_path, name_fmt % 'ar')
    AS = path_join(tools_path, name_fmt % 'as')
    CC = path_join(tools_path, name_fmt % 'clang')
    CXX = path_join(tools_path, name_fmt % 'clang++')
    DLLTOOL = ''
    LD = path_join(tools_path, name_fmt % 'ld')
    OBJDUMP = path_join(tools_path, name_fmt % 'objdump')
    RANLIB = path_join(tools_path, name_fmt % 'ranlib')
    CMAKE = path_join(sdk_cmake_dir, 'bin', 'cmake')
    STRIP = path_join(tools_path, name_fmt % 'strip')

    CPP = path_join(tools_path, name_fmt % 'cpp')
    if not os.path.isfile(CPP):
        CPP = path_join(tools_path, (name_fmt % 'clang'))
        CPP += ' -E'

    CXXCPP = path_join(tools_path, name_fmt % 'cpp')
    if not os.path.isfile(CXXCPP):
        CXXCPP = path_join(tools_path, (name_fmt % 'clang++'))
        CXXCPP += ' -E'

    ccache_path = os.environ.get('CCACHE', '')
    if ccache_path:
        CC = '%s %s' % (ccache_path, CC)
        CXX = '%s %s' % (ccache_path, CXX)
        CPP = '%s %s' % (ccache_path, CPP)
        CXXCPP = '%s %s' % (ccache_path, CXXCPP)

    AC_VARS = [
        'mono_cv_uscore=yes',
        'ac_cv_func_sched_getaffinity=no',
        'ac_cv_func_sched_setaffinity=no',
        'ac_cv_func_shm_open_working_with_mmap=no'
    ]

    CFLAGS, CXXFLAGS, CPPFLAGS, CXXCPPFLAGS, LDFLAGS = [], [], [], [], []

    # On Android we use 'getApplicationInfo().nativeLibraryDir' as the libdir where Mono will look for shared objects.
    # This path looks something like this: '/data/app-lib/{package_name-{num}}'. However, Mono does some relocation
    # and the actual path it will look at will be '/data/app-lib/{package_name}-{num}/../lib', which doesn't exist.
    # Cannot use '/data/data/{package_name}/lib' either, as '/data/data/{package_name}/lib/../lib' may result in
    # permission denied. Therefore we just override 'MONO_RELOC_LIBDIR' here to avoid the relocation.
    CPPFLAGS += ['-DMONO_RELOC_LIBDIR=\\\".\\\"']

    CFLAGS += ['-fstack-protector']
    CFLAGS += ['-DMONODROID=1'] if opts.with_monodroid else []
    CFLAGS += ['-D__ANDROID_API__=' + api] if android_new_ndk else []
    CXXFLAGS += ['-fstack-protector']
    CXXFLAGS += ['-DMONODROID=1'] if opts.with_monodroid else []
    CXXFLAGS += ['-D__ANDROID_API__=' + api] if android_new_ndk else []

    CPPFLAGS += ['-I%s/sysroot/usr/include' % toolchain_path]
    CXXCPPFLAGS += ['-I%s/sysroot/usr/include' % toolchain_path]

    path_link = '%s/platforms/android-%s/arch-%s/usr/lib' % (opts.android_ndk_root, api, arch)

    LDFLAGS += [
        '-z', 'now', '-z', 'relro', '-z', 'noexecstack',
        '-ldl', '-lm', '-llog', '-lc', '-lgcc',
        '-Wl,-rpath-link=%s,-dynamic-linker=/system/bin/linker' % path_link,
        '-L' + path_link
    ]

    # Fixes this error: DllImport unable to load library 'dlopen failed: empty/missing DT_HASH in "libmono-native.so" (built with --hash-style=gnu?)'.
    LDFLAGS += ['-Wl,--hash-style=both']

    CONFIGURE_FLAGS = [
        '--disable-boehm',
        '--disable-executables',
        '--disable-iconv',
        '--disable-mcs-build',
        '--disable-nls',
        '--enable-dynamic-btls',
        '--enable-maintainer-mode',
        '--enable-minimal=ssa,portability,attach,verifier,full_messages,sgen_remset'
                ',sgen_marksweep_par,sgen_marksweep_fixed,sgen_marksweep_fixed_par'
                ',sgen_copying,logging,security,shared_handles,interpreter',
        '--with-btls-android-ndk=%s' % opts.android_ndk_root,
        '--with-btls-android-api=%s' % api,
    ]

    CONFIGURE_FLAGS += ['--enable-monodroid'] if opts.with_monodroid else []
    CONFIGURE_FLAGS += ['--with-btls-android-ndk-asm-workaround'] if android_new_ndk else []

    CONFIGURE_FLAGS += [
        '--with-btls-android-cmake-toolchain=%s/build/cmake/android.toolchain.cmake' % opts.android_ndk_root,
        '--with-sigaltstack=yes',
        '--with-tls=pthread',
        '--without-ikvm-native',
        '--disable-cooperative-suspend',
        '--disable-hybrid-suspend',
        '--disable-crash-reporting'
    ]

    env['_android-%s_AR' % target] = AR
    env['_android-%s_AS' % target] = AS
    env['_android-%s_CC' % target] = CC
    env['_android-%s_CXX' % target] = CXX
    env['_android-%s_CPP' % target] = CPP
    env['_android-%s_CXXCPP' % target] = CXXCPP
    env['_android-%s_DLLTOOL' % target] = DLLTOOL
    env['_android-%s_LD' % target] = LD
    env['_android-%s_OBJDUMP' % target] = OBJDUMP
    env['_android-%s_RANLIB' % target] = RANLIB
    env['_android-%s_CMAKE' % target] = CMAKE
    env['_android-%s_STRIP' % target] = STRIP

    env['_android-%s_AC_VARS' % target] = AC_VARS
    env['_android-%s_CFLAGS' % target] = CFLAGS
    env['_android-%s_CXXFLAGS' % target] = CXXFLAGS
    env['_android-%s_CPPFLAGS' % target] = CPPFLAGS
    env['_android-%s_CXXCPPFLAGS' % target] = CXXCPPFLAGS
    env['_android-%s_LDFLAGS' % target] = LDFLAGS
    env['_android-%s_CONFIGURE_FLAGS' % target] = CONFIGURE_FLAGS

    # Runtime template
    runtime.setup_runtime_template(env, opts, 'android', target, host_triple)