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