Checks if ldflag contains a filename and if so remaps it from gyp-directory-relative to build-directory-relative.
(self, ldflag, gyp_to_build_path)
| 861 | return install_name |
| 862 | |
| 863 | def _MapLinkerFlagFilename(self, ldflag, gyp_to_build_path): |
| 864 | """Checks if ldflag contains a filename and if so remaps it from |
| 865 | gyp-directory-relative to build-directory-relative.""" |
| 866 | # This list is expanded on demand. |
| 867 | # They get matched as: |
| 868 | # -exported_symbols_list file |
| 869 | # -Wl,exported_symbols_list file |
| 870 | # -Wl,exported_symbols_list,file |
| 871 | LINKER_FILE = r"(\S+)" |
| 872 | WORD = r"\S+" |
| 873 | linker_flags = [ |
| 874 | ["-exported_symbols_list", LINKER_FILE], # Needed for NaCl. |
| 875 | ["-unexported_symbols_list", LINKER_FILE], |
| 876 | ["-reexported_symbols_list", LINKER_FILE], |
| 877 | ["-sectcreate", WORD, WORD, LINKER_FILE], # Needed for remoting. |
| 878 | ] |
| 879 | for flag_pattern in linker_flags: |
| 880 | regex = re.compile("(?:-Wl,)?" + "[ ,]".join(flag_pattern)) |
| 881 | m = regex.match(ldflag) |
| 882 | if m: |
| 883 | ldflag = ( |
| 884 | ldflag[: m.start(1)] |
| 885 | + gyp_to_build_path(m.group(1)) |
| 886 | + ldflag[m.end(1) :] |
| 887 | ) |
| 888 | # Required for ffmpeg (no idea why they don't use LIBRARY_SEARCH_PATHS, |
| 889 | # TODO(thakis): Update ffmpeg.gyp): |
| 890 | if ldflag.startswith("-L"): |
| 891 | ldflag = "-L" + gyp_to_build_path(ldflag[len("-L") :]) |
| 892 | return ldflag |
| 893 | |
| 894 | def GetLdflags(self, configname, product_dir, gyp_to_build_path, arch=None): |
| 895 | """Returns flags that need to be passed to the linker. |