blob: 9be3717fd65ef1ffc92bc885de0ee7932a7a626b [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Free peer-reviewed portable C++ source libraries"
2SECTION = "libs"
3DEPENDS = "bjam-native zlib bzip2"
4
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05005ARM_INSTRUCTION_SET_armv4 = "arm"
6ARM_INSTRUCTION_SET_armv5 = "arm"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007
8BOOST_LIBS = "\
9 atomic \
10 chrono \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060011 container \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080012 contract \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013 date_time \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060014 exception \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015 filesystem \
16 graph \
17 iostreams \
18 log \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060019 math \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020 program_options \
21 random \
22 regex \
23 serialization \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024 system \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050025 timer \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026 test \
27 thread \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060028 wave \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029 "
30
Patrick Williamsc0f7c042017-02-23 20:41:17 -060031# only supported by x86 and powerpc
32BOOST_LIBS_append_x86 = " context coroutine"
33BOOST_LIBS_append_x86-64 = " context coroutine"
34BOOST_LIBS_append_powerpc = " context coroutine"
Vernon Mauery0d70daf2018-09-25 14:17:59 -070035BOOST_LIBS_append_arm = " context coroutine"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060036# need consistent settings for native builds (x86 override not applied for native)
37BOOST_LIBS_remove_class-native = " context coroutine"
Brad Bishop37a0e4d2017-12-04 01:01:44 -050038# does not compile
39BOOST_LIBS_remove_mips16e = "wave"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060040
41# optional libraries
Brad Bishopd7bf8c12018-02-25 22:55:05 -050042PACKAGECONFIG ??= "locale python"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060043PACKAGECONFIG[locale] = ",,icu"
44PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
45PACKAGECONFIG[mpi] = ",,mpich"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050046PACKAGECONFIG[python] = ",,python3"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060047
48BOOST_LIBS += "\
Brad Bishop6e60e8b2018-02-01 10:27:11 -050049 ${@bb.utils.filter('PACKAGECONFIG', 'locale python', d)} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060050 ${@bb.utils.contains('PACKAGECONFIG', 'graph_parallel', 'graph_parallel mpi', \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050051 bb.utils.filter('PACKAGECONFIG', 'mpi', d), d)} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060052"
53
Brad Bishop6e60e8b2018-02-01 10:27:11 -050054inherit python3-dir
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}"
56
57# Make a package for each library, plus -dev
58PACKAGES = "${PN}-dbg ${BOOST_PACKAGES}"
59python __anonymous () {
60 packages = []
61 extras = []
Brad Bishop6e60e8b2018-02-01 10:27:11 -050062 for lib in d.getVar('BOOST_LIBS').split():
63 extras.append("--with-%s" % lib)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064 pkg = "boost-%s" % lib.replace("_", "-")
65 packages.append(pkg)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050066 if not d.getVar("FILES_%s" % pkg):
67 d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s*.so.*" % lib)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068 d.setVar("BOOST_PACKAGES", " ".join(packages))
69 d.setVar("BJAM_EXTRA", " ".join(extras))
70}
71
72# Override the contents of specific packages
Patrick Williamsc0f7c042017-02-23 20:41:17 -060073FILES_${PN}-graph_parallel = "${libdir}/libboost_graph_parallel.so.*"
74FILES_${PN}-locale = "${libdir}/libboost_locale.so.*"
75FILES_${PN}-mpi = "${libdir}/mpi.so ${libdir}/libboost_mpi*.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050076FILES_boost-serialization = "${libdir}/libboost_serialization*.so.* \
77 ${libdir}/libboost_wserialization*.so.*"
78FILES_boost-test = "${libdir}/libboost_prg_exec_monitor*.so.* \
79 ${libdir}/libboost_unit_test_framework*.so.*"
80
81# -dev last to pick up the remaining stuff
82PACKAGES += "${PN}-dev ${PN}-staticdev"
83FILES_${PN}-dev = "${includedir} ${libdir}/libboost_*.so"
84FILES_${PN}-staticdev = "${libdir}/libboost_*.a"
85
86# "boost" is a metapackage which pulls in all boost librabries
87PACKAGES += "${PN}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050088FILES_${PN} = ""
89ALLOW_EMPTY_${PN} = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090RRECOMMENDS_${PN} += "${BOOST_PACKAGES}"
91RRECOMMENDS_${PN}_class-native = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092
93# to avoid GNU_HASH QA errors added LDFLAGS to ARCH; a little bit dirty but at least it works
94TARGET_CC_ARCH += "${LDFLAGS}"
95
96# Oh yippee, a new build system, it's sooo cooool I could eat my own
97# foot. inlining=on lets the compiler choose, I think. At least this
98# stuff is documented...
99# NOTE: if you leave <debug-symbols>on then in a debug build the build sys
100# objcopy will be invoked, and that won't work. Building debug apparently
101# requires hacking gcc-tools.jam
102#
103# Sometimes I wake up screaming. Famous figures are gathered in the nightmare,
104# Steve Bourne, Larry Wall, the whole of the ANSI C committee. They're just
105# standing there, waiting, but the truely terrifying thing is what they carry
106# in their hands. At first sight each seems to bear the same thing, but it is
107# not so for the forms in their grasp are ever so slightly different one from
108# the other. Each is twisted in some grotesque way from the other to make each
109# an unspeakable perversion impossible to perceive without the onset of madness.
110# True insanity awaits anyone who perceives all of these horrors together.
111#
112# Quotation marks, there might be an easier way to do this, but I can't find
113# it. The problem is that the user.hpp configuration file must receive a
114# pre-processor macro defined as the appropriate string - complete with "'s
115# around it. (<> is a possibility here but the danger to that is that the
116# failure case interprets the < and > as shell redirections, creating
117# random files in the source tree.)
118#
119#bjam: '-DBOOST_PLATFORM_CONFIG=\"config\"'
120#do_compile: '-sGCC=... '"'-DBOOST_PLATFORM_CONFIG=\"config\"'"
121SQD = '"'
122EQD = '\"'
123#boost.bb: "... '-sGCC=... '${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}config${EQD}'${SQD} ..."
124BJAM_CONF = "${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}boost/config/platform/${TARGET_OS}.hpp${EQD}'${SQD}"
125
126BJAM_TOOLS = "--ignore-site-config \
127 '-sTOOLS=gcc' \
128 '-sGCC=${CC} '${BJAM_CONF} \
129 '-sGXX=${CXX} '${BJAM_CONF} \
130 '-sGCC_INCLUDE_DIRECTORY=${STAGING_INCDIR}' \
131 '-sGCC_STDLIB_DIRECTORY=${STAGING_LIBDIR}' \
132 '-sBUILD=release <optimization>space <threading>multi <inlining>on <debug-symbols>off' \
133 '-sPYTHON_ROOT=${PYTHON_ROOT}' \
134 '--layout=system' \
135 "
136
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800137# use PARALLEL_MAKE to speed up the build
138BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_argument(d, '-j%d')}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500139BJAM_OPTS = '${BOOST_PARALLEL_MAKE} -d+2 -q \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500140 ${BJAM_TOOLS} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600141 -sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500142 --build-dir=${S}/${TARGET_SYS} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500143 --disable-icu \
144 ${BJAM_EXTRA}'
145
146# Native compilation of bzip2 isn't working
147BJAM_OPTS_append_class-native = ' -sNO_BZIP2=1'
148
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500149# Adjust the build for x32
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500150BJAM_OPTS_append_x86-x32 = " abi=x32 address-model=64"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500151
Vernon Mauery0d70daf2018-09-25 14:17:59 -0700152# cross compiling for arm fails to detect abi, so provide some help
153BJAM_OPTS_append_arm = " abi=aapcs architecture=arm"
154
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600155do_configure() {
156 cp -f ${S}/boost/config/platform/linux.hpp ${S}/boost/config/platform/linux-gnueabi.hpp
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500157
158 # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600159 rm -f ${WORKDIR}/user-config.jam
160 echo 'using gcc : 4.3.1 : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500161
162 # If we want Python then we need to tell Boost *exactly* where to find it
163 if ${@bb.utils.contains('BOOST_LIBS', 'python', 'true', 'false', d)}; then
164 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
165 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600166
167 if ${@bb.utils.contains('BOOST_LIBS', 'mpi', 'true', 'false', d)}; then
168 echo "using mpi : : <find-shared-library>mpi ;" >> ${WORKDIR}/user-config.jam
169 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500170
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500171 CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc
172
173 # Boost can't be trusted to find Python on it's own, so remove any mention
174 # of it from the boost configuration
175 sed -i '/using python/d' ${S}/project-config.jam
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500176}
177
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500178do_compile() {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600179 rm -rf ${S}/${TARGET_SYS}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500180 bjam ${BJAM_OPTS} --prefix=${prefix} \
181 --exec-prefix=${exec_prefix} \
182 --libdir=${libdir} \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500183 --includedir=${includedir} \
184 --debug-configuration
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500185}
186
187do_install() {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500188 bjam ${BJAM_OPTS} \
189 --libdir=${D}${libdir} \
190 --includedir=${D}${includedir} \
191 install
192 for lib in ${BOOST_LIBS}; do
193 if [ -e ${D}${libdir}/libboost_${lib}.a ]; then
194 ln -s libboost_${lib}.a ${D}${libdir}/libboost_${lib}-mt.a
195 fi
196 if [ -e ${D}${libdir}/libboost_${lib}.so ]; then
197 ln -s libboost_${lib}.so ${D}${libdir}/libboost_${lib}-mt.so
198 fi
199 done
200
201}
202
203BBCLASSEXTEND = "native nativesdk"