1 |
# $MidnightBSD$ |
2 |
|
3 |
PORTNAME?= postgresql |
4 |
DISTVERSION?= 10.4 |
5 |
PORTREVISION?= 1 |
6 |
CATEGORIES?= databases |
7 |
MASTER_SITES= PGSQL/source/v${DISTVERSION} |
8 |
PKGNAMESUFFIX?= ${DISTV:S/.//}${COMPONENT} |
9 |
DISTV= ${DISTVERSION:R} |
10 |
|
11 |
MAINTAINER?= ports@MidnightBSD.org |
12 |
COMMENT?= PostgreSQL is the most advanced open-source database available anywhere |
13 |
|
14 |
LICENSE= other |
15 |
|
16 |
.if ${DISTVERSION:C/([0-9]*).*/\1/} == 10 |
17 |
CONFLICTS+= ${PORTNAME}*-9.* |
18 |
.else |
19 |
CONFLICTS+= ${PORTNAME}*-9.[^${PORTVERSION:R:E}].* ${PORTNAME}10* |
20 |
.endif |
21 |
|
22 |
WRKSRC= ${WRKDIR}/postgresql-${DISTVERSION} |
23 |
DIST_SUBDIR= postgresql |
24 |
|
25 |
OPTIONS_SUB= yes |
26 |
|
27 |
PKGINSTALL?= ${PKGDIR}/pkg-install${COMPONENT} |
28 |
USES+= tar:bzip2 cpe |
29 |
.if !defined(NO_BUILD) |
30 |
USES+= gmake |
31 |
GNU_CONFIGURE= yes |
32 |
LLD_UNSAFE= yes |
33 |
.endif |
34 |
|
35 |
PG_USER?= postgres |
36 |
PG_GROUP?= postgres |
37 |
PG_UID?= 770 |
38 |
|
39 |
LDFLAGS+= -L${LOCALBASE}/lib |
40 |
INCLUDES+= -I${LOCALBASE}/include |
41 |
CONFIGURE_ARGS+=--with-libraries=${PREFIX}/lib \ |
42 |
--with-includes=${PREFIX}/include \ |
43 |
--enable-thread-safety \ |
44 |
--build=${ARCH}-portbld-freebsd10.4 \ |
45 |
--host=${ARCH}-portbld-freebsd10.4 |
46 |
CONFIGURE_ENV+= INCLUDES="${INCLUDES}" \ |
47 |
PTHREAD_LIBS="-lpthread" \ |
48 |
LDFLAGS_SL="${LDFLAGS_SL}" |
49 |
LDFLAGS+= -lpthread |
50 |
|
51 |
PLIST= ${PKGDIR}/pkg-plist${COMPONENT} |
52 |
|
53 |
INSTALL_DIRS?= src/common src/timezone src/backend \ |
54 |
src/backend/utils/mb/conversion_procs \ |
55 |
src/backend/snowball src/backend/replication/libpqwalreceiver \ |
56 |
src/backend/replication/pgoutput \ |
57 |
src/bin/initdb src/bin/pg_ctl \ |
58 |
src/bin/pg_controldata src/bin/pg_resetwal src/pl \ |
59 |
src/bin/pg_basebackup src/bin/pg_archivecleanup \ |
60 |
src/bin/pg_rewind \ |
61 |
src/bin/pg_test_fsync src/bin/pg_test_timing \ |
62 |
src/bin/pg_waldump src/bin/pg_upgrade |
63 |
|
64 |
BUILD_DIRS?= src/port ${INSTALL_DIRS} |
65 |
INSTALL_TARGET?=install-strip |
66 |
|
67 |
.if !defined(CLIENT_ONLY) && !defined(SLAVE_ONLY) |
68 |
SERVER_ONLY= yes |
69 |
COMPONENT= -server |
70 |
USE_RC_SUBR= postgresql |
71 |
USES+= pgsql:${DISTVERSION:C/([0-9]\.?[0-9]).*/\1/g} |
72 |
USERS= ${PG_USER} |
73 |
GROUPS= ${PG_GROUP} |
74 |
SUB_FILES+= 502.pgsql |
75 |
.endif |
76 |
|
77 |
.if defined(CLIENT_ONLY) |
78 |
OPTIONS_DEFINE+=LIBEDIT |
79 |
LIBEDIT_DESC= Use non-GPL libedit instead of readline |
80 |
USES+= perl5 |
81 |
.else |
82 |
MAKE_ENV= PATH=${PREFIX}/bin:${PATH} |
83 |
CONFIGURE_ENV+= PATH=${PREFIX}/bin:${PATH} |
84 |
.endif |
85 |
|
86 |
.if defined(SERVER_ONLY) |
87 |
OPTIONS_DEFINE= DTRACE LDAP INTDATE TZDATA XML |
88 |
LDAP_DESC= Build with LDAP authentication support |
89 |
DTRACE_DESC= Build with DTrace probes |
90 |
TZDATA_DESC= Use internal timezone database |
91 |
XML_DESC= Build with XML data type |
92 |
|
93 |
.if ${DISTVERSION:C/([0-9]*).*/\1/} != 10 |
94 |
# See http://people.freebsd.org/~girgen/postgresql-icu/README.html for more info |
95 |
OPTIONS_DEFINE+= ICU |
96 |
ICU_DESC= Use ICU for unicode collation |
97 |
.else |
98 |
CONFIGURE_ARGS+=--with-icu |
99 |
LIB_DEPENDS+= libicudata.so:devel/icu |
100 |
USES+= pkgconfig |
101 |
.endif |
102 |
|
103 |
# See http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/76999 for more info |
104 |
# (requires dump/restore if modified.) |
105 |
OPTIONS_DEFINE+= INTDATE |
106 |
INTDATE_DESC= Builds with 64-bit date/time type |
107 |
OPTIONS_DEFAULT+= XML TZDATA INTDATE |
108 |
.endif |
109 |
|
110 |
.if !defined(SLAVE_ONLY) |
111 |
OPTIONS_DEFINE+= NLS PAM GSSAPI OPTIMIZED_CFLAGS DEBUG |
112 |
. if ${DISTVERSION:R} == 9.2 || ${DISTVERSION:R} == 9.3 |
113 |
OPTIONS_RADIO= KRB5 |
114 |
OPTIONS_RADIO_KRB5= MIT_KRB5 HEIMDAL_KRB5 |
115 |
. endif |
116 |
|
117 |
KRB5_DESC= Build with kerberos provider support |
118 |
NLS_DESC= Use internationalized messages |
119 |
PAM_DESC= Build with PAM Support |
120 |
MIT_KRB5_DESC= Build with MIT kerberos support |
121 |
HEIMDAL_KRB5_DESC= Builds with Heimdal kerberos |
122 |
GSSAPI_DESC= Build with GSSAPI support |
123 |
OPTIMIZED_CFLAGS_DESC= Builds with compiler optimizations (-O3) |
124 |
|
125 |
OPTIONS_DEFINE+= SSL |
126 |
SSL_DESC= Build with OpenSSL support |
127 |
|
128 |
OPTIONS_DEFAULT+= SSL |
129 |
.endif # !SLAVE_ONLY |
130 |
|
131 |
.if defined(CLIENT_ONLY) |
132 |
LIBEDIT_CONFIGURE_ON+=--with-libedit-preferred |
133 |
LIBEDIT_USES= libedit |
134 |
LIBEDIT_USES_OFF= readline |
135 |
.endif # CLIENT_ONLY |
136 |
|
137 |
SSL_USES= ssl |
138 |
SSL_CONFIGURE_WITH=openssl |
139 |
|
140 |
PAM_CONFIGURE_WITH= pam |
141 |
|
142 |
XML_CONFIGURE_WITH= libxml |
143 |
XML_LIB_DEPENDS= libxml2.so:textproc/libxml2 |
144 |
|
145 |
TZDATA_CONFIGURE_OFF=--with-system-tzdata=/usr/share/zoneinfo |
146 |
|
147 |
INTDATE_CONFIGURE_OFF=--disable-integer-datetimes |
148 |
|
149 |
NLS_CONFIGURE_ENABLE= nls |
150 |
NLS_USES= gettext |
151 |
|
152 |
LDAP_CONFIGURE_WITH= ldap |
153 |
LDAP_USE= OPENLDAP=yes |
154 |
|
155 |
OPTIMIZED_CFLAGS_CFLAGS= -O3 -funroll-loops |
156 |
|
157 |
DEBUG_CONFIGURE_ENABLE= debug |
158 |
|
159 |
PLIST_SUB+= PG_USER=${PG_USER} \ |
160 |
PG_GROUP=${PG_GROUP} |
161 |
SUB_LIST+= PG_GROUP=${PG_GROUP} \ |
162 |
PG_USER=${PG_USER} \ |
163 |
PG_UID=${PG_UID} |
164 |
|
165 |
.include <bsd.mport.options.mk> |
166 |
|
167 |
.if !defined(SLAVE_ONLY) |
168 |
.if ${DISTVERSION:C/([0-9]*).*/\1/} != 10 |
169 |
. if ( defined(SERVER_ONLY) && ${PORT_OPTIONS:MICU} ) || make(makesum) |
170 |
USES+= autoreconf |
171 |
CONFIGURE_ARGS+=--with-icu |
172 |
PATCH_SITES+= http://people.freebsd.org/~girgen/postgresql-icu/:icu |
173 |
PATCHFILES+= ${ICU_PATCHFILE}:icu |
174 |
LIB_DEPENDS+= libicudata.so:devel/icu |
175 |
. endif |
176 |
.endif # not version 10 |
177 |
.endif # !SLAVE_ONLY |
178 |
|
179 |
.if !defined(SLAVE_ONLY) |
180 |
|
181 |
PATCH_DIST_STRIP=-p1 |
182 |
|
183 |
. if ${PORT_OPTIONS:MDTRACE} |
184 |
CONFIGURE_ARGS+=--enable-dtrace |
185 |
LDFLAGS+=-lelf |
186 |
INSTALL_TARGET=install |
187 |
. endif |
188 |
|
189 |
.if ${PORT_OPTIONS:MGSSAPI} |
190 |
CONFIGURE_ARGS+=--with-gssapi |
191 |
.if empty(PORT_OPTIONS:MMIT_KRB5) && empty(PORT_OPTIONS:MHEIMDAL_KRB5) |
192 |
# Kerberos libraries will pull the proper GSSAPI library |
193 |
# via linker dependencies, but otherwise we must specify |
194 |
# it explicitely: ld --as-needed is used for compilation, |
195 |
# so configure's -lgssapi_krb5 won't go. |
196 |
LDFLAGS+= -lgssapi |
197 |
LDFLAGS_SL+= -lgssapi |
198 |
.endif |
199 |
.else |
200 |
CONFIGURE_ARGS+=--without-gssapi |
201 |
.endif |
202 |
|
203 |
. if ${PORT_OPTIONS:MMIT_KRB5} |
204 |
. if defined(IGNORE_WITH_SRC_KRB5) && (exists(/usr/lib/libkrb5.so) || exists(/usr/bin/krb5-config)) |
205 |
IGNORE= requires that you remove heimdal\'s /usr/bin/krb5-config and /usr/lib/libkrb5.so*, and set NO_KERBEROS=true in /etc/src.conf to build successfully with MIT-KRB |
206 |
. else |
207 |
CONFIGURE_ARGS+=--with-krb5 |
208 |
# Allow defining a home built MIT Kerberos by setting KRB5_HOME |
209 |
. if defined(KRB5_HOME) && exists(${KRB5_HOME}/lib/libgssapi_krb5.a) && exists(${KRB5_HOME}/bin/krb5-config) |
210 |
LIB_DEPENDS+= libkrb5.so.3:security/krb5 |
211 |
. endif |
212 |
. endif |
213 |
. endif |
214 |
|
215 |
. if ${PORT_OPTIONS:MHEIMDAL_KRB5} |
216 |
CONFIGURE_ARGS+=--with-krb5 |
217 |
. endif |
218 |
|
219 |
.endif # !SLAVE_ONLY |
220 |
|
221 |
# For testing files in FILESDIR |
222 |
.include <bsd.port.pre.mk> |
223 |
|
224 |
.if defined(SERVER_ONLY) |
225 |
pre-build: |
226 |
@${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL |
227 |
.endif |
228 |
|
229 |
.if !defined(NO_BUILD) && !target(do-build) |
230 |
|
231 |
do-build: |
232 |
@ cd ${WRKSRC}/src/backend && ${SETENV} ${MAKE_ENV} ${FAKE_MAKEENV} ${MAKE_CMD} ${FAKE_MAKEARGS} symlinks |
233 |
@ for dir in ${BUILD_DIRS}; do \ |
234 |
cd ${WRKSRC}/$${dir} && ${SETENV} ${MAKE_ENV} ${FAKE_MAKEENV} ${MAKE_CMD} ${FAKE_MAKEARGS}; \ |
235 |
done |
236 |
|
237 |
. if exists(${FILESDIR}/pkg-message${COMPONENT}.in) |
238 |
SUB_FILES+= pkg-message${COMPONENT} |
239 |
PKGMESSAGE= ${WRKSRC}/pkg-message${COMPONENT} |
240 |
. endif |
241 |
. if exists(${FILESDIR}/pkg-install${COMPONENT}.in) |
242 |
SUB_FILES+= pkg-install${COMPONENT} |
243 |
PLIST_SUB+= PG_USER=${PG_USER} |
244 |
. endif |
245 |
|
246 |
post-patch: |
247 |
. if defined(SERVER_ONLY) && ${PORT_OPTIONS:MICU} |
248 |
@${REINPLACE_CMD} \ |
249 |
-e '/m4_PACKAGE_VERSION/s/\[2\.6[0-9]\]/m4_defn([m4_PACKAGE_VERSION])/' \ |
250 |
-e '/icu/s/_57//' \ |
251 |
${WRKSRC}/configure.in |
252 |
. endif |
253 |
|
254 |
do-install: |
255 |
@for dir in ${INSTALL_DIRS}; do \ |
256 |
cd ${WRKSRC}/$${dir} && \ |
257 |
${SETENV} ${MAKE_ENV} ${FAKE_MAKEENV} ${MAKE_CMD} ${MAKE_ARGS} ${FAKE_MAKEARGS} ${INSTALL_TARGET}; \ |
258 |
done |
259 |
. if defined(SERVER_ONLY) |
260 |
@ ${MKDIR} ${STAGEDIR}${PREFIX}/share/postgresql ;\ |
261 |
${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily ;\ |
262 |
${INSTALL_SCRIPT} ${WRKDIR}/502.pgsql \ |
263 |
${STAGEDIR}${PREFIX}/etc/periodic/daily |
264 |
. endif # SERVER_ONLY |
265 |
. if defined(CLIENT_ONLY) |
266 |
@ cd ${WRKSRC}/src && ${SETENV} ${MAKE_ENV} ${FAKE_MAKEENV} ${MAKE_CMD} ${MAKE_ARGS} ${FAKE_MAKEARGS} install-local |
267 |
. endif |
268 |
@ if [ -r ${PKGMESSAGE} ]; then \ |
269 |
${MKDIR} ${STAGEDIR}${DOCSDIR} ;\ |
270 |
${INSTALL_DATA} ${PKGMESSAGE} ${STAGEDIR}${DOCSDIR}/README${COMPONENT} ;\ |
271 |
fi |
272 |
.endif # !NO_BUILD |
273 |
|
274 |
.if defined(SERVER_ONLY) |
275 |
check: |
276 |
@if [ `id -u` != 0 ] ; then \ |
277 |
${ECHO} "Running postgresql regressions tests" ;\ |
278 |
cd ${WRKSRC}; ${MAKE_CMD} check ;\ |
279 |
else \ |
280 |
${ECHO} "You cannot run regression tests when postgresql is built as user root." ; \ |
281 |
${ECHO} "Clean and rebuild the port as a regular user to run the tests." ;\ |
282 |
fi |
283 |
.endif |
284 |
|
285 |
.include <bsd.port.post.mk> |