From e60e50386a9e8e87fc93acd7afda5536a180debe Mon Sep 17 00:00:00 2001 From: George Kulakowski Date: Mon, 16 Nov 2015 13:27:56 -0800 Subject: [PATCH] Add fnl build configuration --- base/debug/stack_trace_posix.cc | 4 +-- base/files/file_util_posix.cc | 1 - base/trace_event/BUILD.gn | 2 +- base/trace_event/memory_dump_manager.cc | 2 +- build/config/BUILD.gn | 3 ++ build/config/BUILDCONFIG.gn | 24 ++++++++++++- build/config/fnl/BUILD.gn | 48 +++++++++++++++++++++++++ build/toolchain/fnl/BUILD.gn | 24 +++++++++++++ sky/BUILD.gn | 4 +++ sky/dist/BUILD.gn | 10 +++++- sky/engine/wtf/Assertions.cpp | 2 +- sky/shell/BUILD.gn | 7 ++-- sky/shell/platform/android/sky_main.cc | 2 ++ sky/shell/platform/mac/platform_mac.mm | 1 + sky/shell/shell.cc | 4 --- sky/tools/gn | 18 +++++++++- third_party/libevent/BUILD.gn | 4 +++ 17 files changed, 145 insertions(+), 15 deletions(-) create mode 100644 build/config/fnl/BUILD.gn create mode 100644 build/toolchain/fnl/BUILD.gn diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc index 9593962d3..8798ad49c 100644 --- a/base/debug/stack_trace_posix.cc +++ b/base/debug/stack_trace_posix.cc @@ -22,7 +22,7 @@ #if defined(__GLIBCXX__) #include #endif -#if !defined(__UCLIBC__) +#if !defined(__UCLIBC__) && !defined(FNL_MUSL) #include #endif @@ -738,7 +738,7 @@ StackTrace::StackTrace() { // NOTE: This code MUST be async-signal safe (it's used by in-process // stack dumping signal handler). NO malloc or stdio is allowed here. -#if !defined(__UCLIBC__) +#if !defined(__UCLIBC__) && !defined(FNL_MUSL) // Though the backtrace API man page does not list any possible negative // return values, we take no chance. count_ = base::saturated_cast(backtrace(trace_, arraysize(trace_))); diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc index a8c5d44f9..6086a1741 100644 --- a/base/files/file_util_posix.cc +++ b/base/files/file_util_posix.cc @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include diff --git a/base/trace_event/BUILD.gn b/base/trace_event/BUILD.gn index 8f987479d..663d7bae9 100644 --- a/base/trace_event/BUILD.gn +++ b/base/trace_event/BUILD.gn @@ -59,7 +59,7 @@ source_set("trace_event") { ] } - if (is_linux || is_android) { + if ((is_linux || is_android) && !is_fnl) { sources += [ "malloc_dump_provider.cc", "malloc_dump_provider.h", diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc index 537984672..af107f3f2 100644 --- a/base/trace_event/memory_dump_manager.cc +++ b/base/trace_event/memory_dump_manager.cc @@ -116,7 +116,7 @@ void MemoryDumpManager::Initialize() { RegisterDumpProvider(ProcessMemoryTotalsDumpProvider::GetInstance()); #endif -#if defined(OS_LINUX) || defined(OS_ANDROID) +#if (defined(OS_LINUX) && !defined(FNL_MUSL)) || defined(OS_ANDROID) g_mmaps_dump_provider = ProcessMemoryMapsDumpProvider::GetInstance(); RegisterDumpProvider(g_mmaps_dump_provider); RegisterDumpProvider(MallocDumpProvider::GetInstance()); diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index a2c346932..e257b3593 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -272,6 +272,9 @@ config("feature_flags") { if (enable_webvr) { defines += [ "ENABLE_WEBVR" ] } + if (is_fnl) { + defines += [ "HAVE_SYS_QUEUE_H_=0" ] + } } # Debug/release ---------------------------------------------------------------- diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index 2e39c830d..a691d132d 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -176,6 +176,7 @@ declare_args() { if (current_os == "win") { is_android = false is_chromeos = false + is_fnl = false is_ios = false is_linux = false is_mac = false @@ -185,6 +186,7 @@ if (current_os == "win") { } else if (current_os == "mac") { is_android = false is_chromeos = false + is_fnl = false is_ios = false is_linux = false is_mac = true @@ -194,6 +196,7 @@ if (current_os == "win") { } else if (current_os == "android") { is_android = true is_chromeos = false + is_fnl = false is_ios = false is_linux = false is_mac = false @@ -203,6 +206,7 @@ if (current_os == "win") { } else if (current_os == "chromeos") { is_android = false is_chromeos = true + is_fnl = false is_ios = false is_linux = true is_mac = false @@ -215,6 +219,7 @@ if (current_os == "win") { # Posix variant. is_android = false is_chromeos = false + is_fnl = false is_ios = false is_linux = false is_mac = false @@ -224,6 +229,7 @@ if (current_os == "win") { } else if (current_os == "ios") { is_android = false is_chromeos = false + is_fnl = false is_ios = true is_linux = false is_mac = false @@ -233,6 +239,17 @@ if (current_os == "win") { } else if (current_os == "linux") { is_android = false is_chromeos = false + is_fnl = false + is_ios = false + is_linux = true + is_mac = false + is_nacl = false + is_posix = true + is_win = false +} else if (current_os == "fnl") { + is_android = false + is_chromeos = false + is_fnl = true is_ios = false is_linux = true is_mac = false @@ -400,7 +417,9 @@ if (is_posix) { ] } -if (is_linux) { +if (is_fnl) { + _native_compiler_configs += [ "//build/config/fnl:sdk" ] +} else if (is_linux) { _native_compiler_configs += [ "//build/config/linux:sdk" ] } else if (is_mac) { _native_compiler_configs += [ "//build/config/mac:sdk" ] @@ -574,6 +593,9 @@ if (is_win) { if (is_chromeos && cros_use_custom_toolchain) { set_default_toolchain("//build/toolchain/cros:target") } + if (is_fnl) { + set_default_toolchain("//build/toolchain/fnl:target") + } } else if (is_mac) { host_toolchain = "//build/toolchain/mac:clang_x64" set_default_toolchain(host_toolchain) diff --git a/build/config/fnl/BUILD.gn b/build/config/fnl/BUILD.gn new file mode 100644 index 000000000..0eb35e349 --- /dev/null +++ b/build/config/fnl/BUILD.gn @@ -0,0 +1,48 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/linux/pkg_config.gni") +import("//build/config/features.gni") +import("//build/config/sysroot.gni") +import("//build/config/ui.gni") + +config("sdk") { + if (sysroot != "") { + cflags = [ "--sysroot=" + sysroot ] + ldflags = [ "--sysroot=" + sysroot ] + + # Need to get some linker flags out of the sysroot. + ldflags += [ exec_script("../linux/sysroot_ld_path.py", + [ + rebase_path("//build/linux/sysroot_ld_path.sh", + root_build_dir), + sysroot, + ], + "value") ] + } + + defines = [ "FNL_MUSL" ] + + if (use_ozone) { + defines += [ "MESA_EGL_NO_X11_HEADERS" ] + } +} + +config("fontconfig") { + libs = [ "fontconfig" ] +} + +pkg_config("freetype2") { + packages = [ "freetype2" ] +} + +if (use_evdev_gestures) { + pkg_config("libevdev-cros") { + packages = [ "libevdev-cros" ] + } + + pkg_config("libgestures") { + packages = [ "libgestures" ] + } +} diff --git a/build/toolchain/fnl/BUILD.gn b/build/toolchain/fnl/BUILD.gn new file mode 100644 index 000000000..1e4a07523 --- /dev/null +++ b/build/toolchain/fnl/BUILD.gn @@ -0,0 +1,24 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/toolchain/gcc_toolchain.gni") + +declare_args() { + toolchain_prefix = "" +} + +gcc_toolchain("target") { + assert(toolchain_prefix != "", "Must provide toolchain_prefix") + + cc = "${toolchain_prefix}gcc" + cxx = "${toolchain_prefix}g++" + ar = "${toolchain_prefix}ar" + ld = cxx + readelf = "${toolchain_prefix}readelf" + nm = "${toolchain_prefix}nm" + + toolchain_cpu = "${target_cpu}" + toolchain_os = "linux" + is_clang = is_clang +} diff --git a/sky/BUILD.gn b/sky/BUILD.gn index 072744080..a56be4ea0 100644 --- a/sky/BUILD.gn +++ b/sky/BUILD.gn @@ -18,6 +18,10 @@ group("sky") { deps += [ "//sky/tools/sky_snapshot($dart_host_toolchain)" ] } + if (is_fnl) { + deps -= [ "//sky/shell" ] + } + if (is_linux || is_android) { deps += [ "//sky/shell/platform/mojo" ] } diff --git a/sky/dist/BUILD.gn b/sky/dist/BUILD.gn index 7b511a7b2..0e5a6cb0e 100644 --- a/sky/dist/BUILD.gn +++ b/sky/dist/BUILD.gn @@ -24,7 +24,15 @@ copy("sky_shell") { deps = [ "//sky/shell:shell_struct", ] - } else if(!is_ios) { + } else if (is_fnl) { + sources = [ + "$root_build_dir/flutter.mojo", + ] + + deps = [ + "//sky/shell/platform/mojo", + ] + } else if (!is_ios) { sources = [ "$root_build_dir/flutter.mojo", "$root_build_dir/icudtl.dat", diff --git a/sky/engine/wtf/Assertions.cpp b/sky/engine/wtf/Assertions.cpp index 574021974..fa108771d 100644 --- a/sky/engine/wtf/Assertions.cpp +++ b/sky/engine/wtf/Assertions.cpp @@ -46,7 +46,7 @@ #include #endif -#if (OS(LINUX) && !defined(__UCLIBC__)) +#if (OS(LINUX) && !defined(__UCLIBC__) && !defined(FNL_MUSL)) #include #include #include diff --git a/sky/shell/BUILD.gn b/sky/shell/BUILD.gn index fb97458ee..dafb175f3 100644 --- a/sky/shell/BUILD.gn +++ b/sky/shell/BUILD.gn @@ -54,9 +54,9 @@ source_set("common") { "//sky/services/pointer:interfaces", "//sky/services/vsync:interfaces", "//sky/shell/dart", + "//ui/gfx", "//ui/gfx/geometry", "//url", - "//ui/gl", ] } @@ -70,6 +70,7 @@ source_set("gpu_direct") { deps = [ ":common", + "//ui/gl", ] } @@ -255,7 +256,7 @@ if (is_android) { sky_precompilation_sdk("shell") { sdk_name = "SkySDK" } -} else if (is_linux) { +} else if (is_linux && !is_fnl) { executable("shell") { output_name = "sky_shell" @@ -321,6 +322,8 @@ if (is_android) { ":sky_resources", ] } +} else if (is_fnl) { + # Nothing fnl specific. } else { assert(false, "Unsupported platform") } diff --git a/sky/shell/platform/android/sky_main.cc b/sky/shell/platform/android/sky_main.cc index c2cb38f95..2c589e583 100644 --- a/sky/shell/platform/android/sky_main.cc +++ b/sky/shell/platform/android/sky_main.cc @@ -22,6 +22,7 @@ #include "mojo/edk/embedder/embedder.h" #include "mojo/edk/embedder/simple_platform_support.h" #include "sky/shell/shell.h" +#include "ui/gl/gl_surface.h" using base::LazyInstance; @@ -77,6 +78,7 @@ static void Init(JNIEnv* env, mojo::embedder::Init(std::unique_ptr( new mojo::embedder::SimplePlatformSupport())); + CHECK(gfx::GLSurface::InitializeOneOff()); Shell::InitStandalone(); InitializeTracing(); diff --git a/sky/shell/platform/mac/platform_mac.mm b/sky/shell/platform/mac/platform_mac.mm index 745d2f156..8143e5134 100644 --- a/sky/shell/platform/mac/platform_mac.mm +++ b/sky/shell/platform/mac/platform_mac.mm @@ -64,6 +64,7 @@ int PlatformMacMain(int argc, mojo::embedder::Init(std::unique_ptr( new mojo::embedder::SimplePlatformSupport())); + CHECK(gfx::GLSurface::InitializeOneOff()); sky::shell::Shell::InitStandalone(); result = callback(); diff --git a/sky/shell/shell.cc b/sky/shell/shell.cc index 6fd3524a3..63eb4b0e7 100644 --- a/sky/shell/shell.cc +++ b/sky/shell/shell.cc @@ -16,7 +16,6 @@ #include "mojo/message_pump/message_pump_mojo.h" #include "sky/shell/ui/engine.h" #include "sky/shell/switches.h" -#include "ui/gl/gl_surface.h" namespace sky { namespace shell { @@ -75,9 +74,6 @@ Shell::~Shell() { void Shell::InitStandalone() { CHECK(base::i18n::InitializeICU()); -#if !defined(OS_LINUX) - CHECK(gfx::GLSurface::InitializeOneOff()); -#endif base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); diff --git a/sky/tools/gn b/sky/tools/gn index 3e10746f6..c1be7c60b 100755 --- a/sky/tools/gn +++ b/sky/tools/gn @@ -16,6 +16,8 @@ def get_out_dir(args): target_dir += 'android_' elif args.target_os == 'ios': target_dir += 'ios_' + elif args.target_os == 'fnl': + target_dir += 'fnl_' if args.simulator: target_dir += 'sim_' @@ -38,7 +40,7 @@ def to_gn_args(args): gn_args = {} gn_args['is_debug'] = args.debug - gn_args['is_clang'] = args.clang and args.target_os not in ['android'] + gn_args['is_clang'] = args.clang and args.target_os not in ['android', 'fnl'] ios_target_cpu = 'arm64' if args.ios_force_armv7: @@ -56,6 +58,10 @@ def to_gn_args(args): else: # The iOS simulator snapshot is host targetted gn_args['dart_target_arch'] = ios_target_cpu + elif args.target_os == 'fnl': + gn_args['target_os'] = 'fnl' + gn_args['use_aura'] = False + gn_args['use_ozone'] = True else: gn_args['use_aura'] = False gn_args['use_system_harfbuzz'] = False @@ -71,6 +77,12 @@ def to_gn_args(args): else: gn_args['target_cpu'] = 'x64' + if args.target_sysroot: + gn_args['target_sysroot'] = args.target_sysroot + + if args.toolchain_prefix: + gn_args['toolchain_prefix'] = args.toolchain_prefix + goma_dir = os.environ.get('GOMA_DIR') goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma') if args.goma and goma_dir: @@ -94,6 +106,7 @@ def parse_args(args): parser.add_argument('--target-os', type=str, choices=['android', 'ios']) parser.add_argument('--android', dest='target_os', action='store_const', const='android') + parser.add_argument('--fnl', dest='target_os', action='store_const', const='fnl') parser.add_argument('--ios', dest='target_os', action='store_const', const='ios') parser.add_argument('--ios-force-armv7', dest='ios_force_armv7', action='store_true', default=False) parser.add_argument('--simulator', action='store_true', default=False) @@ -104,6 +117,9 @@ def parse_args(args): parser.add_argument('--clang', default=True, action='store_true') parser.add_argument('--no-clang', dest='clang', action='store_false') + parser.add_argument('--target-sysroot', type=str) + parser.add_argument('--toolchain-prefix', type=str) + return parser.parse_args(args) def main(argv): diff --git a/third_party/libevent/BUILD.gn b/third_party/libevent/BUILD.gn index a1bd0c579..43049c95c 100644 --- a/third_party/libevent/BUILD.gn +++ b/third_party/libevent/BUILD.gn @@ -33,6 +33,10 @@ source_set("libevent") { include_dirs = [ "android" ] } + if (is_fnl) { + include_dirs += [ "compat" ] + } + configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] } -- GitLab