From 80b5ad02679f53cac7629dacb0cf3849bbcdd19f Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Wed, 17 Feb 2021 09:54:48 -0800 Subject: [PATCH] Android.bp: headers_install.sh: Use environment for unifdef tool Tools used when generating headers_install.sh are run from within a sandbox. The location of unifdef changes from headers_install.sh generation time to usage time. Instead, allow calling headers_install.py to specify the location of unifdef with LOC_UNIFDEF environment variable. If this environment variable is unset, unifdef is assumed to live in same directory as generated headers_install.sh script. This assumption allows smooth transition for users of headers_install.sh since main build is not broken by this change. Change-Id: Id23865dd3e25aa179e0bc6d3d6c549e0b93a6717 Signed-off-by: Elliot Berman --- Android.bp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Android.bp b/Android.bp index 929f9f3c3b0c..ed41fcc2de68 100644 --- a/Android.bp +++ b/Android.bp @@ -11,12 +11,11 @@ genrule { srcs: ["scripts/headers_install.sh"], tools: ["unifdef"], out: ["headers_install.sh"], - cmd: "sed 's+scripts/unifdef+$(location unifdef)+g' $(in) > $(out)", + cmd: "sed 's+scripts/unifdef+$${LOC_UNIFDEF:-$$(dirname $$0)/unifdef}+g' $(in) > $(out)", } -cc_prebuilt_binary { +sh_binary_host { name: "headers_install.sh", - device_supported: false, - host_supported: true, - srcs: [":gen-headers_install.sh"], + src: ":gen-headers_install.sh", + required: ["unifdef"], }