mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
198 lines
7.8 KiB
Plaintext
198 lines
7.8 KiB
Plaintext
From 044c28bac274c97f870bffa5d09ba6d80f2c0945 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
|
|
Date: Sat, 2 Dec 2023 02:02:15 +0100
|
|
Subject: Fix INTERFACE_INCLUDE_DIRECTORIES on Haiku
|
|
|
|
Not sure if the IMPORTED_LOCATION shouldn't be develop/lib
|
|
|
|
diff --git a/Makefile.am b/Makefile.am
|
|
index 72f2fca..2eb13d5 100644
|
|
--- a/Makefile.am
|
|
+++ b/Makefile.am
|
|
@@ -71,6 +71,7 @@ _EXTRA_DIST_CMAKE = \
|
|
cmake/autotools/expat__linux.cmake.in \
|
|
cmake/autotools/expat__macos.cmake.in \
|
|
cmake/autotools/expat__windows.cmake.in \
|
|
+ cmake/autotools/expat-noconfig__haiku.cmake.in \
|
|
cmake/autotools/expat-noconfig__linux.cmake.in \
|
|
cmake/autotools/expat-noconfig__macos.cmake.in \
|
|
cmake/autotools/expat-noconfig__windows.cmake.in \
|
|
diff --git a/cmake/autotools/expat-noconfig__haiku.cmake.in b/cmake/autotools/expat-noconfig__haiku.cmake.in
|
|
new file mode 100644
|
|
index 0000000..c1aad9d
|
|
--- /dev/null
|
|
+++ b/cmake/autotools/expat-noconfig__haiku.cmake.in
|
|
@@ -0,0 +1,26 @@
|
|
+#----------------------------------------------------------------
|
|
+# Generated CMake target import file for configuration "NoConfig".
|
|
+#----------------------------------------------------------------
|
|
+
|
|
+# Commands may need to know the format version.
|
|
+set(CMAKE_IMPORT_FILE_VERSION 1)
|
|
+
|
|
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
+
|
|
+set_target_properties(expat::expat PROPERTIES
|
|
+ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}"
|
|
+ INTERFACE_LINK_LIBRARIES "m"
|
|
+)
|
|
+
|
|
+# Import target "expat::expat" for configuration "NoConfig"
|
|
+set_property(TARGET expat::expat APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
|
|
+set_target_properties(expat::expat PROPERTIES
|
|
+ IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/lib/@LIBDIR_BASENAME@/libexpat.so.@SO_MAJOR@.@SO_MINOR@.@SO_PATCH@"
|
|
+ IMPORTED_SONAME_NOCONFIG "libexpat.so.@SO_MAJOR@"
|
|
+ )
|
|
+
|
|
+list(APPEND _cmake_import_check_targets expat::expat )
|
|
+list(APPEND _cmake_import_check_files_for_expat::expat "${_IMPORT_PREFIX}/lib/@LIBDIR_BASENAME@/libexpat.so.@SO_MAJOR@.@SO_MINOR@.@SO_PATCH@" )
|
|
+
|
|
+# Commands beyond this point should not need to know the version.
|
|
+set(CMAKE_IMPORT_FILE_VERSION)
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 71fe499..d25195d 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -452,6 +452,10 @@ AS_CASE("${host_os}",
|
|
CMAKE_SOURCE=cmake/autotools/expat__windows.cmake.in
|
|
CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__windows.cmake.in
|
|
],
|
|
+ [haiku*], [
|
|
+ CMAKE_SOURCE=cmake/autotools/expat__linux.cmake.in
|
|
+ CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__haiku.cmake.in
|
|
+ ],
|
|
[
|
|
CMAKE_SOURCE=cmake/autotools/expat__linux.cmake.in
|
|
CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__linux.cmake.in
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From 1aad0157bdcb8e94f9b6673f2f555e6fb1a9a024 Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Wed, 7 Feb 2024 18:47:27 +0100
|
|
Subject: can't allocate so much on Haiku
|
|
|
|
|
|
diff --git a/tests/basic_tests.c b/tests/basic_tests.c
|
|
index b76cc45..67dd17e 100644
|
|
--- a/tests/basic_tests.c
|
|
+++ b/tests/basic_tests.c
|
|
@@ -3109,13 +3109,18 @@ START_TEST(test_buffer_can_grow_to_max) {
|
|
"withreadabilityprettygreatithinkanywaysthisisprobablylongenoughbye><x a='"};
|
|
const int num_prefixes = sizeof(prefixes) / sizeof(prefixes[0]);
|
|
int maxbuf = INT_MAX / 2 + (INT_MAX & 1); // round up without overflow
|
|
-#if defined(__MINGW32__) && ! defined(__MINGW64__)
|
|
+#if defined(__HAIKU__) || (defined(__MINGW32__) && ! defined(__MINGW64__))
|
|
// workaround for mingw/wine32 on GitHub CI not being able to reach 1GiB
|
|
// Can we make a big allocation?
|
|
void *big = malloc(maxbuf);
|
|
if (! big) {
|
|
// The big allocation failed. Let's be a little lenient.
|
|
maxbuf = maxbuf / 2;
|
|
+ big = malloc(maxbuf);
|
|
+ if (! big) {
|
|
+ // The big allocation failed. Let's be a little lenient.
|
|
+ maxbuf = maxbuf / 2;
|
|
+ }
|
|
}
|
|
free(big);
|
|
#endif
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From e0e8ee11a9bd25baa7f5190d863d1f1e93299ff1 Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Wed, 7 Feb 2024 18:47:27 +0100
|
|
Subject: support for getentropy on Haiku
|
|
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index d25195d..ae13670 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -290,6 +290,19 @@ AS_IF([test "x$with_sys_getrandom" != xno],
|
|
AS_IF([test "x$with_sys_getrandom" = xyes],
|
|
[AC_MSG_ERROR([enforced the use of syscall SYS_getrandom --with-sys-getrandom, but not detected])])])])
|
|
|
|
+AC_ARG_WITH([getentropy],
|
|
+ [AS_HELP_STRING([--with-getentropy],
|
|
+ [enforce the use of getentropy function in the system @<:@default=check@:>@])
|
|
+AS_HELP_STRING([--without-getentropy],
|
|
+ [skip auto detect of getentropy @<:@default=check@:>@])],
|
|
+ [],
|
|
+ [with_getentropy=check])
|
|
+
|
|
+AS_IF([test "x$with_getentropy" != xno],
|
|
+ [AC_CHECK_FUNCS([getentropy],,
|
|
+ [AS_IF([test "x$with_getentropy" = xyes],
|
|
+ [AC_MSG_ERROR([enforced the use of getentropy --with-getentropy, but not detected])])])])
|
|
+
|
|
dnl Only needed for xmlwf:
|
|
AC_CHECK_HEADERS(fcntl.h unistd.h)
|
|
AC_TYPE_OFF_T
|
|
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
|
|
index 086fca5..12fbe36 100644
|
|
--- a/lib/xmlparse.c
|
|
+++ b/lib/xmlparse.c
|
|
@@ -143,8 +143,8 @@
|
|
|
|
#if ! defined(HAVE_GETRANDOM) && ! defined(HAVE_SYSCALL_GETRANDOM) \
|
|
&& ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) \
|
|
- && ! defined(XML_DEV_URANDOM) && ! defined(_WIN32) \
|
|
- && ! defined(XML_POOR_ENTROPY)
|
|
+ && ! defined(HAVE_GETENTROPY) && ! defined(XML_DEV_URANDOM) \
|
|
+ && ! defined(_WIN32) && ! defined(XML_POOR_ENTROPY)
|
|
# error You do not have support for any sources of high quality entropy \
|
|
enabled. For end user security, that is probably not what you want. \
|
|
\
|
|
@@ -153,6 +153,7 @@
|
|
* Linux >=3.17 + glibc (including <2.25) (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \
|
|
* BSD / macOS >=10.7 / glibc >=2.36 (arc4random_buf): HAVE_ARC4RANDOM_BUF, \
|
|
* BSD / macOS (including <10.7) / glibc >=2.36 (arc4random): HAVE_ARC4RANDOM, \
|
|
+ * POSIX 2024 (getentropy): HAVE_GETENTROPY, \
|
|
* Linux (including <3.17) / BSD / macOS (including <10.7) / Solaris >=8 (/dev/urandom): XML_DEV_URANDOM, \
|
|
* Windows >=Vista (rand_s): _WIN32. \
|
|
\
|
|
@@ -1035,7 +1036,7 @@ static const XML_Char implicitContext[]
|
|
'\0'};
|
|
|
|
/* To avoid warnings about unused functions: */
|
|
-#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
|
|
+#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) && ! defined(HAVE_GETENTROPY)
|
|
|
|
# if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)
|
|
|
|
@@ -1104,7 +1105,7 @@ writeRandomBytes_dev_urandom(void *target, size_t count) {
|
|
|
|
# endif /* ! defined(_WIN32) && defined(XML_DEV_URANDOM) */
|
|
|
|
-#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */
|
|
+#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) && ! defined(HAVE_GETENTROPY) */
|
|
|
|
#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF)
|
|
|
|
@@ -1163,7 +1164,7 @@ writeRandomBytes_rand_s(void *target, size_t count) {
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
-#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
|
|
+#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) && ! defined(HAVE_GETENTROPY)
|
|
|
|
static unsigned long
|
|
gather_time_entropy(void) {
|
|
@@ -1208,6 +1209,9 @@ generate_hash_secret_salt(XML_Parser parser) {
|
|
#if defined(HAVE_ARC4RANDOM_BUF)
|
|
arc4random_buf(&entropy, sizeof(entropy));
|
|
return ENTROPY_DEBUG("arc4random_buf", entropy);
|
|
+#elif defined(HAVE_GETENTROPY)
|
|
+ getentropy(&entropy, sizeof(entropy));
|
|
+ return ENTROPY_DEBUG("getentropy", entropy);
|
|
#elif defined(HAVE_ARC4RANDOM)
|
|
writeRandomBytes_arc4random((void *)&entropy, sizeof(entropy));
|
|
return ENTROPY_DEBUG("arc4random", entropy);
|
|
--
|
|
2.51.0
|
|
|