Add otp_release to platform string

This commit is contained in:
Joseph Wayne Norton 2011-01-09 16:06:51 +01:00 committed by Tuncer Ayaz
parent 5a37149642
commit 5b05e54cda
3 changed files with 23 additions and 8 deletions

View file

@ -31,7 +31,8 @@
{erl_opts, [{i, "myinclude"}, {src_dirs, ["src1", "src2"]}, {erl_opts, [{i, "myinclude"}, {src_dirs, ["src1", "src2"]},
{platform_define, {platform_define,
"(linux|solaris|freebsd|darwin)", 'HAVE_SENDFILE'}, "(linux|solaris|freebsd|darwin)", 'HAVE_SENDFILE'},
{platform_define, "(linux|freebsd)", 'BACKLOG', 128}]}. {platform_define, "(linux|freebsd)", 'BACKLOG', 128},
{platform_define, "R13", 'old_inets'}]}.
%% MIB Options? %% MIB Options?
{mib_opts, []}. {mib_opts, []}.

View file

@ -42,16 +42,29 @@
%% %%
%% * erl_opts - Erlang list of options passed to compile:file/2 %% * erl_opts - Erlang list of options passed to compile:file/2
%% It is also possible to specify platform specific %% It is also possible to specify platform specific
%% options by specifying a triplet where the first string %% options by specifying a pair or a triplet where the
%% is a regex that is checked against Erlang's system %% first string is a regex that is checked against the
%% architecture string. E.g. to define HAVE_SENDFILE only %% string
%% on systems with sendfile() and define BACKLOG on %%
%% Linux/FreeBSD as 128 do: %% OtpRelease ++ "-" ++ SysArch ++ "-" ++ Words.
%%
%% where
%%
%% OtpRelease = erlang:system_info(otp_release).
%% SysArch = erlang:system_info(system_architecture).
%% Words = integer_to_list(8 * erlang:system_info(wordsize)).
%%
%% E.g. to define HAVE_SENDFILE only on systems with
%% sendfile(), to define BACKLOG on Linux/FreeBSD as 128,
%% and to define 'old_inets' for R13 OTP release do:
%%
%% {erl_opts, [{platform_define, %% {erl_opts, [{platform_define,
%% "(linux|solaris|freebsd|darwin)", %% "(linux|solaris|freebsd|darwin)",
%% 'HAVE_SENDFILE'}, %% 'HAVE_SENDFILE'},
%% {platform_define, "(linux|freebsd)", %% {platform_define, "(linux|freebsd)",
%% 'BACKLOG', 128}]}. %% 'BACKLOG', 128},
%% {platform_define, "R13",
%% 'old_inets'}]}.
%% %%
-spec compile(Config::#config{}, AppFile::string()) -> 'ok'. -spec compile(Config::#config{}, AppFile::string()) -> 'ok'.

View file

@ -60,7 +60,8 @@ is_arch(ArchRegex) ->
get_arch() -> get_arch() ->
Words = integer_to_list(8 * erlang:system_info(wordsize)), Words = integer_to_list(8 * erlang:system_info(wordsize)),
erlang:system_info(system_architecture) ++ "-" ++ Words. erlang:system_info(otp_release) ++ "-"
++ erlang:system_info(system_architecture) ++ "-" ++ Words.
%% %%
%% Options = [Option] -- defaults to [use_stdout, abort_on_error] %% Options = [Option] -- defaults to [use_stdout, abort_on_error]