postgresql/src/interfaces/ecpg/preproc
Peter Eisentraut 721856ff24 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
2023-11-06 15:18:04 +01:00
..
po Translation updates 2023-05-22 12:44:31 +02:00
.gitignore Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
README.parser Move parse2.pl to parse.pl 2011-06-14 07:34:00 +03:00
c_keywords.c Harmonize parameter names in ecpg code. 2022-09-22 12:53:20 -07:00
c_kwlist.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
check_rules.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
descriptor.c Remove redundant null pointer checks before free() 2022-07-03 11:47:15 +02:00
ecpg.addons Make subquery aliases optional in the FROM clause. 2022-07-20 09:29:42 +01:00
ecpg.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
ecpg.header Harmonize parameter names in ecpg code. 2022-09-22 12:53:20 -07:00
ecpg.tokens Reduce size of backend scanner's tables. 2020-01-13 15:04:31 -05:00
ecpg.trailer Fix possible omission of variable storage markers in ECPG. 2022-09-09 15:34:04 -04:00
ecpg.type Fix ECPG's handling of type names that match SQL keywords. 2022-07-12 17:05:46 -04:00
ecpg_keywords.c Make the order of the header file includes consistent in non-backend modules. 2019-10-25 07:41:52 +05:30
ecpg_kwlist.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
keywords.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
meson.build meson: Add dependencies to perl modules to various script invocations 2023-06-09 20:12:16 -07:00
nls.mk Revert "Use wildcards instead of manually-maintained file lists in */nls.mk." 2022-07-13 14:29:10 -04:00
output.c Harmonize parameter names in ecpg code. 2022-09-22 12:53:20 -07:00
parse.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
parser.c Code review for recent SQL/JSON commits 2023-04-04 14:04:30 +02:00
pgc.l Handle \v as a whitespace character in parsers 2023-07-06 08:16:24 +09:00
preproc_extern.h Harmonize parameter names in ecpg code. 2022-09-22 12:53:20 -07:00
type.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
type.h Harmonize parameter names in ecpg code. 2022-09-22 12:53:20 -07:00
variable.c Remove duplicate lines of code 2023-04-24 11:16:17 +02:00

README.parser

ECPG modifies and extends the core grammar in a way that
1) every token in ECPG is <str> type. New tokens are
   defined in ecpg.tokens, types are defined in ecpg.type
2) most tokens from the core grammar are simply converted
   to literals concatenated together to form the SQL string
   passed to the server, this is done by parse.pl.
3) some rules need side-effects, actions are either added
   or completely overridden (compared to the basic token
   concatenation) for them, these are defined in ecpg.addons,
   the rules for ecpg.addons are explained below.
4) new grammar rules are needed for ECPG metacommands.
   These are in ecpg.trailer.
5) ecpg.header contains common functions, etc. used by
   actions for grammar rules.

In "ecpg.addons", every modified rule follows this pattern:
       ECPG: dumpedtokens postfix
where "dumpedtokens" is simply tokens from core gram.y's
rules concatenated together. e.g. if gram.y has this:
       ruleA: tokenA tokenB tokenC {...}
then "dumpedtokens" is "ruleAtokenAtokenBtokenC".
"postfix" above can be:
a) "block" - the automatic rule created by parse.pl is completely
    overridden, the code block has to be written completely as
    it were in a plain bison grammar
b) "rule" - the automatic rule is extended on, so new syntaxes
    are accepted for "ruleA". E.g.:
      ECPG: ruleAtokenAtokenBtokenC rule
          | tokenD tokenE { action_code; }
          ...
    It will be substituted with:
      ruleA: <original syntax forms and actions up to and including
                    "tokenA tokenB tokenC">
             | tokenD tokenE { action_code; }
             ...
c) "addon" - the automatic action for the rule (SQL syntax constructed
    from the tokens concatenated together) is prepended with a new
    action code part. This code part is written as is's already inside
    the { ... }

Multiple "addon" or "block" lines may appear together with the
new code block if the code block is common for those rules.