blob: 9016f7f937373070a455fa55c705190eaf6f7a75 [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"
Patrick Williams213cb262021-08-07 19:21:33 -050050ALLOW_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]
Patrick Williams213cb262021-08-07 19:21:33 -050054DEBUG_OPTIMIZATION:append = " -Wno-error"
Brad Bishopc342db32019-05-15 21:57:59 -040055
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
Patrick Williams213cb262021-08-07 19:21:33 -050063RDEPENDS: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"
72RRECOMMENDS:${PN}:append:x86 = " liblsan"
73RRECOMMENDS:${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
Patrick Williams213cb262021-08-07 19:21:33 -050084COMPATIBLE_HOST:libc-musl = 'null'
Patrick Williamsc124f4f2015-09-15 14:41:29 -050085
Patrick Williams213cb262021-08-07 19:21:33 -050086FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*"
87FILES:libasan-dev += "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -050088 ${libdir}/libasan_preinit.o \
Patrick Williamse760df82023-05-26 11:10:49 -050089 ${libdir}/libhwasan_preinit.o \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090 ${libdir}/libasan.so \
Andrew Geissler95ac1b82021-03-31 14:34:31 -050091 ${libdir}/libhwasan.so \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092 ${libdir}/libasan.la \
93"
Patrick Williams213cb262021-08-07 19:21:33 -050094FILES:libasan-staticdev += "${libdir}/libasan.a \
William A. Kennington IIIac69b482021-06-02 12:28:27 -070095 ${libdir}/libhwasan.a \
96"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097
Patrick Williams213cb262021-08-07 19:21:33 -050098FILES:libubsan += "${libdir}/libubsan.so.*"
99FILES:libubsan-dev += "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100 ${libdir}/libubsan.so \
101 ${libdir}/libubsan.la \
102"
Patrick Williams213cb262021-08-07 19:21:33 -0500103FILES:libubsan-staticdev += "${libdir}/libubsan.a"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104
Patrick Williams213cb262021-08-07 19:21:33 -0500105FILES:liblsan += "${libdir}/liblsan.so.*"
106FILES:liblsan-dev += "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500107 ${libdir}/liblsan.so \
108 ${libdir}/liblsan.la \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800109 ${libdir}/liblsan_preinit.o \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500110"
Patrick Williams213cb262021-08-07 19:21:33 -0500111FILES:liblsan-staticdev += "${libdir}/liblsan.a"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500112
Patrick Williams213cb262021-08-07 19:21:33 -0500113FILES:libtsan += "${libdir}/libtsan.so.*"
114FILES:libtsan-dev += "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115 ${libdir}/libtsan.so \
116 ${libdir}/libtsan.la \
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500117 ${libdir}/libtsan_*.o \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500118"
Patrick Williams213cb262021-08-07 19:21:33 -0500119FILES:libtsan-staticdev += "${libdir}/libtsan.a"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500120
Patrick Williams213cb262021-08-07 19:21:33 -0500121FILES:${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"