Makefile and mxe-conf: create basic non-empty directory hierarchy

https://github.com/mxe/mxe/pull/1061/files#r49049496
https://github.com/mxe/mxe/issues/1111#issuecomment-169280181
This commit is contained in:
Tony Theodore 2016-01-07 19:42:44 +11:00
parent 01dc8941ec
commit dfec326366
2 changed files with 22 additions and 13 deletions

View File

@ -329,10 +329,13 @@ define CHECK_REQUIREMENT_VERSION
fi fi
endef endef
$(shell [ -d '$(PREFIX)/installed' ] || mkdir -p '$(PREFIX)/installed')
%/.gitkeep:
+@mkdir -p '$(dir $@)'
@touch '$@'
check-requirements: $(PREFIX)/installed/check-requirements check-requirements: $(PREFIX)/installed/check-requirements
$(PREFIX)/installed/check-requirements: $(MAKEFILE) $(PREFIX)/installed/check-requirements: $(MAKEFILE) | $(PREFIX)/installed/.gitkeep
@echo '[check requirements]' @echo '[check requirements]'
$(foreach REQUIREMENT,$(REQUIREMENTS),$(call CHECK_REQUIREMENT,$(REQUIREMENT))) $(foreach REQUIREMENT,$(REQUIREMENTS),$(call CHECK_REQUIREMENT,$(REQUIREMENT)))
$(call CHECK_REQUIREMENT_VERSION,autoconf,2\.6[8-9]\|2\.[7-9][0-9]) $(call CHECK_REQUIREMENT_VERSION,autoconf,2\.6[8-9]\|2\.[7-9][0-9])
@ -349,7 +352,7 @@ $(PREFIX)/installed/check-requirements: $(MAKEFILE)
.PHONY: print-git-oneline .PHONY: print-git-oneline
print-git-oneline: $(PREFIX)/installed/print-git-oneline-$(GIT_HEAD) print-git-oneline: $(PREFIX)/installed/print-git-oneline-$(GIT_HEAD)
$(PREFIX)/installed/print-git-oneline-$(GIT_HEAD): $(PREFIX)/installed/print-git-oneline-$(GIT_HEAD): | $(PREFIX)/installed/.gitkeep
@git log --pretty=tformat:'[git-log] %h %s' -1 | cat @git log --pretty=tformat:'[git-log] %h %s' -1 | cat
@rm -f '$(PREFIX)/installed/print-git-oneline-'* @rm -f '$(PREFIX)/installed/print-git-oneline-'*
@touch '$@' @touch '$@'
@ -449,9 +452,7 @@ else
NONET_CFLAGS := -arch i386 -arch x86_64 NONET_CFLAGS := -arch i386 -arch x86_64
endif endif
$(shell [ -d '$(PREFIX)/$(BUILD)/lib' ] || mkdir -p '$(PREFIX)/$(BUILD)/lib') $(NONET_LIB): $(TOP_DIR)/tools/nonetwork.c | $(PREFIX)/$(BUILD)/lib/.gitkeep
$(NONET_LIB): $(TOP_DIR)/tools/nonetwork.c
@echo '[build nonetwork lib]' @echo '[build nonetwork lib]'
@$(BUILD_CC) -shared -fPIC $(NONET_CFLAGS) -o $@ $< @$(BUILD_CC) -shared -fPIC $(NONET_CFLAGS) -o $@ $<
@ -467,6 +468,7 @@ $(PREFIX)/$(3)/installed/$(1): $(PKG_MAKEFILES) \
$(if $(value $(call LOOKUP_PKG_RULE,$(1),URL,$(3))),download-only-$(1)) \ $(if $(value $(call LOOKUP_PKG_RULE,$(1),URL,$(3))),download-only-$(1)) \
$(addprefix $(PREFIX)/$(3)/installed/,$(if $(call set_is_not_member,$(1),$(MXE_CONF_PKGS)),$(MXE_CONF_PKGS))) \ $(addprefix $(PREFIX)/$(3)/installed/,$(if $(call set_is_not_member,$(1),$(MXE_CONF_PKGS)),$(MXE_CONF_PKGS))) \
$(NONET_LIB) \ $(NONET_LIB) \
$(PREFIX)/$(3)/installed/.gitkeep \
print-git-oneline print-git-oneline
@[ -d '$(LOG_DIR)/$(TIMESTAMP)' ] || mkdir -p '$(LOG_DIR)/$(TIMESTAMP)' @[ -d '$(LOG_DIR)/$(TIMESTAMP)' ] || mkdir -p '$(LOG_DIR)/$(TIMESTAMP)'
$(if $(value $(call LOOKUP_PKG_RULE,$(1),BUILD,$(3))), $(if $(value $(call LOOKUP_PKG_RULE,$(1),BUILD,$(3))),
@ -529,7 +531,6 @@ build-only-$(1)_$(3):
touch '$(PREFIX)/$(3)/installed/$(1)' touch '$(PREFIX)/$(3)/installed/$(1)'
endef endef
$(foreach TARGET,$(MXE_TARGETS), \ $(foreach TARGET,$(MXE_TARGETS), \
$(shell [ -d '$(PREFIX)/$(TARGET)/installed' ] || mkdir -p '$(PREFIX)/$(TARGET)/installed') \
$(foreach PKG,$($(TARGET)_PKGS), \ $(foreach PKG,$($(TARGET)_PKGS), \
$(eval $(call PKG_TARGET_RULE,$(PKG),$(call TMP_DIR,$(PKG)-$(TARGET)),$(TARGET))))) $(eval $(call PKG_TARGET_RULE,$(PKG),$(call TMP_DIR,$(PKG)-$(TARGET)),$(TARGET)))))
@ -615,6 +616,7 @@ BUILD_PKG_TMP_FILES := *-*.list mxe-*.tar.xz mxe-*.deb* wheezy jessie
.PHONY: clean .PHONY: clean
clean: clean:
-chmod 0755 "$$WINEPREFIX"
rm -rf $(call TMP_DIR,*) $(PREFIX) \ rm -rf $(call TMP_DIR,*) $(PREFIX) \
$(addprefix $(TOP_DIR)/, $(BUILD_PKG_TMP_FILES)) $(addprefix $(TOP_DIR)/, $(BUILD_PKG_TMP_FILES))

View File

@ -7,15 +7,20 @@ $(PKG)_UPDATE := echo 1
$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) $(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS)
define $(PKG)_BUILD define $(PKG)_BUILD
# create basic non-empty directory hierarchy
for d in bin include lib share; do \
mkdir -p "$(PREFIX)/$(TARGET)/$$d" && \
touch "$(PREFIX)/$(TARGET)/$$d/.gitkeep" ; \
done
# install target-specific autotools config file # install target-specific autotools config file
$(INSTALL) -d '$(PREFIX)/$(TARGET)/share'
# setting ac_cv_build bypasses the config.guess check in every package # setting ac_cv_build bypasses the config.guess check in every package
echo "ac_cv_build=$(BUILD)" > '$(PREFIX)/$(TARGET)/share/config.site' echo "ac_cv_build=$(BUILD)" > '$(PREFIX)/$(TARGET)/share/config.site'
# create the CMake toolchain file # create the CMake toolchain file
# individual packages (e.g. hdf5) should add their # individual packages (e.g. hdf5) should add their
# own files under CMAKE_TOOLCHAIN_DIR # own files under CMAKE_TOOLCHAIN_DIR
[ -d '$(CMAKE_TOOLCHAIN_DIR)' ] || mkdir -p '$(CMAKE_TOOLCHAIN_DIR)' mkdir -p '$(CMAKE_TOOLCHAIN_DIR)'
touch '$(CMAKE_TOOLCHAIN_DIR)/.gitkeep' touch '$(CMAKE_TOOLCHAIN_DIR)/.gitkeep'
(echo 'set(CMAKE_SYSTEM_NAME Windows)'; \ (echo 'set(CMAKE_SYSTEM_NAME Windows)'; \
echo 'set(MSYS 1)'; \ echo 'set(MSYS 1)'; \
@ -67,7 +72,7 @@ define $(PKG)_BUILD
chmod 0755 '$(PREFIX)/bin/$(TARGET)-cmake' chmod 0755 '$(PREFIX)/bin/$(TARGET)-cmake'
# create pkg-config files for OpenGL/GLU # create pkg-config files for OpenGL/GLU
$(INSTALL) -d '$(PREFIX)/$(TARGET)/lib/pkgconfig' mkdir -p '$(PREFIX)/$(TARGET)/lib/pkgconfig'
(echo 'Name: gl'; \ (echo 'Name: gl'; \
echo 'Version: 0'; \ echo 'Version: 0'; \
echo 'Description: OpenGL'; \ echo 'Description: OpenGL'; \
@ -83,11 +88,11 @@ endef
define $(PKG)_BUILD_$(BUILD) define $(PKG)_BUILD_$(BUILD)
# install config.guess for general use # install config.guess for general use
$(INSTALL) -d '$(PREFIX)/bin' mkdir -p '$(PREFIX)/bin'
$(INSTALL) -m755 '$(EXT_DIR)/config.guess' '$(PREFIX)/bin/' $(INSTALL) -m755 '$(EXT_DIR)/config.guess' '$(PREFIX)/bin/'
# install cmake modules # install cmake modules
$(INSTALL) -d '$(PREFIX)/share/cmake/modules' mkdir -p '$(PREFIX)/share/cmake/modules'
$(INSTALL) -m644 '$(PWD)/src/cmake/modules/'* '$(PREFIX)/share/cmake/modules' $(INSTALL) -m644 '$(PWD)/src/cmake/modules/'* '$(PREFIX)/share/cmake/modules'
# fail early if autotools can't autoreconf # fail early if autotools can't autoreconf
@ -103,7 +108,9 @@ define $(PKG)_BUILD_$(BUILD)
cd '$(1)' && ./configure cd '$(1)' && ./configure
#create readonly directory to force wine to fail #create readonly directory to force wine to fail
$(INSTALL) -m444 -d "$$WINEPREFIX" mkdir -p "$$WINEPREFIX"
touch "$$WINEPREFIX/.gitkeep"
chmod 0555 "$$WINEPREFIX"
#create script "wine" in a directory which is in PATH #create script "wine" in a directory which is in PATH
mkdir -p '$(PREFIX)/$(BUILD)/bin/' mkdir -p '$(PREFIX)/$(BUILD)/bin/'