2013-04-08 11:12:54 +02:00
|
|
|
%%%-------------------------------------------------------------------
|
|
|
|
%%% @author Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
|
|
|
%%% @copyright (C) 2013, Evgeniy Khramtsov
|
|
|
|
%%% @doc
|
|
|
|
%%%
|
|
|
|
%%% @end
|
|
|
|
%%% Created : 1 May 2013 by Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
|
|
|
%%%-------------------------------------------------------------------
|
2015-03-23 14:54:29 +01:00
|
|
|
|
|
|
|
{require_min_otp_vsn, "16"}.
|
|
|
|
|
2013-04-08 11:12:54 +02:00
|
|
|
Cfg = case file:consult("vars.config") of
|
|
|
|
{ok, Terms} ->
|
|
|
|
Terms;
|
|
|
|
_Err ->
|
|
|
|
[]
|
|
|
|
end,
|
|
|
|
|
|
|
|
Macros = lists:flatmap(
|
|
|
|
fun({roster_gateway_workaround, true}) ->
|
|
|
|
[{d, 'ROSTER_GATEWAY_WORKAROUND'}];
|
2014-02-21 23:34:48 +01:00
|
|
|
({transient_supervisors, false}) ->
|
2013-04-08 11:12:54 +02:00
|
|
|
[{d, 'NO_TRANSIENT_SUPERVISORS'}];
|
|
|
|
({nif, true}) ->
|
|
|
|
[{d, 'NIF'}];
|
|
|
|
({db_type, mssql}) ->
|
|
|
|
[{d, 'mssql'}];
|
|
|
|
({lager, true}) ->
|
|
|
|
[{d, 'LAGER'}];
|
2015-02-11 12:08:16 +01:00
|
|
|
({erlang_deprecated_types, true}) ->
|
|
|
|
[{d, 'ERL_DEPRECATED_TYPES'}];
|
2013-04-08 11:12:54 +02:00
|
|
|
(_) ->
|
|
|
|
[]
|
|
|
|
end, Cfg),
|
|
|
|
|
|
|
|
DebugInfo = case lists:keysearch(debug, 1, Cfg) of
|
|
|
|
{value, {debug, true}} ->
|
2013-07-13 21:33:50 +02:00
|
|
|
[];
|
2013-04-08 11:12:54 +02:00
|
|
|
_ ->
|
2013-07-13 21:33:50 +02:00
|
|
|
[no_debug_info]
|
2013-04-08 11:12:54 +02:00
|
|
|
end,
|
|
|
|
|
|
|
|
HiPE = case lists:keysearch(hipe, 1, Cfg) of
|
|
|
|
{value, {hipe, true}} ->
|
|
|
|
[native];
|
|
|
|
_ ->
|
|
|
|
[]
|
|
|
|
end,
|
|
|
|
|
|
|
|
SrcDirs = lists:foldl(
|
|
|
|
fun({tools, true}, Acc) ->
|
|
|
|
[tools|Acc];
|
|
|
|
(_, Acc) ->
|
|
|
|
Acc
|
|
|
|
end, [], Cfg),
|
|
|
|
|
2015-06-04 13:12:49 +02:00
|
|
|
Deps = [{p1_cache_tab, ".*", {git, "https://github.com/processone/cache_tab"}},
|
|
|
|
{p1_tls, ".*", {git, "https://github.com/processone/tls"}},
|
|
|
|
{p1_stringprep, ".*", {git, "https://github.com/processone/stringprep"}},
|
|
|
|
{p1_xml, ".*", {git, "https://github.com/processone/xml"}},
|
|
|
|
{esip, ".*", {git, "https://github.com/processone/p1_sip"}},
|
|
|
|
{p1_stun, ".*", {git, "https://github.com/processone/stun"}},
|
|
|
|
{p1_yaml, ".*", {git, "https://github.com/processone/p1_yaml"}},
|
|
|
|
{p1_utils, ".*", {git, "https://github.com/processone/p1_utils"}}],
|
2013-04-08 11:12:54 +02:00
|
|
|
|
|
|
|
ConfigureCmd = fun(Pkg, Flags) ->
|
|
|
|
{'get-deps',
|
|
|
|
"sh -c 'cd deps/" ++ Pkg ++
|
|
|
|
" && ./configure" ++ Flags ++ "'"}
|
|
|
|
end,
|
|
|
|
|
|
|
|
XMLFlags = lists:foldl(
|
|
|
|
fun({nif, true}, Acc) ->
|
|
|
|
Acc ++ " --enable-nif";
|
|
|
|
({full_xml, true}, Acc) ->
|
|
|
|
Acc ++ " --enable-full-xml";
|
|
|
|
(_, Acc) ->
|
|
|
|
Acc
|
|
|
|
end, "", Cfg),
|
|
|
|
|
|
|
|
PostHooks = [ConfigureCmd("p1_tls", ""),
|
|
|
|
ConfigureCmd("p1_stringprep", ""),
|
2013-10-22 12:12:12 +02:00
|
|
|
ConfigureCmd("p1_yaml", ""),
|
2014-05-02 15:27:46 +02:00
|
|
|
ConfigureCmd("esip", ""),
|
2013-04-08 11:12:54 +02:00
|
|
|
ConfigureCmd("p1_xml", XMLFlags)],
|
|
|
|
|
|
|
|
CfgDeps = lists:flatmap(
|
|
|
|
fun({mysql, true}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{p1_mysql, ".*", {git, "https://github.com/processone/mysql"}}];
|
2013-04-08 11:12:54 +02:00
|
|
|
({pgsql, true}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{p1_pgsql, ".*", {git, "https://github.com/processone/pgsql"}}];
|
2015-03-16 19:53:19 +01:00
|
|
|
({sqlite, true}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{sqlite3, ".*", {git, "https://github.com/alexeyr/erlang-sqlite3"}}];
|
2013-04-08 11:12:54 +02:00
|
|
|
({pam, true}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{p1_pam, ".*", {git, "https://github.com/processone/epam"}}];
|
2013-04-08 11:12:54 +02:00
|
|
|
({zlib, true}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{p1_zlib, ".*", {git, "https://github.com/processone/zlib"}}];
|
2014-07-09 14:40:06 +02:00
|
|
|
({riak, true}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{riakc, ".*", {git, "https://github.com/basho/riak-erlang-client", {tag, "1.4.2"}}}];
|
2013-04-08 11:12:54 +02:00
|
|
|
({json, true}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{jiffy, ".*", {git, "https://github.com/davisp/jiffy"}}];
|
2015-01-29 18:43:47 +01:00
|
|
|
({elixir, true}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{rebar_elixir_plugin, ".*", {git, "https://github.com/yrashk/rebar_elixir_plugin"}},
|
|
|
|
{elixir, ".*", {git, "https://github.com/elixir-lang/elixir", {branch, "v1.0"}}}];
|
2013-04-08 11:12:54 +02:00
|
|
|
({iconv, true}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{p1_iconv, ".*", {git, "https://github.com/processone/eiconv"}}];
|
2013-04-08 11:12:54 +02:00
|
|
|
({lager, true}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{lager, ".*", {git, "https://github.com/basho/lager"}}];
|
2013-07-06 19:10:35 +02:00
|
|
|
({lager, false}) ->
|
2015-06-04 13:12:49 +02:00
|
|
|
[{p1_logger, ".*", {git, "https://github.com/processone/p1_logger"}}];
|
2015-03-07 12:44:17 +01:00
|
|
|
({tools, true}) ->
|
|
|
|
[{meck, "0.*", {git, "https://github.com/eproxus/meck"}}];
|
2015-06-04 13:12:49 +02:00
|
|
|
({redis, true}) ->
|
|
|
|
[{eredis, ".*", {git, "https://github.com/wooga/eredis"}}];
|
2013-04-08 11:12:54 +02:00
|
|
|
(_) ->
|
|
|
|
[]
|
|
|
|
end, Cfg),
|
|
|
|
|
|
|
|
CfgPostHooks = lists:flatmap(
|
|
|
|
fun({pam, true}) ->
|
|
|
|
[ConfigureCmd("p1_pam", "")];
|
|
|
|
({zlib, true}) ->
|
|
|
|
[ConfigureCmd("p1_zlib", "")];
|
|
|
|
({iconv, true}) ->
|
|
|
|
[ConfigureCmd("p1_iconv", "")];
|
|
|
|
(_) ->
|
|
|
|
[]
|
|
|
|
end, Cfg),
|
|
|
|
|
2014-08-26 16:12:57 +02:00
|
|
|
CfgXrefs = lists:flatmap(
|
|
|
|
fun({mysql, false}) ->
|
|
|
|
["(\".*mysql.*\":_/_)"];
|
|
|
|
({pgsql, false}) ->
|
|
|
|
["(\".*pgsql.*\":_/_)"];
|
|
|
|
({pam, false}) ->
|
|
|
|
["(\"epam\":_/_)"];
|
|
|
|
({riak, false}) ->
|
|
|
|
["(\"riak.*\":_/_)"];
|
2014-08-26 16:51:04 +02:00
|
|
|
({riak, true}) ->
|
|
|
|
% used in map-reduce function called from riak vm
|
|
|
|
["(\"riak_object\":_/_)"];
|
2014-08-26 16:12:57 +02:00
|
|
|
({json, false}) ->
|
|
|
|
["(\"jiffy\":_/_)"];
|
|
|
|
({zlib, false}) ->
|
|
|
|
["(\"ezlib\":_/_)"];
|
|
|
|
({http, false}) ->
|
|
|
|
["(\"lhttpc\":_/_)"];
|
|
|
|
({iconv, false}) ->
|
|
|
|
["(\"iconv\":_/_)"];
|
2014-08-27 10:47:12 +02:00
|
|
|
({odbc, false}) ->
|
|
|
|
["(\"odbc\":_/_)"];
|
2014-08-26 16:12:57 +02:00
|
|
|
(_) ->
|
|
|
|
[]
|
|
|
|
end, Cfg),
|
|
|
|
|
2015-01-29 18:43:47 +01:00
|
|
|
ElixirConfig = case lists:keysearch(elixir, 1, Cfg) of
|
|
|
|
{value, {elixir, true}} ->
|
|
|
|
[{plugins, [rebar_elixir_compiler, rebar_exunit] },
|
|
|
|
{lib_dirs, ["deps/elixir/lib"]}];
|
|
|
|
_ ->
|
|
|
|
[]
|
|
|
|
end,
|
2014-08-26 16:12:57 +02:00
|
|
|
|
2013-04-08 11:12:54 +02:00
|
|
|
{ok, Cwd} = file:get_cwd(),
|
|
|
|
|
2015-04-09 17:14:30 +02:00
|
|
|
TestConfigFile = filename:join([Cwd, "test", "config.ctc"]),
|
|
|
|
TestConfig = case file:read_file_info(TestConfigFile) of
|
|
|
|
{ok, _} ->
|
|
|
|
"-userconfig ct_config_plain " ++ TestConfigFile ++ " ";
|
|
|
|
_ ->
|
|
|
|
""
|
|
|
|
end,
|
|
|
|
|
2014-07-05 12:01:29 +02:00
|
|
|
Config = [{erl_opts, Macros ++ HiPE ++ DebugInfo ++
|
2013-04-08 11:12:54 +02:00
|
|
|
[{src_dirs, [asn1, src | SrcDirs]}]},
|
|
|
|
{sub_dirs, ["rel"]},
|
2013-06-30 15:30:30 +02:00
|
|
|
{keep_build_info, true},
|
2015-04-09 17:14:30 +02:00
|
|
|
{ct_extra_params, "-ct_hooks cth_surefire "
|
|
|
|
++ TestConfig
|
|
|
|
++ "-include " ++ filename:join([Cwd, "tools"])},
|
2014-08-26 16:12:57 +02:00
|
|
|
{xref_warnings, false},
|
|
|
|
{xref_checks, []},
|
|
|
|
{xref_queries,
|
|
|
|
[{"(XC - UC) || (XU - X - B - "
|
2014-10-30 16:51:01 +01:00
|
|
|
++ string:join(CfgXrefs, " - ") ++ ")", []}]},
|
2013-04-08 11:12:54 +02:00
|
|
|
{post_hooks, PostHooks ++ CfgPostHooks},
|
2015-01-29 18:43:47 +01:00
|
|
|
{deps, Deps ++ CfgDeps}] ++ ElixirConfig,
|
2013-04-08 11:12:54 +02:00
|
|
|
%%io:format("ejabberd configuration:~n ~p~n", [Config]),
|
|
|
|
Config.
|
|
|
|
|
|
|
|
%% Local Variables:
|
|
|
|
%% mode: erlang
|
|
|
|
%% End:
|
|
|
|
%% vim: set filetype=erlang tabstop=8:
|