update Tue Dec 15 18:37:01 PST 2009
[pkgsrc.git] / databases / postgresql84-client / Makefile
1 # $NetBSD: Makefile,v 1.2 2009/12/15 22:39:40 fhajny Exp $
2
3 PKGNAME=        postgresql84-client-${BASE_VERS}
4 PKGREVISION=    1
5 COMMENT=        PostgreSQL database client programs
6
7 PKG_DESTDIR_SUPPORT=    user-destdir
8
9 .include "../../databases/postgresql84/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 #
21 .if (${OPSYS} == "NetBSD" && !empty(OS_VERSION:M[0-3].*)) || \
22     ${OPSYS} == "DragonFly" || ${OPSYS} == "OpenBSD"
23 PGSQL_THREAD_SAFETY?=   no
24 .endif
25 PGSQL_THREAD_SAFETY?=   yes
26 BUILD_DEFS+=            PGSQL_THREAD_SAFETY
27
28 .if !empty(PGSQL_THREAD_SAFETY:M[yY][eE][sS])
29 .  include "../../mk/pthread.buildlink3.mk"
30 .  if (${PTHREAD_TYPE} == "native")
31 CONFIGURE_ARGS+=        --enable-thread-safety
32 .  endif
33 .endif
34
35 LIBS.SunOS+=    -lintl
36
37 INSTALL_DIRS=   src/include
38 INSTALL_DIRS+=  src/interfaces
39 INSTALL_DIRS+=  src/bin
40 INSTALL_DIRS+=  src/port
41 INSTALL_DIRS+=  doc
42
43 BUILD_DIRS=     ${INSTALL_DIRS}
44
45 # Without this, the Darwin build fails (related to -bundle_loader).
46 BUILD_DIRS+=    src/backend
47
48 PKG_OPTIONS_VAR=        PKG_OPTIONS.postgresql84-client
49 .include "../../databases/postgresql84/options.mk"
50
51 .for _file_ in pg_service.conf psqlrc
52 CONF_FILES+=    ${PG_DATA_DIR}/${_file_}.sample ${PG_ETC_DIR}/${_file_}
53 .endfor
54
55 # XXX work around core dumps with the native libedit
56 USE_GNU_READLINE=       yes
57
58 .include "../../devel/readline/buildlink3.mk"
59 .include "../../devel/zlib/buildlink3.mk"
60 .include "../../security/openssl/buildlink3.mk"
61
62 SUBST_CLASSES+=         pgxs
63 SUBST_STAGE.pgxs=       post-build
64 SUBST_MESSAGE.pgxs=     Fixing workdir tools references in pgxs Makefile
65 SUBST_FILES.pgxs=       src/Makefile.global
66 SUBST_SED.pgxs=         -e 's,${WRKDIR}/.tools,${PREFIX},'
67 SUBST_SED.pgxs+=        -e 's,${WRKDIR}/.wrapper,${PREFIX},'
68 SUBST_SED.pgxs+=        -e 's,${WRKSRC},/dev/null,'
69
70 INSTALLATION_DIRS+=     ${PG_SUBPREFIX}lib/postgresql/pgxs
71 INSTALLATION_DIRS+=     ${PG_SUBPREFIX}lib/postgresql/pgxs/config
72 INSTALLATION_DIRS+=     ${PG_SUBPREFIX}lib/postgresql/pgxs/src
73 INSTALLATION_DIRS+=     ${PG_SUBPREFIX}lib/postgresql/pgxs/src/makefiles
74
75 DEST_PG_PGXS=   ${DESTDIR}${PG_PREFIX}/lib/postgresql/pgxs
76 PG_PGXS_FILES=  config/install-sh config/mkinstalldirs
77 PG_PGXS_FILES+= src/makefiles/pgxs.mk src/Makefile.global
78 PG_PGXS_FILES+= src/Makefile.port src/Makefile.shlib
79 PG_PGXS_FILES+= src/nls-global.mk
80
81 # On Solaris, avoid conflicts between "${SSLBASE}/include/openssl/des.h"
82 # and "/usr/include/crypt.h" -- we want the definitions in the former.
83 .if ${OPSYS} == "SunOS"
84 post-wrapper:
85         touch ${BUILDLINK_DIR}/include/crypt.h
86 .endif
87
88 post-install:
89         cd ${WRKSRC}/doc; for file in                                   \
90                 FAQ* KNOWN_BUGS MISSING_FEATURES README.* TODO          \
91                 bug.template;                                           \
92         do                                                              \
93                 ${INSTALL_DATA} $$file ${DESTDIR}${PG_DOC_DIR}/$$file;  \
94         done;                                                           \
95         for file in ${PG_PGXS_FILES}; do                                \
96                 ${INSTALL_DATA} ${WRKSRC}/$$file ${DEST_PG_PGXS}/$$file;\
97         done
98
99 .include "../../mk/bsd.pkg.mk"