On Thu, Mar 29, 2018 at 2:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Thomas Munro <thomas.munro@enterprisedb.com> writes:
>>>> While we're on the topic, I know of at least one other author of a
>>>> non-core PL (besides myself) that has been frustrated by the fact that
>>>> errcodes.txt is not installed anywhere, making it impossible to
>>>> autogenerate a plerrcodes.h file in the extension build process.
>
>> Something like this? Or I guess src/backend/Makefile could do it directly.
>
> Patch seems reasonable as far as it goes, but what about the MSVC
> infrastructure?
Hmm. Here is an untested version that makes Install.pm treat it the
same way as it treats sql_features.txt. Does this look right?
> Also, do we need to discuss exactly where it's being installed to?
> Is the choice made here easy for an extension Makefile to locate?
${datadir} is:
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
The default comes from here:
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
That is obtainable with pg_config --sharedir. It's a bit obscure that
--sharedir means ${datadir}, but in my tree I see:
src/port/Makefile: echo "#define PGSHAREDIR \"$(datadir)\"" >>$@
That makes its way into pg_config's clutches via this code:
src/port/path.c-get_share_path(const char *my_exec_path, char *ret_path)
src/port/path.c-{
src/port/path.c: make_relative_path(ret_path, PGSHAREDIR,
PGBINDIR, my_exec_path);
src/port/path.c-}
So after "make install" I can find the file like this:
$ ls -slap $(pg_config --sharedir)/errcodes.txt
64 -rw-r--r-- 1 munro staff 31450 29 Mar 14:40
/Users/munro/install/postgres/share/errcodes.txt
Would there be a better location?
--
Thomas Munro
http://www.enterprisedb.com