summaryrefslogtreecommitdiff
path: root/databases/postgresql82-client/Makefile
blob: 8b2267151200a043f5ce8b33da9710f3ef9f200f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# $NetBSD: Makefile,v 1.12.2.1 2010/05/12 21:20:05 tron Exp $

PKGNAME=	postgresql82-client-${BASE_VERS}
COMMENT=	PostgreSQL database client programs

PKG_DESTDIR_SUPPORT=	user-destdir

.include "../../databases/postgresql82/Makefile.common"

USE_TOOLS+=		gzip tar
USE_LIBTOOL=		yes
CONFIGURE_ARGS+=	--with-openssl
CONFIGURE_ARGS+=	--with-readline
CONFIGURE_ARGS+=	--with-zlib

CONFLICTS+=	postgresql82-lib-[0-9]*
CONFLICTS+=	postgresql82-docs-[0-9]*

# 1. The thread-safety test in ${WRSRC}/src/tools/thread does not pass on
# NetBSD earler than 4.0 or DragonFly.
# 2. configure with --enable-thread-safety fails on OpenBSD.
.if (${OPSYS} == "NetBSD" && !empty(OS_VERSION:M[0-3].*)) || \
    ${OPSYS} == "DragonFly" || ${OPSYS} == "OpenBSD"
PGSQL_THREAD_SAFETY?=	no
.endif
PGSQL_THREAD_SAFETY?=	yes
BUILD_DEFS+=		PGSQL_THREAD_SAFETY

.if !empty(PGSQL_THREAD_SAFETY:M[yY][eE][sS])
.  include "../../mk/pthread.buildlink3.mk"
.  if (${PTHREAD_TYPE} == "native")
CONFIGURE_ARGS+=	--enable-thread-safety
.  endif
.endif

LIBS.SunOS+=	-lintl

INSTALL_DIRS=	src/include
INSTALL_DIRS+=	src/interfaces
INSTALL_DIRS+=	src/port
INSTALL_DIRS+=	src/bin
INSTALL_DIRS+=	doc

BUILD_DIRS=	${INSTALL_DIRS}

# Without this, the Darwin build fails (related to -bundle_loader).
BUILD_DIRS+=	src/backend

PKG_OPTIONS_VAR=	PKG_OPTIONS.postgresql82-client
.include "../../databases/postgresql82/options.mk"

.for _file_ in pg_service.conf psqlrc
CONF_FILES+=	${PG_DATA_DIR}/${_file_}.sample ${PG_ETC_DIR}/${_file_}
.endfor

# XXX work around core dumps with the native libedit
USE_GNU_READLINE=	yes

.include "../../devel/readline/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"

SUBST_CLASSES+=		pgxs
SUBST_STAGE.pgxs=	post-build
SUBST_MESSAGE.pgxs=	Fixing workdir tools references in pgxs Makefile
SUBST_FILES.pgxs=	src/Makefile.global
SUBST_SED.pgxs=		-e 's,${WRKDIR}/.tools,${PREFIX},'
SUBST_SED.pgxs+=	-e 's,${WRKDIR}/.wrapper,${PREFIX},'
SUBST_SED.pgxs+=	-e 's,${WRKSRC},/dev/null,'

INSTALLATION_DIRS+=	${PG_SUBPREFIX}lib/postgresql/pgxs
INSTALLATION_DIRS+=	${PG_SUBPREFIX}lib/postgresql/pgxs/config
INSTALLATION_DIRS+=	${PG_SUBPREFIX}lib/postgresql/pgxs/src
INSTALLATION_DIRS+=	${PG_SUBPREFIX}lib/postgresql/pgxs/src/makefiles

DEST_PG_PGXS=	${DESTDIR}${PG_PREFIX}/lib/postgresql/pgxs
PG_PGXS_FILES=	config/install-sh config/mkinstalldirs
PG_PGXS_FILES+=	src/makefiles/pgxs.mk src/Makefile.global
PG_PGXS_FILES+=	src/Makefile.port src/Makefile.shlib
PG_PGXS_FILES+=	src/nls-global.mk

# On Solaris, avoid conflicts between "${SSLBASE}/include/openssl/des.h"
# and "/usr/include/crypt.h" -- we want the definitions in the former.
.if ${OPSYS} == "SunOS"
post-wrapper:
	touch ${BUILDLINK_DIR}/include/crypt.h
.endif

pre-build:
	${RUN} ${_ULIMIT_CMD}						\
	cd ${WRKSRC}/src/backend &&					\
	env ${MAKE_ENV} ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS}		\
		../../src/include/parser/parse.h			\
		../../src/include/utils/fmgroids.h

post-install:
	cd ${WRKSRC}/doc; for file in					\
		FAQ* KNOWN_BUGS MISSING_FEATURES README.* TODO		\
		bug.template;						\
	do								\
		${INSTALL_DATA} $$file ${DESTDIR}${PG_DOC_DIR}/$$file;	\
	done
	for file in ${PG_PGXS_FILES}; do				\
		${INSTALL_DATA} ${WRKSRC}/$$file ${DEST_PG_PGXS}/$$file;\
	done
	cp -R ${WRKSRC}/doc/TODO.detail ${DESTDIR}${PG_DOC_DIR}
	chown -R ${DOCOWN}:${DOCGRP} ${DESTDIR}${PG_DOC_DIR}/TODO.detail

.include "../../mk/bsd.pkg.mk"