Diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 50 |
1 file changed, 26 insertions, 24 deletions
@@ -12,11 +12,8 @@ # run their own jobs in parallel. .NOTPARALLEL: -# Sources live in source/, web assets in assets/, Lua filters in -# custom/extensions/, the bundled Git tree in vendor/git, and everything -# generated lands in build/. CGIT_ROOT leads from inside the Git tree back to -# the project root, because the cgit build runs with vendor/git as its working -# directory. +# CGIT_ROOT leads from inside the Git tree back to the project root, because +# the cgit build runs with vendor/git as its working directory. SRCDIR = source ASSETDIR = assets EXTDIR = custom/extensions @@ -32,18 +29,17 @@ GIT_SHA256 = 26c56c296b38c0695b26fa95f475f1d01704d2d38e73465ca30b0b2f5dc789d3 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VERSION).tar.xz GIT_TARBALL = git-$(GIT_VERSION).tar.xz -# Compiled-in cgit defaults, all overridable through cgit.conf. Every one -# carries the CGIT_ prefix except CACHE_ROOT, which is inherited from upstream -# under that name. -CGIT_VERSION = v2.9.2 +# The defaults compiled into cgit and the directories make install writes to, +# all overridable through cgit.conf. +CGIT_VERSION = v2.11.1 CGIT_SCRIPT_NAME = cgit.cgi CGIT_SCRIPT_PATH = /var/www/htdocs/cgit CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) CGIT_CONFIG = /etc/cgitrc CACHE_ROOT = /var/cache/cgit -# The standard GNU install directories, kept lowercase so that packaging can -# override them. filterdir is the one cgit-specific addition. +# The standard GNU install directories, under the lowercase names packaging +# expects. filterdir is the one cgit-specific addition. prefix = /usr/local libdir = $(prefix)/lib filterdir = $(libdir)/cgit/filters @@ -64,8 +60,7 @@ INSTALL = install -include $(GITDIR)/config.mak.uname -include cgit.conf -export CGIT_VERSION CGIT_SCRIPT_NAME CGIT_SCRIPT_PATH -export CGIT_DATA_PATH CGIT_CONFIG CACHE_ROOT +export CGIT_VERSION CGIT_SCRIPT_NAME CGIT_CONFIG CACHE_ROOT .PHONY: all all: cgit @@ -101,8 +96,6 @@ cgit-nolua: sparse: +@$(MAKE) -C $(GITDIR) -f $(CGIT_ROOT)/$(SRCDIR)/cgit.mk $(GIT_BUILD_FLAGS) cgit-sparse -# The two builds share the Git tree, so they are made one after the other -# even under -j. .PHONY: test test: cgit-with-git +@$(MAKE) cgit-nolua @@ -129,10 +122,8 @@ uninstall: $(RM) $(addprefix $(DESTDIR)$(CGIT_DATA_PATH)/,$(ASSETS)) $(RM) $(addprefix $(DESTDIR)$(filterdir)/,$(FILTER_FILES)) -# Compiled output lives under build/ and the test suite writes into tests/, so -# cleaning removes both. The descent into tests is guarded because -# tests/Makefile includes git's config.mak.uname, which needs the submodule -# present. +# The descent into tests is guarded because tests/Makefile includes git's +# config.mak.uname, which needs the submodule present. .PHONY: clean clean: $(RM) -r $(BUILDDIR) @@ -143,14 +134,25 @@ cleanall: clean @if test -e $(GITDIR)/Makefile; then $(MAKE) -C $(GITDIR) clean; fi # The tarball is checked against its sum before anything is unpacked from it. -# An older macOS has no sha256sum, but its shasum reads the same format. +# Each system ships its own fetcher and sum tool (curl or wget on Linux and +# macOS, fetch on FreeBSD, ftp on OpenBSD and NetBSD, sha256 on the BSDs), so +# the first one present is used, and xz is piped to tar for a tar that cannot +# read it, as OpenBSD's cannot. .PHONY: get-git get-git: mkdir -p $(dir $(GITDIR)) - curl -fL -o $(GIT_TARBALL) $(GIT_URL) - @if command -v sha256sum >/dev/null; then sum=sha256sum; else sum='shasum -a 256'; fi; \ - echo '$(GIT_SHA256) $(GIT_TARBALL)' | $$sum -c - || { $(RM) $(GIT_TARBALL); exit 1; } - tar -xJf $(GIT_TARBALL) && rm -rf $(GITDIR) && mv git-$(GIT_VERSION) $(GITDIR) + @if command -v curl >/dev/null; then curl -fL -o $(GIT_TARBALL) $(GIT_URL); \ + elif command -v wget >/dev/null; then wget -O $(GIT_TARBALL) $(GIT_URL); \ + elif command -v fetch >/dev/null; then fetch -o $(GIT_TARBALL) $(GIT_URL); \ + else ftp -o $(GIT_TARBALL) $(GIT_URL); fi + @if command -v sha256sum >/dev/null; then sum=$$(sha256sum $(GIT_TARBALL)); \ + elif command -v shasum >/dev/null; then sum=$$(shasum -a 256 $(GIT_TARBALL)); \ + elif command -v sha256 >/dev/null; then sum=$$(sha256 -q $(GIT_TARBALL)); \ + else sum=$$(openssl dgst -sha256 -r $(GIT_TARBALL)); fi; \ + test "$${sum%% *}" = '$(GIT_SHA256)' || \ + { echo 'get-git: $(GIT_TARBALL) does not match its sum' >&2; $(RM) $(GIT_TARBALL); exit 1; } + @if command -v xz >/dev/null; then xz -dc $(GIT_TARBALL) | tar -xf -; else tar -xJf $(GIT_TARBALL); fi + rm -rf $(GITDIR) && mv git-$(GIT_VERSION) $(GITDIR) $(RM) $(GIT_TARBALL) .PHONY: tags |
