Build para Windows: make exe (MinGW + pacotes do MSYS2)
make exe gera build/win-x86_64/TinyBlocks/TinyBlocks.exe com as DLLs e o zip; make run-exe abre no Wine. As dependencias (SDL2, SDL2_ttf, libpng, freetype, openssl, zlib, regex) vem dos pacotes MinGW do MSYS2, com as dependencias resolvidas pelo indice do repositorio (packaging/windows/msys2_deps.py). O POSIX que falta fica em packaging/windows/compat (dlfcn, pwd, uname, mkdir, sysconf, setenv, readlink de /proc/self/exe, strndup, getline, open_memstream). No Windows uma DLL nao ve os simbolos do .exe, entao o editor, os modulos dele (TB_ED_STATIC_MODULES) e as libraries de extensao (TB_STATIC_EXTRAS) entram no executavel; TB_STATIC_BUILD deixa o TB_API vazio. Socket e servidor MCP ganham uma camada sobre o Winsock; o kernel do GEMM so usa target_clones no ELF. O pacote leva a fonte DejaVu (procurada ao lado do executavel pelo SDL2 e pela opentype) e os certificados raiz (certs/ca-bundle.crt, carregados pela ssl). Testado no Wine 9: interface, HTTPS com verificacao, tensor, informacoes do sistema e grafico em PNG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
829bc67142
commit
7538d48a13
21 files changed
+820
-61
No files matched your search
@@ -7,6 +7,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
@@ -89,6 +90,23 @@ static void eval_version(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
self->dirty = false;
|
||||
}
|
||||
|
||||
/* Certificados que vao junto do programa: <pasta do executavel>/certs/
|
||||
ca-bundle.crt. No Windows o OpenSSL nao conhece o repositorio do sistema,
|
||||
entao o pacote leva o arquivo (ver packaging/windows). */
|
||||
static void load_bundled_certs(SSL_CTX* ctx) {
|
||||
char exe[1024];
|
||||
ssize_t n = readlink("/proc/self/exe", exe, sizeof(exe) - 1);
|
||||
if (n <= 0) return;
|
||||
exe[n] = 0;
|
||||
char* sl = strrchr(exe, '/');
|
||||
if (!sl) return;
|
||||
snprintf(sl, sizeof(exe) - (size_t)(sl - exe), "/certs/ca-bundle.crt");
|
||||
FILE* f = fopen(exe, "rb");
|
||||
if (!f) return;
|
||||
fclose(f);
|
||||
SSL_CTX_load_verify_locations(ctx, exe, NULL);
|
||||
}
|
||||
|
||||
static bool ssl_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
static const TinyBlocks_Category cat = { "SSL", {0.40f, 0.55f, 0.30f, 1.f}, {0.29f, 0.42f, 0.21f, 1.f} };
|
||||
tb_library_set_category(lib, &cat);
|
||||
@@ -98,6 +116,7 @@ static bool ssl_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
SSL_CTX_set_min_proto_version(s_ctx, TLS1_2_VERSION);
|
||||
SSL_CTX_set_verify(s_ctx, SSL_VERIFY_PEER, NULL);
|
||||
SSL_CTX_set_default_verify_paths(s_ctx); /* certificados do sistema */
|
||||
load_bundled_certs(s_ctx);
|
||||
lib->lib_userdata = (void*)&s_api;
|
||||
static const TinyBlocks_SlotDesc out[] = {{"versão", TB_VALUE_TEXT}};
|
||||
TinyBlocks_TypeBlock* t = tb_type_block_create(rt, "SSL.Version", NULL, 0, out, 1, eval_version);
|
||||
|
||||
Reference in new issue
Block a user