%%%------------------------------------------------------------------- %%% @author Evgeniy Khramtsov %%% @copyright (C) 2013, Evgeniy Khramtsov %%% @doc %%% %%% @end %%% Created : 1 May 2013 by Evgeniy Khramtsov %%%------------------------------------------------------------------- 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@}, {hipe, @hipe@}, {pubsub_ng, @pubsub_ng@}, %% Dependencies {mysql, @mysql@}, {pgsql, @pgsql@}, {pam, @pam@}, {zlib, @zlib@}, {stun, @stun@}, {riak, @riak@}, {json, @json@}, {http, @http@}, {iconv, @iconv@}], 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'}]; ({full_xml, true}) -> [{d, 'FULL_XML_SUPPORT'}]; ({nif, true}) -> [{d, 'NIF'}]; ({db_type, mssql}) -> [{d, 'mssql'}]; (_) -> [] end, Cfg), DebugInfo = case lists:keysearch(debug, 1, Cfg) of {value, {debug, true}} -> [debug_info]; _ -> [] end, 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), Deps = [{logger, ".*", {git, "git://github.com/processone/p1_logger"}}, {tls, ".*", {git, "git://github.com/processone/tls"}}, {stringprep, ".*", {git, "git://github.com/processone/stringprep"}}, {xml, ".*", {git, "git://github.com/processone/xml"}}, {xmlrpc, ".*", {git, "git://github.com/etnt/xmlrpc"}}], 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"}}]; ({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"}}]; (_) -> [] end, Cfg), Config = [{erl_opts, Includes ++ Macros ++ HiPE ++ DebugInfo}, {src_dirs, [asn1, src | SrcDirs]}, {sub_dirs, ["rel"]}, {deps, Deps ++ CfgDeps}], io:format("dynamic configuration:~n ~p~n", [Config]), Config. %% Local Variables: %% mode: erlang %% End: %% vim: set filetype=erlang tabstop=8: