blob: d0348c481718b4e43cd9f37c8a104c75ad8c9835 [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
Andrew Geissler90fd73c2021-03-05 15:25:55 -060038 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 Williamsc124f4f2015-09-15 14:41:29 -050043 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
49INHIBIT_DEFAULT_DEPS = "1"
50ALLOW_EMPTY_${PN} = "1"
Andrew Geissler82c905d2020-04-13 13:39:40 -050051DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052
Brad Bishopc342db32019-05-15 21:57:59 -040053# 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]
54DEBUG_OPTIMIZATION_append = " -Wno-error"
55
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056BBCLASSEXTEND = "nativesdk"
57
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050058PACKAGES = "${PN} ${PN}-dbg"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059PACKAGES += "libasan libubsan liblsan libtsan"
60PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev"
62
63RDEPENDS_libasan += "libstdc++"
64RDEPENDS_libubsan += "libstdc++"
65RDEPENDS_liblsan += "libstdc++"
66RDEPENDS_libtsan += "libstdc++"
67RDEPENDS_libasan-dev += "${PN}"
68RDEPENDS_libubsan-dev += "${PN}"
69RDEPENDS_liblsan-dev += "${PN}"
70RDEPENDS_libtsan-dev += "${PN}"
71RRECOMMENDS_${PN} += "libasan libubsan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050072RRECOMMENDS_${PN}_append_x86 = " liblsan"
Brad Bishop316dfdd2018-06-25 12:45:53 -040073RRECOMMENDS_${PN}_append_x86-64 = " liblsan libtsan"
74RRECOMMENDS_${PN}_append_powerpc64 = " liblsan libtsan"
75RRECOMMENDS_${PN}_append_aarch64 = " liblsan libtsan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050076
77do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
78do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
79do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
80
Brad Bishop316dfdd2018-06-25 12:45:53 -040081# Only x86, powerpc, sparc, s390, arm, and aarch64 are supported
82COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux'
83# musl is currently broken entirely
84COMPATIBLE_HOST_libc-musl = 'null'
Patrick Williamsc124f4f2015-09-15 14:41:29 -050085
Andrew Geissler95ac1b82021-03-31 14:34:31 -050086FILES_libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050087FILES_libasan-dev += "\
88 ${libdir}/libasan_preinit.o \
89 ${libdir}/libasan.so \
Andrew Geissler95ac1b82021-03-31 14:34:31 -050090 ${libdir}/libhwasan.so \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091 ${libdir}/libasan.la \
92"
93FILES_libasan-staticdev += "${libdir}/libasan.a"
94
95FILES_libubsan += "${libdir}/libubsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050096FILES_libubsan-dev += "\
97 ${libdir}/libubsan.so \
98 ${libdir}/libubsan.la \
99"
100FILES_libubsan-staticdev += "${libdir}/libubsan.a"
101
102FILES_liblsan += "${libdir}/liblsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500103FILES_liblsan-dev += "\
104 ${libdir}/liblsan.so \
105 ${libdir}/liblsan.la \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800106 ${libdir}/liblsan_preinit.o \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500107"
108FILES_liblsan-staticdev += "${libdir}/liblsan.a"
109
110FILES_libtsan += "${libdir}/libtsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111FILES_libtsan-dev += "\
112 ${libdir}/libtsan.so \
113 ${libdir}/libtsan.la \
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500114 ${libdir}/libtsan_*.o \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115"
116FILES_libtsan-staticdev += "${libdir}/libtsan.a"
117
Andrew Geissler90fd73c2021-03-05 15:25:55 -0600118FILES_${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"