aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/src/systools.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
committerErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
commit84adefa331c4159d432d22840663c38f155cd4c1 (patch)
treebff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/sasl/src/systools.erl
downloadotp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz
otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2
otp-84adefa331c4159d432d22840663c38f155cd4c1.zip
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/sasl/src/systools.erl')
-rw-r--r--lib/sasl/src/systools.erl109
1 files changed, 109 insertions, 0 deletions
diff --git a/lib/sasl/src/systools.erl b/lib/sasl/src/systools.erl
new file mode 100644
index 0000000000..51ef687047
--- /dev/null
+++ b/lib/sasl/src/systools.erl
@@ -0,0 +1,109 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(systools).
+
+%% Usage:
+%% systools:make_script("RelName")
+%% Make a boot file from RelName.rel.
+%% Generates RelName.{script,boot}
+%% systools:make_tar("RelName")
+%% Make a release package from RelName.rel.
+%% Generates RelName.tar,Z
+%% systools:script2boot(File)
+%% File.script -> File.boot
+%% systools:mk_relup("Target", ["UpFromRel"...], ["DownToRel"...], Opts)
+%% Gather all relup scripts to the relup file
+%%
+
+-export([script2boot/1, script2boot/3, compile_rel/3,
+ make_script/1, make_script/2,
+ make_tar/1, make_tar/2,
+ make_relup/3, make_relup/4]).
+
+-include("erl_compile.hrl").
+
+%%% The behaviour_info functions have been moved to erl_internal in stdlib.
+
+%%-----------------------------------------------------------------
+%% Options is a list of {path, Path} | silent | local where path sets
+%% the search path, silent supresses error message printing on console,
+%% local generates a script with references to the directories there
+%% the applications are found.
+%%-----------------------------------------------------------------
+make_script([RelName|Opts]) when is_atom(RelName) ->
+ make_script([RelName], Opts);
+make_script(RelName) -> make_script(RelName, []).
+
+make_script(RelName, Opt) ->
+ systools_make:make_script(RelName, Opt).
+
+%%-----------------------------------------------------------------
+%% Options is a list of {path, Path} | silent |
+%% {dirs, [src,include,examples,..]} | {erts, ErtsDir} where path
+%% sets the search path, silent supresses error message printing on console,
+%% dirs includes the specified directories (per application) in the
+%% release package and erts specifies that the erts-Vsn/bin directory
+%% should be included in the release package and there it can be found.
+%%-----------------------------------------------------------------
+make_tar(RelName) -> make_tar(RelName, []).
+
+make_tar(RelName, Opt) ->
+ systools_make:make_tar(RelName, Opt).
+
+%%-----------------------------------------------------------------
+%% Create a binary form of a boot script.
+%%-----------------------------------------------------------------
+script2boot(File) ->
+ case systools_lib:file_term2binary(File ++ ".script", File ++ ".boot") of
+ {error,Error} ->
+ io:format(systools_make:format_error(Error)),
+ error;
+ _ ->
+ ok
+ end.
+
+script2boot(File, Output0, _Opt) ->
+ Input = File++".script",
+ Output = Output0++".boot",
+ case systools_lib:file_term2binary(Input, Output) of
+ {error,Error} ->
+ io:format(systools_make:format_error(Error)),
+ error;
+ _ ->
+ ok
+ end.
+
+%%-----------------------------------------------------------------
+%% Options is a list of {path, Path} | silent | noexec where path sets
+%% search path, silent supresses error message printing on console,
+%% noexec supresses writing the output "relup" file
+%%-----------------------------------------------------------------
+make_relup(ReleaseName, UpNameList, DownNameList) ->
+ systools_relup:mk_relup(ReleaseName, UpNameList, DownNameList, []).
+make_relup(ReleaseName, UpNameList, DownNameList, Opts) ->
+ systools_relup:mk_relup(ReleaseName, UpNameList, DownNameList, Opts).
+
+%%-----------------------------------------------------------------
+%% Interface for erl_compile to compile .rel files.
+%%-----------------------------------------------------------------
+compile_rel(Input, Output, Options) ->
+ systools_make:make_script(Input, Output, translate_options(Options)).
+
+translate_options(Opts) ->
+ [{path, Opts#options.includes}|Opts#options.specific].