aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Rascão <[email protected]>2017-10-18 22:51:21 +0100
committerGitHub <[email protected]>2017-10-18 22:51:21 +0100
commit5050dd81853923e904080de1da56e049f24459e3 (patch)
treee3815304e08426e36ad0fef2ce01620ea84b10eb
parent6ab1c19b1c7f3baab66fc69a4f17c833c736ecd9 (diff)
parentf80731ef6c9250f34dd1084c521495ea02dcf4f3 (diff)
downloadrelx-5050dd81853923e904080de1da56e049f24459e3.tar.gz
relx-5050dd81853923e904080de1da56e049f24459e3.tar.bz2
relx-5050dd81853923e904080de1da56e049f24459e3.zip
Merge pull request #540 from obi458/master
win32 cross release on unix and vs
-rw-r--r--src/rlx_prv_assembler.erl4
-rw-r--r--src/rlx_util.erl27
2 files changed, 29 insertions, 2 deletions
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index 475869c..2088de6 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -379,7 +379,7 @@ write_bin_file(State, Release, OutputDir, RelDir) ->
VsnRel = filename:join(BinDir, rlx_release:canonical_name(Release)),
BareRel = filename:join(BinDir, RelName),
ErlOpts = rlx_state:get(State, erl_opts, ""),
- {OsFamily, _OsName} = os:type(),
+ {OsFamily, _OsName} = rlx_util:os_type(State),
StartFile = case rlx_state:get(State, extended_start_script, false) of
false ->
@@ -623,7 +623,7 @@ include_erts(State, Release, OutputDir, RelDir) ->
ErtsVersion = rlx_release:erts(Release),
ErtsDir = filename:join([Prefix, "erts-" ++ ErtsVersion]),
LocalErts = filename:join([OutputDir, "erts-" ++ ErtsVersion]),
- {OsFamily, _OsName} = os:type(),
+ {OsFamily, _OsName} = rlx_util:os_type(State),
case ec_file:is_dir(ErtsDir) of
false ->
?RLX_ERROR({specified_erts_does_not_exist, ErtsVersion});
diff --git a/src/rlx_util.erl b/src/rlx_util.erl
index efad792..b3fc2b7 100644
--- a/src/rlx_util.erl
+++ b/src/rlx_util.erl
@@ -41,6 +41,8 @@
intensity/0,
symlink_or_copy/2]).
+-export([os_type/1]).
+
-define(DFLT_INTENSITY, high).
-define(ONE_LEVEL_INDENT, " ").
%%============================================================================
@@ -326,6 +328,31 @@ intensity() ->
Mode
end.
+os_type(State) ->
+ case include_erts_is_win32(State) of
+ true -> {win32,nt};
+ false -> os:type()
+ end.
+
+include_erts_is_win32(State) ->
+ case rlx_state:get(State, include_erts, true) of
+ true -> false;
+ false -> false;
+ Path -> is_win32_erts(Path,State)
+ end.
+
+is_win32_erts(Path,State) ->
+ case filelib:wildcard(filename:join([Path,"bin","erl.exe"])) of
+ [] -> false;
+ _ ->
+ ec_cmd_log:info(rlx_state:log(State),
+ "Including Erts is win32 ~n", []),
+ true
+ end.
+
+
+
+
%%%===================================================================
%%% Test Functions
%%%===================================================================