Files
haikuports/dev-libs/expat/patches/expat-2.6.2.patchset
2024-03-14 17:06:56 +01:00

421 lines
14 KiB
Plaintext

From d98573ef248827bea8d9b93d9ad9895a1e8f447c 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 9c2259d..a873fff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,6 +68,7 @@ cmakedir = $(libdir)/cmake/expat-@PACKAGE_VERSION@
_EXTRA_DIST_CMAKE = \
+ 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 a5d1ff9..02e85dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -425,6 +425,7 @@ AC_SUBST([CMAKE_SHARED_LIBRARY_PREFIX])
AS_CASE("${host_os}",
[darwin*], [CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__macos.cmake.in],
[mingw*|cygwin*], [CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__windows.cmake.in],
+ [haiku*], [CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__haiku.cmake.in],
[CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__linux.cmake.in])
AC_CONFIG_FILES([Makefile]
[expat.pc]
--
2.37.3
From 8283c87bf2947364bf29ef84ecd532e8f58e8581 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/Makefile.in b/Makefile.in
index f505224..6362402 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -466,6 +466,7 @@ nodist_cmake_DATA = \
cmakedir = $(libdir)/cmake/expat-@PACKAGE_VERSION@
_EXTRA_DIST_CMAKE = \
+ 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/configure b/configure
index a4aee82..ceeca17 100755
--- a/configure
+++ b/configure
@@ -1780,7 +1780,7 @@ else $as_nop
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $2 (void); below. */
+ which can conflict with char $2 (); below. */
#include <limits.h>
#undef $2
@@ -1791,7 +1791,7 @@ else $as_nop
#ifdef __cplusplus
extern "C"
#endif
-char $2 (void);
+char $2 ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
@@ -2545,7 +2545,9 @@ struct stat;
/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */
struct buf { int x; };
struct buf * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (char **p, int i)
+static char *e (p, i)
+ char **p;
+ int i;
{
return p[i];
}
@@ -2596,7 +2598,6 @@ extern int puts (const char *);
extern int printf (const char *, ...);
extern int dprintf (int, const char *, ...);
extern void *malloc (size_t);
-extern void free (void *);
// Check varargs macros. These examples are taken from C99 6.10.3.5.
// dprintf is used instead of fprintf to avoid needing to declare
@@ -13243,14 +13244,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply.
- The 'extern "C"' is for builds by C++ compilers;
- although this is not generally supported in C code supporting it here
- has little cost and some practical benefit (sr 110532). */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen (void);
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
int
main (void)
{
@@ -13311,14 +13306,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply.
- The 'extern "C"' is for builds by C++ compilers;
- although this is not generally supported in C code supporting it here
- has little cost and some practical benefit (sr 110532). */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shl_load (void);
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
int
main (void)
{
@@ -13361,14 +13350,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply.
- The 'extern "C"' is for builds by C++ compilers;
- although this is not generally supported in C code supporting it here
- has little cost and some practical benefit (sr 110532). */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen (void);
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
int
main (void)
{
@@ -13406,14 +13389,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply.
- The 'extern "C"' is for builds by C++ compilers;
- although this is not generally supported in C code supporting it here
- has little cost and some practical benefit (sr 110532). */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen (void);
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
int
main (void)
{
@@ -13451,14 +13428,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply.
- The 'extern "C"' is for builds by C++ compilers;
- although this is not generally supported in C code supporting it here
- has little cost and some practical benefit (sr 110532). */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dld_link (void);
+ builtin and then its argument prototype would still apply. */
+char dld_link ();
int
main (void)
{
@@ -14632,11 +14603,11 @@ if test x$ac_prog_cxx_stdcxx = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5
printf %s "checking for $CXX option to enable C++11 features... " >&6; }
-if test ${ac_cv_prog_cxx_cxx11+y}
+if test ${ac_cv_prog_cxx_11+y}
then :
printf %s "(cached) " >&6
else $as_nop
- ac_cv_prog_cxx_cxx11=no
+ ac_cv_prog_cxx_11=no
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -14678,11 +14649,11 @@ if test x$ac_prog_cxx_stdcxx = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5
printf %s "checking for $CXX option to enable C++98 features... " >&6; }
-if test ${ac_cv_prog_cxx_cxx98+y}
+if test ${ac_cv_prog_cxx_98+y}
then :
printf %s "(cached) " >&6
else $as_nop
- ac_cv_prog_cxx_cxx98=no
+ ac_cv_prog_cxx_98=no
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -18776,23 +18747,22 @@ unsigned short int ascii_mm[] =
int use_ebcdic (int i) {
return ebcdic_mm[i] + ebcdic_ii[i];
}
- int
- main (int argc, char **argv)
- {
- /* Intimidate the compiler so that it does not
- optimize the arrays away. */
- char *p = argv[0];
- ascii_mm[1] = *p++; ebcdic_mm[1] = *p++;
- ascii_ii[1] = *p++; ebcdic_ii[1] = *p++;
- return use_ascii (argc) == use_ebcdic (*p);
- }
+ extern int foo;
+
+int
+main (void)
+{
+return use_ascii (foo) == use_ebcdic (foo);
+ ;
+ return 0;
+}
_ACEOF
-if ac_fn_c_try_link "$LINENO"
+if ac_fn_c_try_compile "$LINENO"
then :
- if grep BIGenDianSyS conftest$ac_exeext >/dev/null; then
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
ac_cv_c_bigendian=yes
fi
- if grep LiTTleEnDian conftest$ac_exeext >/dev/null ; then
+ if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
if test "$ac_cv_c_bigendian" = unknown; then
ac_cv_c_bigendian=no
else
@@ -18801,8 +18771,7 @@ then :
fi
fi
fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -19454,14 +19423,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply.
- The 'extern "C"' is for builds by C++ compilers;
- although this is not generally supported in C code supporting it here
- has little cost and some practical benefit (sr 110532). */
-#ifdef __cplusplus
-extern "C"
-#endif
-char _mwvalidcheckl (void);
+ builtin and then its argument prototype would still apply. */
+char _mwvalidcheckl ();
int
main (void)
{
@@ -19500,14 +19463,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply.
- The 'extern "C"' is for builds by C++ compilers;
- although this is not generally supported in C code supporting it here
- has little cost and some practical benefit (sr 110532). */
-#ifdef __cplusplus
-extern "C"
-#endif
-char cos (void);
+ builtin and then its argument prototype would still apply. */
+char cos ();
int
main (void)
{
@@ -19548,14 +19505,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply.
- The 'extern "C"' is for builds by C++ compilers;
- although this is not generally supported in C code supporting it here
- has little cost and some practical benefit (sr 110532). */
-#ifdef __cplusplus
-extern "C"
-#endif
-char cos (void);
+ builtin and then its argument prototype would still apply. */
+char cos ();
int
main (void)
{
@@ -19610,14 +19561,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply.
- The 'extern "C"' is for builds by C++ compilers;
- although this is not generally supported in C code supporting it here
- has little cost and some practical benefit (sr 110532). */
-#ifdef __cplusplus
-extern "C"
-#endif
-char arc4random_buf (void);
+ builtin and then its argument prototype would still apply. */
+char arc4random_buf ();
int
main (void)
{
@@ -20281,6 +20226,8 @@ case "${host_os}" in #(
CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__macos.cmake.in ;; #(
mingw*|cygwin*) :
CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__windows.cmake.in ;; #(
+ haiku*) :
+ CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__haiku.cmake.in ;; #(
*) :
CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__linux.cmake.in ;;
esac
diff --git a/expat_config.h b/expat_config.h
index 230e264..a5cf1d8 100644
--- a/expat_config.h
+++ b/expat_config.h
@@ -14,7 +14,7 @@
/* #undef HAVE_ARC4RANDOM */
/* Define to 1 if you have the `arc4random_buf' function. */
-#define HAVE_ARC4RANDOM_BUF 1
+/* #undef HAVE_ARC4RANDOM_BUF */
/* define if the compiler supports basic C++11 syntax */
#define HAVE_CXX11 1
@@ -29,7 +29,7 @@
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the `getrandom' function. */
-#define HAVE_GETRANDOM 1
+/* #undef HAVE_GETRANDOM */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@@ -56,7 +56,7 @@
#define HAVE_STRING_H 1
/* Define to 1 if you have `syscall' and `SYS_getrandom'. */
-#define HAVE_SYSCALL_GETRANDOM 1
+/* #undef HAVE_SYSCALL_GETRANDOM */
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
diff --git a/tests/basic_tests.c b/tests/basic_tests.c
index 7112a44..3a287c7 100644
--- a/tests/basic_tests.c
+++ b/tests/basic_tests.c
@@ -2880,13 +2880,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.37.3