コード例 #1
0
ファイル: build.py プロジェクト: niliang000/iotjs
def adjust_option(option):
    if option.target_os.lower() == 'nuttx':
        option.buildlib = True
        if option.nuttx_home == '':
            ex.fail('--nuttx-home needed for nuttx target')
        else:
            option.nuttx_home = fs.abspath(option.nuttx_home)
            if not fs.exists(option.nuttx_home):
                ex.fail('--nuttx-home %s not exists' % option.nuttx_home)
    if option.target_arch == 'x86':
        option.target_arch = 'i686'
    if option.target_arch == 'x64':
        option.target_arch = 'x86_64'
    if option.cmake_param is None:
        option.cmake_param = []
    if option.compile_flag is None:
        option.compile_flag = []
    if option.link_flag is None:
        option.link_flag = []
    if option.external_include_dir is None:
        option.external_include_dir = []
    if option.external_static_lib is None:
        option.external_static_lib = []
    if option.external_shared_lib is None:
        option.external_shared_lib = []
    if option.iotjs_include_module is None:
        option.iotjs_include_module = []
    if option.iotjs_exclude_module is None:
        option.iotjs_exclude_module = []
    if option.jerry_cmake_param is None:
        option.jerry_cmake_param = []
    if option.jerry_compile_flag is None:
        option.jerry_compile_flag = []
    if option.jerry_link_flag is None:
        option.jerry_link_flag = []
コード例 #2
0
ファイル: build.py プロジェクト: niliang000/iotjs
def build_jerry(option):
    # Check if JerryScript submodule exists.
    if not fs.exists(path.JERRY_ROOT):
        ex.fail('JerryScript submodule not exists!')

    # Move working directory to JerryScript build directory.
    build_home = fs.join(host_build_root, 'deps', 'jerry')
    fs.maybe_make_directory(build_home)
    fs.chdir(build_home)

    # Set JerryScript cmake option.
    cmake_opt = [path.JERRY_ROOT]

    cmake_opt.append('-DCMAKE_TOOLCHAIN_FILE=' + host_cmake_toolchain_file)

    if option.buildtype == 'debug':
        cmake_opt.append('-DCMAKE_BUILD_TYPE=Debug')

    # Turn off LTO for jerry bin to save build time.
    cmake_opt.append('-DENABLE_LTO=OFF')

    # Turn on snapshot
    if not option.no_snapshot:
        cmake_opt.append('-DFEATURE_SNAPSHOT_SAVE=ON')

    # Run cmake.
    ex.check_run_cmd('cmake', cmake_opt)

    target_jerry = {
        'target_name': 'jerry',
        'output_path': fs.join(build_home, 'bin/jerry')
    }

    # Make option.
    make_opt = ['-C', build_home]
    if not option.no_parallel_build:
        make_opt.append('-j')

    # Run make for a target.
    ex.check_run_cmd('make', make_opt)

    # Check output
    output = target_jerry['output_path']
    if not fs.exists(output):
        print output
        ex.fail('JerryScript build failed - target not produced.')

    # copy
    fs.copy(output, jerry_output_path)

    return True
コード例 #3
0
ファイル: build.py プロジェクト: niliang000/iotjs
def build_tuv(option):
    # Check if libtuv submodule exists.
    if not fs.exists(path.TUV_ROOT):
        ex.fail('libtuv submodule not exists!')

    # Move working directory to libtuv build directory.
    build_home = fs.join(build_root, 'deps', 'libtuv')
    fs.maybe_make_directory(build_home)
    fs.chdir(build_home)

    # Set tuv cmake option.
    cmake_opt = [path.TUV_ROOT]
    cmake_opt.append('-DCMAKE_TOOLCHAIN_FILE=' +
                     fs.join(path.TUV_ROOT, 'cmake', 'config', 'config_' +
                             target_tuple + '.cmake'))
    cmake_opt.append('-DCMAKE_BUILD_TYPE=' + option.buildtype)
    cmake_opt.append('-DTARGET_PLATFORM=' + target_tuple)
    cmake_opt.append('-DLIBTUV_CUSTOM_LIB_OUT=' + build_home)
    cmake_opt.append('-DBUILDTESTER=no')
    cmake_opt.append('-DBUILDAPIEMULTESTER=no')

    if option.target_os == 'nuttx':
        cmake_opt.append('-DTARGET_SYSTEMROOT=' + option.nuttx_home)

    if option.target_board:
        cmake_opt.append('-DTARGET_BOARD=' + option.target_board)

    # inflate cmake option.
    inflate_cmake_option(cmake_opt, option)

    # Run cmake
    ex.check_run_cmd('cmake', cmake_opt)

    # Run make
    make_opt = []
    if not option.no_parallel_build:
        make_opt.append('-j')

    ex.check_run_cmd('make', make_opt)

    # libtuv output
    output = fs.join(build_home, 'libtuv.a')
    if not fs.exists(output):
        ex.fail('libtuv build failed - target not produced.')

    # copy output to libs directory
    fs.maybe_make_directory(build_libs)
    fs.copy(output, libtuv_output_path)

    return True
