2020-09-22 10:48:37 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2008-09-12 00:13:14 +08:00
|
|
|
#
|
2020-09-22 10:48:37 +08:00
|
|
|
# Copyright (C) 2006-2020 OpenWrt.org
|
2007-03-16 07:57:18 +08:00
|
|
|
|
2012-06-15 04:26:04 +08:00
|
|
|
__package_mk:=1
|
|
|
|
|
2016-12-14 22:36:39 +08:00
|
|
|
all: $(if $(DUMP),dumpinfo,$(if $(CHECK),check,compile))
|
2006-04-14 11:03:32 +08:00
|
|
|
|
2016-12-21 23:39:56 +08:00
|
|
|
include $(INCLUDE_DIR)/download.mk
|
|
|
|
|
2019-08-04 04:45:06 +08:00
|
|
|
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
|
2007-03-17 03:18:55 +08:00
|
|
|
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
|
2010-08-18 21:57:58 +08:00
|
|
|
PKG_BUILD_PARALLEL ?=
|
2021-11-04 22:54:27 +08:00
|
|
|
PKG_SKIP_DOWNLOAD=$(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT)
|
2010-10-17 02:42:58 +08:00
|
|
|
|
2017-01-06 07:28:51 +08:00
|
|
|
MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
|
2012-09-15 18:21:24 +08:00
|
|
|
|
2020-09-05 17:19:11 +08:00
|
|
|
PKG_SOURCE_DATE_EPOCH:=$(if $(DUMP),,$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh $(CURDIR)))
|
|
|
|
|
2010-10-17 02:42:58 +08:00
|
|
|
ifeq ($(strip $(PKG_BUILD_PARALLEL)),0)
|
|
|
|
PKG_JOBS?=-j1
|
|
|
|
else
|
2017-01-06 07:28:51 +08:00
|
|
|
PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1)
|
2010-10-17 02:42:58 +08:00
|
|
|
endif
|
2023-02-03 02:20:42 +08:00
|
|
|
|
|
|
|
PKG_BUILD_FLAGS?=
|
2023-02-03 03:02:25 +08:00
|
|
|
# TODO remove this when all packages moved to PKG_BUILD_FLAGS=no-mips16
|
|
|
|
PKG_USE_MIPS16?=1
|
|
|
|
ifneq ($(strip $(PKG_USE_MIPS16)),1)
|
|
|
|
PKG_BUILD_FLAGS+=no-mips16
|
|
|
|
endif
|
2023-02-03 02:20:42 +08:00
|
|
|
|
2023-02-03 03:02:25 +08:00
|
|
|
__unknown_flags=$(filter-out no-iremap no-mips16,$(PKG_BUILD_FLAGS))
|
2023-02-03 02:20:42 +08:00
|
|
|
ifneq ($(__unknown_flags),)
|
|
|
|
$(error unknown PKG_BUILD_FLAGS: $(__unknown_flags))
|
|
|
|
endif
|
|
|
|
|
|
|
|
# $1=flagname, $2=default (0/1)
|
|
|
|
define pkg_build_flag
|
|
|
|
$(if $(filter no-$(1),$(PKG_BUILD_FLAGS)),0,$(if $(filter $(1),$(PKG_BUILD_FLAGS)),1,$(2)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
ifeq ($(call pkg_build_flag,iremap,1),1)
|
2016-01-25 23:49:31 +08:00
|
|
|
IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR)))
|
|
|
|
TARGET_CFLAGS += $(IREMAP_CFLAGS)
|
|
|
|
endif
|
2023-02-03 03:02:25 +08:00
|
|
|
ifdef CONFIG_USE_MIPS16
|
|
|
|
ifeq ($(call pkg_build_flag,mips16,1),1)
|
|
|
|
TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS))
|
|
|
|
TARGET_CFLAGS += -mips16 -minterlink-mips16
|
|
|
|
TARGET_CXXFLAGS += -mips16 -minterlink-mips16
|
|
|
|
endif
|
|
|
|
endif
|
2007-03-17 03:18:55 +08:00
|
|
|
|
2015-06-21 01:37:18 +08:00
|
|
|
include $(INCLUDE_DIR)/hardening.mk
|
2006-07-29 19:30:06 +08:00
|
|
|
include $(INCLUDE_DIR)/prereq.mk
|
2006-10-14 08:40:27 +08:00
|
|
|
include $(INCLUDE_DIR)/unpack.mk
|
2007-04-16 02:28:24 +08:00
|
|
|
include $(INCLUDE_DIR)/depends.mk
|
2017-05-26 02:38:10 +08:00
|
|
|
|
2019-07-10 19:32:24 +08:00
|
|
|
ifneq ($(wildcard $(TOPDIR)/git-src/$(PKG_NAME)/.git),)
|
|
|
|
USE_GIT_SRC_CHECKOUT:=1
|
|
|
|
QUILT:=1
|
|
|
|
endif
|
2017-05-26 02:38:10 +08:00
|
|
|
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
|
|
|
|
|
2017-03-23 03:16:15 +08:00
|
|
|
include $(INCLUDE_DIR)/quilt.mk
|
2006-07-29 19:30:06 +08:00
|
|
|
|
2019-06-21 03:02:06 +08:00
|
|
|
find_library_dependencies = \
|
|
|
|
$(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \
|
2021-02-16 04:09:49 +08:00
|
|
|
$(filter-out $(BUILD_PACKAGES), $(sort $(foreach dep4, \
|
2019-06-21 03:02:06 +08:00
|
|
|
$(sort $(foreach dep3, \
|
|
|
|
$(sort $(foreach dep2, \
|
|
|
|
$(sort $(foreach dep1, \
|
|
|
|
$(sort $(foreach dep0, \
|
|
|
|
$(Package/$(1)/depends), \
|
|
|
|
$(Package/$(dep0)/depends) $(dep0) \
|
|
|
|
)), \
|
|
|
|
$(Package/$(dep1)/depends) $(dep1) \
|
|
|
|
)), \
|
|
|
|
$(Package/$(dep2)/depends) $(dep2) \
|
|
|
|
)), \
|
|
|
|
$(Package/$(dep3)/depends) $(dep3) \
|
|
|
|
)), \
|
|
|
|
$(Package/$(dep4)/depends) $(dep4) \
|
2021-02-16 04:09:49 +08:00
|
|
|
))) \
|
2019-06-21 03:02:06 +08:00
|
|
|
))
|
|
|
|
|
2014-02-24 01:32:04 +08:00
|
|
|
|
2016-01-04 09:33:32 +08:00
|
|
|
PKG_DIR_NAME:=$(lastword $(subst /,$(space),$(CURDIR)))
|
2011-03-03 08:17:08 +08:00
|
|
|
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),)
|
|
|
|
STAMP_PREPARED:=$(PREV_STAMP_PREPARED)
|
|
|
|
CONFIG_AUTOREBUILD:=
|
|
|
|
else
|
2022-09-06 22:48:37 +08:00
|
|
|
STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(PKG_PREPARED_DEPENDS)))
|
2011-03-03 08:17:08 +08:00
|
|
|
endif
|
2017-12-12 19:20:56 +08:00
|
|
|
STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS)))
|
2016-09-26 21:14:50 +08:00
|
|
|
STAMP_CONFIGURED_WILDCARD=$(PKG_BUILD_DIR)/.configured_*
|
2007-03-24 03:13:08 +08:00
|
|
|
STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
|
2016-01-04 09:33:32 +08:00
|
|
|
STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),)_installed
|
2007-06-03 14:16:08 +08:00
|
|
|
|
2016-01-04 09:33:32 +08:00
|
|
|
STAGING_FILES_LIST:=$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),).list
|
2015-05-26 17:17:13 +08:00
|
|
|
|
|
|
|
define CleanStaging
|
|
|
|
rm -f $(STAMP_INSTALLED)
|
|
|
|
@-(\
|
2018-12-13 01:33:36 +08:00
|
|
|
if [ -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) ]; then \
|
|
|
|
$(SCRIPT_DIR)/clean-package.sh \
|
|
|
|
"$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)" \
|
|
|
|
"$(STAGING_DIR)"; \
|
2015-05-26 17:17:13 +08:00
|
|
|
fi; \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2010-08-16 17:45:21 +08:00
|
|
|
|
2012-11-08 00:15:22 +08:00
|
|
|
PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD_VARIANT),default).install
|
2012-10-07 00:01:06 +08:00
|
|
|
|
2007-06-03 14:16:08 +08:00
|
|
|
include $(INCLUDE_DIR)/package-defaults.mk
|
|
|
|
include $(INCLUDE_DIR)/package-dumpinfo.mk
|
|
|
|
include $(INCLUDE_DIR)/package-ipkg.mk
|
2007-09-29 09:21:56 +08:00
|
|
|
include $(INCLUDE_DIR)/package-bin.mk
|
2007-12-27 10:11:07 +08:00
|
|
|
include $(INCLUDE_DIR)/autotools.mk
|
2007-06-03 14:16:08 +08:00
|
|
|
|
2017-01-19 19:41:59 +08:00
|
|
|
_pkg_target:=$(if $(QUILT),,.)
|
|
|
|
|
2007-07-31 05:14:08 +08:00
|
|
|
override MAKEFLAGS=
|
2021-03-02 19:34:22 +08:00
|
|
|
CONFIG_SITE:=$(INCLUDE_DIR)/site/$(ARCH)
|
2008-01-03 10:12:46 +08:00
|
|
|
CUR_MAKEFILE:=$(filter-out Makefile,$(firstword $(MAKEFILE_LIST)))
|
|
|
|
SUBMAKE:=$(NO_TRACE_MAKE) $(if $(CUR_MAKEFILE),-f $(CUR_MAKEFILE))
|
2014-03-08 02:18:56 +08:00
|
|
|
PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig:$(STAGING_DIR)/usr/share/pkgconfig
|
2015-01-18 08:37:18 +08:00
|
|
|
unexport QUIET CONFIG_SITE
|
2006-10-19 23:25:58 +08:00
|
|
|
|
2007-07-31 02:39:20 +08:00
|
|
|
ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
|
2007-07-31 07:52:17 +08:00
|
|
|
ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
|
2007-06-12 01:19:43 +08:00
|
|
|
define Build/Autoclean
|
|
|
|
$(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
|
2009-04-28 00:02:21 +08:00
|
|
|
$(call rdep,${CURDIR} $(PKG_FILE_DEPENDS),$(STAMP_PREPARED),$(PKG_BUILD_DIR)/.dep_files,-x "*/.dep_*")
|
2007-09-01 13:20:21 +08:00
|
|
|
$(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),,-x "*/.dep_*" -x "*/ipkg*"))
|
2007-06-12 01:19:43 +08:00
|
|
|
endef
|
|
|
|
endif
|
2007-04-16 02:28:24 +08:00
|
|
|
endif
|
|
|
|
|
2019-07-10 19:32:24 +08:00
|
|
|
ifdef USE_GIT_SRC_CHECKOUT
|
|
|
|
define Build/Prepare/Default
|
|
|
|
mkdir -p $(PKG_BUILD_DIR)
|
|
|
|
ln -s $(TOPDIR)/git-src/$(PKG_NAME)/.git $(PKG_BUILD_DIR)/.git
|
|
|
|
( 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
|
2011-10-10 00:33:59 +08:00
|
|
|
ifdef USE_GIT_TREE
|
|
|
|
define Build/Prepare/Default
|
|
|
|
mkdir -p $(PKG_BUILD_DIR)
|
|
|
|
ln -s $(CURDIR)/git-src $(PKG_BUILD_DIR)/.git
|
2018-04-25 17:52:20 +08:00
|
|
|
( cd $(PKG_BUILD_DIR); \
|
|
|
|
git checkout .; \
|
|
|
|
git submodule update --recursive; \
|
|
|
|
git submodule foreach git config --unset core.worktree; \
|
|
|
|
git submodule foreach git checkout .; \
|
|
|
|
)
|
2011-10-10 00:33:59 +08:00
|
|
|
endef
|
|
|
|
endif
|
2014-04-18 22:58:01 +08:00
|
|
|
ifdef USE_SOURCE_DIR
|
|
|
|
define Build/Prepare/Default
|
|
|
|
rm -rf $(PKG_BUILD_DIR)
|
|
|
|
$(if $(wildcard $(USE_SOURCE_DIR)/*),,@echo "Error: USE_SOURCE_DIR=$(USE_SOURCE_DIR) path not found"; false)
|
|
|
|
ln -snf $(USE_SOURCE_DIR) $(PKG_BUILD_DIR)
|
|
|
|
touch $(PKG_BUILD_DIR)/.source_dir
|
|
|
|
endef
|
|
|
|
endif
|
2011-10-10 00:33:59 +08:00
|
|
|
|
2009-04-23 06:05:55 +08:00
|
|
|
define Build/Exports/Default
|
2017-01-19 02:47:36 +08:00
|
|
|
$(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR)/usr/share/aclocal $$(STAGING_DIR)/usr/share/aclocal-* $$(STAGING_DIR_HOSTPKG)/share/aclocal $$(STAGING_DIR_HOSTPKG)/share/aclocal-* $$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*),-I $$(p))
|
2009-04-23 06:05:55 +08:00
|
|
|
$(1) : export STAGING_PREFIX=$$(STAGING_DIR)/usr
|
|
|
|
$(1) : export PATH=$$(TARGET_PATH_PKG)
|
|
|
|
$(1) : export CONFIG_SITE:=$$(CONFIG_SITE)
|
2011-02-07 00:04:33 +08:00
|
|
|
$(1) : export PKG_CONFIG_PATH:=$$(PKG_CONFIG_PATH)
|
|
|
|
$(1) : export PKG_CONFIG_LIBDIR:=$$(PKG_CONFIG_PATH)
|
2009-04-23 06:05:55 +08:00
|
|
|
endef
|
|
|
|
Build/Exports=$(Build/Exports/Default)
|
|
|
|
|
2016-12-14 22:36:39 +08:00
|
|
|
define Build/CoreTargets
|
2017-12-12 19:20:56 +08:00
|
|
|
STAMP_PREPARED:=$$(STAMP_PREPARED)
|
|
|
|
STAMP_CONFIGURED:=$$(STAMP_CONFIGURED)
|
|
|
|
|
2007-09-29 12:29:11 +08:00
|
|
|
$(if $(QUILT),$(Build/Quilt))
|
2007-04-16 02:28:24 +08:00
|
|
|
$(call Build/Autoclean)
|
2017-01-18 21:00:48 +08:00
|
|
|
$(call DefaultTargets)
|
2006-05-14 17:30:29 +08:00
|
|
|
|
2021-08-20 05:14:22 +08:00
|
|
|
$(call check_download_integrity)
|
2020-11-19 23:32:46 +08:00
|
|
|
|
2011-09-30 19:12:13 +08:00
|
|
|
download:
|
|
|
|
$(foreach hook,$(Hooks/Download),
|
|
|
|
$(call $(hook))$(sep)
|
|
|
|
)
|
|
|
|
|
2009-03-14 00:16:54 +08:00
|
|
|
$(STAMP_PREPARED) : export PATH=$$(TARGET_PATH_PKG)
|
2016-05-06 02:37:40 +08:00
|
|
|
$(STAMP_PREPARED): $(STAMP_PREPARED_DEPENDS)
|
2006-05-11 08:18:12 +08:00
|
|
|
@-rm -rf $(PKG_BUILD_DIR)
|
|
|
|
@mkdir -p $(PKG_BUILD_DIR)
|
2017-02-01 21:44:22 +08:00
|
|
|
touch $$@_check
|
2007-12-27 10:11:07 +08:00
|
|
|
$(foreach hook,$(Hooks/Prepare/Pre),$(call $(hook))$(sep))
|
2007-03-16 07:57:18 +08:00
|
|
|
$(Build/Prepare)
|
2007-12-27 10:11:07 +08:00
|
|
|
$(foreach hook,$(Hooks/Prepare/Post),$(call $(hook))$(sep))
|
2006-05-12 07:14:04 +08:00
|
|
|
touch $$@
|
2006-04-14 11:03:32 +08:00
|
|
|
|
2009-04-23 06:05:55 +08:00
|
|
|
$(call Build/Exports,$(STAMP_CONFIGURED))
|
2016-05-06 02:37:40 +08:00
|
|
|
$(STAMP_CONFIGURED): $(STAMP_PREPARED) $(STAMP_CONFIGURED_DEPENDS)
|
2017-12-10 22:30:30 +08:00
|
|
|
rm -f $(STAMP_CONFIGURED_WILDCARD)
|
2015-05-26 17:17:13 +08:00
|
|
|
$(CleanStaging)
|
2007-12-27 10:11:07 +08:00
|
|
|
$(foreach hook,$(Hooks/Configure/Pre),$(call $(hook))$(sep))
|
2007-03-16 07:57:18 +08:00
|
|
|
$(Build/Configure)
|
2007-12-27 10:11:07 +08:00
|
|
|
$(foreach hook,$(Hooks/Configure/Post),$(call $(hook))$(sep))
|
2006-04-14 11:03:32 +08:00
|
|
|
touch $$@
|
|
|
|
|
2009-04-23 06:05:55 +08:00
|
|
|
$(call Build/Exports,$(STAMP_BUILT))
|
2016-05-06 02:37:40 +08:00
|
|
|
$(STAMP_BUILT): $(STAMP_CONFIGURED) $(STAMP_BUILT_DEPENDS)
|
2017-02-01 21:44:22 +08:00
|
|
|
rm -f $$@
|
|
|
|
touch $$@_check
|
2007-12-27 10:11:07 +08:00
|
|
|
$(foreach hook,$(Hooks/Compile/Pre),$(call $(hook))$(sep))
|
2007-03-16 07:57:18 +08:00
|
|
|
$(Build/Compile)
|
2007-12-27 10:11:07 +08:00
|
|
|
$(foreach hook,$(Hooks/Compile/Post),$(call $(hook))$(sep))
|
2008-09-01 19:03:58 +08:00
|
|
|
$(Build/Install)
|
|
|
|
$(foreach hook,$(Hooks/Install/Post),$(call $(hook))$(sep))
|
2007-11-21 06:43:38 +08:00
|
|
|
touch $$@
|
|
|
|
|
2009-03-14 00:16:54 +08:00
|
|
|
$(STAMP_INSTALLED) : export PATH=$$(TARGET_PATH_PKG)
|
2007-11-21 06:43:38 +08:00
|
|
|
$(STAMP_INSTALLED): $(STAMP_BUILT)
|
2016-01-04 09:33:32 +08:00
|
|
|
rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME)
|
2019-06-09 06:00:47 +08:00
|
|
|
mkdir -p $(TMP_DIR)/stage-$(PKG_DIR_NAME)/host $(STAGING_DIR)/packages
|
2008-09-12 00:13:14 +08:00
|
|
|
$(foreach hook,$(Hooks/InstallDev/Pre),\
|
2016-01-04 09:33:32 +08:00
|
|
|
$(call $(hook),$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)$(sep)\
|
2008-09-12 00:13:14 +08:00
|
|
|
)
|
2016-01-04 09:33:32 +08:00
|
|
|
$(call Build/InstallDev,$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)
|
2008-09-12 00:13:14 +08:00
|
|
|
$(foreach hook,$(Hooks/InstallDev/Post),\
|
2016-01-04 09:33:32 +08:00
|
|
|
$(call $(hook),$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)$(sep)\
|
2008-09-12 00:13:14 +08:00
|
|
|
)
|
2013-05-29 18:31:45 +08:00
|
|
|
if [ -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) ]; then \
|
|
|
|
$(SCRIPT_DIR)/clean-package.sh \
|
|
|
|
"$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)" \
|
|
|
|
"$(STAGING_DIR)"; \
|
|
|
|
fi
|
2016-01-04 09:33:32 +08:00
|
|
|
if [ -d $(TMP_DIR)/stage-$(PKG_DIR_NAME) ]; then \
|
|
|
|
(cd $(TMP_DIR)/stage-$(PKG_DIR_NAME); find ./ > $(TMP_DIR)/stage-$(PKG_DIR_NAME).files); \
|
2010-11-04 20:28:55 +08:00
|
|
|
$(call locked, \
|
2016-01-04 09:33:32 +08:00
|
|
|
mv $(TMP_DIR)/stage-$(PKG_DIR_NAME).files $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) && \
|
|
|
|
$(CP) $(TMP_DIR)/stage-$(PKG_DIR_NAME)/* $(STAGING_DIR)/; \
|
2010-11-04 20:28:55 +08:00
|
|
|
,staging-dir); \
|
2007-12-25 09:39:15 +08:00
|
|
|
fi
|
2016-01-04 09:33:32 +08:00
|
|
|
rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME)
|
2006-05-14 17:30:29 +08:00
|
|
|
touch $$@
|
2006-06-01 00:20:27 +08:00
|
|
|
|
2006-08-02 20:07:14 +08:00
|
|
|
ifdef Build/InstallDev
|
2017-01-19 19:41:59 +08:00
|
|
|
$(_pkg_target)compile: $(STAMP_INSTALLED)
|
2006-06-01 08:06:16 +08:00
|
|
|
endif
|
2006-06-01 00:20:27 +08:00
|
|
|
|
2017-01-19 19:41:59 +08:00
|
|
|
$(_pkg_target)prepare: $(STAMP_PREPARED)
|
|
|
|
$(_pkg_target)configure: $(STAMP_CONFIGURED)
|
|
|
|
$(_pkg_target)dist: $(STAMP_CONFIGURED)
|
|
|
|
$(_pkg_target)distcheck: $(STAMP_CONFIGURED)
|
2017-01-18 22:37:57 +08:00
|
|
|
|
|
|
|
ifneq ($(CONFIG_AUTOREMOVE),)
|
|
|
|
compile:
|
2018-05-22 15:18:33 +08:00
|
|
|
-touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
|
2022-09-08 05:50:36 +08:00
|
|
|
$(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' -print0 | \
|
|
|
|
$(XARGS) -0 rm -rf
|
2017-01-18 22:37:57 +08:00
|
|
|
endif
|
2006-04-14 11:03:32 +08:00
|
|
|
endef
|
2005-07-25 03:58:14 +08:00
|
|
|
|
2016-12-14 22:36:39 +08:00
|
|
|
define Build/DefaultTargets
|
2021-11-04 22:54:27 +08:00
|
|
|
$(if $(PKG_SKIP_DOWNLOAD),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
|
2016-12-14 22:36:39 +08:00
|
|
|
$(if $(DUMP),,$(Build/CoreTargets))
|
|
|
|
|
|
|
|
define Build/DefaultTargets
|
|
|
|
endef
|
|
|
|
endef
|
|
|
|
|
2006-04-20 07:56:04 +08:00
|
|
|
define BuildPackage
|
2007-03-16 07:57:18 +08:00
|
|
|
$(eval $(Package/Default))
|
|
|
|
$(eval $(Package/$(1)))
|
|
|
|
|
2007-10-14 12:49:05 +08:00
|
|
|
ifdef DESCRIPTION
|
2009-02-22 12:36:56 +08:00
|
|
|
$$(error DESCRIPTION:= is obsolete, use Package/PKG_NAME/description)
|
2007-10-14 12:49:05 +08:00
|
|
|
endif
|
|
|
|
|
2007-03-16 07:57:18 +08:00
|
|
|
ifndef Package/$(1)/description
|
|
|
|
define Package/$(1)/description
|
2007-10-14 12:49:05 +08:00
|
|
|
$(TITLE)
|
2007-03-16 07:57:18 +08:00
|
|
|
endef
|
|
|
|
endif
|
2006-04-14 09:22:55 +08:00
|
|
|
|
2014-02-24 01:32:04 +08:00
|
|
|
BUILD_PACKAGES += $(1)
|
2019-06-21 03:02:06 +08:00
|
|
|
$(STAMP_PREPARED): $$(if $(QUILT)$(DUMP),,$(call find_library_dependencies,$(1)))
|
2014-02-24 01:32:04 +08:00
|
|
|
|
2012-12-23 03:56:21 +08:00
|
|
|
$(foreach FIELD, TITLE CATEGORY SECTION VERSION,
|
2006-05-12 06:36:20 +08:00
|
|
|
ifeq ($($(FIELD)),)
|
|
|
|
$$(error Package/$(1) is missing the $(FIELD) field)
|
|
|
|
endif
|
|
|
|
)
|
2006-05-11 08:18:12 +08:00
|
|
|
|
2007-09-28 09:23:56 +08:00
|
|
|
$(if $(DUMP), \
|
2016-12-14 22:36:39 +08:00
|
|
|
$(if $(CHECK),,$(Dumpinfo/Package)), \
|
2007-09-28 09:23:56 +08:00
|
|
|
$(foreach target, \
|
|
|
|
$(if $(Package/$(1)/targets),$(Package/$(1)/targets), \
|
2010-02-25 07:43:05 +08:00
|
|
|
$(if $(PKG_TARGETS),$(PKG_TARGETS), ipkg) \
|
2007-09-28 09:23:56 +08:00
|
|
|
), $(BuildTarget/$(target)) \
|
|
|
|
) \
|
|
|
|
)
|
2016-12-14 22:36:39 +08:00
|
|
|
$(if $(PKG_HOST_ONLY),,$(call Build/DefaultTargets,$(1)))
|
2006-04-14 11:03:32 +08:00
|
|
|
endef
|
2005-10-22 09:40:50 +08:00
|
|
|
|
2007-10-07 09:55:03 +08:00
|
|
|
define pkg_install_files
|
2007-10-21 03:13:53 +08:00
|
|
|
$(foreach install_file,$(1),$(INSTALL_DIR) $(3)/`dirname $(install_file)`; $(INSTALL_DATA) $(2)/$(install_file) $(3)/`dirname $(install_file)`;)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define pkg_install_bin
|
2007-12-18 06:24:40 +08:00
|
|
|
$(foreach install_apps,$(1),$(INSTALL_DIR) $(3)/`dirname $(install_apps)`; $(INSTALL_BIN) $(2)/$(install_apps) $(3)/`dirname $(install_apps)`;)
|
2007-10-07 09:55:03 +08:00
|
|
|
endef
|
|
|
|
|
2008-09-03 21:19:50 +08:00
|
|
|
Build/Prepare=$(call Build/Prepare/Default,)
|
|
|
|
Build/Configure=$(call Build/Configure/Default,)
|
|
|
|
Build/Compile=$(call Build/Compile/Default,)
|
|
|
|
Build/Install=$(if $(PKG_INSTALL),$(call Build/Install/Default,))
|
2009-05-31 20:01:05 +08:00
|
|
|
Build/Dist=$(call Build/Dist/Default,)
|
|
|
|
Build/DistCheck=$(call Build/DistCheck/Default,)
|
2005-04-18 14:17:39 +08:00
|
|
|
|
2012-09-17 19:17:26 +08:00
|
|
|
.NOTPARALLEL:
|
|
|
|
|
2012-10-07 00:01:06 +08:00
|
|
|
.PHONY: prepare-package-install
|
|
|
|
prepare-package-install:
|
2012-10-07 06:42:57 +08:00
|
|
|
@mkdir -p $(PKG_INFO_DIR)
|
2017-02-22 01:27:22 +08:00
|
|
|
@rm -f $(PKG_INSTALL_STAMP)
|
2016-04-07 03:55:44 +08:00
|
|
|
@echo "$(filter-out essential nonshared,$(PKG_FLAGS))" > $(PKG_INSTALL_STAMP).flags
|
2012-10-07 00:01:06 +08:00
|
|
|
|
2007-03-16 07:57:18 +08:00
|
|
|
$(PACKAGE_DIR):
|
2006-05-11 04:32:22 +08:00
|
|
|
mkdir -p $@
|
2016-12-14 22:36:39 +08:00
|
|
|
|
2017-02-22 01:27:22 +08:00
|
|
|
compile:
|
2017-01-18 21:27:04 +08:00
|
|
|
.install: .compile
|
2012-10-07 00:01:06 +08:00
|
|
|
install: compile
|
2007-12-25 09:39:15 +08:00
|
|
|
|
2017-01-24 04:53:47 +08:00
|
|
|
force-clean-build: FORCE
|
2017-01-23 00:40:29 +08:00
|
|
|
rm -rf $(PKG_BUILD_DIR)
|
|
|
|
|
2017-01-24 04:53:47 +08:00
|
|
|
clean-build: $(if $(wildcard $(PKG_BUILD_DIR)/.autoremove),force-clean-build)
|
|
|
|
|
|
|
|
clean: force-clean-build
|
2015-05-26 17:17:13 +08:00
|
|
|
$(CleanStaging)
|
2019-06-09 06:00:47 +08:00
|
|
|
$(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR)/host)
|
2007-03-31 21:45:50 +08:00
|
|
|
$(Build/Clean)
|
2019-06-09 06:00:47 +08:00
|
|
|
rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST)
|
2009-05-31 20:01:05 +08:00
|
|
|
|
|
|
|
dist:
|
|
|
|
$(Build/Dist)
|
2015-03-29 15:29:18 +08:00
|
|
|
|
2009-05-31 20:01:05 +08:00
|
|
|
distcheck:
|
2015-03-29 15:29:18 +08:00
|
|
|
$(Build/DistCheck)
|