diff options
author | Dave Smith <dizzyd@dizzyd.com> | 2010-05-03 10:27:00 -0600 |
---|---|---|
committer | Dave Smith <dizzyd@dizzyd.com> | 2010-05-03 10:27:00 -0600 |
commit | ff1cf0365b673593e27c8d4ca85c2e393d045d8c (patch) | |
tree | 12d5773ff4dfd53c15018d43c231bef16751b2e0 /src | |
parent | 1826e620690a4128f157574ad2051daf49bb857d (diff) |
Make sure that the so_specs stuff is properly backwards compatible
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_port_compiler.erl | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl index 404e23a..6960a5f 100644 --- a/src/rebar_port_compiler.erl +++ b/src/rebar_port_compiler.erl @@ -344,18 +344,27 @@ source_to_bin(Source) -> filename:rootname(Source, Ext) ++ ".o". 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 - undefined -> - %% Get the app name, which we'll use to - %% generate the linked port driver name - case rebar_app_utils:load_app_file(AppFile) of - {ok, AppName, _} -> - SoName = ?FMT("priv/~s", [lists:concat([AppName, "_drv.so"])]), - [{SoName, Bins}]; - error -> - ?FAIL - end; - SoSpecs -> SoSpecs - end. + undefined -> + %% New form of so_specs is not provided. See if the old form of {so_name} is available + %% instead + SoName = case rebar_config:get(Config, so_name, undefined) of + undefined -> + %% Ok, neither old nor new form is available. Use the app name and + %% generate a sensible default. + case rebar_app_utils:load_app_file(AppFile) of + {ok, AppName, _} -> + ?FMT("priv/~s", [lists:concat([AppName, "_drv.so"])]); + error -> + ?FAIL + end; + + AName -> + %% Old form is available -- use it + ?FMT("priv/~s", [AName]) + end, + [{SoName, Bins}]; + + SoSpecs -> + SoSpecs + end. |