From e8ed69493b7ab6237fb7114343789d3c213d2315 Mon Sep 17 00:00:00 2001 From: Alex Deymo Date: Wed, 11 Jan 2017 16:54:52 -0800 Subject: [PATCH] Convert several libraries to soong. This patch coverts libfec and its dependencies to soong. This also updates the name of the libext2_uuid-host library removing the "-host" suffix as that is also being converted to soong. Also create a shared library for libfec given that it has quite a few dependencies. Bug: 34284069 Test: mmma system/extras; make checkbuild Change-Id: Ib3ada6420bae32418a02ca92db664d0d24214e2f --- ext4_utils/Android.bp | 70 +++++++++++++++++++++++++++++++++++++++++++++ ext4_utils/Android.mk | 73 ----------------------------------------------- f2fs_utils/Android.mk | 2 +- libfec/Android.bp | 37 ++++++++++++++++++++++++ libfec/Android.mk | 45 ----------------------------- squashfs_utils/Android.bp | 22 ++++++++++++++ squashfs_utils/Android.mk | 17 ----------- 7 files changed, 130 insertions(+), 136 deletions(-) create mode 100644 ext4_utils/Android.bp create mode 100644 libfec/Android.bp create mode 100644 squashfs_utils/Android.bp diff --git a/ext4_utils/Android.bp b/ext4_utils/Android.bp new file mode 100644 index 00000000..a2987aa9 --- /dev/null +++ b/ext4_utils/Android.bp @@ -0,0 +1,70 @@ +// Copyright 2010 The Android Open Source Project + +cc_library { + name: "libext4_utils", + host_supported: true, + srcs: [ + "make_ext4fs.c", + "ext4fixup.c", + "ext4_utils.c", + "allocate.c", + "contents.c", + "extent.c", + "indirect.c", + "sha1.c", + "wipe.c", + "crc16.c", + "ext4_sb.c", + ], + // Various instances of dereferencing a type-punned pointer in extent.c + cflags: ["-fno-strict-aliasing"], + export_include_dirs: ["include"], + shared_libs: [ + "libsparse", + ], + + target: { + host: { + static_libs: ["libsparse"], + shared_libs: ["libz-host"], + }, + linux: { + static_libs: ["libselinux"], + }, + darwin: { + static_libs: ["libselinux"], + }, + windows: { + host_ldlibs: ["-lws2_32"], + enabled: true, + }, + + android: { + srcs: [ + "key_control.cpp", + "ext4_crypt.cpp", + ], + shared_libs: [ + "libbase", + "libselinux", + ], + + static: { + srcs: [ + "ext4_crypt_init_extensions.cpp", + ], + static_libs: [ + "liblogwrap", + ] + }, + shared: { + cflags: ["-DREAL_UUID"], + shared_libs: [ + "libcutils", + "libext2_uuid", + "libz", + ] + }, + }, + }, +} diff --git a/ext4_utils/Android.mk b/ext4_utils/Android.mk index 4287650d..e59eb4a3 100644 --- a/ext4_utils/Android.mk +++ b/ext4_utils/Android.mk @@ -2,41 +2,11 @@ LOCAL_PATH:= $(call my-dir) -libext4_utils_src_files := \ - make_ext4fs.c \ - ext4fixup.c \ - ext4_utils.c \ - allocate.c \ - contents.c \ - extent.c \ - indirect.c \ - sha1.c \ - wipe.c \ - crc16.c \ - ext4_sb.c - # # -- All host/targets including windows # include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(libext4_utils_src_files) -LOCAL_MODULE := libext4_utils -# Various instances of dereferencing a type-punned pointer in extent.c -LOCAL_CFLAGS += -fno-strict-aliasing -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/include -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - $(LOCAL_PATH)/include -LOCAL_STATIC_LIBRARIES := \ - libsparse -LOCAL_STATIC_LIBRARIES_darwin += libselinux -LOCAL_STATIC_LIBRARIES_linux += libselinux -LOCAL_MODULE_HOST_OS := darwin linux windows -include $(BUILD_HOST_STATIC_LIBRARY) - - -include $(CLEAR_VARS) LOCAL_SRC_FILES := make_ext4fs_main.c LOCAL_MODULE := make_ext4fs LOCAL_C_INCLUDES := \ @@ -66,52 +36,9 @@ include $(BUILD_HOST_EXECUTABLE) # -- All host/targets excluding windows # -libext4_utils_src_files += \ - key_control.cpp \ - ext4_crypt.cpp - ifneq ($(HOST_OS),windows) include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(libext4_utils_src_files) -LOCAL_MODULE := libext4_utils -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/include \ - system/core/logwrapper/include -# Various instances of dereferencing a type-punned pointer in extent.c -LOCAL_CFLAGS += -fno-strict-aliasing -LOCAL_CFLAGS += -DREAL_UUID -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - $(LOCAL_PATH)/include -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libext2_uuid \ - libselinux \ - libsparse -include $(BUILD_SHARED_LIBRARY) - - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := \ - $(libext4_utils_src_files) \ - ext4_crypt_init_extensions.cpp -LOCAL_MODULE := libext4_utils -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/include -# Various instances of dereferencing a type-punned pointer in extent.c -LOCAL_CFLAGS += -fno-strict-aliasing -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - $(LOCAL_PATH)/include -LOCAL_STATIC_LIBRARIES := \ - liblogwrap \ - libsparse \ - libselinux \ - libbase -include $(BUILD_STATIC_LIBRARY) - - -include $(CLEAR_VARS) LOCAL_SRC_FILES := make_ext4fs_main.c LOCAL_MODULE := make_ext4fs LOCAL_C_INCLUDES := \ diff --git a/f2fs_utils/Android.mk b/f2fs_utils/Android.mk index f643ad24..32ed0ed1 100644 --- a/f2fs_utils/Android.mk +++ b/f2fs_utils/Android.mk @@ -21,7 +21,7 @@ LOCAL_CFLAGS := -Wno-unused-parameter LOCAL_STATIC_LIBRARIES := \ libselinux \ libsparse \ - libext2_uuid-host \ + libext2_uuid \ libz LOCAL_MODULE := libf2fs_ioutils_host include $(BUILD_HOST_STATIC_LIBRARY) diff --git a/libfec/Android.bp b/libfec/Android.bp new file mode 100644 index 00000000..1145fc41 --- /dev/null +++ b/libfec/Android.bp @@ -0,0 +1,37 @@ +// Copyright 2015 The Android Open Source Project + +cc_library { + name: "libfec", + host_supported: true, + srcs: [ + "fec_open.cpp", + "fec_read.cpp", + "fec_verity.cpp", + "fec_process.cpp", + ], + cflags: ["-Wall", "-Werror", "-O3", "-D_LARGEFILE64_SOURCE"], + export_include_dirs: ["include"], + // Exported header include/fec/io.h includes crypto_utils headers. + export_static_lib_headers: ["libcrypto_utils"], + + static_libs: [ + "libext4_utils", + "libfec_rs", + "libsquashfs_utils", + "libcrypto_utils", + "libcrypto", + "libcutils", + "libbase", + ], + + target: { + host: { + cflags: ["-D_GNU_SOURCE", "-DFEC_NO_KLOG"] + }, + }, + + clang: true, + sanitize: { + misc_undefined: ["integer"], + }, +} diff --git a/libfec/Android.mk b/libfec/Android.mk index 47ac556e..12974bc5 100644 --- a/libfec/Android.mk +++ b/libfec/Android.mk @@ -2,49 +2,4 @@ # LOCAL_PATH := $(call my-dir) -common_cflags := -Wall -Werror -O3 -D_LARGEFILE64_SOURCE - -common_c_includes := \ - $(LOCAL_PATH)/include \ - external/fec - -common_src_files := \ - fec_open.cpp \ - fec_read.cpp \ - fec_verity.cpp \ - fec_process.cpp - -common_static_libraries := \ - libext4_utils \ - libfec_rs \ - libsquashfs_utils \ - libcrypto_utils \ - libcrypto \ - libcutils \ - libbase \ - -include $(CLEAR_VARS) -LOCAL_CFLAGS := $(common_cflags) -LOCAL_C_INCLUDES := $(common_c_includes) -LOCAL_CLANG := true -LOCAL_SANITIZE := integer -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include -LOCAL_MODULE := libfec -LOCAL_SRC_FILES := $(common_src_files) -LOCAL_STATIC_LIBRARIES := $(common_static_libraries) -include $(BUILD_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_CFLAGS := $(common_cflags) -D_GNU_SOURCE -DFEC_NO_KLOG -LOCAL_C_INCLUDES := $(common_c_includes) -LOCAL_CLANG := true -ifeq ($(HOST_OS),linux) -LOCAL_SANITIZE := integer -endif -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include -LOCAL_MODULE := libfec -LOCAL_SRC_FILES := $(common_src_files) -LOCAL_STATIC_LIBRARIES := $(common_static_libraries) -include $(BUILD_HOST_STATIC_LIBRARY) - include $(LOCAL_PATH)/test/Android.mk diff --git a/squashfs_utils/Android.bp b/squashfs_utils/Android.bp new file mode 100644 index 00000000..c0d9b18b --- /dev/null +++ b/squashfs_utils/Android.bp @@ -0,0 +1,22 @@ +// Copyright 2015 The Android Open Source Project + +cc_library_static { + name: "libsquashfs_utils", + host_supported: true, + srcs: [ + "squashfs_utils.c", + ], + include_dirs: ["external/squashfs-tools/squashfs-tools"], + export_include_dirs: ["."], + + static_libs: [ + "libcutils", + ], + + target: { + host: { + cflags: ["-Wall", "-Werror", "-D_GNU_SOURCE", "-DSQUASHFS_NO_KLOG"] + }, + }, + +} diff --git a/squashfs_utils/Android.mk b/squashfs_utils/Android.mk index b80da092..bf60cf4c 100644 --- a/squashfs_utils/Android.mk +++ b/squashfs_utils/Android.mk @@ -3,23 +3,6 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_SRC_FILES := squashfs_utils.c -LOCAL_STATIC_LIBRARIES := libcutils -LOCAL_C_INCLUDES := external/squashfs-tools/squashfs-tools -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) -LOCAL_MODULE := libsquashfs_utils -include $(BUILD_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := squashfs_utils.c -LOCAL_STATIC_LIBRARIES := libcutils -LOCAL_C_INCLUDES := external/squashfs-tools/squashfs-tools -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) -LOCAL_CFLAGS := -Wall -Werror -D_GNU_SOURCE -DSQUASHFS_NO_KLOG -LOCAL_MODULE := libsquashfs_utils -include $(BUILD_HOST_STATIC_LIBRARY) - -include $(CLEAR_VARS) LOCAL_MODULE := mksquashfsimage.sh LOCAL_SRC_FILES := mksquashfsimage.sh LOCAL_MODULE_CLASS := EXECUTABLES -- 2.11.0