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