blob: 668e14a59f6999db86bec4ab0cae97532858f151 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001require 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 () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050015 rm -rf ${B}/${TARGET_SYS}/libsanitizer/
16 mkdir -p ${B}/${TARGET_SYS}/libsanitizer/
17 cd ${B}/${TARGET_SYS}/libsanitizer/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018 chmod a+x ${S}/libsanitizer/configure
Brad Bishop6e60e8b2018-02-01 10:27:11 -050019 relpath=${@os.path.relpath("${S}/libsanitizer", "${B}/${TARGET_SYS}/libsanitizer")}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050020 $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021 # Easiest way to stop bad RPATHs getting into the library since we have a
22 # broken libtool here
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libsanitizer/libtool
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050024 # Link to the sysroot's libstdc++ instead of one gcc thinks it just built
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025 sed -i -e '/LIBSTDCXX_RAW_CXX_\(CXXFLAGS\|LDFLAGS\)\s*=/d' ${B}/${TARGET_SYS}/libsanitizer/*/Makefile
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027EXTRACONFFUNCS += "extract_stashed_builddir"
28do_configure[depends] += "${COMPILERDEP}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029
30do_compile () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050031 cd ${B}/${TARGET_SYS}/libsanitizer/
32 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033}
34
35do_install () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036 cd ${B}/${TARGET_SYS}/libsanitizer/
37 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038 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
44INHIBIT_DEFAULT_DEPS = "1"
45ALLOW_EMPTY_${PN} = "1"
Andrew Geissler82c905d2020-04-13 13:39:40 -050046DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047
Brad Bishopc342db32019-05-15 21:57:59 -040048# 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]
49DEBUG_OPTIMIZATION_append = " -Wno-error"
50
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051BBCLASSEXTEND = "nativesdk"
52
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050053PACKAGES = "${PN} ${PN}-dbg"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054PACKAGES += "libasan libubsan liblsan libtsan"
55PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev"
57
58RDEPENDS_libasan += "libstdc++"
59RDEPENDS_libubsan += "libstdc++"
60RDEPENDS_liblsan += "libstdc++"
61RDEPENDS_libtsan += "libstdc++"
62RDEPENDS_libasan-dev += "${PN}"
63RDEPENDS_libubsan-dev += "${PN}"
64RDEPENDS_liblsan-dev += "${PN}"
65RDEPENDS_libtsan-dev += "${PN}"
66RRECOMMENDS_${PN} += "libasan libubsan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050067RRECOMMENDS_${PN}_append_x86 = " liblsan"
Brad Bishop316dfdd2018-06-25 12:45:53 -040068RRECOMMENDS_${PN}_append_x86-64 = " liblsan libtsan"
69RRECOMMENDS_${PN}_append_powerpc64 = " liblsan libtsan"
70RRECOMMENDS_${PN}_append_aarch64 = " liblsan libtsan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071
72do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
73do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
74do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
75
Brad Bishop316dfdd2018-06-25 12:45:53 -040076# Only x86, powerpc, sparc, s390, arm, and aarch64 are supported
77COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux'
78# musl is currently broken entirely
79COMPATIBLE_HOST_libc-musl = 'null'
Patrick Williamsc124f4f2015-09-15 14:41:29 -050080
81FILES_libasan += "${libdir}/libasan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050082FILES_libasan-dev += "\
83 ${libdir}/libasan_preinit.o \
84 ${libdir}/libasan.so \
85 ${libdir}/libasan.la \
86"
87FILES_libasan-staticdev += "${libdir}/libasan.a"
88
89FILES_libubsan += "${libdir}/libubsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090FILES_libubsan-dev += "\
91 ${libdir}/libubsan.so \
92 ${libdir}/libubsan.la \
93"
94FILES_libubsan-staticdev += "${libdir}/libubsan.a"
95
96FILES_liblsan += "${libdir}/liblsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097FILES_liblsan-dev += "\
98 ${libdir}/liblsan.so \
99 ${libdir}/liblsan.la \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800100 ${libdir}/liblsan_preinit.o \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500101"
102FILES_liblsan-staticdev += "${libdir}/liblsan.a"
103
104FILES_libtsan += "${libdir}/libtsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500105FILES_libtsan-dev += "\
106 ${libdir}/libtsan.so \
107 ${libdir}/libtsan.la \
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500108 ${libdir}/libtsan_*.o \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109"
110FILES_libtsan-staticdev += "${libdir}/libtsan.a"
111
112FILES_${PN} = "${libdir}/*.spec ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"