1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-25 12:03:53 +03:00

Remove distprep

A PostgreSQL release tarball contains a number of prebuilt files, in
particular files produced by bison, flex, perl, and well as html and
man documentation.  We have done this consistent with established
practice at the time to not require these tools for building from a
tarball.  Some of these tools were hard to get, or get the right
version of, from time to time, and shipping the prebuilt output was a
convenience to users.

Now this has at least two problems:

One, we have to make the build system(s) work in two modes: Building
from a git checkout and building from a tarball.  This is pretty
complicated, but it works so far for autoconf/make.  It does not
currently work for meson; you can currently only build with meson from
a git checkout.  Making meson builds work from a tarball seems very
difficult or impossible.  One particular problem is that since meson
requires a separate build directory, we cannot make the build update
files like gram.h in the source tree.  So if you were to build from a
tarball and update gram.y, you will have a gram.h in the source tree
and one in the build tree, but the way things work is that the
compiler will always use the one in the source tree.  So you cannot,
for example, make any gram.y changes when building from a tarball.
This seems impossible to fix in a non-horrible way.

Second, there is increased interest nowadays in precisely tracking the
origin of software.  We can reasonably track contributions into the
git tree, and users can reasonably track the path from a tarball to
packages and downloads and installs.  But what happens between the git
tree and the tarball is obscure and in some cases non-reproducible.

The solution for both of these issues is to get rid of the step that
adds prebuilt files to the tarball.  The tarball now only contains
what is in the git tree (*).  Getting the additional build
dependencies is no longer a problem nowadays, and the complications to
keep these dual build modes working are significant.  And of course we
want to get the meson build system working universally.

This commit removes the make distprep target altogether.  The make
dist target continues to do its job, it just doesn't call distprep
anymore.

(*) - The tarball also contains the INSTALL file that is built at make
dist time, but not by distprep.  This is unchanged for now.

The make maintainer-clean target, whose job it is to remove the
prebuilt files in addition to what make distclean does, is now just an
alias to make distprep.  (In practice, it is probably obsolete given
that git clean is available.)

The following programs are now hard build requirements in configure
(they were already required by meson.build):

- bison
- flex
- perl

Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
This commit is contained in:
Peter Eisentraut
2023-11-06 14:51:52 +01:00
parent b72de09a1b
commit 721856ff24
89 changed files with 175 additions and 416 deletions

View File

@@ -138,42 +138,33 @@ utils/activity/wait_event_types.h: utils/activity/generate-wait_event_types.pl u
# run this unconditionally to avoid needing to know its dependencies here:
submake-catalog-headers:
$(MAKE) -C catalog distprep generated-header-symlinks
$(MAKE) -C catalog generated-header-symlinks
# run this unconditionally to avoid needing to know its dependencies here:
submake-nodes-headers:
$(MAKE) -C nodes distprep generated-header-symlinks
$(MAKE) -C nodes generated-header-symlinks
# run this unconditionally to avoid needing to know its dependencies here:
submake-utils-headers:
$(MAKE) -C utils distprep generated-header-symlinks
$(MAKE) -C utils generated-header-symlinks
.PHONY: submake-catalog-headers submake-nodes-headers submake-utils-headers
# Make symlinks for these headers in the include directory. That way
# we can cut down on the -I options. Also, a symlink is automatically
# up to date when we update the base file.
#
# The point of the prereqdir incantation in some of the rules below is to
# force the symlink to use an absolute path rather than a relative path.
# For headers which are generated by make distprep, the actual header within
# src/backend will be in the source tree, while the symlink in src/include
# will be in the build tree, so a simple ../.. reference won't work.
# For headers generated during regular builds, we prefer a relative symlink.
.PHONY: generated-headers
generated-headers: $(top_builddir)/src/include/storage/lwlocknames.h $(top_builddir)/src/include/utils/wait_event_types.h submake-catalog-headers submake-nodes-headers submake-utils-headers
generated-headers: $(top_builddir)/src/include/storage/lwlocknames.h $(top_builddir)/src/include/utils/wait_event_types.h submake-catalog-headers submake-nodes-headers submake-utils-headers parser/gram.h
$(top_builddir)/src/include/storage/lwlocknames.h: storage/lmgr/lwlocknames.h
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
cd '$(dir $@)' && rm -f $(notdir $@) && \
$(LN_S) "$$prereqdir/$(notdir $<)" .
rm -f '$@'
$(LN_S) ../../backend/$< '$@'
$(top_builddir)/src/include/utils/wait_event_types.h: utils/activity/wait_event_types.h
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
cd '$(dir $@)' && rm -f $(notdir $@) && \
$(LN_S) "$$prereqdir/$(notdir $<)" .
rm -f '$@'
$(LN_S) ../../backend/$< '$@'
utils/probes.o: utils/probes.d $(SUBDIROBJS)
$(DTRACE) $(DTRACEFLAGS) -C -G -s $(call expand_subsys,$^) -o $@
@@ -181,16 +172,12 @@ utils/probes.o: utils/probes.d $(SUBDIROBJS)
##########################################################################
# Be sure that these files get removed by the maintainer-clean target
distprep:
# This target is only needed by nls.mk.
.PHONY: generated-parser-sources
generated-parser-sources:
$(MAKE) -C parser gram.c gram.h scan.c
$(MAKE) -C bootstrap bootparse.c bootparse.h bootscanner.c
$(MAKE) -C catalog distprep
$(MAKE) -C nodes distprep
$(MAKE) -C replication repl_gram.c repl_gram.h repl_scanner.c syncrep_gram.c syncrep_gram.h syncrep_scanner.c
$(MAKE) -C storage/lmgr lwlocknames.h lwlocknames.c
$(MAKE) -C utils distprep
$(MAKE) -C utils/activity wait_event_types.h pgstat_wait_event.c
$(MAKE) -C utils/adt jsonpath_gram.c jsonpath_gram.h jsonpath_scan.c
$(MAKE) -C utils/misc guc-file.c
@@ -290,34 +277,9 @@ ifeq ($(PORTNAME), win32)
endif
distclean: clean
# generated by configure
rm -f port/tas.s port/pg_sema.c port/pg_shmem.c
maintainer-clean: distclean
$(MAKE) -C catalog $@
$(MAKE) -C nodes $@
$(MAKE) -C utils $@
rm -f bootstrap/bootparse.c \
bootstrap/bootparse.h \
bootstrap/bootscanner.c \
parser/gram.c \
parser/gram.h \
parser/scan.c \
replication/repl_gram.c \
replication/repl_gram.h \
replication/repl_scanner.c \
replication/syncrep_gram.c \
replication/syncrep_gram.h \
replication/syncrep_scanner.c \
storage/lmgr/lwlocknames.c \
storage/lmgr/lwlocknames.h \
utils/activity/pgstat_wait_event.c \
utils/activity/wait_event_funcs_data.c \
utils/activity/wait_event_types.h \
utils/adt/jsonpath_gram.c \
utils/adt/jsonpath_gram.h \
utils/adt/jsonpath_scan.c \
utils/misc/guc-file.c
##########################################################################
#

