On Mon, Dec 9, 2013 at 6:43 AM, Torne (Richard Coles)I think make is pretty similar to ninja files so I think something
<to...@chromium.org> wrote:
> Hi folks,
>
> I maintain the gyp backend "android" which outputs Android.mk files suitable
> for building inside the Android OS's build system. This is used to build the
> Android WebView, which consists of the content layer and also the code in
> src/android_webview, and has some special cases in Chromium gyp files
> (controlled by the gyp define "android_webview_build=1"); it's built/tested
> by the "android_aosp" bot on the main waterfall. This is *not* what's used
> for building the Chrome for Android browser port, just to be clear.
>
> Right now I don't anticipate many problems caused by the transition while it
> still generates gyp files, but I'm wondering what the long term plan is. In
> initial meetings about gn it was mentioned that it might be possible to have
> a backend that continues to generate Android.mk files; is that still
> considered a viable option? Does anyone have even a rough idea how much work
> that might be?
that works 80% could be hacked up in a few days to generate Android
makefiles.
There are some subtle cases that will take longer. The thing that will
also slow it down is that we don't want to just duplicate all of the
Ninja code, probably a bunch of it can be shared, so there would be
some refactoring involved. I've done some for the GYP generator, but
it has simpler requirements (since it doesn't actually link anything
and I shell out to Ninja to run scripts). In all, I'd say this is a
several week project.
What I'm planning on doing for script targets in GYP is to write a GYP
action that invokes ninja. Have you considered writing a makefile that
runs ninja? This would be very easy to do and also the easiest to
maintain. From a build purity standpoint this is bad and easy to
reject. But all that's required is a ninja binary on the host system,
it's super fast to implement, and it will probably compile and start
up faster also.
GN will let you depend on any settings, although if you want host
> Some background on how Android builds and what its requirements are:
>
> 1) Android builds using make, with individual modules using an Android.mk
> file to describe their build targets. These are largely declarative
> (defining variables that specify sources/flags then including a
> target-type-specific .mk that sets up the rules based on those variables)
> but arbitrary make syntax is permitted including custom rules. These are
> normally written by hand, not autogenerated. The build system defines
> standard rules for compiling/linking various languages and library types
> (including ones that gyp does not provide first class support for, like
> protobuf or AIDL) and these are expected to be used as-is, with custom rules
> only used for other kinds of processing.
>
> 2) Android supports building for multiple target platforms in the same
> output tree, with non-target-specific parts like host binaries or Java
> compilation shared in common directories. This has caused problems with gyp
> since gyp doesn't prevent host binaries from depending on
> target-platform-specific settings; we've had to special-case the places
> where this happens.
binaries to depend on target configurations, it's rather difficult and
you have to go out of your way. As a result, I would not expect much,
if any, of theses places to exist in the GN build.
Brett
To unsubscribe from this group and stop receiving emails from it, send an email to gn-dev+un...@chromium.org.
I'm not sure I follow what you mean by the conditionals being useless. In the android gyp backend I just process the gyp files exactly as normal and put all the cflags/etc that gyp arrived at into the appropriate variables in the output makefile so that the normal android rules will add those flags to the command lines where they're needed.
>
> Depending on how much fidelity you need, you could certainly export
> file lists into whatever format you want, and this should be pretty
> easy. Doing something where the flags are combined with Android's
> flags will be nontrivial, though. GN files are really scripts that
> execute and produce some results, so by the time the generator is run,
> the context of how stuff was set is lost. I suspect the ability of GYP
> to keep such context around is used in your current output scheme.
I'm not sure what you mean here either. We don't have any context at gyp time; at gyp time we don't even know exactly what product config we are building for (only the architecture, since that affects the source file choices). The flags emitted by gyp into the makefiles are just appended to the command line after the default ones for that product, by the default rules.
Now with correct sender address. Damn.
One thing I did for the OpenSSL sources: use one config file that is parsed by a custom script that generates Android.mk fragments and .gypi files.
The config file lists source files, compiler flags, include paths, and arch-specific overrides.
Works pretty well, though it doesn't handle Java, and requires running the script on each config change.
Maybe something similar could be used, due to the vast differences in these build systems?. Each one has carefully custom written Android.mk and .gyp files that include the generated ones.
One thing I did for the OpenSSL sources: use one config file that is parsed by a custom script that generates Android.mk fragments and .gypi files.
The config file lists source files, compiler flags, include paths, and arch-specific overrides.
Works pretty well, though it doesn't handle Java, and requires running the script on each config change.
Maybe something similar could be used, due to the vast differences in these build systems?. Each one has carefully custom written Android.mk and .gyp files that include the generated ones.
I agree :-) However the alternative seems to teach GN about Android build system quirks, or to teach the Android build about GN ones, which sounds equally hard / impossible, from your previous posts.
I suspect some sort of conversion script will be needed, if you don't want to manually do this every time.
I agree :-) However the alternative seems to teach GN about Android build system quirks, or to teach the Android build about GN ones, which sounds equally hard / impossible, from your previous posts.