File 0296-otp-Install-erl_call-into-erts-and-toplevel-bin.patch of Package erlang
From 88ffb804a6545e9626915c447b8647d58a0ec929 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Wed, 22 Apr 2020 15:33:11 +0200
Subject: [PATCH 1/3] otp: Install erl_call into erts and toplevel bin
We do this in order to make erl_call available even in systems
that are not deployed with erl_interface.
---
 erts/Makefile                     |  2 ++
 erts/etc/common/Makefile.in       | 34 +++++++++++++++++++++++++++-------
 erts/etc/unix/Install.src         |  1 +
 erts/etc/win32/Install.c          |  2 +-
 lib/erl_interface/src/Makefile.in |  2 --
 5 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/erts/Makefile b/erts/Makefile
index 5ca0167fb3..7808dccecc 100644
--- a/erts/Makefile
+++ b/erts/Makefile
@@ -79,6 +79,7 @@ local_setup:
 		cp $(ERL_TOP)/bin/$(TARGET)/ct_run.exe $(ERL_TOP)/bin/ct_run.exe; \
 		cp $(ERL_TOP)/bin/$(TARGET)/erlc.exe $(ERL_TOP)/bin/erlc.exe; \
 		cp $(ERL_TOP)/bin/$(TARGET)/erl.exe $(ERL_TOP)/bin/erl.exe; \
+		cp $(ERL_TOP)/bin/$(TARGET)/erl_call.exe $(ERL_TOP)/bin/erl_call.exe; \
 		cp $(ERL_TOP)/bin/$(TARGET)/werl.exe $(ERL_TOP)/bin/werl.exe; \
 		cp $(ERL_TOP)/bin/$(TARGET)/escript.exe $(ERL_TOP)/bin/escript.exe; \
 	 	chmod 755 $(ERL_TOP)/bin/erl.exe $(ERL_TOP)/bin/erlc.exe \
@@ -94,6 +95,7 @@ local_setup:
 		-e "s;%TARGET%;$(TARGET);"    \
 		-e "s;%VSN%;$(VSN);"    \
 	        $(ERL_TOP)/erts/etc/unix/cerl.src > $(ERL_TOP)/bin/cerl; \
+		cp $(ERL_TOP)/bin/$(TARGET)/erl_call $(ERL_TOP)/bin/erl_call; \
 		cp $(ERL_TOP)/bin/$(TARGET)/dialyzer $(ERL_TOP)/bin/dialyzer; \
 		cp $(ERL_TOP)/bin/$(TARGET)/typer $(ERL_TOP)/bin/typer; \
 		cp $(ERL_TOP)/bin/$(TARGET)/ct_run $(ERL_TOP)/bin/ct_run; \
diff --git a/erts/etc/common/Makefile.in b/erts/etc/common/Makefile.in
index ef40341c87..650ab1f6fe 100644
--- a/erts/etc/common/Makefile.in
+++ b/erts/etc/common/Makefile.in
@@ -154,7 +154,14 @@ MC_OUTPUTS=$(OBJDIR)/erlsrv_logmess.h $(OBJDIR)/erlsrv_logmess.res
 MT_FLAG="-MD"
 endif
 INET_GETHOST = $(BINDIR)/inet_gethost.exe
-INSTALL_EMBEDDED_PROGS += $(BINDIR)/typer.exe $(BINDIR)/dialyzer.exe $(BINDIR)/erlc.exe $(BINDIR)/start_erl.exe $(BINDIR)/escript.exe $(BINDIR)/ct_run.exe
+INSTALL_EMBEDDED_PROGS += \
+	$(BINDIR)/typer.exe \
+	$(BINDIR)/dialyzer.exe \
+	$(BINDIR)/erlc.exe \
+	$(BINDIR)/start_erl.exe \
+	$(BINDIR)/escript.exe \
+	$(BINDIR)/ct_run.exe \
+	$(BINDIR)/erl_call.exe
 INSTALL_SRC = $(WINETC)/start_erl.c $(WINETC)/Nmakefile.start_erl
 ERLEXECDIR=.
 INSTALL_LIBS =
@@ -165,9 +172,11 @@ INSTALL_TOP = Install.ini
 INSTALL_TOP_BIN = $(BINDIR)/Install.exe
 INSTALL_PROGS =              \
 	$(INET_GETHOST)      \
-	$(BINDIR)/heart.exe   $(BINDIR)/erlsrv.exe   \
-	$(BINDIR)/erl.exe $(BINDIR)/erl_log.exe \
-	$(BINDIR)/werl.exe \
+	$(BINDIR)/heart.exe  \
+	$(BINDIR)/erlsrv.exe \
+	$(BINDIR)/erl.exe    \
+	$(BINDIR)/erl_log.exe\
+	$(BINDIR)/werl.exe   \
 	$(BINDIR)/$(ERLEXEC) \
 	$(INSTALL_EMBEDDED_PROGS)
 
@@ -187,9 +196,16 @@ ENTRY_OBJ=
 ERLSRV_OBJECTS= 
 MC_OUTPUTS=
 INET_GETHOST = $(BINDIR)/inet_gethost@EXEEXT@
