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