mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 11:06:20 +00:00
Extract code to get wordsize into helper function
This commit is contained in:
parent
0bbb2985f0
commit
70137292e1
2 changed files with 12 additions and 15 deletions
|
@ -398,14 +398,7 @@ default_env() ->
|
||||||
{"DRV_LDFLAGS", "-shared $ERL_LDFLAGS"},
|
{"DRV_LDFLAGS", "-shared $ERL_LDFLAGS"},
|
||||||
{"darwin", "DRV_LDFLAGS",
|
{"darwin", "DRV_LDFLAGS",
|
||||||
"-bundle -flat_namespace -undefined suppress $ERL_LDFLAGS"},
|
"-bundle -flat_namespace -undefined suppress $ERL_LDFLAGS"},
|
||||||
{"ERLANG_ARCH",
|
{"ERLANG_ARCH", rebar_utils: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},
|
|
||||||
{"ERLANG_TARGET", rebar_utils:get_arch()},
|
{"ERLANG_TARGET", rebar_utils:get_arch()},
|
||||||
|
|
||||||
%% Solaris specific flags
|
%% Solaris specific flags
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
-export([get_cwd/0,
|
-export([get_cwd/0,
|
||||||
is_arch/1,
|
is_arch/1,
|
||||||
get_arch/0,
|
get_arch/0,
|
||||||
|
wordsize/0,
|
||||||
sh/2,
|
sh/2,
|
||||||
find_files/2,
|
find_files/2,
|
||||||
now_str/0,
|
now_str/0,
|
||||||
|
@ -62,15 +63,18 @@ is_arch(ArchRegex) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_arch() ->
|
get_arch() ->
|
||||||
Words = try erlang:system_info({wordsize, external}) of
|
Words = wordsize(),
|
||||||
|
erlang:system_info(otp_release) ++ "-"
|
||||||
|
++ erlang:system_info(system_architecture) ++ "-" ++ Words.
|
||||||
|
|
||||||
|
wordsize() ->
|
||||||
|
try erlang:system_info({wordsize, external}) of
|
||||||
Val ->
|
Val ->
|
||||||
integer_to_list(8 * Val)
|
integer_to_list(8 * Val)
|
||||||
catch
|
catch
|
||||||
error:badarg ->
|
error:badarg ->
|
||||||
integer_to_list(8 * erlang:system_info(wordsize))
|
integer_to_list(8 * erlang:system_info(wordsize))
|
||||||
end,
|
end.
|
||||||
erlang:system_info(otp_release) ++ "-"
|
|
||||||
++ erlang:system_info(system_architecture) ++ "-" ++ Words.
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%% Options = [Option] -- defaults to [use_stdout, abort_on_error]
|
%% Options = [Option] -- defaults to [use_stdout, abort_on_error]
|
||||||
|
|
Loading…
Reference in a new issue