2013-04-08 11:12:54 +02:00
|
|
|
%%%-------------------------------------------------------------------
|
|
|
|
%%% @author Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
2024-01-22 16:40:01 +01:00
|
|
|
%%% @copyright (C) 2013-2024, Evgeniy Khramtsov
|
2013-04-08 11:12:54 +02:00
|
|
|
%%% @doc
|
|
|
|
%%%
|
|
|
|
%%% @end
|
|
|
|
%%% Created : 8 May 2013 by Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
|
|
|
%%%-------------------------------------------------------------------
|
2016-01-07 14:10:54 +01:00
|
|
|
|
|
|
|
TopDir = filename:join(filename:dirname(SCRIPT), ".."),
|
|
|
|
|
|
|
|
GetDeps = fun(Config, GetDepsFun) ->
|
|
|
|
case catch rebar_config:consult_file(Config) of
|
|
|
|
{ok, Data} ->
|
|
|
|
case lists:keyfind(deps, 1, Data) of
|
|
|
|
{deps, Deps} ->
|
|
|
|
lists:map(fun({Dep, _, _}) ->
|
|
|
|
[Dep, GetDepsFun(filename:join([TopDir,
|
|
|
|
"deps",
|
|
|
|
Dep,
|
|
|
|
"rebar.config"]),
|
|
|
|
GetDepsFun)]
|
|
|
|
end, Deps);
|
|
|
|
_ ->
|
|
|
|
[]
|
|
|
|
end;
|
|
|
|
_ ->
|
|
|
|
[]
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
Vars = case file:consult(filename:join([TopDir, "vars.config"])) of
|
2013-04-08 11:12:54 +02:00
|
|
|
{ok, Terms} ->
|
|
|
|
Terms;
|
|
|
|
_Err ->
|
|
|
|
[]
|
|
|
|
end,
|
|
|
|
|
|
|
|
RequiredOTPApps = [sasl, crypto, public_key, ssl,
|
2013-06-18 13:54:30 +02:00
|
|
|
mnesia, inets, compiler, asn1,
|
|
|
|
syntax_tools, os_mon, xmerl],
|
2013-04-08 11:12:54 +02:00
|
|
|
|
|
|
|
ConfiguredOTPApps = lists:flatmap(
|
|
|
|
fun({tools, true}) ->
|
|
|
|
[tools, runtime_tools];
|
2013-06-18 13:54:30 +02:00
|
|
|
({odbc, true}) ->
|
|
|
|
[odbc];
|
2013-04-08 11:12:54 +02:00
|
|
|
(_) ->
|
|
|
|
[]
|
|
|
|
end, Vars),
|
|
|
|
|
|
|
|
OTPApps = RequiredOTPApps ++ ConfiguredOTPApps,
|
|
|
|
|
2016-01-07 14:10:54 +01:00
|
|
|
DepApps = lists:usort(lists:flatten(GetDeps(filename:join(TopDir, "rebar.config"), GetDeps))),
|
2013-04-08 11:12:54 +02:00
|
|
|
|
2024-01-16 18:10:52 +01:00
|
|
|
SysVer = erlang:system_info(otp_release),
|
|
|
|
|
2013-04-08 11:12:54 +02:00
|
|
|
Sys = [{lib_dirs, []},
|
|
|
|
{erts, [{mod_cond, derived}, {app_file, strip}]},
|
|
|
|
{app_file, strip},
|
|
|
|
{rel, "ejabberd", proplists:get_value(vsn, Vars),
|
|
|
|
[
|
|
|
|
kernel,
|
|
|
|
stdlib,
|
|
|
|
ejabberd
|
|
|
|
] ++ OTPApps ++ DepApps},
|
|
|
|
{rel, "start_clean", "",
|
|
|
|
[
|
|
|
|
kernel,
|
|
|
|
stdlib
|
|
|
|
]},
|
|
|
|
{boot_rel, "ejabberd"},
|
|
|
|
{profile, embedded},
|
|
|
|
{incl_cond, exclude},
|
|
|
|
{excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
|
|
|
|
"^erts.*/(doc|info|include|lib|man|src)"]},
|
|
|
|
{excl_app_filters, ["\.gitignore"]},
|
|
|
|
{app, stdlib, [{incl_cond, include}]},
|
|
|
|
{app, kernel, [{incl_cond, include}]},
|
|
|
|
{app, ejabberd, [{incl_cond, include}, {lib_dir, ".."}]}]
|
2024-01-16 18:10:52 +01:00
|
|
|
++ if SysVer < "26" ->
|
|
|
|
[{excl_archive_filters, [".*"]}]; %% Do not archive built libs
|
|
|
|
true ->
|
|
|
|
[]
|
|
|
|
end
|
2013-04-08 11:12:54 +02:00
|
|
|
++ lists:map(
|
|
|
|
fun(App) ->
|
|
|
|
{app, App, [{incl_cond, include},
|
|
|
|
{lib_dir, "../deps/" ++ atom_to_list(App)}]}
|
|
|
|
end, DepApps)
|
|
|
|
++ lists:map(
|
|
|
|
fun(App) ->
|
|
|
|
{app, App, [{incl_cond, include}]}
|
|
|
|
end, OTPApps).
|
|
|
|
|
|
|
|
Overlay = [
|
2022-04-25 12:46:48 +02:00
|
|
|
{mkdir, "logs"},
|
|
|
|
{mkdir, "database"},
|
|
|
|
{mkdir, "conf"},
|
2013-04-08 11:12:54 +02:00
|
|
|
{mkdir, "doc"},
|
|
|
|
{template, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
|
|
|
|
{template, "../ejabberdctl.template", "bin/ejabberdctl"},
|
2022-04-25 12:46:48 +02:00
|
|
|
{copy, "../ejabberdctl.cfg.example", "conf/ejabberdctl.cfg"},
|
|
|
|
{copy, "../ejabberd.yml.example", "conf/ejabberd.yml"},
|
|
|
|
{copy, "../inetrc", "conf/inetrc"},
|
2013-04-08 11:12:54 +02:00
|
|
|
{copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"}
|
|
|
|
],
|
|
|
|
|
|
|
|
Config = [{sys, Sys},
|
|
|
|
{overlay_vars, "../vars.config"},
|
|
|
|
{target_dir, "ejabberd"},
|
|
|
|
{overlay, Overlay}],
|
|
|
|
|
|
|
|
%%io:format("ejabberd release:~n ~p~n", [Config]),
|
|
|
|
Config.
|
|
|
|
|
|
|
|
%% Local Variables:
|
|
|
|
%% mode: erlang
|
|
|
|
%% End:
|
|
|
|
%% vim: set filetype=erlang tabstop=8:
|