Pullup ticket #3113 - requested by spz:
[pkgsrc.git] / databases / postgresql83 / Makefile.common
1 # $NetBSD$
2 #
3 # This Makefile fragment is included by all PostgreSQL packages built from
4 # the main sources of the PostgreSQL distribution except jdbc-postgresql.
5 #
6 # The PostgreSQL package naming scheme, aside from the obvious piecewise
7 # packages, is as follows:
8 #
9 #       <lang>-postgresql       client-side interface to PostgreSQL
10 #       postgresql-<lang>       server-side module for PostgreSQL backend
11
12 .include "../../databases/postgresql83/Makefile.mirrors"
13
14 DISTNAME?=      postgresql-${DIST_VERS}
15 CATEGORIES+=    databases
16 MASTER_SITES?=  ${PGSQL_MIRRORS:=source/v${DIST_VERS}/}
17 EXTRACT_SUFX=   .tar.bz2
18
19 MAINTAINER?=    adam@NetBSD.org
20 HOMEPAGE?=      http://www.postgresql.org/
21
22 CONFLICTS+=     postgresql-[0-9]*
23 CONFLICTS+=     postgresql73-*
24 CONFLICTS+=     postgresql74-*
25 CONFLICTS+=     postgresql80-*
26 CONFLICTS+=     postgresql81-*
27 CONFLICTS+=     postgresql82-*
28 CONFLICTS+=     postgresql84-*
29
30 DISTINFO_FILE?=         ${.CURDIR}/../postgresql83/distinfo
31 COMMON_FILESDIR?=       ${.CURDIR}/../postgresql83/files
32 PATCHDIR?=              ${.CURDIR}/../postgresql83/patches
33
34 # Version numbering scheme:
35 # DIST_VERS             version number on the postgresql distfile
36 # BASE_VERS             pkgsrc-mangled version number (convert pl -> .)
37 # Note: Do not forget jdbc-postgresql83 when updating version
38 DIST_VERS?=             8.3.10
39 BASE_VERS?=             ${DIST_VERS}
40
41 BUILDLINK_API_DEPENDS.postgresql83-client+=     postgresql83-client>=${BASE_VERS}
42
43 GNU_CONFIGURE=          yes
44 USE_TOOLS+=             bison gmake lex msgfmt
45 PKG_SYSCONFSUBDIR=      postgresql
46
47 # in 7.4.x/8.0.x, this is done by autoconf stuff which has leading whitespace
48 USE_PKGLOCALEDIR=       yes
49 SUBST_CLASSES+=         pglocale
50 SUBST_FILES.pglocale=   configure config/programs.m4
51 SUBST_STAGE.pglocale=   pre-configure
52 SUBST_SED.pglocale=     -e 's|\( localedir[      :]*=\).*|\1${PG_LOCALE_DIR}|'
53
54 .include "../../mk/bsd.prefs.mk"
55
56 PG_TEMPLATE.SunOS=      solaris
57 PG_TEMPLATE.IRIX=       irix5
58 .if !defined(PG_TEMPLATE.${OPSYS})
59 PG_TEMPLATE.${OPSYS}=   ${LOWER_OPSYS}
60 .endif
61
62 PG_SUBPREFIX=           # empty
63 .if empty(PG_SUBPREFIX)
64 PG_PREFIX=              ${PREFIX}
65 PLIST_SUBST+=           PG_SUBPREFIX=
66 .else
67 PG_PREFIX=              ${PREFIX}/${PG_SUBPREFIX}
68 BUILD_DEFS+=            PG_SUBPREFIX
69 PLIST_SUBST+=           PG_SUBPREFIX=${PG_SUBPREFIX}/
70 BUILDLINK_PASSTHRU_DIRS+=       ${PG_PREFIX}
71 .endif
72 PG_DATA_DIR=            ${PG_PREFIX}/share/postgresql
73 PG_DOC_DIR=             ${PG_PREFIX}/share/doc/postgresql
74 PG_LOCALE_DIR=          ${PG_PREFIX}/${PKGLOCALEDIR}/locale
75 PG_ETC_DIR=             ${PKG_SYSCONFDIR:S/^${PREFIX}\//${PG_PREFIX}\//}
76
77 GNU_CONFIGURE_PREFIX=   ${PG_PREFIX}
78 CONFIGURE_ARGS+=        --sysconfdir=${PG_ETC_DIR}
79 CONFIGURE_ARGS+=        --datadir=${PG_DATA_DIR}
80 CONFIGURE_ARGS+=        --with-docdir=${PG_DOC_DIR}
81 CONFIGURE_ARGS+=        --with-template=${PG_TEMPLATE.${OPSYS}}
82 CONFIGURE_ARGS+=        --without-readline
83 CONFIGURE_ARGS+=        --without-zlib
84 CONFIGURE_ARGS+=        --enable-nls
85
86 CONFIGURE_ARGS+=        --without-perl
87 CONFIGURE_ARGS+=        --without-python
88 CONFIGURE_ARGS+=        --without-tcl
89
90 # Enable Bonjour on Mac OS X
91 .if ${OPSYS} == "Darwin"
92 CONFIGURE_ARGS+=        --with-bonjour
93 .endif
94
95 # PostgreSQL explicitly forbids any use of -ffast-math
96 BUILDLINK_TRANSFORM+=   rm:-ffast-math
97
98 # USE_LIBLTDL is "yes" or "no" depending on whether we're using libltdl
99 # to provide "dlopen" functionality for the PostgreSQL backend.
100 .if ${OPSYS} == "Interix"
101 USE_LIBLTDL?=           yes
102 .endif
103 USE_LIBLTDL?=           no
104
105 FILES_SUBST+=           PG_PREFIX=${PG_PREFIX:Q}
106
107 .include "../../devel/gettext-lib/buildlink3.mk"
108
109 .if !defined(META_PACKAGE)
110 post-extract:
111         cp -f ${COMMON_FILESDIR}/Makefile.custom ${WRKSRC}/src/Makefile.custom
112         cp -f ${COMMON_FILESDIR}/Makefile.libtool ${WRKSRC}/src/Makefile.shlib
113 .if !empty(USE_LIBLTDL:M[yY][eE][sS])
114                 template=${PG_TEMPLATE.${OPSYS}:Q}
115         cp -f ${COMMON_FILESDIR}/dynloader-ltdl.h \
116                 ${WRKSRC}/src/backend/port/dynloader/${PG_TEMPLATE.${OPSYS}:Q}.h
117         ${ECHO} "static int dummy = 0;" \
118                 > ${WRKSRC}/src/backend/port/dynloader/${PG_TEMPLATE.${OPSYS}:Q}.c
119         fi
120 .endif
121         touch ${WRKSRC}/src/template/dragonfly
122         cp ${WRKSRC}/src/backend/port/dynloader/freebsd.c \
123                 ${WRKSRC}/src/backend/port/dynloader/dragonfly.c
124         cp ${WRKSRC}/src/backend/port/dynloader/freebsd.h \
125                 ${WRKSRC}/src/backend/port/dynloader/dragonfly.h
126         cp ${WRKSRC}/src/include/port/freebsd.h \
127                 ${WRKSRC}/src/include/port/dragonfly.h
128         cp ${WRKSRC}/src/makefiles/Makefile.freebsd \
129                 ${WRKSRC}/src/makefiles/Makefile.dragonfly
130 .endif
131
132 # PGSQL_BLCKSZ is the size in bytes of a PostgreSQL disk page or block.
133 # This also limits the size of a tuple.  The valid values are powers
134 # of 2 up to 32768, and the default size is 8196 (hardcoded in the
135 # PostgreSQL sources).  Please don't change this value unless you know
136 # what you are doing.
137 BUILD_DEFS+=    PGSQL_BLCKSZ
138
139 .if defined(PGSQL_BLCKSZ)
140 .PHONY: pgsql-blcksz
141 pre-configure: pgsql-blcksz
142 pgsql-blcksz:
143         for file in ${WRKSRC}/src/include/pg_config_manual.h; do        \
144                 ${SED} -e "/^#define[   ]*BLCKSZ[       ]*/s/^\(#define[        ]*BLCKSZ\).*/\1 ${PGSQL_BLCKSZ}/" $$file > $$file.new; \
145                 ${MV} -f $$file.new $$file;                             \
146         done
147 .endif