1da0c48c4Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
2da0c48c4Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3da0c48c4Sopenharmony_ci# you may not use this file except in compliance with the License.
4da0c48c4Sopenharmony_ci# You may obtain a copy of the License at
5da0c48c4Sopenharmony_ci#
6da0c48c4Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7da0c48c4Sopenharmony_ci#
8da0c48c4Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9da0c48c4Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10da0c48c4Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11da0c48c4Sopenharmony_ci# See the License for the specific language governing permissions and
12da0c48c4Sopenharmony_ci# limitations under the License.
13da0c48c4Sopenharmony_ci
14da0c48c4Sopenharmony_ciimport("//build/ohos.gni")
15da0c48c4Sopenharmony_ciimport("//third_party/elfutils/elfutils_config.gni")
16da0c48c4Sopenharmony_ci
17da0c48c4Sopenharmony_ciconfig("elfutils_defaults") {
18da0c48c4Sopenharmony_ci  defines = [
19da0c48c4Sopenharmony_ci    "HAVE_CONFIG_H",
20da0c48c4Sopenharmony_ci    "_GNU_SOURCE",
21da0c48c4Sopenharmony_ci    "NMNES=1000",
22da0c48c4Sopenharmony_ci  ]
23da0c48c4Sopenharmony_ci
24da0c48c4Sopenharmony_ci  cflags = [ "-std=gnu99" ]
25da0c48c4Sopenharmony_ci}
26da0c48c4Sopenharmony_ci
27da0c48c4Sopenharmony_ciconfig("elfutils_public_config") {
28da0c48c4Sopenharmony_ci  include_dirs = [ "include" ]
29da0c48c4Sopenharmony_ci}
30da0c48c4Sopenharmony_ci
31da0c48c4Sopenharmony_ci# Build libelf
32da0c48c4Sopenharmony_ciohos_static_library("libelf_static") {
33da0c48c4Sopenharmony_ci  configs = [ ":elfutils_defaults" ]
34da0c48c4Sopenharmony_ci
35da0c48c4Sopenharmony_ci  sources = sources_libelf
36da0c48c4Sopenharmony_ci
37da0c48c4Sopenharmony_ci  include_dirs = [
38da0c48c4Sopenharmony_ci    "//third_party/elfutils",
39da0c48c4Sopenharmony_ci    "//third_party/elfutils/lib",
40da0c48c4Sopenharmony_ci    "//third_party/elfutils/libelf",
41da0c48c4Sopenharmony_ci  ]
42da0c48c4Sopenharmony_ci
43da0c48c4Sopenharmony_ci  deps = []
44da0c48c4Sopenharmony_ci
45da0c48c4Sopenharmony_ci  external_deps = [ "zlib:libz" ]
46da0c48c4Sopenharmony_ci
47da0c48c4Sopenharmony_ci  license_file = "COPYING-LGPLV3"
48da0c48c4Sopenharmony_ci  subsystem_name = "thirdparty"
49da0c48c4Sopenharmony_ci  part_name = "elfutils"
50da0c48c4Sopenharmony_ci}
51da0c48c4Sopenharmony_ci
52da0c48c4Sopenharmony_ci# Build libdw
53da0c48c4Sopenharmony_ciohos_static_library("libdw_static") {
54da0c48c4Sopenharmony_ci  configs = [ ":elfutils_defaults" ]
55da0c48c4Sopenharmony_ci
56da0c48c4Sopenharmony_ci  sources = sources_backends
57da0c48c4Sopenharmony_ci  sources += sources_libcpu
58da0c48c4Sopenharmony_ci  sources += sources_libdw
59da0c48c4Sopenharmony_ci  sources += sources_libdwelf
60da0c48c4Sopenharmony_ci  sources += sources_libdwfl
61da0c48c4Sopenharmony_ci  sources += sources_libebl
62da0c48c4Sopenharmony_ci
63da0c48c4Sopenharmony_ci  include_dirs = [
64da0c48c4Sopenharmony_ci    "//third_party/elfutils",
65da0c48c4Sopenharmony_ci    "//third_party/elfutils/lib",
66da0c48c4Sopenharmony_ci    "//third_party/elfutils/libasm",
67da0c48c4Sopenharmony_ci    "//third_party/elfutils/libelf",
68da0c48c4Sopenharmony_ci    "//third_party/elfutils/libcpu",
69da0c48c4Sopenharmony_ci    "//third_party/elfutils/libdw",
70da0c48c4Sopenharmony_ci    "//third_party/elfutils/libdwelf",
71da0c48c4Sopenharmony_ci    "//third_party/elfutils/libdwfl",
72da0c48c4Sopenharmony_ci    "//third_party/elfutils/libebl",
73da0c48c4Sopenharmony_ci  ]
74da0c48c4Sopenharmony_ci
75da0c48c4Sopenharmony_ci  public_configs = [ ":elfutils_public_config" ]
76da0c48c4Sopenharmony_ci
77da0c48c4Sopenharmony_ci  deps = [ ":libelf_static" ]
78da0c48c4Sopenharmony_ci
79da0c48c4Sopenharmony_ci  license_file = "COPYING-LGPLV3"
80da0c48c4Sopenharmony_ci  subsystem_name = "thirdparty"
81da0c48c4Sopenharmony_ci  part_name = "elfutils"
82da0c48c4Sopenharmony_ci}
83