diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Add a dist target and build releases through it
| -rw-r--r-- | .github/workflows/release.yml | 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rw-r--r-- | Makefile | 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rwxr-xr-x | tools/release-build.sh | 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 files changed, 24 insertions, 10 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12226f9..994e8eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,14 +31,8 @@ jobs: package() { # $1 = release-build.sh arg, $2 = tarball suffix ./tools/release-build.sh $1 dist="cgit-${GITHUB_REF_NAME}${2}" - mkdir -p "$dist" - cp build/cgit "$dist/cgit.cgi" - cp assets/cgit.css assets/cgit.js assets/cgit.png assets/favicon.ico assets/robots.txt "$dist/" - cp cgitrc.5.txt README.txt LICENSE.txt AUTHORS "$dist/" - # Ship the filter scripts and the example configs, hooks and - # server setups that the docs and cgitrc reference. - cp -r extensions examples "$dist/" - tar czf "${dist}.tar.gz" "$dist" + make dist DIST_NAME="$dist" + mv "build/${dist}.tar.gz" . sha256sum "${dist}.tar.gz" > "${dist}.tar.gz.sha256" } package "" "" @@ -43,6 +43,13 @@ mandir = $(prefix)/share/man ASSETS = cgit.css cgit.js cgit.png favicon.ico robots.txt FILTER_FILES = $(notdir $(wildcard $(EXTDIR)/*.lua)) +# Extra files and whole trees the dist target bundles into the release tarball, +# alongside the binary and the assets above. +DIST_DOCS = cgitrc.5.txt README.txt LICENSE.txt AUTHORS +DIST_TREES = $(EXTDIR) examples +DIST_NAME = cgit-$(CGIT_VERSION) +DIST_DIR = $(BUILDDIR)/$(DIST_NAME) + # The man-page source (*.5.txt) sits at the project root and is rendered into # build/. Only one man section exists, so DOC_* derive straight from MAN5_TXT. MAN5_TXT = $(wildcard *.5.txt) @@ -131,6 +138,19 @@ uninstall-html: rm -fv $(DESTDIR)$(htmldir)/$$i; \ done +# Stage a release tarball under build/ from an already-built binary. It has no +# `all` prerequisite on purpose, so tools/release-build.sh keeps ownership of +# the hardening flags rather than triggering a plain rebuild here. +dist: + @test -f $(BUILDDIR)/cgit || { echo 'build/cgit missing, run make first' >&2; exit 1; } + $(RM) -r $(DIST_DIR) + $(INSTALL) -m 0755 -d $(DIST_DIR) + $(INSTALL) -m 0755 $(BUILDDIR)/cgit $(DIST_DIR)/$(CGIT_SCRIPT_NAME) + $(INSTALL) -m 0644 $(addprefix $(ASSETDIR)/,$(ASSETS)) $(DIST_DIR) + $(INSTALL) -m 0644 $(DIST_DOCS) $(DIST_DIR) + $(COPYTREE) $(DIST_TREES) $(DIST_DIR) + tar czf $(DIST_DIR).tar.gz -C $(BUILDDIR) $(DIST_NAME) + # Compiled output lives under build/; the test suite writes into tests/, so # cleaning removes both. The tests descent is guarded because tests/Makefile # includes git's config.mak.uname, which needs the submodule present. @@ -155,4 +175,4 @@ tags: .PHONY: doc doc-man doc-html .PHONY: install install-doc install-man install-html .PHONY: uninstall uninstall-doc uninstall-man uninstall-html -.PHONY: clean cleanall get-git tags +.PHONY: dist clean cleanall get-git tags diff --git a/tools/release-build.sh b/tools/release-build.sh index 92aa78b..ee6b501 100755 --- a/tools/release-build.sh +++ b/tools/release-build.sh @@ -32,5 +32,5 @@ LDFLAGS="-pie \ # A full rebuild so the bundled git objects pick up the same flags. # cleanall also descends into git/, which plain clean does not. -make $LUA cleanall +make cleanall exec make $LUA CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" |
