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 | |
| 5 | ARM_INSTRUCTION_SET = "arm" |
| 6 | |
| 7 | BOOST_LIBS = "\ |
| 8 | atomic \ |
| 9 | chrono \ |
| 10 | date_time \ |
| 11 | filesystem \ |
| 12 | graph \ |
| 13 | iostreams \ |
| 14 | log \ |
| 15 | program_options \ |
| 16 | random \ |
| 17 | regex \ |
| 18 | serialization \ |
| 19 | signals \ |
| 20 | system \ |
| 21 | test \ |
| 22 | thread \ |
| 23 | " |
| 24 | |
| 25 | # optional boost-python library |
| 26 | PACKAGECONFIG ??= "" |
| 27 | PACKAGECONFIG[python] = ",,python python3" |
| 28 | BOOST_LIBS += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python python3', '', d)}" |
| 29 | inherit python-dir |
| 30 | PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}" |
| 31 | |
| 32 | # Make a package for each library, plus -dev |
| 33 | PACKAGES = "${PN}-dbg ${BOOST_PACKAGES}" |
| 34 | python __anonymous () { |
| 35 | packages = [] |
| 36 | extras = [] |
| 37 | for lib in d.getVar('BOOST_LIBS', True).split( ): |
| 38 | # BJAM does not know '--with-python3' (only --with-python) |
| 39 | if lib != "python3": |
| 40 | extras.append("--with-%s" % lib) |
| 41 | pkg = "boost-%s" % lib.replace("_", "-") |
| 42 | packages.append(pkg) |
| 43 | if lib == "python": |
| 44 | # special: python*.so matches python3.so !! |
| 45 | if not d.getVar("FILES_%s" % pkg, True): |
| 46 | d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s.so.*" % lib) |
| 47 | else: |
| 48 | if not d.getVar("FILES_%s" % pkg, True): |
| 49 | d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s*.so.*" % lib) |
| 50 | d.setVar("BOOST_PACKAGES", " ".join(packages)) |
| 51 | d.setVar("BJAM_EXTRA", " ".join(extras)) |
| 52 | } |
| 53 | |
| 54 | # Override the contents of specific packages |
| 55 | FILES_boost-serialization = "${libdir}/libboost_serialization*.so.* \ |
| 56 | ${libdir}/libboost_wserialization*.so.*" |
| 57 | FILES_boost-test = "${libdir}/libboost_prg_exec_monitor*.so.* \ |
| 58 | ${libdir}/libboost_unit_test_framework*.so.*" |
| 59 | |
| 60 | # -dev last to pick up the remaining stuff |
| 61 | PACKAGES += "${PN}-dev ${PN}-staticdev" |
| 62 | FILES_${PN}-dev = "${includedir} ${libdir}/libboost_*.so" |
| 63 | FILES_${PN}-staticdev = "${libdir}/libboost_*.a" |
| 64 | |
| 65 | # "boost" is a metapackage which pulls in all boost librabries |
| 66 | PACKAGES += "${PN}" |
| 67 | RRECOMMENDS_${PN} += "${BOOST_PACKAGES}" |
| 68 | RRECOMMENDS_${PN}_class-native = "" |
| 69 | ALLOW_EMPTY_${PN} = "1" |
| 70 | |
| 71 | # to avoid GNU_HASH QA errors added LDFLAGS to ARCH; a little bit dirty but at least it works |
| 72 | TARGET_CC_ARCH += "${LDFLAGS}" |
| 73 | |
| 74 | # Oh yippee, a new build system, it's sooo cooool I could eat my own |
| 75 | # foot. inlining=on lets the compiler choose, I think. At least this |
| 76 | # stuff is documented... |
| 77 | # NOTE: if you leave <debug-symbols>on then in a debug build the build sys |
| 78 | # objcopy will be invoked, and that won't work. Building debug apparently |
| 79 | # requires hacking gcc-tools.jam |
| 80 | # |
| 81 | # Sometimes I wake up screaming. Famous figures are gathered in the nightmare, |
| 82 | # Steve Bourne, Larry Wall, the whole of the ANSI C committee. They're just |
| 83 | # standing there, waiting, but the truely terrifying thing is what they carry |
| 84 | # in their hands. At first sight each seems to bear the same thing, but it is |
| 85 | # not so for the forms in their grasp are ever so slightly different one from |
| 86 | # the other. Each is twisted in some grotesque way from the other to make each |
| 87 | # an unspeakable perversion impossible to perceive without the onset of madness. |
| 88 | # True insanity awaits anyone who perceives all of these horrors together. |
| 89 | # |
| 90 | # Quotation marks, there might be an easier way to do this, but I can't find |
| 91 | # it. The problem is that the user.hpp configuration file must receive a |
| 92 | # pre-processor macro defined as the appropriate string - complete with "'s |
| 93 | # around it. (<> is a possibility here but the danger to that is that the |
| 94 | # failure case interprets the < and > as shell redirections, creating |
| 95 | # random files in the source tree.) |
| 96 | # |
| 97 | #bjam: '-DBOOST_PLATFORM_CONFIG=\"config\"' |
| 98 | #do_compile: '-sGCC=... '"'-DBOOST_PLATFORM_CONFIG=\"config\"'" |
| 99 | SQD = '"' |
| 100 | EQD = '\"' |
| 101 | #boost.bb: "... '-sGCC=... '${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}config${EQD}'${SQD} ..." |
| 102 | BJAM_CONF = "${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}boost/config/platform/${TARGET_OS}.hpp${EQD}'${SQD}" |
| 103 | |
| 104 | BJAM_TOOLS = "--ignore-site-config \ |
| 105 | '-sTOOLS=gcc' \ |
| 106 | '-sGCC=${CC} '${BJAM_CONF} \ |
| 107 | '-sGXX=${CXX} '${BJAM_CONF} \ |
| 108 | '-sGCC_INCLUDE_DIRECTORY=${STAGING_INCDIR}' \ |
| 109 | '-sGCC_STDLIB_DIRECTORY=${STAGING_LIBDIR}' \ |
| 110 | '-sBUILD=release <optimization>space <threading>multi <inlining>on <debug-symbols>off' \ |
| 111 | '-sPYTHON_ROOT=${PYTHON_ROOT}' \ |
| 112 | '--layout=system' \ |
| 113 | " |
| 114 | |
| 115 | # use PARALLEL_MAKE to speed up the build, but limit it by -j 64, greater paralelism causes bjam to segfault or to ignore -j |
| 116 | # https://svn.boost.org/trac/boost/ticket/7634 |
| 117 | def get_boost_parallel_make(bb, d): |
| 118 | pm = d.getVar('PARALLEL_MAKE', True) |
| 119 | if pm: |
| 120 | # look for '-j' and throw other options (e.g. '-l') away |
| 121 | # because they might have different meaning in bjam |
| 122 | pm = pm.split() |
| 123 | while pm: |
| 124 | v = None |
| 125 | opt = pm.pop(0) |
| 126 | if opt == '-j': |
| 127 | v = pm.pop(0) |
| 128 | elif opt.startswith('-j'): |
| 129 | v = opt[2:].strip() |
| 130 | else: |
| 131 | v = None |
| 132 | |
| 133 | if v: |
| 134 | v = min(64, int(v)) |
| 135 | return '-j' + str(v) |
| 136 | |
| 137 | return "" |
| 138 | |
| 139 | BOOST_PARALLEL_MAKE = "${@get_boost_parallel_make(bb, d)}" |
| 140 | BJAM_OPTS = '${BOOST_PARALLEL_MAKE} \ |
| 141 | ${BJAM_TOOLS} \ |
| 142 | -sBOOST_BUILD_USER_CONFIG=${S}/tools/build/example/user-config.jam \ |
| 143 | --builddir=${S}/${TARGET_SYS} \ |
| 144 | --disable-icu \ |
| 145 | ${BJAM_EXTRA}' |
| 146 | |
| 147 | # Native compilation of bzip2 isn't working |
| 148 | BJAM_OPTS_append_class-native = ' -sNO_BZIP2=1' |
| 149 | |
| 150 | do_boostconfig() { |
| 151 | cp -f boost/config/platform/linux.hpp boost/config/platform/linux-gnueabi.hpp |
| 152 | |
| 153 | # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation. |
| 154 | sed -i "/^using gcc : 4.3.1/d" ${S}/tools/build/example/user-config.jam |
| 155 | sed -i "/^using python : ${PYTHON_BASEVERSION}"/d ${S}/tools/build/example/user-config.jam |
| 156 | echo 'using gcc : 4.3.1 : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${S}/tools/build/example/user-config.jam |
| 157 | echo "using python : ${PYTHON_BASEVERSION} : : ${STAGING_INCDIR}/python${PYTHON_BASEVERSION} ;" >> ${S}/tools/build/example/user-config.jam |
| 158 | echo "using python : 3.4 : : ${STAGING_INCDIR}/python3.4m ;" >> ${S}/tools/build/example/user-config.jam |
| 159 | |
| 160 | CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc --with-python-root=${PYTHON_ROOT} |
| 161 | sed -i '/^using python/d' project-config.jam |
| 162 | } |
| 163 | |
| 164 | do_boostconfig[dirs] = "${S}" |
| 165 | addtask do_boostconfig after do_patch before do_configure |
| 166 | |
| 167 | do_compile() { |
| 168 | set -ex |
| 169 | bjam ${BJAM_OPTS} --prefix=${prefix} \ |
| 170 | --exec-prefix=${exec_prefix} \ |
| 171 | --libdir=${libdir} \ |
| 172 | --includedir=${includedir} |
| 173 | } |
| 174 | |
| 175 | do_install() { |
| 176 | set -ex |
| 177 | bjam ${BJAM_OPTS} \ |
| 178 | --libdir=${D}${libdir} \ |
| 179 | --includedir=${D}${includedir} \ |
| 180 | install |
| 181 | for lib in ${BOOST_LIBS}; do |
| 182 | if [ -e ${D}${libdir}/libboost_${lib}.a ]; then |
| 183 | ln -s libboost_${lib}.a ${D}${libdir}/libboost_${lib}-mt.a |
| 184 | fi |
| 185 | if [ -e ${D}${libdir}/libboost_${lib}.so ]; then |
| 186 | ln -s libboost_${lib}.so ${D}${libdir}/libboost_${lib}-mt.so |
| 187 | fi |
| 188 | done |
| 189 | |
| 190 | } |
| 191 | |
| 192 | BBCLASSEXTEND = "native nativesdk" |