25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-31 15:21:38 +01:00
xmpp.chapril.org-ejabberd/rebar.config.script.in

143 lines
4.9 KiB
Plaintext
Raw Normal View History

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-02 10:15:03 +02:00
Cfg = [%% Macros
{roster_gateway_workaround, @roster_gateway_workaround@},
{flash_hack, @flash_hack@},
{transient_supervisors, @transient_supervisors@},
{full_xml, @full_xml@},
{nif, @nif@},
{db_type, @db_type@},
{debug, @debug@},
2013-05-02 10:29:40 +02:00
{hipe, @hipe@},
{pubsub_ng, @pubsub_ng@},
2013-05-02 10:15:03 +02:00
%% Dependencies
{mysql, @mysql@},
{pgsql, @pgsql@},
{pam, @pam@},
{zlib, @zlib@},
{stun, @stun@},
{riak, @riak@},
{json, @json@},
{http, @http@},
2013-05-02 10:15:03 +02:00
{iconv, @iconv@}],
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];
(_, 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"}},
{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-01 15:22:26 +02:00
{xmlrpc, ".*", {git, "git://github.com/etnt/xmlrpc"}}],
2013-05-02 10:15:03 +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"}}];
({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
CfgPostHooks = lists:flatmap(
fun({pam, true}) ->
[ConfigureCmd("epam", "")];
({zlib, true}) ->
[ConfigureCmd("ezlib", "")];
({iconv, true}) ->
[ConfigureCmd("iconv", "")];
(_) ->
[]
end, Cfg),
2013-05-02 12:27:53 +02:00
Config = [{erl_opts, Includes ++ Macros ++ HiPE ++ DebugInfo},
{src_dirs, [asn1, src | SrcDirs]},
{sub_dirs, ["rel"]},
{post_hooks, PostHooks ++ CfgPostHooks},
2013-05-02 12:27:53 +02:00
{deps, Deps ++ CfgDeps}],
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: