blob: 6091a0b6fb5a7124812b82e6ea5731d40d6ce273 [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/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024 cd ${B}/$target/libsanitizer/
25 chmod a+x ${S}/libsanitizer/configure
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050026 relpath=${@os.path.relpath("${S}/libsanitizer", "${B}/$target/libsanitizer")}
27 $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 # Easiest way to stop bad RPATHs getting into the library since we have a
29 # broken libtool here
30 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/$target/libsanitizer/libtool
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050031 # Link to the sysroot's libstdc++ instead of one gcc thinks it just built
32 sed -i -e '/LIBSTDCXX_RAW_CXX_\(CXXFLAGS\|LDFLAGS\)\s*=/d' ${B}/$target/libsanitizer/*/Makefile
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033}
34
35do_compile () {
36 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
37 cd ${B}/$target/libsanitizer/
38 oe_runmake MULTIBUILDTOP=${B}/$target/libsanitizer/
39}
40
41do_install () {
42 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
43 cd ${B}/$target/libsanitizer/
44 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/libsanitizer/ install
45 if [ -d ${D}${infodir} ]; then
46 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
47 fi
48 chown -R root:root ${D}
49}
50
51INHIBIT_DEFAULT_DEPS = "1"
52ALLOW_EMPTY_${PN} = "1"
53DEPENDS = "gcc-runtime"
54
55BBCLASSEXTEND = "nativesdk"
56
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050057PACKAGES = "${PN} ${PN}-dbg"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058PACKAGES += "libasan libubsan liblsan libtsan"
59PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050060PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev"
61
62RDEPENDS_libasan += "libstdc++"
63RDEPENDS_libubsan += "libstdc++"
64RDEPENDS_liblsan += "libstdc++"
65RDEPENDS_libtsan += "libstdc++"
66RDEPENDS_libasan-dev += "${PN}"
67RDEPENDS_libubsan-dev += "${PN}"
68RDEPENDS_liblsan-dev += "${PN}"
69RDEPENDS_libtsan-dev += "${PN}"
70RRECOMMENDS_${PN} += "libasan libubsan"
71RRECOMMENDS_${PN}_append_x86-64 = " liblsan libtsan"
72RRECOMMENDS_${PN}_append_x86 = " liblsan"
73
74do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
75do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
76do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
77
78# MIPS, aarch64, and SPARC are broken.
79COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm).*-linux'
80
81FILES_libasan += "${libdir}/libasan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050082FILES_libasan-dev += "\
83 ${libdir}/libasan_preinit.o \
84 ${libdir}/libasan.so \
85 ${libdir}/libasan.la \
86"
87FILES_libasan-staticdev += "${libdir}/libasan.a"
88
89FILES_libubsan += "${libdir}/libubsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090FILES_libubsan-dev += "\
91 ${libdir}/libubsan.so \
92 ${libdir}/libubsan.la \
93"
94FILES_libubsan-staticdev += "${libdir}/libubsan.a"
95
96FILES_liblsan += "${libdir}/liblsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097FILES_liblsan-dev += "\
98 ${libdir}/liblsan.so \
99 ${libdir}/liblsan.la \
100"
101FILES_liblsan-staticdev += "${libdir}/liblsan.a"
102
103FILES_libtsan += "${libdir}/libtsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104FILES_libtsan-dev += "\
105 ${libdir}/libtsan.so \
106 ${libdir}/libtsan.la \
107"
108FILES_libtsan-staticdev += "${libdir}/libtsan.a"
109
110FILES_${PN} = "${libdir}/*.spec ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"