Fix build for Erlang 17 and 18 by adding patches from FreeBSD ports.

Bump PKGREVISION.
This commit is contained in:
fhajny 2015-07-17 14:25:42 +00:00
parent d053ad45e8
commit b888531d20
4 changed files with 312 additions and 2 deletions

View file

@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.55 2015/06/29 21:44:10 fhajny Exp $
# $NetBSD: Makefile,v 1.56 2015/07/17 14:25:42 fhajny Exp $
DISTNAME= ejabberd-15.06
PKGREVISION= 1
CATEGORIES= chat
MASTER_SITES= http://www.process-one.net/downloads/ejabberd/${PKGVERSION_NOREV}/
EXTRACT_SUFX= .tgz

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.34 2015/06/29 21:44:10 fhajny Exp $
$NetBSD: distinfo,v 1.35 2015/07/17 14:25:42 fhajny Exp $
SHA1 (ejabberd-15.06-deps.tar.gz) = b3704208c5756c7c717477b9c66e7f5853b6d91e
RMD160 (ejabberd-15.06-deps.tar.gz) = 3ae7d5d31befe7717322253d7692bc3b33172042
@ -10,3 +10,5 @@ SHA1 (patch-aa) = 5025927e6be5792fa8e59541938950d901b91ee5
SHA1 (patch-ad) = cdd7a61333f3206ac3ae9168b1878a059da25988
SHA1 (patch-ae) = a9340add286fe4b70ce0ac6b75a2f9162b8c4e7d
SHA1 (patch-configure) = 8cf03f571ef13ed825b445e0f1664d387895b8fe
SHA1 (patch-erlang17) = c01196a914d2be84f1639d64e83fe1a12e52f7ee
SHA1 (patch-erlang18) = 80e9a83bfa5e6264231088df4ec8e7a1c0cc277f

View file

@ -0,0 +1,104 @@
$NetBSD: patch-erlang17,v 1.1 2015/07/17 14:25:42 fhajny Exp $
Patch to build with Erlang 17/18 based on FreeBSD ports.
https://svnweb.freebsd.org/ports/head/net-im/ejabberd/files/patch-erlang-17-dict-queue?revision=390878&view=co
--- ../deps/esip/src/esip_listener.erl.orig
+++ ../deps/esip/src/esip_listener.erl
@@ -37,7 +37,11 @@
-include("esip_lib.hrl").
-define(TCP_SEND_TIMEOUT, 10000).
+-ifdef(ERLANG_17).
+-record(state, {listeners = dict:new() :: dict:dict()}).
+-else.
-record(state, {listeners = dict:new() :: dict()}).
+-endif.
%%%===================================================================
%%% API
$FreeBSD$
--- ../deps/esip/rebar.config.orig
+++ ../deps/esip/rebar.config
@@ -1,4 +1,5 @@
-{erl_opts, [{i, "include"},
+{erl_opts, [{platform_define, "^1[78]-", 'ERLANG_17'},
+ {i, "include"},
{i, "deps/p1_stun/include"},
{i, "../p1_stun/include"}]}.
$FreeBSD$
--- ../deps/p1_stun/src/turn.erl.orig
+++ ../deps/p1_stun/src/turn.erl
@@ -56,6 +56,29 @@
-type addr() :: {inet:ip_address(), inet:port_number()}.
+-ifdef(ERLANG_17).
+-record(state,
+ {sock_mod = gen_udp :: gen_udp | gen_tcp | p1_tls,
+ sock :: inet:socket() | p1_tls:tls_socket(),
+ addr = {{0,0,0,0}, 0} :: addr(),
+ owner = self() :: pid(),
+ username = <<"">> :: binary(),
+ realm = <<"">> :: binary(),
+ key = {<<"">>, <<"">>, <<"">>} :: {binary(), binary(), binary()},
+ server_name = <<"">> :: binary(),
+ permissions = ?DICT:new() :: dict:dict(),
+ channels = ?DICT:new() :: dict:dict(),
+ max_permissions :: non_neg_integer() | atom(),
+ relay_ip = {127,0,0,1} :: inet:ip_address(),
+ min_port = 49152 :: non_neg_integer(),
+ max_port = 65535 :: non_neg_integer(),
+ relay_addr :: addr(),
+ relay_sock :: inet:socket(),
+ last_trid :: non_neg_integer(),
+ last_pkt = <<>> :: binary(),
+ seq = 1 :: non_neg_integer(),
+ life_timer :: reference()}).
+-else.
-record(state,
{sock_mod = gen_udp :: gen_udp | gen_tcp | p1_tls,
sock :: inet:socket() | p1_tls:tls_socket(),
@@ -77,6 +100,7 @@
last_pkt = <<>> :: binary(),
seq = 1 :: non_neg_integer(),
life_timer :: reference()}).
+-endif.
%%====================================================================
%% API
$FreeBSD$
--- ../deps/p1_stun/rebar.config.orig
+++ ../deps/p1_stun/rebar.config
@@ -1,4 +1,5 @@
-{erl_opts, [debug_info, {i, "include"}]}.
+{erl_opts, [{platform_define, "^1[78]-", 'ERLANG_17'},
+ debug_info, {i, "include"}]}.
{deps, [{p1_tls, ".*", {git, "git://github.com/processone/tls.git"}},
{p1_utils, ".*", {git, "git://github.com/processone/p1_utils.git"}}]}.
$FreeBSD$
--- ../deps/p1_stun/src/stun_listener.erl.orig
+++ ../deps/p1_stun/src/stun_listener.erl
@@ -36,7 +36,11 @@
terminate/2, code_change/3]).
-define(TCP_SEND_TIMEOUT, 10000).
+-ifdef(ERLANG_17).
+-record(state, {listeners = dict:new() :: dict:dict()}).
+-else.
-record(state, {listeners = dict:new() :: dict()}).
+-endif.
%%%===================================================================
%%% API

View file

@ -0,0 +1,203 @@
$NetBSD: patch-erlang18,v 1.1 2015/07/17 14:25:42 fhajny Exp $
Patch to build with Erlang 18 based on FreeBSD ports.
https://svnweb.freebsd.org/ports/head/net-im/ejabberd/files/patch-erlang-18
diff -ruN --exclude '*.orig' ../deps/esip/src/esip.erl ../deps/esip/src/esip.erl
--- ../deps/esip/src/esip.erl 2015-01-14 12:52:19.000000000 +0100
+++ ../deps/esip/src/esip.erl 2015-06-25 10:20:59.000000000 +0200
@@ -739,7 +739,7 @@
%% gen_server callbacks
%%====================================================================
init([]) ->
- {A, B, C} = now(),
+ {A, B, C} = erlang:timestamp(),
random:seed(A, B, C),
ets:new(esip_config, [named_table, public]),
set_config([]),
diff -ruN --exclude '*.orig' ../deps/esip/src/esip_codec.erl ../deps/esip/src/esip_codec.erl
--- ../deps/esip/src/esip_codec.erl 2015-01-14 12:52:19.000000000 +0100
+++ ../deps/esip/src/esip_codec.erl 2015-06-25 10:21:17.000000000 +0200
@@ -1334,10 +1334,10 @@
io:format("~n== Estimate: ~p~n", [T div N]).
test_loop(P, Msg, N) ->
- test_loop(P, Msg, N, now()).
+ test_loop(P, Msg, N, erlang:timestamp()).
test_loop(P, _, 0, T) ->
- P ! {ok, timer:now_diff(now(), T)};
+ P ! {ok, timer:now_diff(erlang:timestamp(), T)};
test_loop(P, Msg, N, T) ->
decode(Msg),
test_loop(P, Msg, N-1, T).
diff -ruN --exclude '*.orig' ../deps/esip/src/esip_transaction.erl ../deps/esip/src/esip_transaction.erl
--- ../deps/esip/src/esip_transaction.erl 2015-01-14 12:52:19.000000000 +0100
+++ ../deps/esip/src/esip_transaction.erl 2015-06-25 10:20:38.000000000 +0200
@@ -205,9 +205,9 @@
maybe_report_error(Type, N) ->
case ets:lookup(?MODULE, {last_error_report, Type}) of
[{_, Now}] ->
- case timer:now_diff(now(), Now) of
+ case timer:now_diff(erlang:timestamp(), Now) of
T when T > 60000000 ->
- ets:insert(?MODULE, {{last_error_report, Type}, now()}),
+ ets:insert(?MODULE, {{last_error_report, Type}, erlang:timestamp()}),
?ERROR_MSG("too many ~s transactions: ~p", [Type, N]);
_ ->
ok
diff -ruN --exclude '*.orig' ../deps/p1_cache_tab/src/cache_tab.erl ../deps/p1_cache_tab/src/cache_tab.erl
--- ../deps/p1_cache_tab/src/cache_tab.erl 2015-01-14 12:52:24.000000000 +0100
+++ ../deps/p1_cache_tab/src/cache_tab.erl 2015-06-25 10:22:59.000000000 +0200
@@ -405,7 +405,7 @@
[get_proc(Tab, N) || N <- lists:seq(1, get_proc_num())].
now_priority() ->
- {MSec, Sec, USec} = now(),
+ {MSec, Sec, USec} = erlang:timestamp(),
-((MSec*1000000 + Sec)*1000000 + USec).
clean_priority(LifeTime) ->
@@ -594,20 +594,20 @@
test3(Iter) ->
ok = new(test_tbl, [{max_size, unlimited}, {life_time, unlimited}]),
L = lists:seq(1, Iter),
- T1 = now(),
+ T1 = erlang:timestamp(),
lists:foreach(
fun(N) ->
ok = ?insert(test_tbl, N, N, fun() -> ok end)
end, L),
io:format("** average insert (size = ~p): ~p usec~n",
- [Iter, round(timer:now_diff(now(), T1)/Iter)]),
- T2 = now(),
+ [Iter, round(timer:now_diff(erlang:timestamp(), T1)/Iter)]),
+ T2 = erlang:timestamp(),
lists:foreach(
fun(N) ->
{ok, N} = ?lookup(test_tbl, N, fun() -> ok end)
end, L),
io:format("** average lookup (size = ~p): ~p usec~n",
- [Iter, round(timer:now_diff(now(), T2)/Iter)]),
+ [Iter, round(timer:now_diff(erlang:timestamp(), T2)/Iter)]),
{ok, Iter} = info(test_tbl, size),
delete(test_tbl).
diff -ruN --exclude '*.orig' ../deps/p1_stun/src/stun.erl ../deps/p1_stun/src/stun.erl
--- ../deps/p1_stun/src/stun.erl 2015-01-14 12:52:02.000000000 +0100
+++ ../deps/p1_stun/src/stun.erl 2015-06-25 10:22:10.000000000 +0200
@@ -583,7 +583,7 @@
end.
now_priority() ->
- {MSec, Sec, USec} = now(),
+ {MSec, Sec, USec} = erlang:timestamp(),
-((MSec*1000000 + Sec)*1000000 + USec).
clean_treap(Treap, CleanPriority) ->
@@ -647,7 +647,7 @@
{ok, Sock}.
seed() ->
- {A, B, C} = now(),
+ {A, B, C} = erlang:timestamp(),
random:seed(A, B, C).
prepare_response(State, Msg) ->
diff -ruN --exclude '*.orig' ../deps/p1_stun/src/stun_shaper.erl ../deps/p1_stun/src/stun_shaper.erl
--- ../deps/p1_stun/src/stun_shaper.erl 2014-05-19 04:09:58.000000000 +0200
+++ ../deps/p1_stun/src/stun_shaper.erl 2015-06-25 10:21:53.000000000 +0200
@@ -46,7 +46,7 @@
new(none) -> none;
new(MaxRate) when is_integer(MaxRate) ->
#maxrate{maxrate = MaxRate, lastrate = 0.0,
- lasttime = now_to_usec(now())}.
+ lasttime = now_to_usec(erlang:timestamp())}.
-spec update(shaper(), integer()) -> {shaper(), integer()}.
@@ -54,13 +54,13 @@
update(#maxrate{} = State, Size) ->
MinInterv = 1000 * Size /
(2 * State#maxrate.maxrate - State#maxrate.lastrate),
- Interv = (now_to_usec(now()) - State#maxrate.lasttime) /
+ Interv = (now_to_usec(erlang:timestamp()) - State#maxrate.lasttime) /
1000,
Pause = if MinInterv > Interv ->
1 + trunc(MinInterv - Interv);
true -> 0
end,
- NextNow = now_to_usec(now()) + Pause * 1000,
+ NextNow = now_to_usec(erlang:timestamp()) + Pause * 1000,
{State#maxrate{lastrate =
(State#maxrate.lastrate +
1000000 * Size / (NextNow - State#maxrate.lasttime))
diff -ruN --exclude '*.orig' ../deps/p1_stun/src/stun_test.erl ../deps/p1_stun/src/stun_test.erl
--- ../deps/p1_stun/src/stun_test.erl 2014-05-19 04:09:58.000000000 +0200
+++ ../deps/p1_stun/src/stun_test.erl 2015-06-25 10:21:35.000000000 +0200
@@ -356,7 +356,7 @@
end.
mk_trid() ->
- {A, B, C} = now(),
+ {A, B, C} = erlang:timestamp(),
random:seed(A, B, C),
random:uniform(1 bsl 96).
diff -ruN --exclude '*.orig' ../deps/p1_stun/src/turn.erl ../deps/p1_stun/src/turn.erl
--- ../deps/p1_stun/src/turn.erl 2014-05-19 04:09:58.000000000 +0200
+++ ../deps/p1_stun/src/turn.erl 2015-06-25 10:16:52.000000000 +0200
@@ -64,8 +64,8 @@
realm = <<"">> :: binary(),
key = {<<"">>, <<"">>, <<"">>} :: {binary(), binary(), binary()},
server_name = <<"">> :: binary(),
- permissions = ?DICT:new() :: dict(),
- channels = ?DICT:new() :: dict(),
+ permissions = ?DICT:new() :: dict:dict(),
+ channels = ?DICT:new() :: dict:dict(),
max_permissions :: non_neg_integer() | atom(),
relay_ip = {127,0,0,1} :: inet:ip_address(),
min_port = 49152 :: non_neg_integer(),
@@ -117,7 +117,7 @@
ok
end,
TRef = erlang:start_timer(?DEFAULT_LIFETIME, self(), stop),
- {A1, A2, A3} = now(),
+ {A1, A2, A3} = erlang:timestamp(),
random:seed(A1, A2, A3),
case turn_sm:add_allocation(AddrPort, Username, Realm, MaxAllocs, self()) of
ok ->
diff -ruN --exclude '*.orig' ../deps/p1_utils/src/p1_fsm.erl ../deps/p1_utils/src/p1_fsm.erl
--- ../deps/p1_utils/src/p1_fsm.erl 2014-07-28 01:40:11.000000000 +0200
+++ ../deps/p1_utils/src/p1_fsm.erl 2015-06-25 10:22:37.000000000 +0200
@@ -601,12 +601,12 @@
true ->
Time1
end,
- Now = now(),
+ Now = erlang:timestamp(),
Reason = case catch rpc_call(Node, M, F, A, RPCTimeout) of
{ok, Clone} ->
process_flag(trap_exit, true),
MRef = erlang:monitor(process, Clone),
- NowDiff = timer:now_diff(now(), Now) div 1000,
+ NowDiff = timer:now_diff(erlang:timestamp(), Now) div 1000,
TimeLeft = lists:max([Time1 - NowDiff, 0]),
TRef = erlang:start_timer(TimeLeft, self(), timeout),
relay_messages(MRef, TRef, Clone, Queue);
@@ -664,12 +664,12 @@
true ->
Time1
end,
- Now = now(),
+ Now = erlang:timestamp(),
Reason = case catch rpc_call(Node, M, F, A, RPCTimeout) of
{ok, Clone} ->
process_flag(trap_exit, true),
MRef = erlang:monitor(process, Clone),
- NowDiff = timer:now_diff(now(), Now) div 1000,
+ NowDiff = timer:now_diff(erlang:timestamp(), Now) div 1000,
TimeLeft = lists:max([Time1 - NowDiff, 0]),
TRef = erlang:start_timer(TimeLeft, self(), timeout),
relay_messages(MRef, TRef, Clone, Queue);