Commit graph

222 commits

Author SHA1 Message Date
Dan Willemsen
648c8aed4c Support unique_host_soname to add -host for shared libs
In order to distinguish our host libraries from system installed
libraries, support a flag to automatically append -host to host shared
libraries names. Previously, we were implementing this with different modules,
but with Soong, we'd really like to share the module definitions.

This properly exports the module to make, so that
LOCAL_SHARED_LIBRARIES := libcrypto still works, but the final installed
name is libcrypto-host.so.

Change-Id: I63389469fe1b38078b8bbf4c0fd92e54ef90ae1a
2016-07-21 16:42:14 -07:00
Dan Albert
6a0476930a Remove the implicit "_" in subnames.
The NDK stub libraries need to use subname, but should use "." instead
of "_".

Test: Still builds.
Change-Id: Ib4b0303531e03968c55671ea167ab987adebd783
2016-07-18 23:31:18 -07:00
Colin Cross
3854a60c55 Add symlink installation support
Allow modules to specify a list of names to create alias symlinks, and
pass the list to make so it can create them.  Also pass
LOCAL_FORCE_STATIC_EXECUTABLE for static binaries so that make can avoid
a linker_asan -> linker -> linker_asan dependency loop.

Change-Id: I314d088095ac5f43641ed2cf8247c14c27e23b93
2016-07-15 13:37:03 -07:00
Dan Willemsen
f2c27d7370 Export the default LOCAL_STRIP_MODULE value
In make, BUILD_PREBUILT and BUILD_SHARED_LIBRARY/BUILD_EXECUTABLE use
different defaults for LOCAL_STRIP_MODULE. Explicitly use the
BUILD_SHARED_LIBRARY/BUILD_EXECUTABLE default so that we'll strip
binaries the same way when converting from Make to Soong.

BUILD_SHARED_LIBRARY/BUILD_EXECUTABLE uses the default set in
dynamic_binary.mk: mini-debug-info.

BUILD_PREBUILT (SHARED_LIBRARIES) uses no_debuglink
BUILD_PREBUILT (EXECUTABLES) doesn't strip by default

None of the above support stripping host modules.

Change-Id: I73a6f7bd7d2ed2033936579c78ae4980386dd4a2
2016-07-13 17:33:49 -07:00
Colin Cross
c7a38dc00c Add support for test libraries
Add cc_test_library, which is a combination of a cc_test and a static
library.  Requires adding a libraryInterface to identify libraries that
are embedded in other types.

Change-Id: I2f0dcccb2f7243409210547562d2b41c3fbce44e
2016-07-12 13:13:09 -07:00
Dan Willemsen
72d3993c9b Stop exporting NDK prebuilt modules to Make
Make isn't going to use any of these anytime soon. So hide them from
make for now, and be sure to save the AndroidMk shared library
dependencies before we convert them to NDK dependencies.

And $(ACP) is no longer used by $(copy-file-to-target)

Change-Id: I8f8f7d0177d31ba4206c0bc1f2ff952dce53b6b4
2016-07-08 23:41:36 -07:00
Colin Cross
7b5c22b1f0 Don't specify LOCAL_STRIP_MODULE for static libraries
After I92a838b07fe4116d5a4b8521fe1ce8d44e6e84e2 in build/,
LOCAL_STRIP_MODULE := keep_symbols will be honored for prebuilts, which
will trigger an error if it is set on a static library.  Only set
LOCAL_STRIP_MODULE for binaries and shared libraries.

Change-Id: I4e17a78afa7c5810dbf9003166c14a1ff3a59c9e
2016-07-07 11:21:53 -07:00
Dan Willemsen
7517ed0b46 Export strip information to Make
Change-Id: I3c69451a505ac2b97f3112050acc4b64b1cd7394
2016-06-10 17:20:30 -07:00
Dan Willemsen
a96ff64527 Check NDK linking, expose SDK_VERSION to Make
Modules defining sdk_version should only be allowed to link against the
ndk prebuilt libraries and other modules defining sdk_version. Implement
this, and expose the necessary information to Make so that it can be
implemented there as well.

Change-Id: I051498b595f8711883bc120f0394b8bfe2f65bce
2016-06-07 21:52:12 -07:00
Colin Cross
bc6fb16b26 Support sanitizer variants inside make builds
Create both sanitized and unsanitized variants inside make builds with
sanitizers enabled.  Only export the sanitized version to make, and
always install the sanitized version in /data to match the make build.

Change-Id: I5a17bcbddc7a9d871c929c84d3c116228ef3258f
2016-05-24 17:14:15 -07:00
Colin Cross
635c3b0157 Rename common to android
Rename the "common" package to "android", because common is too
generic.  Also removes all android.Android naming stutter.

