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