blob: e5e84526fa62d0be9b3941ba86f81c92d322095d [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"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060046DEPENDS = "gcc-runtime virtual/${TARGET_PREFIX}gcc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047
48BBCLASSEXTEND = "nativesdk"
49
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050050PACKAGES = "${PN} ${PN}-dbg"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051PACKAGES += "libasan libubsan liblsan libtsan"
52PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050053PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev"
54
55RDEPENDS_libasan += "libstdc++"
56RDEPENDS_libubsan += "libstdc++"
57RDEPENDS_liblsan += "libstdc++"
58RDEPENDS_libtsan += "libstdc++"
59RDEPENDS_libasan-dev += "${PN}"
60RDEPENDS_libubsan-dev += "${PN}"
61RDEPENDS_liblsan-dev += "${PN}"
62RDEPENDS_libtsan-dev += "${PN}"
63RRECOMMENDS_${PN} += "libasan libubsan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064RRECOMMENDS_${PN}_append_x86 = " liblsan"
Brad Bishop316dfdd2018-06-25 12:45:53 -040065RRECOMMENDS_${PN}_append_x86-64 = " liblsan libtsan"
66RRECOMMENDS_${PN}_append_powerpc64 = " liblsan libtsan"
67RRECOMMENDS_${PN}_append_aarch64 = " liblsan libtsan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068
69do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
70do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
71do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
72
Brad Bishop316dfdd2018-06-25 12:45:53 -040073# Only x86, powerpc, sparc, s390, arm, and aarch64 are supported
74COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux'
75# musl is currently broken entirely
76COMPATIBLE_HOST_libc-musl = 'null'
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077
78FILES_libasan += "${libdir}/libasan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079FILES_libasan-dev += "\
80 ${libdir}/libasan_preinit.o \
81 ${libdir}/libasan.so \
82 ${libdir}/libasan.la \
83"
84FILES_libasan-staticdev += "${libdir}/libasan.a"
85
86FILES_libubsan += "${libdir}/libubsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050087FILES_libubsan-dev += "\
88 ${libdir}/libubsan.so \
89 ${libdir}/libubsan.la \
90"
91FILES_libubsan-staticdev += "${libdir}/libubsan.a"
92
93FILES_liblsan += "${libdir}/liblsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094FILES_liblsan-dev += "\
95 ${libdir}/liblsan.so \
96 ${libdir}/liblsan.la \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080097 ${libdir}/liblsan_preinit.o \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050098"
99FILES_liblsan-staticdev += "${libdir}/liblsan.a"
100
101FILES_libtsan += "${libdir}/libtsan.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500102FILES_libtsan-dev += "\
103 ${libdir}/libtsan.so \
104 ${libdir}/libtsan.la \
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500105 ${libdir}/libtsan_*.o \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500106"
107FILES_libtsan-staticdev += "${libdir}/libtsan.a"
108
109FILES_${PN} = "${libdir}/*.spec ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"