Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: build/config/gcc/BUILD.gn

Issue 2605673002: Add gcc_target_rpath gn arg (Closed)
Patch Set: Address comment Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/gcc/BUILD.gn
diff --git a/build/config/gcc/BUILD.gn b/build/config/gcc/BUILD.gn
index 422ec0e92af9173212fe8eeec091a359f4f9b178..bf97f712f7a02d2bcb689b39e6d0e98a4d7c22ae 100644
--- a/build/config/gcc/BUILD.gn
+++ b/build/config/gcc/BUILD.gn
@@ -7,6 +7,17 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/sysroot.gni")
import("//build/toolchain/toolchain.gni")
+declare_args() {
+ # When non empty, overrides the target rpath value. This allows a user to
+ # make a Chromium build where binaries and shared libraries are meant to be
+ # installed into separate directories, like /usr/bin/chromium and
+ # /usr/lib/chromium for instance. It is useful when a build system that
+ # generates a whole target root filesystem (like Yocto) is used on top of gn,
+ # especially when cross-compiling.
+ # Note: this gn arg is similar to gyp target_rpath generator flag.
+ gcc_target_rpath = ""
+}
+
# This config causes functions not to be automatically exported from shared
# libraries. By default, all symbols are exported but this means there are
# lots of exports that slow everything down. In general we explicitly mark
@@ -61,11 +72,18 @@ config("rpath_for_built_shared_libraries") {
} else {
rpath_link = "."
}
- ldflags = [
- # Want to pass "\$". GN will re-escape as required for ninja.
- "-Wl,-rpath=\$ORIGIN/${rpath_link}",
- "-Wl,-rpath-link=${rpath_link}",
- ]
+ if (current_toolchain != default_toolchain || gcc_target_rpath == "") {
+ ldflags = [
+ # Want to pass "\$". GN will re-escape as required for ninja.
+ "-Wl,-rpath=\$ORIGIN/${rpath_link}",
+ "-Wl,-rpath-link=${rpath_link}",
+ ]
+ } else {
+ ldflags = [
+ "-Wl,-rpath=${gcc_target_rpath}",
+ "-Wl,-rpath-link=${rpath_link}",
+ ]
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698