Skip to content

Commit

Permalink
Bug 1397764 - Part 1. Move STLPORT_CPPFLAGS to moz.configure. r=chman…
Browse files Browse the repository at this point in the history
…chester

To build sytlo, we have to set compiler flags via BINDGEN_CFLAGS.  Since we
 pass stlport flags to clang, I would like to move STLPORT_CPPFLAGS to
moz.configure.

MozReview-Commit-ID: 26jvUqUvwTY

--HG--
extra : rebase_source : 5568627368fbf2dce02904918e50a241713d0a85
  • Loading branch information
makotokato committed Sep 29, 2017
1 parent 7451333 commit 6a7100f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 29 deletions.
32 changes: 3 additions & 29 deletions build/autoconf/android.m4
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ case "$target" in
dnl $android_platform will be set for us by Python configure.
CPPFLAGS="-idirafter $android_platform/usr/include $CPPFLAGS"
CFLAGS="-fno-short-enums -fno-exceptions $CFLAGS"
CXXFLAGS="-fno-short-enums -fno-exceptions $CXXFLAGS"
CXXFLAGS="-fno-short-enums -fno-exceptions $CXXFLAGS $stlport_cppflags"
ASFLAGS="-idirafter $android_platform/usr/include -DANDROID $ASFLAGS"
dnl Add --allow-shlib-undefined, because libGLESv2 links to an
Expand Down Expand Up @@ -57,53 +57,27 @@ AC_DEFUN([MOZ_ANDROID_STLPORT],
[
if test "$OS_TARGET" = "Android"; then
if test -z "$STLPORT_CPPFLAGS$STLPORT_LIBS"; then
if test -z "$STLPORT_LIBS"; then
# android-ndk-r8b and later
ndk_base="$android_ndk/sources/cxx-stl"
cxx_base="$ndk_base/llvm-libc++"
cxx_libs="$cxx_base/libs/$ANDROID_CPU_ARCH"
cxx_libs="$android_ndk/sources/cxx-stl/llvm-libc++/libs/$ANDROID_CPU_ARCH"
# NDK r12 removed the arm/thumb library split and just made
# everything thumb by default. Attempt to compensate.
if test "$MOZ_THUMB2" = 1 -a -d "$cxx_libs/thumb"; then
cxx_libs="$cxx_libs/thumb"
fi
cxx_include="$cxx_base/libcxx/include"
cxxabi_base="$ndk_base/llvm-libc++abi"
cxxabi_include="$cxxabi_base/libcxxabi/include"
if ! test -e "$cxx_libs/libc++_static.a"; then
AC_MSG_ERROR([Couldn't find path to llvm-libc++ in the android ndk])
fi
if ! test -e "$cxx_include"; then
# NDK r13 removes the inner "libcxx" directory.
cxx_include="$cxx_base/include"
if ! test -e "$cxx_include"; then
AC_MSG_ERROR([Couldn't find path to libc++ includes in the android ndk])
fi
fi
if ! test -e "$cxxabi_include"; then
# NDK r13 removes the inner "libcxxabi" directory.
cxxabi_include="$cxxabi_base/include"
if ! test -e "$cxxabi_include"; then
AC_MSG_ERROR([Couldn't find path to libc++abi includes in the android ndk])
fi
fi
STLPORT_LIBS="-L$cxx_libs -lc++_static"
# NDK r12 split the libc++ runtime libraries into pieces.
for lib in c++abi unwind android_support; do
if test -e "$cxx_libs/lib${lib}.a"; then
STLPORT_LIBS="$STLPORT_LIBS -l${lib}"
fi
done
# Add android/support/include/ for prototyping long double math
# functions, locale-specific C library functions, multibyte support,
# etc.
STLPORT_CPPFLAGS="-I$cxx_include -I$android_ndk/sources/android/support/include -I$cxxabi_include"
fi
CXXFLAGS="$CXXFLAGS $STLPORT_CPPFLAGS"
fi
AC_SUBST([STLPORT_LIBS])
Expand Down
40 changes: 40 additions & 0 deletions build/moz.configure/android-ndk.configure
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,43 @@ def android_toolchain_prefix(target, toolchain):

imply_option('--with-toolchain-prefix', android_toolchain_prefix,
reason='--with-android-ndk')

option(env='STLPORT_CPPFLAGS',
nargs=1,
help='Options compiler should pass for standard C++ library')

@depends('STLPORT_CPPFLAGS', ndk)
@imports(_from='os.path', _import='isdir')
def stlport_cppflags(value, ndk):
if value and len(value):
return value
if not ndk:
return

ndk_base = os.path.join(ndk, 'sources', 'cxx-stl')
cxx_base = os.path.join(ndk_base, 'llvm-libc++')
cxx_include = os.path.join(cxx_base, 'libcxx', 'include')
cxxabi_base = os.path.join(ndk_base, 'llvm-libc++abi')
cxxabi_include = os.path.join(cxxabi_base, 'libcxxabi', 'include')

if not isdir(cxx_include):
# NDK r13 removes the inner "libcxx" directory.
cxx_include = os.path.join(cxx_base, 'include')
if not isdir(cxx_include):
die("Couldn't find path to libc++ includes in the android ndk")

if not isdir(cxxabi_include):
# NDK r13 removes the inner "libcxxabi" directory.
cxxabi_include = os.path.join(cxxabi_base, 'include')
if not isdir(cxxabi_include):
die("Couldn't find path to libc++abi includes in the android ndk")

# Add android/support/include/ for prototyping long double math
# functions, locale-specific C library functions, multibyte support,
# etc.
return "-I%s -I%s -I%s" % (cxx_include,
os.path.join(ndk, 'sources', 'android',
'support', 'include'),
cxxabi_include)

add_old_configure_assignment('stlport_cppflags', stlport_cppflags)

0 comments on commit 6a7100f

Please sign in to comment.