cmake: fix build and detection of secondary arch

- /boot/system/lib/x86 may not be the last path in the list, as is the
case with clang after packaged version 12.
- We need libbsd to find arc4random_buf and avoid a redefinition.
- cpuid_info only exists for x86 arches.

Related: #10864
Fixes: #10234
This commit is contained in:
Máximo Castañeda
2024-08-29 20:34:07 +02:00
committed by Adrien Destugues
parent 7189a5d495
commit 5783507269
2 changed files with 62 additions and 29 deletions

View File

@@ -91,6 +91,8 @@ defineDebugInfoPackage cmake$secondaryArchSuffix \
BUILD()
{
export LDFLAGS="-lbsd"
# not an autotools configure
./configure --prefix=$prefix \
--datadir=/$relativeDataDir/cmake \

View File

@@ -1,4 +1,4 @@
From d11f934441fa7630881fc76fd86217addea4fefb Mon Sep 17 00:00:00 2001
From 33ea1830a803f66c59f38589805e43656faca0e7 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 24 Mar 2018 14:19:43 +0100
Subject: Fix search path for Lua headers.
@@ -18,10 +18,10 @@ index 405a7a7..f7fa477 100644
~/Library/Frameworks
/Library/Frameworks
--
2.42.1
2.45.2
From 5a31441dba597acdfe41aabd049565afc924a1e3 Mon Sep 17 00:00:00 2001
From 32a31d4fa17df1ccb37779ceeb6d8fddcccfd503 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 7 Sep 2019 17:29:56 +0200
Subject: links against libnetwork
@@ -42,10 +42,10 @@ index 115c354..84a9759 100755
fi
if test "x${bootstrap_system_libuv}" = "x"; then
--
2.42.1
2.45.2
From 853d17e4b682fdeaeda1da342c12f946e123f0e9 Mon Sep 17 00:00:00 2001
From 680263a7958afb47452a72170386bdb136e7772f Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 7 Sep 2019 23:46:47 +0200
Subject: bootstrap uses cmlibuv
@@ -77,45 +77,46 @@ index d0b0e00..e7ed773 100644
return 0;
}
--
2.42.1
2.45.2
From 208ce84930cb4056529bbc535e41a9c3ac0d4700 Mon Sep 17 00:00:00 2001
From 4cbd1a41b7a2f3c65ac37c3e8b629f39d6142165 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 21 Sep 2019 15:30:44 +0200
Subject: also detect secondary arch with clang.
Subject: Haiku: Improve secondary arch detection
Find the directory when it's not the last in the list.
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index 7d9a737..e5ccf3f 100644
index 7d9a737..74b17f5 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -35,6 +35,10 @@ execute_process(
@@ -33,8 +33,8 @@ execute_process(
RESULT_VARIABLE _HAIKU_SEARCH_DIRS_FOUND
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "libraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/?(:?\n+)" _dummy "${_HAIKU_SEARCH_DIRS}\n")
set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}")
+if(NOT CMAKE_HAIKU_SECONDARY_ARCH)
+ string(REGEX MATCH "libraries: =?([^\n]*:)?/system/lib/([^/]*)/?(:?\n+)" _dummy "${_HAIKU_SEARCH_DIRS}\n")
+ set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}")
+endif()
-string(REGEX MATCH "libraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/?(:?\n+)" _dummy "${_HAIKU_SEARCH_DIRS}\n")
-set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}")
+string(REGEX MATCH "libraries: =?([^\n]*:)?(/boot)?/system(/develop)?/lib/([^/]*)/?(:|\n)" _dummy "${_HAIKU_SEARCH_DIRS}\n")
+set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_4}")
if(NOT CMAKE_HAIKU_SECONDARY_ARCH)
set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "")
--
2.42.1
2.45.2
From 744100d4791a76fe32c59870035e40a919400462 Mon Sep 17 00:00:00 2001
From 8e6bbdda1cc04596408fc7f570db19a5ba68f9ed Mon Sep 17 00:00:00 2001
From: Augustin Cavalier <waddlesplash@gmail.com>
Date: Fri, 21 Feb 2020 15:38:39 -0500
Subject: Modules/Haiku: Set CMAKE_SYSTEM_FRAMEWORK_PATH.
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index e5ccf3f..c8f4b8d 100644
index 74b17f5..41d77bb 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -121,6 +121,9 @@ LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
@@ -117,6 +117,9 @@ LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES})
@@ -126,10 +127,10 @@ index e5ccf3f..c8f4b8d 100644
set(CMAKE_INSTALL_PREFIX "/boot/system" CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
--
2.42.1
2.45.2
From c2b4a6e9638714eaf8b8b32236d1b44143c14acb Mon Sep 17 00:00:00 2001
From 8595fba610744bca2548d931f8c514f488b54f70 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 15 Apr 2021 21:09:12 +0200
Subject: disable dependency tracking for older GNU compilers
@@ -151,10 +152,10 @@ index d01054b..7a5271c 100644
# define flags for linker depfile generation
--
2.42.1
2.45.2
From bb22485844ea6b11af849bcda1d8a44d659563e7 Mon Sep 17 00:00:00 2001
From d8e0aafe7a6a1781a5aa6cf389eaf2d451160a81 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 20 Oct 2021 14:28:22 +0200
Subject: Haiku: fix install dirs, let FindPackage search in data/
@@ -195,10 +196,10 @@ index 30458cd..68fecef 100644
auto cmnGen = cmEnumPathSegmentsGenerator{ common };
auto cmakeGen = cmAppendPathSegmentGenerator{ "cmake"_s };
--
2.42.1
2.45.2
From aae457bc3e9cfd685c48fb1086d69f3d920b7057 Mon Sep 17 00:00:00 2001
From 037d60c2bfb59e6c1f81d4d2867cbb7940b10ba1 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 23 Feb 2022 13:44:06 +0100
Subject: Disable weak symbols; they do not seem to behave correctly.
@@ -218,10 +219,10 @@ index 485cadf..95dc81b 100644
#else
# define ZSTD_HAVE_WEAK_SYMBOLS 0
--
2.42.1
2.45.2
From ea82f9ac2459bb1931f77e40d2774954acd4562b Mon Sep 17 00:00:00 2001
From 0eb4e7b228a05f80d0490af279d073fa9b73c081 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 9 Feb 2024 13:48:22 +0100
Subject: Haiku: enable debugger
@@ -255,5 +256,35 @@ index 1bc855e..93378da 100644
# Check if we can build the Mach-O parser.
--
2.42.1
2.45.2
From da893309fde0ec42448f3105387b123bcb194c14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A1ximo=20Casta=C3=B1eda?= <antiswen@yahoo.es>
Date: Sat, 31 Aug 2024 21:52:20 +0200
Subject: Fix build for non-x86 arches
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 369ff9a..84d5d65 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -4998,6 +4998,7 @@ bool SystemInformationImplementation::QueryHaikuInfo()
this->TotalVirtualMemory = 0;
this->AvailableVirtualMemory = 0;
+#if defined(__i386__) || defined(__x86_64__)
// Retrieve cpuid_info union for cpu 0
cpuid_info cpu_info;
get_cpuid(&cpu_info, 0, 0);
@@ -5033,6 +5034,7 @@ bool SystemInformationImplementation::QueryHaikuInfo()
// Chip Extended Model
this->ChipID.ExtendedModel = cpu_info.eax_1.extended_model;
+#endif
// Get ChipID.ProcessorName from other information already gathered
this->RetrieveClassicalCPUIdentity();
--
2.45.2