blob: ef16533bab2920e4dc79d63f2a627c2ba74c35fa [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Free peer-reviewed portable C++ source libraries"
2SECTION = "libs"
3DEPENDS = "bjam-native zlib bzip2"
4
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05005ARM_INSTRUCTION_SET_armv4 = "arm"
6ARM_INSTRUCTION_SET_armv5 = "arm"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007
8BOOST_LIBS = "\
9 atomic \
10 chrono \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060011 container \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012 date_time \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060013 exception \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014 filesystem \
15 graph \
16 iostreams \
17 log \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060018 math \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019 program_options \
20 random \
21 regex \
22 serialization \
23 signals \
24 system \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050025 timer \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026 test \
27 thread \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060028 wave \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029 "
30
Patrick Williamsc0f7c042017-02-23 20:41:17 -060031# only supported by x86 and powerpc
32BOOST_LIBS_append_x86 = " context coroutine"
33BOOST_LIBS_append_x86-64 = " context coroutine"
34BOOST_LIBS_append_powerpc = " context coroutine"
35# need consistent settings for native builds (x86 override not applied for native)
36BOOST_LIBS_remove_class-native = " context coroutine"
37
38# optional libraries
39PACKAGECONFIG ??= "locale"
40PACKAGECONFIG[locale] = ",,icu"
41PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
42PACKAGECONFIG[mpi] = ",,mpich"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050043PACKAGECONFIG[python] = ",,python python3"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060044
45BOOST_LIBS += "\
46 ${@bb.utils.contains('PACKAGECONFIG', 'locale', 'locale', '', d)} \
47 ${@bb.utils.contains('PACKAGECONFIG', 'graph_parallel', 'graph_parallel mpi', \
48 bb.utils.contains('PACKAGECONFIG', 'mpi', 'mpi', '', d), d)} \
49 ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python python3', '', d)} \
50"
51
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052inherit python-dir
53PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}"
54
55# Make a package for each library, plus -dev
56PACKAGES = "${PN}-dbg ${BOOST_PACKAGES}"
57python __anonymous () {
58 packages = []
59 extras = []
60 for lib in d.getVar('BOOST_LIBS', True).split( ):
61 # BJAM does not know '--with-python3' (only --with-python)
62 if lib != "python3":
63 extras.append("--with-%s" % lib)
64 pkg = "boost-%s" % lib.replace("_", "-")
65 packages.append(pkg)
66 if lib == "python":
67 # special: python*.so matches python3.so !!
68 if not d.getVar("FILES_%s" % pkg, True):
69 d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s.so.*" % lib)
70 else:
71 if not d.getVar("FILES_%s" % pkg, True):
72 d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s*.so.*" % lib)
73 d.setVar("BOOST_PACKAGES", " ".join(packages))
74 d.setVar("BJAM_EXTRA", " ".join(extras))
75}
76
77# Override the contents of specific packages
Patrick Williamsc0f7c042017-02-23 20:41:17 -060078FILES_${PN}-graph = "${libdir}/libboost_graph.so.*"
79FILES_${PN}-graph_parallel = "${libdir}/libboost_graph_parallel.so.*"
80FILES_${PN}-locale = "${libdir}/libboost_locale.so.*"
81FILES_${PN}-mpi = "${libdir}/mpi.so ${libdir}/libboost_mpi*.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050082FILES_boost-serialization = "${libdir}/libboost_serialization*.so.* \
83 ${libdir}/libboost_wserialization*.so.*"
84FILES_boost-test = "${libdir}/libboost_prg_exec_monitor*.so.* \
85 ${libdir}/libboost_unit_test_framework*.so.*"
86
87# -dev last to pick up the remaining stuff
88PACKAGES += "${PN}-dev ${PN}-staticdev"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050089FILES_${PN} = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090FILES_${PN}-dev = "${includedir} ${libdir}/libboost_*.so"
91FILES_${PN}-staticdev = "${libdir}/libboost_*.a"
92
93# "boost" is a metapackage which pulls in all boost librabries
94PACKAGES += "${PN}"
95RRECOMMENDS_${PN} += "${BOOST_PACKAGES}"
96RRECOMMENDS_${PN}_class-native = ""
97ALLOW_EMPTY_${PN} = "1"
98
99# to avoid GNU_HASH QA errors added LDFLAGS to ARCH; a little bit dirty but at least it works
100TARGET_CC_ARCH += "${LDFLAGS}"
101
102# Oh yippee, a new build system, it's sooo cooool I could eat my own
103# foot. inlining=on lets the compiler choose, I think. At least this
104# stuff is documented...
105# NOTE: if you leave <debug-symbols>on then in a debug build the build sys
106# objcopy will be invoked, and that won't work. Building debug apparently
107# requires hacking gcc-tools.jam
108#
109# Sometimes I wake up screaming. Famous figures are gathered in the nightmare,
110# Steve Bourne, Larry Wall, the whole of the ANSI C committee. They're just
111# standing there, waiting, but the truely terrifying thing is what they carry
112# in their hands. At first sight each seems to bear the same thing, but it is
113# not so for the forms in their grasp are ever so slightly different one from
114# the other. Each is twisted in some grotesque way from the other to make each
115# an unspeakable perversion impossible to perceive without the onset of madness.
116# True insanity awaits anyone who perceives all of these horrors together.
117#
118# Quotation marks, there might be an easier way to do this, but I can't find
119# it. The problem is that the user.hpp configuration file must receive a
120# pre-processor macro defined as the appropriate string - complete with "'s
121# around it. (<> is a possibility here but the danger to that is that the
122# failure case interprets the < and > as shell redirections, creating
123# random files in the source tree.)
124#
125#bjam: '-DBOOST_PLATFORM_CONFIG=\"config\"'
126#do_compile: '-sGCC=... '"'-DBOOST_PLATFORM_CONFIG=\"config\"'"
127SQD = '"'
128EQD = '\"'
129#boost.bb: "... '-sGCC=... '${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}config${EQD}'${SQD} ..."
130BJAM_CONF = "${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}boost/config/platform/${TARGET_OS}.hpp${EQD}'${SQD}"
131
132BJAM_TOOLS = "--ignore-site-config \
133 '-sTOOLS=gcc' \
134 '-sGCC=${CC} '${BJAM_CONF} \
135 '-sGXX=${CXX} '${BJAM_CONF} \
136 '-sGCC_INCLUDE_DIRECTORY=${STAGING_INCDIR}' \
137 '-sGCC_STDLIB_DIRECTORY=${STAGING_LIBDIR}' \
138 '-sBUILD=release <optimization>space <threading>multi <inlining>on <debug-symbols>off' \
139 '-sPYTHON_ROOT=${PYTHON_ROOT}' \
140 '--layout=system' \
141 "
142
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500143# use PARALLEL_MAKE to speed up the build, but limit it by -j 64, greater parallelism causes bjam to segfault or to ignore -j
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500144# https://svn.boost.org/trac/boost/ticket/7634
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500145def get_boost_parallel_make(d):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500146 pm = d.getVar('PARALLEL_MAKE', True)
147 if pm:
148 # look for '-j' and throw other options (e.g. '-l') away
149 # because they might have different meaning in bjam
150 pm = pm.split()
151 while pm:
152 v = None
153 opt = pm.pop(0)
154 if opt == '-j':
155 v = pm.pop(0)
156 elif opt.startswith('-j'):
157 v = opt[2:].strip()
158 else:
159 v = None
160
161 if v:
162 v = min(64, int(v))
163 return '-j' + str(v)
164
165 return ""
166
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500167BOOST_PARALLEL_MAKE = "${@get_boost_parallel_make(d)}"
168BJAM_OPTS = '${BOOST_PARALLEL_MAKE} -d+2 -q \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500169 ${BJAM_TOOLS} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600170 -sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500171 --build-dir=${S}/${TARGET_SYS} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500172 --disable-icu \
173 ${BJAM_EXTRA}'
174
175# Native compilation of bzip2 isn't working
176BJAM_OPTS_append_class-native = ' -sNO_BZIP2=1'
177
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600178do_configure() {
179 cp -f ${S}/boost/config/platform/linux.hpp ${S}/boost/config/platform/linux-gnueabi.hpp
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500180
181 # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600182 rm -f ${WORKDIR}/user-config.jam
183 echo 'using gcc : 4.3.1 : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam
184 echo "using python : ${PYTHON_BASEVERSION} : : ${STAGING_INCDIR}/python${PYTHON_BASEVERSION} ;" >> ${WORKDIR}/user-config.jam
185 echo "using python : 3.5 : : ${STAGING_INCDIR}/python3.5m ;" >> ${WORKDIR}/user-config.jam
186
187 if ${@bb.utils.contains('BOOST_LIBS', 'mpi', 'true', 'false', d)}; then
188 echo "using mpi : : <find-shared-library>mpi ;" >> ${WORKDIR}/user-config.jam
189 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500190
191 CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc --with-python-root=${PYTHON_ROOT}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600192 sed -i '/^using python/d' ${S}/project-config.jam
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500193}
194
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500195do_compile() {
196 set -ex
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600197 rm -rf ${S}/${TARGET_SYS}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500198 bjam ${BJAM_OPTS} --prefix=${prefix} \
199 --exec-prefix=${exec_prefix} \
200 --libdir=${libdir} \
201 --includedir=${includedir}
202}
203
204do_install() {
205 set -ex
206 bjam ${BJAM_OPTS} \
207 --libdir=${D}${libdir} \
208 --includedir=${D}${includedir} \
209 install
210 for lib in ${BOOST_LIBS}; do
211 if [ -e ${D}${libdir}/libboost_${lib}.a ]; then
212 ln -s libboost_${lib}.a ${D}${libdir}/libboost_${lib}-mt.a
213 fi
214 if [ -e ${D}${libdir}/libboost_${lib}.so ]; then
215 ln -s libboost_${lib}.so ${D}${libdir}/libboost_${lib}-mt.so
216 fi
217 done
218
219}
220
221BBCLASSEXTEND = "native nativesdk"