Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2016 The CyanogenMod Project |
Luca Stefani | 05b6880 | 2019-09-08 22:02:37 +0200 | [diff] [blame^] | 3 | # 2017-2019 The LineageOS Project |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | |
LuK1337 | 56030be | 2018-02-25 19:05:14 +0100 | [diff] [blame] | 18 | ifeq ($(TARGET_SCREEN_WIDTH),) |
| 19 | $(warning TARGET_SCREEN_WIDTH is not set, using default value: 1080) |
| 20 | TARGET_SCREEN_WIDTH := 1080 |
| 21 | endif |
| 22 | ifeq ($(TARGET_SCREEN_HEIGHT),) |
| 23 | $(warning TARGET_SCREEN_HEIGHT is not set, using default value: 1920) |
| 24 | TARGET_SCREEN_HEIGHT := 1920 |
| 25 | endif |
| 26 | |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 27 | TARGET_GENERATED_BOOTANIMATION := $(TARGET_OUT_INTERMEDIATES)/BOOTANIMATION/bootanimation.zip |
Luca Stefani | 05b6880 | 2019-09-08 22:02:37 +0200 | [diff] [blame^] | 28 | $(TARGET_GENERATED_BOOTANIMATION): INTERMEDIATES := $(TARGET_OUT_INTERMEDIATES)/BOOTANIMATION |
| 29 | $(TARGET_GENERATED_BOOTANIMATION): $(SOONG_ZIP) |
| 30 | @echo "Building bootanimation.zip" |
| 31 | @rm -rf $(dir $@) |
| 32 | @mkdir -p $(dir $@) |
| 33 | $(hide) tar xfp vendor/lineage/bootanimation/bootanimation.tar -C $(INTERMEDIATES) |
| 34 | $(hide) if [ $(TARGET_SCREEN_HEIGHT) -lt $(TARGET_SCREEN_WIDTH) ]; then \ |
| 35 | IMAGEWIDTH=$(TARGET_SCREEN_HEIGHT); \ |
| 36 | else \ |
| 37 | IMAGEWIDTH=$(TARGET_SCREEN_WIDTH); \ |
| 38 | fi; \ |
| 39 | IMAGESCALEWIDTH=$$IMAGEWIDTH; \ |
| 40 | IMAGESCALEHEIGHT=$$(expr $$IMAGESCALEWIDTH / 3); \ |
| 41 | if [ "$(TARGET_BOOTANIMATION_HALF_RES)" = "true" ]; then \ |
| 42 | IMAGEWIDTH="$$(expr "$$IMAGEWIDTH" / 2)"; \ |
| 43 | fi; \ |
| 44 | IMAGEHEIGHT=$$(expr $$IMAGEWIDTH / 3); \ |
| 45 | RESOLUTION="$$IMAGEWIDTH"x"$$IMAGEHEIGHT"; \ |
| 46 | for part_cnt in 0 1 2 3 4; do \ |
| 47 | mkdir -p $(INTERMEDIATES)/part$$part_cnt; \ |
| 48 | done; \ |
| 49 | mogrify -resize $$RESOLUTION -colors 250 $(INTERMEDIATES)/*/*.png; \ |
| 50 | echo "$$IMAGESCALEWIDTH $$IMAGESCALEHEIGHT 60" > $(INTERMEDIATES)/desc.txt; \ |
| 51 | cat vendor/lineage/bootanimation/desc.txt >> $(INTERMEDIATES)/desc.txt |
| 52 | $(hide) $(SOONG_ZIP) -L 0 -o $(TARGET_GENERATED_BOOTANIMATION) -C $(INTERMEDIATES) -D $(INTERMEDIATES) |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 53 | |
| 54 | ifeq ($(TARGET_BOOTANIMATION),) |
| 55 | TARGET_BOOTANIMATION := $(TARGET_GENERATED_BOOTANIMATION) |
Zhao Wei Liew | d0850b3 | 2017-02-11 06:01:13 +0800 | [diff] [blame] | 56 | ifeq ($(shell command -v mogrify),) |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 57 | $(info **********************************************) |
| 58 | $(info The boot animation could not be generated as) |
| 59 | $(info ImageMagick is not installed in your system.) |
| 60 | $(info $(space)) |
| 61 | $(info Please install ImageMagick from this website:) |
| 62 | $(info https://imagemagick.org/script/binary-releases.php) |
| 63 | $(info **********************************************) |
| 64 | $(error stop) |
| 65 | endif |
| 66 | endif |
| 67 | |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 68 | include $(CLEAR_VARS) |
| 69 | LOCAL_MODULE := bootanimation.zip |
| 70 | LOCAL_MODULE_CLASS := ETC |
| 71 | LOCAL_MODULE_PATH := $(TARGET_OUT)/media |
| 72 | |
| 73 | include $(BUILD_SYSTEM)/base_rules.mk |
| 74 | |
| 75 | $(LOCAL_BUILT_MODULE): $(TARGET_BOOTANIMATION) |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 76 | @cp $(TARGET_BOOTANIMATION) $@ |