commit 11d14c260a467cf494a61b3a0d5bf3ed85fa4653
parent a6bb8818ebe3616b6d76fb450ea1c76a1c4860e4
Author: Iván Ávalos <avalos@disroot.org>
Date: Thu, 19 Feb 2026 22:44:58 +0100
disable cURL on mobile
Diffstat:
3 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/cross/package-android.sh b/cross/package-android.sh
@@ -36,25 +36,21 @@ JNILIBS_DIR=$ANDROID_DIR/qtart/src/main/jniLibs
if [ "$1" = "all" ] || [ "$1" = "x86" ]; then
./cross/build-android.sh x86
cp ./build-android/x86/libtalerwalletcore.so $JNILIBS_DIR/x86
- cp ./build-android/x86/subprojects/c-ares/libc_ares.so $JNILIBS_DIR/x86
fi
if [ "$1" = "all" ] || [ "$1" = "x86_64" ]; then
./cross/build-android.sh x86_64
cp ./build-android/x86_64/libtalerwalletcore.so $JNILIBS_DIR/x86_64
- cp ./build-android/x86_64/subprojects/c-ares/libc_ares.so $JNILIBS_DIR/x86_64
fi
if [ "$1" = "all" ] || [ "$1" = "arm64" ]; then
./cross/build-android.sh arm64-v8a
cp ./build-android/arm64-v8a/libtalerwalletcore.so $JNILIBS_DIR/arm64-v8a
- cp ./build-android/arm64-v8a/subprojects/c-ares/libc_ares.so $JNILIBS_DIR/arm64-v8a
fi
if [ "$1" = "all" ] || [ "$1" = "armeabi" ]; then
./cross/build-android.sh armeabi-v7a
cp ./build-android/armeabi-v7a/libtalerwalletcore.so $JNILIBS_DIR/armeabi-v7a
- cp ./build-android/armeabi-v7a/subprojects/c-ares/libc_ares.so $JNILIBS_DIR/armeabi-v7a
fi
pushd $ANDROID_DIR
diff --git a/meson.build b/meson.build
@@ -72,8 +72,10 @@ mbedtls_dep = mbedtls_proj.dependency('mbedtls')
mbedx509_dep = mbedtls_proj.dependency('mbedx509')
# Library for HTTP requests
-curl_proj = subproject('curl', required : true)
-curl_dep = curl_proj.get_variable('curl_dep')
+if host_machine.system() != 'ios' and host_machine.system() != 'android'
+ curl_proj = subproject('curl', required : true)
+ curl_dep = curl_proj.get_variable('curl_dep')
+endif
# Crypto library
sodium_proj = subproject('libsodium', required : true)
@@ -88,7 +90,13 @@ libunicode = static_library('unicode', 'quickjs/libunicode.c')
# general utilities
cutils = static_library('cutils', 'quickjs/cutils.c')
# standard library for quickjs (std and os modules)
-quickjs_libc = static_library('quickjs-libc', ['quickjs/quickjs-libc.c', 'quickjs/quickjs-http.c'], dependencies : curl_dep )
+# mobile apps use native networking
+if host_machine.system() == 'ios' or host_machine.system() == 'android'
+ quickjs_libc = static_library('quickjs-libc', ['quickjs/quickjs-libc.c'])
+else
+ quickjs_libc = static_library('quickjs-libc', ['quickjs/quickjs-libc.c', 'quickjs/quickjs-http.c'], dependencies : curl_dep)
+endif
+
# base JS interpreter
quickjs = static_library('quickjs', 'quickjs/quickjs.c')
@@ -127,8 +135,8 @@ qjsc_exe = executable('qjsc', [
# Just the compiler, no HTTP support required
c_args : ['-DNO_HTTP'],
link_with: [
- libbf_native,
- libregexp_native,
+ libbf_native,
+ libregexp_native,
libunicode_native,
cutils_native,
quickjs_native,
@@ -198,6 +206,19 @@ endif
# Interactive JS interpreter with Taler-specific
# functions (crypto etc.)
if not meson.is_cross_build()
+ dependencies = [
+ m_dep,
+ mbedcrypto_dep,
+ mbedtls_dep,
+ mbedx509_dep,
+ sodium_dep,
+ ]
+
+ # mobile apps use native networking
+ if host_machine.system() != 'ios' and host_machine.system() != 'android'
+ dependencies += [curl_dep]
+ endif
+
qtart_exe = executable('qtart', [
'qtart.c',
],
@@ -213,14 +234,7 @@ if not meson.is_cross_build()
prelude,
tart,
],
- dependencies: [
- m_dep,
- mbedcrypto_dep,
- mbedtls_dep,
- mbedx509_dep,
- curl_dep,
- sodium_dep
- ])
+ dependencies: dependencies)
endif
# Library that implements wallet-core, typically
@@ -244,8 +258,12 @@ if host_machine.system() == 'ios'
mbedtls_dep,
mbedx509_dep,
sodium_dep,
- ])
+ ], c_args : ['-DNO_CURL'])
else
+ talerwalletcore_cargs = []
+ if host_machine.system() == 'android'
+ talerwalletcore_cargs += ['-DNO_CURL']
+ endif
talerwalletcore_lib = shared_library('talerwalletcore', 'taler_wallet_core_lib.c',
link_with : [
libbf,
@@ -264,7 +282,7 @@ else
mbedtls_dep,
mbedx509_dep,
sodium_dep,
- ])
+ ], c_args : talerwalletcore_cargs)
endif
# Example for using libtalerwalletcore.so
diff --git a/taler_wallet_core_lib.c b/taler_wallet_core_lib.c
@@ -335,12 +335,14 @@ TALER_set_http_client_implementation(struct TALER_WALLET_Instance *twi,
twi->http_impl = impl;
}
+#ifndef NO_CURL
void
TALER_set_curl_http_client(struct TALER_WALLET_Instance *twi)
{
struct JSHttpClientImplementation *client = js_curl_http_client_create();
TALER_set_http_client_implementation(twi, client);
}
+#endif
#pragma mark -
struct JSHttpClientImplementation *