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'}];
|
|
|
|
({transient_supervisors, true}) ->
|
|
|
|
[{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,
|
|
|
|
|
|
|
|
Includes = [{i, "include"},
|
|
|
|
{i, filename:join(["deps", "p1_xml", "include"])}],
|
|
|
|
|
|
|
|
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"}},
|
2013-08-12 14:25:05 +02:00
|
|
|
{p1_yaml, ".*", {git, "git://github.com/processone/p1_yaml"}},
|
2013-04-08 11:12:54 +02:00
|
|
|
{xmlrpc, ".*", {git, "git://github.com/rds13/xmlrpc"}}],
|
|
|
|
|
|
|
|
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", ""),
|
|
|
|
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"}}];
|
|
|
|
({stun, true}) ->
|
|
|
|
[{p1_stun, ".*", {git, "git://github.com/processone/stun"}}];
|
|
|
|
({json, true}) ->
|
|
|
|
[{jiffy, ".*", {git, "git://github.com/davisp/jiffy"}}];
|
|
|
|
({iconv, true}) ->
|
|
|
|
[{p1_iconv, ".*", {git, "git://github.com/processone/eiconv"}}];
|
|
|
|
({http, true}) ->
|
|
|
|
[{ibrowse, ".*", {git, "git://github.com/cmullaparthi/ibrowse"}},
|
|
|
|
{lhttpc, ".*", {git, "git://github.com/esl/lhttpc"}}];
|
|
|
|
({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),
|
|
|
|
|
|
|
|
{ok, Cwd} = file:get_cwd(),
|
|
|
|
|
|
|
|
Config = [{erl_opts, Includes ++ Macros ++ HiPE ++ DebugInfo ++
|
|
|
|
[{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 "
|
|
|
|
++ filename:join([Cwd, "tools"]) ++ " "
|
|
|
|
++ filename:join([Cwd, "deps", "p1_xml", "include"])},
|
|
|
|
{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:
|