0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-09-24 23:32:30 +00:00
Files
termux-packages/packages/mesa/0016-define-reallocarray.patch
Fredrik Fornwall a0037d1e8d fix(main/mesa): Fix build when targeting newer API level
Fix build errors when targeting a newer API level such as with:

    TERMUX_PKG_API_LEVEL=30 ./build-package.sh -i mesa

1: Change to only define reallocarray if API level < 29

Fixes the build error:

> reallocarray.h:44:1:
> error: static declaration of 'reallocarray' follows non-static declaration

2: Specify the Android API level to bindgen

Fixes the build error:

> Unable to generate bindings: clang diagnosed error:
> [..]/c++/v1/__condition_variable/condition_variable.h:226:14:
> error: use of undeclared identifier 'pthread_cond_clockwait'

3: Only patch in emulated TLS symbol names when if API level < 29

Fixes the build error:

> ld.lld: error: version script assignment of 'global' to
> symbol '__emutls_v._mesa_glapi_tls_Context' failed:
> symbol not defined
2025-09-13 19:12:05 +02:00

12 lines
296 B
Diff

--- a/src/util/reallocarray.h
+++ b/src/util/reallocarray.h
@@ -24,7 +24,7 @@
#ifndef REALLOCARRAY_H
#define REALLOCARRAY_H
-#if !defined(HAVE_REALLOCARRAY)
+#if !defined(HAVE_REALLOCARRAY) || (defined(__TERMUX__) && __ANDROID_API__ < 29)
#include <stdlib.h> // size_t
#include <errno.h>