コード例 #4
0
ファイル: build.py プロジェクト: niliang000/iotjs
def build_libhttpparser(option):
    # Check if JerryScript submodule exists.
    if not fs.exists(path.HTTPPARSER_ROOT):
        ex.fail('libhttpparser submodule not exists!')
        return False

    # Move working directory to JerryScript build directory.
    build_home = fs.join(build_root, 'deps', 'httpparser')
    fs.maybe_make_directory(build_home)
    fs.chdir(build_home)

    # Set JerryScript cmake option.
    cmake_opt = [path.HTTPPARSER_ROOT]

    cmake_opt.append('-DCMAKE_TOOLCHAIN_FILE=' + cmake_toolchain_file)
    cmake_opt.append('-DBUILDTYPE=' + option.buildtype.capitalize())

    if option.target_os == 'nuttx':
        cmake_opt.append('-DNUTTX_HOME=' + option.nuttx_home)
        cmake_opt.append('-DOS=NUTTX')
    if option.target_os == 'linux':
        cmake_opt.append('-DOS=LINUX')

    # inflate cmake option.
    inflate_cmake_option(cmake_opt, option)

    # Run cmake.
    ex.check_run_cmd('cmake', cmake_opt)

    # Set make option.
    make_opt = []
    if not option.no_parallel_build:
        make_opt.append('-j')

    # Run make
    ex.check_run_cmd('make', make_opt)

    # Output
    output = fs.join(build_home, 'libhttpparser.a')
    if not fs.exists(output):
        ex.fail('libhttpparser build failed - target not produced.')

    # copy
    fs.copy(output, libhttpparser_output_path)

    return True
コード例 #5
0
def git_remove_remote(fork_name, branch_name):
    remote_name = get_merge_remote_name(fork_name, branch_name)
    return ex.run_cmd('git remote remove %s' % remote_name)


def check_build():
    return (ex.run_cmd(BUILD_SCRIPT_DEBUG) or ex.run_cmd(BUILD_SCRIPT_RELEASE))


def git_push():
    return ex.run_cmd('git push origin master')


if len(sys.argv) < 3:
    ex.fail('usage: <merge.py> <fork_name> <branch_name> [<id>]')

fork_name = sys.argv[1]
branch_name = sys.argv[2]
git_id = ""
git_passwd = ""

if len(sys.argv) >= 4:
    git_id = sys.argv[3]
    git_passwd = getpass.getpass()

merge_branch = get_merge_branch_name(fork_name, branch_name)

# check if current branch is master.
if git_current_branch() != 'master':
    ex.fail('You should run merge script on master branch')
コード例 #6
0
ファイル: build.py プロジェクト: niliang000/iotjs
def build_iotjs(option):
    # Run js2c
    fs.chdir(path.TOOLS_ROOT)
    js2c(option.buildtype, option.no_snapshot, option.js_modules,
         jerry_output_path)

    # Move working directory to IoT.js build directory.
    build_home = fs.join(build_root, 'iotjs')
    fs.maybe_make_directory(build_home)
    fs.chdir(build_home)

    # Set JerryScript cmake option.
    cmake_opt = [path.PROJECT_ROOT]
    cmake_opt.append('-DCMAKE_TOOLCHAIN_FILE=' + cmake_toolchain_file)
    cmake_opt.append('-DCMAKE_BUILD_TYPE=' + option.buildtype.capitalize())
    cmake_opt.append('-DTARGET_OS=' + option.target_os)
    cmake_opt.append('-DPLATFORM_DESCRIPT=' + platform_descriptor)

    # IoT.js module list
    cmake_opt.append('-DIOTJS_MODULES=' + (' ').join(option.native_modules))

    if not option.no_snapshot:
        option.compile_flag.append('-DENABLE_SNAPSHOT')

    if option.target_os == 'nuttx':
        cmake_opt.append('-DNUTTX_HOME=' + option.nuttx_home)
        option.buildlib = True

    # --build-lib
    if option.buildlib:
        cmake_opt.append('-DBUILD_TO_LIB=YES')

    # --cmake-param
    cmake_opt += option.cmake_param

    # --external_static_lib
    cmake_opt.append('-DEXTERNAL_STATIC_LIB=' +
                     ' '.join(option.external_static_lib))

    # --external_shared_lib
    cmake_opt.append('-DEXTERNAL_SHARED_LIB=' +
                     ' '.join(option.external_shared_lib))

    # inflate cmake option
    inflate_cmake_option(cmake_opt, option)

    # Run cmake.
    ex.check_run_cmd('cmake', cmake_opt)

    # Set make option.
    make_opt = []
    if not option.no_parallel_build:
        make_opt.append('-j')

    # Run make
    ex.check_run_cmd('make', make_opt)

    # Output
    output = fs.join(build_home,
                     'liblibiotjs.a' if option.buildlib else 'iotjs')

    if not fs.exists(output):
        ex.fail('IoT.js build failed - target not produced.')

    # copy
    dest_path = libiotjs_output_path if option.buildlib else iotjs_output_path
    fs.copy(output, dest_path)

    return True
