mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Call earlier deps configure scripts durring compilation
This commit is contained in:
parent
2198fbce97
commit
05feab35c4
32
plugins/override_opts.erl
Normal file
32
plugins/override_opts.erl
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
-module(override_opts).
|
||||||
|
-export([preprocess/2]).
|
||||||
|
|
||||||
|
override_opts(override, Config, Opts) ->
|
||||||
|
lists:foldl(fun({Opt, Value}, Conf) ->
|
||||||
|
rebar_config:set(Conf, Opt, Value)
|
||||||
|
end, Config, Opts);
|
||||||
|
override_opts(add, Config, Opts) ->
|
||||||
|
lists:foldl(fun({Opt, Value}, Conf) ->
|
||||||
|
V = rebar_config:get_local(Conf, Opt, []),
|
||||||
|
rebar_config:set(Conf, Opt, [Value | V])
|
||||||
|
end, Config, Opts).
|
||||||
|
|
||||||
|
preprocess(Config, _Dirs) ->
|
||||||
|
Overrides = rebar_config:get_local(Config, overrides, []),
|
||||||
|
TopOverrides = case rebar_config:get_xconf(Config, top_overrides, []) of
|
||||||
|
[] -> Overrides;
|
||||||
|
Val -> Val
|
||||||
|
end,
|
||||||
|
Config2 = rebar_config:set_xconf(Config, top_overrides, TopOverrides),
|
||||||
|
Config3 = case rebar_app_utils:load_app_file(Config2, _Dirs) of
|
||||||
|
{ok, C, AppName, _AppData} ->
|
||||||
|
lists:foldl(fun({Type, AppName2, Opts}, Conf1) when
|
||||||
|
AppName2 == AppName ->
|
||||||
|
override_opts(Type, Conf1, Opts);
|
||||||
|
(_, Conf2) ->
|
||||||
|
Conf2
|
||||||
|
end, C, TopOverrides);
|
||||||
|
_ ->
|
||||||
|
Config2
|
||||||
|
end,
|
||||||
|
{ok, Config3, []}.
|
@ -107,7 +107,7 @@
|
|||||||
|
|
||||||
{if_rebar3, {plugins, [rebar3_hex, {provider_asn1, "0.2.0"}]}}.
|
{if_rebar3, {plugins, [rebar3_hex, {provider_asn1, "0.2.0"}]}}.
|
||||||
{if_not_rebar3, {plugins, [
|
{if_not_rebar3, {plugins, [
|
||||||
deps_erl_opts, override_deps_versions,
|
deps_erl_opts, override_deps_versions, override_opts,
|
||||||
{if_var_true, elixir, rebar_elixir_compiler},
|
{if_var_true, elixir, rebar_elixir_compiler},
|
||||||
{if_var_true, elixir, rebar_exunit}
|
{if_var_true, elixir, rebar_exunit}
|
||||||
]}}.
|
]}}.
|
||||||
@ -163,7 +163,6 @@
|
|||||||
{port_env, [{"CFLAGS", "-g -O2 -Wall"}]}.
|
{port_env, [{"CFLAGS", "-g -O2 -Wall"}]}.
|
||||||
|
|
||||||
{port_specs, [{"priv/lib/jid.so", ["c_src/jid.c"]}]}.
|
{port_specs, [{"priv/lib/jid.so", ["c_src/jid.c"]}]}.
|
||||||
|
|
||||||
%% Local Variables:
|
%% Local Variables:
|
||||||
%% mode: erlang
|
%% mode: erlang
|
||||||
%% End:
|
%% End:
|
||||||
|
@ -255,9 +255,9 @@ CtParams = fun(CompileOpts) ->
|
|||||||
|
|
||||||
GenDepConfigureLine =
|
GenDepConfigureLine =
|
||||||
fun(DepPath, Flags) ->
|
fun(DepPath, Flags) ->
|
||||||
["sh -c 'if test ! -f ",DepPath,"config.status -o ",
|
["sh -c 'if test ! -f config.status -o ",
|
||||||
"config.status -nt ",DepPath,"config.status; ",
|
"../../config.status -nt config.status; ",
|
||||||
"then (cd ", DepPath, " && ",
|
"then (",
|
||||||
"CFLAGS=\"", CFlags,"\" ",
|
"CFLAGS=\"", CFlags,"\" ",
|
||||||
"CPPFLAGS=\"", CPPFlags, "\" "
|
"CPPFLAGS=\"", CPPFlags, "\" "
|
||||||
"LDFLAGS=\"", LDFlags, "\"",
|
"LDFLAGS=\"", LDFlags, "\"",
|
||||||
@ -269,8 +269,8 @@ GenDepsConfigure =
|
|||||||
fun(Hooks) ->
|
fun(Hooks) ->
|
||||||
lists:map(fun({Pkg, Flags}) ->
|
lists:map(fun({Pkg, Flags}) ->
|
||||||
DepPath = ResolveDepPath("deps/" ++ Pkg ++ "/"),
|
DepPath = ResolveDepPath("deps/" ++ Pkg ++ "/"),
|
||||||
{'compile',
|
{add, list_to_atom(Pkg), [{pre_hooks, {'compile',
|
||||||
lists:flatten(GenDepConfigureLine(DepPath, Flags))}
|
lists:flatten(GenDepConfigureLine(DepPath, Flags))}}]}
|
||||||
end, Hooks)
|
end, Hooks)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ Rules = [
|
|||||||
AppendList([{coveralls, ".*", {git, "https://github.com/markusn/coveralls-erl.git", "master"}}]), []},
|
AppendList([{coveralls, ".*", {git, "https://github.com/markusn/coveralls-erl.git", "master"}}]), []},
|
||||||
{[post_hooks], [cover_enabled], os:getenv("TRAVIS") == "true",
|
{[post_hooks], [cover_enabled], os:getenv("TRAVIS") == "true",
|
||||||
AppendList2(TravisPostHooks), [], false},
|
AppendList2(TravisPostHooks), [], false},
|
||||||
{[pre_hooks], [post_hook_configure], true,
|
{[overrides], [post_hook_configure], true,
|
||||||
AppendList2(GenDepsConfigure), [], []},
|
AppendList2(GenDepsConfigure), [], []},
|
||||||
{[ct_extra_params], [eunit_compile_opts], true,
|
{[ct_extra_params], [eunit_compile_opts], true,
|
||||||
AppendStr2(CtParams), "", []},
|
AppendStr2(CtParams), "", []},
|
||||||
|
Loading…
Reference in New Issue
Block a user