Ran:
gomvpkg -from 'android/soong/common' -to 'android/soong/android'
gorename -from '"android/soong/android".AndroidModuleContext' -to 'ModuleContext'
gorename -from '"android/soong/android".AndroidBaseContext' -to 'BaseContext'
gorename -from '"android/soong/android".AndroidModuleBase' -to 'ModuleBase'
gorename -from '"android/soong/android".AndroidBottomUpMutatorContext' -to 'BottomUpMutatorContext'
gorename -from '"android/soong/android".AndroidTopDownMutatorContext' -to 'TopDownMutatorContext'
gorename -from '"android/soong/android".AndroidModule' -to 'Module'

Change-Id: I3b23590b8ce7c8a1ea1139411d84a53163288da7
2016-05-18 15:37:25 -07:00
Dan Willemsen
e7932e890b Properly export toolchain static libs
Change-Id: I7fd5308469aee5a43d576d1a72f7738dc6f9fbaa
2016-05-16 15:56:53 -07:00
Dan Willemsen
3b1fffa33b Fix Android.mk LOCAL_EXPORT_C_INCLUDE_DIRS generation
We were keeping the original array, and adding duplicates with -I
removed. Instead, only add entries that start with -I, but continue
stripping that off. This removes the -isystem arguments from the NDK
libraries.

Change-Id: I8fd71bbd6b7a051aad7e80a92a05dbdc05a6b87a
2016-05-05 15:11:48 -07:00
Colin Cross
30d5f514dd Support sanitizer builds inside make
Make expects libraries built with address sanitizer to be installed into
/data, and can't handle multiple variants of modules.

Change-Id: Ice575ff6f0788a88f296e7b3ee521a2b9771f55f
2016-05-03 18:02:42 -07:00
Colin Cross
e14388b9de Remove trailing / from install path
Prevents make installing files with a double /:
Install: out/target/product/generic_arm64/system/lib//libc.so

Change-Id: Iee237f344e8140c4938aa9d1e6940e4fdbfa7cd8
2016-05-03 14:53:18 -07:00
Colin Cross
c99deeb961 Use blueprint DependencyTags
Blueprint now requres DependencyTags to be passed to AddDependency
calls.  Use the tags to avoid setting member variables on modules, which
will be lost after the mutators have been called.

Change-Id: I8c1d9ed1db85a300e14394b911a516d361ba9f75
2016-04-12 15:24:02 -07:00
Colin Cross
bf305dea81 Remove extension from LOCAL_MODULE_STEM
LOCAL_MODULE_STEM adds the expected extension to the installation path,
remove the extension from the filename.

Change-Id: I54dbcfa73d8d07fc3630caf2d582160003e28f79
2016-03-29 17:32:06 -07:00
Colin Cross
a23446680f Use correct install paths in generated Android.mk
Extract Soong's install path and put it in the generated Android.mk file
so that tests get installed in the correct place.

Change-Id: Id4726855c5677855406de20773a5da533bdd4cea
2016-03-24 13:14:12 -07:00
Colin Cross
ca860ac720 Refactor cc
Refactor all of cc in order to use composition instead of inheritance.
All cc module types exported by cc are now *cc.Module objects, with
compilation, linking, and installing steps delegated to different
objects in order to form the full module type.  Additional features that
modify dependencies and flags can be inserted in a features object list,
and custom module types can be created by adding a Customizer object
that can modify properties.

Change-Id: Ie1283d14920f7856f6947b0530606b2f4d58fab0
2016-03-21 17:31:04 -07:00
Dan Willemsen
97750520a4 Refactor Android.mk generation
Now, instead of combining multiple binaries into a single BUILD_PREBUILT
definition, use separate instances for every module variant. This fixes
HOST vs HOST_CROSS prebuilts, and should be saner overall. From make,
these should look the same, we're only just using one instance of
prebuilt_internal per BUILD_PREBUILT call instead of multiple.

With that simplification, we don't have to store as much state, and can
directly write into the buffer.

Also switch from io.WriteString to fmt.Fprintln, which will require
fewer explicit string concatentations, and we don't need to worry about
newlines.

Allow the module-provided functions to return errors.

Change-Id: If30453b21fa21387f635626618d8fabfc78e6859
2016-02-09 19:56:22 -08:00
Dan Willemsen
34cc69e4bf Use Path instead of string for file paths
This centralizes verification and common operations, like converting the
path to a source file to the path for a built object.

It also embeds the configuration knowledge into the path, so that we can
remove "${SrcDir}/path" from the ninja file. When SrcDir is '.', that
leads to paths like './path' instead of just 'path' like make is doing,
causing differences in compiled binaries.

Change-Id: Ib4e8910a6e867ce1b7b420d927c04f1142a7589e
2015-12-09 14:29:12 -08:00
Dan Willemsen
218f65628e Hybrid soong/mk build using prebuilts
Change-Id: I96daa69af27bd19c8bfbe327a1318f51c738fc03
2015-12-01 15:08:01 -08:00