aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile9
-rw-r--r--resources.go11
-rw-r--r--templates/_footer.tmpl2
4 files changed, 9 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
index c6e998b..c1935f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
/forge
/version.go
/vendor
+/source.tar.gz
diff --git a/Makefile b/Makefile
index 3783d4f..4344a99 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,12 @@
# SPDX-License-Identifier: AGPL-3.0-only
# SPDX-FileContributor: Runxi Yu <https://runxiyu.org>
-.PHONY: clean version.go man
+.PHONY: clean version.go man source.tar.gz
CFLAGS = -Wall -Wextra -Werror -pedantic -std=c99 -D_GNU_SOURCE
MAN_PAGES = forge.5 hookc.1
-forge: version.go hookc/*.c hookc/hookc man # TODO
- go mod vendor
+forge: source.tar.gz version.go hookc/*.c hookc/hookc man # TODO
go build .
man: $(MAN_PAGES:%=man/%.html) $(MAN_PAGES:%=man/%.txt)
@@ -28,3 +27,7 @@ version.go:
clean:
$(RM) forge version.go vendor
+source.tar.gz:
+ rm -f source.tar.gz
+ go mod vendor
+ git ls-files -z | xargs -0 tar -czf source.tar.gz vendor
diff --git a/resources.go b/resources.go
index 54ff752..b0db7ee 100644
--- a/resources.go
+++ b/resources.go
@@ -13,16 +13,7 @@ import (
"github.com/tdewolff/minify/v2/html"
)
-// We embed all source for easy AGPL compliance.
-//
-//go:embed .gitignore .gitattributes
-//go:embed LICENSE README.md
-//go:embed *.go go.mod go.sum
-//go:embed *.scfg
-//go:embed Makefile
-//go:embed static/* templates/* scripts/* sql/* man/*
-//go:embed hookc/*.c
-//go:embed vendor/*
+//go:embed LICENSE source.tar.gz
var sourceFS embed.FS
var sourceHandler = http.StripPrefix(
diff --git a/templates/_footer.tmpl b/templates/_footer.tmpl
index 4971694..43611f5 100644
--- a/templates/_footer.tmpl
+++ b/templates/_footer.tmpl
@@ -5,7 +5,7 @@
{{- define "footer" -}}
<a href="https://lindenii.runxiyu.org/forge/">Lindenii Forge</a>
{{ .global.forge_version }}
-(<a href="/:/source/">source</a>,
+(<a href="/:/source/source.tar.gz">source</a>,
<a href="https://forge.lindenii.runxiyu.org/lindenii/forge/:/repos/server/">upstream</a>,
<a href="/:/source/LICENSE">license</a>)
{{- end -}}