Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 15 | rm -rf ${B}/${TARGET_SYS}/libsanitizer/ |
| 16 | mkdir -p ${B}/${TARGET_SYS}/libsanitizer/ |
| 17 | cd ${B}/${TARGET_SYS}/libsanitizer/ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 18 | chmod a+x ${S}/libsanitizer/configure |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 19 | relpath=${@os.path.relpath("${S}/libsanitizer", "${B}/${TARGET_SYS}/libsanitizer")} |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 20 | $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 21 | # Easiest way to stop bad RPATHs getting into the library since we have a |
| 22 | # broken libtool here |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 23 | sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libsanitizer/libtool |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 24 | # Link to the sysroot's libstdc++ instead of one gcc thinks it just built |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 25 | sed -i -e '/LIBSTDCXX_RAW_CXX_\(CXXFLAGS\|LDFLAGS\)\s*=/d' ${B}/${TARGET_SYS}/libsanitizer/*/Makefile |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | } |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 27 | EXTRACONFFUNCS += "extract_stashed_builddir" |
| 28 | do_configure[depends] += "${COMPILERDEP}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | |
| 30 | do_compile () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 31 | cd ${B}/${TARGET_SYS}/libsanitizer/ |
| 32 | oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | do_install () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 36 | cd ${B}/${TARGET_SYS}/libsanitizer/ |
| 37 | oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 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 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 51 | DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 52 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 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 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 56 | BBCLASSEXTEND = "nativesdk" |
| 57 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 58 | PACKAGES = "${PN} ${PN}-dbg" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 59 | PACKAGES += "libasan libubsan liblsan libtsan" |
| 60 | PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 72 | RRECOMMENDS_${PN}_append_x86 = " liblsan" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 73 | RRECOMMENDS_${PN}_append_x86-64 = " liblsan libtsan" |
| 74 | RRECOMMENDS_${PN}_append_powerpc64 = " liblsan libtsan" |
| 75 | RRECOMMENDS_${PN}_append_aarch64 = " liblsan libtsan" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 76 | |
| 77 | do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" |
| 78 | do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" |
| 79 | do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" |
| 80 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 81 | # Only x86, powerpc, sparc, s390, arm, and aarch64 are supported |
| 82 | COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux' |
| 83 | # musl is currently broken entirely |
| 84 | COMPATIBLE_HOST_libc-musl = 'null' |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 85 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 86 | FILES_libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 87 | FILES_libasan-dev += "\ |
| 88 | ${libdir}/libasan_preinit.o \ |
| 89 | ${libdir}/libasan.so \ |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 90 | ${libdir}/libhwasan.so \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 91 | ${libdir}/libasan.la \ |
| 92 | " |
| 93 | FILES_libasan-staticdev += "${libdir}/libasan.a" |
| 94 | |
| 95 | FILES_libubsan += "${libdir}/libubsan.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 96 | FILES_libubsan-dev += "\ |
| 97 | ${libdir}/libubsan.so \ |
| 98 | ${libdir}/libubsan.la \ |
| 99 | " |
| 100 | FILES_libubsan-staticdev += "${libdir}/libubsan.a" |
| 101 | |
| 102 | FILES_liblsan += "${libdir}/liblsan.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 103 | FILES_liblsan-dev += "\ |
| 104 | ${libdir}/liblsan.so \ |
| 105 | ${libdir}/liblsan.la \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 106 | ${libdir}/liblsan_preinit.o \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 107 | " |
| 108 | FILES_liblsan-staticdev += "${libdir}/liblsan.a" |
| 109 | |
| 110 | FILES_libtsan += "${libdir}/libtsan.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 111 | FILES_libtsan-dev += "\ |
| 112 | ${libdir}/libtsan.so \ |
| 113 | ${libdir}/libtsan.la \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 114 | ${libdir}/libtsan_*.o \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 115 | " |
| 116 | FILES_libtsan-staticdev += "${libdir}/libtsan.a" |
| 117 | |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 118 | FILES_${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h" |