1*require gcc-configure-common.inc 2* 3*LICENSE = "NCSA | MIT" 4* 5*LIC_FILES_CHKSUM = "\ 6* file://libsanitizer/LICENSE.TXT;md5=0249c37748936faf5b1efd5789587909 \ 7*" 8* 9*EXTRA_OECONF_PATHS = "\ 10* --with-sysroot=/not/exist \ 11* --with-build-sysroot=${STAGING_DIR_TARGET} \ 12*" 13* 14*do_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*} 27*EXTRACONFFUNCS += "extract_stashed_builddir" 28*do_configure[depends] += "${COMPILERDEP}" 29* 30*do_compile () { 31* cd ${B}/${TARGET_SYS}/libsanitizer/ 32* oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ 33*} 34* 35*do_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* 49*INHIBIT_DEFAULT_DEPS = "1" 50*ALLOW_EMPTY:${PN} = "1" 51*DEPENDS = "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] 54*DEBUG_OPTIMIZATION:append = " -Wno-error" 55* 56*BBCLASSEXTEND = "nativesdk" 57* 58*PACKAGES = "${PN} ${PN}-dbg" 59*PACKAGES += "libasan libubsan liblsan libtsan" 60*PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev" 61*PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev" 62* 63*RDEPENDS:libasan += "libstdc++" 64*RDEPENDS:libubsan += "libstdc++" 65*RDEPENDS:liblsan += "libstdc++" 66*RDEPENDS:libtsan += "libstdc++" 67*RDEPENDS:libasan-dev += "${PN}" 68*RDEPENDS:libubsan-dev += "${PN}" 69*RDEPENDS:liblsan-dev += "${PN}" 70*RDEPENDS:libtsan-dev += "${PN}" 71*RRECOMMENDS:${PN} += "libasan libubsan" 72*RRECOMMENDS:${PN}:append:x86 = " liblsan" 73*RRECOMMENDS:${PN}:append:x86-64 = " liblsan libtsan" 74*RRECOMMENDS:${PN}:append:powerpc64 = " liblsan libtsan" 75*RRECOMMENDS:${PN}:append:aarch64 = " liblsan libtsan" 76*RRECOMMENDS:${PN}:append:riscv64 = " liblsan libtsan" 77* 78*do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" 79*do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" 80*do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" 81* 82*# Only x86, powerpc, sparc, s390, arm, aarch64 and loongarch64 are supported 83*COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64|loongarch64|riscv64).*-linux' 84*# musl is currently broken entirely 85*COMPATIBLE_HOST:libc-musl = 'null' 86* 87*FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*" 88*FILES:libasan-dev += "\ 89* ${libdir}/libasan_preinit.o \ 90* ${libdir}/libhwasan_preinit.o \ 91* ${libdir}/libasan.so \ 92* ${libdir}/libhwasan.so \ 93* ${libdir}/libasan.la \ 94*" 95*FILES:libasan-staticdev += "${libdir}/libasan.a \ 96* ${libdir}/libhwasan.a \ 97*" 98* 99*FILES:libubsan += "${libdir}/libubsan.so.*" 100*FILES:libubsan-dev += "\ 101* ${libdir}/libubsan.so \ 102* ${libdir}/libubsan.la \ 103*" 104*FILES:libubsan-staticdev += "${libdir}/libubsan.a" 105* 106*FILES:liblsan += "${libdir}/liblsan.so.*" 107*FILES:liblsan-dev += "\ 108* ${libdir}/liblsan.so \ 109* ${libdir}/liblsan.la \ 110* ${libdir}/liblsan_preinit.o \ 111*" 112*FILES:liblsan-staticdev += "${libdir}/liblsan.a" 113* 114*FILES:libtsan += "${libdir}/libtsan.so.*" 115*FILES:libtsan-dev += "\ 116* ${libdir}/libtsan.so \ 117* ${libdir}/libtsan.la \ 118* ${libdir}/libtsan_*.o \ 119*" 120*FILES:libtsan-staticdev += "${libdir}/libtsan.a" 121* 122*FILES:${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h" 123*