diff --git a/starboard/build/config/BUILDCONFIG.gn b/starboard/build/config/BUILDCONFIG.gn index b599e100cd57..6cfa4d69b93c 100644 --- a/starboard/build/config/BUILDCONFIG.gn +++ b/starboard/build/config/BUILDCONFIG.gn @@ -416,7 +416,15 @@ template("evergreen_loader") { } template("executable") { - not_needed(invoker, [ "build_loader" ]) + not_needed(invoker, + [ + "build_loader", + + # TODO(b/305091479): Investigate when this variable is unneeded + # so that we can refactor this to avoid the not_needed + # declaration. + "shared_library_target_name", + ]) target_with_platform_configs(target_name) { target_type = "executable" @@ -446,7 +454,16 @@ template("executable") { } install_target(target_name + "_install") { - forward_variables_from(invoker, [ "testonly" ]) + # "shared_library_target_name" is used when this executable install_target + # is invoked from within a shared_library target that is building a loader + # In this case, it allows the install_target to determine the inputs/deps + # for the corresponding shared_library install_target. + forward_variables_from(invoker, + [ + "testonly", + "shared_library_target_name", + ]) + installable_target_name = executable_target_name installable_target_dep = ":$executable_target_name" not_needed([ "installable_target_dep" ]) @@ -511,6 +528,10 @@ template("shared_library") { ]) sources = [ "//$starboard_path/starboard_loader.cc" ] + # Forwards the "shared_library_target_name" to allow this loader install + # target to depend the corresponding shared_library install_target outputs. + shared_library_target_name = actual_target_name + if (defined(extra_platform_loader_sources)) { sources += extra_platform_loader_sources } diff --git a/starboard/build/install/install_target.gni b/starboard/build/install/install_target.gni index b11168cb6509..530d585a1ebe 100644 --- a/starboard/build/install/install_target.gni +++ b/starboard/build/install/install_target.gni @@ -16,6 +16,8 @@ import("//starboard/build/config/install.gni") import("//starboard/build/config/starboard_target_type.gni") template("install_target") { + not_needed(invoker, [ "shared_library_target_name" ]) + installable_target_name = invoker.installable_target_name installable_target_dep = invoker.installable_target_dep diff --git a/starboard/raspi/shared/install_target.gni b/starboard/raspi/shared/install_target.gni index dfc1b42c937f..cf74ac4fd117 100644 --- a/starboard/raspi/shared/install_target.gni +++ b/starboard/raspi/shared/install_target.gni @@ -16,6 +16,8 @@ import("//starboard/build/config/starboard_target_type.gni") import("//starboard/raspi/shared/toolchain/raspi_shared_toolchain.gni") template("install_target") { + not_needed(invoker, [ "shared_library_target_name" ]) + installable_target_name = invoker.installable_target_name # TODO(b/218889313): raspi relies on install_content being adjacent to the