-
Notifications
You must be signed in to change notification settings - Fork 32
/
cmake_extra_sanity.bbclass
75 lines (65 loc) · 2.17 KB
/
cmake_extra_sanity.bbclass
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
inherit cmake_sysroot
# do_install:append:class-cross does not work so hack
do_install:prepend:class-native() {
no_staging_check=true
}
do_install:prepend:class-nativesdk() {
no_staging_check=true
}
do_install:append() {
# avoid strange prefixing seen often
old_dir=`pwd`
cd ${D}
if grep -qr 'usr\/\/usr' ; then
bbfatal 'usr//usr found - check sources for PREFIX or better CMAKE_INSTALL_PREFIX!'
fi
cd $old_dir
# check for staging links in non native recipes
# TBD: -> oe-core (1st part - genarated sources - should work with autotools too)
if [ x = x$no_staging_check ] ; then
error=
# check for generated sources
for f in `find ${B} -name '*.h' -o -name '*.cpp'` ; do
if grep -q 'recipe-sysroot' $f ; then
bbwarn "$f contains links to build sysroot!"
error=true
fi
done
# check installed cmake files
for f in `find ${D} -name '*.cmake'` ; do
if grep -q 'recipe-sysroot' "$f" ; then
bbwarn "$f contains links to build host sysroot!"
error=true
fi
done
if [ x != x$error ] ; then
bbfatal "One or more files contain links to build host sysroot ${STAGING_DIR_HOST}(-native)"
fi
fi
}
do_populate_sysroot[postfuncs] += "do_sysroot_cmake_sanity "
# check sysroot cmake files for links not relative and not to sysroots
do_sysroot_cmake_sanity() {
error=
for f in `cat ${CMAKEINSTALLED}` ; do
if grep -q ';${libdir}' "$f" ; then
bbwarn "$f contains links to ${libdir}!"
error=true
fi
if grep -q '\"${libdir}/lib' "$f" ; then
bbwarn "$f contains links to ${libdir}!"
error=true
fi
if grep -q ';${includedir}' "$f" ; then
bbwarn "$f contains links to ${includedir}!"
error=true
fi
if grep -q '\"${includedir}' "$f" ; then
bbwarn "$f contains links to ${includedir}!"
error=true
fi
done
if [ x != x$error ] ; then
bbfatal "One or more files in sysroot contain links to ${prefix}"
fi
}