autofoo: Rework git tag/release stuff

- Add 'release' target to make dist without git tag in rpm name.
- Use .git-src (not .git) to test if we are building from git.
This commit is contained in:
Kim Woelders 2022-10-23 08:08:58 +02:00
parent 489cf37b12
commit 191b9bac47
3 changed files with 13 additions and 9 deletions

0
.git-src Normal file
View File

View File

@ -33,19 +33,25 @@ dist-hook: $(top_builddir)/$(PACKAGE).spec
cd $(top_srcdir) && $(AUTOMAKE) --foreign $(abs_builddir)/$(distdir)/test/Makefile; \ cd $(top_srcdir) && $(AUTOMAKE) --foreign $(abs_builddir)/$(distdir)/test/Makefile; \
fi fi
if SRC_IS_GIT RPR_DEV = `echo -n "1.%(date '+%y%m%d').git"; git rev-parse --short=8 HEAD`
RPM_RELEASE=`echo -n "1.%(date '+%y%m%d').git"; git rev-parse --short=8 HEAD` RPR_REL = 1
else SED_DEV = "s/\@PACKAGE\@/@PACKAGE@/;s/\@VERSION\@/@VERSION@/;s/\@RPM_RELEASE\@/$(RPR_DEV)/"
RPM_RELEASE=`echo -n "1.%(date '+%y%m%d')"` SED_REL = "s/\@PACKAGE\@/@PACKAGE@/;s/\@VERSION\@/@VERSION@/;s/\@RPM_RELEASE\@/$(RPR_REL)/"
endif
$(top_builddir)/$(PACKAGE).spec: FORCE $(top_builddir)/$(PACKAGE).spec: FORCE
sed "s/\@PACKAGE\@/@PACKAGE@/;s/\@VERSION\@/@VERSION@/;s/\@RPM_RELEASE\@/$(RPM_RELEASE)/" \ @if [ -f $(top_srcdir)/.git-src -a -z "$(release)" ]; then \
$(top_srcdir)/$(PACKAGE).spec.in > $@ sed $(SED_DEV) $(top_srcdir)/$(PACKAGE).spec.in > $@; \
else \
sed $(SED_REL) $(top_srcdir)/$(PACKAGE).spec.in > $@; \
fi
.PHONY: doc src test .PHONY: doc src test
doc src test: doc src test:
$(MAKE) -C $@ $(MAKE) -C $@
test: src test: src
.PHONY: release
release:
$(MAKE) dist release=y
FORCE: FORCE:

View File

@ -7,8 +7,6 @@ AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(1.6 dist-xz -Wno-portability) AM_INIT_AUTOMAKE(1.6 dist-xz -Wno-portability)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_CONDITIONAL(SRC_IS_GIT, test -d $srcdir/.git)
AC_C_BIGENDIAN AC_C_BIGENDIAN
AC_PROG_CC AC_PROG_CC
AM_PROG_AS AM_PROG_AS