diff options
author | Jesse Gumm <sigmastar@gmail.com> | 2011-12-08 20:03:18 +0100 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-12-08 20:12:16 +0100 |
commit | 9f31ceae00c579b48df95600d495369ac20600d3 (patch) | |
tree | e98ffd24b1acbf31d1bf0328a6fbc79e140270c7 /src | |
parent | 8f4e80b8273ff285c974396641fc6c998121c21e (diff) |
Fail if erl_interface not found
Previously if erl_interface could not be found {error, not_found} was
incorrectly used as a path. With this change we fail early with a
descriptive error message.
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_port_compiler.erl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl index 1b46112..4d03a97 100644 --- a/src/rebar_port_compiler.erl +++ b/src/rebar_port_compiler.erl @@ -392,6 +392,14 @@ os_env() -> %% Drop variables without a name (win32) [T1 || {K, _V} = T1 <- Os, K =/= []]. +erl_interface_dir(Subdir) -> + case code:lib_dir(erl_interface, Subdir) of + {error, bad_name} -> + throw({error, {erl_interface,Subdir,"code:lib_dir(erl_interface)" + "is unable to find the erl_interface library."}}); + Dir -> Dir + end. + default_env() -> [ {"CXX_TEMPLATE", @@ -402,13 +410,13 @@ default_env() -> "$CC $PORT_IN_FILES $LDFLAGS $DRV_LDFLAGS -o $PORT_OUT_FILE"}, {"CC", "cc"}, {"CXX", "c++"}, - {"ERL_CFLAGS", lists:concat([" -I", code:lib_dir(erl_interface, include), + {"ERL_CFLAGS", lists:concat([" -I", erl_interface_dir(include), " -I", filename:join(erts_dir(), "include"), " "])}, {"ERL_LDFLAGS", " -L$ERL_EI_LIBDIR -lerl_interface -lei"}, {"DRV_CFLAGS", "-g -Wall -fPIC $ERL_CFLAGS"}, {"DRV_LDFLAGS", "-shared $ERL_LDFLAGS"}, - {"ERL_EI_LIBDIR", code:lib_dir(erl_interface, lib)}, + {"ERL_EI_LIBDIR", erl_interface_dir(lib)}, {"darwin", "DRV_LDFLAGS", "-bundle -flat_namespace -undefined suppress $ERL_LDFLAGS"}, {"ERLANG_ARCH", rebar_utils:wordsize()}, |