コード例 #1
0
    def __init__(self, suite, name, deps, workingSets, **kwargs):
        subDir = 'src'
        srcDirs = ['patches']
        d = mx.join(suite.dir, subDir, name)
        super(LibffiBuilderProject, self).__init__(suite, name, subDir, srcDirs, deps, workingSets, d, **kwargs)

        self.out_dir = self.get_output_root()
        if mx.get_os() != 'windows':
            class LibtoolNativeProject(mx.NativeProject):
                def getArchivableResults(self, use_relpath=True, single=False):
                    for file_path, archive_path in super(LibtoolNativeProject, self).getArchivableResults(use_relpath):
                        path_in_lt_objdir = mx.basename(mx.dirname(file_path)) == '.libs'
                        yield file_path, mx.basename(archive_path) if path_in_lt_objdir else archive_path
                        if single:
                            assert path_in_lt_objdir, 'the first build result must be from LT_OBJDIR'
                            break

            self.delegate = LibtoolNativeProject(suite, name, subDir, [], [], None,
                                                 ['.libs/libffi.a',
                                                  'include/ffi.h',
                                                  'include/ffitarget.h'],
                                                 mx.join(self.out_dir, 'libffi-build'),
                                                 mx.join(self.out_dir, 'libffi-3.2.1'))
            self.delegate.buildEnv = dict(
                SOURCES=mx.basename(self.delegate.dir),
                OUTPUT=mx.basename(self.delegate.getOutput()),
                CONFIGURE_ARGS=' '.join([
                    '--disable-dependency-tracking',
                    '--disable-shared',
                    '--with-pic',
                    'CFLAGS="{}"'.format(' '.join(
                        ['-g'] + (['-m64'] if mx.get_os() == 'solaris' else [])
                    )),
                ])
            )
コード例 #2
0
 def getArchivableResults(self, use_relpath=True, single=False):
     for file_path, archive_path in super(LibtoolNativeProject, self).getArchivableResults(use_relpath):
         path_in_lt_objdir = mx.basename(mx.dirname(file_path)) == '.libs'
         yield file_path, mx.basename(archive_path) if path_in_lt_objdir else archive_path
         if single:
             assert path_in_lt_objdir, 'the first build result must be from LT_OBJDIR'
             break
コード例 #3
0
    def __init__(self, suite, name, deps, workingSets, **kwargs):
        subDir = 'src'
        srcDirs = ['patches']
        d = mx.join(suite.dir, subDir, name)
        super(LibffiBuilderProject, self).__init__(suite, name, subDir, srcDirs, deps, workingSets, d, **kwargs)

        self.out_dir = self.get_output_root()
        if mx.get_os() == 'windows':
            self.delegate = mx_native.DefaultNativeProject(suite, name, subDir, [], [], None,
                                                           mx.join(self.out_dir, 'libffi-3.2.1'),
                                                           theLicense=None,
                                                           kind='static_lib',
                                                           cflags=['-MD', '-O2'])
            self.delegate._source = dict(tree=['include',
                                               'src',
                                               mx.join('src', 'x86')],
                                         files={'.h': [mx.join('include', 'ffi.h'),
                                                       mx.join('include', 'ffitarget.h'),
                                                       mx.join('src', 'fficonfig.h'),
                                                       mx.join('src', 'ffi_common.h')],
                                                '.c': [mx.join('src', 'closures.c'),
                                                       mx.join('src', 'java_raw_api.c'),
                                                       mx.join('src', 'prep_cif.c'),
                                                       mx.join('src', 'raw_api.c'),
                                                       mx.join('src', 'types.c'),
                                                       mx.join('src', 'x86', 'ffi.c')],
                                                '.S': [mx.join('src', 'x86', 'win64.S')]})
        else:
            class LibtoolNativeProject(mx.NativeProject):
                def getArchivableResults(self, use_relpath=True, single=False):
                    for file_path, archive_path in super(LibtoolNativeProject, self).getArchivableResults(use_relpath):
                        path_in_lt_objdir = mx.basename(mx.dirname(file_path)) == '.libs'
                        yield file_path, mx.basename(archive_path) if path_in_lt_objdir else archive_path
                        if single:
                            assert path_in_lt_objdir, 'the first build result must be from LT_OBJDIR'
                            break

            self.delegate = LibtoolNativeProject(suite, name, subDir, [], [], None,
                                                 ['.libs/libffi.a',
                                                  'include/ffi.h',
                                                  'include/ffitarget.h'],
                                                 mx.join(self.out_dir, 'libffi-build'),
                                                 mx.join(self.out_dir, 'libffi-3.2.1'))
            self.delegate.buildEnv = dict(
                SOURCES=mx.basename(self.delegate.dir),
                OUTPUT=mx.basename(self.delegate.getOutput()),
                CONFIGURE_ARGS=' '.join([
                    '--disable-dependency-tracking',
                    '--disable-shared',
                    '--with-pic',
                    'CFLAGS="{}"'.format(' '.join(
                        ['-g', '-O3'] + (['-m64'] if mx.get_os() == 'solaris' else [])
                    )),
                ])
            )

        # pylint: disable=access-member-before-definition
        assert len(self.buildDependencies) == 1, '{} must depend only on its sources'.format(self.name)
        self.buildDependencies += getattr(self.delegate, 'buildDependencies', [])
