2013-05-01 15:22:26 +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>
|
|
|
|
%%%-------------------------------------------------------------------
|
2013-05-09 11:05:35 +02:00
|
|
|
Cfg = case file:consult("vars.config") of
|
2013-05-08 11:27:25 +02:00
|
|
|
{ok, Terms} ->
|
|
|
|
Terms;
|
|
|
|
_Err ->
|
|
|
|
[]
|
|
|
|
end,
|
2013-05-02 10:15:03 +02:00
|
|
|
|
2013-05-01 15:22:26 +02:00
|
|
|
Macros = lists:flatmap(
|
|
|
|
fun({roster_gateway_workaround, true}) ->
|
|
|
|
[{d, 'ROSTER_GATEWAY_WORKAROUND'}];
|
|
|
|
({flash_hack, true}) ->
|
|
|
|
[{d, 'ENABLE_FLASH_HACK'}];
|
|
|
|
({transient_supervisors, true}) ->
|
|
|
|
[{d, 'NO_TRANSIENT_SUPERVISORS'}];
|
|
|
|
({nif, true}) ->
|
|
|
|
[{d, 'NIF'}];
|
|
|
|
({db_type, mssql}) ->
|
|
|
|
[{d, 'mssql'}];
|
|
|
|
(_) ->
|
|
|
|
[]
|
|
|
|
end, Cfg),
|
2013-05-02 10:15:03 +02:00
|
|
|
|
|
|
|
DebugInfo = case lists:keysearch(debug, 1, Cfg) of
|
|
|
|
{value, {debug, true}} ->
|
|
|
|
[debug_info];
|
|
|
|
_ ->
|
|
|
|
[]
|
|
|
|
end,
|
|
|
|
|
2013-05-02 10:29:40 +02:00
|
|
|
HiPE = case lists:keysearch(hipe, 1, Cfg) of
|
|
|
|
{value, {hipe, true}} ->
|
|
|
|
[native];
|
|
|
|
_ ->
|
|
|
|
[]
|
|
|
|
end,
|
|
|
|
|
|
|
|
Includes = [{i, "include"},
|
|
|
|
{i, filename:join(["deps", "logger", "include"])},
|
|
|
|
{i, filename:join(["deps", "xml", "include"])}],
|
|
|
|
|
|
|
|
SrcDirs = lists:foldl(
|
|
|
|
fun({pubsub_ng, true}, Acc) ->
|
|
|
|
[mod_pubsub_ng|Acc];
|
2013-05-12 06:13:16 +02:00
|
|
|
({tools, true}, Acc) ->
|
|
|
|
[tools|Acc];
|
2013-05-02 10:29:40 +02:00
|
|
|
(_, Acc) ->
|
|
|
|
Acc
|
|
|
|
end, [], Cfg),
|
2013-05-02 10:15:03 +02:00
|
|
|
|
2013-05-01 15:22:26 +02:00
|
|
|
Deps = [{logger, ".*", {git, "git://github.com/processone/p1_logger"}},
|
2013-05-08 07:17:11 +02:00
|
|
|
{cache_tab, ".*", {git, "git://github.com/processone/cache_tab"}},
|
2013-05-01 15:22:26 +02:00
|
|
|
{tls, ".*", {git, "git://github.com/processone/tls"}},
|
|
|
|
{stringprep, ".*", {git, "git://github.com/processone/stringprep"}},
|
2013-05-02 13:04:55 +02:00
|
|
|
{xml, ".*", {git, "git://github.com/processone/xml"}},
|
2013-05-09 12:57:27 +02:00
|
|
|
{xmlrpc, ".*", {git, "git://github.com/rds13/xmlrpc"}}],
|
2013-05-02 10:15:03 +02:00
|
|
|
|
2013-05-08 05:32:18 +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("tls", ""),
|
|
|
|
ConfigureCmd("stringprep", ""),
|
|
|
|
ConfigureCmd("xml", XMLFlags)],
|
|
|
|
|
2013-05-01 15:22:26 +02:00
|
|
|
CfgDeps = lists:flatmap(
|
|
|
|
fun({mysql, true}) ->
|
|
|
|
[{mysql, ".*", {git, "git://github.com/processone/mysql"}}];
|
|
|
|
({pgsql, true}) ->
|
|
|
|
[{pgsql, ".*", {git, "git://github.com/processone/pgsql"}}];
|
|
|
|
({pam, true}) ->
|
|
|
|
[{epam, ".*", {git, "git://github.com/processone/epam"}}];
|
|
|
|
({zlib, true}) ->
|
|
|
|
[{ezlib, ".*", {git, "git://github.com/processone/zlib"}}];
|
|
|
|
({stun, true}) ->
|
|
|
|
[{stun, ".*", {git, "git://github.com/processone/stun"}}];
|
|
|
|
({riak, true}) ->
|
|
|
|
[{riakc, ".*", {git, "git://github.com/basho/riak-erlang-client"}}];
|
|
|
|
({json, true}) ->
|
|
|
|
[{jiffy, ".*", {git, "git://github.com/davisp/jiffy"}}];
|
2013-05-01 15:35:01 +02:00
|
|
|
({iconv, true}) ->
|
|
|
|
[{iconv, ".*", {git, "git://github.com/processone/eiconv"}}];
|
2013-05-02 12:36:10 +02:00
|
|
|
({http, true}) ->
|
|
|
|
[{ibrowse, ".*", {git, "git://github.com/cmullaparthi/ibrowse"}},
|
|
|
|
{lhttpc, ".*", {git, "git://github.com/esl/lhttpc"}}];
|
2013-05-01 15:22:26 +02:00
|
|
|
(_) ->
|
|
|
|
[]
|
|
|
|
end, Cfg),
|
2013-05-02 10:15:03 +02:00
|
|
|
|
2013-05-08 05:32:18 +02:00
|
|
|
CfgPostHooks = lists:flatmap(
|
|
|
|
fun({pam, true}) ->
|
|
|
|
[ConfigureCmd("epam", "")];
|
|
|
|
({zlib, true}) ->
|
|
|
|
[ConfigureCmd("ezlib", "")];
|
|
|
|
({iconv, true}) ->
|
|
|
|
[ConfigureCmd("iconv", "")];
|
|
|
|
(_) ->
|
|
|
|
[]
|
|
|
|
end, Cfg),
|
|
|
|
|
2013-05-09 13:22:27 +02:00
|
|
|
Config = [{erl_opts, Includes ++ Macros ++ HiPE ++ DebugInfo ++
|
|
|
|
[{src_dirs, [asn1, src | SrcDirs]}]},
|
2013-05-02 12:27:53 +02:00
|
|
|
{sub_dirs, ["rel"]},
|
2013-05-08 05:32:18 +02:00
|
|
|
{post_hooks, PostHooks ++ CfgPostHooks},
|
2013-05-02 12:27:53 +02:00
|
|
|
{deps, Deps ++ CfgDeps}],
|
2013-05-09 03:56:01 +02:00
|
|
|
%%io:format("ejabberd configuration:~n ~p~n", [Config]),
|
2013-05-02 12:27:53 +02:00
|
|
|
Config.
|
2013-05-01 15:22:26 +02:00
|
|
|
|
|
|
|
%% Local Variables:
|
|
|
|
%% mode: erlang
|
|
|
|
%% End:
|
|
|
|
%% vim: set filetype=erlang tabstop=8:
|