1# Class to inherit when you want to build against Breakpad.
2# Apart from inheriting this class, you need to set BREAKPAD_BIN in
3# your recipe, and make sure that you link against libbreakpad_client.a.
4
5DEPENDS += "breakpad breakpad-native"
6
7CFLAGS += "-I${STAGING_DIR_TARGET}${includedir}/breakpad "
8CXXFLAGS += "-I${STAGING_DIR_TARGET}${includedir}/breakpad "
9
10BREAKPAD_BIN ?= ""
11
12python () {
13    breakpad_bin = d.getVar("BREAKPAD_BIN")
14
15    if not breakpad_bin:
16       PN = d.getVar("PN")
17       FILE = os.path.basename(d.getVar("FILE"))
18       bb.error("To build %s, see breakpad.bbclass for instructions on \
19                 setting up your Breakpad configuration" % PN)
20       raise ValueError('BREAKPAD_BIN not defined in %s' % PN)
21}
22
23# Add creation of symbols here
24PACKAGE_PREPROCESS_FUNCS += "breakpad_package_preprocess"
25breakpad_package_preprocess () {
26    mkdir -p ${PKGD}/usr/share/breakpad-syms
27    find ${D} -name ${BREAKPAD_BIN} -exec sh -c "dump_syms {} > ${PKGD}/usr/share/breakpad-syms/${BREAKPAD_BIN}.sym" \;
28    HASH=$(head -n1 ${PKGD}/usr/share/breakpad-syms/${BREAKPAD_BIN}.sym | rev | cut -d ' ' -f2 | rev)
29    mkdir -p ${PKGD}/usr/share/breakpad-syms/${BREAKPAD_BIN}/${HASH}
30    mv ${PKGD}/usr/share/breakpad-syms/${BREAKPAD_BIN}.sym ${PKGD}/usr/share/breakpad-syms/${BREAKPAD_BIN}/${HASH}
31}
32
33PACKAGES =+ "${PN}-breakpad"
34
35FILES_${PN}-breakpad = "/usr/share/breakpad-syms"
36
37