Bug 873569 - Part 2: Move Gecko .so libraries into assets/ directory of Android APK. r=glandium

This commit is contained in:
Nick Alexander 2013-06-12 13:24:30 -07:00
parent 4923ffdcd2
commit 0242a75718
2 changed files with 29 additions and 16 deletions

View File

@ -175,8 +175,8 @@ loadGeckoLibs(const char *apkName)
RefPtr<Zip> zip = ZipCollection::GetZip(apkName);
char *file = new char[strlen(apkName) + sizeof("!/libxul.so")];
sprintf(file, "%s!/libxul.so", apkName);
char *file = new char[strlen(apkName) + sizeof("!/assets/libxul.so")];
sprintf(file, "%s!/assets/libxul.so", apkName);
xul_handle = __wrap_dlopen(file, RTLD_GLOBAL | RTLD_LAZY);
delete[] file;
@ -234,8 +234,8 @@ loadSQLiteLibs(const char *apkName)
lib_mapping = (struct mapping_info *)calloc(MAX_MAPPING_INFO, sizeof(*lib_mapping));
}
char *file = new char[strlen(apkName) + sizeof("!/libmozsqlite3.so")];
sprintf(file, "%s!/libmozsqlite3.so", apkName);
char *file = new char[strlen(apkName) + sizeof("!/assets/libmozsqlite3.so")];
sprintf(file, "%s!/assets/libmozsqlite3.so", apkName);
sqlite_handle = __wrap_dlopen(file, RTLD_GLOBAL | RTLD_LAZY);
delete [] file;
@ -262,19 +262,19 @@ loadNSSLibs(const char *apkName)
lib_mapping = (struct mapping_info *)calloc(MAX_MAPPING_INFO, sizeof(*lib_mapping));
}
char *file = new char[strlen(apkName) + sizeof("!/libnss3.so")];
sprintf(file, "%s!/libnss3.so", apkName);
char *file = new char[strlen(apkName) + sizeof("!/assets/libnss3.so")];
sprintf(file, "%s!/assets/libnss3.so", apkName);
nss_handle = __wrap_dlopen(file, RTLD_GLOBAL | RTLD_LAZY);
delete [] file;
#ifndef MOZ_FOLD_LIBS
file = new char[strlen(apkName) + sizeof("!/libnspr4.so")];
sprintf(file, "%s!/libnspr4.so", apkName);
file = new char[strlen(apkName) + sizeof("!/assets/libnspr4.so")];
sprintf(file, "%s!/assets/libnspr4.so", apkName);
nspr_handle = __wrap_dlopen(file, RTLD_GLOBAL | RTLD_LAZY);
delete [] file;
file = new char[strlen(apkName) + sizeof("!/libplc4.so")];
sprintf(file, "%s!/libplc4.so", apkName);
file = new char[strlen(apkName) + sizeof("!/assets/libplc4.so")];
sprintf(file, "%s!/assets/libplc4.so", apkName);
plc_handle = __wrap_dlopen(file, RTLD_GLOBAL | RTLD_LAZY);
delete [] file;
#endif

View File

@ -341,8 +341,17 @@ ifdef MOZ_OMX_PLUGIN
DIST_FILES += libomxplugin.so libomxplugingb.so libomxplugingb235.so libomxpluginhc.so libomxpluginsony.so libomxpluginfroyo.so libomxpluginjb-htc.so
endif
SO_LIBRARIES := $(filter-out $(MOZ_CHILD_PROCESS_NAME),$(filter %.so,$(DIST_FILES)))
# These libraries are moved into the assets/ directory of the APK.
ASSET_SO_LIBRARIES := $(addprefix assets/,$(SO_LIBRARIES))
DIST_FILES := $(filter-out $(SO_LIBRARIES),$(DIST_FILES))
NON_DIST_FILES += $(SO_LIBARIES)
ifdef MOZ_ENABLE_SZIP
SZIP_LIBRARIES := $(filter-out $(MOZ_CHILD_PROCESS_NAME),$(filter %.so,$(DIST_FILES)))
# These libraries are szipped (before being moved into the assets/
# directory of the APK).
SZIP_LIBRARIES := $(SO_LIBRARIES)
endif
PKG_SUFFIX = .apk
@ -351,11 +360,13 @@ INNER_MAKE_PACKAGE = \
make -C $(GECKO_APP_AP_PATH) gecko.ap_ && \
cp $(GECKO_APP_AP_PATH)/gecko.ap_ $(_ABS_DIST) && \
( cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && \
mkdir -p assets && \
mkdir -p lib/$(ABI_DIR) && \
mv libmozglue.so $(MOZ_CHILD_PROCESS_NAME) lib/$(ABI_DIR) && \
mv $(SO_LIBRARIES) assets && \
unzip -o $(_ABS_DIST)/gecko.ap_ && \
rm $(_ABS_DIST)/gecko.ap_ && \
$(if $(SZIP_LIBRARIES),$(ZIP) -0 $(_ABS_DIST)/gecko.ap_ $(SZIP_LIBRARIES) && ) \
$(ZIP) -0 $(_ABS_DIST)/gecko.ap_ $(ASSET_SO_LIBRARIES) && \
$(ZIP) -r9D $(_ABS_DIST)/gecko.ap_ $(DIST_FILES) -x $(NON_DIST_FILES) $(SZIP_LIBRARIES) && \
$(ZIP) -0 $(_ABS_DIST)/gecko.ap_ $(OMNIJAR_NAME)) && \
rm -f $(_ABS_DIST)/gecko.apk && \
@ -368,10 +379,12 @@ INNER_MAKE_PACKAGE = \
INNER_UNMAKE_PACKAGE = \
mkdir $(MOZ_PKG_DIR) && \
( cd $(MOZ_PKG_DIR) && \
$(UNZIP) $(UNPACKAGE) && \
mv lib/$(ABI_DIR)/libmozglue.so . && \
mv lib/$(ABI_DIR)/*plugin-container* $(MOZ_CHILD_PROCESS_NAME) && \
rm -rf lib/$(ABI_DIR) )
$(UNZIP) $(UNPACKAGE) && \
mv lib/$(ABI_DIR)/libmozglue.so . && \
mv lib/$(ABI_DIR)/*plugin-container* $(MOZ_CHILD_PROCESS_NAME) && \
mv $(ASSET_SO_LIBRARIES) . && \
rm -rf assets && \
rm -rf lib/$(ABI_DIR) )
endif
ifeq ($(MOZ_PKG_FORMAT),DMG)