chromium/third_party/apache-portable-runtime/BUILD.gn

# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/android/config.gni")

# In a separate config so that the -Wno flag shows up after -Wall.
config("apr_warnings") {
  if (is_clang) {
    cflags = [
      # TODO(https://crbug.com/1347226): Investigate, fix.
      "-Wno-deprecated-declarations",

      # TODO(https://crbug.com/1343303): Remove once fix is rolled in.
      "-Wno-array-parameter",
    ]
  }
}

# Builds 'Apache Portable Runtime'. See http://apr.apache.org
static_library("apr") {
  sources = [
    "src/atomic/unix/builtins.c",
    "src/atomic/unix/ia32.c",
    "src/atomic/unix/mutex.c",
    "src/atomic/unix/ppc.c",
    "src/atomic/unix/s390.c",
    "src/atomic/unix/solaris.c",
    "src/dso/unix/dso.c",
    "src/file_io/unix/buffer.c",
    "src/file_io/unix/copy.c",
    "src/file_io/unix/dir.c",
    "src/file_io/unix/fileacc.c",
    "src/file_io/unix/filedup.c",
    "src/file_io/unix/filepath.c",
    "src/file_io/unix/filepath_util.c",
    "src/file_io/unix/filestat.c",
    "src/file_io/unix/flock.c",
    "src/file_io/unix/fullrw.c",
    "src/file_io/unix/mktemp.c",
    "src/file_io/unix/open.c",
    "src/file_io/unix/pipe.c",
    "src/file_io/unix/readwrite.c",
    "src/file_io/unix/seek.c",
    "src/file_io/unix/tempdir.c",
    "src/include/apr_skiplist.h",
    "src/include/arch/apr_private_common.h",
    "src/include/arch/unix/apr_arch_atomic.h",
    "src/include/arch/unix/apr_arch_dso.h",
    "src/include/arch/unix/apr_arch_file_io.h",
    "src/include/arch/unix/apr_arch_global_mutex.h",
    "src/include/arch/unix/apr_arch_internal_time.h",
    "src/include/arch/unix/apr_arch_misc.h",
    "src/include/arch/unix/apr_arch_networkio.h",
    "src/include/arch/unix/apr_arch_poll_private.h",
    "src/include/arch/unix/apr_arch_proc_mutex.h",
    "src/include/arch/unix/apr_arch_shm.h",
    "src/include/arch/unix/apr_arch_thread_cond.h",
    "src/include/arch/unix/apr_arch_thread_mutex.h",
    "src/include/arch/unix/apr_arch_thread_rwlock.h",
    "src/include/arch/unix/apr_arch_threadproc.h",
    "src/include/arch/unix/apr_private.h",
    "src/locks/unix/global_mutex.c",
    "src/locks/unix/proc_mutex.c",
    "src/locks/unix/thread_cond.c",
    "src/locks/unix/thread_mutex.c",
    "src/locks/unix/thread_rwlock.c",
    "src/memory/unix/apr_pools.c",
    "src/misc/unix/charset.c",
    "src/misc/unix/env.c",
    "src/misc/unix/errorcodes.c",
    "src/misc/unix/getopt.c",
    "src/misc/unix/otherchild.c",
    "src/misc/unix/rand.c",
    "src/misc/unix/start.c",
    "src/misc/unix/version.c",
    "src/mmap/unix/common.c",
    "src/mmap/unix/mmap.c",
    "src/network_io/unix/inet_ntop.c",
    "src/network_io/unix/inet_pton.c",
    "src/network_io/unix/multicast.c",
    "src/network_io/unix/sendrecv.c",
    "src/network_io/unix/sockaddr.c",
    "src/network_io/unix/sockets.c",
    "src/network_io/unix/sockopt.c",
    "src/passwd/apr_getpass.c",
    "src/poll/unix/epoll.c",
    "src/poll/unix/kqueue.c",
    "src/poll/unix/poll.c",
    "src/poll/unix/pollcb.c",
    "src/poll/unix/pollset.c",
    "src/poll/unix/port.c",
    "src/poll/unix/select.c",
    "src/random/unix/apr_random.c",
    "src/random/unix/sha2.c",
    "src/random/unix/sha2.h",
    "src/random/unix/sha2_glue.c",
    "src/shmem/unix/shm.c",
    "src/strings/apr_cpystrn.c",
    "src/strings/apr_fnmatch.c",
    "src/strings/apr_snprintf.c",
    "src/strings/apr_strings.c",
    "src/strings/apr_strnatcmp.c",
    "src/strings/apr_strtok.c",
    "src/support/unix/waitio.c",
    "src/tables/apr_hash.c",
    "src/tables/apr_skiplist.c",
    "src/tables/apr_tables.c",
    "src/threadproc/unix/proc.c",
    "src/threadproc/unix/procsup.c",
    "src/threadproc/unix/signals.c",
    "src/threadproc/unix/thread.c",
    "src/threadproc/unix/threadpriv.c",
    "src/time/unix/time.c",
    "src/time/unix/timestr.c",
    "src/user/unix/groupinfo.c",
    "src/user/unix/userinfo.c",
  ]
  include_dirs = [
    "src/include",
    "src/include/arch/unix",
  ]
  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [
    "//build/config/compiler:no_chromium_code",

    # Must be after no_chromium_code so -Wno flags show up after -Wall.
    ":apr_warnings",
  ]

  # See https://crbug.com/1347085 --- older Android's NDK has different strerror_p.
  if (is_android && default_min_sdk_version < 23) {
    defines = [ "STRERROR_R_RC_INT" ]
  }
}