bulk changes
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -66,10 +67,18 @@ int create_project(manifest_t manifest)
|
||||
flast = true;
|
||||
cfprintf("doc/WHATNEXT", what_next);
|
||||
|
||||
fprintf(stderr, "Changing permissions 1");
|
||||
if (chmod("configure", 0755) == -1) {
|
||||
fprintf(stderr, "\n");
|
||||
perror("chmod");
|
||||
return 1;
|
||||
}
|
||||
fprintf(stderr, ", done.\n");
|
||||
|
||||
main_source = "src/main.c";
|
||||
break;
|
||||
case FASM:
|
||||
snprintf(buffer, BUFSIZ, "%s.txt", manifest.project);
|
||||
snprintf(buffer, BUFSIZ, "%s.TXT", manifest.project);
|
||||
for (int i = 0; buffer[i] != '\0'; ++i)
|
||||
buffer[i] = toupper((unsigned char)buffer[i]);
|
||||
cfprintf(
|
||||
@@ -83,6 +92,14 @@ int create_project(manifest_t manifest)
|
||||
"#!/bin/sh\n\ncc SOURCE/main.c -o %s",
|
||||
manifest.project);
|
||||
|
||||
fprintf(stderr, "Changing permissions 1");
|
||||
if (chmod("TOOLS/build.sh", 0755) == -1) {
|
||||
fprintf(stderr, "\n");
|
||||
perror("chmod");
|
||||
return 1;
|
||||
}
|
||||
fprintf(stderr, ", done.\n");
|
||||
|
||||
main_source = "SOURCE/main.c";
|
||||
break;
|
||||
case GNU:
|
||||
@@ -146,16 +163,31 @@ int create_project(manifest_t manifest)
|
||||
abort();
|
||||
}
|
||||
|
||||
if (manifest.libraries.ncurses)
|
||||
if (manifest.libraries.ncurses) {
|
||||
fprintf(stderr, "Pulling ncurses");
|
||||
system("git submodule add --quiet https://github.com/mirror/ncurses");
|
||||
if (manifest.libraries.raylib)
|
||||
fprintf(stderr, ", done.\n");
|
||||
}
|
||||
if (manifest.libraries.raylib) {
|
||||
fprintf(stderr, "Pulling raylib");
|
||||
system("git submodule add --quiet https://github.com/raysan5/raylib");
|
||||
if (manifest.libraries.stb)
|
||||
fprintf(stderr, ", done.\n");
|
||||
}
|
||||
if (manifest.libraries.stb) {
|
||||
fprintf(stderr, "Pulling stb");
|
||||
system("git submodule add --quiet https://github.com/nothings/stb");
|
||||
if (manifest.libraries.uthash)
|
||||
fprintf(stderr, ", done.\n");
|
||||
}
|
||||
if (manifest.libraries.uthash) {
|
||||
fprintf(stderr, "Pulling uthash");
|
||||
system("git submodule add --quiet https://github.com/troydhanson/uthash");
|
||||
if (manifest.libraries.linenoise)
|
||||
fprintf(stderr, ", done.\n");
|
||||
}
|
||||
if (manifest.libraries.linenoise) {
|
||||
fprintf(stderr, "Pulling linenoise");
|
||||
system("git submodule add --quiet https://github.com/antirez/linenoise");
|
||||
fprintf(stderr, ", done.\n");
|
||||
}
|
||||
|
||||
switch (manifest.licence) {
|
||||
case MIT:
|
||||
@@ -174,6 +206,12 @@ int create_project(manifest_t manifest)
|
||||
abort();
|
||||
}
|
||||
|
||||
if (!manifest.flags.git) {
|
||||
fprintf(stderr, "Initializing git reposity");
|
||||
system("git init --quiet");
|
||||
fprintf(stderr, ", done.\n");
|
||||
}
|
||||
|
||||
if (manifest.flags.editor) {
|
||||
snprintf(buffer, BUFSIZ, "nvim %s", main_source);
|
||||
system(buffer);
|
||||
|
||||
@@ -115,7 +115,7 @@ static int parse_arguments(manifest_t *conf, int argc, char **argv)
|
||||
}
|
||||
|
||||
if (optind >= argc) {
|
||||
fputs("error: missing required positional argument", stderr);
|
||||
fputs("error: missing required positional argument\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
conf->project = str_dup(argv[optind]);
|
||||
@@ -165,7 +165,7 @@ int main(int argc, char **argv)
|
||||
.name = "author",
|
||||
.editor = "nano",
|
||||
.licence = UNL,
|
||||
.style = SIMPLE,
|
||||
.style = POSIX,
|
||||
|
||||
.libraries.ncurses = false,
|
||||
.libraries.raylib = false,
|
||||
|
||||
@@ -44,13 +44,14 @@ char *configure =
|
||||
line ("trycc () { test -z \"$CC\" && cmdexists \"$1\" && CC=$1 ; }")
|
||||
line ()
|
||||
line ("prefix=/usr/bin/")
|
||||
line ("CFLAGS=\"-Wall -Wextra -O2\"")
|
||||
line ("CFLAGS=\"-Wall -Wextra -O2 --std=c23 -Wpedantic\"")
|
||||
line ("LDFLAGS=")
|
||||
line ("CC=")
|
||||
line ()
|
||||
line ("for arg ; do")
|
||||
line ("case \"$arg\" in")
|
||||
line ("--help|h) usage ;;")
|
||||
line ("--prefix=*) prefix=${arg#*=} ;;")
|
||||
line ("CFLAGS=*) CFLAGS=${arg#*=} ;;")
|
||||
line ("LDFLAGS=*) LDFLAGS=${arg#*=} ;;")
|
||||
line ("esac")
|
||||
|
||||
Reference in New Issue
Block a user