Re: Should contrib modules install .h files?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Should contrib modules install .h files?
Дата
Msg-id 63444.1530537990@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Should contrib modules install .h files?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Ответы Re: Should contrib modules install .h files?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: Should contrib modules install .h files?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: Should contrib modules install .h files?  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> I'm thinking that $(includedir_server)/$(MODULEDIR) would be a
> reasonable place? MODULEDIR defaults to either "contrib" or "extension"
> depending on whether EXTENSION is set.
> Something like the attached patch seem reasonable?

FWIW, I agree with Andres' thought that each contrib module should have
its own subdirectory under $(includedir_server).  Otherwise we're going
to be faced with questions about whether .h files need to be renamed
because they're not globally unique enough.  There are already some that
are pretty shaky from this standpoint:

contrib$ ls */*.h
bloom/bloom.h                   pg_trgm/trgm.h
btree_gist/btree_gist.h         pgcrypto/blf.h
btree_gist/btree_utils_num.h    pgcrypto/imath.h
btree_gist/btree_utils_var.h    pgcrypto/mbuf.h
cube/cubedata.h                 pgcrypto/md5.h
hstore/hstore.h                 pgcrypto/pgcrypto.h
intarray/_int.h                 pgcrypto/pgp.h
isn/EAN13.h                     pgcrypto/px-crypt.h
isn/ISBN.h                      pgcrypto/px.h
isn/ISMN.h                      pgcrypto/rijndael.h
isn/ISSN.h                      pgcrypto/sha1.h
isn/UPC.h                       postgres_fdw/postgres_fdw.h
isn/isn.h                       seg/segdata.h
ltree/crc32.h                   sepgsql/sepgsql.h
ltree/ltree.h                   tablefunc/tablefunc.h
pageinspect/pageinspect.h

Not sure about whether the MODULEDIR part is useful.  Seems like
making a distinction between extensions and other contrib is
likely to create more headaches than it avoids.

BTW, it's somewhat interesting to think about whether we ought to
change the coding conventions so that extensions refer to their
own headers with a subdirectory, e.g., #include "bloom/bloom.h".
Having done that, all of contrib could build with a single
centrally-provided -I switch pointing at BUILDDIR/contrib/,
and there would be a path to allowing the code to build out of
tree by pointing that common -I at $(includedir_server)/ or
$(includedir_server)/MODULEDIR.  This seems like it could be
a lot less messy as we accrete more cross-module references.

            regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Monitoring time of fsyncing WALs
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Test-cases for deferred constraints in plpgsql_transaction.sql