From a5ad20aecc699847846c24ccda63ab04e58a64f0 Mon Sep 17 00:00:00 2001 From: Aaron Wisner Date: Fri, 24 Aug 2018 09:59:50 -0500 Subject: [PATCH] Fix mac build breakage due to missing usb_osx.cpp in Android.cpp file for libfastboot2 https://android-review.googlesource.com/c/platform/system/core/+/722153 Test: Build on osx Change-Id: I6151e37581ac332e4d5cfb5e40feb3ea0e3093df --- fastboot/Android.bp | 19 +++++++++++++++++++ fastboot/fuzzy_fastboot/Android.bp | 10 ++++++++++ 2 files changed, 29 insertions(+) diff --git a/fastboot/Android.bp b/fastboot/Android.bp index 3414d5352..f32b5d59c 100644 --- a/fastboot/Android.bp +++ b/fastboot/Android.bp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This is required because no Android.bp can include a library defined in an +// Android.mk. Eventually should kill libfastboot (defined in Android.mk) cc_library_host_static { name: "libfastboot2", @@ -56,6 +58,23 @@ cc_library_host_static { linux: { srcs: ["usb_linux.cpp"], }, + + darwin: { + srcs: ["usb_osx.cpp"], + + host_ldlibs: [ + "-framework CoreFoundation", + "-framework IOKit", + ], + }, + + windows: { + srcs: ["usb_windows.cpp"], + + host_ldlibs: [ + "-lws2_32", + ], + }, }, cflags: [ diff --git a/fastboot/fuzzy_fastboot/Android.bp b/fastboot/fuzzy_fastboot/Android.bp index 9a68ff37a..301534bfb 100644 --- a/fastboot/fuzzy_fastboot/Android.bp +++ b/fastboot/fuzzy_fastboot/Android.bp @@ -28,4 +28,14 @@ cc_test_host { "libsparse", ], + // Static libs (libfastboot2) shared library dependencies are not transitively included + // This is needed to avoid link time errors when building for mac + target: { + darwin: { + host_ldlibs: [ + "-framework CoreFoundation", + "-framework IOKit", + ], + }, + } }