From 87163ff7be3c7a7e86a850e688012f3e52baf038 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Mon, 11 Apr 2016 03:30:08 +0300 Subject: [PATCH 1/3] add "make shell" command It provides interactive shell with the environment of MXE build. --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 3e0ed04f..81a6fdad 100644 --- a/Makefile +++ b/Makefile @@ -460,6 +460,10 @@ $(NONET_LIB): $(TOP_DIR)/tools/nonetwork.c | $(PREFIX)/$(BUILD)/lib/.gitkeep @echo '[build nonetwork lib]' @$(BUILD_CC) -shared -fPIC $(NONET_CFLAGS) -o $@ $< +.PHONY: shell +shell: + $(PRELOAD) $(SHELL) + define PKG_TARGET_RULE .PHONY: $(1) $(1): $(PREFIX)/$(3)/installed/$(1) From 632085f2f7d7aa9ae525a72f41ffae281a0ca760 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Mon, 11 Apr 2016 21:04:18 +1000 Subject: [PATCH 2/3] add `nonetwork` lib to `shell` target dependencies --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 81a6fdad..edec8adc 100644 --- a/Makefile +++ b/Makefile @@ -461,7 +461,7 @@ $(NONET_LIB): $(TOP_DIR)/tools/nonetwork.c | $(PREFIX)/$(BUILD)/lib/.gitkeep @$(BUILD_CC) -shared -fPIC $(NONET_CFLAGS) -o $@ $< .PHONY: shell -shell: +shell: $(NONET_LIB) $(PRELOAD) $(SHELL) define PKG_TARGET_RULE From 580828183a8c888f3e5454a2171faf292d998ff4 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Mon, 11 Apr 2016 21:06:46 +1000 Subject: [PATCH 3/3] clarify rationale for env whitelist entries * add EDITOR, PS1, TERM for basic functionality of interactive shells * separate mxe related variables * identify source of ACLOCAL_PATH and LD_LIBRARY_PATH --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index edec8adc..3f846bf8 100644 --- a/Makefile +++ b/Makefile @@ -155,8 +155,15 @@ endef PRELOAD_VARS := LD_PRELOAD DYLD_FORCE_FLAT_NAMESPACE DYLD_INSERT_LIBRARIES # use a minimal whitelist of safe environment variables -# HOME is needed for ~/.gitconfig for patch-tool-mxe -ENV_WHITELIST := PATH HOME LANG MAKE% MXE% %PROXY %proxy LD_LIBRARY_PATH $(PRELOAD_VARS) ACLOCAL_PATH +# basic working shell environment and mxe variables +# see http://www.linuxfromscratch.org/lfs/view/stable/chapter04/settingenvironment.html +ENV_WHITELIST := EDITOR HOME LANG PATH %PROXY %proxy PS1 TERM +ENV_WHITELIST += MAKE% MXE% $(PRELOAD_VARS) + +# OS/Distro related issues - "unsafe" but practical +# 1. https://github.com/mxe/mxe/issues/697 +ENV_WHITELIST += ACLOCAL_PATH LD_LIBRARY_PATH + unexport $(filter-out $(ENV_WHITELIST),$(shell env | cut -d '=' -f1)) # disable wine with readonly directory (created by mxe-conf)