summaryrefslogtreecommitdiffstats
path: root/devel/boost/Makefile
blob: e57da1f2f1b824c31cba1b3c95789b0879e2e9c3 (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# ex:ts=8
# Ports collection makefile for:  boost
# Date Created:			  6 January 2002
# Whom:				  Paul Marquis <pmarquis@pobox.com>
#
# $FreeBSD$

PORTNAME=	boost
PORTVERSION=	1.32.0
PORTREVISION=	2
CATEGORIES=	devel
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE:S/$/:boost_site,spirit_site/}
MASTER_SITE_SUBDIR=boost/:boost_site
DISTNAME=	${PORTNAME}_${PORTVERSION:S/./_/g}
DISTFILES=	${DISTNAME}${EXTRACT_SUFX}:boost_site

MAINTAINER=	barner@FreeBSD.org
COMMENT=	Free peer-reviewed portable C++ source libraries

USE_BZIP2=	yes
USE_REINPLACE=	yes
INSTALLS_SHLIB=	yes

MAKE_ENV+=	GCC="${CC} ${CFLAGS}"\
		GXX="${CXX} ${CXXFLAGS}"\
		STLPORT_ROOT=/

OPTIONS=	VERBOSE_BUILD	"Show compiler messages"	off \
		DEBUG		"Build debugging symbols"	off \
		THREADS		"Thread support"		on  \
		OPTIMIZED_CFLAGS "Enable -O3 optimization"	off

UNIQ=		/usr/bin/uniq
BOOST_LIBS=	date_time filesystem prg_exec_monitor program_options \
		regex signals test_exec_monitor unit_test_framework
BOOST_SHARED_LIB_VER=	2

PKGMESSAGE=	${WRKDIR}/pkg-message

.if !defined(WITH_PYTHON) && defined(WITH_PYSTE)
WITH_PYTHON=	IMPLIED_BY_PYSTE
.endif

#
# Unfortunately, it is not possible to use OPTIONS to control the
# optional Python support
#
# In order to build Boost's Python bindings, please specify
# -DWITH_PYTHON on the command line or use the devel/boost-python
# slave port.
#
# To build Pyste, the Boost.Python code generator use -DWITH_PYSTE
# (this implies -DWITH_PYTHON).
#
.if defined(WITH_PYTHON)
PKGNAMESUFFIX=	-python
USE_PYTHON=	2.3+
PLIST_SUB+=	BOOST_PYTHON=""
MAKE_ENV+=	PYTHON_ROOT="${LOCALBASE}"\
		PYTHON_VERSION="${PYTHON_VERSION}"\
		PYTHON_INCLUDES="${PYTHON_INCLUDEDIR}"\
		PYTHON_LIB_PATH="${PYTHON_LIBDIR}"
BOOST_LIBS+=	python
.if defined(WITH_PYSTE)
RUN_DEPENDS+=	gccxml:${PORTSDIR}/devel/gccxml \
		${PYTHON_SITELIBDIR}/elementtree/ElementTree.py:${PORTSDIR}/devel/py-elementtree
BUILD_DEPENDS+=	${PYTHON_SITELIBDIR}/elementtree/ElementTree.py:${PORTSDIR}/devel/py-elementtree
PLIST_SUB+=	BOOST_PYSTE=""
.else
PLIST_SUB+=	BOOST_PYSTE="@comment "
.endif
.else
PLIST_SUB+=	BOOST_PYTHON="@comment "
PLIST_SUB+=	BOOST_PYSTE="@comment "
.endif

.include <bsd.port.pre.mk>
SPIRIT_VERSION=	1.6.2

# FreeBSD 4:
# - no wchar support
# - needs stlport
# - spirit 1.6.x
.if ${OSVERSION} < 500000
USE_ZIP=	yes
EXTRA_PATCHES=	${FILESDIR}/FBSD4-patch-libs::serialization::build::Jamfile\
		${FILESDIR}/FBSD4-patch-boost::program_options::detail::utf8_codecvt_facet.hpp

DISTFILES+=	spirit-only-${SPIRIT_VERSION}.zip:spirit_site
MASTER_SITE_SUBDIR+=spirit/:spirit_site
BJAM_BUILD+=	<stlport-iostream>on
BOOST_TOOLS=	gcc-stlport

PLIST_SUB+=	BOOST_WCHAR="@comment "\
		BOOST_SPIRIT_1.6=""\
		BOOST_SPIRIT_1.8="@comment "

BOOST_STL_OPTS=	"-sSTLPORT_INCLUDE_DIRECTORY=${LOCALBASE}/include/stlport"\
		"-sSTLPORT_LIB_DIRECTORY=${LOCALBASE}/lib"

RUN_DEPENDS+=	${LOCALBASE}/lib/libstlport_gcc.so:${PORTSDIR}/devel/stlport
BUILD_DEPENDS+=	${RUN_DEPENDS}

# FreeBSD 5
# - wchar support
# - spirit 1.8.x
.else
BOOST_TOOLS=	gcc
EXTRA_PATCHES=	${FILESDIR}/FBSD5-patch-boost::python::detail::config.hpp

