diff options
author | brettw <brettw@chromium.org> | 2015-11-09 15:56:21 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-09 23:57:13 +0000 |
commit | af7fb1f58f1d3348dab79312422f6c4bf5313101 (patch) | |
tree | 3170b112cce09a63c5af4285c098b3e14a43d7c9 /build | |
parent | 6ffe80ed4dea8b85925ba6dfa2a0cb8f472fb951 (diff) | |
download | chromium_src-af7fb1f58f1d3348dab79312422f6c4bf5313101.zip chromium_src-af7fb1f58f1d3348dab79312422f6c4bf5313101.tar.gz chromium_src-af7fb1f58f1d3348dab79312422f6c4bf5313101.tar.bz2 |
Support spaces in output names in GN Linux
This quotes BUILD-file-generated file names in command lines in the gcc_toolchain. I checked that executables and shared libraries with spaces can be built now. This doesn't affect Mac or Windows.
BUG=546894
Review URL: https://codereview.chromium.org/1435583002
Cr-Commit-Position: refs/heads/master@{#358708}
Diffstat (limited to 'build')
-rw-r--r-- | build/toolchain/gcc_toolchain.gni | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index 3af4ff3..d6a9002 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -212,13 +212,15 @@ template("gcc_toolchain") { gold_plugin_path = rebase_path( "//third_party/llvm-build/Release+Asserts/lib/LLVMgold.so", root_build_dir) - arflags = "--plugin $gold_plugin_path" + arflags = "--plugin \"$gold_plugin_path\"" } # This needs a Python script to avoid using simple sh features in this - # command, in case the host does not use a POSIX shell (e.g. Windows). - ar_wrapper = rebase_path("//build/toolchain/gcc_ar_wrapper.py") - command = "$python_path $ar_wrapper --output={{output}} --ar=$ar $arflags rcs @$rspfile" + # command, in case the host does not use a POSIX shell (e.g. compiling + # POSIX-like toolchains such as NaCl on Windows). + ar_wrapper = + rebase_path("//build/toolchain/gcc_ar_wrapper.py", root_build_dir) + command = "$python_path \"$ar_wrapper\" --output={{output}} --ar=$ar $arflags rcs @\"$rspfile\"" description = "AR {{output}}" rspfile_content = "{{inputs}}" outputs = [ @@ -247,7 +249,7 @@ template("gcc_toolchain") { # .TOC file, overwrite it, otherwise, don't change it. tocfile = sofile + ".TOC" - link_command = "$ld -shared {{ldflags}} -o $unstripped_sofile -Wl,-soname=$soname @$rspfile" + link_command = "$ld -shared {{ldflags}} -o \"$unstripped_sofile\" -Wl,-soname=\"$soname\" @\"$rspfile\"" assert(defined(readelf), "to solink you must have a readelf") assert(defined(nm), "to solink you must have an nm") @@ -260,7 +262,7 @@ template("gcc_toolchain") { # requiring sh control structures, pipelines, and POSIX utilities. # The host might not have a POSIX shell and utilities (e.g. Windows). solink_wrapper = rebase_path("//build/toolchain/gcc_solink_wrapper.py") - command = "$python_path $solink_wrapper --readelf=$readelf --nm=$nm $strip_switch --sofile=$unstripped_sofile --tocfile=$tocfile --output=$sofile -- $link_command" + command = "$python_path $solink_wrapper --readelf=$readelf --nm=$nm $strip_switch --sofile=\"$unstripped_sofile\" --tocfile=\"$tocfile\" --output=\"$sofile\" -- $link_command" rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix" @@ -304,11 +306,10 @@ template("gcc_toolchain") { unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" } - command = "$ld -shared {{ldflags}} -o $unstripped_sofile -Wl,-soname=$soname @$rspfile" + command = "$ld -shared {{ldflags}} -o \"$unstripped_sofile\" -Wl,-soname=\"$soname\" @\"$rspfile\"" if (defined(invoker.strip)) { - strip_command = - "${invoker.strip} --strip-unneeded -o $sofile $unstripped_sofile" + strip_command = "${invoker.strip} --strip-unneeded -o \"$sofile\" \"$unstripped_sofile\"" command += " && " + strip_command } rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix" @@ -345,10 +346,11 @@ template("gcc_toolchain") { unstripped_outfile = "{{root_out_dir}}/exe.unstripped/$exename" } - command = "$ld {{ldflags}} -o $unstripped_outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix" + command = "$ld {{ldflags}} -o \"$unstripped_outfile\" -Wl,--start-group @\"$rspfile\" {{solibs}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix" if (defined(invoker.strip)) { - link_wrapper = rebase_path("//build/toolchain/gcc_link_wrapper.py") - command = "$python_path $link_wrapper --strip=${invoker.strip} --unstripped-file=$unstripped_outfile --output=$outfile -- $command" + link_wrapper = + rebase_path("//build/toolchain/gcc_link_wrapper.py", root_build_dir) + command = "$python_path \"$link_wrapper\" --strip=${invoker.strip} --unstripped-file=\"$unstripped_outfile\" --output=\"$outfile\" -- $command" } description = "LINK $outfile" rspfile_content = "{{inputs}}" |