Commit a6a15140 authored by sisbell's avatar sisbell Committed by Georg Koppen
Browse files

Bug 30665: Get Firefox 68 ESR Working with latest android toolchain

parent effde40c
From dcd5a0e59bef209aa8301a427b749830876cdada Mon Sep 17 00:00:00 2001
From: Jeff Gilbert <jgilbert@mozilla.com>
Date: Tue, 19 Feb 2019 15:43:39 -0800
Subject: [PATCH] Bug 1527534 - Reuse LoadApitraceLibrary. r=lsalzman a=lizzard
Differential Revision: https://phabricator.services.mozilla.com/D20418
diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
index d91d03aee6a9..f4d8c1f80176 100644
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -265,11 +265,8 @@ GLContextEGL::~GLContextEGL() {
}
bool GLContextEGL::Init() {
-#if defined(ANDROID)
- // We can't use LoadApitraceLibrary here because the GLContext
- // expects its own handle to the GL library
- if (!OpenLibrary(APITRACE_LIB))
-#endif
+ mLibrary = LoadApitraceLibrary();
+ if (!mLibrary) {
if (!OpenLibrary(GLES2_LIB)) {
#if defined(XP_UNIX)
if (!OpenLibrary(GLES2_LIB2)) {
@@ -278,6 +275,7 @@ bool GLContextEGL::Init() {
}
#endif
}
+ }
SetupLookupFunction();
if (!InitWithPrefix("gl", true)) return false;
diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp
index fe4bd9811949..ef693e283968 100644
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -63,9 +63,18 @@ static const char* sEGLExtensionNames[] = {
"EGL_ANGLE_device_creation_d3d11",
};
-#if defined(ANDROID)
+PRLibrary* LoadApitraceLibrary() {
+ const char* path = nullptr;
+
+#ifdef ANDROID
+ // We only need to explicitly dlopen egltrace
+ // on android as we can use LD_PRELOAD or other tricks
+ // on other platforms. We look for it in /data/local
+ // as that's writeable by all users.
+ path = "/data/local/tmp/egltrace.so";
+#endif
+ if (!path) return nullptr;
-static PRLibrary* LoadApitraceLibrary() {
// Initialization of gfx prefs here is only needed during the unit tests...
gfxPrefs::GetSingleton();
if (!gfxPrefs::UseApitrace()) {
@@ -73,7 +82,6 @@ static PRLibrary* LoadApitraceLibrary() {
}
static PRLibrary* sApitraceLibrary = nullptr;
-
if (sApitraceLibrary) return sApitraceLibrary;
nsAutoCString logFile;
@@ -87,20 +95,19 @@ static PRLibrary* LoadApitraceLibrary() {
nsAutoCString logPath;
logPath.AppendPrintf("%s/%s", getenv("GRE_HOME"), logFile.get());
+#ifndef XP_WIN // Windows is missing setenv and forbids PR_LoadLibrary.
// apitrace uses the TRACE_FILE environment variable to determine where
// to log trace output to
printf_stderr("Logging GL tracing output to %s", logPath.get());
setenv("TRACE_FILE", logPath.get(), false);
- printf_stderr("Attempting load of %s\n", APITRACE_LIB);
-
- sApitraceLibrary = PR_LoadLibrary(APITRACE_LIB);
+ printf_stderr("Attempting load of %s\n", path);
+ sApitraceLibrary = PR_LoadLibrary(path);
+#endif
return sApitraceLibrary;
}
-#endif // ANDROID
-
#ifdef XP_WIN
// see the comment in GLLibraryEGL::EnsureInitialized() for the rationale here.
static PRLibrary* LoadLibraryForEGLOnWindows(const nsAString& filename) {
diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h
index 069a2f0908d7..3f200bf76b3f 100644
--- a/gfx/gl/GLLibraryEGL.h
+++ b/gfx/gl/GLLibraryEGL.h
@@ -18,18 +18,6 @@
#include <bitset>
#include <vector>
-#ifdef ANDROID
-// We only need to explicitly dlopen egltrace
-// on android as we can use LD_PRELOAD or other tricks
-// on other platforms. We look for it in /data/local
-// as that's writeable by all users
-//
-// This should really go in GLLibraryEGL.cpp but we currently reference
-// APITRACE_LIB in GLContextProviderEGL.cpp. Further refactoring
-// will come in subsequent patches on Bug 732865
-#define APITRACE_LIB "/data/local/tmp/egltrace.so"
-#endif
-
#if defined(MOZ_X11)
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)mozilla::DefaultXDisplay())
#else
@@ -49,6 +37,7 @@ class DataSourceSurface;
namespace gl {
class GLContext;
+PRLibrary* LoadApitraceLibrary();
void BeforeEGLCall(const char* funcName);
void AfterEGLCall(const char* funcName);
diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h
index b2e094672b59..fae5bec1e78e 100644
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -433,9 +433,7 @@ class gfxPrefs final {
SmoothScrollMSDPhysicsRegularSpringConstant, int32_t, 1000);
DECL_GFX_PREF(Once, "gfx.android.rgb16.force", AndroidRGB16Force, bool, false);
-#if defined(ANDROID)
DECL_GFX_PREF(Once, "gfx.apitrace.enabled", UseApitrace, bool, false);
-#endif
#if defined(RELEASE_OR_BETA)
// "Skip" means this is locked to the default value in beta and release.
DECL_GFX_PREF(Skip, "gfx.blocklist.all", BlocklistAll, int32_t, 0);
--
2.20.1
diff --git a/python/mozboot/mozboot/android-packages.txt b/python/mozboot/mozboot/android-packages.txt
index ac947a72f410..1a9aa21cb5d8 100644
--- a/python/mozboot/mozboot/android-packages.txt
+++ b/python/mozboot/mozboot/android-packages.txt
@@ -1,5 +1,3 @@
platform-tools
build-tools;27.0.3
platforms;android-28
-emulator
-docs
diff --git a/build/moz.configure/android-sdk.configure b/build/moz.configure/android-sdk.configure
index a8ecc617850d..0a58597e2646 100644
--- a/build/moz.configure/android-sdk.configure
+++ b/build/moz.configure/android-sdk.configure
@@ -87,10 +87,6 @@ def android_platform_tools(sdk_root):
tools)
-@depends(android_sdk_root)
-def android_emulator_path(sdk_root):
- return [os.path.join(sdk_root, 'emulator')]
-
@template
def check_android_tools(tool, tool_dir):
@@ -108,7 +104,6 @@ def check_android_tools(tool, tool_dir):
check_android_tools('zipalign', android_build_tools)
check_android_tools('adb', android_platform_tools)
-check_android_tools('emulator', android_emulator_path)
set_config('ANDROID_SDK_ROOT', android_sdk_root)
set_config('ANDROID_TOOLS', android_tools)
......@@ -56,10 +56,6 @@ mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig
export ASAN_OPTIONS="detect_leaks=0"
[% END -%]
[% IF c("var/android-armv7") -%]
cp /var/tmp/dist/android-toolchain/android-ndk/arm/lib64/libclang.so.6 /var/tmp/dist/android-toolchain/android-ndk/arm/lib64/libclang.so
[% END -%]
[% IF c("var/android") %]
gradle_repo=/var/tmp/dist/gradle-dependencies
export GRADLE_MAVEN_REPOSITORIES="file://$gradle_repo"
......@@ -71,9 +67,9 @@ mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig
# Move Android library dependencies so they will be included in the apk during the build
cp $rootdir/[% c('input_files_by_name/topl') %]/* mobile/android/app
cp $rootdir/[% c('input_files_by_name/tor-android-service') %]/* mobile/android/app
# Apply patches
patch -p1 < $rootdir/android-packages.patch
patch -p1 < $rootdir/android-remove-emulator.patch
# Move emulator to location that firefox build expects
mkdir /var/tmp/dist/android-toolchain/android-sdk-linux/emulator
cp /var/tmp/dist/android-toolchain/android-sdk-linux/tools/emulator /var/tmp/dist/android-toolchain/android-sdk-linux/emulator
# Prepare building the multi-locale .apk including our own strings
mkdir -p /var/tmp/dist/locales
......
......@@ -179,15 +179,9 @@ input_files:
- project: tor-onion-proxy-library
name: topl
enable: '[% c("var/android") %]'
- filename: android-packages.patch
enable: '[% c("var/android") %]'
- filename: android-remove-emulator.patch
enable: '[% c("var/android") %]'
- project: firefox-locale-bundle
name: firefox-locale-bundle
enable: '[% c("var/android") %]'
- project: tba-translation
name: tba-translation
enable: '[% c("var/android") %]'
- filename: 1527534.patch
enable: '[% c("var/android") %]'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment