diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-02 02:34:41 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-02 02:34:41 +0100 |
| commit | 8201a711afc5336242dacb21d880f36f7845f011 (patch) | |
| tree | 3be28e18ba8826d6d7218fb2be72760f387f09b3 /Makefile | |
| parent | be82b2aa821d0635e8a7d12792b02e9e56675aa2 (diff) | |
Ensure that the current version has a tag before allowing to roll a distribution tarball
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 9 |
1 files changed, 7 insertions, 2 deletions
| @@ -40,12 +40,15 @@ FEATURES+=-DWANT_FULLSCRAPE | |||
| 40 | #FEATURES+=-D_DEBUG_RANDOMTORRENTS | 40 | #FEATURES+=-D_DEBUG_RANDOMTORRENTS |
| 41 | 41 | ||
| 42 | VERSION=1.0.0 | 42 | VERSION=1.0.0 |
| 43 | +GIT_VERSION=`sh -c 'test -r .tarball-version && read v < .tarball-version && echo "$$v" || { command -v git >/dev/null && test -d .git && git describe --tags --match "v*" --always --dirty 2>/dev/null; }'` | 43 | TARBALL_VERSION=test -r .tarball-version && read v < .tarball-version && echo "$$v" |
| 44 | HAVE_GIT=command -v git >/dev/null && test -d .git | ||
| 45 | GIT_VERSION=`sh -c '$(TARBALL_VERSION) || { $(HAVE_GIT) && git describe --tags --match "v*" --always --dirty 2>/dev/null; }'` | ||
| 46 | OT_TAG=`sh -c '$(TARBALL_VERSION) || { $(HAVE_GIT) && git describe --tags --match "v*" --exact-match 2>/dev/null; }'` | ||
| 44 | 47 | ||
| 45 | OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage | 48 | OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage |
| 46 | OPTS_production=-O3 | 49 | OPTS_production=-O3 |
| 47 | 50 | ||
| 48 | CFLAGS+=-DOT_VERSION=\"$(VERSION)\" -DGIT_VERSION=\"$(GIT_VERSION)\" -Wall -pipe -pthread -Wextra -Wwrite-strings #-ansi -pedantic | 51 | CFLAGS+=-DOT_VERSION=\"$(VERSION)\" -DGIT_VERSION=\"$(GIT_VERSION)\" -DOT_TAG=\"$(OT_TAG)\" -Wall -pipe -pthread -Wextra -Wwrite-strings #-ansi -pedantic |
| 49 | LDFLAGS+=-pthread | 52 | LDFLAGS+=-pthread |
| 50 | 53 | ||
| 51 | # Record feature flags as a dep to allow rebuild when they change | 54 | # Record feature flags as a dep to allow rebuild when they change |
| @@ -173,6 +176,8 @@ install: | |||
| 173 | DISTNAME=opentracker-$(VERSION) | 176 | DISTNAME=opentracker-$(VERSION) |
| 174 | 177 | ||
| 175 | dist: | 178 | dist: |
| 179 | @test "`git describe --tags --match 'v*' --exact-match 2>/dev/null`" = "v$(VERSION)" || \ | ||
| 180 | { echo "HEAD must carry the tag v$(VERSION). Tag the release, or correct VERSION."; exit 1; } | ||
| 176 | rm -rf $(DISTNAME) $(DISTNAME).tar.gz | 181 | rm -rf $(DISTNAME) $(DISTNAME).tar.gz |
| 177 | git archive --format=tar --prefix=$(DISTNAME)/ HEAD | tar -xf - | 182 | git archive --format=tar --prefix=$(DISTNAME)/ HEAD | tar -xf - |
| 178 | git describe --tags --match "v*" --always > $(DISTNAME)/.tarball-version | 183 | git describe --tags --match "v*" --always > $(DISTNAME)/.tarball-version |
