Ticket #62391: patch-fix-scanner-in-build-execution.diff

File patch-fix-scanner-in-build-execution.diff, 3.4 KB (added by VinDuv, 4 years ago)
  • giscanner/ccompiler.py

    old new  
    184184        if os.name == 'nt':
    185185            runtime_path_envvar = ['LIB', 'PATH']
    186186        else:
    187             runtime_path_envvar = ['LD_LIBRARY_PATH', 'DYLD_FALLBACK_LIBRARY_PATH']
     187            if sys.platform == "darwin":
     188                runtime_path_envvar = ['DYLD_LIBRARY_PATH']
     189            else:
     190                runtime_path_envvar = ['LD_LIBRARY_PATH']
    188191            # Search the current directory first
    189192            # (This flag is not supported nor needed for Visual C++)
    190193            args.append('-L.')
  • giscanner/dumper.py

    old new  
    236236
    237237        args.extend(sources)
    238238
    239         pkg_config_libs = pkgconfig.libs(self._packages,
    240                                          msvc_syntax=self._compiler.check_is_msvc())
     239        pkg_config_libs, pkg_config_libs_only_L = pkgconfig.libs(
     240            self._packages, msvc_syntax=self._compiler.check_is_msvc())
     241        this_L = [lib[len('-L'):] for lib in pkg_config_libs_only_L]
     242
     243        # uniquely merge pkg_config and options library paths
     244        # set() returns them in random order, so sort them for predictiveness
     245        library_paths = sorted (set().union (self._options.library_paths,
     246                                                         this_L))
     247
     248        # remove anything in LIBRARY_PATH
     249        env_LIBRARY_PATH = os.environ['LIBRARY_PATH'].split(':') if \
     250            'LIBRARY_PATH' in os.environ else []
     251        library_paths = [l for l in library_paths if l not in env_LIBRARY_PATH]
     252
     253        if os.name == 'nt':
     254            runtime_path_envvar = ['LIB', 'PATH']
     255        else:
     256            runtime_path_envvar = ['LIBRARY_PATH']
     257        for envvar in runtime_path_envvar:
     258            os.environ[envvar] = os.pathsep.join \
     259                (sorted (set().union (os.environ[envvar].split(':'), this_L))) \
     260                    if envvar in os.environ else os.pathsep.join(this_L)
    241261
    242262        if not self._options.external_library:
    243263            self._compiler.get_internal_link_flags(args,
    244264                                                   libtool,
    245265                                                   self._options.libraries,
    246266                                                   self._options.extra_libraries,
    247                                                    self._options.library_paths)
     267                                                   library_paths)
    248268            args.extend(pkg_config_libs)
    249269
    250270        else:
  • giscanner/pkgconfig.py

    old new  
    5252
    5353def libs(packages, msvc_syntax=False, ignore_errors=True, command=None):
    5454    flags = ['--msvc-syntax'] if msvc_syntax else []
    55     flags.append('--libs')
     55    flags.append('--libs-only-l')
     56    flags.append('--libs-only-other')
    5657    flags.extend(packages)
    57     out = check_output(flags, ignore_errors, command)
    58     return shlex.split(out)
     58    out_libs_only_not_L = shlex.split(check_output(flags, ignore_errors, command))
     59    flags = ['--msvc-syntax'] if msvc_syntax else []
     60    flags.append('--libs-only-L')
     61    flags.extend(packages)
     62    out_libs_only_L = shlex.split(check_output(flags, ignore_errors, command))
     63    return out_libs_only_not_L, out_libs_only_L