blob: c987ccb5895d910e90323fb82af2a86ba187798b [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001require gcc-configure-common.inc
2
3LICENSE = "NCSA | MIT"
4
5LIC_FILES_CHKSUM = "\
6 file://libsanitizer/LICENSE.TXT;md5=0249c37748936faf5b1efd5789587909 \
7"
8
9EXTRA_OECONF_PATHS = "\
10 --with-sysroot=/not/exist \
11 --with-build-sysroot=${STAGING_DIR_TARGET} \
12"
13
14do_configure () {
15 mtarget=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
16 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
17 if [ -d ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget ]; then
18 hardlinkdir ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget ${B}
19 fi
20
21 echo "Configuring libsanitizer"
22 rm -rf ${B}/$target/libsanitizer/
23 mkdir -p ${B}/$target/libsanitizer/
24 # This is kind of gross, but it's an easy way to make configure happy
25 # without hacking it up to use the system stdc++ instead of the one it
26 # expects to be newly built.
27 rm -rf ${B}/$target/libstdc++-v3/
28 mkdir -p ${B}/$target/libstdc++-v3/src/
29 ln -s ${STAGING_LIBDIR}/libstdc++.la ${B}/$target/libstdc++-v3/src/
30 ln -s ${STAGING_LIBDIR}/libstdc++.so ${B}/$target/libstdc++-v3/src/
31 cd ${B}/$target/libsanitizer/
32 chmod a+x ${S}/libsanitizer/configure
33 ${S}/libsanitizer/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
34 # Easiest way to stop bad RPATHs getting into the library since we have a
35 # broken libtool here
36 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/$target/libsanitizer/libtool
37}
38
39do_compile () {
40 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
41 cd ${B}/$target/libsanitizer/
42 oe_runmake MULTIBUILDTOP=${B}/$target/libsanitizer/
43}
44
45do_install () {
46 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
47 cd ${B}/$target/libsanitizer/
48 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/libsanitizer/ install
49 if [ -d ${D}${infodir} ]; then
50 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
51 fi
52 chown -R root:root ${D}
53}
54
55INHIBIT_DEFAULT_DEPS = "1"
56ALLOW_EMPTY_${PN} = "1"
57DEPENDS = "gcc-runtime"
58
59BBCLASSEXTEND = "nativesdk"
60
61PACKAGES = "${PN}"
62PACKAGES += "libasan libubsan liblsan libtsan"
63PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev"
64PACKAGES += "libasan-dbg libubsan-dbg liblsan-dbg libtsan-dbg"
65PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev"
66
67RDEPENDS_libasan += "libstdc++"
68RDEPENDS_libubsan += "libstdc++"
69RDEPENDS_liblsan += "libstdc++"
70RDEPENDS_libtsan += "libstdc++"
71RDEPENDS_libasan-dev += "${PN}"
72RDEPENDS_libubsan-dev += "${PN}"
73RDEPENDS_liblsan-dev += "${PN}"
74RDEPENDS_libtsan-dev += "${PN}"
75RRECOMMENDS_${PN} += "libasan libubsan"
76RRECOMMENDS_${PN}_append_x86-64 = " liblsan libtsan"
77RRECOMMENDS_${PN}_append_x86 = " liblsan"
78
79do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
80do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
81do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
82
83# MIPS, aarch64, and SPARC are broken.
84COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm).*-linux'
85
86FILES_libasan += "${libdir}/libasan.so.*"
87FILES_libasan-dbg += "${libdir}/.debug/libasan.so.*"
88FILES_libasan-dev += "\
89 ${libdir}/libasan_preinit.o \
90 ${libdir}/libasan.so \
91 ${libdir}/libasan.la \
92"
93FILES_libasan-staticdev += "${libdir}/libasan.a"
94
95FILES_libubsan += "${libdir}/libubsan.so.*"
96FILES_libubsan-dbg += "${libdir}/.debug/libubsan.so.*"
97FILES_libubsan-dev += "\
98 ${libdir}/libubsan.so \
99 ${libdir}/libubsan.la \
100"
101FILES_libubsan-staticdev += "${libdir}/libubsan.a"
102
103FILES_liblsan += "${libdir}/liblsan.so.*"
104FILES_liblsan-dbg += "${libdir}/.debug/liblsan.so.*"
105FILES_liblsan-dev += "\
106 ${libdir}/liblsan.so \
107 ${libdir}/liblsan.la \
108"
109FILES_liblsan-staticdev += "${libdir}/liblsan.a"
110
111FILES_libtsan += "${libdir}/libtsan.so.*"
112FILES_libtsan-dbg += "${libdir}/.debug/libtsan.so.*"
113FILES_libtsan-dev += "\
114 ${libdir}/libtsan.so \
115 ${libdir}/libtsan.la \
116"
117FILES_libtsan-staticdev += "${libdir}/libtsan.a"
118
119FILES_${PN} = "${libdir}/*.spec ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"