0
0
mirror of https://github.com/chromium/crashpad.git synced 2025-01-15 10:07:56 +08:00

gn, linux: Build for Linux with GN

This is sufficient for a native Linux build using GN. Android is not yet
supported.

mini_chromium side: https://crrev.com/c/833407

This also updates mini_chromium to 404f6dbf9928.

c913ef97a236 gn, linux: Build for Linux with GN
404f6dbf9928 gn: Don’t use .rsp files; rationalize descriptions and
             output dirs

Bug: crashpad:79
Change-Id: I4f3b72fd02884d77812e520fb95231b35815677d
Reviewed-on: https://chromium-review.googlesource.com/833408
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
Mark Mentovai 2017-12-19 14:21:14 -05:00 committed by Commit Bot
parent a0bd3fee55
commit 99b0030616
8 changed files with 173 additions and 24 deletions

2
DEPS

@ -28,7 +28,7 @@ deps = {
'5e2b3ddde7cda5eb6bc09a5546a76b00e49d888f', '5e2b3ddde7cda5eb6bc09a5546a76b00e49d888f',
'crashpad/third_party/mini_chromium/mini_chromium': 'crashpad/third_party/mini_chromium/mini_chromium':
Var('chromium_git') + '/chromium/mini_chromium@' + Var('chromium_git') + '/chromium/mini_chromium@' +
'e182031c61072f629494a1f52729a8d29a6acace', '404f6dbf9928dd19cb437ad5b05abfdd97b5bf67',
'crashpad/third_party/zlib/zlib': 'crashpad/third_party/zlib/zlib':
Var('chromium_git') + '/chromium/src/third_party/zlib@' + Var('chromium_git') + '/chromium/src/third_party/zlib@' +
'13dc246a58e4b72104d35f9b1809af95221ebda7', '13dc246a58e4b72104d35f9b1809af95221ebda7',

@ -28,12 +28,6 @@ if (current_cpu == "") {
current_cpu = target_cpu current_cpu = target_cpu
} }
declare_args() {
is_debug = false
is_clang = current_os == "mac" || current_os == "fuchsia"
clang_root = ""
}
is_mac = false is_mac = false
is_win = false is_win = false
is_linux = false is_linux = false
@ -52,6 +46,16 @@ if (current_os == "mac") {
is_fuchsia = true is_fuchsia = true
} }
declare_args() {
# When true, enables the debug configuration, with additional run-time checks
# and logging. When false, enables the release configuration, with additional
# optimizations.
is_debug = false
# When true, configures for compilation with Clang.
is_clang = !is_win
}
if (is_win) { if (is_win) {
set_default_toolchain( set_default_toolchain(
"//third_party/mini_chromium/mini_chromium/build:msvc_toolchain") "//third_party/mini_chromium/mini_chromium/build:msvc_toolchain")
@ -60,29 +64,33 @@ if (is_win) {
"//third_party/mini_chromium/mini_chromium/build:gcc_like_toolchain") "//third_party/mini_chromium/mini_chromium/build:gcc_like_toolchain")
} }
default_configs = [ _default_configs = [
"//third_party/mini_chromium/mini_chromium/build:default", "//third_party/mini_chromium/mini_chromium/build:default",
"//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors", "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors",
] ]
default_executable_configs =
_default_configs +
[ "//third_party/mini_chromium/mini_chromium/build:executable" ]
set_defaults("source_set") { set_defaults("source_set") {
configs = default_configs configs = _default_configs
} }
set_defaults("static_library") { set_defaults("static_library") {
configs = default_configs configs = _default_configs
} }
set_defaults("executable") { set_defaults("executable") {
configs = default_configs configs = default_executable_configs
} }
set_defaults("loadable_module") { set_defaults("loadable_module") {
configs = default_configs configs = _default_configs
} }
set_defaults("shared_library") { set_defaults("shared_library") {
configs = default_configs configs = _default_configs
} }
# These are set to constant values for Chromium build file compatibility. This # These are set to constant values for Chromium build file compatibility. This

@ -48,6 +48,6 @@ if (crashpad_is_in_chromium) {
} }
set_defaults("test") { set_defaults("test") {
configs = _default_configs configs = default_executable_configs
} }
} }

