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 <eberman@codeaurora.org>
This commit is contained in:
Elliot Berman
2021-02-17 09:54:48 -08:00
parent 2527bfe32d
commit 80b5ad0267

View File

@@ -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"],
}