blob: 2bc78ceb961457c938b616c427021ac9b300a7bb [file] [log] [blame]
Dan Pasanen24a1cc92016-12-28 22:59:21 -06001#
2# Copyright (C) 2016 The CyanogenMod Project
Luca Stefani05b68802019-09-08 22:02:37 +02003# 2017-2019 The LineageOS Project
Dan Pasanen24a1cc92016-12-28 22:59:21 -06004#
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
LuK133756030be2018-02-25 19:05:14 +010018ifeq ($(TARGET_SCREEN_WIDTH),)
19 $(warning TARGET_SCREEN_WIDTH is not set, using default value: 1080)
20 TARGET_SCREEN_WIDTH := 1080
21endif
22ifeq ($(TARGET_SCREEN_HEIGHT),)
23 $(warning TARGET_SCREEN_HEIGHT is not set, using default value: 1920)
24 TARGET_SCREEN_HEIGHT := 1920
25endif
26
Dan Pasanen24a1cc92016-12-28 22:59:21 -060027TARGET_GENERATED_BOOTANIMATION := $(TARGET_OUT_INTERMEDIATES)/BOOTANIMATION/bootanimation.zip
Luca Stefani05b68802019-09-08 22:02:37 +020028$(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; \
Rashed Abdel-Tawab52b26fa2019-09-08 15:30:19 -070049 prebuilts/tools-lineage/${HOST_OS}-x86/bin/mogrify -resize $$RESOLUTION -colors 250 $(INTERMEDIATES)/*/*.png; \
Luca Stefani05b68802019-09-08 22:02:37 +020050 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 Pasanen24a1cc92016-12-28 22:59:21 -060053
54ifeq ($(TARGET_BOOTANIMATION),)
55 TARGET_BOOTANIMATION := $(TARGET_GENERATED_BOOTANIMATION)
Dan Pasanen24a1cc92016-12-28 22:59:21 -060056endif
57
Dan Pasanen24a1cc92016-12-28 22:59:21 -060058include $(CLEAR_VARS)
59LOCAL_MODULE := bootanimation.zip
60LOCAL_MODULE_CLASS := ETC
61LOCAL_MODULE_PATH := $(TARGET_OUT)/media
62
63include $(BUILD_SYSTEM)/base_rules.mk
64
65$(LOCAL_BUILT_MODULE): $(TARGET_BOOTANIMATION)
Dan Pasanen24a1cc92016-12-28 22:59:21 -060066 @cp $(TARGET_BOOTANIMATION) $@