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