blob: 0330202586ff64b23eaeee961119058dee0d2b6b [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
Brad Bishop96ff1982019-08-19 13:50:42 -04005CVE_PRODUCT = "boost:boost"
6
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05007ARM_INSTRUCTION_SET_armv4 = "arm"
8ARM_INSTRUCTION_SET_armv5 = "arm"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05009
10BOOST_LIBS = "\
11 atomic \
12 chrono \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060013 container \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080014 contract \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015 date_time \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060016 exception \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017 filesystem \
18 graph \
19 iostreams \
20 log \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060021 math \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022 program_options \
23 random \
24 regex \
25 serialization \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026 system \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050027 timer \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 test \
29 thread \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060030 wave \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031 "
32
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033# only supported by x86 and powerpc
34BOOST_LIBS_append_x86 = " context coroutine"
35BOOST_LIBS_append_x86-64 = " context coroutine"
36BOOST_LIBS_append_powerpc = " context coroutine"
Vernon Mauery0d70daf2018-09-25 14:17:59 -070037BOOST_LIBS_append_arm = " context coroutine"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060038# need consistent settings for native builds (x86 override not applied for native)
39BOOST_LIBS_remove_class-native = " context coroutine"
Brad Bishop37a0e4d2017-12-04 01:01:44 -050040# does not compile
41BOOST_LIBS_remove_mips16e = "wave"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060042
43# optional libraries
Brad Bishopd7bf8c12018-02-25 22:55:05 -050044PACKAGECONFIG ??= "locale python"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060045PACKAGECONFIG[locale] = ",,icu"
46PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
47PACKAGECONFIG[mpi] = ",,mpich"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050048PACKAGECONFIG[python] = ",,python3"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060049
50BOOST_LIBS += "\
Brad Bishop6e60e8b2018-02-01 10:27:11 -050051 ${@bb.utils.filter('PACKAGECONFIG', 'locale python', d)} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060052 ${@bb.utils.contains('PACKAGECONFIG', 'graph_parallel', 'graph_parallel mpi', \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050053 bb.utils.filter('PACKAGECONFIG', 'mpi', d), d)} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060054"
55
Brad Bishop6e60e8b2018-02-01 10:27:11 -050056inherit python3-dir
Patrick Williamsc124f4f2015-09-15 14:41:29 -050057PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}"
58
59# Make a package for each library, plus -dev
60PACKAGES = "${PN}-dbg ${BOOST_PACKAGES}"
61python __anonymous () {
62 packages = []
63 extras = []
Brad Bishop6e60e8b2018-02-01 10:27:11 -050064 for lib in d.getVar('BOOST_LIBS').split():
65 extras.append("--with-%s" % lib)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050066 pkg = "boost-%s" % lib.replace("_", "-")
67 packages.append(pkg)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050068 if not d.getVar("FILES_%s" % pkg):
69 d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s*.so.*" % lib)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070 d.setVar("BOOST_PACKAGES", " ".join(packages))
71 d.setVar("BJAM_EXTRA", " ".join(extras))
72}
73
74# Override the contents of specific packages
Patrick Williamsc0f7c042017-02-23 20:41:17 -060075FILES_${PN}-graph_parallel = "${libdir}/libboost_graph_parallel.so.*"
76FILES_${PN}-locale = "${libdir}/libboost_locale.so.*"
77FILES_${PN}-mpi = "${libdir}/mpi.so ${libdir}/libboost_mpi*.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078FILES_boost-serialization = "${libdir}/libboost_serialization*.so.* \
79 ${libdir}/libboost_wserialization*.so.*"
80FILES_boost-test = "${libdir}/libboost_prg_exec_monitor*.so.* \
81 ${libdir}/libboost_unit_test_framework*.so.*"
82
83# -dev last to pick up the remaining stuff
84PACKAGES += "${PN}-dev ${PN}-staticdev"
85FILES_${PN}-dev = "${includedir} ${libdir}/libboost_*.so"
86FILES_${PN}-staticdev = "${libdir}/libboost_*.a"
87
88# "boost" is a metapackage which pulls in all boost librabries
89PACKAGES += "${PN}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050090FILES_${PN} = ""
91ALLOW_EMPTY_${PN} = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092RRECOMMENDS_${PN} += "${BOOST_PACKAGES}"
93RRECOMMENDS_${PN}_class-native = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094
95# to avoid GNU_HASH QA errors added LDFLAGS to ARCH; a little bit dirty but at least it works
96TARGET_CC_ARCH += "${LDFLAGS}"
97
98# Oh yippee, a new build system, it's sooo cooool I could eat my own
99# foot. inlining=on lets the compiler choose, I think. At least this
100# stuff is documented...
101# NOTE: if you leave <debug-symbols>on then in a debug build the build sys
102# objcopy will be invoked, and that won't work. Building debug apparently
103# requires hacking gcc-tools.jam
104#
105# Sometimes I wake up screaming. Famous figures are gathered in the nightmare,
106# Steve Bourne, Larry Wall, the whole of the ANSI C committee. They're just
107# standing there, waiting, but the truely terrifying thing is what they carry
108# in their hands. At first sight each seems to bear the same thing, but it is
109# not so for the forms in their grasp are ever so slightly different one from
110# the other. Each is twisted in some grotesque way from the other to make each
111# an unspeakable perversion impossible to perceive without the onset of madness.
112# True insanity awaits anyone who perceives all of these horrors together.
113#
114# Quotation marks, there might be an easier way to do this, but I can't find
115# it. The problem is that the user.hpp configuration file must receive a
116# pre-processor macro defined as the appropriate string - complete with "'s
117# around it. (<> is a possibility here but the danger to that is that the
118# failure case interprets the < and > as shell redirections, creating
119# random files in the source tree.)
120#
121#bjam: '-DBOOST_PLATFORM_CONFIG=\"config\"'
122#do_compile: '-sGCC=... '"'-DBOOST_PLATFORM_CONFIG=\"config\"'"
123SQD = '"'
124EQD = '\"'
125#boost.bb: "... '-sGCC=... '${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}config${EQD}'${SQD} ..."
126BJAM_CONF = "${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}boost/config/platform/${TARGET_OS}.hpp${EQD}'${SQD}"
127
128BJAM_TOOLS = "--ignore-site-config \
129 '-sTOOLS=gcc' \
130 '-sGCC=${CC} '${BJAM_CONF} \
131 '-sGXX=${CXX} '${BJAM_CONF} \
132 '-sGCC_INCLUDE_DIRECTORY=${STAGING_INCDIR}' \
133 '-sGCC_STDLIB_DIRECTORY=${STAGING_LIBDIR}' \
134 '-sBUILD=release <optimization>space <threading>multi <inlining>on <debug-symbols>off' \
135 '-sPYTHON_ROOT=${PYTHON_ROOT}' \
136 '--layout=system' \
137 "
138
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800139# use PARALLEL_MAKE to speed up the build
140BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_argument(d, '-j%d')}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500141BJAM_OPTS = '${BOOST_PARALLEL_MAKE} -d+2 -q \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500142 ${BJAM_TOOLS} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600143 -sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500144 --build-dir=${S}/${TARGET_SYS} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500145 --disable-icu \
146 ${BJAM_EXTRA}'
147
148# Native compilation of bzip2 isn't working
149BJAM_OPTS_append_class-native = ' -sNO_BZIP2=1'
150
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500151# Adjust the build for x32
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500152BJAM_OPTS_append_x86-x32 = " abi=x32 address-model=64"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500153
Vernon Mauery0d70daf2018-09-25 14:17:59 -0700154# cross compiling for arm fails to detect abi, so provide some help
155BJAM_OPTS_append_arm = " abi=aapcs architecture=arm"
156
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600157do_configure() {
158 cp -f ${S}/boost/config/platform/linux.hpp ${S}/boost/config/platform/linux-gnueabi.hpp
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500159
160 # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600161 rm -f ${WORKDIR}/user-config.jam
162 echo 'using gcc : 4.3.1 : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500163
164 # If we want Python then we need to tell Boost *exactly* where to find it
165 if ${@bb.utils.contains('BOOST_LIBS', 'python', 'true', 'false', d)}; then
166 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
167 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600168
169 if ${@bb.utils.contains('BOOST_LIBS', 'mpi', 'true', 'false', d)}; then
170 echo "using mpi : : <find-shared-library>mpi ;" >> ${WORKDIR}/user-config.jam
171 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500172
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500173 CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc
174
175 # Boost can't be trusted to find Python on it's own, so remove any mention
176 # of it from the boost configuration
177 sed -i '/using python/d' ${S}/project-config.jam
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500178}
179
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500180do_compile() {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600181 rm -rf ${S}/${TARGET_SYS}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500182 bjam ${BJAM_OPTS} --prefix=${prefix} \
183 --exec-prefix=${exec_prefix} \
184 --libdir=${libdir} \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500185 --includedir=${includedir} \
186 --debug-configuration
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500187}
188
189do_install() {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500190 bjam ${BJAM_OPTS} \
191 --libdir=${D}${libdir} \
192 --includedir=${D}${includedir} \
193 install
194 for lib in ${BOOST_LIBS}; do
195 if [ -e ${D}${libdir}/libboost_${lib}.a ]; then
196 ln -s libboost_${lib}.a ${D}${libdir}/libboost_${lib}-mt.a
197 fi
198 if [ -e ${D}${libdir}/libboost_${lib}.so ]; then
199 ln -s libboost_${lib}.so ${D}${libdir}/libboost_${lib}-mt.so
200 fi
201 done
202
203}
204
205BBCLASSEXTEND = "native nativesdk"