Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump(main/ngspice): 44 #22797

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/ngspice/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ TERMUX_PKG_DESCRIPTION="A mixed-level/mixed-signal circuit simulator"
TERMUX_PKG_LICENSE="BSD 3-Clause, LGPL-2.1"
TERMUX_PKG_LICENSE_FILE="COPYING"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="43"
TERMUX_PKG_REVISION=1
TERMUX_PKG_VERSION="44"
TERMUX_PKG_SRCURL=https://github.com/imr/ngspice/archive/refs/tags/ngspice-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=4c0443250f777f4e24884263674e33cfe4bdff9756bd846ac7a69ac36192bf73
TERMUX_PKG_SHA256=40e15a4951d1c3c8b4ba5335ff8a1e8161bea6994767761cc598d0218fe8d2cb
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_UPDATE_TAG_TYPE="newest-tag"
TERMUX_PKG_UPDATE_VERSION_SED_REGEXP="s/ngspice-//"
Expand All @@ -18,6 +17,7 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--with-readline=yes
"
TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS="
--enable-cider
--enable-xspice
Expand Down
44 changes: 44 additions & 0 deletions packages/ngspice/pthread_cancel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
--- a/src/xspice/verilog/coroutine_shim.h
+++ b/src/xspice/verilog/coroutine_shim.h
@@ -82,6 +82,13 @@ static void cr_yield_to_sim(struct cr_ctx *ctx) {
fail("pthread_cond_wait (spice)", err);
}

+#ifdef __ANDROID__
+static void cr_thread_signal_handler(int signum)
+{
+ pthread_exit(0);
+}
+#endif
+
static void cr_init(struct cr_ctx *ctx, void *(*fn)(void *), void *data) {
int err;

@@ -105,6 +112,15 @@ static void cr_init(struct cr_ctx *ctx, void *(*fn)(void *), void *data) {
err = pthread_cond_wait(&ctx->spice_cond, &ctx->mutex);
if (err)
fail("pthread_cond_wait", err);
+
+#ifdef __ANDROID__
+ struct sigaction actions;
+ memset(&actions, 0, sizeof(actions));
+ sigemptyset(&actions.sa_mask);
+ actions.sa_flags = 0;
+ actions.sa_handler = cr_thread_signal_handler;
+ sigaction(SIGUSR2, &actions, NULL);
+#endif
tqfx marked this conversation as resolved.
Show resolved Hide resolved
}

static void cr_safety(void) {
@@ -129,7 +145,11 @@ static void cr_cleanup(struct cr_ctx *ctx) {
* It should be in pthread_cond_wait() and will go quickly.
*/

+#ifndef __ANDROID__
pthread_cancel(ctx->thread);
+#else
+ pthread_kill(ctx->thread, SIGUSR2);
+#endif
pthread_mutex_unlock(&ctx->mutex);
pthread_cond_signal(&ctx->cosim_cond); // Make it run
pthread_join(ctx->thread, NULL); // Wait for it.
Loading