25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Fix compilation of external module with new xmpp lib

This commit is contained in:
Christophe Romain 2016-12-06 12:01:04 +01:00
parent 0c2491d9ea
commit 1883a98d1c
2 changed files with 19 additions and 7 deletions

View File

@ -493,7 +493,8 @@ compile_deps(_Module, _Spec, DestDir) ->
Inc = filename:join(Dep, "include"),
Lib = filename:join(Dep, "lib"),
Src = filename:join(Dep, "src"),
Options = [{outdir, Ebin}, {i, Inc}],
Options = [verbose, report_errors, report_warnings,
{outdir, Ebin}, {i, Inc}],
[file:copy(App, Ebin) || App <- filelib:wildcard(Src++"/*.app")],
%% Compile erlang files
@ -525,10 +526,10 @@ compile_deps(_Module, _Spec, DestDir) ->
compile(_Module, _Spec, DestDir) ->
Ebin = filename:join(DestDir, "ebin"),
filelib:ensure_dir(filename:join(Ebin, ".")),
EjabBin = filename:dirname(code:which(ejabberd)),
EjabInc = filename:join(filename:dirname(EjabBin), "include"),
Options = [{outdir, Ebin}, {i, "include"}, {i, EjabInc},
verbose, report_errors, report_warnings],
Includes = [{i, filename:join(code:lib_dir(App), "include")}
|| App <- [fast_xml, xmpp, ejabberd]],
Options = [verbose, report_errors, report_warnings,
{outdir, Ebin}, {i, "include"} | Includes],
[file:copy(App, Ebin) || App <- filelib:wildcard("src/*.app")],
%% Compile erlang files

View File

@ -639,11 +639,22 @@ get_commands_spec() ->
%%%
%%% Node
%%% Adminsys
%%%
compile(File) ->
compile:file(File).
Includes = [{i, filename:join(code:lib_dir(App), "include")}
|| App <- [fast_xml, xmpp, ejabberd]],
Ebin = filename:join(code:lib_dir(ejabberd), "ebin"),
case compile:file(File, [{outdir, Ebin}|Includes]) of
error -> error;
{error, _, _} -> error;
OK ->
[ok, ModuleName | _] = tuple_to_list(OK),
code:purge(ModuleName),
code:load_file(ModuleName),
ok
end.
get_cookie() ->
atom_to_list(erlang:get_cookie()).