This commit is contained in:
2025-08-15 19:08:52 -04:00
parent af1b5805b6
commit a386594b1f
5 changed files with 80 additions and 74 deletions

0
configure vendored Executable file → Normal file
View File

View File

@@ -74,6 +74,10 @@ int sanitize(manifest_t *m)
if (!m->flag.GNU) if (!m->flag.GNU)
m->flag.GNU = DEFAULT_GNU; m->flag.GNU = DEFAULT_GNU;
if (strcmp(".", m->project) == 0) {
}
return 0; return 0;
} }
@@ -86,27 +90,33 @@ int create_libraries(manifest_t manifest)
} }
if (HAS_LIBRARY(manifest.libraries, LIB_RAYLIB)) { if (HAS_LIBRARY(manifest.libraries, LIB_RAYLIB)) {
fputs("Pulling raylib", stderr);
REMOVE_LIBRARY(manifest.libraries, LIB_RAYLIB); REMOVE_LIBRARY(manifest.libraries, LIB_RAYLIB);
status = system( status = system(
"git submodule add -q https://github.com/raysan5/raylib"); "git submodule add --quiet https://github.com/raysan5/raylib");
if (status != 0) if (status != 0)
return status; return status;
fputs(", done.\n", stderr);
} }
if (HAS_LIBRARY(manifest.libraries, LIB_NCURSES)) { if (HAS_LIBRARY(manifest.libraries, LIB_NCURSES)) {
fputs("Pulling ncurses", stderr);
REMOVE_LIBRARY(manifest.libraries, LIB_NCURSES); REMOVE_LIBRARY(manifest.libraries, LIB_NCURSES);
status = system( status = system(
"git submodule add -q https://github.com/mirror/ncurses"); "git submodule add --quiet https://github.com/mirror/ncurses");
if (status != 0) if (status != 0)
return status; return status;
fputs(", done.\n", stderr);
} }
if (HAS_LIBRARY(manifest.libraries, LIB_CURL)) { if (HAS_LIBRARY(manifest.libraries, LIB_CURL)) {
fputs("Pulling curl", stderr);
REMOVE_LIBRARY(manifest.libraries, LIB_CURL); REMOVE_LIBRARY(manifest.libraries, LIB_CURL);
status = system( status = system(
"git submodule add -q https://github.com/curl/curl"); "git submodule add --quiet https://github.com/curl/curl");
if (status != 0) if (status != 0)
return status; return status;
fputs(", done.\n", stderr);
} }
return status; return status;
@@ -171,7 +181,7 @@ int create_makefile(manifest_t manifest)
char *m = strdup(manifest.project); char *m = strdup(manifest.project);
char *M = strdup(manifest.project); char *M = strdup(manifest.project);
if (!M) { if (!M) {
fprintf(stderr, "create_makefile: fatal: out of memory\n"); fputs("create_makefile: fatal: out of memory\n", stderr);
return ENOMEM; return ENOMEM;
} }
@@ -273,80 +283,76 @@ int create_project(manifest_t manifest)
manifest.path = ""; manifest.path = "";
} }
// status = create_makefile(manifest); status = create_makefile(manifest);
// if (status != 0) { if (status != 0) {
// fprintf(stderr, fprintf(stderr,
// "create_project: failed to create Makefile: %s\n", "create_project: failed to create Makefile: %s\n",
// strerror(status)); strerror(status));
// return status; return status;
// }
//
// status = create_configure(manifest);
// if (status != 0) {
// fprintf(stderr,
// "create_project: failed to create configure: %s\n",
// strerror(status));
// return status;
// }
//
// status = maybe_create_clang_format(manifest);
// if (status != 0) {
// fprintf(stderr,
// "create_project: warning: clang-format setup failed: %s\n",
// strerror(status));
// }
//
// char *licence_line = malloc(1024);
// if (!licence_line) {
// fprintf(stderr,
// "create_project: failed to allocate memory for licence line\n");
// return ENOMEM;
// }
//
// status = create_licence(manifest, &licence_line);
// if (status != 0) {
// fprintf(stderr,
// "create_project: failed to create licence: %s\n",
// strerror(status));
// free(licence_line);
// return status;
// }
//
// status = generate_source_code(manifest, licence_line);
// if (status != 0) {
// fprintf(stderr,
// "create_project: failed to generate source code: %s\n",
// strerror(status));
// free(licence_line);
// return status;
// }
//
// free(licence_line);
//
// status = create_libraries(manifest);
// if (status != 0) {
// printfn("failed to get libraries: %s", strerror(status));
// return status;
// }
//
// status = setup_git(manifest);
// if (status != 0) {
// printfn("warning: git initialization failed: %s",
// strerror(status));
// }
char *resolved;
resolved = malloc(PATH_MAX);
if (!resolved) {
printfn("Failed to alloc");
return 2;
} }
if (!realpath(manifest.path, resolved)) {
printfn("Failed to get realpath"); status = create_configure(manifest);
free(resolved); if (status != 0) {
fprintf(stderr,
"create_project: failed to create configure: %s\n",
strerror(status));
return status;
}
status = maybe_create_clang_format(manifest);
if (status != 0) {
fprintf(stderr,
"create_project: warning: clang-format setup failed: %s\n",
strerror(status));
}
char *licence_line = malloc(1024);
if (!licence_line) {
fputs("create_project: failed to allocate memory for licence line\n",
stderr);
return ENOMEM;
}
status = create_licence(manifest, &licence_line);
if (status != 0) {
fprintf(stderr,
"create_project: failed to create licence: %s\n",
strerror(status));
free(licence_line);
return status;
}
status = generate_source_code(manifest, licence_line);
if (status != 0) {
fprintf(stderr,
"create_project: failed to generate source code: %s\n",
strerror(status));
free(licence_line);
return status;
}
free(licence_line);
status = create_libraries(manifest);
if (status != 0) {
printfn("failed to get libraries: %s", strerror(status));
return status;
}
status = setup_git(manifest);
if (status != 0) {
printfn("warning: git initialization failed: %s",
strerror(status));
}
char *resolved = realpath(manifest.path, NULL);
if (!resolved) {
fprintf(stderr, "Failed to get realpath for '%s': %s\n",
manifest.path, strerror(errno));
return 2; return 2;
} }
fprintf(stderr, "Created %s at\n %s\n", manifest.project, resolved); fprintf(stderr, "Created %s at\n %s\n", manifest.project, resolved);
free(resolved);
return 0; return 0;
} }

0
tools/Cleanup Executable file → Normal file
View File

0
tools/check_header Executable file → Normal file
View File

0
tools/format Executable file → Normal file
View File