Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@
# profiling bs
perf.data*
flamegraph.svg
callgrind.out*
callgrind.out*

# grainpit.cgi stuff
grainpit.cgi/grainpit.cgi
grainpit.cgi/main.o
grainpit.cgi/config.h
grainpit.cgi/generated.h
grainpit.cgi/generate
grainpit.cgi/generate.o
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ this is planned to be the preferred way to use grainpit once its completed

currently this is empty in the repo because the general project structure for it is still being figured out

### cgi script (unofficial)
### cgi script

see <https://codeberg.org/doclic/grainpit.cgi/>
> [!NOTE]
> this currently does not support the full feature set and may be out of date as it does not directly depend on the main grainpit library

written in c unlike the rest of the project (also means compatibility if you are on a machine without support for rust), thank you to @doclic for writing this implementation

## features

Expand Down
38 changes: 38 additions & 0 deletions grainpit.cgi/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.POSIX:

# compiler for the machine that runs the build
BUILDCC = $(CC)
BUILDCFLAGS = $(CFLAGS)
BUILDLDFLAGS = $(LDFLAGS)

# compiler for the machine that runs final program
HOSTCC = $(CC)
HOSTCFLAGS = $(CFLAGS)
HOSTLDFLAGS = $(LDFLAGS)

.PHONY: all clean

.DEFAULT: all

all: grainpit.cgi

clean:
rm -f grainpit.cgi main.o generated.h generate generate.o

grainpit.cgi: main.o
$(HOSTCC) $(HOSTLDFLAGS) -ograinpit.cgi main.o

main.o: main.c config.h generated.h
$(HOSTCC) $(HOSTCFLAGS) -c main.c

config.h:
cp config.def.h config.h

generated.h: generate
./generate

generate: generate.o
$(BUILDCC) $(BUILDLDFLAGS) -ogenerate generate.o

generate.o: generate.c
$(BUILDCC) $(BUILDCFLAGS) -c generate.c
6 changes: 6 additions & 0 deletions grainpit.cgi/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
grainpit.cgi

build with make
if you need to edit config edit config.h
the compilation uses a lot of memory (like 8gb) go complain to doclic if it causes issues

8 changes: 8 additions & 0 deletions grainpit.cgi/config.def.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* Default configuration file for grainpit.cgi */

/* make sure they all with a slash */
static const char *grainpit_extraurls[] = {
"https://example.com/",
};
/* range from 0 to 100, 0 means never, 100 means always */
static int grainpit_extraurls_chance = 5;
Loading
Loading