mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 951865 - Part 2: Package GeckoView resources when building mobile/android/base. r=glandium
This is a temporary measure. We have multiple resource directories that all need to be included into the GeckoView library. This patch stuffs the resources into a zip file which can be included in the GeckoView packaging step. These resources used to be copied into res/, which led to synchronization issues. This new zip file will now suffer the same synchronization problems. Android Archive (.aar) files make this synchronization step explicit, and tools such as gradle do the work to keep things in sync. We'll move to use a tool like this eventually, but for now...
This commit is contained in:
parent
0f59e92889
commit
96365240d2
@ -2,7 +2,9 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DIST_FILES := package-name.txt.in
|
||||
DIST_FILES := \
|
||||
package-name.txt.in \
|
||||
$(NULL)
|
||||
|
||||
ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
|
||||
MIN_CPU_VERSION=7
|
||||
@ -163,9 +165,35 @@ PP_TARGETS += preprocessed_package
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
not_android_res_files := \
|
||||
*.mkdir.done* \
|
||||
*.DS_Store* \
|
||||
$(NULL)
|
||||
|
||||
# This uses the fact that Android resource directories list all
|
||||
# resource files one subdirectory below the parent resource directory.
|
||||
android_res_files := $(wildcard $(addsuffix /*,$(wildcard $(addsuffix /*,$(ANDROID_RES_DIRS)))))
|
||||
android_res_files := $(filter-out $(not_android_res_files),$(wildcard $(addsuffix /*,$(wildcard $(addsuffix /*,$(ANDROID_RES_DIRS))))))
|
||||
|
||||
# For GeckoView, we want a zip of an Android res/ directory that
|
||||
# merges the contents of all the ANDROID_RES_DIRS. The inner res/
|
||||
# directory must have the Android resource two-layer hierarchy.
|
||||
|
||||
# The following helper zips files in a directory into a zip file while
|
||||
# maintaining the directory structure rooted below the directory.
|
||||
# (adding or creating said file as appropriate). For example, if the
|
||||
# dir contains dir/subdir/file, calling with directory dir would
|
||||
# create a zip containing subdir/file. Note: the trailing newline is
|
||||
# necessary.
|
||||
|
||||
# $(1): zip file to add to (or create).
|
||||
# $(2): directory to zip contents of.
|
||||
define zip_directory_with_relative_paths
|
||||
cd $(2) && zip -q $(1) -r * -x $(not_android_res_files)
|
||||
|
||||
endef
|
||||
|
||||
geckoview_resources.zip: $(android_res_files) $(GLOBAL_DEPS)
|
||||
$(foreach dir,$(ANDROID_RES_DIRS),$(call zip_directory_with_relative_paths,$(CURDIR)/$@,$(dir)))
|
||||
|
||||
$(ANDROID_GENERATED_RESFILES): $(call mkdir_deps,$(sort $(dir $(ANDROID_GENERATED_RESFILES))))
|
||||
|
||||
@ -241,7 +269,8 @@ fennec_ids.txt: $(gecko_package_dir)/R.java fennec-ids-generator.py
|
||||
# Override the Java settings with some specific android settings
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
|
||||
libs:: classes.dex jni-stubs.inc GeneratedJNIWrappers.cpp fennec_ids.txt
|
||||
libs:: geckoview_resources.zip classes.dex jni-stubs.inc GeneratedJNIWrappers.cpp fennec_ids.txt
|
||||
$(INSTALL) geckoview_resources.zip $(FINAL_TARGET)
|
||||
$(INSTALL) classes.dex $(FINAL_TARGET)
|
||||
@(diff jni-stubs.inc $(topsrcdir)/mozglue/android/jni-stubs.inc >/dev/null && diff GeneratedJNIWrappers.cpp $(topsrcdir)/widget/android/GeneratedJNIWrappers.cpp >/dev/null) || \
|
||||
(echo '*** Error: The generated JNI code has changed. Please run cp $(CURDIR)/jni-stubs.inc $(topsrcdir)/mozglue/android && cp $(CURDIR)/GeneratedJNIWrappers.* $(topsrcdir)/widget/android and repeat the build.' && exit 1)
|
||||
|
@ -31,26 +31,31 @@ GARBAGE_DIRS = \
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_ABS_DIST = $(abspath $(DIST))
|
||||
|
||||
package: $(properties_deps)
|
||||
# Make directory for the zips
|
||||
$(MKDIR) -p $(DIST)/geckoview_library
|
||||
$(MKDIR) -p $(_ABS_DIST)/geckoview_library
|
||||
|
||||
# Zip the assets
|
||||
cd $(DIST)/fennec; \
|
||||
$(ZIP) -r ../geckoview_library/geckoview_assets.zip assets
|
||||
# Zip the assets into $(DIST)/geckoview_library/geckoview_assets.zip
|
||||
cd $(_ABS_DIST)/fennec && \
|
||||
$(ZIP) -q -r $(_ABS_DIST)/geckoview_library/geckoview_assets.zip assets
|
||||
|
||||
# Make empty directories to fit an Android project structure
|
||||
$(MKDIR) -p bin gen libs/$(ANDROID_CPU_ARCH) src
|
||||
|
||||
# Copy the JARs
|
||||
cp ../base/*.jar libs/
|
||||
cp $(DEPTH)/mobile/android/base/*.jar libs/
|
||||
|
||||
# Copy the SOs
|
||||
cp $(DIST)/bin/libmozglue.so $(DIST)/bin/lib/libplugin-container.so libs/$(ANDROID_CPU_ARCH)/
|
||||
cp $(_ABS_DIST)/bin/libmozglue.so $(_ABS_DIST)/bin/lib/libplugin-container.so libs/$(ANDROID_CPU_ARCH)/
|
||||
|
||||
# Copy the resources
|
||||
cp -R ../base/res .
|
||||
$(RM) -rf res
|
||||
$(MKDIR) -p res
|
||||
cd res && \
|
||||
$(UNZIP) -q -u -o $(_ABS_DIST)/bin/geckoview_resources.zip
|
||||
|
||||
# Zip the directory
|
||||
cd ..; \
|
||||
$(ZIP) -r ../../dist/geckoview_library/geckoview_library.zip geckoview_library --exclude geckoview_library/backend.mk geckoview_library/Makefile
|
||||
cd $(DEPTH)/mobile/android && \
|
||||
$(ZIP) -q -r $(_ABS_DIST)/geckoview_library/geckoview_library.zip geckoview_library -x geckoview_library/backend.mk geckoview_library/Makefile
|
||||
|
Loading…
Reference in New Issue
Block a user