Skip to content

Commit

Permalink
Remove distprep
Browse files Browse the repository at this point in the history
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
  • Loading branch information
petere committed Nov 6, 2023
1 parent b72de09 commit 721856f
Show file tree
Hide file tree
Showing 89 changed files with 175 additions and 416 deletions.
6 changes: 2 additions & 4 deletions GNUmakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ install-world-bin-contrib-recurse: install-world-bin-src-recurse

$(call recurse,installdirs uninstall init-po update-po,doc src config)

$(call recurse,distprep coverage,doc src config contrib)
$(call recurse,coverage,doc src config contrib)

# clean, distclean, etc should apply to contrib too, even though
# it's not built by default
Expand All @@ -53,7 +53,7 @@ clean:

# Important: distclean `src' last, otherwise Makefile.global
# will be gone too soon.
distclean maintainer-clean:
distclean:
$(MAKE) -C doc $@
$(MAKE) -C contrib $@
$(MAKE) -C config $@
Expand Down Expand Up @@ -109,7 +109,6 @@ distdir:
|| cp "$(top_srcdir)/$$file" "$(distdir)/$$file"; \
fi || exit; \
done
$(MAKE) -C $(distdir) distprep
$(MAKE) -C $(distdir)/doc/src/sgml/ INSTALL
cp $(distdir)/doc/src/sgml/INSTALL $(distdir)/
$(MAKE) -C $(distdir) distclean
Expand All @@ -122,7 +121,6 @@ distcheck: dist
install_prefix=`cd $(dummy) && pwd`; \
cd $(distdir) \
&& ./configure --prefix="$$install_prefix"
$(MAKE) -C $(distdir) -q distprep
$(MAKE) -C $(distdir)
$(MAKE) -C $(distdir) install
$(MAKE) -C $(distdir) uninstall
Expand Down
9 changes: 2 additions & 7 deletions config/perl.m4
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@ if test "$PERL"; then
if echo "$pgac_perl_version" | sed ['s/[.a-z_]/ /g'] | \
$AWK '{ if ([$]1 == 5 && ([$]2 >= 14)) exit 1; else exit 0;}'
then
AC_MSG_WARN([
AC_MSG_ERROR([
*** The installed version of Perl, $PERL, is too old to use with PostgreSQL.
*** Perl version 5.14 or later is required, but this is $pgac_perl_version.])
PERL=""
fi
fi
if test -z "$PERL"; then
AC_MSG_WARN([
*** Without Perl you will not be able to build PostgreSQL from Git.
*** You can obtain Perl from any CPAN mirror site.
*** (If you are using the official distribution of PostgreSQL then you do not
*** need to worry about this, because the Perl output is pre-generated.)])
AC_MSG_ERROR([Perl not found])
fi
])# PGAC_PATH_PERL

