Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Free peer-reviewed portable C++ source libraries" |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 2 | DESCRIPTION = "Provides free peer-reviewed portable C++ source libraries. The emphasis is on libraries which work well with the C++ \ |
| 3 | Standard Library. One goal is to establish 'existing practice' and \ |
| 4 | provide 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 \ |
| 5 | upcoming C++ Standard Library Technical Report." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | SECTION = "libs" |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 7 | DEPENDS = "boost-build-native zlib bzip2" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 8 | |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 9 | CVE_PRODUCT = "boost:boost" |
| 10 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 11 | ARM_INSTRUCTION_SET_armv4 = "arm" |
| 12 | ARM_INSTRUCTION_SET_armv5 = "arm" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 13 | |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 14 | B = "${WORKDIR}/build" |
| 15 | do_configure[cleandirs] = "${B}" |
| 16 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 17 | BOOST_LIBS = "\ |
| 18 | atomic \ |
| 19 | chrono \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 20 | container \ |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 21 | context \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 22 | contract \ |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 23 | coroutine \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 24 | date_time \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 25 | exception \ |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 26 | fiber \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | filesystem \ |
| 28 | graph \ |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 29 | headers \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | iostreams \ |
| 31 | log \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 32 | math \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 33 | program_options \ |
| 34 | random \ |
| 35 | regex \ |
| 36 | serialization \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | system \ |
| 38 | test \ |
| 39 | thread \ |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 40 | timer \ |
| 41 | type_erasure \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 42 | wave \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 43 | " |
| 44 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 45 | # optional libraries |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 46 | PACKAGECONFIG ??= "locale python" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 47 | PACKAGECONFIG[locale] = ",,icu" |
| 48 | PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich" |
| 49 | PACKAGECONFIG[mpi] = ",,mpich" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 50 | PACKAGECONFIG[python] = ",,python3" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 51 | |
| 52 | BOOST_LIBS += "\ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 53 | ${@bb.utils.filter('PACKAGECONFIG', 'locale python', d)} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 54 | ${@bb.utils.contains('PACKAGECONFIG', 'graph_parallel', 'graph_parallel mpi', \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 55 | bb.utils.filter('PACKAGECONFIG', 'mpi', d), d)} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 56 | " |
| 57 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 58 | inherit python3-dir |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 59 | PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}" |
| 60 | |
| 61 | # Make a package for each library, plus -dev |
| 62 | PACKAGES = "${PN}-dbg ${BOOST_PACKAGES}" |
| 63 | python __anonymous () { |
| 64 | packages = [] |
| 65 | extras = [] |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 66 | pn = d.getVar("PN") |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 67 | mlprefix = d.getVar("MLPREFIX") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 68 | for lib in d.getVar('BOOST_LIBS').split(): |
| 69 | extras.append("--with-%s" % lib) |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 70 | pkg = "boost-%s" % (lib.replace("_", "-")) |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 71 | if "-native" in pn: |
| 72 | pkg = pkg + "-native" |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 73 | packages.append(mlprefix + pkg) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 74 | if not d.getVar("FILES_%s" % pkg): |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 75 | d.setVar("FILES_%s%s" % (mlprefix, pkg), "${libdir}/libboost_%s*.so.*" % lib) |
| 76 | else: |
| 77 | d.setVar("FILES_%s%s" % (mlprefix, pkg), d.getVar("FILES_%s" % pkg)) |
| 78 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 79 | d.setVar("BOOST_PACKAGES", " ".join(packages)) |
| 80 | d.setVar("BJAM_EXTRA", " ".join(extras)) |
| 81 | } |
| 82 | |
| 83 | # Override the contents of specific packages |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 84 | FILES_${PN}-graph_parallel = "${libdir}/libboost_graph_parallel.so.*" |
| 85 | FILES_${PN}-locale = "${libdir}/libboost_locale.so.*" |
| 86 | FILES_${PN}-mpi = "${libdir}/mpi.so ${libdir}/libboost_mpi*.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 87 | FILES_boost-serialization = "${libdir}/libboost_serialization*.so.* \ |
| 88 | ${libdir}/libboost_wserialization*.so.*" |
| 89 | FILES_boost-test = "${libdir}/libboost_prg_exec_monitor*.so.* \ |
| 90 | ${libdir}/libboost_unit_test_framework*.so.*" |
| 91 | |
| 92 | # -dev last to pick up the remaining stuff |
| 93 | PACKAGES += "${PN}-dev ${PN}-staticdev" |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 94 | FILES_${PN}-dev = "${includedir} ${libdir}/libboost_*.so ${libdir}/cmake" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 95 | FILES_${PN}-staticdev = "${libdir}/libboost_*.a" |
| 96 | |
| 97 | # "boost" is a metapackage which pulls in all boost librabries |
| 98 | PACKAGES += "${PN}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 99 | FILES_${PN} = "" |
| 100 | ALLOW_EMPTY_${PN} = "1" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 101 | RRECOMMENDS_${PN} += "${BOOST_PACKAGES}" |
| 102 | RRECOMMENDS_${PN}_class-native = "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 103 | |
| 104 | # to avoid GNU_HASH QA errors added LDFLAGS to ARCH; a little bit dirty but at least it works |
| 105 | TARGET_CC_ARCH += "${LDFLAGS}" |
| 106 | |
| 107 | # Oh yippee, a new build system, it's sooo cooool I could eat my own |
| 108 | # foot. inlining=on lets the compiler choose, I think. At least this |
| 109 | # stuff is documented... |
| 110 | # NOTE: if you leave <debug-symbols>on then in a debug build the build sys |
| 111 | # objcopy will be invoked, and that won't work. Building debug apparently |
| 112 | # requires hacking gcc-tools.jam |
| 113 | # |
| 114 | # Sometimes I wake up screaming. Famous figures are gathered in the nightmare, |
| 115 | # Steve Bourne, Larry Wall, the whole of the ANSI C committee. They're just |
| 116 | # standing there, waiting, but the truely terrifying thing is what they carry |
| 117 | # in their hands. At first sight each seems to bear the same thing, but it is |
| 118 | # not so for the forms in their grasp are ever so slightly different one from |
| 119 | # the other. Each is twisted in some grotesque way from the other to make each |
| 120 | # an unspeakable perversion impossible to perceive without the onset of madness. |
| 121 | # True insanity awaits anyone who perceives all of these horrors together. |
| 122 | # |
| 123 | # Quotation marks, there might be an easier way to do this, but I can't find |
| 124 | # it. The problem is that the user.hpp configuration file must receive a |
| 125 | # pre-processor macro defined as the appropriate string - complete with "'s |
| 126 | # around it. (<> is a possibility here but the danger to that is that the |
| 127 | # failure case interprets the < and > as shell redirections, creating |
| 128 | # random files in the source tree.) |
| 129 | # |
| 130 | #bjam: '-DBOOST_PLATFORM_CONFIG=\"config\"' |
| 131 | #do_compile: '-sGCC=... '"'-DBOOST_PLATFORM_CONFIG=\"config\"'" |
| 132 | SQD = '"' |
| 133 | EQD = '\"' |
| 134 | #boost.bb: "... '-sGCC=... '${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}config${EQD}'${SQD} ..." |
| 135 | BJAM_CONF = "${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}boost/config/platform/${TARGET_OS}.hpp${EQD}'${SQD}" |
| 136 | |
| 137 | BJAM_TOOLS = "--ignore-site-config \ |
| 138 | '-sTOOLS=gcc' \ |
| 139 | '-sGCC=${CC} '${BJAM_CONF} \ |
| 140 | '-sGXX=${CXX} '${BJAM_CONF} \ |
| 141 | '-sGCC_INCLUDE_DIRECTORY=${STAGING_INCDIR}' \ |
| 142 | '-sGCC_STDLIB_DIRECTORY=${STAGING_LIBDIR}' \ |
| 143 | '-sBUILD=release <optimization>space <threading>multi <inlining>on <debug-symbols>off' \ |
| 144 | '-sPYTHON_ROOT=${PYTHON_ROOT}' \ |
| 145 | '--layout=system' \ |
| 146 | " |
| 147 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 148 | # use PARALLEL_MAKE to speed up the build |
| 149 | BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_argument(d, '-j%d')}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 150 | BJAM_OPTS = '${BOOST_PARALLEL_MAKE} -d+2 -q \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 151 | ${BJAM_TOOLS} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 152 | -sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \ |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 153 | --build-dir=${B} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 154 | --disable-icu \ |
| 155 | ${BJAM_EXTRA}' |
| 156 | |
| 157 | # Native compilation of bzip2 isn't working |
| 158 | BJAM_OPTS_append_class-native = ' -sNO_BZIP2=1' |
| 159 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 160 | # Adjust the build for x32 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 161 | BJAM_OPTS_append_x86-x32 = " abi=x32 address-model=64" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 162 | |
Vernon Mauery | 0d70daf | 2018-09-25 14:17:59 -0700 | [diff] [blame] | 163 | # cross compiling for arm fails to detect abi, so provide some help |
| 164 | BJAM_OPTS_append_arm = " abi=aapcs architecture=arm" |
Brad Bishop | 08902b0 | 2019-08-20 09:16:51 -0400 | [diff] [blame] | 165 | BJAM_OPTS_append_aarch64 = " abi=aapcs address-model=64 architecture=arm" |
Vernon Mauery | 0d70daf | 2018-09-25 14:17:59 -0700 | [diff] [blame] | 166 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 167 | do_configure() { |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 168 | cd ${S} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 169 | cp -f ${S}/boost/config/platform/linux.hpp ${S}/boost/config/platform/linux-gnueabi.hpp |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 170 | |
| 171 | # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 172 | rm -f ${WORKDIR}/user-config.jam |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 173 | echo 'using gcc : : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 174 | |
| 175 | # If we want Python then we need to tell Boost *exactly* where to find it |
| 176 | if ${@bb.utils.contains('BOOST_LIBS', 'python', 'true', 'false', d)}; then |
| 177 | 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 |
| 178 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 179 | |
| 180 | if ${@bb.utils.contains('BOOST_LIBS', 'mpi', 'true', 'false', d)}; then |
| 181 | echo "using mpi : : <find-shared-library>mpi ;" >> ${WORKDIR}/user-config.jam |
| 182 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 183 | |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 184 | CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=b2 --with-toolset=gcc |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 185 | |
| 186 | # Boost can't be trusted to find Python on it's own, so remove any mention |
| 187 | # of it from the boost configuration |
| 188 | sed -i '/using python/d' ${S}/project-config.jam |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 189 | } |
| 190 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 191 | do_compile() { |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 192 | cd ${S} |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 193 | b2 ${BJAM_OPTS} \ |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 194 | --prefix=${prefix} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 195 | --exec-prefix=${exec_prefix} \ |
| 196 | --libdir=${libdir} \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 197 | --includedir=${includedir} \ |
| 198 | --debug-configuration |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | do_install() { |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 202 | cd ${S} |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 203 | b2 ${BJAM_OPTS} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 204 | --libdir=${D}${libdir} \ |
| 205 | --includedir=${D}${includedir} \ |
| 206 | install |
| 207 | for lib in ${BOOST_LIBS}; do |
| 208 | if [ -e ${D}${libdir}/libboost_${lib}.a ]; then |
| 209 | ln -s libboost_${lib}.a ${D}${libdir}/libboost_${lib}-mt.a |
| 210 | fi |
| 211 | if [ -e ${D}${libdir}/libboost_${lib}.so ]; then |
| 212 | ln -s libboost_${lib}.so ${D}${libdir}/libboost_${lib}-mt.so |
| 213 | fi |
| 214 | done |
| 215 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 216 | # Cmake files reference full paths to image |
| 217 | find ${D}${libdir}/cmake -type f | \ |
| 218 | grep 'cmake$' | \ |
| 219 | xargs -n 1 sed -e 's,${D}${libdir}/cmake,${libdir}/cmake,' -i |
| 220 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | BBCLASSEXTEND = "native nativesdk" |