From 4a2160503bd1c8bcaa83c1e2856622395d3b1c67 Mon Sep 17 00:00:00 2001 From: LDA Date: Sun, 15 Sep 2024 12:07:30 +0200 Subject: [PATCH] [CI] Try to Mbed things out --- .forgejo/workflows/build-release.yaml | 25 +++++++++++-------------- configure.c | 6 +++--- src/Parsee/Data.c | 5 +++++ 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.forgejo/workflows/build-release.yaml b/.forgejo/workflows/build-release.yaml index b550e8f..f83fcdd 100644 --- a/.forgejo/workflows/build-release.yaml +++ b/.forgejo/workflows/build-release.yaml @@ -10,14 +10,14 @@ jobs: run: | echo $(uname -a) $(env | grep container) apt update -y - apt install -y build-essential liblmdb-dev nodejs libssl-dev git wget + apt install -y build-essential liblmdb-dev nodejs libssl-dev git wget python3 - name: Clone everything run: | mkdir -p repos git clone --depth=1 https://git.musl-libc.org/git/musl repos/musl - git clone --depth=1 https://github.com/openssl/openssl repos/openssl + git clone --depth=1 https://github.com/Mbed-TLS/mbedtls repos/mbed git clone --depth=1 https://github.com/LMDB/lmdb repos/lmdb - git clone --depth=1 https://git.kappach.at/KappaChat/Cytoplasm repos/cyto + git clone --depth=1 https://git.kappach.at/lda/Cytoplasm repos/cyto echo "PREFIX=$GITHUB_WORKSPACE/usr" >> $GITHUB_ENV echo "PATH=$GITHUB_WORKSPACE/usr/bin:$PATH" >> $GITHUB_ENV echo "INCLUDE_PATH=$GITHUB_WORKSPACE/usr/include" >> $GITHUB_ENV @@ -29,15 +29,13 @@ jobs: make -j$(nproc) make install -j$(nproc) alias musl-gcc="musl-gcc -Wl,-Bstatic -L ${PREFIX}/lib" - - name: Build OpenSSL + - name: Build MbedTLS run: | alias musl-gcc="musl-gcc -Wl,-Bstatic -L ${PREFIX}/lib" - cd repos/openssl - CC=musl-gcc ./Configure -static --static --prefix=${PREFIX} no-async no-engine -DOPENSSL_NO_SECURE_MEMORY - make -j$(nproc) - make install -j$(nproc) - cp libcrypto.a ${PREFIX}/lib - cp libssl.a ${PREFIX}/lib + cd repos/mbed + python3 -m pip install -r scripts/basic.requirements.txt --break-system-packages + make CC=musl-gcc -j$(nproc) + make install DESTDIR=${PREFIX} -j$(nproc) - name: Build LMDB run: | alias musl-gcc="musl-gcc -Wl,-Bstatic -L ${PREFIX}/lib" @@ -48,10 +46,9 @@ jobs: run: | alias musl-gcc="musl-gcc -Wl,-Bstatic -L ${PREFIX}/lib" cd repos/cyto - rm configure - wget https://kappach.at/configure - chmod +x configure - ./configure --cc=musl-gcc --prefix=${PREFIX} --with-lmdb + git fetch + git checkout add-mbed + ./configure --cc=musl-gcc --prefix=${PREFIX} --with-lmdb --with-mbed make -j$(nproc) make install - name: Clone/Build Parsee diff --git a/configure.c b/configure.c index b5d6200..b01b351 100644 --- a/configure.c +++ b/configure.c @@ -466,7 +466,7 @@ main_build(int argc, char *argv[]) write_images(makefile, images); if (with_static) { - fprintf(makefile, " -lm -lpthread -lssl -lCytoplasm -lssl -lcrypto"); + fprintf(makefile, " -lm -lpthread -lmbedtls -lmbedx509 -lmbedcrypto -lCytoplasm -lmbedtls -lmbedx509 -lmbedcrypto"); if (with_lmdb) fprintf(makefile, " -llmdb"); } fprintf(makefile, " -lCytoplasm $(LDFLAGS)\n"); @@ -558,8 +558,8 @@ main_build(int argc, char *argv[]) fprintf(makefile, " -L $(CYTO_LIB)"); if (with_static) { - fprintf(makefile, " -lm -lpthread -lssl"); - fprintf(makefile, " -lCytoplasm -lssl -lcrypto"); + fprintf(makefile, " -lm -lpthread -lmbedtls -lmbedx509 -lmbedcrypto"); + fprintf(makefile, " -lCytoplasm -lmbedtls -lmbedx509 -lmbedcrypto"); if (with_lmdb) fprintf(makefile, " -llmdb"); } fprintf(makefile, " -lCytoplasm $(CFLAGS)\n"); diff --git a/src/Parsee/Data.c b/src/Parsee/Data.c index d4bf6cb..2dae26e 100644 --- a/src/Parsee/Data.c +++ b/src/Parsee/Data.c @@ -159,13 +159,16 @@ ParseeCleanup(void *datp) ArrayAdd(to_delete, StrDuplicate(f)); \ cleaned++; \ } \ + Log(LOG_INFO, "Free A, %s [%s][%p]", f, #field, ref); \ DbUnlock(data->db, ref); \ + Log(LOG_INFO, "Free'd!"); \ } \ DbListFree(field##_list); \ \ for (j = 0; j < ArraySize(to_delete); j++) \ { \ field = ArrayGet(to_delete, j); \ + Log(LOG_INFO, "%s (%ss)", field, #field"s"); \ if (cleaned > threshold) \ { \ DbDelete(data->db, 4, "chats", chat, #field"s", field); \ @@ -236,7 +239,9 @@ ParseeCleanup(void *datp) CleanupField(event, 3 HOURS, 500); CleanupField(id, 3 HOURS, 500); + Log(LOG_INFO, "Free B %p", ref); DbUnlock(data->db, ref); + Log(LOG_INFO, "Free'd!"); } DbListFree(chats); Log(LOG_DEBUG, "Cleant up %d entries...", entries);