File 3721-erts-Add-file-properties-to-erl.exe.patch of Package erlang

From 9940a34a7efc527740ee1c04f0ecb5061b4cbf67 Mon Sep 17 00:00:00 2001
From: Dan Gudmundsson <dgud@erlang.org>
Date: Mon, 25 Oct 2021 13:28:21 +0200
Subject: [PATCH] erts: Add file properties to erl.exe

Add versions and product name to erl.exe and werl.exe
---
 erts/etc/common/Makefile.in  | 24 +++++++++++++++++++++++-
 erts/etc/win32/erl.rc        | 25 ++++++++++++++++++++++---
 erts/etc/win32/version.h.src |  7 +++++++
 3 files changed, 52 insertions(+), 4 deletions(-)
 create mode 100644 erts/etc/win32/version.h.src

diff --git a/erts/etc/common/Makefile.in b/erts/etc/common/Makefile.in
index ba4d898f79..48018b2c86 100644
--- a/erts/etc/common/Makefile.in
+++ b/erts/etc/common/Makefile.in
@@ -319,9 +319,31 @@ $(LOGMESS_GENERATED): $(WINETC)/erlsrv/erlsrv_logmess.mc
 	$(V_MC) -o $(OBJDIR) $(WINETC)/erlsrv/erlsrv_logmess.mc && \
 		echo $? >$(LOGMESS_GENERATED)
 
+#
+# Make version fit into max 4 integers separated by comma.
+#
+COMMA_CHAR := ,
+SPACE_CHAR := $(subst ,, )
+ERTS_VSN_COMMA_SEP := $(subst .,$(SPACE_CHAR),$(VSN))
+OTP_VSN_COMMA_SEP  := $(subst .,$(SPACE_CHAR),$(OTP_VERSION))
+
+ERTS_VSN_COMMA_SEP := $(wordlist 1,4, $(ERTS_VSN_COMMA_SEP))
+OTP_VSN_COMMA_SEP  := $(wordlist 1,4, $(OTP_VSN_COMMA_SEP))
+
+ERTS_VSN_COMMA_SEP := $(subst $(SPACE_CHAR),$(COMMA_CHAR),$(ERTS_VSN_COMMA_SEP))
+OTP_VSN_COMMA_SEP  := $(subst $(SPACE_CHAR),$(COMMA_CHAR),$(OTP_VSN_COMMA_SEP))
+
+$(WINETC)/version.h:   $(WINETC)/version.h.src
+	$(vsn_verbose)sed -e 's;%ERTS_VERSION%;$(VSN);' \
+	    -e 's;%ERTS_VERSION_INTS%;$(ERTS_VSN_COMMA_SEP);' \
+	    -e 's;%OTP_VERSION%;$(OTP_VERSION);' \
+	    -e 's;%OTP_VERSION_INTS%;$(OTP_VSN_COMMA_SEP);' \
+                  $(WINETC)/version.h.src > $(WINETC)/version.h
+
 $(OBJDIR)/$(ERLRES_OBJ): $(WINETC)/erl.rc $(WINETC)/erlang.ico \
 		$(WINETC)/erl_icon.ico $(WINETC)/hrl_icon.ico \
-		$(WINETC)/beam_icon.ico $(LOGMESS_GENERATED)
+		$(WINETC)/beam_icon.ico $(LOGMESS_GENERATED) \
+		$(WINETC)/version.h
 	$(V_RC) -o $@ -I$(WINETC) $(WINETC)/erl.rc
 
 ifeq ($(USING_VC), yes)
diff --git a/erts/etc/win32/erl.rc b/erts/etc/win32/erl.rc
index 772213ac86..3ff41b8eaa 100644
--- a/erts/etc/win32/erl.rc
+++ b/erts/etc/win32/erl.rc
@@ -19,12 +19,31 @@
 //
 #include <windows.h>
 #include "resource.h"
+#include "version.h"
 
 1           ICON    DISCARDABLE     "erlang.ico"
 
-
-
-
+VS_VERSION_INFO VERSIONINFO
+    FILEVERSION    ERTS_VERSION_INTS
+    PRODUCTVERSION OTP_VERSION_INTS
+{
+    BLOCK "StringFileInfo"
+    {
+        BLOCK "040904e4"
+        {
+            VALUE "CompanyName",        "Ericsson\0"
+            VALUE "FileDescription",    "Erlang\0"
+            VALUE "FileVersion",        ERTS_VERSION_STR
+            VALUE "LegalCopyright",     "Ericsson. All rights reserved.\0"
+            VALUE "ProductName",        "Erlang/OTP\0"
+            VALUE "ProductVersion",     OTP_VERSION_STR
+        }
+    }
+    BLOCK "VarFileInfo"
+    {
+        VALUE "Translation", 0x0409, 1252
+    }
+}
 
 
 
diff --git a/erts/etc/win32/version.h.src b/erts/etc/win32/version.h.src
new file mode 100644
index 0000000000..266ebda47d
--- /dev/null
+++ b/erts/etc/win32/version.h.src
@@ -0,0 +1,7 @@
+
+
+#define ERTS_VERSION_INTS %ERTS_VERSION_INTS%
+#define ERTS_VERSION_STR  "%ERTS_VERSION%\0"
+
+#define OTP_VERSION_INTS  %OTP_VERSION_INTS%
+#define OTP_VERSION_STR   "%OTP_VERSION%\0"
-- 
2.31.1

openSUSE Build Service is sponsored by