View File

@@ -28,5 +28,7 @@ bootparse.c: BISONFLAGS += -d
# Force these dependencies to be known even without dependency info built:
bootparse.o bootscanner.o: bootparse.h
# bootparse.c and bootscanner.c are in the distribution tarball, so
# they are not cleaned here.
clean:
rm -f bootparse.c \
bootparse.h \
bootscanner.c

View File

@@ -152,9 +152,7 @@ POSTGRES_BKI_DATA = $(addprefix $(top_srcdir)/src/include/catalog/,\
pg_type.dat \
)
all: distprep generated-header-symlinks
distprep: bki-stamp
all: generated-header-symlinks
.PHONY: generated-header-symlinks
@@ -173,14 +171,12 @@ bki-stamp: genbki.pl Catalog.pm $(POSTGRES_BKI_SRCS) $(POSTGRES_BKI_DATA) $(top_
--set-version=$(MAJORVERSION) $(POSTGRES_BKI_SRCS)
touch $@
# The generated headers must all be symlinked into builddir/src/include/,
# using absolute links for the reasons explained in src/backend/Makefile.
# The generated headers must all be symlinked into src/include/.
# We use header-stamp to record that we've done this because the symlinks
# themselves may appear older than bki-stamp.
$(top_builddir)/src/include/catalog/header-stamp: bki-stamp
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
cd '$(dir $@)' && for file in $(GENERATED_HEADERS); do \
rm -f $$file && $(LN_S) "$$prereqdir/$$file" . ; \
rm -f $$file && $(LN_S) "../../../$(subdir)/$$file" . ; \
done
touch $@
@@ -201,9 +197,5 @@ installdirs:
uninstall-data:
rm -f $(addprefix '$(DESTDIR)$(datadir)'/, postgres.bki system_constraints.sql system_functions.sql system_views.sql information_schema.sql sql_features.txt)
# postgres.bki, system_constraints.sql, and the generated headers are
# in the distribution tarball, so they are not cleaned here.
clean:
maintainer-clean: clean
rm -f bki-stamp postgres.bki system_constraints.sql $(GENERATED_HEADERS)

View File

@@ -71,6 +71,6 @@ uninstall-types:
include $(top_srcdir)/src/Makefile.shlib
clean distclean maintainer-clean: clean-lib
clean distclean: clean-lib
rm -f $(OBJS)
rm -f llvmjit_types.bc

View File

@@ -22,7 +22,7 @@ GETTEXT_FLAGS = $(BACKEND_COMMON_GETTEXT_FLAGS) \
report_invalid_record:2:c-format \
ereport_startup_progress:1:c-format
gettext-files: distprep
gettext-files: generated-parser-sources generated-headers
find $(srcdir) $(srcdir)/../common $(srcdir)/../port -name '*.c' -print | LC_ALL=C sort >$@
my-clean:

View File

@@ -65,9 +65,7 @@ node_headers = \
# see also catalog/Makefile for an explanation of these make rules
all: distprep generated-header-symlinks
distprep: node-support-stamp
all: generated-header-symlinks
.PHONY: generated-header-symlinks
@@ -81,14 +79,12 @@ node-support-stamp: gen_node_support.pl $(addprefix $(top_srcdir)/src/include/,$
$(PERL) $^
touch $@
# These generated headers must be symlinked into builddir/src/include/,
# using absolute links for the reasons explained in src/backend/Makefile.
# These generated headers must be symlinked into src/include/.
# We use header-stamp to record that we've done this because the symlinks
# themselves may appear older than node-support-stamp.
$(top_builddir)/src/include/nodes/header-stamp: node-support-stamp
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
cd '$(dir $@)' && for file in nodetags.h; do \
rm -f $$file && $(LN_S) "$$prereqdir/$$file" . ; \
rm -f $$file && $(LN_S) "../../../$(subdir)/$$file" . ; \
done
touch $@
@@ -98,5 +94,5 @@ outfuncs.o: outfuncs.c outfuncs.funcs.c outfuncs.switch.c | node-support-stamp
queryjumblefuncs.o: queryjumblefuncs.c queryjumblefuncs.funcs.c queryjumblefuncs.switch.c | node-support-stamp
readfuncs.o: readfuncs.c readfuncs.funcs.c readfuncs.switch.c | node-support-stamp
maintainer-clean: clean
clean:
rm -f node-support-stamp $(addsuffix funcs.funcs.c,copy equal out queryjumble read) $(addsuffix funcs.switch.c,copy equal out queryjumble read) nodetags.h

View File

@@ -64,8 +64,8 @@ scan.c: FLEX_FIX_WARNING=yes
# Force these dependencies to be known even without dependency info built:
gram.o scan.o parser.o: gram.h
# gram.c, gram.h, and scan.c are in the distribution tarball, so they
# are not cleaned here.
clean distclean maintainer-clean:
clean:
rm -f gram.c \
gram.h \
scan.c
rm -f lex.backup

View File

@@ -43,6 +43,6 @@ else
$(CC) $(CFLAGS) -c $<
endif
distclean clean:
clean:
rm -f tas_cpp.s
$(MAKE) -C win32 clean

View File

@@ -48,6 +48,10 @@ syncrep_gram.c: BISONFLAGS += -d
# Force these dependencies to be known even without dependency info built:
syncrep_gram.o syncrep_scanner.o: syncrep_gram.h
# repl_gram.c, repl_scanner.c, syncrep_gram.c and syncrep_scanner.c
# are in the distribution tarball, so they are not cleaned here.
# (Our parent Makefile takes care of them during maintainer-clean.)
clean:
rm -f repl_gram.c \
repl_gram.h \
repl_scanner.c \
syncrep_gram.c \
syncrep_gram.h \
syncrep_scanner.c

View File

@@ -33,5 +33,5 @@ installdirs: installdirs-lib
uninstall: uninstall-lib
clean distclean maintainer-clean: clean-lib
clean distclean: clean-lib
rm -f $(OBJS)

View File

@@ -28,5 +28,5 @@ installdirs: installdirs-lib
uninstall: uninstall-lib
clean distclean maintainer-clean: clean-lib
clean distclean: clean-lib
rm -f $(OBJS)

View File

@@ -104,8 +104,6 @@ include $(top_srcdir)/src/Makefile.shlib
$(SQLSCRIPT): snowball_create.pl snowball_func.sql.in snowball.sql.in
$(PERL) $< --input ${srcdir} --outdir .
distprep: $(SQLSCRIPT)
install: all installdirs install-lib install-script
$(INSTALL_DATA) $(addprefix $(srcdir)/stopwords/,$(stop_files)) '$(DESTDIR)$(datadir)/$(DICTDIR)'
@@ -122,6 +120,4 @@ uninstall: uninstall-lib
clean distclean: clean-lib
rm -f $(OBJS)
maintainer-clean: distclean
rm -f $(SQLSCRIPT)

View File

@@ -45,8 +45,6 @@ lwlocknames.h: $(top_srcdir)/src/backend/storage/lmgr/lwlocknames.txt generate-l
check: s_lock_test
./s_lock_test
clean distclean:
clean:
rm -f s_lock_test
maintainer-clean: clean
rm -f lwlocknames.h lwlocknames.c

View File

@@ -34,13 +34,14 @@ catalogdir = $(top_srcdir)/src/backend/catalog
include $(top_srcdir)/src/backend/common.mk
all: distprep probes.h generated-header-symlinks
all: probes.h generated-header-symlinks
distprep: fmgr-stamp errcodes.h
.PHONY: generated-header-symlinks submake-adt-headers
.PHONY: generated-header-symlinks
generated-header-symlinks: $(top_builddir)/src/include/utils/header-stamp submake-adt-headers
generated-header-symlinks: $(top_builddir)/src/include/utils/header-stamp $(top_builddir)/src/include/utils/probes.h
submake-adt-headers:
$(MAKE) -C adt jsonpath_gram.h
$(SUBDIRS:%=%-recursive): fmgr-stamp errcodes.h
@@ -66,22 +67,15 @@ probes.h: Gen_dummy_probes.sed probes.d
sed -f $^ >$@
endif
# These generated headers must be symlinked into builddir/src/include/,
# using absolute links for the reasons explained in src/backend/Makefile.
# These generated headers must be symlinked into src/include/.
# We use header-stamp to record that we've done this because the symlinks
# themselves may appear older than fmgr-stamp.
$(top_builddir)/src/include/utils/header-stamp: fmgr-stamp errcodes.h
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
cd '$(dir $@)' && for file in fmgroids.h fmgrprotos.h errcodes.h; do \
rm -f $$file && $(LN_S) "$$prereqdir/$$file" . ; \
$(top_builddir)/src/include/utils/header-stamp: fmgr-stamp errcodes.h probes.h
cd '$(dir $@)' && for file in fmgroids.h fmgrprotos.h errcodes.h probes.h; do \
rm -f $$file && $(LN_S) "../../../$(subdir)/$$file" . ; \
done
touch $@
# probes.h is handled differently because it's not in the distribution tarball.
$(top_builddir)/src/include/utils/probes.h: probes.h
cd '$(dir $@)' && rm -f $(notdir $@) && \
$(LN_S) "../../../$(subdir)/probes.h" .
# Recipe for rebuilding the Perl version of Gen_dummy_probes
# Nothing depends on it, so it will never be called unless explicitly requested
# The last two lines of the recipe format the script according to our
@@ -104,10 +98,6 @@ installdirs:
uninstall-data:
rm -f $(addprefix '$(DESTDIR)$(datadir)'/, errcodes.txt)
# fmgroids.h, fmgrprotos.h, fmgrtab.c, fmgr-stamp, and errcodes.h are in the
# distribution tarball, so they are not cleaned here.
clean:
rm -f probes.h probes.h.tmp
maintainer-clean: clean
rm -f fmgroids.h fmgrprotos.h fmgrtab.c fmgr-stamp errcodes.h

View File

@@ -47,5 +47,5 @@ pgstat_wait_event.c: wait_event_types.h
wait_event_types.h: $(top_srcdir)/src/backend/utils/activity/wait_event_names.txt generate-wait_event_types.pl
$(PERL) $(srcdir)/generate-wait_event_types.pl --code $<
maintainer-clean: clean
clean:
rm -f wait_event_types.h pgstat_wait_event.c wait_event_funcs_data.c

View File

@@ -132,10 +132,9 @@ jsonpath_scan.c: FLEX_NO_BACKUP=yes
# Force these dependencies to be known even without dependency info built:
jsonpath_gram.o jsonpath_scan.o: jsonpath_gram.h
# jsonpath_gram.c and jsonpath_scan.c are in the distribution tarball,
# so they are not cleaned here.
clean distclean maintainer-clean:
clean:
rm -f lex.backup
rm -f jsonpath_gram.c jsonpath_gram.h jsonpath_scan.c
like.o: like.c like_match.c

View File

@@ -21,5 +21,5 @@ OBJS = \
include $(top_srcdir)/src/backend/common.mk
clean distclean maintainer-clean:
clean distclean:
$(MAKE) -C conversion_procs $@

View File

@@ -66,8 +66,6 @@ all: $(MAPS)
distclean: clean
rm -f $(TEXTS)
maintainer-clean: distclean
rm -f $(MAPS)

View File

@@ -13,5 +13,5 @@ installdirs: installdirs-lib
uninstall: uninstall-lib
clean distclean maintainer-clean: clean-lib
clean distclean: clean-lib
rm -f $(OBJS)

View File

@@ -40,6 +40,5 @@ endif
include $(top_srcdir)/src/backend/common.mk
# Note: guc-file.c is not deleted by 'make clean',
# since we want to ship it in distribution tarballs.
clean:
rm -f guc-file.c