summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar_port_compiler.erl9
-rw-r--r--src/rebar_utils.erl18
2 files changed, 12 insertions, 15 deletions
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index ad1e387..3154738 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -398,14 +398,7 @@ default_env() ->
{"DRV_LDFLAGS", "-shared $ERL_LDFLAGS"},
{"darwin", "DRV_LDFLAGS",
"-bundle -flat_namespace -undefined suppress $ERL_LDFLAGS"},
- {"ERLANG_ARCH",
- try erlang:system_info({wordsize, external}) of
- Val ->
- integer_to_list(8 * Val)
- catch
- error:badarg ->
- integer_to_list(8 * erlang:system_info(wordsize))
- end},
+ {"ERLANG_ARCH", rebar_utils:wordsize()},
{"ERLANG_TARGET", rebar_utils:get_arch()},
%% Solaris specific flags
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 68ca0dc..ebf6656 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -29,6 +29,7 @@
-export([get_cwd/0,
is_arch/1,
get_arch/0,
+ wordsize/0,
sh/2,
find_files/2,
now_str/0,
@@ -62,16 +63,19 @@ is_arch(ArchRegex) ->
end.
get_arch() ->
- Words = try erlang:system_info({wordsize, external}) of
- Val ->
- integer_to_list(8 * Val)
- catch
- error:badarg ->
- integer_to_list(8 * erlang:system_info(wordsize))
- end,
+ Words = wordsize(),
erlang:system_info(otp_release) ++ "-"
++ erlang:system_info(system_architecture) ++ "-" ++ Words.
+wordsize() ->
+ try erlang:system_info({wordsize, external}) of
+ Val ->
+ integer_to_list(8 * Val)
+ catch
+ error:badarg ->
+ integer_to_list(8 * erlang:system_info(wordsize))
+ end.
+
%%
%% Options = [Option] -- defaults to [use_stdout, abort_on_error]
%% Option = ErrorOption | OutputOption | {cd, string()} | {env, Env}