File 0385-Add-missing-wx-dependencies.patch of Package erlang

From cf0fc1d1d1ddde5f52cf7ed3d36fae4df88b9500 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Henrique=20Ferreira=20de=20Freitas?=
 <joaohf@gmail.com>
Date: Tue, 8 Apr 2025 17:23:25 -0300
Subject: [PATCH] Add missing wx dependencies

The following applications:

 - et
 - observer
 - debugger
 - reltool

And also the wx/examples/[simple,demo,sudoku] depends on wx application
in order to build properly.

When cross compiling Erlang/OTP [1], there are cases where the initial
bootstrap system (which in most of the cases is just the same Erlang/OTP
version but built for host) may not have Erlang wx application enabled.
Thus when cross compiling the above applications will not able to found
wx.hrl and wx behaviour files.

That is because the target build should look into ERL_TOP in order to
see the missing dependencies.

Without the proper ERL_COMPILE_FLAGS the build will try to use from the
host system, which in my case does not have wx enabled.

1: https://github.com/erlang/otp/blob/master/HOWTO/INSTALL-CROSS.md
---
 lib/debugger/src/Makefile       | 2 +-
 lib/et/src/Makefile             | 6 +++++-
 lib/observer/src/Makefile       | 2 ++
 lib/reltool/src/Makefile        | 3 ++-
 lib/wx/examples/demo/Makefile   | 3 ++-
 lib/wx/examples/simple/Makefile | 3 ++-
 lib/wx/examples/sudoku/Makefile | 3 ++-
 7 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/lib/debugger/src/Makefile b/lib/debugger/src/Makefile
index 65ad9d46e7..e85f9fd7e1 100644
--- a/lib/debugger/src/Makefile
+++ b/lib/debugger/src/Makefile
@@ -87,7 +87,7 @@ APPUP_TARGET = $(EBIN)/$(APPUP_FILE)
 # ----------------------------------------------------
 # FLAGS
 # ----------------------------------------------------
-ERL_COMPILE_FLAGS += -Werror
+ERL_COMPILE_FLAGS += -Werror -I $(ERL_TOP)/lib -pa $(ERL_TOP)/lib/wx/ebin
 
 
 # ----------------------------------------------------
diff --git a/lib/et/src/Makefile b/lib/et/src/Makefile
index 819d28a343..b386accf53 100644
--- a/lib/et/src/Makefile
+++ b/lib/et/src/Makefile
@@ -68,7 +68,11 @@ APPUP_TARGET = $(EBIN)/$(APPUP_FILE)
 # ----------------------------------------------------
 # FLAGS
 # ----------------------------------------------------
-ERL_COMPILE_FLAGS += -pa $(ERL_TOP)/lib/et/ebin -I../include -Werror
+ERL_COMPILE_FLAGS += -pa $(ERL_TOP)/lib/et/ebin \
+		     -pa $(ERL_TOP)/lib/wx/ebin \
+		     -I../include \
+		     -I $(ERL_TOP)/lib \
+		     -Werror
 
 # ----------------------------------------------------
 # Special Build Targets
diff --git a/lib/observer/src/Makefile b/lib/observer/src/Makefile
index a678b5acbd..a07e4feadf 100644
--- a/lib/observer/src/Makefile
+++ b/lib/observer/src/Makefile
@@ -125,6 +125,8 @@ ERL_COMPILE_FLAGS += \
 	-I../include \
 	-I ../../et/include \
 	-I ../../../libraries/et/include \
+	-I $(ERL_TOP)/lib \
+	-pa $(ERL_TOP)/lib/wx/ebin \
 	-Werror
 
 # ----------------------------------------------------
diff --git a/lib/reltool/src/Makefile b/lib/reltool/src/Makefile
index 935116322c..6423cab564 100644
--- a/lib/reltool/src/Makefile
+++ b/lib/reltool/src/Makefile
@@ -61,7 +61,8 @@ APPUP_TARGET = $(EBIN)/$(APPUP_FILE)
 
 ERL_COMPILE_FLAGS += +'{parse_transform,sys_pre_attributes}' \
                      +'{attribute,insert,app_vsn,$(APP_VSN)}' \
-		     -Werror
+		     -Werror \
+		     -I $(ERL_TOP)/lib
 
 # ----------------------------------------------------
 # Targets
diff --git a/lib/wx/examples/demo/Makefile b/lib/wx/examples/demo/Makefile
index 63b59ee333..c67c22fa08 100644
--- a/lib/wx/examples/demo/Makefile
+++ b/lib/wx/examples/demo/Makefile
@@ -63,7 +63,8 @@ TESTMODS = \
 TESTTARGETS = $(TESTMODS:%=%.beam)
 TESTSRC = $(TESTMODS:%=%.erl)
 
-ERL_COMPILE_FLAGS += +nowarn_missing_doc +nowarn_missing_spec_documented
+ERL_COMPILE_FLAGS += +nowarn_missing_doc +nowarn_missing_spec_documented \
+		     -I $(ERL_TOP)/lib -pa $(ERL_TOP)/lib/wx/ebin
 
 # Targets
 $(TYPES):	$(TESTTARGETS)
diff --git a/lib/wx/examples/simple/Makefile b/lib/wx/examples/simple/Makefile
index c5371d839f..f444451eab 100644
--- a/lib/wx/examples/simple/Makefile
+++ b/lib/wx/examples/simple/Makefile
@@ -32,7 +32,8 @@ TESTMODS = hello hello2 minimal menu
 TESTTARGETS = $(TESTMODS:%=%.beam)
 TESTSRC = $(TESTMODS:%=%.erl)
 
-ERL_COMPILE_FLAGS += +nowarn_missing_doc +nowarn_missing_spec_documented
+ERL_COMPILE_FLAGS += +nowarn_missing_doc +nowarn_missing_spec_documented \
+		     -I $(ERL_TOP)/lib -pa $(ERL_TOP)/lib/wx/ebin
 
 # Targets
 $(TYPES):	$(TESTTARGETS)
diff --git a/lib/wx/examples/sudoku/Makefile b/lib/wx/examples/sudoku/Makefile
index 6434f6eb51..55e108e610 100644
--- a/lib/wx/examples/sudoku/Makefile
+++ b/lib/wx/examples/sudoku/Makefile
@@ -32,7 +32,8 @@ TESTMODS = sudoku sudoku_board sudoku_game sudoku_gui
 TESTTARGETS = $(TESTMODS:%=%.beam)
 TESTSRC = $(TESTMODS:%=%.erl)
 
-ERL_COMPILE_FLAGS += +nowarn_missing_doc +nowarn_missing_spec_documented
+ERL_COMPILE_FLAGS += +nowarn_missing_doc +nowarn_missing_spec_documented \
+		     -I $(ERL_TOP)/lib -pa $(ERL_TOP)/lib/wx/ebin
 
 # Targets
 $(TYPES):	$(TESTTARGETS)
-- 
2.43.0

openSUSE Build Service is sponsored by