Make sure that the so_specs stuff is properly backwards compatible

This commit is contained in:
Dave Smith 2010-05-03 10:27:00 -06:00
parent 1826e62069
commit ff1cf0365b

View file

@ -344,18 +344,27 @@ source_to_bin(Source) ->
filename:rootname(Source, Ext) ++ ".o". filename:rootname(Source, Ext) ++ ".o".
so_specs(Config, AppFile, Bins) -> so_specs(Config, AppFile, Bins) ->
%% Check config to see if a custom so_name has been specified
?INFO("config ~p\n", [Config]),
case rebar_config:get(Config, so_specs, undefined) of case rebar_config:get(Config, so_specs, undefined) of
undefined -> undefined ->
%% Get the app name, which we'll use to %% New form of so_specs is not provided. See if the old form of {so_name} is available
%% generate the linked port driver name %% instead
case rebar_app_utils:load_app_file(AppFile) of SoName = case rebar_config:get(Config, so_name, undefined) of
{ok, AppName, _} -> undefined ->
SoName = ?FMT("priv/~s", [lists:concat([AppName, "_drv.so"])]), %% Ok, neither old nor new form is available. Use the app name and
[{SoName, Bins}]; %% generate a sensible default.
error -> case rebar_app_utils:load_app_file(AppFile) of
?FAIL {ok, AppName, _} ->
end; ?FMT("priv/~s", [lists:concat([AppName, "_drv.so"])]);
SoSpecs -> SoSpecs error ->
end. ?FAIL
end;
AName ->
%% Old form is available -- use it
?FMT("priv/~s", [AName])
end,
[{SoName, Bins}];
SoSpecs ->
SoSpecs
end.