Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] patchlevel.h broken when building outside the source tree



Zsh's build process has for a long time supported compiling the shell in
a separate tree parallel to the source.  I use this, for example, to
build both a static and a dynamic-link version of the shell from the
same sources.

The change to use git-describe for ZSH_PATCHLEVEL broke such builds.

The following is not an ideal patch because make still fails to notice
when "cd $(sdir) && git ..." fails, and therefore happily builds a shell
with an empty-string $ZSH_PATCHLEVEL, but that can at least be unlikely.


diff --git a/Makefile.in b/Makefile.in
index a29ab78..197276c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -160,7 +160,7 @@ targz-src: $(DISTNAME).tar.gz
 $(DISTNAME).tar.gz: FORCE
 	@$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) SRC \
 	    $(MAKE) $(MAKEDEFS)
-	echo '#define ZSH_PATCHLEVEL "'`git describe --tags --long`'"' >$(DISTNAME)/Src/patchlevel.h.release
+	echo '#define ZSH_PATCHLEVEL "'`cd $(sdir_top) && git describe --tags --long`'"' >$(DISTNAME)/Src/patchlevel.h.release
 	tar cf - $(DISTNAME) | gzip -9 > $@
 	rm -rf $(DISTNAME)
 
diff --git a/Src/zsh.mdd b/Src/zsh.mdd
index 0fec5c3..4bc884b 100644
--- a/Src/zsh.mdd
+++ b/Src/zsh.mdd
@@ -43,7 +43,7 @@ patchlevel.h: FORCE
 	@if [ -f $(sdir)/$@.release ]; then \
 	  cp -f $(sdir)/$@.release $@; \
 	else \
-	  echo '#define ZSH_PATCHLEVEL "'`git describe --tags --long`'"' > $@.tmp; \
+	  echo '#define ZSH_PATCHLEVEL "'`cd $(sdir) && git describe --tags --long`'"' > $@.tmp; \
 	  cmp $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@; \
 	fi
 FORCE:

-- 
Barton E. Schaefer



Messages sorted by: Reverse Date, Date, Thread, Author