Filter the 'libraries' key to separate things that shouldn't be ldflags. Library entries that look like filenames should be converted to android module names instead of being passed to the linker as flags. Args: libraries: the value of spec.get('libraries')
(self, libraries)
| 779 | return (clean_cflags, include_paths) |
| 780 | |
| 781 | def FilterLibraries(self, libraries): |
| 782 | """Filter the 'libraries' key to separate things that shouldn't be ldflags. |
| 783 | |
| 784 | Library entries that look like filenames should be converted to android |
| 785 | module names instead of being passed to the linker as flags. |
| 786 | |
| 787 | Args: |
| 788 | libraries: the value of spec.get('libraries') |
| 789 | Returns: |
| 790 | A tuple (static_lib_modules, dynamic_lib_modules, ldflags) |
| 791 | """ |
| 792 | static_lib_modules = [] |
| 793 | dynamic_lib_modules = [] |
| 794 | ldflags = [] |
| 795 | for libs in libraries: |
| 796 | # Libs can have multiple words. |
| 797 | for lib in libs.split(): |
| 798 | # Filter the system libraries, which are added by default by the Android |
| 799 | # build system. |
| 800 | if ( |
| 801 | lib == "-lc" |
| 802 | or lib == "-lstdc++" |
| 803 | or lib == "-lm" |
| 804 | or lib.endswith("libgcc.a") |
| 805 | ): |
| 806 | continue |
| 807 | match = re.search(r"([^/]+)\.a$", lib) |
| 808 | if match: |
| 809 | static_lib_modules.append(match.group(1)) |
| 810 | continue |
| 811 | match = re.search(r"([^/]+)\.so$", lib) |
| 812 | if match: |
| 813 | dynamic_lib_modules.append(match.group(1)) |
| 814 | continue |
| 815 | if lib.startswith("-l"): |
| 816 | ldflags.append(lib) |
| 817 | return (static_lib_modules, dynamic_lib_modules, ldflags) |
| 818 | |
| 819 | def ComputeDeps(self, spec): |
| 820 | """Compute the dependencies of a gyp spec. |
no test coverage detected