-INSTALL_EMBEDDED_PROGS += $(BINDIR)/typer@EXEEXT@ $(BINDIR)/dialyzer@EXEEXT@ \
- $(BINDIR)/erlc@EXEEXT@ $(BINDIR)/escript@EXEEXT@ $(BINDIR)/ct_run@EXEEXT@ \
- $(BINDIR)/run_erl $(BINDIR)/to_erl $(BINDIR)/dyn_erl
+INSTALL_EMBEDDED_PROGS += \
+	$(BINDIR)/typer@EXEEXT@ \
+	$(BINDIR)/dialyzer@EXEEXT@ \
+	$(BINDIR)/erlc@EXEEXT@ \
+	$(BINDIR)/escript@EXEEXT@ \
+	$(BINDIR)/ct_run@EXEEXT@ \
+	$(BINDIR)/run_erl@EXEEXT@ \
+	$(BINDIR)/to_erl@EXEEXT@ \
+	$(BINDIR)/dyn_erl@EXEEXT@ \
+	$(BINDIR)/erl_call@EXEEXT@
 INSTALL_EMBEDDED_DATA = $(UXETC)/start.src $(UXETC)/start_erl.src
 INSTALL_TOP = Install
 INSTALL_TOP_BIN = 
@@ -424,6 +440,10 @@ $(OBJDIR)/dyn_erl.o: $(UXETC)/dyn_erl.c $(RC_GENERATED)
 $(OBJDIR)/safe_string.o: $(ETC)/safe_string.c $(RC_GENERATED)
 	$(V_CC) $(CFLAGS) -o $@ -c $(ETC)/safe_string.c
 
+# erl_call
+$(BINDIR)/erl_call@EXEEXT@: $(ERL_TOP)/lib/erl_interface/bin/$(TARGET)/erl_call@EXEEXT@
+	$(ld_verbose)cp $< $@
+
 ifneq ($(TARGET),win32)
 $(BINDIR)/$(ERLEXEC): $(OBJDIR)/$(ERLEXEC).o $(ERTS_LIB)
 	$(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/$(ERLEXEC).o $(ERTS_INTERNAL_LIBS)
diff --git a/erts/etc/unix/Install.src b/erts/etc/unix/Install.src
index e4b842877c..2dbf628972 100644
--- a/erts/etc/unix/Install.src
+++ b/erts/etc/unix/Install.src
@@ -88,6 +88,7 @@ cd "$ERL_ROOT/bin"
 
 cp -p "$ERL_ROOT/erts-%I_VSN%/bin/erl" .
 cp -p "$ERL_ROOT/erts-%I_VSN%/bin/erlc" .
+cp -p "$ERL_ROOT/erts-%I_VSN%/bin/erl_call" .
 cp -p "$ERL_ROOT/erts-%I_VSN%/bin/dialyzer" .
 cp -p "$ERL_ROOT/erts-%I_VSN%/bin/typer" .
 cp -p "$ERL_ROOT/erts-%I_VSN%/bin/ct_run" .
diff --git a/erts/etc/win32/Install.c b/erts/etc/win32/Install.c
index 06594a107f..c7bf96c124 100644
--- a/erts/etc/win32/Install.c
+++ b/erts/etc/win32/Install.c
@@ -47,7 +47,7 @@ int wmain(int argc, wchar_t **argv)
     InitFile *ini_file;
     InitSection *ini_section;
     HANDLE module = GetModuleHandle(NULL);
-    wchar_t *binaries[] = { L"erl.exe", L"werl.exe", L"erlc.exe",
+    wchar_t *binaries[] = { L"erl.exe", L"werl.exe", L"erlc.exe", L"erl_call.exe",
 			    L"dialyzer.exe",
 			    L"typer.exe",
 			    L"escript.exe", L"ct_run.exe", NULL };
diff --git a/lib/erl_interface/src/Makefile.in b/lib/erl_interface/src/Makefile.in
index 5a07b5542a..98356f2eb7 100644
--- a/lib/erl_interface/src/Makefile.in
+++ b/lib/erl_interface/src/Makefile.in
@@ -745,9 +745,7 @@ release: opt
 	$(INSTALL_DATA) $(HEADERS)     "$(RELEASE_PATH)/usr/include"
 	$(INSTALL_DATA) $(OBJ_TARGETS) "$(RELSYSDIR)/lib"
 	$(INSTALL_DATA) $(OBJ_TARGETS) "$(RELEASE_PATH)/usr/lib"
-ifneq ($(EXE_TARGETS),)
 	$(INSTALL_PROGRAM) $(EXE_TARGETS) "$(RELSYSDIR)/bin"
-endif
 	$(INSTALL_DATA) $(EXTRA)        "$(RELSYSDIR)/src"
 	$(INSTALL_DATA) connect/*.[ch]  "$(RELSYSDIR)/src/connect"
 	$(INSTALL_DATA) decode/*.[ch]   "$(RELSYSDIR)/src/decode"
-- 
2.16.4