kumquat-buildroot/package/environment-setup/environment-setup.mk
Peter Korsgaard 48874afb9d package/environment-setup: do not export GIT_DIR
Commit c07aafa087 (package/Makefile.in: set GIT_DIR=.  in {HOST,
TARGET}_MAKE_ENV) added GIT_DIR=.  to TARGET_MAKE_ENV (which is included in
TARGET_CONFIGURE_OPTS) to work around issues with packages getting confused
when building in a subdir of the Buildroot git repo.

This unfortunately also causes git commands to fail when
output/host/environment-setup is sourced:

git status
fatal: not a git repository: '.'

So strip GIT_DIR= from TARGET_CONFIGURE_OPTS when generating
environment-setup.

Reported-by: Mircea Gliga <gliga.mircea@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-01-27 21:07:46 +01: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 $(filter-out GIT_DIR=%,$(TARGET_CONFIGURE_OPTS)); do \
printf "export \"$$var\"\n" >> $(ENVIRONMENT_SETUP_FILE); \
done
printf "export \"ARCH=$(NORMALIZED_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))