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>
|
|
|
|
%%%-------------------------------------------------------------------
|
|
|
|
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'}];
|
|
|
|
(_) ->
|
|
|
|
[]
|
|
|
|
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),
|
|
|
|
|
2013-07-06 19:10:35 +02:00
|
|
|
Deps = [{p1_cache_tab, ".*", {git, "git://github.com/processone/cache_tab"}},
|
2013-04-08 11:12:54 +02:00
|
|
|
{p1_tls, ".*", {git, "git://github.com/processone/tls"}},
|
|
|
|
{p1_stringprep, ".*", {git, "git://github.com/processone/stringprep"}},
|
|
|
|
{p1_xml, ".*", {git, "git://github.com/processone/xml"}},
|
2014-05-02 15:27:46 +02:00
|
|
|
{esip, ".*", {git, "git://github.com/processone/p1_sip"}},
|
2014-06-03 18:54:39 +02:00
|
|
|
{p1_stun, ".*", {git, "git://github.com/processone/stun"}},
|
2013-08-12 14:25:05 +02:00
|
|
|
{p1_yaml, ".*", {git, "git://github.com/processone/p1_yaml"}},
|
2014-10-03 16:53:55 +02:00
|
|
|
{ehyperloglog, ".*", {git, "https://github.com/vaxelfel/eHyperLogLog.git"}},
|
2014-07-17 10:50:43 +02:00
|
|
|
{p1_utils, ".*", {git, "git://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}) ->
|
|
|
|
[{p1_mysql, ".*", {git, "git://github.com/processone/mysql"}}];
|
|
|
|
({pgsql, true}) ->
|
|
|
|
[{p1_pgsql, ".*", {git, "git://github.com/processone/pgsql"}}];
|
|
|
|
({pam, true}) ->
|
|
|
|
[{p1_pam, ".*", {git, "git://github.com/processone/epam"}}];
|
|
|
|
({zlib, true}) ->
|
|
|
|
[{p1_zlib, ".*", {git, "git://github.com/processone/zlib"}}];
|
2014-07-09 14:40:06 +02:00
|
|
|
({riak, true}) ->
|
|
|
|
[{riakc, ".*",
|
|
|
|
{git, "git://github.com/basho/riak-erlang-client",
|
|
|
|
{tag, "1.4.2"}}}];
|
2013-04-08 11:12:54 +02:00
|
|
|
({json, true}) ->
|
|
|
|
[{jiffy, ".*", {git, "git://github.com/davisp/jiffy"}}];
|
|
|
|
({iconv, true}) ->
|
|
|
|
[{p1_iconv, ".*", {git, "git://github.com/processone/eiconv"}}];
|
|
|
|
({lager, true}) ->
|
|
|
|
[{lager, ".*", {git, "git://github.com/basho/lager"}}];
|
2013-07-06 19:10:35 +02:00
|
|
|
({lager, false}) ->
|
|
|
|
[{p1_logger, ".*", {git, "git://github.com/processone/p1_logger"}}];
|
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),
|
|
|
|
|
|
|
|
|
2013-04-08 11:12:54 +02:00
|
|
|
{ok, Cwd} = file:get_cwd(),
|
|
|
|
|
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},
|
2013-04-08 11:12:54 +02:00
|
|
|
{ct_extra_params, "-include "
|
2014-07-05 12:01:29 +02:00
|
|
|
++ 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},
|
|
|
|
{deps, Deps ++ CfgDeps}],
|
|
|
|
%%io:format("ejabberd configuration:~n ~p~n", [Config]),
|
|
|
|
Config.
|
|
|
|
|
|
|
|
%% Local Variables:
|
|
|
|
%% mode: erlang
|
|
|
|
%% End:
|
|
|
|
%% vim: set filetype=erlang tabstop=8:
|