From 8daca4a9d3f22f0646e1e468e0f15e15aea1338d Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Tue, 10 Jul 2018 10:23:53 +0200 Subject: [PATCH] Build applications linking libpq with -pthread on openbsd OpenBSD require that linking with a library using sigwait(3) be compiled with -pthread. This adds a kludge in the relevant makefiles which is less than elegant, but it seemed the least intrusive change to make. --- src/bin/pg_ctl/Makefile | 4 ++++ src/bin/pg_dump/Makefile | 4 ++++ src/bin/scripts/Makefile | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/src/bin/pg_ctl/Makefile b/src/bin/pg_ctl/Makefile index b9b84aec33..21e4ffb1a5 100644 --- a/src/bin/pg_ctl/Makefile +++ b/src/bin/pg_ctl/Makefile @@ -25,6 +25,10 @@ LIBS := $(filter-out -lreadline -ledit -ltermcap -lncurses -lcurses -lcurl -lssl override CPPFLAGS := -DDEF_PGPORT=$(DEF_PGPORT) -I$(libpq_srcdir) $(CPPFLAGS) +ifeq ($(PORTNAME),openbsd) +override CFLAGS += -pthread +endif + OBJS= pg_ctl.o $(WIN32RES) all: pg_ctl diff --git a/src/bin/pg_dump/Makefile b/src/bin/pg_dump/Makefile index d2cf936cce..a11bf3e5d7 100644 --- a/src/bin/pg_dump/Makefile +++ b/src/bin/pg_dump/Makefile @@ -25,6 +25,10 @@ LIBS := $(filter-out -lreadline -ledit -ltermcap -lncurses -lcurses -lcurl , $(L # the use of tempnam in pg_backup_tar.c causes a warning when using newer versions of GCC override CPPFLAGS := -Wno-deprecated-declarations -I$(libpq_srcdir) $(CPPFLAGS) +ifeq ($(PORTNAME),openbsd) +override CFLAGS += -pthread +endif + OBJS= pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \ pg_backup_files.o pg_backup_null.o pg_backup_tar.o \ pg_backup_directory.o dumputils.o compress_io.o $(WIN32RES) diff --git a/src/bin/scripts/Makefile b/src/bin/scripts/Makefile index 726eb66c6d..ec08770414 100644 --- a/src/bin/scripts/Makefile +++ b/src/bin/scripts/Makefile @@ -26,8 +26,13 @@ PROGRAMS = createdb createlang createuser dropdb droplang dropuser clusterdb vac override CPPFLAGS := -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir) $(CPPFLAGS) + all: $(PROGRAMS) +ifeq ($(PORTNAME),openbsd) +override CFLAGS += -pthread +endif + %: %.o $(WIN32RES) $(CC) $(CFLAGS) $^ $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) -- GitLab