File: Fix-cross-build-failures.patch

package info (click to toggle)
luanti 5.10.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 44,212 kB
  • sloc: cpp: 235,338; java: 4,662; sh: 854; ansic: 450; xml: 335; python: 304; makefile: 39
file content (37 lines) | stat: -rw-r--r-- 1,400 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From: Travis Wrightsman <travis@wrightsman.org>
Date: Wed, 16 Apr 2025 14:57:55 +0200
Subject: Fix cross build failures

Forwarded: https://github.com/luanti-org/luanti/pull/16030
Applied-Upstream: https://github.com/luanti-org/luanti/commit/0695541bf59b305cc6661deb5d57a30e92cb9c6c

luanti fails to cross build from source, because it attempts to create
/minetest and that happens to not work resulting in Permission denied as
expected. The root cause for this is that EXECUTABLE_OUTPUT_PATH ends up being
empty.

Co-authored-by: Helmut Grohne <helmut@subdivi.de>
---
 src/CMakeLists.txt | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 65e5ab6..c53c85f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -577,9 +577,12 @@ if(USE_CURL)
 endif()
 
 
-# When cross-compiling assume the user doesn't want to run the executable anyway,
-# otherwise place it in <source dir>/bin/ since Luanti can only run from there.
-if(NOT CMAKE_CROSSCOMPILING)
+# When cross-compiling place the executable in <build dir>/bin so that multiple
+# targets can be built from the same source folder. Otherwise, place it in
+# <source dir>/bin/ since Luanti can only run from there.
+if(CMAKE_CROSSCOMPILING)
+	set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
+else()
 	set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
 endif()