kumquat-buildroot/package/environment-setup/environment-setup.mk
Mircea GLIGA d0ed2725e9 package/environment-setup: Fix incorrect order of the sed expressions
Order of the `sed` expressions is important; when this was commited
to master, the order of the expressions from the original patch [1] was
changed, rendering the second expression to noop.

This made all the environment variables from the script to contain
absolute paths: long absolute paths makes verbose builds difficult
to read/follow.
We can take advantage of the fact that the PATH is updated and we
don't have to use absolute paths.

Fixed by reordering the `sed` expresions:
* first update the path of the binaries: e.g. 's%$(HOST_DIR)/bin/%%g'
* only then update remaining paths: e.g. 's%$(HOST_DIR)%\$$SDK_PATH%g'

[1] https://patchwork.ozlabs.org/project/buildroot/patch/20201027140140.47982-1-matthew.weber@rockwellcollins.com/

Signed-off-by: Mircea GLIGA <mgliga@bitdefender.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-05-18 22:22:29 +02:00

42 lines
1.5 KiB
Makefile

################################################################################
#
# environment-setup
#
################################################################################
ENVIRONMENT_SETUP_FILE = $(HOST_DIR)/environment-setup
define HOST_ENVIRONMENT_SETUP_INSTALL_CMDS
cp package/environment-setup/environment-setup $(ENVIRONMENT_SETUP_FILE)
for var in $(TARGET_CONFIGURE_OPTS); do \
printf "export \"$$var\"\n" >> $(ENVIRONMENT_SETUP_FILE); \
done
printf "export \"ARCH=$(KERNEL_ARCH)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
printf "export \"CROSS_COMPILE=$(TARGET_CROSS)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
printf "export \"CONFIGURE_FLAGS=--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \
--prefix=/usr \
--exec-prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--program-prefix=\"\n" >> $(ENVIRONMENT_SETUP_FILE)
printf "alias configure=\"./configure \$${CONFIGURE_FLAGS}\"\n" \
>> $(ENVIRONMENT_SETUP_FILE)
printf "alias cmake=\"cmake \
-DCMAKE_TOOLCHAIN_FILE=$(HOST_DIR)/share/buildroot/toolchainfile.cmake \
-DCMAKE_INSTALL_PREFIX=/usr\"\n" >> $(ENVIRONMENT_SETUP_FILE)
$(SED) 's%$(HOST_DIR)/bin/%%g' \
-e 's%$(HOST_DIR)%\$$SDK_PATH%g' \
-e '/^export "PATH=/c\' \
$(ENVIRONMENT_SETUP_FILE)
printf "export \"PATH=\$$SDK_PATH/bin:\$$SDK_PATH/sbin:\$$PATH\"\n" \
>> $(ENVIRONMENT_SETUP_FILE)
$(if $(BR2_LINUX_KERNEL),\
printf "export \"KERNELDIR=$(LINUX_BUILDDIR)\"\n" \
>> $(ENVIRONMENT_SETUP_FILE),)
endef
$(eval $(host-generic-package))