bulk changes

This commit is contained in:
2025-08-24 18:36:56 -04:00
parent 88656994c9
commit 45bfdb155c
5 changed files with 73 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ install: $(YAIT)
cp $(YAIT) $(PREFIX) cp $(YAIT) $(PREFIX)
uninstall: uninstall:
$(RM) $(DESTDIR)$(PREFIX)/bin/yait $(RM) $(PREFIX)yait
clean: clean:
$(RM) -r bin $(RM) -r bin

View File

@@ -10,6 +10,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
@@ -66,10 +67,18 @@ int create_project(manifest_t manifest)
flast = true; flast = true;
cfprintf("doc/WHATNEXT", what_next); 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"; main_source = "src/main.c";
break; break;
case FASM: case FASM:
snprintf(buffer, BUFSIZ, "%s.txt", manifest.project); snprintf(buffer, BUFSIZ, "%s.TXT", manifest.project);
for (int i = 0; buffer[i] != '\0'; ++i) for (int i = 0; buffer[i] != '\0'; ++i)
buffer[i] = toupper((unsigned char)buffer[i]); buffer[i] = toupper((unsigned char)buffer[i]);
cfprintf( cfprintf(
@@ -83,6 +92,14 @@ int create_project(manifest_t manifest)
"#!/bin/sh\n\ncc SOURCE/main.c -o %s", "#!/bin/sh\n\ncc SOURCE/main.c -o %s",
manifest.project); 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"; main_source = "SOURCE/main.c";
break; break;
case GNU: case GNU:
@@ -146,16 +163,31 @@ int create_project(manifest_t manifest)
abort(); abort();
} }
if (manifest.libraries.ncurses) if (manifest.libraries.ncurses) {
fprintf(stderr, "Pulling ncurses");
system("git submodule add --quiet https://github.com/mirror/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"); 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"); 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"); 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"); system("git submodule add --quiet https://github.com/antirez/linenoise");
fprintf(stderr, ", done.\n");
}
switch (manifest.licence) { switch (manifest.licence) {
case MIT: case MIT:
@@ -174,6 +206,12 @@ int create_project(manifest_t manifest)
abort(); abort();
} }
if (!manifest.flags.git) {
fprintf(stderr, "Initializing git reposity");
system("git init --quiet");
fprintf(stderr, ", done.\n");
}
if (manifest.flags.editor) { if (manifest.flags.editor) {
snprintf(buffer, BUFSIZ, "nvim %s", main_source); snprintf(buffer, BUFSIZ, "nvim %s", main_source);
system(buffer); system(buffer);

View File

@@ -115,7 +115,7 @@ static int parse_arguments(manifest_t *conf, int argc, char **argv)
} }
if (optind >= argc) { if (optind >= argc) {
fputs("error: missing required positional argument", stderr); fputs("error: missing required positional argument\n", stderr);
return 1; return 1;
} }
conf->project = str_dup(argv[optind]); conf->project = str_dup(argv[optind]);
@@ -165,7 +165,7 @@ int main(int argc, char **argv)
.name = "author", .name = "author",
.editor = "nano", .editor = "nano",
.licence = UNL, .licence = UNL,
.style = SIMPLE, .style = POSIX,
.libraries.ncurses = false, .libraries.ncurses = false,
.libraries.raylib = false, .libraries.raylib = false,

View File

@@ -44,13 +44,14 @@ char *configure =
line ("trycc () { test -z \"$CC\" && cmdexists \"$1\" && CC=$1 ; }") line ("trycc () { test -z \"$CC\" && cmdexists \"$1\" && CC=$1 ; }")
line () line ()
line ("prefix=/usr/bin/") line ("prefix=/usr/bin/")
line ("CFLAGS=\"-Wall -Wextra -O2\"") line ("CFLAGS=\"-Wall -Wextra -O2 --std=c23 -Wpedantic\"")
line ("LDFLAGS=") line ("LDFLAGS=")
line ("CC=") line ("CC=")
line () line ()
line ("for arg ; do") line ("for arg ; do")
line ("case \"$arg\" in") line ("case \"$arg\" in")
line ("--help|h) usage ;;") line ("--help|h) usage ;;")
line ("--prefix=*) prefix=${arg#*=} ;;")
line ("CFLAGS=*) CFLAGS=${arg#*=} ;;") line ("CFLAGS=*) CFLAGS=${arg#*=} ;;")
line ("LDFLAGS=*) LDFLAGS=${arg#*=} ;;") line ("LDFLAGS=*) LDFLAGS=${arg#*=} ;;")
line ("esac") line ("esac")

24
tools/new-doc Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
name=$1
cat <<EOF > doc/$name
Yb dP db 88 888888
YbdP dPYb 88 88
8P dP__Yb 88 88
dP dP""""Yb 88 88
yait manual
$name
$(printf '%*s\n' "${#name}" '' | tr ' ' '#')
EOF
if [ "$EDITOR" = "nvim" ]; then
nvim +'normal! Gi' doc/$name
exit 0
fi
$EDITOR doc/$name