Expand Down
21 changes: 4 additions & 17 deletions config/programs.m4
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ if test "$BISON"; then
AC_MSG_NOTICE([using $pgac_bison_version])
if echo "$pgac_bison_version" | $AWK '{ if ([$]4 < 2.3) exit 0; else exit 1;}'
then
AC_MSG_WARN([
AC_MSG_ERROR([
*** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
*** Bison version 2.3 or later is required, but this is $pgac_bison_version.])
BISON=""
fi
# Bison >=3.0 issues warnings about %name-prefix="base_yy", instead
# of the now preferred %name-prefix "base_yy", but the latter
Expand All @@ -49,12 +48,7 @@ if test "$BISON"; then
fi
if test -z "$BISON"; then
AC_MSG_WARN([
*** Without Bison you will not be able to build PostgreSQL from Git nor
*** change any of the parser definition files. You can obtain Bison from
*** a GNU mirror site. (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this, because the Bison
*** output is pre-generated.)])
AC_MSG_ERROR([bison not found])
fi
dnl We don't need AC_SUBST(BISON) because PGAC_PATH_PROGS did it
AC_SUBST(BISONFLAGS)
Expand Down Expand Up @@ -95,7 +89,7 @@ else
pgac_cv_path_flex=$pgac_candidate
break 2
else
AC_MSG_WARN([
AC_MSG_ERROR([
*** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version.])
fi
Expand All @@ -109,14 +103,7 @@ fi
])[]dnl AC_CACHE_CHECK
if test x"$pgac_cv_path_flex" = x"no"; then
AC_MSG_WARN([
*** Without Flex you will not be able to build PostgreSQL from Git nor
*** change any of the scanner definition files. You can obtain Flex from
*** a GNU mirror site. (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this because the Flex
*** output is pre-generated.)])
FLEX=
AC_MSG_ERROR([flex not found])
else
FLEX=$pgac_cv_path_flex
pgac_flex_version=`$FLEX --version 2>/dev/null`
Expand Down
62 changes: 9 additions & 53 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -10162,13 +10162,9 @@ if test "$BISON"; then
$as_echo "$as_me: using $pgac_bison_version" >&6;}
if echo "$pgac_bison_version" | $AWK '{ if ($4 < 2.3) exit 0; else exit 1;}'
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
*** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
*** Bison version 2.3 or later is required, but this is $pgac_bison_version." >&5
$as_echo "$as_me: WARNING:
as_fn_error $? "
*** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
*** Bison version 2.3 or later is required, but this is $pgac_bison_version." >&2;}
BISON=""
*** Bison version 2.3 or later is required, but this is $pgac_bison_version." "$LINENO" 5
fi
# Bison >=3.0 issues warnings about %name-prefix="base_yy", instead
# of the now preferred %name-prefix "base_yy", but the latter
Expand All @@ -10181,18 +10177,7 @@ $as_echo "$as_me: WARNING:
fi

if test -z "$BISON"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
*** Without Bison you will not be able to build PostgreSQL from Git nor
*** change any of the parser definition files. You can obtain Bison from
*** a GNU mirror site. (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this, because the Bison
*** output is pre-generated.)" >&5
$as_echo "$as_me: WARNING:
*** Without Bison you will not be able to build PostgreSQL from Git nor
*** change any of the parser definition files. You can obtain Bison from
*** a GNU mirror site. (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this, because the Bison
*** output is pre-generated.)" >&2;}
as_fn_error $? "bison not found" "$LINENO" 5
fi


Expand Down Expand Up @@ -10225,12 +10210,9 @@ else
pgac_cv_path_flex=$pgac_candidate
break 2
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
*** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version." >&5
$as_echo "$as_me: WARNING:
as_fn_error $? "
*** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version." >&2;}
*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version." "$LINENO" 5
fi
fi
fi
Expand All @@ -10244,20 +10226,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_path_flex" >&5
$as_echo "$pgac_cv_path_flex" >&6; }
if test x"$pgac_cv_path_flex" = x"no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
*** Without Flex you will not be able to build PostgreSQL from Git nor
*** change any of the scanner definition files. You can obtain Flex from
*** a GNU mirror site. (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this because the Flex
*** output is pre-generated.)" >&5
$as_echo "$as_me: WARNING:
*** Without Flex you will not be able to build PostgreSQL from Git nor
*** change any of the scanner definition files. You can obtain Flex from
*** a GNU mirror site. (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this because the Flex
*** output is pre-generated.)" >&2;}

FLEX=
as_fn_error $? "flex not found" "$LINENO" 5
else
FLEX=$pgac_cv_path_flex
pgac_flex_version=`$FLEX --version 2>/dev/null`
Expand Down Expand Up @@ -10331,27 +10300,14 @@ $as_echo "$as_me: using perl $pgac_perl_version" >&6;}
if echo "$pgac_perl_version" | sed 's/[.a-z_]/ /g' | \
$AWK '{ if ($1 == 5 && ($2 >= 14)) exit 1; else exit 0;}'
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
*** The installed version of Perl, $PERL, is too old to use with PostgreSQL.
*** Perl version 5.14 or later is required, but this is $pgac_perl_version." >&5
$as_echo "$as_me: WARNING:
as_fn_error $? "
*** The installed version of Perl, $PERL, is too old to use with PostgreSQL.
*** Perl version 5.14 or later is required, but this is $pgac_perl_version." >&2;}
PERL=""
*** Perl version 5.14 or later is required, but this is $pgac_perl_version." "$LINENO" 5
fi
fi

if test -z "$PERL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
*** Without Perl you will not be able to build PostgreSQL from Git.
*** You can obtain Perl from any CPAN mirror site.
*** (If you are using the official distribution of PostgreSQL then you do not
*** need to worry about this, because the Perl output is pre-generated.)" >&5
$as_echo "$as_me: WARNING:
*** Without Perl you will not be able to build PostgreSQL from Git.
*** You can obtain Perl from any CPAN mirror site.
*** (If you are using the official distribution of PostgreSQL then you do not
*** need to worry about this, because the Perl output is pre-generated.)" >&2;}
as_fn_error $? "Perl not found" "$LINENO" 5
fi

