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 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 38 | if [ -d ${D}${infodir} ]; then |
| 39 | rmdir --ignore-fail-on-non-empty -p ${D}${infodir} |
| 40 | fi |
| 41 | chown -R root:root ${D} |
| 42 | } |
| 43 | |
| 44 | INHIBIT_DEFAULT_DEPS = "1" |
| 45 | ALLOW_EMPTY_${PN} = "1" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 46 | DEPENDS = "gcc-runtime virtual/${TARGET_PREFIX}gcc" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | |
| 48 | BBCLASSEXTEND = "nativesdk" |
| 49 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 50 | PACKAGES = "${PN} ${PN}-dbg" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 51 | PACKAGES += "libasan libubsan liblsan libtsan" |
| 52 | PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 53 | PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev" |
| 54 | |
| 55 | RDEPENDS_libasan += "libstdc++" |
| 56 | RDEPENDS_libubsan += "libstdc++" |
| 57 | RDEPENDS_liblsan += "libstdc++" |
| 58 | RDEPENDS_libtsan += "libstdc++" |
| 59 | RDEPENDS_libasan-dev += "${PN}" |
| 60 | RDEPENDS_libubsan-dev += "${PN}" |
| 61 | RDEPENDS_liblsan-dev += "${PN}" |
| 62 | RDEPENDS_libtsan-dev += "${PN}" |
| 63 | RRECOMMENDS_${PN} += "libasan libubsan" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 64 | RRECOMMENDS_${PN}_append_x86 = " liblsan" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 65 | RRECOMMENDS_${PN}_append_x86-64 = " liblsan libtsan" |
| 66 | RRECOMMENDS_${PN}_append_powerpc64 = " liblsan libtsan" |
| 67 | RRECOMMENDS_${PN}_append_aarch64 = " liblsan libtsan" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 68 | |
| 69 | do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" |
| 70 | do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" |
| 71 | do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" |
| 72 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 73 | # Only x86, powerpc, sparc, s390, arm, and aarch64 are supported |
| 74 | COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux' |
| 75 | # musl is currently broken entirely |
| 76 | COMPATIBLE_HOST_libc-musl = 'null' |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 77 | |
| 78 | FILES_libasan += "${libdir}/libasan.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 79 | FILES_libasan-dev += "\ |
| 80 | ${libdir}/libasan_preinit.o \ |
| 81 | ${libdir}/libasan.so \ |
| 82 | ${libdir}/libasan.la \ |
| 83 | " |
| 84 | FILES_libasan-staticdev += "${libdir}/libasan.a" |
| 85 | |
| 86 | FILES_libubsan += "${libdir}/libubsan.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 87 | FILES_libubsan-dev += "\ |
| 88 | ${libdir}/libubsan.so \ |
| 89 | ${libdir}/libubsan.la \ |
| 90 | " |
| 91 | FILES_libubsan-staticdev += "${libdir}/libubsan.a" |
| 92 | |
| 93 | FILES_liblsan += "${libdir}/liblsan.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 94 | FILES_liblsan-dev += "\ |
| 95 | ${libdir}/liblsan.so \ |
| 96 | ${libdir}/liblsan.la \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 97 | ${libdir}/liblsan_preinit.o \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 98 | " |
| 99 | FILES_liblsan-staticdev += "${libdir}/liblsan.a" |
| 100 | |
| 101 | FILES_libtsan += "${libdir}/libtsan.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 102 | FILES_libtsan-dev += "\ |
| 103 | ${libdir}/libtsan.so \ |
| 104 | ${libdir}/libtsan.la \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 105 | ${libdir}/libtsan_*.o \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 106 | " |
| 107 | FILES_libtsan-staticdev += "${libdir}/libtsan.a" |
| 108 | |
| 109 | FILES_${PN} = "${libdir}/*.spec ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/sanitizer/*.h" |