]> granicus.if.org Git - ejabberd/commitdiff
Fix fetching from git@github url and allow compilation from ejabberd sources
authorChristophe Romain <christophe.romain@process-one.net>
Wed, 29 Apr 2015 08:19:15 +0000 (10:19 +0200)
committerChristophe Romain <christophe.romain@process-one.net>
Wed, 29 Apr 2015 08:19:15 +0000 (10:19 +0200)
src/ext_mod.erl

index b2b426cec308e6fe44e56ed41476b782a9a9bfce..35c2a78d73270c33702508659db7c66cb00cb17e 100644 (file)
@@ -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;