Skip to content

Commit

Permalink
Move pigz symlinks out of GUI makefile
Browse files Browse the repository at this point in the history
* Unify the building of pigz and its symlinks under the same module.
  LOCAL_POST_INSTALL_CMD has been around since Android 4.3, use it.

Change-Id: I6a1f74216b6f5a5283fc17839b9b6f19571f3be5
  • Loading branch information
mdmower committed Jan 18, 2017
1 parent e04eee7 commit c55b9a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 29 deletions.
1 change: 0 additions & 1 deletion Android.mk
Expand Up @@ -361,7 +361,6 @@ LOCAL_ADDITIONAL_DEPENDENCIES += \
teamwin \
toolbox_symlinks \
twrp \
unpigz_symlink \
fsck.fat \
fatlabel \
mkfs.fat \
Expand Down
3 changes: 0 additions & 3 deletions gui/Android.mk
Expand Up @@ -157,9 +157,6 @@ ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
ln -sf $(TWRP_SH_TARGET) $(TARGET_RECOVERY_ROOT_OUT)/sbin/sh
endif
endif
ln -sf /sbin/pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gzip
ln -sf /sbin/unpigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gunzip


LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN)
LOCAL_SRC_FILES := twrp $(TWRP_RES_GEN)
Expand Down
31 changes: 6 additions & 25 deletions pigz/Android.mk
Expand Up @@ -12,29 +12,10 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH) \
external/zlib
LOCAL_SHARED_LIBRARIES += libz libc

include $(BUILD_EXECUTABLE)

PIGZ_TOOLS := unpigz
SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(PIGZ_TOOLS))
$(SYMLINKS): PIGZ_BINARY := $(LOCAL_MODULE)
$(SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "Symlink: $@ -> $(PIGZ_BINARY)"
@mkdir -p $(dir $@)
@rm -rf $@
$(hide) ln -sf $(PIGZ_BINARY) $@

ifneq (,$(filter $(PLATFORM_SDK_VERSION),16 17 18))
ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
LOCAL_POST_INSTALL_CMD := \
$(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin && \
ln -sf pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gunzip && \
ln -sf pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gzip && \
ln -sf pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/unpigz

# We need this so that the installed files could be picked up based on the
# local module name
ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
$(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
endif

include $(CLEAR_VARS)
LOCAL_MODULE := unpigz_symlink
LOCAL_MODULE_TAGS := optional
LOCAL_ADDITIONAL_DEPENDENCIES := $(SYMLINKS)
include $(BUILD_PHONY_PACKAGE)
SYMLINKS :=
include $(BUILD_EXECUTABLE)

0 comments on commit c55b9a7

Please sign in to comment.