@ -15,15 +15,19 @@
config("compat_config") { config("compat_config") {
include_dirs = [] include_dirs = []
if (is_mac) {
include_dirs += [ "mac" ]
}
if (is_linux) {
include_dirs += [ "linux" ]
}
if (is_win) { if (is_win) {
include_dirs += [ "win" ] include_dirs += [ "win" ]
} else { } else {
include_dirs += [ "non_win" ] include_dirs += [ "non_win" ]
} }
if (is_mac) {
include_dirs += [ "mac" ]
}
} }
template("compat_target") { template("compat_target") {
@ -55,6 +59,13 @@ compat_target("compat") {
sources += [ "non_mac/mach/mach.h" ] sources += [ "non_mac/mach/mach.h" ]
} }
if (is_linux) {
sources += [
"linux/signal.h",
"linux/sys/ptrace.h",
]
}
if (is_win) { if (is_win) {
sources += [ sources += [
"win/getopt.h", "win/getopt.h",

@ -94,6 +94,34 @@ static_library("snapshot") {
] ]
} }
if (is_linux) {
sources += [
"elf/elf_dynamic_array_reader.cc",
"elf/elf_dynamic_array_reader.h",
"elf/elf_image_reader.cc",
"elf/elf_image_reader.h",
"elf/elf_symbol_table_reader.cc",
"elf/elf_symbol_table_reader.h",
"linux/cpu_context_linux.cc",
"linux/cpu_context_linux.h",
"linux/debug_rendezvous.cc",
"linux/debug_rendezvous.h",
"linux/exception_snapshot_linux.cc",
"linux/exception_snapshot_linux.h",
"linux/memory_snapshot_linux.cc",
"linux/memory_snapshot_linux.h",
"linux/process_reader.cc",
"linux/process_reader.h",
"linux/process_snapshot_linux.cc",
"linux/process_snapshot_linux.h",
"linux/signal_context.h",
"linux/system_snapshot_linux.cc",
"linux/system_snapshot_linux.h",
"linux/thread_snapshot_linux.cc",
"linux/thread_snapshot_linux.h",
]
}
if (is_win) { if (is_win) {
sources += [ sources += [
"win/capture_memory_delegate_win.cc", "win/capture_memory_delegate_win.cc",
@ -218,12 +246,24 @@ static_library("test_support") {
} }
} }
config("snapshot_test_link") {
visibility = [ ":*" ]
if (is_linux) {
# Theres no way to make the link depend on this file. “inputs” doesnt have
# the intended effect in a config. https://crbug.com/781858,
# https://crbug.com/796187.
inputs = [
"elf/test_exported_symbols.sym",
]
ldflags = [ "-Wl,--dynamic-list," + rebase_path(inputs[0], root_build_dir) ]
}
}
source_set("snapshot_test") { source_set("snapshot_test") {
testonly = true testonly = true
sources = [ sources = [
"cpu_context_test.cc", "cpu_context_test.cc",
"crashpad_info_client_options_test.cc",
"minidump/process_snapshot_minidump_test.cc", "minidump/process_snapshot_minidump_test.cc",
] ]
@ -239,6 +279,20 @@ source_set("snapshot_test") {
] ]
} }
if (is_linux) {
sources += [
"elf/elf_image_reader_test.cc",
"elf/elf_image_reader_test_note.S",
"elf/test_exported_symbols.sym",
"linux/debug_rendezvous_test.cc",
"linux/exception_snapshot_linux_test.cc",
"linux/process_reader_test.cc",
"linux/system_snapshot_linux_test.cc",
]
} else {
sources += [ "crashpad_info_client_options_test.cc" ]
}
if (is_win) { if (is_win) {
sources += [ sources += [
"api/module_annotations_win_test.cc", "api/module_annotations_win_test.cc",
@ -255,6 +309,12 @@ source_set("snapshot_test") {
sources += [ "posix/timezone_test.cc" ] sources += [ "posix/timezone_test.cc" ]
} }
# public_configs isnt quite right. snapshot_test_link sets ldflags, and
# whats really needed is a way to push ldflags to dependent targets that
# produce linker output. Luckily in this case, all dependents do produce
# linker output. https://crbug.com/796183.
public_configs = [ ":snapshot_test_link" ]
deps = [ deps = [
":snapshot_api", ":snapshot_api",
":test_support", ":test_support",
@ -281,6 +341,10 @@ source_set("snapshot_test") {
] ]
} }
if (is_linux) {
libs = [ "dl" ]
}
if (is_win) { if (is_win) {
cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union

@ -65,6 +65,15 @@ static_library("test") {
] ]
} }
if (is_linux) {
sources += [
"linux/fake_ptrace_connection.cc",
"linux/fake_ptrace_connection.h",
"linux/get_tls.cc",
"linux/get_tls.h",
]
}
if (is_win) { if (is_win) {
sources += [ sources += [
"multiprocess_exec_win.cc", "multiprocess_exec_win.cc",

@ -72,14 +72,15 @@ executable("generate_dump") {
if (is_mac) { if (is_mac) {
# This would be better as a config so that it could be shared with # This would be better as a config so that it could be shared with
# exception_port_tool, but configs cant alter “inputs”. # exception_port_tool, but configs cant alter “inputs”.
# https://crbug.com/781858.
inputs = [ inputs = [
rebase_path("mac/sectaskaccess_info.plist"), "mac/sectaskaccess_info.plist",
] ]
ldflags = [ ldflags = [
"-sectcreate", "-sectcreate",
"__TEXT", "__TEXT",
"__info_plist", "__info_plist",
inputs[0], rebase_path(inputs[0], root_build_dir),
] ]
} }
@ -108,15 +109,15 @@ if (is_mac) {
] ]
# This would be better as a config so that it could be shared with # This would be better as a config so that it could be shared with
# generate_dump, but configs cant alter “inputs”. # generate_dump, but configs cant alter “inputs”. https://crbug.com/781858.
inputs = [ inputs = [
rebase_path("mac/sectaskaccess_info.plist"), "mac/sectaskaccess_info.plist",
] ]
ldflags = [ ldflags = [
"-sectcreate", "-sectcreate",
"__TEXT", "__TEXT",
"__info_plist", "__info_plist",
inputs[0], rebase_path(inputs[0], root_build_dir),
] ]
deps = [ deps = [

@ -240,6 +240,43 @@ static_library("util") {
sources += get_target_outputs(":mig") sources += get_target_outputs(":mig")
} }
if (is_linux) {
sources += [
"linux/address_types.h",
"linux/auxiliary_vector.cc",
"linux/auxiliary_vector.h",
"linux/checked_linux_address_range.h",
"linux/direct_ptrace_connection.cc",
"linux/direct_ptrace_connection.h",
"linux/exception_information.h",
"linux/memory_map.cc",
"linux/memory_map.h",
"linux/proc_stat_reader.cc",
"linux/proc_stat_reader.h",
"linux/ptrace_broker.cc",
"linux/ptrace_broker.h",
"linux/ptrace_client.cc",
"linux/ptrace_client.h",
"linux/ptrace_connection.h",
"linux/ptracer.cc",
"linux/ptracer.h",
"linux/scoped_ptrace_attach.cc",
"linux/scoped_ptrace_attach.h",
"linux/thread_info.cc",
"linux/thread_info.h",
"linux/traits.h",
"misc/paths_linux.cc",
"net/http_transport_libcurl.cc",
"posix/process_info_linux.cc",
"process/process_memory_linux.cc",
"process/process_memory_linux.h",
# TODO: Port to all platforms.
"process/process_memory_range.cc",
"process/process_memory_range.h",
]
}
if (is_win) { if (is_win) {
sources += [ sources += [
"file/directory_reader_win.cc", "file/directory_reader_win.cc",
@ -349,6 +386,10 @@ static_library("util") {
include_dirs += [ "$root_build_dir/gen" ] include_dirs += [ "$root_build_dir/gen" ]
} }
if (is_linux) {
libs = [ "curl" ]
}
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/wd4201", # nonstandard extension used : nameless struct/union. "/wd4201", # nonstandard extension used : nameless struct/union.
@ -449,6 +490,21 @@ source_set("util_test") {
] ]
} }
if (is_linux) {
sources += [
"linux/auxiliary_vector_test.cc",
"linux/memory_map_test.cc",
"linux/proc_stat_reader_test.cc",
"linux/ptrace_broker_test.cc",
"linux/ptracer_test.cc",
"linux/scoped_ptrace_attach_test.cc",
# TODO: Port to all platforms.
"process/process_memory_range_test.cc",
"process/process_memory_test.cc",
]
}
if (is_win) { if (is_win) {
sources += [ sources += [
"win/capture_context_test.cc", "win/capture_context_test.cc",