build: use -iremap feature to replace __FILE__ absolute path names in packages with ones relative to $(BUILD_DIR)

improves reproducible builds

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48489
This commit is contained in:
Felix Fietkau 2016-01-25 15:49:31 +00:00
parent 0ae15ad439
commit b737686b2c
2 changed files with 9 additions and 0 deletions

View file

@ -14,6 +14,7 @@ PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
PKG_MD5SUM ?= unknown PKG_MD5SUM ?= unknown
PKG_BUILD_PARALLEL ?= PKG_BUILD_PARALLEL ?=
PKG_USE_MIPS16 ?= 1 PKG_USE_MIPS16 ?= 1
PKG_IREMAP ?= 1
ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),) ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j) MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
@ -33,6 +34,10 @@ ifdef CONFIG_USE_MIPS16
TARGET_CFLAGS += -mips16 -minterlink-mips16 TARGET_CFLAGS += -mips16 -minterlink-mips16
endif endif
endif endif
ifeq ($(strip $(PKG_IREMAP)),1)
IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR)))
TARGET_CFLAGS += $(IREMAP_CFLAGS)
endif
include $(INCLUDE_DIR)/hardening.mk include $(INCLUDE_DIR)/hardening.mk
include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/prereq.mk

View file

@ -118,6 +118,10 @@ else
TOOLCHAIN_DIR_NAME:=toolchain-$(GNU_TARGET_NAME) TOOLCHAIN_DIR_NAME:=toolchain-$(GNU_TARGET_NAME)
endif endif
ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_GCC_VERSION_4_8)),)
iremap = -iremap $(1):$(2)
endif
PACKAGE_DIR:=$(BIN_DIR)/packages PACKAGE_DIR:=$(BIN_DIR)/packages
BUILD_DIR:=$(BUILD_DIR_BASE)/$(TARGET_DIR_NAME) BUILD_DIR:=$(BUILD_DIR_BASE)/$(TARGET_DIR_NAME)
STAGING_DIR:=$(TOPDIR)/staging_dir/$(TARGET_DIR_NAME) STAGING_DIR:=$(TOPDIR)/staging_dir/$(TARGET_DIR_NAME)