Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6a26174 authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge "Use --sysroot when compiling against the NDK" into main

parents 27a03c1d 3394e2f2
Loading
Loading
Loading
Loading
+19 −18
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ my_allow_undefined_symbols := true
endif
endif

my_ndk_sysroot_include :=
my_ndk_sysroot :=
my_ndk_sysroot_lib :=
my_api_level := 10000

@@ -207,11 +207,9 @@ ifneq ($(LOCAL_SDK_VERSION),)

  my_built_ndk := $(SOONG_OUT_DIR)/ndk
  my_ndk_triple := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_TRIPLE)
  my_ndk_sysroot_include := \
      $(my_built_ndk)/sysroot/usr/include \
      $(my_built_ndk)/sysroot/usr/include/$(my_ndk_triple) \
  my_ndk_sysroot := $(my_built_ndk)/sysroot

  my_ndk_sysroot_lib := $(my_built_ndk)/sysroot/usr/lib/$(my_ndk_triple)/$(my_ndk_api)
  my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib/$(my_ndk_triple)/$(my_ndk_api)

  # The bionic linker now has support for packed relocations and gnu style
  # hashes (which are much faster!), but shipping to older devices requires
@@ -1628,19 +1626,6 @@ my_ldlibs += $(my_cxx_ldlibs)
###########################################################
ifndef LOCAL_IS_HOST_MODULE

ifeq ($(call module-in-vendor-or-product),true)
  my_target_global_c_includes :=
  my_target_global_c_system_includes := $(TARGET_OUT_HEADERS)
else ifdef LOCAL_SDK_VERSION
  my_target_global_c_includes :=
  my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
else
  my_target_global_c_includes := $(SRC_HEADERS) \
    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
  my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
endif

my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
@@ -1656,6 +1641,22 @@ else
  my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
endif # my_use_clang_lld

ifeq ($(call module-in-vendor-or-product),true)
  my_target_global_c_includes :=
  my_target_global_c_system_includes := $(TARGET_OUT_HEADERS)
  my_target_global_cflags += -nostdlibinc
else ifdef LOCAL_SDK_VERSION
  my_target_global_c_includes :=
  my_target_global_c_system_includes := $(my_ndk_stl_include_path)
  my_target_global_cflags += --sysroot $(my_ndk_sysroot)
else
  my_target_global_c_includes := $(SRC_HEADERS) \
    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
  my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
  my_target_global_cflags += -nostdlibinc
endif

my_target_triple := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)TRIPLE)
ifndef LOCAL_IS_HOST_MODULE
  my_target_triple_flag := -target $(my_target_triple)$(my_api_level)