Esempio n. 1
0
    def _build_iotjs(self, profile, extra_flags):
        '''
        Build IoT.js for Tizen target.
        '''
        iotjs = self.env['modules']['iotjs']

        profiles = {
            'minimal': 'profiles/minimal.profile',
            'target': 'test/profiles/tizen.profile'
        }

        build_flags = [
            '--clean', '--no-parallel-build', '--no-init-submodule',
            '--target-arch=noarch', '--target-os=tizen', '--target-board=rpi3',
            '--profile=%s' % profiles[profile],
            '--buildtype=%s' % self.env['info']['buildtype']
        ] + extra_flags

        iotjs_build_options = ' '.join(build_flags)
        # Note: these values should be defined for GBS, because
        #       it will compile the IoT.js itself.
        utils.define_environment('IOTJS_BUILD_OPTION', iotjs_build_options)

        args = ['--clean']

        if self.env['info']['buildtype'] == 'debug':
            args.append('--debug')

        utils.execute(iotjs['src'], 'config/tizen/gbsbuild.sh', args)

        tizen_build_dir = utils.join(paths.GBS_IOTJS_PATH, 'build')
        iotjs_build_dir = utils.join(iotjs['src'], 'build')
        # Copy the GBS created binaries to the iotjs build folder.
        # Note: GBS compiles iotjs in the GBS folder.
        utils.copy(tizen_build_dir, iotjs_build_dir)
Esempio n. 2
0
    def _build_jerryscript(self, profile, extra_flags):
        '''
        Build JerryScript for NuttX target.
        '''
        nuttx = self.env['modules']['nuttx']
        jerry = self.env['modules']['jerryscript']

        profiles = {
            'minimal': jerry['paths']['minimal-profile'],
            'target': jerry['paths']['es2015-subset-profile']
        }

        build_flags = [
            '--clean', '--lto=OFF', '--jerry-cmdline=OFF', '--jerry-libc=OFF',
            '--jerry-libm=ON', '--all-in-one=OFF', '--mem-heap=70',
            '--profile=%s' % profiles[profile],
            '--toolchain=%s' % jerry['paths']['stm32f4dis-toolchain'],
            '--compile-flag=-I%s' % jerry['paths']['stm32f4dis-target'],
            '--compile-flag=-isystem %s' % nuttx['paths']['include']
        ] + extra_flags

        # NuttX requires the path of the used JerryScript folder.
        utils.define_environment('JERRYSCRIPT_ROOT_DIR', jerry['src'])

        utils.execute(jerry['src'], 'tools/build.py', build_flags)
Esempio n. 3
0
    def _build_iotjs(self, profile, extra_flags):
        '''
        Build IoT.js for NuttX target.
        '''
        iotjs = self.env['modules']['iotjs']
        nuttx = self.env['modules']['nuttx']

        profiles = {
            'minimal': iotjs['paths']['minimal-profile'],
            'target': iotjs['paths']['nuttx-profile']
        }

        build_flags = [
            '--clean', '--no-parallel-build', '--no-init-submodule',
            '--target-arch=arm', '--target-os=nuttx',
            '--target-board=stm32f4dis', '--jerry-heaplimit=64',
            '--profile=%s' % profiles[profile],
            '--buildtype=%s' % self.env['info']['buildtype'],
            '--nuttx-home=%s' % nuttx['src']
        ] + extra_flags

        # NuttX requires the path of the used IoT.js folder.
        utils.define_environment('IOTJS_ROOT_DIR', iotjs['src'])

        utils.execute(iotjs['src'], 'tools/build.py', build_flags)
Esempio n. 4
0
    def _build_iotjs(self, profile, extra_flags):
        '''
        Build IoT.js for TizenRT target.
        '''
        iotjs = self.env['modules']['iotjs']

        profiles = {
            'minimal': iotjs['paths']['minimal-profile'],
            'target': iotjs['paths']['tizenrt-profile']
        }

        if extra_flags and self.env['info']['coverage']:
            tizenrt = self.env['modules']['tizenrt']
            extra_flags.append('--jerry-cmake-param=-DJERRY_PORT_DEFAULT=ON')
            extra_flags.append('--compile-flag="-isystem %s"' %
                               tizenrt['paths']['include'])

        build_flags = [
            '--clean',
            '--no-parallel-build',
            '--no-init-submodule',
            '--target-arch=arm',
            '--target-os=tizenrt',
            '--target-board=artik05x',
            '--profile=%s' % profiles[profile],
            '--buildtype=%s' % self.env['info']['buildtype'],
        ] + extra_flags

        iotjs_build_options = ' '.join(build_flags)
        # Note: these values should be defined for TizenRT, because
        #       it will compile the IoT.js itself.
        utils.define_environment('IOTJS_BUILD_OPTION', iotjs_build_options)

        # TizenRT requires the path of the used IoT.js folder.
        utils.define_environment('IOTJS_ROOT_DIR', iotjs['src'])
Esempio n. 5
0
    def _build_jerryscript(self, profile, extra_flags):
        '''
        Build JerryScript for TizenRT target.
        '''
        tizenrt = self.env['modules']['tizenrt']
        jerry = self.env['modules']['jerryscript']

        profiles = {
            'minimal': jerry['paths']['minimal-profile'],
            'target': jerry['paths']['es2015-subset-profile']
        }

        build_flags = [
            '--clean', '--lto=OFF', '--jerry-cmdline=OFF', '--jerry-libc=OFF',
            '--jerry-libm=ON', '--all-in-one=OFF', '--mem-heap=70',
            '--profile=%s' % profiles[profile],
            '--toolchain=%s' % jerry['paths']['artik053-toolchain'],
            '--compile-flag=-isystem %s' % tizenrt['paths']['include']
        ] + extra_flags

        if self.env['info']['buildtype'] == 'debug':
            build_flags.append('--debug')

        # TizenRT requires the path of the used JerryScript folder.
        utils.define_environment('JERRYSCRIPT_ROOT_DIR', jerry['src'])

        utils.execute(jerry['src'], 'tools/build.py', build_flags)
Esempio n. 6
0
    def _build_nuttx(self):
        '''
        Build the NuttX Operating System.
        '''
        nuttx = self.env['modules']['nuttx']
        buildtype = self.env['info']['buildtype']

        utils.define_environment('R', int(buildtype == 'release'))
        utils.define_environment('EXTRA_LIBS', '-Map=nuttx.map')

        # Provide test files as ROMFS content.
        self._append_testfiles()

        utils.execute(nuttx['src'], 'make', ['-j1'])
Esempio n. 7
0
    def _build_freya(self):
        '''
        Cross-compile Valgrind and its Freya tool.
        '''
        build_dir = utils.join(self.env['paths']['build'], 'valgrind_freya')
        valgrind_files = [
            'vg-in-place', 'coregrind/valgrind', '.in_place/freya-arm-linux',
            '.in_place/vgpreload_core-arm-linux.so',
            '.in_place/vgpreload_freya-arm-linux.so'
        ]

        # Check if a Freya build already exists, if yes, skip the build.
        if utils.exist_files(build_dir, valgrind_files):
            return

        freya = self.env['modules']['freya']

        utils.define_environment('LD', 'arm-linux-gnueabihf-ld')
        utils.define_environment('AR', 'arm-linux-gnueabihf-ar')
        utils.define_environment('CC', 'arm-linux-gnueabihf-gcc')
        utils.define_environment('CPP', 'arm-linux-gnueabihf-cpp')
        utils.define_environment('CXX', 'arm-linux-gnueabihf-g++')

        configure_options = ['--host=armv7-linux-gnueabihf']

        utils.execute(freya['src'], './autogen.sh')
        utils.execute(freya['src'], './configure', configure_options)
        utils.execute(freya['src'], 'make', ['clean'])
        utils.execute(freya['src'], 'make', ['TOOLS=freya'])

        utils.unset_environment('LD')
        utils.unset_environment('AR')
        utils.unset_environment('CC')
        utils.unset_environment('CPP')
        utils.unset_environment('CXX')

        # Copy necessary files into the output directory.
        for valgrind_file in valgrind_files:
            src = utils.join(freya['src'], valgrind_file)
            dst = utils.join(build_dir, valgrind_file)

            utils.copy(src, dst)
Esempio n. 8
0
def push_environment(**params):
    '''
    Define the environment variables globally, not just for a process.
    '''
    for key, value in params['env'].iteritems():
        utils.define_environment(key, value)