build: set OS=="android" for android builds

Work around the build name issues by instead manually adding the build
target for android builds using '-DOS=android'

This additionally resolves problems caused by the OS variable being
rewritten from "android" to "linux" in gyp. This causes errors, as
real-time support (-lrt) and pthread support (-lpthread) is not
available in the android NDK toolchain as libraries.

The functions present in these libraries are included automatically
during the build instead during the android compilation process.
This commit is contained in:
Linus Mårtensson 2013-06-05 13:28:22 +02:00 committed by Ben Noordhuis
parent 7d8504cf69
commit ff3ee84442
3 changed files with 7 additions and 9 deletions

View File

@ -16,5 +16,5 @@ export PLATFORM=android
if [ $2 -a $2 == 'gyp' ]
then
./gyp_uv -Dandroid_build=1 -Dtarget_arch=arm
./gyp_uv -Dtarget_arch=arm -DOS=android
fi

View File

@ -1,6 +1,5 @@
{
'variables': {
'android_build%': 0,
'visibility%': 'hidden', # V8's visibility setting
'target_arch%': 'ia32', # set v8's target architecture
'host_arch%': 'ia32', # set v8's host architecture
@ -130,7 +129,7 @@
}]
]
}],
['OS in "freebsd linux openbsd solaris" or android_build == 1', {
['OS in "freebsd linux openbsd solaris android"', {
'cflags': [ '-Wall' ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
'target_conditions': [
@ -150,7 +149,7 @@
'cflags': [ '-pthreads' ],
'ldflags': [ '-pthreads' ],
}],
[ 'OS != "solaris" and android_build == 0', {
[ 'OS not in "solaris android"', {
'cflags': [ '-pthread' ],
'ldflags': [ '-pthread' ],
}],

9
uv.gyp
View File

@ -1,6 +1,5 @@
{
'variables': {
'android_build%': 0,
'uv_use_dtrace%': 'false',
# uv_parent_path is the relative path to libuv in the parent project
# this is only relevant when dtrace is enabled and libuv is a child project
@ -22,7 +21,7 @@
['OS=="solaris"', {
'cflags': [ '-pthreads' ],
}],
['OS != "solaris" and android_build == 0', {
['OS not in "solaris android"', {
'cflags': [ '-pthread' ],
}],
],
@ -162,7 +161,7 @@
['OS=="solaris"', {
'ldflags': [ '-pthreads' ],
}],
['OS != "solaris" and android_build == 0', {
['OS != "solaris" and OS != "android"', {
'ldflags': [ '-pthread' ],
}],
],
@ -180,7 +179,7 @@
}],
],
}],
[ 'OS in "linux mac" or android_build == 1', {
[ 'OS in "linux mac android"', {
'sources': [ 'src/unix/proctitle.c' ],
}],
[ 'OS=="mac"', {
@ -216,7 +215,7 @@
'libraries': [ '-ldl', '-lrt' ],
},
}],
[ 'android_build == 1', {
[ 'OS=="android"', {
'sources': [
'src/unix/linux-core.c',
'src/unix/linux-inotify.c',