build: use directory name instead of PKG_NAME for staging files and package metadata
authorFelix Fietkau <nbd@openwrt.org>
Mon, 4 Jan 2016 01:33:32 +0000 (01:33 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 4 Jan 2016 01:33:32 +0000 (01:33 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 48110

include/package.mk

index 6538afe3e24fc73bf85f88b820aa4b67aa3a4abf..1dfbd68d33f7ee35c413791b01eb3e4a5ca0c312 100644 (file)
@@ -49,6 +49,7 @@ find_library_dependencies = $(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.ver
                ) \
        ))))
 
+PKG_DIR_NAME:=$(lastword $(subst /,$(space),$(CURDIR)))
 STAMP_NO_AUTOREBUILD=$(wildcard $(PKG_BUILD_DIR)/.no_autorebuild)
 PREV_STAMP_PREPARED:=$(if $(STAMP_NO_AUTOREBUILD),$(wildcard $(PKG_BUILD_DIR)/.prepared*))
 ifneq ($(PREV_STAMP_PREPARED),)
@@ -60,9 +61,9 @@ endif
 STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS)))
 STAMP_CONFIGURED_WILDCARD=$(patsubst %_$(call confvar,$(PKG_CONFIG_DEPENDS)),%_*,$(STAMP_CONFIGURED))
 STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
-STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),)_installed
+STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),)_installed
 
-STAGING_FILES_LIST:=$(PKG_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),).list
+STAGING_FILES_LIST:=$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),).list
 
 define CleanStaging
        rm -f $(STAMP_INSTALLED)
@@ -85,7 +86,6 @@ ifneq ($(wildcard $(PKG_BUILD_DIR)/.source_dir),)
   QUILT:=1
 endif
 
-PKG_DIR_NAME:=$(lastword $(subst /,$(space),$(CURDIR)))
 PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD_VARIANT),default).install
 
 include $(INCLUDE_DIR)/download.mk
@@ -190,28 +190,28 @@ define Build/DefaultTargets
 
   $(STAMP_INSTALLED) : export PATH=$$(TARGET_PATH_PKG)
   $(STAMP_INSTALLED): $(STAMP_BUILT)
-       rm -rf $(TMP_DIR)/stage-$(PKG_NAME)
-       mkdir -p $(TMP_DIR)/stage-$(PKG_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages
+       rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME)
+       mkdir -p $(TMP_DIR)/stage-$(PKG_DIR_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages
        $(foreach hook,$(Hooks/InstallDev/Pre),\
-               $(call $(hook),$(TMP_DIR)/stage-$(PKG_NAME),$(TMP_DIR)/stage-$(PKG_NAME)/host)$(sep)\
+               $(call $(hook),$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)$(sep)\
        )
-       $(call Build/InstallDev,$(TMP_DIR)/stage-$(PKG_NAME),$(TMP_DIR)/stage-$(PKG_NAME)/host)
+       $(call Build/InstallDev,$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)
        $(foreach hook,$(Hooks/InstallDev/Post),\
-               $(call $(hook),$(TMP_DIR)/stage-$(PKG_NAME),$(TMP_DIR)/stage-$(PKG_NAME)/host)$(sep)\
+               $(call $(hook),$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)$(sep)\
        )
        if [ -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) ]; then \
                $(SCRIPT_DIR)/clean-package.sh \
                        "$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)" \
                        "$(STAGING_DIR)"; \
        fi
-       if [ -d $(TMP_DIR)/stage-$(PKG_NAME) ]; then \
-               (cd $(TMP_DIR)/stage-$(PKG_NAME); find ./ > $(TMP_DIR)/stage-$(PKG_NAME).files); \
+       if [ -d $(TMP_DIR)/stage-$(PKG_DIR_NAME) ]; then \
+               (cd $(TMP_DIR)/stage-$(PKG_DIR_NAME); find ./ > $(TMP_DIR)/stage-$(PKG_DIR_NAME).files); \
                $(call locked, \
-                       mv $(TMP_DIR)/stage-$(PKG_NAME).files $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) && \
-                       $(CP) $(TMP_DIR)/stage-$(PKG_NAME)/* $(STAGING_DIR)/; \
+                       mv $(TMP_DIR)/stage-$(PKG_DIR_NAME).files $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) && \
+                       $(CP) $(TMP_DIR)/stage-$(PKG_DIR_NAME)/* $(STAGING_DIR)/; \
                ,staging-dir); \
        fi
-       rm -rf $(TMP_DIR)/stage-$(PKG_NAME)
+       rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME)
        touch $$@
 
   ifdef Build/InstallDev
@@ -228,7 +228,7 @@ define Build/DefaultTargets
 endef
 
 define Build/IncludeOverlay
-  $(eval -include $(wildcard $(TOPDIR)/overlay/*/$(PKG_NAME).mk))
+  $(eval -include $(wildcard $(TOPDIR)/overlay/*/$(PKG_DIR_NAME).mk))
   define Build/IncludeOverlay
   endef
 endef