Bug 1413362 - part 3: Update build system to find and use GVR for WebVR draft
authorRandall Barker <rbarker@mozilla.com>
Tue, 31 Oct 2017 17:41:43 -0700
changeset 690451 eb907139e5b8f9ee0c6c7cbea62f197c7922e15b
parent 690450 1dbdf9f4cd57c8b3d91ac442103e3281a6dd8904
child 738572 03071f8fe10a537137cf1634fe806b9aa1fbf204
push id87299
push userbmo:rbarker@mozilla.com
push dateWed, 01 Nov 2017 23:52:00 +0000
bugs1413362
milestone58.0a1
Bug 1413362 - part 3: Update build system to find and use GVR for WebVR MozReview-Commit-ID: EDiOxbnKLSS
build/autoconf/android.m4
build/moz.configure/old.configure
old-configure.in
toolkit/library/moz.build
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -176,16 +176,50 @@ AC_DEFUN([MOZ_ANDROID_INSTALL_TRACKING],
 
 if test -n "$MOZ_INSTALL_TRACKING"; then
     MOZ_ANDROID_AAR(play-services-ads, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
     MOZ_ANDROID_AAR(play-services-basement, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
 fi
 
 ])
 
+AC_DEFUN([MOZ_GVR_ANDROID_SDK],
+[
+
+MOZ_ARG_WITH_STRING(gvr-android-sdk,
+[  --with-gvr-android-sdk=DIR
+                          location where the Android GVR SDK can be found (like ~/.mozbuild/gvr-android-sdk)],
+    gvr_android_sdk=$withval)
+
+case "$target" in
+*-android*|*-linuxandroid*)
+    AC_MSG_CHECKING([for GVR Android SDK])
+    if test -d "$gvr_android_sdk" ; then
+        AC_MSG_RESULT([$gvr_android_sdk])
+        AC_DEFINE(MOZ_USE_GVR_ANDROID)
+        MOZ_GVR_INCLUDE=$gvr_android_sdk/libraries/headers/
+        MOZ_GVR_LIBS=$gvr_android_sdk/libraries/jni/armeabi-v7a/
+        if test -d "$MOZ_GVR_INCLUDE" -a -d "$MOZ_GVR_LIBS" ; then
+          MOZ_USE_GVR_ANDROID=1
+          AC_SUBST(MOZ_USE_GVR_ANDROID)
+          AC_SUBST(MOZ_GVR_INCLUDE)
+          AC_SUBST(MOZ_GVR_LIBS)
+        else
+          AC_MSG_ERROR([Could not find GVR NDK. Did you run ./gradlew :extractNdk in $gvr_android_sdk])
+        fi
+    elif test -n "$gvr_android_sdk" ; then
+        AC_MSG_ERROR([Could not find GVR SDK $gvr_android_sdk])
+    else
+        AC_MSG_RESULT([not specified])
+    fi
+    ;;
+esac
+
+])
+
 dnl Configure an Android SDK.
 dnl Arg 1: compile SDK version, like 23.
 dnl Arg 2: target SDK version, like 23.
 dnl Arg 3: list of build-tools versions, like "23.0.3 23.0.1".
 dnl Arg 4: list of target lint versions, like "25.3.2 25.3.1" (note: we fall back to
 dnl        unversioned lint if this version is not found).
 AC_DEFUN([MOZ_ANDROID_SDK],
 [
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -255,16 +255,17 @@ def old_configure_options(*options):
     '--with-cross-lib',
     '--with-debug-label',
     '--with-distribution-id',
     '--with-doc-include-dirs',
     '--with-doc-input-dirs',
     '--with-doc-output-dir',
     '--with-float-abi',
     '--with-fpu',
+    '--with-gvr-android-sdk',
     '--with-intl-api',
     '--with-ios-sdk',
     '--with-jitreport-granularity',
     '--with-macbundlename-prefix',
     '--with-macos-private-frameworks',
     '--with-macos-sdk',
     '--with-nspr-cflags',
     '--with-nspr-exec-prefix',
--- a/old-configure.in
+++ b/old-configure.in
@@ -2231,16 +2231,18 @@ dnl mobile target.
 dnl ========================================================
 
 case "$MOZ_BUILD_APP" in
 mobile/android)
     MOZ_ANDROID_SDK(23, 23, 25.0.3, 26.0.0 26.0.0-dev 25.3.2 25.3.1)
     ;;
 esac
 
+MOZ_GVR_ANDROID_SDK
+
 dnl ========================================================
 dnl =
 dnl = Toolkit Options
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Toolkit Options)
 
 dnl ========================================================
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -192,16 +192,22 @@ if CONFIG['OS_ARCH'] == 'WINNT':
         'winspool',
     ]
 
 if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android':
     OS_LIBS += [
         'rt',
     ]
 
+if CONFIG['MOZ_USE_GVR_ANDROID']:
+    OS_LIBS += [
+        '-L%s' % CONFIG['MOZ_GVR_LIBS'],
+        '-lgvr',
+    ]
+
 OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
 OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
 
 if CONFIG['SERVO_TARGET_DIR']:
     if CONFIG['_MSC_VER']:
         OS_LIBS += ['%s/geckoservo' % CONFIG['SERVO_TARGET_DIR']]
     else:
         OS_LIBS += ['-L%s' % CONFIG['SERVO_TARGET_DIR'], '-lgeckoservo']