Install errcodes.txt for use by extensions.
authorAndrew Gierth <[email protected]>
Thu, 5 Apr 2018 03:05:40 +0000 (04:05 +0100)
committerAndrew Gierth <[email protected]>
Thu, 5 Apr 2018 03:05:40 +0000 (04:05 +0100)
Maintainers of out-of-tree PLs typically need access to the set of
error codes. To avoid the need to duplicate that information in some
form in PL source trees, provide errcodes.txt as part of a server
installation.

Thomas Munro, based on a suggestion from Andrew Gierth
Discussion: https://postgr.es/m/87woykk7mu.fsf%40news-spur.riddles.org.uk

src/backend/Makefile
src/backend/utils/Makefile
src/tools/msvc/Install.pm

index 21b094385f626ff8008de0a2544e525299fc9011..a4b6d1658cc33bbeefa6d2a83959528d3c34cb46 100644 (file)
@@ -247,6 +247,7 @@ endif
 endif
        $(MAKE) -C catalog install-data
        $(MAKE) -C tsearch install-data
+       $(MAKE) -C utils install-data
        $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample'
        $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample'
        $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample'
@@ -312,6 +313,7 @@ endif
 endif
        $(MAKE) -C catalog uninstall-data
        $(MAKE) -C tsearch uninstall-data
+       $(MAKE) -C utils uninstall-data
        rm -f '$(DESTDIR)$(datadir)/pg_hba.conf.sample' \
              '$(DESTDIR)$(datadir)/pg_ident.conf.sample' \
              '$(DESTDIR)$(datadir)/postgresql.conf.sample' \
index e296e6ce4d5b8cff27094da0b0ced4bb58e115a9..163c81a1c226be73b908bd45f12b25d552c63c1b 100644 (file)
@@ -46,6 +46,16 @@ else
        sed -f $(srcdir)/Gen_dummy_probes.sed $< >$@
 endif
 
+.PHONY: install-data
+install-data: errcodes.txt installdirs
+       $(INSTALL_DATA) $(srcdir)/errcodes.txt '$(DESTDIR)$(datadir)/errcodes.txt'
+
+installdirs:
+       $(MKDIR_P) '$(DESTDIR)$(datadir)'
+
+.PHONY: uninstall-data
+uninstall-data:
+       rm -f $(addprefix '$(DESTDIR)$(datadir)'/, errcodes.txt)
 
 # fmgroids.h, fmgrprotos.h, fmgrtab.c and errcodes.h are in the
 # distribution tarball, so they are not cleaned here.
index 33290993addb5e83701badc0d4030a697f945aa9..82528eaa283613d31dee5e7e9fb06eda4fd0eef6 100644 (file)
@@ -134,6 +134,9 @@ sub Install
                CopyFiles(
                        'Information schema data', $target . '/share/',
                        'src/backend/catalog/',    'sql_features.txt');
+               CopyFiles(
+                       'Error code data', $target . '/share/',
+                       'src/backend/utils/',    'errcodes.txt');
                GenerateConversionScript($target);
                GenerateTimezoneFiles($target, $conf);
                GenerateTsearchFiles($target);