PLIST_SUB+=	BOOST_WCHAR=""\
		BOOST_SPIRIT_1.6="@comment "\
		BOOST_SPIRIT_1.8=""
.endif

.if defined (WITH_VERBOSE_BUILD)
BJAM_OPTIONS=	-d2
.endif

.if defined (WITHOUT_DEBUG)
BJAM_BUILD+=	release
.else
BJAM_BUILD+=	debug
.endif

.if defined (WITHOUT_THREADS)
BJAM_BUILD+=	<threading>single
PLIST_SUB+=	BOOST_THREADS="@comment "
.else
BJAM_BUILD+=	<threading>multi
PLIST_SUB+=	BOOST_THREADS=""
BOOST_LIBS+=	thread
.endif

.if defined (WITHOUT_OPTIMIZED_CFLAGS)
BJAM_BUILD+=	<optimization>off
.else
BJAM_BUILD+=	<optimization>speed\
		<inlining>full
.endif

.if ${ARCH} == alpha
BJAM=		${WRKSRC}/tools/build/jam_src/bin.freebsdaxp/bjam
# temporary work around for GCC bug on alpha
# ("-mcpu=ev4 -mtune=ev5 -mieee" makes gcc consume all virtual memory)
#
# If you are trying to build this on alpha, a quick test whether the problem
# still exists would be very much appreciated!
CXXFLAGS=-O -pipe
.elif ${ARCH} == sparc64
BJAM=		${WRKSRC}/tools/build/jam_src/bin.freebsdsparc/bjam
.elif ${ARCH} == ia64
BJAM=		${WRKSRC}/tools/build/jam_src/bin.freebsdia64/bjam
.else
BJAM=		${WRKSRC}/tools/build/jam_src/bin.freebsd/bjam
.endif

