1require 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 rm -rf ${B}/${TARGET_SYS}/libsanitizer/ 16 mkdir -p ${B}/${TARGET_SYS}/libsanitizer/ 17 cd ${B}/${TARGET_SYS}/libsanitizer/ 18 chmod a+x ${S}/libsanitizer/configure 19 relpath=${@os.path.relpath("${S}/libsanitizer", "${B}/${TARGET_SYS}/libsanitizer")} 20 $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} 21 # Easiest way to stop bad RPATHs getting into the library since we have a 22 # broken libtool here 23 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libsanitizer/libtool 24 # Link to the sysroot's libstdc++ instead of one gcc thinks it just built 25 sed -i -e '/LIBSTDCXX_RAW_CXX_\(CXXFLAGS\|LDFLAGS\)\s*=/d' ${B}/${TARGET_SYS}/libsanitizer/*/Makefile 26} 27EXTRACONFFUNCS += "extract_stashed_builddir" 28do_configure[depends] += "${COMPILERDEP}" 29 30do_compile () { 31 cd ${B}/${TARGET_SYS}/libsanitizer/ 32 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ 33} 34 35do_install () { 36 cd ${B}/${TARGET_SYS}/libsanitizer/ 37 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install 38 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then 39 install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include 40 mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include 41 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include 42 fi 43 if [ -d ${D}${infodir} ]; then 44 rmdir --ignore-fail-on-non-empty -p ${D}${infodir} 45 fi 46 chown -R root:root ${D} 47} 48 49INHIBIT_DEFAULT_DEPS = "1" 50ALLOW_EMPTY:${PN} = "1" 51DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc" 52 53# used to fix ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized] 54DEBUG_OPTIMIZATION:append = " -Wno-error" 55 56BBCLASSEXTEND = "nativesdk" 57 58PACKAGES = "${PN} ${PN}-dbg" 59PACKAGES += "libasan libubsan liblsan libtsan" 60PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev" 61PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev" 62 63RDEPENDS:libasan += "libstdc++" 64RDEPENDS:libubsan += "libstdc++" 65RDEPENDS:liblsan += "libstdc++" 66RDEPENDS:libtsan += "libstdc++" 67RDEPENDS:libasan-dev += "${PN}" 68RDEPENDS:libubsan-dev += "${PN}" 69RDEPENDS:liblsan-dev += "${PN}" 70RDEPENDS:libtsan-dev += "${PN}" 71RRECOMMENDS:${PN} += "libasan libubsan" 72RRECOMMENDS:${PN}:append:x86 = " liblsan" 73RRECOMMENDS:${PN}:append:x86-64 = " liblsan libtsan" 74RRECOMMENDS:${PN}:append:powerpc64 = " liblsan libtsan" 75RRECOMMENDS:${PN}:append:aarch64 = " liblsan libtsan" 76 77do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" 78do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" 79do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" 80 81# Only x86, powerpc, sparc, s390, arm, and aarch64 are supported 82COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux' 83# musl is currently broken entirely 84COMPATIBLE_HOST:libc-musl = 'null' 85 86FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*" 87FILES:libasan-dev += "\ 88 ${libdir}/libasan_preinit.o \ 89 ${libdir}/libasan.so \ 90 ${libdir}/libhwasan.so \ 91 ${libdir}/libasan.la \ 92" 93FILES:libasan-staticdev += "${libdir}/libasan.a \ 94 ${libdir}/libhwasan.a \ 95" 96 97FILES:libubsan += "${libdir}/libubsan.so.*" 98FILES:libubsan-dev += "\ 99 ${libdir}/libubsan.so \ 100 ${libdir}/libubsan.la \ 101" 102FILES:libubsan-staticdev += "${libdir}/libubsan.a" 103 104FILES:liblsan += "${libdir}/liblsan.so.*" 105FILES:liblsan-dev += "\ 106 ${libdir}/liblsan.so \ 107 ${libdir}/liblsan.la \ 108 ${libdir}/liblsan_preinit.o \ 109" 110FILES:liblsan-staticdev += "${libdir}/liblsan.a" 111 112FILES:libtsan += "${libdir}/libtsan.so.*" 113FILES:libtsan-dev += "\ 114 ${libdir}/libtsan.so \ 115 ${libdir}/libtsan.la \ 116 ${libdir}/libtsan_*.o \ 117" 118FILES:libtsan-staticdev += "${libdir}/libtsan.a" 119 120FILES:${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h" 121