Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
// Copyright 2017 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package cc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"android/soong/android"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2018-06-08 14:08:40 +08:00
|
|
|
vndkSuffix = ".vndk."
|
|
|
|
binder32Suffix = ".binder32"
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
// Creates vndk prebuilts that include the VNDK version.
|
|
|
|
//
|
|
|
|
// Example:
|
|
|
|
//
|
|
|
|
// vndk_prebuilt_shared {
|
|
|
|
// name: "libfoo",
|
2020-01-22 10:11:29 +08:00
|
|
|
// version: "27",
|
|
|
|
// target_arch: "arm64",
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
// vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
// product_available: true,
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
// vndk: {
|
|
|
|
// enabled: true,
|
|
|
|
// },
|
|
|
|
// export_include_dirs: ["include/external/libfoo/vndk_include"],
|
|
|
|
// arch: {
|
|
|
|
// arm64: {
|
|
|
|
// srcs: ["arm/lib64/libfoo.so"],
|
|
|
|
// },
|
|
|
|
// arm: {
|
|
|
|
// srcs: ["arm/lib/libfoo.so"],
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
type vndkPrebuiltProperties struct {
|
2017-12-29 15:20:21 +08:00
|
|
|
// VNDK snapshot version.
|
|
|
|
Version *string
|
|
|
|
|
2020-11-03 18:27:32 +08:00
|
|
|
// Target arch name of the snapshot (e.g. 'arm64' for variant 'aosp_arm64')
|
2017-12-29 15:20:21 +08:00
|
|
|
Target_arch *string
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
|
2018-06-08 14:08:40 +08:00
|
|
|
// If the prebuilt snapshot lib is built with 32 bit binder, this must be set to true.
|
|
|
|
// The lib with 64 bit binder does not need to set this property.
|
|
|
|
Binder32bit *bool
|
|
|
|
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
// Prebuilt files for each arch.
|
|
|
|
Srcs []string `android:"arch_variant"`
|
2018-11-20 11:59:08 +08:00
|
|
|
|
2019-05-14 17:52:49 +08:00
|
|
|
// list of flags that will be used for any module that links against this module.
|
|
|
|
Export_flags []string `android:"arch_variant"`
|
|
|
|
|
2018-11-20 11:59:08 +08:00
|
|
|
// Check the prebuilt ELF files (e.g. DT_SONAME, DT_NEEDED, resolution of undefined symbols,
|
|
|
|
// etc).
|
|
|
|
Check_elf_files *bool
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type vndkPrebuiltLibraryDecorator struct {
|
|
|
|
*libraryDecorator
|
2020-02-17 17:00:39 +08:00
|
|
|
properties vndkPrebuiltProperties
|
|
|
|
androidMkSuffix string
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *vndkPrebuiltLibraryDecorator) Name(name string) string {
|
2017-12-29 15:20:21 +08:00
|
|
|
return name + p.NameSuffix()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *vndkPrebuiltLibraryDecorator) NameSuffix() string {
|
2018-06-08 14:08:40 +08:00
|
|
|
suffix := p.version()
|
2017-12-29 15:20:21 +08:00
|
|
|
if p.arch() != "" {
|
2018-06-08 14:08:40 +08:00
|
|
|
suffix += "." + p.arch()
|
|
|
|
}
|
|
|
|
if Bool(p.properties.Binder32bit) {
|
|
|
|
suffix += binder32Suffix
|
2017-12-29 15:20:21 +08:00
|
|
|
}
|
2018-06-08 14:08:40 +08:00
|
|
|
return vndkSuffix + suffix
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *vndkPrebuiltLibraryDecorator) version() string {
|
2017-12-29 15:20:21 +08:00
|
|
|
return String(p.properties.Version)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *vndkPrebuiltLibraryDecorator) arch() string {
|
|
|
|
return String(p.properties.Target_arch)
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
}
|
|
|
|
|
2018-06-08 14:08:40 +08:00
|
|
|
func (p *vndkPrebuiltLibraryDecorator) binderBit() string {
|
|
|
|
if Bool(p.properties.Binder32bit) {
|
|
|
|
return "32"
|
|
|
|
}
|
|
|
|
return "64"
|
|
|
|
}
|
|
|
|
|
2021-01-23 06:06:33 +08:00
|
|
|
func (p *vndkPrebuiltLibraryDecorator) snapshotAndroidMkSuffix() string {
|
|
|
|
return ".vendor"
|
|
|
|
}
|
|
|
|
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
func (p *vndkPrebuiltLibraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
2017-12-29 15:20:21 +08:00
|
|
|
p.libraryDecorator.libName = strings.TrimSuffix(ctx.ModuleName(), p.NameSuffix())
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
return p.libraryDecorator.linkerFlags(ctx, flags)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *vndkPrebuiltLibraryDecorator) singleSourcePath(ctx ModuleContext) android.Path {
|
|
|
|
if len(p.properties.Srcs) == 0 {
|
|
|
|
ctx.PropertyErrorf("srcs", "missing prebuilt source file")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(p.properties.Srcs) > 1 {
|
|
|
|
ctx.PropertyErrorf("srcs", "multiple prebuilt source files")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return android.PathForModuleSrc(ctx, p.properties.Srcs[0])
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
|
|
|
flags Flags, deps PathDeps, objs Objects) android.Path {
|
2019-10-03 07:01:35 +08:00
|
|
|
|
2019-10-18 15:26:59 +08:00
|
|
|
if !p.matchesWithDevice(ctx.DeviceConfig()) {
|
2020-12-17 02:20:23 +08:00
|
|
|
ctx.Module().HideFromMake()
|
2019-10-03 07:01:35 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
if len(p.properties.Srcs) > 0 && p.shared() {
|
2019-05-14 17:52:49 +08:00
|
|
|
p.libraryDecorator.exportIncludes(ctx)
|
|
|
|
p.libraryDecorator.reexportFlags(p.properties.Export_flags...)
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
// current VNDK prebuilts are only shared libs.
|
2020-01-22 10:11:29 +08:00
|
|
|
|
|
|
|
in := p.singleSourcePath(ctx)
|
|
|
|
builderFlags := flagsToBuilderFlags(flags)
|
|
|
|
p.unstrippedOutputFile = in
|
|
|
|
libName := in.Base()
|
2020-08-19 20:53:01 +08:00
|
|
|
if p.stripper.NeedsStrip(ctx) {
|
|
|
|
stripFlags := flagsToStripFlags(flags)
|
2020-01-22 10:11:29 +08:00
|
|
|
stripped := android.PathForModuleOut(ctx, "stripped", libName)
|
2020-08-19 20:53:01 +08:00
|
|
|
p.stripper.StripExecutableOrSharedLib(ctx, in, stripped, stripFlags)
|
2020-01-22 10:11:29 +08:00
|
|
|
in = stripped
|
|
|
|
}
|
|
|
|
|
|
|
|
// Optimize out relinking against shared libraries whose interface hasn't changed by
|
|
|
|
// depending on a table of contents file instead of the library itself.
|
|
|
|
tocFile := android.PathForModuleOut(ctx, libName+".toc")
|
|
|
|
p.tocFile = android.OptionalPathForPath(tocFile)
|
2020-11-24 06:02:44 +08:00
|
|
|
transformSharedObjectToToc(ctx, in, tocFile, builderFlags)
|
2020-01-22 10:11:29 +08:00
|
|
|
|
2020-02-17 17:00:39 +08:00
|
|
|
p.androidMkSuffix = p.NameSuffix()
|
|
|
|
|
|
|
|
vndkVersion := ctx.DeviceConfig().VndkVersion()
|
|
|
|
if vndkVersion == p.version() {
|
|
|
|
p.androidMkSuffix = ""
|
|
|
|
}
|
|
|
|
|
2020-09-19 05:15:30 +08:00
|
|
|
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
|
|
|
|
SharedLibrary: in,
|
|
|
|
UnstrippedSharedLibrary: p.unstrippedOutputFile,
|
|
|
|
|
|
|
|
TableOfContents: p.tocFile,
|
|
|
|
})
|
|
|
|
|
2020-10-16 15:23:05 +08:00
|
|
|
p.libraryDecorator.flagExporter.setProvider(ctx)
|
|
|
|
|
2020-01-22 10:11:29 +08:00
|
|
|
return in
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
}
|
2019-10-03 07:01:35 +08:00
|
|
|
|
2020-12-17 02:20:23 +08:00
|
|
|
ctx.Module().HideFromMake()
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-10-18 15:26:59 +08:00
|
|
|
func (p *vndkPrebuiltLibraryDecorator) matchesWithDevice(config android.DeviceConfig) bool {
|
|
|
|
arches := config.Arches()
|
|
|
|
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if config.BinderBitness() != p.binderBit() {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if len(p.properties.Srcs) == 0 {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2019-09-09 09:49:03 +08:00
|
|
|
func (p *vndkPrebuiltLibraryDecorator) nativeCoverage() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2020-06-01 22:23:05 +08:00
|
|
|
func (p *vndkPrebuiltLibraryDecorator) isSnapshotPrebuilt() bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
func (p *vndkPrebuiltLibraryDecorator) install(ctx ModuleContext, file android.Path) {
|
2020-10-20 17:54:21 +08:00
|
|
|
// do not install vndk libs
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func vndkPrebuiltSharedLibrary() *Module {
|
|
|
|
module, library := NewLibrary(android.DeviceSupported)
|
|
|
|
library.BuildOnlyShared()
|
|
|
|
module.stl = nil
|
|
|
|
module.sanitize = nil
|
2020-08-19 20:53:01 +08:00
|
|
|
library.disableStripping()
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
|
|
|
|
prebuilt := &vndkPrebuiltLibraryDecorator{
|
|
|
|
libraryDecorator: library,
|
|
|
|
}
|
|
|
|
|
2018-11-20 11:59:08 +08:00
|
|
|
prebuilt.properties.Check_elf_files = BoolPtr(false)
|
2019-08-26 15:52:35 +08:00
|
|
|
prebuilt.baseLinker.Properties.No_libcrt = BoolPtr(true)
|
|
|
|
prebuilt.baseLinker.Properties.Nocrt = BoolPtr(true)
|
|
|
|
|
|
|
|
// Prevent default system libs (libc, libm, and libdl) from being linked
|
|
|
|
if prebuilt.baseLinker.Properties.System_shared_libs == nil {
|
|
|
|
prebuilt.baseLinker.Properties.System_shared_libs = []string{}
|
|
|
|
}
|
2018-11-20 11:59:08 +08:00
|
|
|
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
module.compiler = nil
|
|
|
|
module.linker = prebuilt
|
|
|
|
module.installer = prebuilt
|
|
|
|
|
|
|
|
module.AddProperties(
|
|
|
|
&prebuilt.properties,
|
|
|
|
)
|
|
|
|
|
2020-10-23 13:36:11 +08:00
|
|
|
android.AddLoadHook(module, func(ctx android.LoadHookContext) {
|
|
|
|
// empty BOARD_VNDK_VERSION implies that the device won't support
|
|
|
|
// system only OTA. In this case, VNDK snapshots aren't needed.
|
|
|
|
if ctx.DeviceConfig().VndkVersion() == "" {
|
|
|
|
ctx.Module().Disable()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
return module
|
|
|
|
}
|
|
|
|
|
2019-04-02 01:56:49 +08:00
|
|
|
// vndk_prebuilt_shared installs Vendor Native Development kit (VNDK) snapshot
|
|
|
|
// shared libraries for system build. Example:
|
|
|
|
//
|
|
|
|
// vndk_prebuilt_shared {
|
|
|
|
// name: "libfoo",
|
2020-01-22 10:11:29 +08:00
|
|
|
// version: "27",
|
|
|
|
// target_arch: "arm64",
|
2019-04-02 01:56:49 +08:00
|
|
|
// vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
// product_available: true,
|
2019-04-02 01:56:49 +08:00
|
|
|
// vndk: {
|
|
|
|
// enabled: true,
|
|
|
|
// },
|
|
|
|
// export_include_dirs: ["include/external/libfoo/vndk_include"],
|
|
|
|
// arch: {
|
|
|
|
// arm64: {
|
|
|
|
// srcs: ["arm/lib64/libfoo.so"],
|
|
|
|
// },
|
|
|
|
// arm: {
|
|
|
|
// srcs: ["arm/lib/libfoo.so"],
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// }
|
2019-08-23 10:17:39 +08:00
|
|
|
func VndkPrebuiltSharedFactory() android.Module {
|
Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-11-17 11:10:28 +08:00
|
|
|
module := vndkPrebuiltSharedLibrary()
|
|
|
|
return module.Init()
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2019-08-23 10:17:39 +08:00
|
|
|
android.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
2017-12-07 05:08:00 +08:00
|
|
|
}
|