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