File 0004-rebar_port_compiler-remove-lerl_interface-for-Erlang.patch of Package rebar

From 406e8f4822d073f336f73c0b7ba6e1730918c22b Mon Sep 17 00:00:00 2001
From: Led <ledest@gmail.com>
Date: Sun, 16 Aug 2020 02:11:49 +0300
Subject: [PATCH] rebar_port_compiler: remove '-lerl_interface' for Erlang/OTP
 >= 23

---
 src/rebar_port_compiler.erl | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index 94b8602..595809a 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -35,6 +35,15 @@
 
 -include("rebar.hrl").
 
+-ifdef(OTP_RELEASE).
+-if(?OTP_RELEASE < 23).
+-define(ERL_INTERFACE, "-lerl_interface ").
+-endif.
+-endif.
+-ifndef(ERL_INTERFACE).
+-define(ERL_INTERFACE, "").
+-endif.
+
 -record(spec, {type::'drv' | 'exe',
                link_lang::'cc' | 'cxx',
                target::file:filename(),
@@ -137,7 +146,7 @@ info_help(Description) ->
        "           CXXFLAGS - C++ compiler~n"
        "           LDFLAGS  - Link flags~n"
        "           ERL_CFLAGS  - default -I paths for erts and ei~n"
-       "           ERL_LDFLAGS - default -L and -lerl_interface -lei~n"
+       "           ERL_LDFLAGS - default -L and " ?ERL_INTERFACE "-lei~n"
        "           DRV_CFLAGS  - flags that will be used for compiling~n"
        "           DRV_LDFLAGS - flags that will be used for linking~n"
        "           EXE_CFLAGS  - flags that will be used for compiling~n"
@@ -674,7 +683,7 @@ default_env() ->
                       ])},
      {"ERL_EI_LIBDIR", lists:concat(["\"", erl_interface_dir(lib), "\""])},
      {"ERL_LDFLAGS"  , "-L$ERL_EI_LIBDIR"},
-     {"ERL_LIBS"     , "-lerl_interface -lei"},
+     {"ERL_LIBS"     , ?ERL_INTERFACE "-lei"},
      {"ERLANG_ARCH"  , rebar_utils:wordsize()},
      {"ERLANG_TARGET", rebar_utils:get_arch()},
 
-- 
2.26.2

openSUSE Build Service is sponsored by