From aab2b702534827d49a84975ad586a8a0ca303004 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 12 Jun 2016 02:08:38 +0300 Subject: [PATCH] create tmp-*/readonly instead of usr/readonly Removing MXE directory with "rm -rf" used to fail on file usr/readonly/.gitkeep because directory usr/readonly was readonly. Now readonly directory is created in tmp-* directory and .gitkeep is not created for it (because tmp-* is not under usr/). Problems with removing MXE directory are fixed even in case of interrupted build. fix #1221 --- Makefile | 15 ++++++++------- src/mxe-conf.mk | 7 ------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index b3275a74..cd45f8c2 100644 --- a/Makefile +++ b/Makefile @@ -158,7 +158,7 @@ PRELOAD_VARS := LD_PRELOAD DYLD_FORCE_FLAT_NAMESPACE DYLD_INSERT_LIBRARIES # 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) +ENV_WHITELIST += MAKE% MXE% $(PRELOAD_VARS) WINEPREFIX # OS/Distro related issues - "unsafe" but practical # 1. https://github.com/mxe/mxe/issues/697 @@ -166,10 +166,6 @@ 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) -# see https://github.com/mxe/mxe/issues/841 -export WINEPREFIX=$(PREFIX)/readonly - SHORT_PKG_VERSION = \ $(word 1,$(subst ., ,$($(1)_VERSION))).$(word 2,$(subst ., ,$($(1)_VERSION))) @@ -494,7 +490,7 @@ $(PREFIX)/$(3)/installed/$(1): $(PKG_MAKEFILES) \ @$(PRINTF_FMT) '[message]' '$(1)' '$(3) $($(call LOOKUP_PKG_RULE,$(1),MESSAGE,$(3)))') @touch '$(LOG_DIR)/$(TIMESTAMP)/$(1)_$(3)' @ln -sf '$(TIMESTAMP)/$(1)_$(3)' '$(LOG_DIR)/$(1)_$(3)' - @if ! (time $(PRELOAD) $(MAKE) -f '$(MAKEFILE)' 'build-only-$(1)_$(3)' WGET=false) &> '$(LOG_DIR)/$(TIMESTAMP)/$(1)_$(3)'; then \ + @if ! (time $(PRELOAD) WINEPREFIX='$(2)/readonly' $(MAKE) -f '$(MAKEFILE)' 'build-only-$(1)_$(3)' WGET=false) &> '$(LOG_DIR)/$(TIMESTAMP)/$(1)_$(3)'; then \ echo; \ echo 'Failed to build package $(1) for target $(3)!'; \ echo '------------------------------------------------------------'; \ @@ -535,6 +531,12 @@ build-only-$(1)_$(3): perl --version 2>&1 | head -3 rm -rf '$(2)' mkdir -p '$(2)' + + # disable wine with readonly directory + # see https://github.com/mxe/mxe/issues/841 + mkdir -p '$(2)/readonly' + chmod 0555 '$(2)/readonly' + $$(if $(value $(call LOOKUP_PKG_RULE,$(1),FILE,$(3))),\ $$(call PREPARE_PKG_SOURCE,$(1),$(2))) $$(call $(call LOOKUP_PKG_RULE,$(1),BUILD,$(3)),$(2)/$($(1)_SUBDIR),$(TOP_DIR)/src/$(1)-test) @@ -634,7 +636,6 @@ BUILD_PKG_TMP_FILES := *-*.list mxe-*.tar.xz mxe-*.deb* wheezy jessie .PHONY: clean clean: - @[ -d "$$WINEPREFIX" ] && chmod 0755 "$$WINEPREFIX" || true rm -rf $(call TMP_DIR,*) $(PREFIX) \ $(addprefix $(TOP_DIR)/, $(BUILD_PKG_TMP_FILES)) diff --git a/src/mxe-conf.mk b/src/mxe-conf.mk index 45ba6a30..83a92b0f 100644 --- a/src/mxe-conf.mk +++ b/src/mxe-conf.mk @@ -107,13 +107,6 @@ define $(PKG)_BUILD_$(BUILD) cd '$(1)' && autoreconf -fiv cd '$(1)' && ./configure - #create readonly directory to force wine to fail - mkdir -p "$$WINEPREFIX" - [ -f "$$WINEPREFIX/.gitkeep" ] \ - || chmod 0755 "$$WINEPREFIX" \ - && touch "$$WINEPREFIX/.gitkeep" - chmod 0555 "$$WINEPREFIX" - #create script "wine" in a directory which is in PATH mkdir -p '$(PREFIX)/$(BUILD)/bin/' (echo '#!/usr/bin/env bash'; \