rebar.config.script 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. %% -*- mode: erlang -*-
  2. IsCentos6 = fun() ->
  3. case file:read_file("/etc/centos-release") of
  4. {ok, <<"CentOS release 6", _/binary >>} ->
  5. true;
  6. _ ->
  7. false
  8. end
  9. end,
  10. IsWin32 = fun() ->
  11. win32 =:= element(1, os:type())
  12. end,
  13. IsMacOS = fun() ->
  14. {unix, darwin} =:= os:type()
  15. end,
  16. IsQuicSupp = fun() ->
  17. not (IsCentos6() orelse IsWin32()
  18. orelse IsMacOS() orelse
  19. false =/= os:getenv("BUILD_WITHOUT_QUIC")
  20. )
  21. orelse "1" == os:getenv("BUILD_WITH_QUIC")
  22. end,
  23. Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}},
  24. Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.9"}}},
  25. ExtraDeps = fun(C) ->
  26. {deps, Deps0} = lists:keyfind(deps, 1, C),
  27. Deps = Deps0 ++ [Bcrypt || not IsWin32()] ++
  28. [ Quicer || IsQuicSupp()],
  29. lists:keystore(deps, 1, C, {deps, Deps})
  30. end,
  31. ExtraDeps(CONFIG).