pre-everything::
.if !defined(WITH_PYTHON)
	@${ECHO_CMD}
	@${ECHO_CMD} To build Boost\'s Python bindings hit CTRL+C now and
	@${ECHO_CMD} run \`\`make -DWITH_PYTHON [...]\'\' or use the
	@${ECHO_CMD} devel/boost-python slave port.
	@${ECHO_CMD}
	@sleep 2
.else
.if ${WITH_PYTHON} == IMPLIED_BY_PYSTE
	@${ECHO_CMD}
	@${ECHO_CMD} WITH_PYSTE implies WITH_PYTHON! Enabling Python bindings!
	@${ECHO_CMD}
.else
	@${ECHO_CMD}
	@${ECHO_CMD} Python bindings enabled!
	@${ECHO_CMD}
.endif
.if !defined(WITH_PYSTE)
	@${ECHO_CMD} To build Pyste, Boost.Python\'s interface generator,  hit CTRL+C now and
	@${ECHO_CMD} run \`\`make -DWITH_PYTHON -DWITH_PYSTE[...]\'\'.
	@${ECHO_CMD}
	@sleep 2
.else
	@${ECHO_CMD} Pyste will be installed!
	@${ECHO_CMD}
.endif
.endif

do-extract:
	@${MKDIR} ${WRKDIR}
	@cd ${WRKDIR} && ${TAR} -xjpof ${DISTDIR}/${DISTNAME}.tar.bz2

# boost 1.32.0's spirit 1.8.x cannot be built with GCC 2.95.4,
# so we use spirit 1.6.x
.if ${OSVERSION} < 500000
	@cd ${WRKDIR} && ${UNZIP_CMD} ${DISTDIR}/spirit-only-${SPIRIT_VERSION}.zip > /dev/null

# remove CRLF
	@${FIND} ${WRKDIR}/spirit_${SPIRIT_VERSION:S/./_/g} -type f -exec \
		${REINPLACE_CMD} -i '' -e "s|"`printf '\015'`"||g" {} \;

# replace spirit v1.8 with v1.6
	@${RM} -rf ${WRKSRC}/boost/spirit* ${WRKSRC}/libs/spirit
	@${MV} ${WRKDIR}/spirit_${SPIRIT_VERSION:S/./_/g}/boost/* ${WRKSRC}/boost
	@${MV} ${WRKDIR}/spirit_${SPIRIT_VERSION:S/./_/g}/libs/spirit ${WRKSRC}/libs
.endif

post-patch:
# If necessary, remove Boost.Python
.if !defined(WITH_PYTHON)
	@${RM} -rf ${WRKSRC}/boost/python* ${WRKSRC}/libs/python
.endif

# Do the right thing(tm) for pthread support
	@${REINPLACE_CMD} -e 's|%%PTHREAD_CFLAGS%%|${PTHREAD_CFLAGS}|'\
		${WRKSRC}/tools/build/v1/gcc-tools.jam \
		${WRKSRC}/tools/build/v1/gcc-stlport-tools.jam
	@${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|'\
		${WRKSRC}/tools/build/v1/gcc-tools.jam \
		${WRKSRC}/tools/build/v1/gcc-stlport-tools.jam

post-configure:
# Configure pyste, the Boost.Python code generator
.if defined(WITH_PYSTE)
	@cd ${BUILD_WRKSRC}/libs/python/pyste/install && \
	${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYSETUP} \
		config ${PYDISTUTILS_CONFIGUREARGS}
.endif

do-build:
# build the bjam project build tool
	cd ${WRKSRC}/tools/build/jam_src && ./build.sh gcc

# build the library
	cd ${WRKSRC} && \
		${SETENV} ${MAKE_ENV} ${BJAM} ${BJAM_OPTIONS} --prefix=${PREFIX}\
		"-sTOOLS=${BOOST_TOOLS}" "-sBUILD=${BJAM_BUILD}"\
		${BOOST_STL_OPTS}

# Build pyste, the Boost.Python code generator
.if defined(WITH_PYSTE)
	cd ${BUILD_WRKSRC}/libs/python/pyste/install && \
	${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYSETUP} \
		build ${PYDISTUTILS_BUILDARGS}
.endif

do-install:
	${INSTALL_PROGRAM} ${BJAM} ${PREFIX}/bin/

# Install libraries
	${FIND} ${WRKSRC}/bin/boost/libs -type f -name "*.a"\
		-exec ${INSTALL_DATA} \{\} ${PREFIX}/lib \;

	${FIND} ${WRKSRC}/bin/boost/libs -type f \
		-name "*.so.${BOOST_SHARED_LIB_VER}" \
		-exec ${INSTALL_DATA} \{\} ${PREFIX}/lib \;

# Create symlinks for shared libraries
.for lib in ${BOOST_LIBS}
	cd ${PREFIX}/lib && ${RM} -f "libboost_${lib}.so" && \
	${LN} -s "libboost_${lib}.so.${BOOST_SHARED_LIB_VER}" "libboost_${lib}.so"
.endfor

# Install headers
	cd ${WRKSRC} && \
	${FIND} boost -type d -a \! -name "*.orig"\
		-exec ${MKDIR} ${PREFIX}/include/\{\} \;

	cd ${WRKSRC} && \
	${FIND} boost -type f -a \! -name "*.orig"\
		-exec ${INSTALL_DATA} \{\} ${PREFIX}/include/\{\} \;

# Install pyste, the Boost.Python code generator
.if defined(WITH_PYSTE)
	cd ${WRKSRC}/libs/python/pyste/install && \
	${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYSETUP} \
		install ${PYDISTUTILS_INSTALLARGS}
.else
# Delete pyste folder in order not to install the documentation
	${RM} -rf ${WRKSRC}/libs/python/pyste
.endif

# Documentation & examples
.if !defined(NOPORTDOCS)
# Installation
	${MKDIR} ${DOCSDIR}

	${FIND} ${WRKSRC} -type f -exec ${CHMOD} 0444 {} \;
	${FIND} ${WRKSRC} -type d -exec ${CHMOD} 0555 {} \;
	cd ${WRKSRC} &&\
	${FIND} . -name "*.htm" -o -name "*.html"  -o -name "*.css"\
		-o -name "*.jp*g" -o -name "*.png" -o -name "*.gif"\
		| ${TAR} cTf - - | ${TAR} xUCf ${DOCSDIR} -

	cd ${WRKSRC}/libs &&\
	${FIND} . -name "example" -o -name "examples" -o -name "*example*.cpp"\
		-o -name "*example*.c" -o -name "*example*.hpp" | ${UNIQ} |\
		${GREP} -v "assign/test" | ${GREP} -v "iterator/test" | \
		${GREP} -v "range/test" |\
	${TAR} cTf - - | ${TAR} xUCf ${DOCSDIR}/libs -
.endif

# display pkg-message
post-install:
	@${TOUCH} ${PKGMESSAGE}

.if ${OSVERSION} < 500000
	@${CAT} ${.CURDIR}/../boost/pkg-message.stlport >> ${PKGMESSAGE}
	@${ECHO_CMD} >> ${PKGMESSAGE}
.endif

.if defined (WITH_THREADS)
	@${CAT} ${.CURDIR}/../boost/pkg-message.threads >> ${PKGMESSAGE}
	@${ECHO_CMD} >> ${PKGMESSAGE}
.endif

.if defined (WITH_PYTHON)
	@${CAT} ${.CURDIR}/../boost/pkg-message.python >> ${PKGMESSAGE}
	@${ECHO_CMD} >> ${PKGMESSAGE}
.endif

	@${REINPLACE_CMD} \
		-e "s|%%LOCALBASE%%|${LOCALBASE}|g" \
		-e "s|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|g" \
		-e "s|%%PYTHON_INCLUDEDIR%%|${PYTHON_INCLUDEDIR}|g" \
		-e "s|%%PYTHON_LIBDIR%%|${PYTHON_LIBDIR}|g" \
		-e "s|%%PYTHON_VERSION%%|${PYTHON_VERSION}|g" ${PKGMESSAGE}

	@if [ -s ${PKGMESSAGE} ]; then \
	${ECHO_CMD} ; \
	${ECHO_CMD} "===============================================================================" ; \
	${ECHO_CMD} ; \
	${CAT} ${PKGMESSAGE}; \
	${ECHO_CMD} "===============================================================================" ; \
	${ECHO_CMD} ; \
	fi

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud