Various build rule changes to match AOSP:
Add libunwind_llvm and libdl as dependencies for libc++ on device
Always add libcompiler_rt-extras as a dependency
Add libm, libc, and libdl as depnendencies for libc++ static binaries
Disable some clang warnings, and add some clang filtered cflags
Add -fstack-protector to host linux builds
Add jack_flags property to java modules (currently ignored)
Change-Id: Ic0da617bdeaf25f58cb8298dd9ea91b7d6509151
Make static or shared cflags properties apply to all source files,
not just the source files defined in the static or shared block.
Needed for libunwind, which passes -DUNW_ADDITIONAL_PREFIX to source
files for the static library, but not for the shared library.
Change-Id: I3cd88cc1099e505eeee077c697db00de22a8b03a
Add genrule, which uses a host executable (possibly built by the
build system) to generate a single source file. This differs slightly
from gensrcs, which takes a list of sources and translates them through
a host executable to individual source files.
Change-Id: I94bda62c4c53fb3f3817def190e6a7561508d297
Add libgtest to native test dependencies before adding stl
dependencies to resolve link errors between libgtest and
libc++_static.
Install device native tests to /dava/nativetest32 and
/data/nativetest64.
Change-Id: I6d9ddba8d5cdbacaa86cae0833fd7e656657e4d9
Allow combined static/shared libraries to specify separate dependencies,
and recompile objects if static or shared cflags are set.
Change-Id: I9fd71d8debd5ade5637389ee38e793082d6d18bb
Host gcc libraries should only apply to static binaries, not all
static libraries. Add c.staticBinary(), and rework everything
else to use c.static(), removing c.shared().
Change-Id: I8addae9b6848010cef94d873f48e7e358e4f5059
Pass --fix-cortex-a8 only on Cortex A8 and generic ARM builds, and
pass --no-fix-cortex-a8 on everything else.
Change-Id: I4b12afee4de443b5d55df66be3c6a05251715e31
Targeting the platform-provided libc++ on the host requires passing
-nodefautlibs to gcc, and then re-adding all the default libs except
libc++.
Change-Id: I5a42375bcc819b07f6ee02e9d76e7f5088fa00e0
Instead of the complicated Flags and DepNames system used now
for overriding CC modules, export all the main structs and the
properties structs so that module types that override them can
modify properties before build rule generation starts.
Change-Id: I6d71550def1ef07798b27d5fec40739ef3ac8165
Reduce the number of flags variables when compiling C by getting
rid of the separately-tracked IncludeDirs variables, and putting
them directly in GlobalFlags. Also changes exportedIncludeDirs
to exportedFlags, which will allow exporting flags besides -I.
Also fixes a bug when building a module with the NDK and -Werror
by passing NDK exported include directories with -isystem instead
of -I, which will ignore warnings from those includes.
Also fixes a bug where the default includes were being inserted
into all cflags by the arm and arm64 toolchain modules.
Change-Id: Ice97f84e637b21d20c38c85b881afa315f9f92ae
Modules built against the NDK shouldn't get the global or arch-specific
include paths, all headers will be provided by depenendencies or the
NDK.
Change-Id: I13b9530a365e11e9cf6bd2b99b756b36944e0a9e
Support specifying an install path relative to the default install
path for cc libraries and binaries.
Change-Id: I47a97de9beaedde27d99c498c3f26c9d36358d94
Add support for aidl files listed in srcs for java builds, and
an aidl_preprocess module type for framework and sdk aidls.
Change-Id: I3aa537f4483822e5b534c74d0b35f13a938f8947
Support -file or -path/glob in file lists that contain globs to
subtract files from the resulting glob. Also move source file
prefixing and handling into a common function.
Change-Id: Ib6d74ce22f53cae7348c4ba35b779976d90359a6
Using ctx.Config().(Config) everywhere is a mouthful, and it is
inefficient to do the type assertion. Put the Config interface into
the context, and provide an AConfig() to return the Config already
converted to the right type.
Change-Id: I301a1fd7d2a005580aabca7866a37c5d42ad8c69
Add support for yacc (.y or .yy) and lex (.l or .ll) files. Also
tweak locations of .o files for normal and generated sources to
makes sure they don't collide.
Change-Id: I03172cddbdc022525bf392a81d72050406b8cdb3
ld and ar command lines often end up larger than ARG_MAX, use Ninja's
rsp file support to automatically write the object files to a temporary
file and pass it in using @file support.
This isn't going to work on Darwin host builds, where the host
toolchains don't support @.
Change-Id: Ida2f4e114ab02df6967e863577fa324e197827d5
Move ndk linking against libc and libm out of system shared libraries
so that static libraries that link against the ndk can depend on
libc and libm, which is required to get the ndk sysroot include path.
Also make ndk stl versions only apply to the device variant of
multi-target builds.
Change-Id: I6926541da17b9baf3aa7f811a839c3b65c5d804d
Instead of setting a string property to magic default value and then
checking for it later, call ctx.ContainsProperty to determine if it
was set. Use the same method on the clang bool property, which
couldn't be set to a magic value.
blueprint's ModuleContext.ContainsProperty only works on a single
property, not on all arch variant properties -
ModuleContext.ContainsProperty("clang") will return false if
clang was not set but arch.arm.clang was set - so track which
properties were extended inside extendProperties, and override
ModuleContext.ContainsProperty in AndroidModuleContext to also
check the extended properties.
Change-Id: I03cbe71dc69344972e23d6c794da9be05e720c45
The suffix property will modify the name of the resulting binary
by adding its value to the module name.
Change-Id: I188e97d4c88f26c060ba2ffbd37f832d701fe0cb
The linker needs to add __dl_ to the beginning of all of its symbols
to avoid conflicts. Add support for a prefix_symbols property, and
insert an objcopy --prefix_symbols build step to produce the final
binary.
Change-Id: I70de7c830cd64305e5900c6de53efecea2e17c75
ccLibrary uses ccDynamic for linking shared libraries, but bypasses
it by calling directly into ccBase for static libraries. Instead of
duplicating the same mess for ccBinary, rename ccDynamic to ccLinked
and add the logic for dealing with static or shared linkage. This
also allows moving the stl logic out of ccBase and into ccLinked.
Change-Id: Idfa6d86de16911c8851f694d6ed92681c8939281
CC module dependencies need to be handled in both AndroidDynamicDependencies
and GenerateAndroidBuildActions. Replace handling them in both with
splitting out individual functions to list each type of dependency,
and then call them from both AndroidDynamicDependencies and collectDeps
in GenerateAndroidBuildActions.
Change-Id: If8104f6ec4846a389a41ab599b1167bcf47b45b7
Add Host(), Device(), and Debug() to AndroidModuleContext to allow
build rule generators to easily determine build options.
Change-Id: Ib93a462cb45189399063f641b3a8df175db0592e
Art needs a custom module type in order to perform complicated
build logic like depending on environment variables and varying
cflags based on cpu variant. Export enough of the types and
functions from cc for art_cc_library to inherit from cc_library.
While I'm touching every line, also rename the New* methods
to *Factory.
Change-Id: I7123aa47019c4ced7a1ab57c394225bc7844b5ea
Add art and libnativehelper to the root Blueprints file, and
add a warning used by art to the clang unknown flags list.
Change-Id: If282413103fa20fa66422e4330fbabff61b66144
Some cc_test modules want a test per source file, for example when
there is global state that needs to be reset between each test
suite, but no way to reset it. Allow them to specify test_per_src: true,
which will cause a separate test to be built for each source file.
Change-Id: I3dbf1202fb070437cb0109f195dc11a6440061ee
Exported include dirs were only being copied to the build flags
in ccDynamic. Move the copy to after collectDeps is run so it
picks up the extra includes from all the overriden functions.
Also check exported include dirs of shared library dependencies
of static libraries.
Change-Id: Idb94277f88bbb10869e72011113df57f586274de
Add sdk_version property that will be used later for NDK builds.
For now, use it to determine if libnativehelper/include/nativehelper
should be added to the global include dirs.
Change-Id: I4e0f9b3f27c380b1ac28f163b1d2b43a46d7191c
Add debug: { cflags: [...] } and release: { cflags: [...] }.
For now it always takes the release cflags, later a per-module
debug selector will allow using the debug cflags.
Change-Id: I40bc68267287db901e47e74983d0d61fda2b9367
This behaves slightly differently than it does in the make based build.
1. The make based build manually passes -DGTEST_OS_ANDROID (or
whatever). gtest-port.h already has logic that does this, so it's a
no-op.
2. Host libraries are named identically, rather than libgtest_host.
Change-Id: Ic40a1025c698611d202cb7c8ec45abd8fe130065
Refactor common code out of NewCC* to initialize the ccBase,
ccDynamic, and ccLibrary structures. Also adds an enum for the
default multilib values.
Change-Id: Iaeffe86bf2568b6054be4ddcee725818af45e14f