| Index: third_party/libcxx/BUILD.gn | 
| diff --git a/third_party/libcxx/BUILD.gn b/third_party/libcxx/BUILD.gn | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..368608b4d1bec0880ed0a1582e53e1c5fbf99e3a | 
| --- /dev/null | 
| +++ b/third_party/libcxx/BUILD.gn | 
| @@ -0,0 +1,169 @@ | 
| +# Copyright 2016 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. | 
| + | 
| +config("libcxx_common_config") { | 
| +  cflags = [ | 
| +    # Flags from upstream CMake builds. | 
| +    "-D_DEBUG", | 
| +    "-D__STDC_CONSTANT_MACROS", | 
| +    "-D__STDC_FORMAT_MACROS", | 
| +    "-D__STDC_LIMIT_MACROS", | 
| + | 
| +    "-fPIC", | 
| +    "-fvisibility-inlines-hidden", | 
| + | 
| +    "-Werror=return-type", | 
| + | 
| +    "-Wall", | 
| + | 
| +    "-Wcast-qual", | 
| +    "-Wcovered-switch-default", | 
| +    "-Wdelete-non-virtual-dtor", | 
| +    "-Wmissing-field-initializers", | 
| +    "-Wnon-virtual-dtor", | 
| +    "-Wwrite-strings", | 
| + | 
| +    "-Wno-error", | 
| +    "-Wno-long-long", | 
| +    "-Wno-unused-function", | 
| + | 
| +    "-std=c++11", | 
| +    "-nostdinc++", | 
| + | 
| +    # Use our sysroot. | 
| +    "--sysroot=fusl_${current_cpu}/sysroot", | 
| + | 
| +    # Use musl-based libc++ header paths. | 
| +    "-D_LIBCPP_HAS_MUSL_LIBC", | 
| +  ] | 
| + | 
| +  include_dirs = [ | 
| +    "libcxx/include", | 
| +    "libcxxabi/include", | 
| +  ] | 
| +} | 
| + | 
| +config("libcxx_config") { | 
| +  cflags = [ | 
| +    # Flags from upstream CMake build. | 
| +    "-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER", | 
| +    "-Dcxx_EXPORTS", | 
| +    "-DLIBCXX_BUILDING_LIBCXXABI", | 
| + | 
| +    "-UNDEBUG", | 
| + | 
| +    "-Wno-unused-parameter", | 
| + | 
| +    # Build fix for musl. | 
| +    "-Wno-invalid-constexpr", | 
| +  ] | 
| +} | 
| + | 
| +config("libcxxabi_config") { | 
| +  cflags = [ | 
| +    # Flags from upstream CMake build. | 
| +    "-fstrict-aliasing", | 
| + | 
| +    "-Wchar-subscripts", | 
| +    "-Wconversion", | 
| +    "-Wmismatched-tags", | 
| +    "-Wmissing-braces", | 
| +    "-Wnewline-eof", | 
| +    "-Wshadow", | 
| +    "-Wshorten-64-to-32", | 
| +    "-Wsign-compare", | 
| +    "-Wsign-conversion", | 
| +    "-Wstrict-aliasing=2", | 
| +    "-Wstrict-overflow=4", | 
| +    "-Wundef", | 
| +    "-Wunused-parameter", | 
| +    "-Wunused-variable", | 
| + | 
| +    "-pedantic", | 
| +  ] | 
| +} | 
| + | 
| +source_set("libcxxabi_sources") { | 
| +  configs = [] | 
| +  configs += [ | 
| +    ":libcxxabi_config", | 
| +    ":libcxx_common_config", | 
| +  ] | 
| + | 
| +  deps = [ | 
| +    "//fusl:copy_sysroot", | 
| +  ] | 
| + | 
| +  sources = [ | 
| +    "libcxxabi/src/abort_message.cpp", | 
| +    "libcxxabi/src/cxa_aux_runtime.cpp", | 
| +    "libcxxabi/src/cxa_default_handlers.cpp", | 
| +    "libcxxabi/src/cxa_demangle.cpp", | 
| +    "libcxxabi/src/cxa_exception.cpp", | 
| +    "libcxxabi/src/cxa_exception_storage.cpp", | 
| +    "libcxxabi/src/cxa_guard.cpp", | 
| +    "libcxxabi/src/cxa_handlers.cpp", | 
| +    "libcxxabi/src/cxa_new_delete.cpp", | 
| +    "libcxxabi/src/cxa_personality.cpp", | 
| +    "libcxxabi/src/cxa_thread_atexit.cpp", | 
| +    "libcxxabi/src/cxa_unexpected.cpp", | 
| +    "libcxxabi/src/cxa_vector.cpp", | 
| +    "libcxxabi/src/cxa_virtual.cpp", | 
| +    "libcxxabi/src/exception.cpp", | 
| +    "libcxxabi/src/private_typeinfo.cpp", | 
| +    "libcxxabi/src/stdexcept.cpp", | 
| +    "libcxxabi/src/typeinfo.cpp", | 
| +  ] | 
| +} | 
| + | 
| +source_set("libcxx_sources") { | 
| +  configs = [] | 
| +  configs += [ | 
| +    ":libcxx_config", | 
| +    ":libcxx_common_config", | 
| +  ] | 
| + | 
| +  deps = [ | 
| +    "//fusl:copy_sysroot", | 
| +  ] | 
| + | 
| +  sources = [ | 
| +    "libcxx/src/algorithm.cpp", | 
| +    "libcxx/src/any.cpp", | 
| +    "libcxx/src/bind.cpp", | 
| +    "libcxx/src/chrono.cpp", | 
| +    "libcxx/src/condition_variable.cpp", | 
| +    "libcxx/src/debug.cpp", | 
| +    "libcxx/src/exception.cpp", | 
| +    "libcxx/src/future.cpp", | 
| +    "libcxx/src/hash.cpp", | 
| +    "libcxx/src/ios.cpp", | 
| +    "libcxx/src/iostream.cpp", | 
| +    "libcxx/src/locale.cpp", | 
| +    "libcxx/src/memory.cpp", | 
| +    "libcxx/src/mutex.cpp", | 
| +    "libcxx/src/new.cpp", | 
| +    "libcxx/src/optional.cpp", | 
| +    "libcxx/src/random.cpp", | 
| +    "libcxx/src/regex.cpp", | 
| +    "libcxx/src/shared_mutex.cpp", | 
| +    "libcxx/src/stdexcept.cpp", | 
| +    "libcxx/src/string.cpp", | 
| +    "libcxx/src/strstream.cpp", | 
| +    "libcxx/src/system_error.cpp", | 
| +    "libcxx/src/thread.cpp", | 
| +    "libcxx/src/typeinfo.cpp", | 
| +    "libcxx/src/utility.cpp", | 
| +    "libcxx/src/valarray.cpp", | 
| +  ] | 
| +} | 
| + | 
| +static_library("libcxx") { | 
| +  complete_static_lib = true | 
| + | 
| +  deps = [ | 
| +    ":libcxx_sources", | 
| +    ":libcxxabi_sources", | 
| +  ] | 
| +} | 
|  |