blob: c4faea211f0986836d8e9204ee0ed52dcfcf21cf [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 \
24 signals \
25 system \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050026 timer \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027 test \
28 thread \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060029 wave \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030 "
31
Patrick Williamsc0f7c042017-02-23 20:41:17 -060032# only supported by x86 and powerpc
33BOOST_LIBS_append_x86 = " context coroutine"
34BOOST_LIBS_append_x86-64 = " context coroutine"
35BOOST_LIBS_append_powerpc = " context coroutine"
Vernon Mauery0d70daf2018-09-25 14:17:59 -070036BOOST_LIBS_append_arm = " context coroutine"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060037# need consistent settings for native builds (x86 override not applied for native)
38BOOST_LIBS_remove_class-native = " context coroutine"
Brad Bishop37a0e4d2017-12-04 01:01:44 -050039# does not compile
40BOOST_LIBS_remove_mips16e = "wave"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060041
42# optional libraries
Brad Bishopd7bf8c12018-02-25 22:55:05 -050043PACKAGECONFIG ??= "locale python"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060044PACKAGECONFIG[locale] = ",,icu"
45PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
46PACKAGECONFIG[mpi] = ",,mpich"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050047PACKAGECONFIG[python] = ",,python3"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060048
49BOOST_LIBS += "\
Brad Bishop6e60e8b2018-02-01 10:27:11 -050050 ${@bb.utils.filter('PACKAGECONFIG', 'locale python', d)} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060051 ${@bb.utils.contains('PACKAGECONFIG', 'graph_parallel', 'graph_parallel mpi', \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050052 bb.utils.filter('PACKAGECONFIG', 'mpi', d), d)} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060053"
54
Brad Bishop6e60e8b2018-02-01 10:27:11 -050055inherit python3-dir
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056PYTHON_ROOT = "${STAGING_DIR_HOST}/${prefix}"
57
58# Make a package for each library, plus -dev
59PACKAGES = "${PN}-dbg ${BOOST_PACKAGES}"
60python __anonymous () {
61 packages = []
62 extras = []
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063 for lib in d.getVar('BOOST_LIBS').split():
64 extras.append("--with-%s" % lib)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050065 pkg = "boost-%s" % lib.replace("_", "-")
66 packages.append(pkg)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050067 if not d.getVar("FILES_%s" % pkg):
68 d.setVar("FILES_%s" % pkg, "${libdir}/libboost_%s*.so.*" % lib)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069 d.setVar("BOOST_PACKAGES", " ".join(packages))
70 d.setVar("BJAM_EXTRA", " ".join(extras))
71}
72
73# Override the contents of specific packages
Patrick Williamsc0f7c042017-02-23 20:41:17 -060074FILES_${PN}-graph_parallel = "${libdir}/libboost_graph_parallel.so.*"
75FILES_${PN}-locale = "${libdir}/libboost_locale.so.*"
76FILES_${PN}-mpi = "${libdir}/mpi.so ${libdir}/libboost_mpi*.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077FILES_boost-serialization = "${libdir}/libboost_serialization*.so.* \
78 ${libdir}/libboost_wserialization*.so.*"
79FILES_boost-test = "${libdir}/libboost_prg_exec_monitor*.so.* \
80 ${libdir}/libboost_unit_test_framework*.so.*"
81
82# -dev last to pick up the remaining stuff
83PACKAGES += "${PN}-dev ${PN}-staticdev"
84FILES_${PN}-dev = "${includedir} ${libdir}/libboost_*.so"
85FILES_${PN}-staticdev = "${libdir}/libboost_*.a"
86
87# "boost" is a metapackage which pulls in all boost librabries
88PACKAGES += "${PN}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050089FILES_${PN} = ""
90ALLOW_EMPTY_${PN} = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091RRECOMMENDS_${PN} += "${BOOST_PACKAGES}"
92RRECOMMENDS_${PN}_class-native = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050093
94# to avoid GNU_HASH QA errors added LDFLAGS to ARCH; a little bit dirty but at least it works
95TARGET_CC_ARCH += "${LDFLAGS}"
96
97# Oh yippee, a new build system, it's sooo cooool I could eat my own
98# foot. inlining=on lets the compiler choose, I think. At least this
99# stuff is documented...
100# NOTE: if you leave <debug-symbols>on then in a debug build the build sys
101# objcopy will be invoked, and that won't work. Building debug apparently
102# requires hacking gcc-tools.jam
103#
104# Sometimes I wake up screaming. Famous figures are gathered in the nightmare,
105# Steve Bourne, Larry Wall, the whole of the ANSI C committee. They're just
106# standing there, waiting, but the truely terrifying thing is what they carry
107# in their hands. At first sight each seems to bear the same thing, but it is
108# not so for the forms in their grasp are ever so slightly different one from
109# the other. Each is twisted in some grotesque way from the other to make each
110# an unspeakable perversion impossible to perceive without the onset of madness.
111# True insanity awaits anyone who perceives all of these horrors together.
112#
113# Quotation marks, there might be an easier way to do this, but I can't find
114# it. The problem is that the user.hpp configuration file must receive a
115# pre-processor macro defined as the appropriate string - complete with "'s
116# around it. (<> is a possibility here but the danger to that is that the
117# failure case interprets the < and > as shell redirections, creating
118# random files in the source tree.)
119#
120#bjam: '-DBOOST_PLATFORM_CONFIG=\"config\"'
121#do_compile: '-sGCC=... '"'-DBOOST_PLATFORM_CONFIG=\"config\"'"
122SQD = '"'
123EQD = '\"'
124#boost.bb: "... '-sGCC=... '${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}config${EQD}'${SQD} ..."
125BJAM_CONF = "${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}boost/config/platform/${TARGET_OS}.hpp${EQD}'${SQD}"
126
127BJAM_TOOLS = "--ignore-site-config \
128 '-sTOOLS=gcc' \
129 '-sGCC=${CC} '${BJAM_CONF} \
130 '-sGXX=${CXX} '${BJAM_CONF} \
131 '-sGCC_INCLUDE_DIRECTORY=${STAGING_INCDIR}' \
132 '-sGCC_STDLIB_DIRECTORY=${STAGING_LIBDIR}' \
133 '-sBUILD=release <optimization>space <threading>multi <inlining>on <debug-symbols>off' \
134 '-sPYTHON_ROOT=${PYTHON_ROOT}' \
135 '--layout=system' \
136 "
137
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800138# use PARALLEL_MAKE to speed up the build
139BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_argument(d, '-j%d')}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500140BJAM_OPTS = '${BOOST_PARALLEL_MAKE} -d+2 -q \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500141 ${BJAM_TOOLS} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600142 -sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500143 --build-dir=${S}/${TARGET_SYS} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500144 --disable-icu \
145 ${BJAM_EXTRA}'
146
147# Native compilation of bzip2 isn't working
148BJAM_OPTS_append_class-native = ' -sNO_BZIP2=1'
149
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500150# Adjust the build for x32
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500151BJAM_OPTS_append_x86-x32 = " abi=x32 address-model=64"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500152
Vernon Mauery0d70daf2018-09-25 14:17:59 -0700153# cross compiling for arm fails to detect abi, so provide some help
154BJAM_OPTS_append_arm = " abi=aapcs architecture=arm"
155
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600156do_configure() {
157 cp -f ${S}/boost/config/platform/linux.hpp ${S}/boost/config/platform/linux-gnueabi.hpp
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500158
159 # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600160 rm -f ${WORKDIR}/user-config.jam
161 echo 'using gcc : 4.3.1 : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500162
163 # If we want Python then we need to tell Boost *exactly* where to find it
164 if ${@bb.utils.contains('BOOST_LIBS', 'python', 'true', 'false', d)}; then
165 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
166 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600167
168 if ${@bb.utils.contains('BOOST_LIBS', 'mpi', 'true', 'false', d)}; then
169 echo "using mpi : : <find-shared-library>mpi ;" >> ${WORKDIR}/user-config.jam
170 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500171
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500172 CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc
173
174 # Boost can't be trusted to find Python on it's own, so remove any mention
175 # of it from the boost configuration
176 sed -i '/using python/d' ${S}/project-config.jam
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500177}
178
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500179do_compile() {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600180 rm -rf ${S}/${TARGET_SYS}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500181 bjam ${BJAM_OPTS} --prefix=${prefix} \
182 --exec-prefix=${exec_prefix} \
183 --libdir=${libdir} \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500184 --includedir=${includedir} \
185 --debug-configuration
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500186}
187
188do_install() {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500189 bjam ${BJAM_OPTS} \
190 --libdir=${D}${libdir} \
191 --includedir=${D}${includedir} \
192 install
193 for lib in ${BOOST_LIBS}; do
194 if [ -e ${D}${libdir}/libboost_${lib}.a ]; then
195 ln -s libboost_${lib}.a ${D}${libdir}/libboost_${lib}-mt.a
196 fi
197 if [ -e ${D}${libdir}/libboost_${lib}.so ]; then
198 ln -s libboost_${lib}.so ${D}${libdir}/libboost_${lib}-mt.so
199 fi
200 done
201
202}
203
204BBCLASSEXTEND = "native nativesdk"