blob: 77105aa1fa13bd37e5181c2af322f712b7643e05 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Free peer-reviewed portable C++ source libraries"
Andrew Geissler90fd73c2021-03-05 15:25:55 -06002DESCRIPTION = "Provides free peer-reviewed portable C++ source libraries. The emphasis is on libraries which work well with the C++ \
3Standard Library. One goal is to establish 'existing practice' and \
4provide reference implementations so that the Boost libraries are suitable for eventual standardization. Some of the libraries have already been proposed for inclusion in the C++ Standards Committee's \
5upcoming C++ Standard Library Technical Report."
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006SECTION = "libs"
Andrew Geisslerf0343792020-11-18 10:42:21 -06007DEPENDS = "boost-build-native zlib bzip2"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008
Brad Bishop96ff1982019-08-19 13:50:42 -04009CVE_PRODUCT = "boost:boost"
10
Patrick Williams213cb262021-08-07 19:21:33 -050011ARM_INSTRUCTION_SET:armv4 = "arm"
12ARM_INSTRUCTION_SET:armv5 = "arm"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050014B = "${WORKDIR}/build"
15do_configure[cleandirs] = "${B}"
16
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017BOOST_LIBS = "\
18 atomic \
19 chrono \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060020 container \
Andrew Geisslerf0343792020-11-18 10:42:21 -060021 context \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080022 contract \
Andrew Geisslerf0343792020-11-18 10:42:21 -060023 coroutine \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024 date_time \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060025 exception \
Andrew Geisslerf0343792020-11-18 10:42:21 -060026 fiber \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027 filesystem \
28 graph \
Andrew Geisslerf0343792020-11-18 10:42:21 -060029 headers \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030 iostreams \
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000031 json \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032 log \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033 math \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034 program_options \
35 random \
36 regex \
37 serialization \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038 system \
39 test \
40 thread \
Andrew Geisslerf0343792020-11-18 10:42:21 -060041 timer \
42 type_erasure \
Andrew Geissler517393d2023-01-13 08:55:19 -060043 url \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060044 wave \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045 "
46
Patrick Williamsc0f7c042017-02-23 20:41:17 -060047# optional libraries
Brad Bishopd7bf8c12018-02-25 22:55:05 -050048PACKAGECONFIG ??= "locale python"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060049PACKAGECONFIG[locale] = ",,icu"
50PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
51PACKAGECONFIG[mpi] = ",,mpich"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050052PACKAGECONFIG[python] = ",,python3"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060053
54BOOST_LIBS += "\
Brad Bishop6e60e8b2018-02-01 10:27:11 -050055 ${@bb.utils.filter('PACKAGECONFIG', 'locale python', d)} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060056 ${@bb.utils.contains('PACKAGECONFIG', 'graph_parallel', 'graph_parallel mpi', \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050057 bb.utils.filter('PACKAGECONFIG', 'mpi', d), d)} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060058"
59
Brad Bishop6e60e8b2018-02-01 10:27:11 -050060inherit python3-dir
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}"
62
63# Make a package for each library, plus -dev
64PACKAGES = "${PN}-dbg ${BOOST_PACKAGES}"
65python __anonymous () {
66 packages = []
67 extras = []
Andrew Geisslerd1e89492021-02-12 15:35:20 -060068 pn = d.getVar("PN")
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050069 mlprefix = d.getVar("MLPREFIX")
Brad Bishop6e60e8b2018-02-01 10:27:11 -050070 for lib in d.getVar('BOOST_LIBS').split():
71 extras.append("--with-%s" % lib)
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050072 pkg = "boost-%s" % (lib.replace("_", "-"))
Andrew Geisslerd1e89492021-02-12 15:35:20 -060073 if "-native" in pn:
74 pkg = pkg + "-native"
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050075 packages.append(mlprefix + pkg)
Patrick Williams213cb262021-08-07 19:21:33 -050076 if not d.getVar("FILES:%s" % pkg):
77 d.setVar("FILES:%s%s" % (mlprefix, pkg), "${libdir}/libboost_%s*.so.*" % lib)
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050078 else:
Patrick Williams213cb262021-08-07 19:21:33 -050079 d.setVar("FILES:%s%s" % (mlprefix, pkg), d.getVar("FILES:%s" % pkg))
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050080
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081 d.setVar("BOOST_PACKAGES", " ".join(packages))
82 d.setVar("BJAM_EXTRA", " ".join(extras))
83}
84
85# Override the contents of specific packages
Patrick Williams213cb262021-08-07 19:21:33 -050086FILES:${PN}-graph_parallel = "${libdir}/libboost_graph_parallel.so.*"
87FILES:${PN}-locale = "${libdir}/libboost_locale.so.*"
88FILES:${PN}-mpi = "${libdir}/mpi.so ${libdir}/libboost_mpi*.so.*"
89FILES:boost-serialization = "${libdir}/libboost_serialization*.so.* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090 ${libdir}/libboost_wserialization*.so.*"
Patrick Williams213cb262021-08-07 19:21:33 -050091FILES:boost-test = "${libdir}/libboost_prg_exec_monitor*.so.* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092 ${libdir}/libboost_unit_test_framework*.so.*"
93
94# -dev last to pick up the remaining stuff
95PACKAGES += "${PN}-dev ${PN}-staticdev"
Patrick Williams213cb262021-08-07 19:21:33 -050096FILES:${PN}-dev = "${includedir} ${libdir}/libboost_*.so ${libdir}/cmake"
97FILES:${PN}-staticdev = "${libdir}/libboost_*.a"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050098
99# "boost" is a metapackage which pulls in all boost librabries
100PACKAGES += "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -0500101FILES:${PN} = ""
102ALLOW_EMPTY:${PN} = "1"
103RRECOMMENDS:${PN} += "${BOOST_PACKAGES}"
104RRECOMMENDS:${PN}:class-native = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500105
106# to avoid GNU_HASH QA errors added LDFLAGS to ARCH; a little bit dirty but at least it works
107TARGET_CC_ARCH += "${LDFLAGS}"
108
109# Oh yippee, a new build system, it's sooo cooool I could eat my own
110# foot. inlining=on lets the compiler choose, I think. At least this
111# stuff is documented...
112# NOTE: if you leave <debug-symbols>on then in a debug build the build sys
113# objcopy will be invoked, and that won't work. Building debug apparently
114# requires hacking gcc-tools.jam
115#
116# Sometimes I wake up screaming. Famous figures are gathered in the nightmare,
117# Steve Bourne, Larry Wall, the whole of the ANSI C committee. They're just
118# standing there, waiting, but the truely terrifying thing is what they carry
119# in their hands. At first sight each seems to bear the same thing, but it is
120# not so for the forms in their grasp are ever so slightly different one from
121# the other. Each is twisted in some grotesque way from the other to make each
122# an unspeakable perversion impossible to perceive without the onset of madness.
123# True insanity awaits anyone who perceives all of these horrors together.
124#
125# Quotation marks, there might be an easier way to do this, but I can't find
126# it. The problem is that the user.hpp configuration file must receive a
127# pre-processor macro defined as the appropriate string - complete with "'s
128# around it. (<> is a possibility here but the danger to that is that the
129# failure case interprets the < and > as shell redirections, creating
130# random files in the source tree.)
131#
132#bjam: '-DBOOST_PLATFORM_CONFIG=\"config\"'
133#do_compile: '-sGCC=... '"'-DBOOST_PLATFORM_CONFIG=\"config\"'"
134SQD = '"'
135EQD = '\"'
136#boost.bb: "... '-sGCC=... '${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}config${EQD}'${SQD} ..."
137BJAM_CONF = "${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}boost/config/platform/${TARGET_OS}.hpp${EQD}'${SQD}"
138
139BJAM_TOOLS = "--ignore-site-config \
140 '-sTOOLS=gcc' \
141 '-sGCC=${CC} '${BJAM_CONF} \
142 '-sGXX=${CXX} '${BJAM_CONF} \
143 '-sGCC_INCLUDE_DIRECTORY=${STAGING_INCDIR}' \
144 '-sGCC_STDLIB_DIRECTORY=${STAGING_LIBDIR}' \
145 '-sBUILD=release <optimization>space <threading>multi <inlining>on <debug-symbols>off' \
146 '-sPYTHON_ROOT=${PYTHON_ROOT}' \
147 '--layout=system' \
148 "
149
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800150# use PARALLEL_MAKE to speed up the build
151BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_argument(d, '-j%d')}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500152BJAM_OPTS = '${BOOST_PARALLEL_MAKE} -d+2 -q \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500153 ${BJAM_TOOLS} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600154 -sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500155 -sICU_PATH=${STAGING_EXECPREFIXDIR} \
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500156 --build-dir=${B} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500157 --disable-icu \
158 ${BJAM_EXTRA}'
159
160# Native compilation of bzip2 isn't working
Patrick Williams213cb262021-08-07 19:21:33 -0500161BJAM_OPTS:append:class-native = ' -sNO_BZIP2=1'
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500162
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500163# Adjust the build for x32
Patrick Williams213cb262021-08-07 19:21:33 -0500164BJAM_OPTS:append:x86-x32 = " abi=x32 address-model=64"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500165
Vernon Mauery0d70daf2018-09-25 14:17:59 -0700166# cross compiling for arm fails to detect abi, so provide some help
Patrick Williams213cb262021-08-07 19:21:33 -0500167BJAM_OPTS:append:arm = " abi=aapcs architecture=arm"
168BJAM_OPTS:append:aarch64 = " abi=aapcs address-model=64 architecture=arm"
Vernon Mauery0d70daf2018-09-25 14:17:59 -0700169
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600170do_configure() {
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500171 cd ${S}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600172 cp -f ${S}/boost/config/platform/linux.hpp ${S}/boost/config/platform/linux-gnueabi.hpp
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500173
174 # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600175 rm -f ${WORKDIR}/user-config.jam
Andrew Geisslerf0343792020-11-18 10:42:21 -0600176 echo 'using gcc : : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500177
178 # If we want Python then we need to tell Boost *exactly* where to find it
179 if ${@bb.utils.contains('BOOST_LIBS', 'python', 'true', 'false', d)}; then
180 echo "using python : ${PYTHON_BASEVERSION} : ${STAGING_DIR_HOST}${bindir}/python3 : ${STAGING_DIR_HOST}${includedir}/${PYTHON_DIR}${PYTHON_ABI} : ${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR} ;" >> ${WORKDIR}/user-config.jam
181 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600182
183 if ${@bb.utils.contains('BOOST_LIBS', 'mpi', 'true', 'false', d)}; then
184 echo "using mpi : : <find-shared-library>mpi ;" >> ${WORKDIR}/user-config.jam
185 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500186
Andrew Geisslerf0343792020-11-18 10:42:21 -0600187 CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=b2 --with-toolset=gcc
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500188
189 # Boost can't be trusted to find Python on it's own, so remove any mention
190 # of it from the boost configuration
191 sed -i '/using python/d' ${S}/project-config.jam
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500192}
193
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500194do_compile() {
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500195 cd ${S}
Andrew Geisslerf0343792020-11-18 10:42:21 -0600196 b2 ${BJAM_OPTS} \
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500197 --prefix=${prefix} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500198 --exec-prefix=${exec_prefix} \
199 --libdir=${libdir} \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500200 --includedir=${includedir} \
201 --debug-configuration
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500202}
203
204do_install() {
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500205 cd ${S}
Andrew Geisslerf0343792020-11-18 10:42:21 -0600206 b2 ${BJAM_OPTS} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500207 --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
Andrew Geissler82c905d2020-04-13 13:39:40 -0500219 # Cmake files reference full paths to image
220 find ${D}${libdir}/cmake -type f | \
221 grep 'cmake$' | \
222 xargs -n 1 sed -e 's,${D}${libdir}/cmake,${libdir}/cmake,' -i
223
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500224}
225
226BBCLASSEXTEND = "native nativesdk"