4 This can format all PostgreSQL *.c and *.h files, but excludes *.y, and
7 1) Install pg_bsd_indent (see below for details).
9 2) Install entab (src/tools/entab/).
11 3) Change directory to the top of the build tree.
13 4) Remove all derived files (pgindent has trouble with one of the flex macros):
21 5) Download the typedef file from the buildfarm:
23 wget -O src/tools/pgindent/typedefs.list http://buildfarm.postgresql.org/cgi-bin/typedefs.pl
27 src/tools/pgindent/pgindent
29 7) Remove any files that generate errors and restore their original
32 8) Indent the Perl code:
35 find . -name \*.pl -o -name \*.pm
37 find . -type f -exec file {} \; |
38 egrep -i ':.*perl[0-9]*\>' |
42 xargs perltidy --profile=src/tools/pgindent/perltidyrc
44 9) Do a full test build:
47 # stop is only necessary if it's going to install in a location with an
48 # already running server
52 make -C contrib install
55 make installcheck-world
57 10) Remove Perl backup files after testing
59 ---------------------------------------------------------------------------
64 We have standardized on NetBSD's indent, and renamed it pg_bsd_indent.
65 We have fixed a few bugs which requre the NetBSD source to be patched
66 with indent.bsd.patch patch. A fully patched version is available at
67 ftp://ftp.postgresql.org/pub/dev.
69 GNU indent, version 2.2.6, has several problems, and is not recommended.
70 These bugs become pretty major when you are doing >500k lines of code.
71 If you don't believe me, take a directory and make a copy. Run pgindent
72 on the copy using GNU indent, and do a diff -r. You will see what I
73 mean. GNU indent does some things better, but mangles too. For details,
76 http://archives.postgresql.org/pgsql-hackers/2003-10/msg00374.php
77 http://archives.postgresql.org/pgsql-hackers/2011-04/msg01436.php
79 ---------------------------------------------------------------------------
81 Notes about excluded files
82 --------------------------
84 src/include/storage/s_lock.h is excluded because it contains assembly code
85 that pgindent tends to mess up.
87 src/include/snowball/libstemmer/ and src/backend/snowball/libstemmer/
88 are excluded because those files are imported from an external project,
89 not maintained locally, and are machine-generated anyway.
91 src/interfaces/ecpg/test/expected/ is excluded to avoid breaking the ecpg
92 regression tests. Several *.h files are included in regression output so
93 should not be changed.
95 ---------------------------------------------------------------------------
97 Obsolete typedef list creation instructions
98 -------------------------------------------
102 1) Build the source tree with _debug_ symbols and all possible configure options
104 2) Install to /usr/local/pgsql
106 3) Install all contrib modules
108 4) Save a list of typedefs by running:
110 src/tools/find_typedef /usr/local/pgsql/bin /usr/local/pgsql/lib > /tmp/pgtypedefs