Pullup ticket #3113 - requested by spz:
[pkgsrc.git] / databases / postgresql83-client / Makefile
1 # $NetBSD$
2
3 PKGNAME=        postgresql83-client-${BASE_VERS}
4 PKGREVISION=    1
5 COMMENT=        PostgreSQL database client programs
6
7 PKG_DESTDIR_SUPPORT=    user-destdir
8
9 .include "../../databases/postgresql83/Makefile.common"
10
11 USE_TOOLS+=             gzip tar
12 USE_LIBTOOL=            yes
13 CONFIGURE_ARGS+=        --with-openssl
14 CONFIGURE_ARGS+=        --with-readline
15 CONFIGURE_ARGS+=        --with-zlib
16
17 # 1. The thread-safety test in ${WRSRC}/src/tools/thread does not pass on
18 # NetBSD earler than 4.0 or DragonFly.
19 # 2. configure with --enable-thread-safety fails on OpenBSD.
20 .if (${OPSYS} == "NetBSD" && !empty(OS_VERSION:M[0-3].*)) || \
21     ${OPSYS} == "DragonFly" || ${OPSYS} == "OpenBSD"
22 PGSQL_THREAD_SAFETY?=   no
23 .endif
24 PGSQL_THREAD_SAFETY?=   yes
25 BUILD_DEFS+=            PGSQL_THREAD_SAFETY
26
27 .if !empty(PGSQL_THREAD_SAFETY:M[yY][eE][sS])
28 .  include "../../mk/pthread.buildlink3.mk"
29 .  if (${PTHREAD_TYPE} == "native")
30 CONFIGURE_ARGS+=        --enable-thread-safety
31 .  endif
32 .endif
33
34 LIBS.SunOS+=    -lintl
35
36 INSTALL_DIRS=   src/include
37 INSTALL_DIRS+=  src/interfaces
38 INSTALL_DIRS+=  src/bin
39 INSTALL_DIRS+=  src/port
40 INSTALL_DIRS+=  doc
41
42 BUILD_DIRS=     ${INSTALL_DIRS}
43
44 # Without this, the Darwin build fails (related to -bundle_loader).
45 BUILD_DIRS+=    src/backend
46
47 PKG_OPTIONS_VAR=        PKG_OPTIONS.postgresql83-client
48 .include "../../databases/postgresql83/options.mk"
49
50 .for _file_ in pg_service.conf psqlrc
51 CONF_FILES+=    ${PG_DATA_DIR}/${_file_}.sample ${PG_ETC_DIR}/${_file_}
52 .endfor
53
54 # XXX work around core dumps with the native libedit
55 USE_GNU_READLINE=       yes
56
57 .include "../../devel/readline/buildlink3.mk"
58 .include "../../devel/zlib/buildlink3.mk"
59 .include "../../security/openssl/buildlink3.mk"
60
61 SUBST_CLASSES+=         pgxs
62 SUBST_STAGE.pgxs=       post-build
63 SUBST_MESSAGE.pgxs=     Fixing workdir tools references in pgxs Makefile
64 SUBST_FILES.pgxs=       src/Makefile.global
65 SUBST_SED.pgxs=         -e 's,${WRKDIR}/.tools,${PREFIX},'
66 SUBST_SED.pgxs+=        -e 's,${WRKDIR}/.wrapper,${PREFIX},'
67 SUBST_SED.pgxs+=        -e 's,${WRKSRC},/dev/null,'
68
69 INSTALLATION_DIRS+=     ${PG_SUBPREFIX}lib/postgresql/pgxs
70 INSTALLATION_DIRS+=     ${PG_SUBPREFIX}lib/postgresql/pgxs/config
71 INSTALLATION_DIRS+=     ${PG_SUBPREFIX}lib/postgresql/pgxs/src
72 INSTALLATION_DIRS+=     ${PG_SUBPREFIX}lib/postgresql/pgxs/src/makefiles
73
74 DEST_PG_PGXS=   ${DESTDIR}${PG_PREFIX}/lib/postgresql/pgxs
75 PG_PGXS_FILES=  config/install-sh config/mkinstalldirs
76 PG_PGXS_FILES+= src/makefiles/pgxs.mk src/Makefile.global
77 PG_PGXS_FILES+= src/Makefile.port src/Makefile.shlib
78 PG_PGXS_FILES+= src/nls-global.mk
79
80 # On Solaris, avoid conflicts between "${SSLBASE}/include/openssl/des.h"
81 # and "/usr/include/crypt.h" -- we want the definitions in the former.
82 .if ${OPSYS} == "SunOS"
83 post-wrapper:
84         touch ${BUILDLINK_DIR}/include/crypt.h
85 .endif
86
87 pre-build:
88         ${RUN} ${_ULIMIT_CMD}                                           \
89         cd ${WRKSRC}/src/backend &&                                     \
90         env ${MAKE_ENV} ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS}             \
91                 ../../src/include/parser/parse.h                        \
92                 ../../src/include/utils/fmgroids.h
93
94 post-install:
95         cd ${WRKSRC}/doc; for file in                                   \
96                 FAQ* KNOWN_BUGS MISSING_FEATURES README.* TODO          \
97                 bug.template;                                           \
98         do                                                              \
99                 ${INSTALL_DATA} $$file ${DESTDIR}${PG_DOC_DIR}/$$file;  \
100         done
101         for file in ${PG_PGXS_FILES}; do                                \
102                 ${INSTALL_DATA} ${WRKSRC}/$$file ${DEST_PG_PGXS}/$$file;\
103         done
104         cp -R ${WRKSRC}/doc/TODO.detail ${DESTDIR}${PG_DOC_DIR}
105         chown -R ${DOCOWN}:${DOCGRP} ${DESTDIR}${PG_DOC_DIR}/TODO.detail
106
107 .include "../../mk/bsd.pkg.mk"