db: Fix checking for thread local storage with clang

This fixes the pthread_getspecific and pthread_setspecific calls in tls.m4.
Also append pthread library in global LDFLAGS variable.
This commit is contained in:
Biswapriyo Nath
2023-08-13 20:21:31 +05:30
parent b909cb3718
commit d5f2369b16
2 changed files with 32 additions and 3 deletions

View File

@@ -0,0 +1,15 @@
--- a/dist/aclocal/tls.m4
+++ b/dist/aclocal/tls.m4
@@ -42,10 +42,10 @@
pthread_key_create(&key, NULL);
}
static void *get_tls() {
- return (void *)pthread_getspecific(&key);
+ return (void *)pthread_getspecific(key);
}
static void set_tls(void *p) {
- pthread_setspecific(&key, p);
+ pthread_setspecific(key, p);
}], [],
[ac_cv_tls=pthread])
fi

View File

@@ -17,19 +17,32 @@ depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools"
"${MINGW_PACKAGE_PREFIX}-cc")
source=(https://download.oracle.com/berkeley-db/db-${pkgver}.tar.gz
0001-db-tls-m4-fix-pthread.patch
mingw.patch
clang_cxx_11.patch
clang_libc++_store.patch)
sha256sums=('2917c28f60903908c2ca4587ded1363b812c4e830a5326aaa77c9879d13ae18e'
'3b340bfa4817b5cbe1bf295e0cbb87d5a6e16384a16fff485f1e1991e15b1ce0'
'62981c4064efccbe4219406316151a5266258c270b621f3b3faff39108978d02'
'd7bc0d56fc20f7e71dca5b4bee21ef296cb6cd4d835ff9789dc61c11f3977325'
'69be5d13b1377a0bebe767789afc1e9ab34fd6c15c5adcaeec2d5953508ae260')
_apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying ${_patch}"
patch -p1 -i "${srcdir}/${_patch}"
done
}
prepare() {
cd ${srcdir}/${_realname}-${pkgver}
patch -Nbp1 -i ${srcdir}/mingw.patch
patch -Nbp1 -i ${srcdir}/clang_cxx_11.patch
patch -Nbp1 -i ${srcdir}/clang_libc++_store.patch
_apply_patch_with_msg \
0001-db-tls-m4-fix-pthread.patch \
mingw.patch \
clang_cxx_11.patch \
clang_libc++_store.patch \
pushd dist
autoreconf -fiv -I aclocal -I aclocal_java
@@ -44,6 +57,7 @@ build() {
CFLAGS+=" -DUNICODE -D_UNICODE"
CXXFLAGS+=" -DUNICODE -D_UNICODE"
LDFLAGS+=" -lpthread"
# for ucrt
export ac_cv_func_time=yes