15f9996aaSopenharmony_ci# Copyright (c) 2013 The Chromium Authors. All rights reserved.
25f9996aaSopenharmony_ci# Use of this source code is governed by a BSD-style license that can be
35f9996aaSopenharmony_ci# found in the LICENSE file.
45f9996aaSopenharmony_ci
55f9996aaSopenharmony_ciimport("//build/config/c++/c++.gni")
65f9996aaSopenharmony_ci
75f9996aaSopenharmony_cigroup("linux") {
85f9996aaSopenharmony_ci  visibility = [ "//:optimize_gn_gen" ]
95f9996aaSopenharmony_ci}
105f9996aaSopenharmony_ci
115f9996aaSopenharmony_ci# This is included by reference in the //build/config/compiler config that
125f9996aaSopenharmony_ci# is applied to all targets. It is here to separate out the logic that is
135f9996aaSopenharmony_ci# Linux-only.
145f9996aaSopenharmony_ciconfig("compiler") {
155f9996aaSopenharmony_ci}
165f9996aaSopenharmony_ci
175f9996aaSopenharmony_ci# This is included by reference in the //build/config/compiler:runtime_library
185f9996aaSopenharmony_ci# config that is applied to all targets. It is here to separate out the logic
195f9996aaSopenharmony_ci# that is Linux-only. Please see that target for advice on what should go in
205f9996aaSopenharmony_ci# :runtime_library vs. :compiler.
215f9996aaSopenharmony_ciconfig("runtime_library") {
225f9996aaSopenharmony_ci  # Set here because OS_CHROMEOS cannot be autodetected in build_config.h like OS_LINUX and the like.
235f9996aaSopenharmony_ci  if (is_chromeos) {
245f9996aaSopenharmony_ci    defines = [ "OS_CHROMEOS" ]
255f9996aaSopenharmony_ci  }
265f9996aaSopenharmony_ci  libs = []
275f9996aaSopenharmony_ci  if ((!is_chromeos || default_toolchain != "//build/toolchain/cros:target") &&
285f9996aaSopenharmony_ci      !use_custom_libcxx) {
295f9996aaSopenharmony_ci    libs += [ "atomic" ]
305f9996aaSopenharmony_ci  }
315f9996aaSopenharmony_ci
325f9996aaSopenharmony_ci  # double framework, use prebuilt libc++.
335f9996aaSopenharmony_ci  if (is_double_framework) {
345f9996aaSopenharmony_ci    if (current_cpu == "x86") {
355f9996aaSopenharmony_ci      libs += [ "${asdk_libs_dir}/ndk/libcxx/linux_x86/libc++.so" ]
365f9996aaSopenharmony_ci    } else {
375f9996aaSopenharmony_ci      libs += [ "${asdk_libs_dir}/ndk/libcxx/linux_x86_64/libc++.so" ]
385f9996aaSopenharmony_ci    }
395f9996aaSopenharmony_ci  }
405f9996aaSopenharmony_ci}
415f9996aaSopenharmony_ci
425f9996aaSopenharmony_ciconfig("executable_config") {
435f9996aaSopenharmony_ci  cflags = [ "-fPIE" ]
445f9996aaSopenharmony_ci  asmflags = [ "-fPIE" ]
455f9996aaSopenharmony_ci  ldflags = [ "-pie" ]
465f9996aaSopenharmony_ci}
475f9996aaSopenharmony_ci
485f9996aaSopenharmony_ciconfig("x11") {
495f9996aaSopenharmony_ci  libs = [
505f9996aaSopenharmony_ci    "X11",
515f9996aaSopenharmony_ci    "X11-xcb",
525f9996aaSopenharmony_ci    "xcb",
535f9996aaSopenharmony_ci    "Xcomposite",
545f9996aaSopenharmony_ci    "Xcursor",
555f9996aaSopenharmony_ci    "Xdamage",
565f9996aaSopenharmony_ci    "Xext",
575f9996aaSopenharmony_ci    "Xfixes",
585f9996aaSopenharmony_ci    "Xi",
595f9996aaSopenharmony_ci    "Xrender",
605f9996aaSopenharmony_ci    "Xtst",
615f9996aaSopenharmony_ci  ]
625f9996aaSopenharmony_ci}
635f9996aaSopenharmony_ci
645f9996aaSopenharmony_ci# Ensures all exported symbols are added to the dynamic symbol table.  This is
655f9996aaSopenharmony_ci# necessary to expose Chrome's custom operator new() and operator delete() (and
665f9996aaSopenharmony_ci# other memory-related symbols) to libraries.  Otherwise, they might
675f9996aaSopenharmony_ci# (de)allocate memory on a different heap, which would spell trouble if pointers
685f9996aaSopenharmony_ci# to heap-allocated memory are passed over shared library boundaries.
695f9996aaSopenharmony_ciconfig("export_dynamic") {
705f9996aaSopenharmony_ci  ldflags = [ "-rdynamic" ]
715f9996aaSopenharmony_ci}
72