OpenWrt v18.06.0-rc1: adjust config defaults
[openwrt/openwrt.git] / include / package.mk
index ce1aa256bdf0eaf78c298fcba0f207e6ca9047fc..2473eecb922074e415496e1add86cf2c9c47cccb 100644 (file)
@@ -37,10 +37,22 @@ endif
 
 include $(INCLUDE_DIR)/hardening.mk
 include $(INCLUDE_DIR)/prereq.mk
-include $(INCLUDE_DIR)/host.mk
 include $(INCLUDE_DIR)/unpack.mk
 include $(INCLUDE_DIR)/depends.mk
 
+ifneq ($(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src)),)
+  USE_GIT_TREE:=1
+  QUILT:=1
+endif
+ifdef USE_SOURCE_DIR
+  QUILT:=1
+endif
+ifneq ($(wildcard $(PKG_BUILD_DIR)/.source_dir),)
+  QUILT:=1
+endif
+
+include $(INCLUDE_DIR)/quilt.mk
+
 find_library_dependencies = $(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \
        $(filter-out $(BUILD_PACKAGES),$(foreach dep, \
                $(filter-out @%, $(patsubst +%,%,$(1))), \
@@ -76,20 +88,9 @@ define CleanStaging
        )
 endef
 
-ifneq ($(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src)),)
-  USE_GIT_TREE:=1
-  QUILT:=1
-endif
-ifdef USE_SOURCE_DIR
-  QUILT:=1
-endif
-ifneq ($(wildcard $(PKG_BUILD_DIR)/.source_dir),)
-  QUILT:=1
-endif
 
 PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD_VARIANT),default).install
 
-include $(INCLUDE_DIR)/quilt.mk
 include $(INCLUDE_DIR)/package-defaults.mk
 include $(INCLUDE_DIR)/package-dumpinfo.mk
 include $(INCLUDE_DIR)/package-ipkg.mk
@@ -119,7 +120,12 @@ ifdef USE_GIT_TREE
   define Build/Prepare/Default
        mkdir -p $(PKG_BUILD_DIR)
        ln -s $(CURDIR)/git-src $(PKG_BUILD_DIR)/.git
-       ( cd $(PKG_BUILD_DIR); git checkout .)
+       ( cd $(PKG_BUILD_DIR); \
+               git checkout .; \
+               git submodule update --recursive; \
+               git submodule foreach git config --unset core.worktree; \
+               git submodule foreach git checkout .; \
+       )
   endef
 endif
 ifdef USE_SOURCE_DIR
@@ -143,6 +149,9 @@ endef
 Build/Exports=$(Build/Exports/Default)
 
 define Build/CoreTargets
+  STAMP_PREPARED:=$$(STAMP_PREPARED)
+  STAMP_CONFIGURED:=$$(STAMP_CONFIGURED)
+
   $(if $(QUILT),$(Build/Quilt))
   $(call Build/Autoclean)
   $(call DefaultTargets)
@@ -164,11 +173,11 @@ define Build/CoreTargets
 
   $(call Build/Exports,$(STAMP_CONFIGURED))
   $(STAMP_CONFIGURED): $(STAMP_PREPARED) $(STAMP_CONFIGURED_DEPENDS)
+       rm -f $(STAMP_CONFIGURED_WILDCARD)
        $(CleanStaging)
        $(foreach hook,$(Hooks/Configure/Pre),$(call $(hook))$(sep))
        $(Build/Configure)
        $(foreach hook,$(Hooks/Configure/Post),$(call $(hook))$(sep))
-       rm -f $(STAMP_CONFIGURED_WILDCARD)
        touch $$@
 
   $(call Build/Exports,$(STAMP_BUILT))
@@ -219,7 +228,7 @@ define Build/CoreTargets
 
   ifneq ($(CONFIG_AUTOREMOVE),)
     compile:
-               -touch $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
+               -touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
                $(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \
                        $(XARGS) rm -rf
   endif
@@ -233,14 +242,7 @@ define Build/DefaultTargets
   endef
 endef
 
-define Build/IncludeOverlay
-  $(eval -include $(wildcard $(TOPDIR)/overlay/*/$(PKG_DIR_NAME).mk))
-  define Build/IncludeOverlay
-  endef
-endef
-
 define BuildPackage
-  $(Build/IncludeOverlay)
   $(eval $(Package/Default))
   $(eval $(Package/$(1)))
 
@@ -294,13 +296,13 @@ Build/DistCheck=$(call Build/DistCheck/Default,)
 .PHONY: prepare-package-install
 prepare-package-install:
        @mkdir -p $(PKG_INFO_DIR)
-       @touch $(PKG_INSTALL_STAMP).clean
+       @rm -f $(PKG_INSTALL_STAMP)
        @echo "$(filter-out essential nonshared,$(PKG_FLAGS))" > $(PKG_INSTALL_STAMP).flags
 
 $(PACKAGE_DIR):
        mkdir -p $@
 
-compile: prepare-package-install
+compile:
 .install: .compile
 install: compile