25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Call earlier deps configure scripts durring compilation

This commit is contained in:
Paweł Chmielowski 2017-09-26 17:32:37 +02:00
parent 2198fbce97
commit 05feab35c4
3 changed files with 39 additions and 8 deletions

32
plugins/override_opts.erl Normal file
View 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, []}.

View File

@ -107,7 +107,7 @@
{if_rebar3, {plugins, [rebar3_hex, {provider_asn1, "0.2.0"}]}}.
{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_exunit}
]}}.
@ -163,7 +163,6 @@
{port_env, [{"CFLAGS", "-g -O2 -Wall"}]}.
{port_specs, [{"priv/lib/jid.so", ["c_src/jid.c"]}]}.
%% Local Variables:
%% mode: erlang
%% End:

View File

@ -255,9 +255,9 @@ CtParams = fun(CompileOpts) ->
GenDepConfigureLine =
fun(DepPath, Flags) ->
["sh -c 'if test ! -f ",DepPath,"config.status -o ",
"config.status -nt ",DepPath,"config.status; ",
"then (cd ", DepPath, " && ",
["sh -c 'if test ! -f config.status -o ",
"../../config.status -nt config.status; ",
"then (",
"CFLAGS=\"", CFlags,"\" ",
"CPPFLAGS=\"", CPPFlags, "\" "
"LDFLAGS=\"", LDFlags, "\"",
@ -269,8 +269,8 @@ GenDepsConfigure =
fun(Hooks) ->
lists:map(fun({Pkg, Flags}) ->
DepPath = ResolveDepPath("deps/" ++ Pkg ++ "/"),
{'compile',
lists:flatten(GenDepConfigureLine(DepPath, Flags))}
{add, list_to_atom(Pkg), [{pre_hooks, {'compile',
lists:flatten(GenDepConfigureLine(DepPath, Flags))}}]}
end, Hooks)
end,
@ -326,7 +326,7 @@ Rules = [
AppendList([{coveralls, ".*", {git, "https://github.com/markusn/coveralls-erl.git", "master"}}]), []},
{[post_hooks], [cover_enabled], os:getenv("TRAVIS") == "true",
AppendList2(TravisPostHooks), [], false},
{[pre_hooks], [post_hook_configure], true,
{[overrides], [post_hook_configure], true,
AppendList2(GenDepsConfigure), [], []},
{[ct_extra_params], [eunit_compile_opts], true,
AppendStr2(CtParams), "", []},