1// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_applicable_licenses: ["external_ppp_pppd_license"],
17}
18
19// Added automatically by a large-scale-change that took the approach of
20// 'apply every license found to every target'. While this makes sure we respect
21// every license restriction, it may not be entirely correct.
22//
23// e.g. GPL in an MIT project might only apply to the contrib/ directory.
24//
25// Please consider splitting the single license below into multiple licenses,
26// taking care not to lose any license_kind information, and overriding the
27// default license using the 'licenses: [...]' property on targets as needed.
28//
29// For unused files, consider creating a 'fileGroup' with "//visibility:private"
30// to attach the license to, and including a comment whether the files may be
31// used in the current project.
32// See: http://go/android-license-faq
33license {
34    name: "external_ppp_pppd_license",
35    visibility: [":__subpackages__"],
36    license_kinds: [
37        "SPDX-license-identifier-0BSD",
38        "SPDX-license-identifier-Apache-2.0",
39        "SPDX-license-identifier-BSD",
40        "SPDX-license-identifier-GPL",
41        "SPDX-license-identifier-GPL-2.0",
42        "SPDX-license-identifier-LGPL",
43        "SPDX-license-identifier-MIT",
44        "legacy_notice",
45        "legacy_unencumbered",
46    ],
47    license_text: [
48        "NOTICE",
49    ],
50}
51
52cc_defaults {
53    name: "ppp_defaults",
54    cflags: [
55        "-DCHAPMS=1",
56        "-DMPPE=1",
57        "-DINET6=1",
58        "-DUSE_OPENSSL=1",
59        "-Wno-missing-field-initializers",
60        "-Wno-unused-parameter",
61        "-Werror",
62        "-Wno-pointer-sign",
63        "-DPLUGIN",
64    ],
65    local_include_dirs: ["include"],
66}
67
68filegroup {
69    name: "pppd-sources",
70    srcs: [
71        "auth.c",
72        "ccp.c",
73        "chap-md5.c",
74        "chap-new.c",
75        "chap_ms.c",
76        "demand.c",
77        "eap.c",
78        "ecp.c",
79        "eui64.c",
80        "fsm.c",
81        "ipcp.c",
82        "ipv6cp.c",
83        "lcp.c",
84        "magic.c",
85        "main.c",
86        "options.c",
87        "pppcrypt.c",
88        "pppox.c",
89        "session.c",
90        "sys-linux.c",
91        "tty.c",
92        "upap.c",
93        "utils.c",
94    ]
95}
96
97cc_library_static {
98    name: "libpppd",
99    defaults: ["ppp_defaults"],
100
101    srcs: [
102        ":pppd-sources"
103    ],
104    export_include_dirs:[".", "include"],
105
106    // options.c:623:21: error: passing 'const char *' to parameter of
107    // type 'char *' discards qualifiers.
108    // [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
109    clang_cflags: ["-Wno-incompatible-pointer-types-discards-qualifiers"],
110
111    shared_libs: [
112        "libdl",
113        "liblog",
114        "libcutils",
115        "libcrypto",
116    ],
117
118    cflags: [
119        "-Dmain=main_loop",
120        "-Wno-empty-body",
121        "-Wno-attributes",
122        "-Wno-sign-compare",
123    ],
124
125    ldflags: ["-rdynamic"],
126    required: [
127        "pppol2tp-android",
128        "pppopptp-android",
129    ],
130}
131
132cc_binary {
133    name: "pppd",
134    defaults: ["ppp_defaults"],
135
136    srcs: [
137        ":pppd-sources"
138    ],
139
140    shared_libs: [
141        "libdl",
142        "liblog",
143        "libcutils",
144        "libcrypto",
145    ],
146
147    ldflags: ["-rdynamic"],
148
149    clang_cflags: ["-Wno-incompatible-pointer-types-discards-qualifiers"],
150
151    required: [
152        "pppol2tp-android",
153        "pppopptp-android",
154    ],
155
156    sanitize: {
157        memtag_heap: true,
158    },
159}
160
161cc_library_shared {
162    name: "pppol2tp-android",
163    defaults: ["ppp_defaults"],
164    srcs: ["plugins/pppol2tp-android/pppol2tp-android.c"],
165    allow_undefined_symbols: true,
166}
167
168cc_library_shared {
169    name: "pppopptp-android",
170    defaults: ["ppp_defaults"],
171    srcs: ["plugins/pppopptp-android/pppopptp-android.c"],
172    allow_undefined_symbols: true,
173}
174