aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2020-03-03 11:18:07 +0100
committerPaweł Chmielowski <pchmielowski@process-one.net>2020-03-03 11:25:17 +0100
commit151b818af4d01b8afd979d43d1334be423560419 (patch)
tree43fbe87787857f35d43e09988a3fbb99078c5cce
parentFix list parameters in sql queries on pgsql (diff)
Use compilation flags used during build to compile modules in ext_mod
This fixes issue #3178
-rw-r--r--mix.exs19
-rw-r--r--rebar.config.script6
-rw-r--r--src/ext_mod.erl2
3 files changed, 21 insertions, 6 deletions
diff --git a/mix.exs b/mix.exs
index dba39abf1..29ca4a6a3 100644
--- a/mix.exs
+++ b/mix.exs
@@ -51,12 +51,25 @@ defmodule Ejabberd.Mixfile do
end
end
+ defp if_version_below(ver, okResult) do
+ if :erlang.system_info(:otp_release) < ver do
+ okResult
+ else
+ []
+ end
+ end
+
defp erlc_options do
# Use our own includes + includes from all dependencies
includes = ["include"] ++ deps_include(["fast_xml", "xmpp", "p1_utils"])
- [:debug_info, {:d, :ELIXIR_ENABLED}] ++ cond_options() ++ Enum.map(includes, fn(path) -> {:i, path} end) ++
- if_version_above('20', [{:d, :DEPRECATED_GET_STACKTRACE}]) ++
- if_function_exported(:erl_error, :format_exception, 6, [{:d, :HAVE_ERL_ERROR}])
+ result = [:debug_info, {:d, :ELIXIR_ENABLED}] ++
+ cond_options() ++
+ Enum.map(includes, fn (path) -> {:i, path} end) ++
+ if_version_above('20', [{:d, :DEPRECATED_GET_STACKTRACE}]) ++
+ if_version_below('22', [{:d, :LAGER}]) ++
+ if_function_exported(:erl_error, :format_exception, 6, [{:d, :HAVE_ERL_ERROR}])
+ defines = for {:d, value} <- result, do: {:d, value}
+ result ++ [{:d, :ALL_DEFS, defines}]
end
defp cond_options do
diff --git a/rebar.config.script b/rebar.config.script
index fee828025..c09380d75 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -304,12 +304,14 @@ fun(Hooks) ->
end,
ProcessErlOpt = fun(Vals) ->
- lists:map(
+ R = lists:map(
fun({i, Path}) ->
{i, ResolveDepPath(Path)};
(ErlOpt) ->
ErlOpt
- end, Vals)
+ end, Vals),
+ M = lists:filter(fun({d, M}) -> true; (_) -> false end, R),
+ [{d, 'ALL_DEFS', M} | R]
end,
ProcssXrefExclusions = fun(Items) ->
diff --git a/src/ext_mod.erl b/src/ext_mod.erl
index 1b8c0eb61..e4feeaee6 100644
--- a/src/ext_mod.erl
+++ b/src/ext_mod.erl
@@ -570,7 +570,7 @@ compile_result(Results) ->
end.
compile_options() ->
- [verbose, report_errors, report_warnings]
+ [verbose, report_errors, report_warnings, ?ALL_DEFS]
++ [{i, filename:join(app_dir(App), "include")}
|| App <- [fast_xml, xmpp, p1_utils, ejabberd]]
++ [{i, filename:join(mod_dir(Mod), "include")}