pgsql: Build src/port files as a library with -fPIC, and use that in li

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Build src/port files as a library with -fPIC, and use that in li
Date: 2018-09-27 15:23:49
Message-ID: E1g5Y8r-0006vs-QA@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Build src/port files as a library with -fPIC, and use that in libpq.

libpq and ecpg need shared-library-friendly versions of assorted src/port/
and src/common/ modules. Up to now, they got those by symlinking the
individual source files and compiling them locally. That's baroque, and a
pain to maintain, and it results in some amount of duplicated compile work.
It might've made sense when only a couple of files were needed, but the
list has grown and grown and grown :-(

It makes more sense to have the originating directory build a third variant
of libpgport.a/libpgcommon.a containing modules built with $(CFLAGS_SL),
and just link that into the shared library. Unused files won't get linked,
so the end result should be the same.

This patch makes a down payment on that idea by having src/port/ build
such a library and making libpq use it. If the buildfarm doesn't expose
fatal problems with the approach, I'll extend it to the other cases.

Discussion: https://postgr.es/m/13022.1538003440@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ea53100d5671b5b243f77898b0b04d23c38b2820

Modified Files
--------------
src/interfaces/libpq/.gitignore | 21 ----------------
src/interfaces/libpq/Makefile | 41 +++++++++---------------------
src/port/.gitignore | 1 +
src/port/Makefile | 55 ++++++++++++++++++++++++++++++++---------
4 files changed, 55 insertions(+), 63 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2018-09-27 18:42:30 pgsql: Clean up in the wake of TupleDescGetSlot() removal / 10763358c3f
Previous Message Peter Eisentraut 2018-09-27 12:08:32 Re: pgsql: Incorporate strerror_r() into src/port/snprintf.c, too.

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Kuzmenkov 2018-09-27 15:32:59 buildfarm and git pull
Previous Message Nikita Glukhov 2018-09-27 14:58:22 Re: Jsonb transform for pl/python