if test "$with_perl" = yes; then
Expand Down
7 changes: 2 additions & 5 deletions contrib/cube/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ REGRESS = cube cube_sci

SHLIB_LINK += $(filter -lm, $(LIBS))

EXTRA_CLEAN = cubeparse.h cubeparse.c cubescan.c

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
Expand All @@ -37,8 +39,3 @@ cubeparse.c: BISONFLAGS += -d

# Force these dependencies to be known even without dependency info built:
cubeparse.o cubescan.o: cubeparse.h

distprep: cubeparse.c cubescan.c

maintainer-clean:
rm -f cubeparse.h cubeparse.c cubescan.c
9 changes: 2 additions & 7 deletions contrib/fuzzystrmatch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ PGFILEDESC = "fuzzystrmatch - similarities and distance between strings"

REGRESS = fuzzystrmatch fuzzystrmatch_utf8

EXTRA_CLEAN = daitch_mokotoff.h

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
Expand All @@ -31,10 +33,3 @@ daitch_mokotoff.o: daitch_mokotoff.h

daitch_mokotoff.h: daitch_mokotoff_header.pl
$(PERL) $< $@

# daitch_mokotoff.h is included in tarballs, so it has to be made by
# "distprep" and not cleaned except by "maintainer-clean".
distprep: daitch_mokotoff.h

maintainer-clean:
rm -f daitch_mokotoff.h
7 changes: 1 addition & 6 deletions contrib/seg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ HEADERS = segdata.h

REGRESS = security seg

EXTRA_CLEAN = y.tab.c y.tab.h
EXTRA_CLEAN = segparse.h segparse.c segscan.c

ifdef USE_PGXS
PG_CONFIG = pg_config
Expand All @@ -38,8 +38,3 @@ segparse.c: BISONFLAGS += -d

# Force these dependencies to be known even without dependency info built:
segparse.o segscan.o: segparse.h

distprep: segparse.c segscan.c

maintainer-clean:
rm -f segparse.h segparse.c segscan.c
2 changes: 1 addition & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ subdir = doc
top_builddir = ..
include $(top_builddir)/src/Makefile.global

all distprep html man install installdirs uninstall clean distclean maintainer-clean:
all html man install installdirs uninstall clean distclean:
$(MAKE) -C src $@
2 changes: 1 addition & 1 deletion doc/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ subdir = doc/src
top_builddir = ../..
include $(top_builddir)/src/Makefile.global

all distprep html man install installdirs uninstall clean distclean maintainer-clean:
all html man install installdirs uninstall clean distclean:
$(MAKE) -C sgml $@
16 changes: 5 additions & 11 deletions doc/src/sgml/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#----------------------------------------------------------------------------

# This makefile is for building and installing the documentation.
# When a release tarball is created, the documentation files are
# prepared using the distprep target. In Git-based trees these files
# In Git-based trees these files
# don't exist, unless explicitly built, so we skip the installation in
# that case.

Expand All @@ -28,8 +27,6 @@ include $(top_builddir)/src/Makefile.global

all: html man

distprep: html distprep-man


ifndef DBTOEPUB
DBTOEPUB = $(missing) dbtoepub
Expand Down Expand Up @@ -77,7 +74,7 @@ postgres-full.xml: postgres.sgml $(ALLSGML)
## Man pages
##

man distprep-man: man-stamp
man: man-stamp

man-stamp: stylesheet-man.xsl postgres-full.xml
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_MAN_FLAGS) $^
Expand All @@ -89,10 +86,9 @@ man-stamp: stylesheet-man.xsl postgres-full.xml
##

# Technically, this should depend on Makefile.global, but then
# version.sgml would need to be rebuilt after every configure run,
# even in distribution tarballs. So this is cheating a bit, but it
# will achieve the goal of updating the version number when it
# changes.
# version.sgml would need to be rebuilt after every configure run. So
# this is cheating a bit, but it will achieve the goal of updating the
# version number when it changes.
version.sgml: $(top_srcdir)/configure
{ \
echo "<!ENTITY version \"$(VERSION)\">"; \
Expand Down Expand Up @@ -305,8 +301,6 @@ clean:
rm -f *.texixml *.texi *.info db2texi.refs

distclean: clean

maintainer-clean: distclean
# HTML
rm -fr html/ html-stamp
# man
Expand Down
Loading

0 comments on commit 721856f

Please sign in to comment.