aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--src/relx.erl1
-rw-r--r--src/rlx_cmd_args.erl8
-rw-r--r--src/rlx_prv_discover.erl27
-rw-r--r--src/rlx_state.erl6
5 files changed, 30 insertions, 13 deletions
diff --git a/README.md b/README.md
index 19e2008..b0e9427 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,7 @@ Options
| -u | --upfrom | string | | The release to upgrade from. Only valid with relup target |
| -o | --output-dir | string | ./ | The output directory for the release |
| -l | --lib-dir | string | | Additional dirs to search for OTP apps |
+| | --system_libs | string | | Path to a Erlang system libs to use |
| -p | --path | string | | Additional dirs to add to Erlang code path |
| | --default-libs | boolean | true | Whether to use the default system added lib dirs (means you must add them all manually) |
| -V | --verbose | integer | 2 | The verbosity level between 0 and 3 |
diff --git a/src/relx.erl b/src/relx.erl
index 1ac91d9..6306559 100644
--- a/src/relx.erl
+++ b/src/relx.erl
@@ -201,6 +201,7 @@ opt_spec_list() ->
"Provide an app name and a directory to override in the form <appname>:<app directory>"},
{config, $c, "config", {string, ""}, "The path to a config file"},
{overlay_vars, undefined, "overlay_vars", string, "Path to a file of overlay variables"},
+ {system_libs, undefined, "system_libs", string, "Path to dir of Erlang system libs"},
{version, $v, "version", undefined, "Print relx version"},
{root_dir, $r, "root", string, "The project root directory"}].
diff --git a/src/rlx_cmd_args.erl b/src/rlx_cmd_args.erl
index ea32fd4..d6bf0bb 100644
--- a/src/rlx_cmd_args.erl
+++ b/src/rlx_cmd_args.erl
@@ -252,7 +252,13 @@ create_disable_default_libs(Opts, Acc) ->
{ok, rlx_state:cmd_args()} | relx:error().
create_overlay_vars(Opts, Acc) ->
OverlayVars = proplists:get_all_values(overlay_vars, Opts),
- create_upfrom(Opts, [{overlay_vars, OverlayVars} | Acc]).
+ create_system_libs(Opts, [{overlay_vars, OverlayVars} | Acc]).
+
+-spec create_system_libs([getopt:option()], rlx_state:cmd_args()) ->
+ {ok, rlx_state:cmd_args()} | relx:error().
+create_system_libs(Opts, Acc) ->
+ SystemLibs = proplists:get_value(system_libs, Opts, undefined),
+ create_upfrom(Opts, [{system_libs, SystemLibs} | Acc]).
-spec create_upfrom([getopt:option()], rlx_state:cmd_args()) ->
{ok, rlx_state:cmd_args()} | relx:error().
diff --git a/src/rlx_prv_discover.erl b/src/rlx_prv_discover.erl
index 0ac4aac..5d09619 100644
--- a/src/rlx_prv_discover.erl
+++ b/src/rlx_prv_discover.erl
@@ -100,22 +100,27 @@ add_common_project_dirs(State) ->
Ebin = filename:join(Root, "ebin"),
lists:foldl(fun(Dir, LibDirs) ->
case ec_file:exists(Dir) of
- true ->
- [erlang:iolist_to_binary(Dir) | LibDirs];
- false ->
- LibDirs
- end
- end, [], [Deps, Lib, Apps, Ebin])
+ true ->
+ [erlang:iolist_to_binary(Dir) | LibDirs];
+ false ->
+ LibDirs
+ end
+ end, [], [Deps, Lib, Apps, Ebin])
end.
-spec add_system_lib_dir(rlx_state:t()) -> [file:name()].
add_system_lib_dir(State) ->
ExcludeSystem = rlx_state:get(State, discover_exclude_system, false),
- case ExcludeSystem of
- true ->
- [];
- false ->
- erlang:iolist_to_binary(code:lib_dir())
+ case rlx_state:get(State, system_libs, undefined) of
+ undefined ->
+ case ExcludeSystem of
+ true ->
+ [];
+ false ->
+ erlang:iolist_to_binary(code:lib_dir())
+ end;
+ SystemLibs ->
+ erlang:iolist_to_binary(SystemLibs)
end.
add_release_output_dir(State) ->
diff --git a/src/rlx_state.erl b/src/rlx_state.erl
index 1d235a9..b196e8d 100644
--- a/src/rlx_state.erl
+++ b/src/rlx_state.erl
@@ -138,7 +138,11 @@ new(PropList, Targets)
default_libs,
proplists:get_value(default_libs, PropList, true)),
- rlx_state:put(create_logic_providers(State1),
+ State2 = rlx_state:put(create_logic_providers(State1),
+ system_libs,
+ proplists:get_value(system_libs, PropList, undefined)),
+
+ rlx_state:put(create_logic_providers(State2),
overlay_vars,
proplists:get_value(overlay_vars, PropList, [])).