blob: 9e727a10b7e271d079c8fedfafc8aa52e7df30f9 [file] [log] [blame]
Dan Willemsenb916b802017-03-19 13:44:32 -07001// Copyright 2017 Google Inc. All rights reserved.
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 cc
16
Kiyoung Kim37693d02024-04-04 09:56:15 +090017import (
18 "android/soong/android"
19 "strings"
20)
21
Dan Willemsenb916b802017-03-19 13:44:32 -070022var (
23 llndkLibrarySuffix = ".llndk"
Jiyong Park2a454122017-10-19 15:59:33 +090024 llndkHeadersSuffix = ".llndk"
Dan Willemsenb916b802017-03-19 13:44:32 -070025)
26
Colin Cross127bb8b2020-12-16 16:46:01 -080027// Holds properties to describe a stub shared library based on the provided version file.
Dan Willemsenb916b802017-03-19 13:44:32 -070028type llndkLibraryProperties struct {
29 // Relative path to the symbol map.
30 // An example file can be seen here: TODO(danalbert): Make an example.
Nan Zhang0007d812017-11-07 10:57:05 -080031 Symbol_file *string
Dan Willemsenb916b802017-03-19 13:44:32 -070032
33 // Whether to export any headers as -isystem instead of -I. Mainly for use by
34 // bionic/libc.
Nan Zhang0007d812017-11-07 10:57:05 -080035 Export_headers_as_system *bool
Dan Willemsenb916b802017-03-19 13:44:32 -070036
37 // Which headers to process with versioner. This really only handles
38 // bionic/libc/include right now.
39 Export_preprocessed_headers []string
40
41 // Whether the system library uses symbol versions.
Nan Zhang0007d812017-11-07 10:57:05 -080042 Unversioned *bool
Jiyong Park82e2bf32017-08-16 14:05:54 +090043
Jiyong Park2a454122017-10-19 15:59:33 +090044 // list of llndk headers to re-export include directories from.
Colin Cross0fb7fcd2021-03-02 11:00:07 -080045 Export_llndk_headers []string
46
47 // list of directories relative to the Blueprints file that willbe added to the include path
48 // (using -I) for any module that links against the LLNDK variant of this module, replacing
49 // any that were listed outside the llndk clause.
50 Override_export_include_dirs []string
Colin Cross127bb8b2020-12-16 16:46:01 -080051
52 // whether this module can be directly depended upon by libs that are installed
53 // to /vendor and /product.
54 // When set to true, this module can only be depended on by VNDK libraries, not
55 // vendor nor product libraries. This effectively hides this module from
56 // non-system modules. Default value is false.
57 Private *bool
Colin Cross1f3f1302021-04-26 18:37:44 -070058
59 // if true, make this module available to provide headers to other modules that set
60 // llndk.symbol_file.
61 Llndk_headers *bool
Dan Willemsenb916b802017-03-19 13:44:32 -070062}
Kiyoung Kim37693d02024-04-04 09:56:15 +090063
64func makeLlndkVars(ctx android.MakeVarsContext) {
65 // Make uses LLNDK_MOVED_TO_APEX_LIBRARIES to avoid installing libraries on /system if
66 // they been moved to an apex.
67 movedToApexLlndkLibraries := make(map[string]bool)
68 ctx.VisitAllModules(func(module android.Module) {
69 if library := moduleLibraryInterface(module); library != nil && library.hasLLNDKStubs() {
70 // Skip bionic libs, they are handled in different manner
71 name := library.implementationModuleName(module.(*Module).BaseModuleName())
72 if module.(android.ApexModule).DirectlyInAnyApex() && !isBionic(name) {
73 movedToApexLlndkLibraries[name] = true
74 }
75 }
76 })
77
78 ctx.Strict("LLNDK_MOVED_TO_APEX_LIBRARIES",
79 strings.Join(android.SortedKeys(movedToApexLlndkLibraries), " "))
80}