pcbjam/wasm/stubs/libgit2_stub.c
Viktor Vaczi 9f4ed1e51e Add KiCad PCBnew WASM build support and documentation
Build infrastructure:
- Update build-pcbnew.sh with stub library compilation
- Update build-wxuniversal-wasm.sh with library symlinks and stubs
- Add stub libraries for libgit2 and curl (network ops via JS)
- Add WASM-specific CMake Find modules

Documentation:
- Add KICAD_WASM_BUILD.md with complete modification list
- Document 68 KiCad files modified for WASM support
- Document disabled features and reasons
- Document stub libraries and wxWidgets changes

Submodule updates:
- kicad: Add WASM/Emscripten build support (wasm-port branch)
- wxwidgets: Add KiCad compatibility fixes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 18:26:57 +01:00

64 lines
1.2 KiB
C

/* libgit2 stub for WebAssembly builds
* Git functionality is not available in browser, but KiCad needs these symbols
*/
#include <stddef.h>
/* Error handling */
typedef struct {
char *message;
int klass;
} git_error;
static git_error stub_error = { "Git not available in WebAssembly", 0 };
int git_libgit2_init(void) {
return 1; /* Return 1 to indicate "initialized" */
}
int git_libgit2_shutdown(void) {
return 0;
}
const git_error* git_error_last(void) {
return &stub_error;
}
/* Repository operations - all return failure */
int git_repository_open(void **out, const char *path) {
*out = NULL;
return -1;
}
int git_repository_head(void **out, void *repo) {
*out = NULL;
return -1;
}
void git_repository_free(void *repo) {
(void)repo;
}
/* Reference operations */
const void* git_reference_target(const void *ref) {
(void)ref;
return NULL;
}
void git_reference_free(void *ref) {
(void)ref;
}
/* OID operations */
char* git_oid_tostr(char *out, size_t n, const void *id) {
if (out && n > 0) {
out[0] = '\0';
}
return out;
}
int git_oid_cmp(const void *a, const void *b) {
(void)a;
(void)b;
return 0;
}