コード例 #4
0
    def _archivable_results(self, target_arch, use_relpath, single):
        out_dir_arch = self._install_dir
        for file_path in self.getResults():
            assert not mx.isabs(file_path)
            abs_path = mx.join(out_dir_arch, file_path)
            archive_path = file_path if use_relpath else mx.basename(file_path)

            # if test.skip exists the test should be skipped
            if mx.exists(mx.join(mx.dirname(abs_path), "test.skip")):
                continue

            yield abs_path, archive_path
コード例 #5
0
ファイル: mx_native.py プロジェクト: stiansols/mx
    def build(self):
        if not mx.exists(self._manifest) \
                or self._reason is None \
                or mx.basename(self._manifest) in self._reason \
                or 'phony' in self._reason:
            with mx.SafeFileCreation(self._manifest) as sfc:
                self.subject.generate_manifest(sfc.tmpPath)

                if mx.exists(self._manifest) \
                        and not filecmp.cmp(self._manifest, sfc.tmpPath, shallow=False):
                    self.ninja.clean()

        self.ninja.build()
コード例 #6
0
ファイル: mx_truffle.py プロジェクト: cliid/graal
    def __init__(self, suite, name, deps, workingSets, **kwargs):
        subDir = 'src'
        srcDirs = ['patches']
        d = mx.join(suite.dir, subDir, name)
        super(LibffiBuilderProject,
              self).__init__(suite, name, subDir, srcDirs, deps, workingSets,
                             d, **kwargs)

        self.out_dir = self.get_output_root()
        if mx.get_os() == 'windows':
            self.delegate = mx_native.DefaultNativeProject(
                suite,
                name,
                subDir, [], [],
                None,
                mx.join(self.out_dir, 'libffi-3.3'),
                'static_lib',
                deliverable='ffi',
                cflags=['-MD', '-O2', '-DFFI_BUILDING_DLL'])
            self.delegate._source = dict(
                tree=['include', 'src',
                      mx.join('src', 'x86')],
                files={
                    '.h': [
                        mx.join('include', 'ffi.h'),
                        mx.join('include', 'ffitarget.h'),
                        mx.join('src', 'fficonfig.h'),
                        mx.join('src', 'ffi_common.h')
                    ],
                    '.c': [
                        mx.join('src', 'closures.c'),
                        mx.join('src', 'prep_cif.c'),
                        mx.join('src', 'raw_api.c'),
                        mx.join('src', 'types.c'),
                        mx.join('src', 'x86', 'ffiw64.c')
                    ],
                    '.S': [mx.join('src', 'x86', 'win64_intel.S')]
                })
        else:

            class LibtoolNativeProject(
                    mx.NativeProject,  # pylint: disable=too-many-ancestors
                    mx_native.NativeDependency):
                include_dirs = property(
                    lambda self: [mx.join(self.getOutput(), 'include')])
                libs = property(
                    lambda self:
                    [next(self.getArchivableResults(single=True))[0]])

                def getArchivableResults(self, use_relpath=True, single=False):
                    for file_path, archive_path in super(
                            LibtoolNativeProject,
                            self).getArchivableResults(use_relpath):
                        path_in_lt_objdir = mx.basename(
                            mx.dirname(file_path)) == '.libs'
                        yield file_path, mx.basename(
                            archive_path
                        ) if path_in_lt_objdir else archive_path
                        if single:
                            assert path_in_lt_objdir, 'the first build result must be from LT_OBJDIR'
                            break

            self.delegate = LibtoolNativeProject(
                suite, name, subDir, [], [], None,
                ['.libs/libffi.a', 'include/ffi.h', 'include/ffitarget.h'],
                mx.join(self.out_dir, 'libffi-build'),
                mx.join(self.out_dir, 'libffi-3.3'))
            self.delegate.buildEnv = dict(
                SOURCES=mx.basename(self.delegate.dir),
                OUTPUT=mx.basename(self.delegate.getOutput()),
                CONFIGURE_ARGS=' '.join([
                    '--disable-dependency-tracking',
                    '--disable-shared',
                    '--with-pic',
                    'CFLAGS="{}"'.format(' '.join(['-g', '-O3'] + (
                        ['-m64'] if mx.get_os() == 'solaris' else []))),
                    'CPPFLAGS="-DNO_JAVA_RAW_API"',
                ]))

        self.include_dirs = self.delegate.include_dirs
        self.libs = self.delegate.libs
コード例 #7
0
 def result(base_dir, file_path):
     assert not mx.isabs(file_path)
     archive_path = file_path if use_relpath else mx.basename(file_path)
     return mx.join(base_dir, file_path), archive_path
コード例 #8
0
ファイル: mx_native.py プロジェクト: multi-os-engine/mx
 def add_debug_prefix(prefix_dir):
     return '-fdebug-prefix-map={}={}'.format(
         prefix_dir, mx.basename(prefix_dir))
コード例 #9
0
            def add_debug_prefix(prefix_dir):
                def quote(path):
                    return '"{}"'.format(path) if ' ' in path else path

                return '-fdebug-prefix-map={}={}'.format(
                    quote(prefix_dir), quote(mx.basename(prefix_dir)))