blob: 1966d3d8074458999287b443abc90dbbe88a0ad3 [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 \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012 date_time \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060013 exception \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014 filesystem \
15 graph \
16 iostreams \
17 log \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060018 math \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019 program_options \
20 random \
21 regex \
22 serialization \
23 signals \
24 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"
35# need consistent settings for native builds (x86 override not applied for native)
36BOOST_LIBS_remove_class-native = " context coroutine"
Brad Bishop37a0e4d2017-12-04 01:01:44 -050037# does not compile
38BOOST_LIBS_remove_mips16e = "wave"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060039
40# optional libraries
41PACKAGECONFIG ??= "locale"
42PACKAGECONFIG[locale] = ",,icu"
43PACKAGECONFIG[graph_parallel] = ",,,boost-mpi mpich"
44PACKAGECONFIG[mpi] = ",,mpich"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045PACKAGECONFIG[python] = ",,python python3"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060046
47BOOST_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 Williamsc124f4f2015-09-15 14:41:29 -050054inherit python-dir
55PYTHON_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 = []
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 Williamsc0f7c042017-02-23 20:41:17 -060080FILES_${PN}-graph = "${libdir}/libboost_graph.so.*"
81FILES_${PN}-graph_parallel = "${libdir}/libboost_graph_parallel.so.*"
82FILES_${PN}-locale = "${libdir}/libboost_locale.so.*"
83FILES_${PN}-mpi = "${libdir}/mpi.so ${libdir}/libboost_mpi*.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050084FILES_boost-serialization = "${libdir}/libboost_serialization*.so.* \
85 ${libdir}/libboost_wserialization*.so.*"
86FILES_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
90PACKAGES += "${PN}-dev ${PN}-staticdev"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050091FILES_${PN} = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092FILES_${PN}-dev = "${includedir} ${libdir}/libboost_*.so"
93FILES_${PN}-staticdev = "${libdir}/libboost_*.a"
94
95# "boost" is a metapackage which pulls in all boost librabries
96PACKAGES += "${PN}"
97RRECOMMENDS_${PN} += "${BOOST_PACKAGES}"
98RRECOMMENDS_${PN}_class-native = ""
99ALLOW_EMPTY_${PN} = "1"
100
101# to avoid GNU_HASH QA errors added LDFLAGS to ARCH; a little bit dirty but at least it works
102TARGET_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\"'"
129SQD = '"'
130EQD = '\"'
131#boost.bb: "... '-sGCC=... '${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}config${EQD}'${SQD} ..."
132BJAM_CONF = "${SQD}'-DBOOST_PLATFORM_CONFIG=${EQD}boost/config/platform/${TARGET_OS}.hpp${EQD}'${SQD}"
133
134BJAM_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 Williamsd8c66bc2016-06-20 12:57:21 -0500145# 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 Williamsc124f4f2015-09-15 14:41:29 -0500146# https://svn.boost.org/trac/boost/ticket/7634
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500147def get_boost_parallel_make(d):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500148 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 Williamsd8c66bc2016-06-20 12:57:21 -0500169BOOST_PARALLEL_MAKE = "${@get_boost_parallel_make(d)}"
170BJAM_OPTS = '${BOOST_PARALLEL_MAKE} -d+2 -q \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500171 ${BJAM_TOOLS} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600172 -sBOOST_BUILD_USER_CONFIG=${WORKDIR}/user-config.jam \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500173 --build-dir=${S}/${TARGET_SYS} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500174 --disable-icu \
175 ${BJAM_EXTRA}'
176
177# Native compilation of bzip2 isn't working
178BJAM_OPTS_append_class-native = ' -sNO_BZIP2=1'
179
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600180do_configure() {
181 cp -f ${S}/boost/config/platform/linux.hpp ${S}/boost/config/platform/linux-gnueabi.hpp
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500182
183 # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600184 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 Williamsc124f4f2015-09-15 14:41:29 -0500192
193 CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" ./bootstrap.sh --with-bjam=bjam --with-toolset=gcc --with-python-root=${PYTHON_ROOT}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600194 sed -i '/^using python/d' ${S}/project-config.jam
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500195}
196
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500197do_compile() {
198 set -ex
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600199 rm -rf ${S}/${TARGET_SYS}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500200 bjam ${BJAM_OPTS} --prefix=${prefix} \
201 --exec-prefix=${exec_prefix} \
202 --libdir=${libdir} \
203 --includedir=${includedir}
204}
205
206do_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
223BBCLASSEXTEND = "native nativesdk"