chore: drop unused static-main.c (jdns uses the default main.c)
ober
d5a4f6e6b02546da41f801a1e68dffd24f5cc2f5
deleted file mode 100644 --- a/support/static-main.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Custom main.c for a standalone static jerbuild binary (referenced by - * .jerbuild as main-c). Identical to jerbuild's stock template with ONE - * addition: it sets JERBOA_STATIC=1 before building the heap. - * - * The bundled std modules — (std db sqlite-native), (std crypto native-rust), - * etc. — read JERBOA_STATIC at library-load time and, when set, trust the - * jerboa-native symbols that are linked into this binary (and registered via - * register_ffi_symbols() below from the .jerbuild ffi-symbols list) instead of - * trying to dlopen a libjerboa_native.{so,dylib} that does not exist in a - * static build. - */ -#include "scheme.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> - -#include "petite_boot.h" -#include "scheme_boot.h" -#include "program_boot.h" -#include "ffi_symbols.h" - -static const char *write_program_tmpfile(void) { - static char path[] = "/tmp/jerboa-prog-XXXXXX"; - int fd = mkstemp(path); - if (fd < 0) { perror("mkstemp"); exit(1); } - ssize_t n = write(fd, program_boot_data, program_boot_size); - if (n != (ssize_t)program_boot_size) { - perror("write"); close(fd); unlink(path); exit(1); - } - close(fd); - return path; -} - -int main(int argc, const char *argv[]) { - /* Trust the linked-in jerboa-native symbols (see file header). */ - setenv("JERBOA_STATIC", "1", 1); - - Sscheme_init(NULL); - Sregister_boot_file_bytes("petite", - (void *)petite_boot_data, petite_boot_size); - Sregister_boot_file_bytes("scheme", - (void *)scheme_boot_data, scheme_boot_size); - Sbuild_heap(NULL, NULL); - register_ffi_symbols(); - - const char *prog_path = write_program_tmpfile(); - int status = Sscheme_program(prog_path, argc, argv); - unlink(prog_path); - - Sscheme_deinit(); - return status; -}