Просмотр исходного кода

Make relx work on Windows/MSYS2

Loïc Hoguin 9 лет назад
Родитель
Сommit
4f59af14f2
4 измененных файлов с 27 добавлено и 4 удалено
  1. 7 1
      core/core.mk
  2. 1 3
      plugins/relx.mk
  3. 8 0
      test/Makefile
  4. 11 0
      test/plugin_bootstrap.mk

+ 7 - 1
core/core.mk

@@ -141,6 +141,12 @@ define erlang
 $(ERL) $(2) -pz $(ERLANG_MK_TMP)/rebar/ebin -eval "$(subst $(newline),,$(subst ",\",$(1)))" -- erlang.mk
 endef
 
+ifeq ($(PLATFORM),msys2)
+core_native_path = $(subst \,\\\\,$(shell cygpath -w $1))
+else
+core_native_path = $1
+endif
+
 ifeq ($(shell which wget 2>/dev/null | wc -l), 1)
 define core_http_get
 	wget --no-check-certificate -O $(1) $(2)|| rm $(1)
@@ -162,7 +168,7 @@ define core_http_get.erl
 endef
 
 define core_http_get
-	$(call erlang,$(call core_http_get.erl,$(1),$(2)))
+	$(call erlang,$(call core_http_get.erl,$(call core_native_path,$1),$2))
 endef
 endif
 

+ 1 - 3
plugins/relx.mk

@@ -5,10 +5,8 @@
 
 # Configuration.
 
-RELX_CONFIG ?= $(CURDIR)/relx.config
-
 RELX ?= $(CURDIR)/relx
-export RELX
+RELX_CONFIG ?= $(CURDIR)/relx.config
 
 RELX_URL ?= https://github.com/erlware/relx/releases/download/v2.0.0/relx
 RELX_OPTS ?=

+ 8 - 0
test/Makefile

@@ -11,6 +11,14 @@ APP_TO_CLEAN = $(subst -,_,$(patsubst clean-%,%,$@))
 
 ERL = erl +A0 -noinput -boot start_clean
 
+# Platform, condensed version.
+
+ifeq ($(shell uname -o),Msys)
+	PLATFORM = msys2
+else
+	PLATFORM = unix
+endif
+
 # OTP master, for downloading files for testing.
 
 OTP_MASTER = https://raw.githubusercontent.com/erlang/otp/master

+ 11 - 0
test/plugin_bootstrap.mk

@@ -90,11 +90,22 @@ bootstrap-rel: build clean-bootstrap-rel
 	$t test -f $(APP)/ebin/$(APP)_sup.beam
 
 	$i "Check that the release was generated"
+ifeq ($(PLATFORM),msys2)
+	$t test -f $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd
+else
 	$t test -f $(APP)/_rel/$(APP)_release/bin/$(APP)_release
+endif
 
 	$i "Check that the release can be started and stopped"
+ifeq ($(PLATFORM),msys2)
+	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
+	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
+	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
+	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
+else
 	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
 	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
+endif
 
 	$i "Check that there's no erl_crash.dump file"
 	$t test ! -f $(APP)/_rel/$(APP)_release/erl_crash.dump