aboutsummaryrefslogtreecommitdiff
path: root/GNUmakefile.in
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2024-03-25 06:28:19 +0100
committerPeter Eisentraut <peter@eisentraut.org>2024-03-25 06:29:53 +0100
commit619bc23a1a2f3750ac3668fe5a7564bc51e01684 (patch)
tree4c9db6225048bc06cbc5b7cc2f0402d884393024 /GNUmakefile.in
parent80d5d4937c168af46c976feebe24765ad76eb540 (diff)
downloadpostgresql-619bc23a1a2f3750ac3668fe5a7564bc51e01684.tar.gz
postgresql-619bc23a1a2f3750ac3668fe5a7564bc51e01684.zip
make dist uses git archive
This changes "make dist" to directly use "git archive", rather than the custom shell script it currently runs. This is to make the creation of the distribution tarball more directly traceable to the git repository. That is why we removed the "make distprep" step. "make dist" continues to produce a .gz and a .bz2 tarball as before. The archives produced this way are deterministic and reproducible, meaning for a given commit the result file should always be bit-for-bit identical. The exception is that if you use a git version older than 2.38.0, gzip records the platform in the archive, so you'd get a different output on Windows vs. macOS vs. "UNIX" (everything else). In git 2.38.0, this was changed so that everything is recorded as "UNIX" now. This is just something to keep in mind. This issue is specific to the gzip format, it does not affect other compression formats. Meson has its own distribution building command (meson dist), but we are not using that at this point. The main problem is that, the way they have implemented it, it is not deterministic in the above sense. Also, we want a "make" version for the time being. But the target name "dist" in meson is reserved for that reason, so we call the custom target "pgdist" (so call something like "meson compile -C build pgdist"). Reviewed-by: Tristan Partin <tristan@neon.tech> Discussion: https://www.postgresql.org/message-id/flat/40e80f77-a294-4f29-a16f-e21bc7bc75fc%40eisentraut.org
Diffstat (limited to 'GNUmakefile.in')
-rw-r--r--GNUmakefile.in32
1 files changed, 14 insertions, 18 deletions
diff --git a/GNUmakefile.in b/GNUmakefile.in
index 4d8fc794bbb..30553b2a950 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -87,29 +87,25 @@ update-unicode: | submake-generated-headers submake-libpgport
distdir = postgresql-$(VERSION)
dummy = =install=
-dist: $(distdir).tar.gz $(distdir).tar.bz2
- rm -rf $(distdir)
+GIT = git
-$(distdir).tar: distdir
- $(TAR) chf $@ $(distdir)
+dist: $(distdir).tar.gz $(distdir).tar.bz2
-.INTERMEDIATE: $(distdir).tar
+.PHONY: $(distdir).tar.gz $(distdir).tar.bz2
distdir-location:
@echo $(distdir)
-distdir:
- rm -rf $(distdir)* $(dummy)
- for x in `cd $(top_srcdir) && find . \( -name CVS -prune \) -o \( -name .git -prune \) -o -print`; do \
- file=`expr X$$x : 'X\./\(.*\)'`; \
- if test -d "$(top_srcdir)/$$file" ; then \
- mkdir "$(distdir)/$$file" && chmod 777 "$(distdir)/$$file"; \
- else \
- ln "$(top_srcdir)/$$file" "$(distdir)/$$file" >/dev/null 2>&1 \
- || cp "$(top_srcdir)/$$file" "$(distdir)/$$file"; \
- fi || exit; \
- done
- $(MAKE) -C $(distdir) distclean
+# Note: core.autocrlf=false is needed to avoid line-ending conversion
+# in case the environment has a different setting. Without this, a
+# tarball created on Windows might be different than on, and unusable
+# on, Unix machines.
+
+$(distdir).tar.gz:
+ $(GIT) -C $(srcdir) -c core.autocrlf=false archive --format tar.gz -9 --prefix $(distdir)/ HEAD -o $(abs_top_builddir)/$@
+
+$(distdir).tar.bz2:
+ $(GIT) -C $(srcdir) -c core.autocrlf=false -c tar.tar.bz2.command='$(BZIP2) -c' archive --format tar.bz2 --prefix $(distdir)/ HEAD -o $(abs_top_builddir)/$@
distcheck: dist
rm -rf $(dummy)
@@ -135,4 +131,4 @@ headerscheck: submake-generated-headers
cpluspluscheck: submake-generated-headers
$(top_srcdir)/src/tools/pginclude/headerscheck --cplusplus $(top_srcdir) $(abs_top_builddir)
-.PHONY: dist distdir distcheck docs install-docs world check-world install-world installcheck-world headerscheck cpluspluscheck
+.PHONY: dist distcheck docs install-docs world check-world install-world installcheck-world headerscheck cpluspluscheck