Fix the @rpath of dawn_components
When the libdawn_native target was renamed to dawn_native, the output
library name stayed the same (GN inserts a lib prefix if it isn't
present) but the @rpath annotation changed to be just dawn_native.dylib.
Fix this by adding the lib prefix in the rpath annotation. This requires
changing libdawn_proc to dawn_proc otherwise the rpath annotation would
be liblibdawn_proc.dylib.
Bug: dawn:380
Change-Id: Id8610a6318af3468dcc486ee8d3c035f0273fe0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
diff --git a/scripts/dawn_component.gni b/scripts/dawn_component.gni
index cf18a21..00fad8b 100644
--- a/scripts/dawn_component.gni
+++ b/scripts/dawn_component.gni
@@ -49,11 +49,11 @@
template("dawn_component") {
# Copy the target_name in the local scope so it doesn't get shadowed in the
# definition of targets.
- libname = target_name
+ name = target_name
# The config that will apply to dependents of the shared library so they know
# they should "import" the symbols
- config("${libname}_shared_public_config") {
+ config("${name}_shared_public_config") {
defines = [ "${invoker.DEFINE_PREFIX}_SHARED_LIBRARY" ]
# Executable needs an rpath to find our shared libraries on OSX and Linux
@@ -68,8 +68,9 @@
}
}
- shared_library("${libname}_shared") {
- output_name = libname
+ shared_library("${name}_shared") {
+ # The "tool" for creating shared libraries will automatically add the "lib" prefix
+ output_name = name
# Copy all variables except "configs", which has a default value
forward_variables_from(invoker, "*", [ "configs" ])
@@ -81,7 +82,7 @@
if (is_mac) {
ldflags = [
"-install_name",
- "@rpath/${libname}.dylib",
+ "@rpath/lib${name}.dylib",
]
}
@@ -89,7 +90,7 @@
if (!defined(public_configs)) {
public_configs = []
}
- public_configs += [ ":${libname}_shared_public_config" ]
+ public_configs += [ ":${name}_shared_public_config" ]
# Tell sources of this library to export the symbols (and not import)
if (!defined(defines)) {
@@ -106,8 +107,8 @@
}
}
- static_library("${libname}_static") {
- output_name = libname + "_static"
+ static_library("${name}_static") {
+ output_name = name + "_static"
complete_static_lib = dawn_complete_static_libs
@@ -118,14 +119,14 @@
}
}
- group(libname) {
+ group(name) {
if (is_component_build) {
public_deps = [
- ":${libname}_shared",
+ ":${name}_shared",
]
} else {
public_deps = [
- ":${libname}_static",
+ ":${name}_static",
]
}
}