arcapos / luapgsql

Lua binding for PostgreSQL
108 stars 24 forks source link

PGXS support #40

Open devrimgunduz opened 8 years ago

devrimgunduz commented 8 years ago

Hi,

While RPMifing luapgsql, I noticed that GNUMakefile is missing PGXS support. Is that intentional?

I tried adding related lines to GNUMakefile, but it fails at some point:


USE_PGXS=1 make 
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -DLINUX_OOM_ADJ=0 -I. -I./ -I/usr/pgsql-9.5/include/server -I/usr/pgsql-9.5/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o luapgsql.o luapgsql.c
luapgsql.c:40:22: fatal error: libpq-fe.h: No such file or directory
 #include <libpq-fe.h>
                      ^
compilation terminated.
<builtin>: recipe for target 'luapgsql.o' failed
make: *** [luapgsql.o] Error 1

though everything seems to be normal :(

I'm adding these to GNUMakefile:


ifdef USE_PGXS
PG_CONFIG = /usr/pgsql-9.5/bin/pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/luapgsql
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif

Any comments?

Regards, Devrim

mbalmer commented 8 years ago

If that does not break other uses of the GNUmakefile, then I am all fine adding this. Maybe consider adding a similar construct for Makefile (for BSD users)?