MCPcopy Create free account
hub / github.com/nodejs/node / FilterLibraries

Method FilterLibraries

tools/gyp/pylib/gyp/generator/android.py:781–817  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 1

WriteTargetFlagsMethod · 0.95

Calls 3

splitMethod · 0.45
searchMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected