From: Christophe Romain Date: Wed, 29 Apr 2015 08:19:15 +0000 (+0200) Subject: Fix fetching from git@github url and allow compilation from ejabberd sources X-Git-Tag: 15.06~82 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4440b03b8976da2041df6004c0e56b8273d83268;p=ejabberd Fix fetching from git@github url and allow compilation from ejabberd sources --- diff --git a/src/ext_mod.erl b/src/ext_mod.erl index b2b426cec..35c2a78d7 100644 --- a/src/ext_mod.erl +++ b/src/ext_mod.erl @@ -302,7 +302,15 @@ extract_url(Path, DestDir) -> ++[{error, unsupported_source}]). extract_github_master(Repos, DestDir) -> - case extract(zip, geturl(Repos ++ "/archive/master.zip"), DestDir) of + Base = case string:tokens(Repos, ":") of + ["git@github.com", T1] -> "https://github.com/"++T1; + _ -> Repos + end, + Url = case lists:reverse(Base) of + [$t,$i,$g,$.|T2] -> lists:reverse(T2); + _ -> Base + end, + case extract(zip, geturl(Url++"/archive/master.zip"), DestDir) of ok -> RepDir = filename:join(DestDir, module_name(Repos)), file:rename(RepDir++"-master", RepDir); @@ -445,10 +453,13 @@ compile(_Module, _Spec, DestDir) -> {file, _} -> [{d, 'LAGER'}]; _ -> [] end, + ExtLib = case filelib:is_file(filename:join(EjabInc, "xml.hrl")) of + true -> [{d, 'NO_EXT_LIB'}]; %% use include instead of include_lib + false -> [] + end, Options = [{outdir, Ebin}, {i, "include"}, {i, EjabInc}, - {d, 'NO_EXT_LIB'}, %% use include instead of include_lib verbose, report_errors, report_warnings] - ++ Logger, + ++ Logger ++ ExtLib, Result = [case compile:file(File, Options) of {ok, _} -> ok; {ok, _, _} -> ok;