Lindenii Project Forge
Login

server

Lindenii Forge’s main backend daemon
Commit info
ID
390faa0cf752c363d1ac82e9fb7ca58ef8df3c2e
Author
Runxi Yu <me@runxiyu.org>
Author date
Sun, 10 Aug 2025 10:04:30 +0800
Committer
Runxi Yu <me@runxiyu.org>
Committer date
Sun, 10 Aug 2025 10:06:13 +0800
Actions
Makefile: Remove source tarball generation
# 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 source.tar.gz $(wildcard LICENSE*) $(wildcard forged/static/*) $(wildcard forged/templates/*)
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 source.tar.gz */*.o

source.tar.gz: $(SOURCE_FILES)
	rm -f source.tar.gz
	git ls-files -z | xargs -0 tar -czf source.tar.gz
	rm -rf forge utils/colb hookc/hookc git2d/git2d */*.o

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

forged/internal/embed/.gitignore:
	@touch $@
/source.tar.gz
/hookc/hookc
/git2d/git2d
/static
/templates
/LICENSE*
/forged
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>

// Package embed provides embedded filesystems created in build-time.
package embed

import "embed"

// Source contains the licenses and source tarballs collected at build time.
// Source contains the licenses collected at build time.
// It is intended to be served to the user.
//
//go:embed LICENSE* source.tar.gz
//go:embed LICENSE*
var Source embed.FS

// Resources contains the templates and static files used by the web interface,
// as well as the git backend daemon and the hookc helper.
//
//go:embed forged/templates/* forged/static/*
//go:embed hookc/hookc git2d/git2d
var Resources embed.FS
{{/*
	SPDX-License-Identifier: AGPL-3.0-only
	SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>
*/}}
{{- define "footer" -}}
<a href="https://lindenii.runxiyu.org/forge/">Lindenii Forge</a>
{{ .global.forge_version }}
(<a href="/-/source/source.tar.gz">source</a>,
<a href="https://forge.lindenii.runxiyu.org/forge/-/repos/server/">upstream</a>,
(<a href="https://forge.lindenii.runxiyu.org/forge/-/repos/server/">upstream</a>,
<a href="/-/source/LICENSE">license</a>,
<a href="https://webirc.runxiyu.org/kiwiirc/#lindenii">support</a>)
{{- end -}}