diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 821ea8a2288..d61d56312c4 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -715,6 +715,8 @@ MOZ_SYSTEM_PLY = @MOZ_SYSTEM_PLY@ MOZ_PACKAGE_JSSHELL = @MOZ_PACKAGE_JSSHELL@ +MOZ_LINKER_EXTRACT = @MOZ_LINKER_EXTRACT@ + # We only want to do the pymake sanity on Windows, other os's can cope ifeq ($(HOST_OS_ARCH),WINNT) # Ensure invariants between GNU Make and pymake diff --git a/configure.in b/configure.in index 04424af366c..773b86512e2 100644 --- a/configure.in +++ b/configure.in @@ -8490,6 +8490,7 @@ AC_SUBST(MOZ_OS2_TOOLS) AC_SUBST(MOZ_POST_DSO_LIB_COMMAND) AC_SUBST(MOZ_POST_PROGRAM_COMMAND) +AC_SUBST(MOZ_LINKER_EXTRACT) dnl ======================================================== dnl = Mac bundle name prefix diff --git a/mobile/android/base/App.java.in b/mobile/android/base/App.java.in index 3a96303f545..4c324d30e56 100644 --- a/mobile/android/base/App.java.in +++ b/mobile/android/base/App.java.in @@ -79,5 +79,12 @@ public class App extends GeckoApp { #endif return super.onOptionsItemSelected(item); } + +#ifdef MOZ_LINKER_EXTRACT + @Override + public boolean linkerExtract() { + return true; + } +#endif }; diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index dc5b7d3ae4d..8d1a992d1eb 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -2831,4 +2831,8 @@ abstract public class GeckoApp } }); } + + public boolean linkerExtract() { + return false; + } } \ No newline at end of file diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index 6c506fc7478..cecc8f902f5 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -310,21 +310,26 @@ public class GeckoAppShell File cacheFile = getCacheDir(context); putenv("GRE_HOME=" + getGREDir(context).getPath()); - File[] files = cacheFile.listFiles(); - if (files != null) { - Iterator cacheFiles = Arrays.asList(files).iterator(); - while (cacheFiles.hasNext()) { - File libFile = cacheFiles.next(); - if (libFile.getName().endsWith(".so")) - libFile.delete(); - } - } // setup the libs cache String linkerCache = System.getenv("MOZ_LINKER_CACHE"); - if (System.getenv("MOZ_LINKER_CACHE") == null) { - GeckoAppShell.putenv("MOZ_LINKER_CACHE=" + cacheFile.getPath()); + if (linkerCache == null) { + linkerCache = cacheFile.getPath(); + GeckoAppShell.putenv("MOZ_LINKER_CACHE=" + linkerCache); } + + if (GeckoApp.mAppContext != null && + GeckoApp.mAppContext.linkerExtract()) { + GeckoAppShell.putenv("MOZ_LINKER_EXTRACT=1"); + // Ensure that the cache dir is world-writable + File cacheDir = new File(linkerCache); + if (cacheDir.isDirectory()) { + cacheDir.setWritable(true, false); + cacheDir.setExecutable(true, false); + cacheDir.setReadable(true, false); + } + } + sLibsSetup = true; } diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in index a454755046a..df0bc30310e 100644 --- a/mobile/android/base/Makefile.in +++ b/mobile/android/base/Makefile.in @@ -212,6 +212,10 @@ DEFINES += \ -DUA_BUILDID=$(UA_BUILDID) \ $(NULL) +ifdef MOZ_LINKER_EXTRACT +DEFINES += -DMOZ_LINKER_EXTRACT=1 +endif + GARBAGE += \ AndroidManifest.xml \ classes.dex \