I have a rebar dependency which needs a "./configure" command to be run before the application can be compiled (it actually generates the Makefile). Is it possible to tell rebar how to build a specific dependency?
After discussing the issue in the Rebar mailing list, I've ended up by creating a Rebar plugin. Here it is, in case someone needs to do something similar. The final 'ok' is required by the current Rebar plugins API.
-module(rebar_compiledeps_plugin).
-export([pre_compile/2]).
pre_compile(_, _) ->
Cwd = rebar_utils:get_cwd(),
case lists:suffix("my_dep", Cwd) of
true ->
Opts = [{cwd, Cwd}],
case filelib:is_regular(filename:join([Cwd, "Makefile"])) of
true ->
rebar_utils:sh("make [OPTIONS]", Opts);
false ->
rebar_utils:sh("./configure && make [OPTIONS]", Opts)
end;
false ->
ok
end,
ok.