Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 1 | LOCAL_PATH := $(call my-dir) |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 2 | # Transfer in the resources for the device |
| 3 | include $(CLEAR_VARS) |
| 4 | LOCAL_MODULE := twrp |
bigbiff | d58ba18 | 2020-03-23 10:02:29 -0400 | [diff] [blame] | 5 | LOCAL_MODULE_TAGS := optional |
bigbiff | 673c7ae | 2020-12-02 19:44:56 -0500 | [diff] [blame] | 6 | LOCAL_MODULE_CLASS := DATA |
Dees Troy | 3454ade | 2015-01-20 19:21:04 +0000 | [diff] [blame] | 7 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 8 | |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 9 | # The extra blank line before *** is intentional to ensure it ends up on its own line |
| 10 | define TW_THEME_WARNING_MSG |
| 11 | |
| 12 | **************************************************************************** |
| 13 | Could not find ui.xml for TW_THEME: $(TW_THEME) |
| 14 | Set TARGET_SCREEN_WIDTH and TARGET_SCREEN_HEIGHT to automatically select |
| 15 | an appropriate theme, or set TW_THEME to one of the following: |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 16 | $(notdir $(wildcard $(LOCAL_PATH)/theme/*_*)) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 17 | **************************************************************************** |
| 18 | endef |
| 19 | define TW_CUSTOM_THEME_WARNING_MSG |
| 20 | |
| 21 | **************************************************************************** |
| 22 | Could not find ui.xml for TW_CUSTOM_THEME: $(TW_CUSTOM_THEME) |
Matt Mower | 0c00571 | 2017-02-12 13:10:08 -0600 | [diff] [blame] | 23 | Expected to find custom theme's ui.xml at: |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 24 | $(TWRP_THEME_LOC)/ui.xml |
| 25 | Please fix this or set TW_THEME to one of the following: |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 26 | $(notdir $(wildcard $(LOCAL_PATH)/theme/*_*)) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 27 | **************************************************************************** |
| 28 | endef |
| 29 | |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 30 | TWRP_RES := $(LOCAL_PATH)/theme/common/fonts |
| 31 | TWRP_RES += $(LOCAL_PATH)/theme/common/languages |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 32 | ifeq ($(TW_EXTRA_LANGUAGES),true) |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 33 | TWRP_RES += $(LOCAL_PATH)/theme/extra-languages/fonts |
| 34 | TWRP_RES += $(LOCAL_PATH)/theme/extra-languages/languages |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 35 | endif |
| 36 | |
Ethan Yonker | 1ecaca7 | 2014-04-14 09:27:15 -0500 | [diff] [blame] | 37 | ifeq ($(TW_CUSTOM_THEME),) |
Ethan Yonker | 591b920 | 2015-03-11 11:17:15 -0500 | [diff] [blame] | 38 | ifeq ($(TW_THEME),) |
niks255 | d73903c | 2017-01-15 17:39:48 +0600 | [diff] [blame] | 39 | ifeq ($(DEVICE_RESOLUTION),) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 40 | GUI_WIDTH := $(TARGET_SCREEN_WIDTH) |
| 41 | GUI_HEIGHT := $(TARGET_SCREEN_HEIGHT) |
| 42 | else |
| 43 | SPLIT_DEVICE_RESOLUTION := $(subst x, ,$(DEVICE_RESOLUTION)) |
| 44 | GUI_WIDTH := $(word 1, $(SPLIT_DEVICE_RESOLUTION)) |
| 45 | GUI_HEIGHT := $(word 2, $(SPLIT_DEVICE_RESOLUTION)) |
niks255 | d73903c | 2017-01-15 17:39:48 +0600 | [diff] [blame] | 46 | endif |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 47 | |
| 48 | # Minimum resolution of 100x100 |
| 49 | # This also ensures GUI_WIDTH and GUI_HEIGHT are numbers |
| 50 | ifeq ($(shell test $(GUI_WIDTH) -ge 100; echo $$?),0) |
| 51 | ifeq ($(shell test $(GUI_HEIGHT) -ge 100; echo $$?),0) |
| 52 | ifeq ($(shell test $(GUI_WIDTH) -gt $(GUI_HEIGHT); echo $$?),0) |
| 53 | ifeq ($(shell test $(GUI_WIDTH) -ge 1280; echo $$?),0) |
| 54 | TW_THEME := landscape_hdpi |
| 55 | else |
| 56 | TW_THEME := landscape_mdpi |
| 57 | endif |
| 58 | else ifeq ($(shell test $(GUI_WIDTH) -lt $(GUI_HEIGHT); echo $$?),0) |
| 59 | ifeq ($(shell test $(GUI_WIDTH) -ge 720; echo $$?),0) |
| 60 | TW_THEME := portrait_hdpi |
| 61 | else |
| 62 | TW_THEME := portrait_mdpi |
| 63 | endif |
| 64 | else ifeq ($(shell test $(GUI_WIDTH) -eq $(GUI_HEIGHT); echo $$?),0) |
| 65 | # watch_hdpi does not yet exist |
| 66 | TW_THEME := watch_mdpi |
| 67 | endif |
| 68 | endif |
Ethan Yonker | 591b920 | 2015-03-11 11:17:15 -0500 | [diff] [blame] | 69 | endif |
| 70 | endif |
bigbiff | ce8f83c | 2015-12-12 18:30:21 -0500 | [diff] [blame] | 71 | |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 72 | TWRP_THEME_LOC := $(LOCAL_PATH)/theme/$(TW_THEME) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 73 | ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),) |
| 74 | $(warning $(TW_THEME_WARNING_MSG)) |
| 75 | $(error Theme selection failed; exiting) |
| 76 | endif |
| 77 | |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 78 | TWRP_RES += $(LOCAL_PATH)/theme/common/$(word 1,$(subst _, ,$(TW_THEME))).xml |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 79 | # for future copying of used include xmls and fonts: |
| 80 | # UI_XML := $(TWRP_THEME_LOC)/ui.xml |
| 81 | # TWRP_INCLUDE_XMLS := $(shell xmllint --xpath '/recovery/include/xmlfile/@name' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq) |
| 82 | # TWRP_FONTS_TTF := $(shell xmllint --xpath '/recovery/resources/font/@filename' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)niq) |
| 83 | else |
| 84 | TWRP_THEME_LOC := $(TW_CUSTOM_THEME) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 85 | ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),) |
| 86 | $(warning $(TW_CUSTOM_THEME_WARNING_MSG)) |
| 87 | $(error Theme selection failed; exiting) |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 88 | endif |
that | d16b2ce | 2015-07-27 20:39:19 +0200 | [diff] [blame] | 89 | endif |
Vojtech Bocek | 76ee903 | 2014-09-07 15:01:56 +0200 | [diff] [blame] | 90 | |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 91 | TWRP_RES += $(TW_ADDITIONAL_RES) |
| 92 | |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 93 | TWRP_RES_GEN := $(intermediates)/twrp |
Ethan Yonker | 5c93369 | 2014-04-04 11:26:32 -0500 | [diff] [blame] | 94 | $(TWRP_RES_GEN): |
Dees Troy | 3454ade | 2015-01-20 19:21:04 +0000 | [diff] [blame] | 95 | mkdir -p $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
that | d16b2ce | 2015-07-27 20:39:19 +0200 | [diff] [blame] | 96 | cp -fr $(TWRP_RES) $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
Dees Troy | 3454ade | 2015-01-20 19:21:04 +0000 | [diff] [blame] | 97 | cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 98 | |
| 99 | LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN) |
bigbiff | 673c7ae | 2020-12-02 19:44:56 -0500 | [diff] [blame] | 100 | #LOCAL_SRC_FILES := twrp |
| 101 | LOCAL_SRC_FILES := $(TWRP_RES_GEN) |
| 102 | $(warning LOCAL_SRC_FILES: $(LOCAL_SRC_FILES)) |
Dees_Troy | 7d15c25 | 2012-09-05 20:47:21 -0400 | [diff] [blame] | 103 | include $(BUILD_PREBUILT) |