mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 686876 - Move libraries at the top level in the apk. r=mfinkle
This commit is contained in:
parent
7847c746e5
commit
10d9b1f0d9
@ -432,7 +432,7 @@ static void * mozload(const char * path, void *zip,
|
||||
|
||||
if (extractLibs) {
|
||||
char fullpath[PATH_MAX];
|
||||
snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), path + 4);
|
||||
snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), path);
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "resolved %s to %s", path, fullpath);
|
||||
extractFile(fullpath, entry, data);
|
||||
handle = __wrap_dlopen(fullpath, RTLD_LAZY);
|
||||
@ -456,11 +456,11 @@ static void * mozload(const char * path, void *zip,
|
||||
uint32_t lib_size = letoh32(entry->uncompressed_size);
|
||||
int cache_fd = 0;
|
||||
if (letoh16(file->compression) == DEFLATE) {
|
||||
cache_fd = lookupLibCacheFd(path + 4);
|
||||
cache_fd = lookupLibCacheFd(path);
|
||||
fd = cache_fd;
|
||||
if (fd < 0) {
|
||||
char fullpath[PATH_MAX];
|
||||
snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), path + 4);
|
||||
snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), path);
|
||||
fd = open(fullpath, O_RDWR);
|
||||
struct stat status;
|
||||
if (stat(fullpath, &status) ||
|
||||
@ -470,19 +470,19 @@ static void * mozload(const char * path, void *zip,
|
||||
fd = -1;
|
||||
} else {
|
||||
cache_fd = fd;
|
||||
addLibCacheFd(path + 4, fd);
|
||||
addLibCacheFd(path, fd);
|
||||
}
|
||||
}
|
||||
if (fd < 0)
|
||||
fd = createAshmem(lib_size, path);
|
||||
#ifdef DEBUG
|
||||
else
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Loading %s from cache", path + 4);
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Loading %s from cache", path);
|
||||
#endif
|
||||
if (fd < 0) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Couldn't open " ASHMEM_NAME_DEF ", Error %d, %s, using a file", errno, strerror(errno));
|
||||
char fullpath[PATH_MAX];
|
||||
snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), path + 4);
|
||||
snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), path);
|
||||
fd = open(fullpath, O_RDWR | O_CREAT);
|
||||
if (fd < 0) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Couldn't create a file either, giving up");
|
||||
@ -500,7 +500,7 @@ static void * mozload(const char * path, void *zip,
|
||||
return NULL;
|
||||
}
|
||||
skipLibCache = true;
|
||||
addLibCacheFd(path + 4, fd);
|
||||
addLibCacheFd(path, fd);
|
||||
}
|
||||
buf = mmap(NULL, lib_size,
|
||||
PROT_READ | PROT_WRITE,
|
||||
@ -516,11 +516,11 @@ static void * mozload(const char * path, void *zip,
|
||||
if (cache_fd < 0) {
|
||||
extractLib(entry, data, buf);
|
||||
if (!skipLibCache)
|
||||
addLibCacheFd(path + 4, fd, lib_size, buf);
|
||||
addLibCacheFd(path, fd, lib_size, buf);
|
||||
}
|
||||
|
||||
// preload libxul, to avoid slowly demand-paging it
|
||||
if (!strcmp(path, "lib/libxul.so"))
|
||||
if (!strcmp(path, "libxul.so"))
|
||||
madvise(buf, entry->uncompressed_size, MADV_WILLNEED);
|
||||
data = buf;
|
||||
}
|
||||
@ -629,7 +629,7 @@ loadLibs(const char *apkName)
|
||||
file_ids = (char *)extractBuf("lib.id", zip, cdir_start, cdir_entries);
|
||||
#endif
|
||||
|
||||
#define MOZLOAD(name) mozload("lib/lib" name ".so", zip, cdir_start, cdir_entries)
|
||||
#define MOZLOAD(name) mozload("lib" name ".so", zip, cdir_start, cdir_entries)
|
||||
MOZLOAD("mozalloc");
|
||||
MOZLOAD("nspr4");
|
||||
MOZLOAD("plc4");
|
||||
|
@ -270,6 +270,20 @@ DIST_FILES = \
|
||||
res \
|
||||
lib \
|
||||
lib.id \
|
||||
libmozalloc.so \
|
||||
libnspr4.so \
|
||||
libplc4.so \
|
||||
libplds4.so \
|
||||
libmozsqlite3.so \
|
||||
libnssutil3.so \
|
||||
libnss3.so \
|
||||
libssl3.so \
|
||||
libsmime3.so \
|
||||
libxul.so \
|
||||
libxpcom.so \
|
||||
libnssckbi.so \
|
||||
libfreebl3.so \
|
||||
libsoftokn3.so \
|
||||
extensions \
|
||||
application.ini \
|
||||
platform.ini \
|
||||
@ -304,10 +318,9 @@ INNER_MAKE_PACKAGE = \
|
||||
( cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && \
|
||||
rm -rf lib && \
|
||||
mkdir -p lib/$(ABI_DIR) && \
|
||||
cp lib*.so lib && \
|
||||
mv lib/libmozutils.so lib/$(ABI_DIR) && \
|
||||
mv libmozutils.so lib/$(ABI_DIR) && \
|
||||
rm -f lib.id && \
|
||||
for SOMELIB in lib/*.so ; \
|
||||
for SOMELIB in *.so ; \
|
||||
do \
|
||||
printf "`basename $$SOMELIB`:`$(_ABS_DIST)/host/bin/file_id $$SOMELIB`\n" >> lib.id ; \
|
||||
done && \
|
||||
@ -324,7 +337,6 @@ INNER_UNMAKE_PACKAGE = \
|
||||
cd $(MOZ_PKG_DIR) && \
|
||||
$(UNZIP) $(UNPACKAGE) && \
|
||||
mv lib/$(ABI_DIR)/*.so . && \
|
||||
mv lib/*.so . && \
|
||||
rm -rf lib
|
||||
endif
|
||||
ifeq ($(MOZ_PKG_FORMAT),DMG)
|
||||
|
Loading…
Reference in New Issue
Block a user