Lindenii Project Forge
Login

server

Lindenii Forge’s main backend daemon
Commit info
ID
77a4f5300122e0b107ea35d9e624909bcda580e3
Author
Runxi Yu <me@runxiyu.org>
Author date
Tue, 12 Aug 2025 10:21:16 +0800
Committer
Runxi Yu <me@runxiyu.org>
Committer date
Tue, 12 Aug 2025 10:21:16 +0800
Actions
Remove colb
# SPDX-License-Identifier: AGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>
#
# TODO: This Makefile utilizes a lot of GNU extensions. Some of them are
# unfortunately difficult to avoid as POSIX Make's pattern rules are not
# sufficiently expressive. This needs to be fixed sometime (or we might move to
# some other build system).
#

.PHONY: clean

CFLAGS = -Wall -Wextra -pedantic -std=c99 -D_GNU_SOURCE

VERSION = $(shell git describe --tags --always --dirty)
SOURCE_FILES = $(shell git ls-files)
EMBED = git2d/git2d hookc/hookc $(wildcard LICENSE*) $(wildcard forged/static/*) $(wildcard forged/templates/*)
EMBED_ = $(EMBED:%=forged/internal/embed/%)

forge: $(EMBED_) $(SOURCE_FILES)
	CGO_ENABLED=0 go build -o forge -ldflags '-extldflags "-f no-PIC -static" -X "go.lindenii.runxiyu.org/forge/forged/internal/unsorted.version=$(VERSION)"' -tags 'osusergo netgo static_build' ./forged

utils/colb:

hookc/hookc:

git2d/git2d: $(wildcard git2d/*.c)
	$(CC) $(CFLAGS) -o git2d/git2d $^ $(shell pkg-config --cflags --libs libgit2) -lpthread

clean:
	rm -rf forge utils/colb hookc/hookc git2d/git2d */*.o
	rm -rf forge hookc/hookc git2d/git2d */*.o

forged/internal/embed/%: %
	@mkdir -p $(shell dirname $@)
	@cp $^ $@

forged/internal/embed/.gitignore:
	@touch $@
/colb
/*-
 * SPDX-License-Identifier: GPL-3.0-only
 * SPDX-FileCopyrightText: Copyright (c) 2021 June McEnroe <june@causal.agency>
 */

#include <locale.h>
#include <stdio.h>
#include <wchar.h>

int
main(void)
{
	wint_t		next, prev = WEOF;

	setlocale(LC_CTYPE, "C.UTF-8");

	while (WEOF != (next = getwchar())) {
		if (next == L'\b') {
			prev = WEOF;
		} else {
			if (prev != WEOF)
				putwchar(prev);
			prev = next;
		}
	}
	if (prev != WEOF)
		putwchar(prev);
}