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" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 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] |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 54 | DEBUG_OPTIMIZATION:append = " -Wno-error" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 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 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 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" |
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 |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 84 | COMPATIBLE_HOST:libc-musl = 'null' |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 85 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 86 | FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*" |
| 87 | FILES:libasan-dev += "\ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 88 | ${libdir}/libasan_preinit.o \ |
Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 89 | ${libdir}/libhwasan_preinit.o \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 90 | ${libdir}/libasan.so \ |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 91 | ${libdir}/libhwasan.so \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 92 | ${libdir}/libasan.la \ |
| 93 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 94 | FILES:libasan-staticdev += "${libdir}/libasan.a \ |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 95 | ${libdir}/libhwasan.a \ |
| 96 | " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 97 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 98 | FILES:libubsan += "${libdir}/libubsan.so.*" |
| 99 | FILES:libubsan-dev += "\ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 100 | ${libdir}/libubsan.so \ |
| 101 | ${libdir}/libubsan.la \ |
| 102 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 103 | FILES:libubsan-staticdev += "${libdir}/libubsan.a" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 104 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 105 | FILES:liblsan += "${libdir}/liblsan.so.*" |
| 106 | FILES:liblsan-dev += "\ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 107 | ${libdir}/liblsan.so \ |
| 108 | ${libdir}/liblsan.la \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 109 | ${libdir}/liblsan_preinit.o \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 111 | FILES:liblsan-staticdev += "${libdir}/liblsan.a" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 112 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 113 | FILES:libtsan += "${libdir}/libtsan.so.*" |
| 114 | FILES:libtsan-dev += "\ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 115 | ${libdir}/libtsan.so \ |
| 116 | ${libdir}/libtsan.la \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 117 | ${libdir}/libtsan_*.o \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 118 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 119 | FILES:libtsan-staticdev += "${libdir}/libtsan.a" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 120 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 121 | FILES:${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h" |