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 |
| 41 | PACKAGECONFIG ??= "locale" |
| 42 | PACKAGECONFIG[locale] = ",,icu" |
| 43 | PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich" |
| 44 | PACKAGECONFIG[mpi] = ",,mpich" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | PACKAGECONFIG[python] = ",,python python3" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 46 | |
| 47 | BOOST_LIBS += "\ |
| 48 | ${@bb.utils.contains('PACKAGECONFIG', 'locale', 'locale', '', d)} \ |
| 49 | ${@bb.utils.contains('PACKAGECONFIG', 'graph_parallel', 'graph_parallel mpi', \ |
| 50 | bb.utils.contains('PACKAGECONFIG', 'mpi', 'mpi', '', d), d)} \ |
| 51 | ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python python3', '', d)} \ |
| 52 | " |
| 53 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 54 | inherit python-dir |
| 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 = [] |
| 62 | for lib in d.getVar('BOOST_LIBS', True).split( ): |
| 63 | # BJAM does not know '--with-python3' (only --with-python) |
| 64 | if lib != "python3": |
| 65 | extras.append("--with-%s" % lib) |
| 66 | pkg = "boost-%s" % lib.replace("_", "-") |
| 67 | packages.append(pkg) |
| 68 | if lib == "python": |
| 69 | # special: python*.so matches python3.so !! |
| 70 | if not d.getVar("FILES_%s" % pkg, True): |
| 71 | d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s.so.*" % lib) |
| 72 | else: |
| 73 | if not d.getVar("FILES_%s" % pkg, True): |
| 74 | d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s*.so.*" % lib) |
| 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 = "${libdir}/libboost_graph.so.*" |
| 81 | FILES_${PN}-graph_parallel = "${libdir}/libboost_graph_parallel.so.*" |
| 82 | FILES_${PN}-locale = "${libdir}/libboost_locale.so.*" |
| 83 | FILES_${PN}-mpi = "${libdir}/mpi.so ${libdir}/libboost_mpi*.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 84 | FILES_boost-serialization = "${libdir}/libboost_serialization*.so.* \ |
| 85 | ${libdir}/libboost_wserialization*.so.*" |
| 86 | FILES_boost-test = "${libdir}/libboost_prg_exec_monitor*.so.* \ |
| 87 | ${libdir}/libboost_unit_test_framework*.so.*" |
| 88 | |
| 89 | # -dev last to pick up the remaining stuff |
| 90 | PACKAGES += "${PN}-dev ${PN}-staticdev" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 91 | FILES_${PN} = "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 92 | FILES_${PN}-dev = "${includedir} ${libdir}/libboost_*.so" |
| 93 | FILES_${PN}-staticdev = "${libdir}/libboost_*.a" |
| 94 | |
| 95 | # "boost" is a metapackage which pulls in all boost librabries |
| 96 | PACKAGES += "${PN}" |
| 97 | RRECOMMENDS_${PN} += "${BOOST_PACKAGES}" |
| 98 | RRECOMMENDS_${PN}_class-native = "" |
| 99 | ALLOW_EMPTY_${PN} = "1" |
| 100 | |
| 101 | # to avoid GNU_HASH QA errors added LDFLAGS to ARCH; a little bit dirty but at least it works |
| 102 | TARGET_CC_ARCH += "${LDFLAGS}" |
| 103 | |
| 104 | # Oh yippee, a new build system, it's sooo cooool I could eat my own |
| 105 | # foot. inlining=on lets the compiler choose, I think. At least this |
| 106 | # stuff is documented... |
| 107 | # NOTE: if you leave <debug-symbols>on then in a debug build the build sys |
| 108 | # objcopy will be invoked, and that won't work. Building debug apparently |
| 109 | # requires hacking gcc-tools.jam |
| 110 | # |
| 111 | # Sometimes I wake up screaming. Famous figures are gathered in the nightmare, |
| 112 | # Steve Bourne, Larry Wall, the whole of the ANSI C committee. They're just |
| 113 | # standing there, waiting, but the truely terrifying thing is what they carry |
| 114 | # in their hands. At first sight each seems to bear the same thing, but it is |
| 115 | # not so for the forms in their grasp are ever so slightly different one from |
| 116 | # the other. Each is twisted in some grotesque way from the other to make each |
| 117 | # an unspeakable perversion impossible to perceive without the onset of madness. |
| 118 | # True insanity awaits anyone who perceives all of these horrors together. |
| 119 | # |
| 120 | # Quotation marks, there might be an easier way to do this, but I can't find |
| 121 | # it. The problem is that the user.hpp configuration file must receive a |
| 122 | # pre-processor macro defined as the appropriate string - complete with "'s |
| 123 | # around it. (<> is a possibility here but the danger to that is that the |
| 124 | # failure case interprets the < and > as shell redirections, creating |
| 125 | # random files in the source tree.) |
| 126 | # |
| 127 | #bjam: '-DBOOST_PLATFORM_CONFIG=\"config\"' |
| 128 | #do_compile: '-sGCC=... '"'-DBOOST_PLATFORM_CONFIG=\"config\"'" |
| 129 | SQD = '"' |
| 130 | EQD = '\"' |
| 131 | #boost.bb: "... '-sGCC=... '${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}config${EQD}'${SQD} ..." |
| 132 | BJAM_CONF = "${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}boost/config/platform/${TARGET_OS}.hpp${EQD}'${SQD}" |
| 133 | |
| 134 | BJAM_TOOLS = "--ignore-site-config \ |
| 135 | '-sTOOLS=gcc' \ |
| 136 | '-sGCC=${CC} '${BJAM_CONF} \ |
| 137 | '-sGXX=${CXX} '${BJAM_CONF} \ |
| 138 | '-sGCC_INCLUDE_DIRECTORY=${STAGING_INCDIR}' \ |
| 139 | '-sGCC_STDLIB_DIRECTORY=${STAGING_LIBDIR}' \ |
| 140 | '-sBUILD=release <optimization>space <threading>multi <inlining>on <debug-symbols>off' \ |
| 141 | '-sPYTHON_ROOT=${PYTHON_ROOT}' \ |
| 142 | '--layout=system' \ |
| 143 | " |
| 144 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 145 | # 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] | 146 | # https://svn.boost.org/trac/boost/ticket/7634 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 147 | def get_boost_parallel_make(d): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 148 | pm = d.getVar('PARALLEL_MAKE', True) |
| 149 | if pm: |
| 150 | # look for '-j' and throw other options (e.g. '-l') away |
| 151 | # because they might have different meaning in bjam |
| 152 | pm = pm.split() |
| 153 | while pm: |
| 154 | v = None |
| 155 | opt = pm.pop(0) |
| 156 | if opt == '-j': |
| 157 | v = pm.pop(0) |
| 158 | elif opt.startswith('-j'): |
| 159 | v = opt[2:].strip() |
| 160 | else: |
| 161 | v = None |
| 162 | |
| 163 | if v: |
| 164 | v = min(64, int(v)) |
| 165 | return '-j' + str(v) |
| 166 | |
| 167 | return "" |
| 168 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 169 | BOOST_PARALLEL_MAKE = "${@get_boost_parallel_make(d)}" |
| 170 | BJAM_OPTS = '${BOOST_PARALLEL_MAKE} -d+2 -q \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 171 | ${BJAM_TOOLS} \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 172 | -sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 173 | --build-dir=${S}/${TARGET_SYS} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 174 | --disable-icu \ |
| 175 | ${BJAM_EXTRA}' |
| 176 | |
| 177 | # Native compilation of bzip2 isn't working |
| 178 | BJAM_OPTS_append_class-native = ' -sNO_BZIP2=1' |
| 179 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 180 | do_configure() { |
| 181 | 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] | 182 | |
| 183 | # 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] | 184 | rm -f ${WORKDIR}/user-config.jam |
| 185 | echo 'using gcc : 4.3.1 : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam |
| 186 | echo "using python : ${PYTHON_BASEVERSION} : : ${STAGING_INCDIR}/python${PYTHON_BASEVERSION} ;" >> ${WORKDIR}/user-config.jam |
| 187 | echo "using python : 3.5 : : ${STAGING_INCDIR}/python3.5m ;" >> ${WORKDIR}/user-config.jam |
| 188 | |
| 189 | if ${@bb.utils.contains('BOOST_LIBS', 'mpi', 'true', 'false', d)}; then |
| 190 | echo "using mpi : : <find-shared-library>mpi ;" >> ${WORKDIR}/user-config.jam |
| 191 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 192 | |
| 193 | CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc --with-python-root=${PYTHON_ROOT} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 194 | sed -i '/^using python/d' ${S}/project-config.jam |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 195 | } |
| 196 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 197 | do_compile() { |
| 198 | set -ex |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 199 | rm -rf ${S}/${TARGET_SYS} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 200 | bjam ${BJAM_OPTS} --prefix=${prefix} \ |
| 201 | --exec-prefix=${exec_prefix} \ |
| 202 | --libdir=${libdir} \ |
| 203 | --includedir=${includedir} |
| 204 | } |
| 205 | |
| 206 | do_install() { |
| 207 | set -ex |
| 208 | bjam ${BJAM_OPTS} \ |
| 209 | --libdir=${D}${libdir} \ |
| 210 | --includedir=${D}${includedir} \ |
| 211 | install |
| 212 | for lib in ${BOOST_LIBS}; do |
| 213 | if [ -e ${D}${libdir}/libboost_${lib}.a ]; then |
| 214 | ln -s libboost_${lib}.a ${D}${libdir}/libboost_${lib}-mt.a |
| 215 | fi |
| 216 | if [ -e ${D}${libdir}/libboost_${lib}.so ]; then |
| 217 | ln -s libboost_${lib}.so ${D}${libdir}/libboost_${lib}-mt.so |
| 218 | fi |
| 219 | done |
| 220 | |
| 221 | } |
| 222 | |
| 223 | BBCLASSEXTEND = "native nativesdk" |