android_kernel_xiaomi_sm8450/Android.bp
Elliot Berman 80b5ad0267 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>
2021-02-18 09:36:58 -08:00

22 lines
474 B
Plaintext

cc_binary_host {
name: "unifdef",
srcs: ["scripts/unifdef.c"],
sanitize: {
never: true,
},
}
genrule {
name: "gen-headers_install.sh",
srcs: ["scripts/headers_install.sh"],
tools: ["unifdef"],
out: ["headers_install.sh"],
cmd: "sed 's+scripts/unifdef+$${LOC_UNIFDEF:-$$(dirname $$0)/unifdef}+g' $(in) > $(out)",
}
sh_binary_host {
name: "headers_install.sh",
src: ":gen-headers_install.sh",
required: ["unifdef"],
}