コード例 #7
0
ファイル: build.py プロジェクト: niliang000/iotjs
 def print_warn(fmt, arg):
     print fmt % arg
     ex.fail('Failed to analyze module dependency')
コード例 #8
0
ファイル: build.py プロジェクト: niliang000/iotjs
def build_libjerry(option):
    # Check if JerryScript submodule exists.
    if not fs.exists(path.JERRY_ROOT):
        ex.fail('JerryScript submodule not exists!')

    # Move working directory to JerryScript build directory.
    build_home = fs.join(build_root, 'deps', 'jerry')
    fs.maybe_make_directory(build_home)
    fs.chdir(build_home)

    # Set JerryScript cmake option.
    cmake_opt = [path.JERRY_ROOT]

    cmake_opt.append('-DCMAKE_TOOLCHAIN_FILE=' + cmake_toolchain_file)

    if option.buildtype == 'debug':
        cmake_opt.append('-DCMAKE_BUILD_TYPE=Debug')

    if option.target_os == 'nuttx':
        cmake_opt.append('-DEXTERNAL_LIBC_INTERFACE=' +
                         fs.join(option.nuttx_home, 'include'))
        if option.target_arch == 'arm':
            cmake_opt.append('-DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=arm')

    if option.target_os == 'linux':
        cmake_opt.append('-DJERRY_LIBC=OFF')

    # --jerry-heaplimit
    if option.jerry_heaplimit:
        cmake_opt.append('-DMEM_HEAP_SIZE_KB=' + str(option.jerry_heaplimit))

    # --jerry-heap-section
    if option.jerry_heap_section:
        cmake_opt.append('-DJERRY_HEAP_SECTION_ATTR=' +
                         str(option.jerry_heap_section))

    # --jerry-lto
    cmake_opt.append('-DENABLE_LTO=%s' % ('ON' if option.jerry_lto else 'OFF'))

    if option.jerry_memstat:
        cmake_opt.append('-DFEATURE_MEM_STATS=ON')

    # Turn on snapshot
    cmake_opt.append('-DFEATURE_SNAPSHOT_SAVE=OFF')
    if not option.no_snapshot:
        cmake_opt.append('-DFEATURE_SNAPSHOT_EXEC=ON')

    # --jerry-cmake-param
    cmake_opt += option.jerry_cmake_param

    # inflate cmake option.
    inflate_cmake_option(cmake_opt, option, for_jerry=True)

    # Run cmake.
    ex.check_run_cmd('cmake', cmake_opt)

    # make target - libjerry
    target_libjerry_name = 'jerry-core'
    target_libjerry = {
        'target_name': target_libjerry_name,
        'output_path': fs.join(build_home, 'lib',
                               'lib%s.a' % target_libjerry_name),
        'dest_path': libjerry_output_path
    }

    targets = []
    targets.append(target_libjerry)

    # make the target.
    for target in targets:
        # Make option.
        make_opt = ['-C', build_home, target['target_name']]
        if not option.no_parallel_build:
            make_opt.append('-j')

        # Run make for a target.
        ex.check_run_cmd('make', make_opt)

        # Check output
        output = target['output_path']
        if not fs.exists(output):
            print output
            ex.fail('JerryScript build failed - target not produced.')

        # copy
        fs.copy(output, target['dest_path'])

    return True
コード例 #9
0
ファイル: build.py プロジェクト: niliang000/iotjs
set_global_vars(option)

# clean build directory.
if option.clean:
    print_progress('Clear build directory')
    fs.rmtree(build_root)
    fs.rmtree(host_build_root)

create_build_directories(option)

# Perform tidy check.
print_progress('Tidy checking')
if not option.no_check_tidy:
    if not check_tidy(path.PROJECT_ROOT):
        ex.fail("Failed check_tidy")

# Anazlye module dependency
print_progress('Analyze module dependency')
if not analyze_module_dependency(option):
    ex.fail('Failed to analyze module dependency')

# Perform init-submodule.
print_progress('Initialize submodules')
if not option.no_init_submodule:
    init_submodule()

# make build directory.
print_progress('Create build directory')
fs.maybe_make_directory(build_root)