Skip to content

Commit

Permalink
bug 748797 - support MOZ_LINKER_EXTRACT=1 as a configure option to tu…
Browse files Browse the repository at this point in the history
…rn on linker extraction all the time. r=glandium,blassey, a=android-only

CLOSED TREE
  • Loading branch information
Ted Mielczarek committed May 2, 2012
1 parent bc1fb7a commit 67f5e36
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
2 changes: 2 additions & 0 deletions config/autoconf.mk.in
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions configure.in
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions mobile/android/base/App.java.in
Expand Up @@ -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
};

4 changes: 4 additions & 0 deletions mobile/android/base/GeckoApp.java
Expand Up @@ -2831,4 +2831,8 @@ public boolean onTouch(View view, MotionEvent event) {
}
});
}

public boolean linkerExtract() {
return false;
}
}
27 changes: 16 additions & 11 deletions mobile/android/base/GeckoAppShell.java
Expand Up @@ -310,21 +310,26 @@ public static void loadLibsSetup(Context context) {

File cacheFile = getCacheDir(context);
putenv("GRE_HOME=" + getGREDir(context).getPath());
File[] files = cacheFile.listFiles();
if (files != null) {
Iterator<File> 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;
}

Expand Down
4 changes: 4 additions & 0 deletions mobile/android/base/Makefile.in
Expand Up @@ -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 \
Expand Down

0 comments on commit 67f5e36

Please sign in to comment.