Revert "Revert "Switch to NetBSD's strxfrm(3).""
This reverts commit 8793e7c7d21a0434d1b5e63364c88b2b125a3d29,
and fixes the build by building upstream NetBSD source as a
separate library that's then swallowed whole into libc_common.
Change-Id: I6c9317d8c48b5ccaf85a7b185bc07fb31176ff97
diff --git a/libc/Android.mk b/libc/Android.mk
index fd81d7e..88225d6 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -209,7 +209,6 @@
string/strstr.c \
string/strtok.c \
string/strtotimeval.c \
- string/strxfrm.c \
string/__memcpy_chk.c \
string/__memmove_chk.c \
string/__memset_chk.c \
@@ -338,6 +337,9 @@
regex/regexec.c \
regex/regfree.c \
+libc_upstream_netbsd_src_files := \
+ upstream-netbsd/libc/string/strxfrm.c \
+
# The following files are common, but must be compiled
# with different C flags when building a static C library.
#
@@ -677,18 +679,39 @@
# ========================================================
+# libc_netbsd.a - upstream NetBSD C library code
+# ========================================================
+#
+# These files are built with the netbsd-compat.h header file
+# automatically included.
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
+LOCAL_CFLAGS := \
+ $(libc_common_cflags) \
+ -include upstream-netbsd/netbsd-compat.h
+LOCAL_C_INCLUDES := $(libc_common_c_includes)
+LOCAL_MODULE := libc_netbsd
+LOCAL_SYSTEM_SHARED_LIBRARIES :=
+
+include $(BUILD_STATIC_LIBRARY)
+
+
+# ========================================================
# libc_common.a
# ========================================================
+
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libc_common_src_files)
LOCAL_CFLAGS := $(libc_common_cflags)
ifeq ($(TARGET_ARCH),arm)
-LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
+ LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
endif
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_common
-LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp
+LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_netbsd
LOCAL_SYSTEM_SHARED_LIBRARIES :=
include $(BUILD_STATIC_LIBRARY)