Ejemplo n.º 1
0
 def __init__(self, exelist, version, gcc_type, is_cross, exe_wrap):
     CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap)
     self.id = 'gcc'
     self.gcc_type = gcc_type
     if mesonlib.version_compare(version, ">=4.9.0"):
         GnuCPPCompiler.std_warn_args= GnuCPPCompiler.new_warn
     else:
         GnuCPPCompiler.std_warn_args = GnuCPPCompiler.old_warn
Ejemplo n.º 2
0
    def __init__(self, name, kwargs):
        required = kwargs.get('required', True)
        Dependency.__init__(self)
        self.name = name
        if PkgConfigDependency.pkgconfig_found is None:
            self.check_pkgconfig()

        if not PkgConfigDependency.pkgconfig_found:
            raise DependencyException('Pkg-config not found.')
        self.is_found = False
        p = subprocess.Popen(['pkg-config', '--modversion', name],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
        out = p.communicate()[0]
        if p.returncode != 0:
            mlog.log('Dependency', name, 'found:', mlog.red('NO'))
            if required:
                raise DependencyException('Required dependency %s not found.' %
                                          name)
            self.modversion = 'none'
            self.cargs = []
            self.libs = []
        else:
            self.modversion = out.decode().strip()
            mlog.log('Dependency', mlog.bold(name), 'found:',
                     mlog.green('YES'), self.modversion)
            version_requirement = kwargs.get('version', None)
            if version_requirement is None:
                self.is_found = True
            else:
                if not isinstance(version_requirement, str):
                    raise DependencyException(
                        'Version argument must be string.')
                self.is_found = mesonlib.version_compare(
                    self.modversion, version_requirement)
                if not self.is_found and required:
                    raise DependencyException(
                        'Invalid version of a dependency, needed %s %s found %s.'
                        % (name, version_requirement, self.modversion))
            if not self.is_found:
                return
            p = subprocess.Popen(['pkg-config', '--cflags', name],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate cargs for %s.' % name)
            self.cargs = out.decode().split()

            p = subprocess.Popen(['pkg-config', '--libs', name],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate libs for %s.' % name)
            self.libs = out.decode().split()
Ejemplo n.º 3
0
    def __init__(self, name, kwargs):
        required = kwargs.get('required', True)
        Dependency.__init__(self)
        self.name = name
        if PkgConfigDependency.pkgconfig_found is None:
            self.check_pkgconfig()

        if not PkgConfigDependency.pkgconfig_found:
            raise DependencyException('Pkg-config not found.')
        self.is_found = False
        p = subprocess.Popen(['pkg-config', '--modversion', name], stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
        out = p.communicate()[0]
        if p.returncode != 0:
            mlog.log('Dependency', name, 'found:', mlog.red('NO'))
            if required:
                raise DependencyException('Required dependency %s not found.' % name)
            self.modversion = 'none'
            self.cargs = []
            self.libs = []
        else:
            self.modversion = out.decode().strip()
            mlog.log('Dependency', mlog.bold(name), 'found:', mlog.green('YES'), self.modversion)
            version_requirement = kwargs.get('version', None)
            if version_requirement is None:
                self.is_found = True
            else:
                if not isinstance(version_requirement, str):
                    raise DependencyException('Version argument must be string.')
                self.is_found = mesonlib.version_compare(self.modversion, version_requirement)
                if not self.is_found and required:
                    raise DependencyException('Invalid version of a dependency, needed %s %s found %s.' % (name, version_requirement, self.modversion))
            if not self.is_found:
                return
            p = subprocess.Popen(['pkg-config', '--cflags', name], stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate cargs for %s.' % name)
            self.cargs = out.decode().split()

            p = subprocess.Popen(['pkg-config', '--libs', name], stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate libs for %s.' % name)
            self.libs = out.decode().split()
Ejemplo n.º 4
0
    def __init__(self, environment, kwargs):
        Dependency.__init__(self)
        if WxDependency.wx_found is None:
            self.check_wxconfig()

        if not WxDependency.wx_found:
            raise DependencyException('Wx-config not found.')
        self.is_found = False
        p = subprocess.Popen([self.wxc, '--version'],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
        out = p.communicate()[0]
        if p.returncode != 0:
            mlog.log('Dependency wxwidgets found:', mlog.red('NO'))
            self.cargs = []
            self.libs = []
        else:
            self.modversion = out.decode().strip()
            version_req = kwargs.get('version', None)
            if version_req is not None:
                if not mesonlib.version_compare(self.modversion, version_req):
                    mlog.log('Wxwidgets version %s does not fullfill requirement %s' %\
                             (self.modversion, version_req))
                    return
            mlog.log('Dependency wxwidgets found:', mlog.green('YES'))
            self.is_found = True
            self.requested_modules = self.get_requested(kwargs)
            # wx-config seems to have a cflags as well but since it requires C++,
            # this should be good, at least for now.
            p = subprocess.Popen([self.wxc, '--cxxflags'],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate cargs for wxwidgets.')
            self.cargs = out.decode().split()

            p = subprocess.Popen([self.wxc, '--libs'] + self.requested_modules,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate libs for wxwidgets.')
            self.libs = out.decode().split()
Ejemplo n.º 5
0
    def __init__(self, environment, kwargs):
        Dependency.__init__(self)
        if WxDependency.wx_found is None:
            self.check_wxconfig()

        if not WxDependency.wx_found:
            raise DependencyException('Wx-config not found.')
        self.is_found = False
        p = subprocess.Popen([self.wxc, '--version'],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
        out = p.communicate()[0]
        if p.returncode != 0:
            mlog.log('Dependency wxwidgets found:', mlog.red('NO'))
            self.cargs = []
            self.libs = []
        else:
            self.modversion = out.decode().strip()
            version_req = kwargs.get('version', None)
            if version_req is not None:
                if not mesonlib.version_compare(self.modversion, version_req):
                    mlog.log('Wxwidgets version %s does not fullfill requirement %s' %\
                             (self.modversion, version_req))
                    return
            mlog.log('Dependency wxwidgets found:', mlog.green('YES'))
            self.is_found = True
            self.requested_modules = self.get_requested(kwargs)
            # wx-config seems to have a cflags as well but since it requires C++,
            # this should be good, at least for now.
            p = subprocess.Popen([self.wxc, '--cxxflags'],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate cargs for wxwidgets.')
            self.cargs = out.decode().split()

            p = subprocess.Popen([self.wxc, '--libs'] + self.requested_modules,
                                 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate libs for wxwidgets.')
            self.libs = out.decode().split()
Ejemplo n.º 6
0
    def __init__(self, name, environment, kwargs):
        Dependency.__init__(self)
        self.required = kwargs.get("required", True)
        if "native" in kwargs and environment.is_cross_build():
            want_cross = not kwargs["native"]
        else:
            want_cross = environment.is_cross_build()
        self.name = name
        if PkgConfigDependency.pkgconfig_found is None:
            self.check_pkgconfig()

        self.is_found = False
        if not PkgConfigDependency.pkgconfig_found:
            if self.required:
                raise DependencyException("Pkg-config not found.")
            self.cargs = []
            self.libs = []
            return
        if environment.is_cross_build() and want_cross:
            if "pkgconfig" not in environment.cross_info:
                raise DependencyException("Pkg-config binary missing from cross file.")
            pkgbin = environment.cross_info["pkgconfig"]
            self.type_string = "Cross"
        else:
            pkgbin = "pkg-config"
            self.type_string = "Native"

        self.pkgbin = pkgbin
        p = subprocess.Popen([pkgbin, "--modversion", name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out = p.communicate()[0]
        if p.returncode != 0:
            if self.required:
                raise DependencyException("%s dependency %s not found." % (self.type_string, name))
            self.modversion = "none"
            self.cargs = []
            self.libs = []
        else:
            self.modversion = out.decode().strip()
            mlog.log("%s dependency" % self.type_string, mlog.bold(name), "found:", mlog.green("YES"), self.modversion)
            version_requirement = kwargs.get("version", None)
            if version_requirement is None:
                self.is_found = True
            else:
                if not isinstance(version_requirement, str):
                    raise DependencyException("Version argument must be string.")
                self.is_found = mesonlib.version_compare(self.modversion, version_requirement)
                if not self.is_found and self.required:
                    raise DependencyException(
                        "Invalid version of a dependency, needed %s %s found %s."
                        % (name, version_requirement, self.modversion)
                    )
            if not self.is_found:
                return
            p = subprocess.Popen([pkgbin, "--cflags", name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError("Could not generate cargs for %s." % name)
            self.cargs = out.decode().split()

            p = subprocess.Popen([pkgbin, "--libs", name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError("Could not generate libs for %s." % name)
            self.libs = []
            for lib in out.decode().split():
                if lib.endswith(".la"):
                    shared_libname = self.extract_libtool_shlib(lib)
                    shared_lib = os.path.join(os.path.dirname(lib), shared_libname)
                    if not os.path.exists(shared_lib):
                        shared_lib = os.path.join(os.path.dirname(lib), ".libs", shared_libname)

                    if not os.path.exists(shared_lib):
                        raise RuntimeError(
                            'Got a libtools specific "%s" dependencies'
                            "but we could not compute the actual shared"
                            "library path" % lib
                        )
                    lib = shared_lib

                self.libs.append(lib)
Ejemplo n.º 7
0
    def __init__(self, name, environment, kwargs):
        Dependency.__init__(self)
        self.required = kwargs.get('required', True)
        if 'native' in kwargs and environment.is_cross_build():
            want_cross = not kwargs['native']
        else:
            want_cross = environment.is_cross_build()
        self.name = name
        if PkgConfigDependency.pkgconfig_found is None:
            self.check_pkgconfig()

        self.is_found = False
        if not PkgConfigDependency.pkgconfig_found:
            if self.required:
                raise DependencyException('Pkg-config not found.')
            self.cargs = []
            self.libs = []
            return
        if environment.is_cross_build() and want_cross:
            if "pkgconfig" not in environment.cross_info.config["binaries"]:
                raise DependencyException('Pkg-config binary missing from cross file.')
            pkgbin = environment.cross_info.config["binaries"]['pkgconfig']
            self.type_string = 'Cross'
        else:
            pkgbin = 'pkg-config'
            self.type_string = 'Native'

        self.pkgbin = pkgbin
        p = subprocess.Popen([pkgbin, '--modversion', name],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
        out = p.communicate()[0]
        if p.returncode != 0:
            if self.required:
                raise DependencyException('%s dependency %s not found.' % (self.type_string, name))
            self.modversion = 'none'
            self.cargs = []
            self.libs = []
        else:
            self.modversion = out.decode().strip()
            mlog.log('%s dependency' % self.type_string, mlog.bold(name), 'found:',
                     mlog.green('YES'), self.modversion)
            self.version_requirement = kwargs.get('version', None)
            if self.version_requirement is None:
                self.is_found = True
            else:
                if not isinstance(self.version_requirement, str):
                    raise DependencyException('Version argument must be string.')
                self.is_found = mesonlib.version_compare(self.modversion, self.version_requirement)
                if not self.is_found and self.required:
                    raise DependencyException(
                        'Invalid version of a dependency, needed %s %s found %s.' %
                        (name, self.version_requirement, self.modversion))
            if not self.is_found:
                return
            p = subprocess.Popen([pkgbin, '--cflags', name], stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate cargs for %s.' % name)
            self.cargs = out.decode().split()

            p = subprocess.Popen([pkgbin, '--libs', name], stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate libs for %s.' % name)
            self.libs = []
            for lib in out.decode().split():
                if lib.endswith(".la"):
                    shared_libname = self.extract_libtool_shlib(lib)
                    shared_lib = os.path.join(os.path.dirname(lib), shared_libname)
                    if not os.path.exists(shared_lib):
                        shared_lib = os.path.join(os.path.dirname(lib), ".libs", shared_libname)

                    if not os.path.exists(shared_lib):
                        raise RuntimeError('Got a libtools specific "%s" dependencies'
                                           'but we could not compute the actual shared'
                                           'library path' % lib)
                    lib = shared_lib

                self.libs.append(lib)
Ejemplo n.º 8
0
    def __init__(self, name, kwargs):
        required = kwargs.get('required', True)
        Dependency.__init__(self)
        self.name = name
        if PkgConfigDependency.pkgconfig_found is None:
            self.check_pkgconfig()

        self.is_found = False
        if not PkgConfigDependency.pkgconfig_found:
            if required:
                raise DependencyException('Pkg-config not found.')
            self.cargs = []
            self.libs = []
            return
        p = subprocess.Popen(['pkg-config', '--modversion', name], stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
        out = p.communicate()[0]
        if p.returncode != 0:
            if required:
                raise DependencyException('Required dependency %s not found.' % name)
            self.modversion = 'none'
            self.cargs = []
            self.libs = []
        else:
            self.modversion = out.decode().strip()
            mlog.log('Dependency', mlog.bold(name), 'found:', mlog.green('YES'), self.modversion)
            version_requirement = kwargs.get('version', None)
            if version_requirement is None:
                self.is_found = True
            else:
                if not isinstance(version_requirement, str):
                    raise DependencyException('Version argument must be string.')
                self.is_found = mesonlib.version_compare(self.modversion, version_requirement)
                if not self.is_found and required:
                    raise DependencyException('Invalid version of a dependency, needed %s %s found %s.' % (name, version_requirement, self.modversion))
            if not self.is_found:
                return
            p = subprocess.Popen(['pkg-config', '--cflags', name], stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate cargs for %s.' % name)
            self.cargs = out.decode().split()

            p = subprocess.Popen(['pkg-config', '--libs', name], stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate libs for %s.' % name)
            self.libs = []
            for lib in out.decode().split():
                if lib.endswith(".la"):
                    shared_libname = self.__extract_libtool_shlib(lib)
                    shared_lib = os.path.join(os.path.dirname(lib), shared_libname)
                    if not os.path.exists(shared_lib):
                        shared_lib = os.path.join(os.path.dirname(lib), ".libs", shared_libname)

                    if not os.path.exists(shared_lib):
                        raise RuntimeError('Got a libtools specific "%s" dependencies'
                                           'but we could not compute the actual shared'
                                           'library path' % lib)
                    lib = shared_lib

                self.libs.append(lib)
Ejemplo n.º 9
0
    def __init__(self, name, environment, kwargs):
        Dependency.__init__(self)
        self.required = kwargs.get('required', True)
        if 'native' in kwargs and environment.is_cross_build():
            want_cross = not kwargs['native']
        else:
            want_cross = environment.is_cross_build()
        self.name = name
        if PkgConfigDependency.pkgconfig_found is None:
            self.check_pkgconfig()

        self.is_found = False
        if not PkgConfigDependency.pkgconfig_found:
            if self.required:
                raise DependencyException('Pkg-config not found.')
            self.cargs = []
            self.libs = []
            return
        if environment.is_cross_build() and want_cross:
            if "pkgconfig" not in environment.cross_info:
                raise DependencyException(
                    'Pkg-config binary missing from cross file.')
            pkgbin = environment.cross_info['pkgconfig']
            self.type_string = 'Cross'
        else:
            pkgbin = 'pkg-config'
            self.type_string = 'Native'

        self.pkgbin = pkgbin
        p = subprocess.Popen([pkgbin, '--modversion', name],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
        out = p.communicate()[0]
        if p.returncode != 0:
            if self.required:
                raise DependencyException('%s dependency %s not found.' %
                                          (self.type_string, name))
            self.modversion = 'none'
            self.cargs = []
            self.libs = []
        else:
            self.modversion = out.decode().strip()
            mlog.log('%s dependency' % self.type_string, mlog.bold(name),
                     'found:', mlog.green('YES'), self.modversion)
            self.version_requirement = kwargs.get('version', None)
            if self.version_requirement is None:
                self.is_found = True
            else:
                if not isinstance(self.version_requirement, str):
                    raise DependencyException(
                        'Version argument must be string.')
                self.is_found = mesonlib.version_compare(
                    self.modversion, self.version_requirement)
                if not self.is_found and self.required:
                    raise DependencyException(
                        'Invalid version of a dependency, needed %s %s found %s.'
                        % (name, self.version_requirement, self.modversion))
            if not self.is_found:
                return
            p = subprocess.Popen([pkgbin, '--cflags', name],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate cargs for %s.' % name)
            self.cargs = out.decode().split()

            p = subprocess.Popen([pkgbin, '--libs', name],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            out = p.communicate()[0]
            if p.returncode != 0:
                raise RuntimeError('Could not generate libs for %s.' % name)
            self.libs = []
            for lib in out.decode().split():
                if lib.endswith(".la"):
                    shared_libname = self.extract_libtool_shlib(lib)
                    shared_lib = os.path.join(os.path.dirname(lib),
                                              shared_libname)
                    if not os.path.exists(shared_lib):
                        shared_lib = os.path.join(os.path.dirname(lib),
                                                  ".libs", shared_libname)

                    if not os.path.exists(shared_lib):
                        raise RuntimeError(
                            'Got a libtools specific "%s" dependencies'
                            'but we could not compute the actual shared'
                            'library path' % lib)
                    lib = shared_lib

                self.libs.append(lib)