blob: 22c1d78dd149b114f8de4b83cdc23f1e331d726e [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001require gcc-configure-common.inc
2
Patrick Williamsc0f7c042017-02-23 20:41:17 -06003SUMMARY = "Runtime libraries from GCC"
4
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05005# Over-ride the LICENSE set by gcc-${PV}.inc to remove "& GPLv3"
6# All gcc-runtime packages are now covered by the runtime exception.
7LICENSE = "GPL-3.0-with-GCC-exception"
8
9CXXFLAGS_remove = "-fvisibility-inlines-hidden"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010
11EXTRA_OECONF_PATHS = "\
12 --with-gxx-include-dir=${includedir}/c++/${BINV} \
13 --with-sysroot=/not/exist \
14 --with-build-sysroot=${STAGING_DIR_TARGET} \
15"
16
17EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
Brad Bishop19323692019-04-05 15:28:33 -040018EXTRA_OECONF_append = " --cache-file=${B}/config.cache"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019
Brad Bishop08902b02019-08-20 09:16:51 -040020# Disable ifuncs for libatomic on arm conflicts -march/-mcpu
21EXTRA_OECONF_append_arm = " libat_cv_have_ifunc=no "
22
23# Building with thumb enabled on armv6t fails
24ARM_INSTRUCTION_SET_armv6 = "arm"
25
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050026RUNTIMELIBITM = "libitm"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080027RUNTIMELIBITM_arc = ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -050028RUNTIMELIBITM_mipsarch = ""
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050029RUNTIMELIBITM_nios2 = ""
30RUNTIMELIBITM_microblaze = ""
Brad Bishop00111322018-04-01 22:23:53 -040031RUNTIMELIBITM_riscv32 = ""
32RUNTIMELIBITM_riscv64 = ""
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080033RUNTIMELIBSSP ?= ""
34RUNTIMELIBSSP_mingw32 ?= "libssp"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050035
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080036RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050037 ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \
38"
39
Patrick Williamsc124f4f2015-09-15 14:41:29 -050040# libiberty
41# libmudflap
42# libgfortran needs separate recipe due to libquadmath dependency
43
Brad Bishop316dfdd2018-06-25 12:45:53 -040044SLIB = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
45SLIB_NEW = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
46
47DEBUG_PREFIX_MAP_class-target = " \
48 -fdebug-prefix-map=${WORKDIR}/recipe-sysroot= \
49 -fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \
50 -fdebug-prefix-map=${SLIB}=${SLIB_NEW} \
51 -fdebug-prefix-map=${SLIB}/include=${SLIB_NEW}/libstdc++-v3/../include \
52 -fdebug-prefix-map=${SLIB}/libiberty=${SLIB_NEW}/libstdc++-v3/../libiberty \
53 -fdebug-prefix-map=${B}=${SLIB_NEW} \
54 "
55
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056do_configure () {
57 export CXX="${CXX} -nostdinc++ -nostdlib++"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058 for d in libgcc ${RUNTIMETARGET}; do
59 echo "Configuring $d"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050060 rm -rf ${B}/${TARGET_SYS}/$d/
61 mkdir -p ${B}/${TARGET_SYS}/$d/
62 cd ${B}/${TARGET_SYS}/$d/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050063 chmod a+x ${S}/$d/configure
Brad Bishop6e60e8b2018-02-01 10:27:11 -050064 relpath=${@os.path.relpath("${S}/$d", "${B}/${TARGET_SYS}/$d")}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050065 $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Brad Bishopd7bf8c12018-02-25 22:55:05 -050066 if [ "$d" = "libgcc" ]; then
67 (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
68 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069 done
70}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050071EXTRACONFFUNCS += "extract_stashed_builddir"
72do_configure[depends] += "${COMPILERDEP}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050073
74do_compile () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075 for d in libgcc ${RUNTIMETARGET}; do
Brad Bishop6e60e8b2018-02-01 10:27:11 -050076 cd ${B}/${TARGET_SYS}/$d/
77 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078 done
79}
80
81do_install () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050082 for d in ${RUNTIMETARGET}; do
Brad Bishop6e60e8b2018-02-01 10:27:11 -050083 cd ${B}/${TARGET_SYS}/$d/
84 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ install
Patrick Williamsc124f4f2015-09-15 14:41:29 -050085 done
Brad Bishop08902b02019-08-20 09:16:51 -040086 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
87 install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include
88 mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
89 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include
90 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091 rm -rf ${D}${infodir}/libgomp.info ${D}${infodir}/dir
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050092 rm -rf ${D}${infodir}/libitm.info ${D}${infodir}/dir
Patrick Williamsc124f4f2015-09-15 14:41:29 -050093 rm -rf ${D}${infodir}/libquadmath.info ${D}${infodir}/dir
94 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
95 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
96 fi
97 if [ -d ${D}${infodir} ]; then
98 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
99 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600100}
101
102do_install_append_class-target () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500103 if [ "${TARGET_OS}" = "linux-gnuspe" ]; then
104 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
105 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600106
107 if [ "${TARGET_OS}" = "linux-gnun32" ]; then
Brad Bishopf3fd2882019-06-21 08:06:37 -0400108 if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
109 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux
110 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/32
111 elif [ "${MULTILIB_VARIANTS}" != "" ]; then
112 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
113 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600114 else
115 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
116 fi
Brad Bishopf3fd2882019-06-21 08:06:37 -0400117 elif [ "${TARGET_OS}" = "linux-gnux32" ]; then
118 if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
119 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux
120 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/x32
121 elif [ "${MULTILIB_VARIANTS}" != "" ]; then
122 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
123 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600124 else
125 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
126 fi
Brad Bishopf3fd2882019-06-21 08:06:37 -0400127 elif [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
Brad Bishopc8f47122019-06-24 09:36:18 -0400128 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}
Brad Bishopf3fd2882019-06-21 08:06:37 -0400129 ln -s ../${TARGET_SYS}/bits ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/bits
130 ln -s ../${TARGET_SYS}/ext ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/ext
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600131 fi
132
133 if [ "${TCLIBC}" != "glibc" ]; then
134 case "${TARGET_OS}" in
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500135 "linux-musl" | "linux-*spe") extra_target_os="linux";;
136 "linux-musleabi") extra_target_os="linux-gnueabi";;
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600137 *) extra_target_os="linux";;
138 esac
139 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
140 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500141 chown -R root:root ${D}
142}
143
144INHIBIT_DEFAULT_DEPS = "1"
Brad Bishop19323692019-04-05 15:28:33 -0400145DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc virtual/${MLPREFIX}libc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500146PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
147
148BBCLASSEXTEND = "nativesdk"
149
150PACKAGES = "\
151 ${PN}-dbg \
152 libstdc++ \
153 libstdc++-precompile-dev \
154 libstdc++-dev \
155 libstdc++-staticdev \
156 libg2c \
157 libg2c-dev \
158 libssp \
159 libssp-dev \
160 libssp-staticdev \
161 libmudflap \
162 libmudflap-dev \
163 libmudflap-staticdev \
164 libquadmath \
165 libquadmath-dev \
166 libquadmath-staticdev \
167 libgomp \
168 libgomp-dev \
169 libgomp-staticdev \
170 libatomic \
171 libatomic-dev \
172 libatomic-staticdev \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500173 libitm \
174 libitm-dev \
175 libitm-staticdev \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500176"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500177# The base package doesn't exist, so we clear the recommends.
178RRECOMMENDS_${PN}-dbg = ""
179
180# include python debugging scripts
181FILES_${PN}-dbg += "\
182 ${libdir}/libstdc++.so.*-gdb.py \
183 ${datadir}/gcc-${BINV}/python/libstdcxx \
184"
185
186FILES_libg2c = "${target_libdir}/libg2c.so.*"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600187SUMMARY_libg2c = "Companion runtime library for g77"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500188FILES_libg2c-dev = "\
189 ${libdir}/libg2c.so \
190 ${libdir}/libg2c.a \
191 ${libdir}/libfrtbegin.a \
192"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600193SUMMARY_libg2c-dev = "Companion runtime library for g77 - development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500194
195FILES_libstdc++ = "${libdir}/libstdc++.so.*"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600196SUMMARY_libstdc++ = "GNU standard C++ library"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500197FILES_libstdc++-dev = "\
198 ${includedir}/c++/ \
199 ${libdir}/libstdc++.so \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500200 ${libdir}/libstdc++*.la \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500201 ${libdir}/libsupc++.la \
202"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600203SUMMARY_libstdc++-dev = "GNU standard C++ library - development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500204FILES_libstdc++-staticdev = "\
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500205 ${libdir}/libstdc++*.a \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500206 ${libdir}/libsupc++.a \
207"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600208SUMMARY_libstdc++-staticdev = "GNU standard C++ library - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500209
210FILES_libstdc++-precompile-dev = "${includedir}/c++/${TARGET_SYS}/bits/*.gch"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600211SUMMARY_libstdc++-precompile-dev = "GNU standard C++ library - precompiled header files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500212
213FILES_libssp = "${libdir}/libssp.so.*"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600214SUMMARY_libssp = "GNU stack smashing protection library"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500215FILES_libssp-dev = "\
216 ${libdir}/libssp*.so \
217 ${libdir}/libssp*_nonshared.a \
218 ${libdir}/libssp*.la \
Brad Bishop08902b02019-08-20 09:16:51 -0400219 ${libdir}/${TARGET_SYS}/${BINV}/include/ssp \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500220"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600221SUMMARY_libssp-dev = "GNU stack smashing protection library - development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500222FILES_libssp-staticdev = "${libdir}/libssp*.a"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600223SUMMARY_libssp-staticdev = "GNU stack smashing protection library - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500224
225FILES_libquadmath = "${libdir}/libquadmath*.so.*"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600226SUMMARY_libquadmath = "GNU quad-precision math library"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500227FILES_libquadmath-dev = "\
Brad Bishop08902b02019-08-20 09:16:51 -0400228 ${libdir}/${TARGET_SYS}/${BINV}/include/quadmath* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500229 ${libdir}/libquadmath*.so \
230 ${libdir}/libquadmath.la \
231"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600232SUMMARY_libquadmath-dev = "GNU quad-precision math library - development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500233FILES_libquadmath-staticdev = "${libdir}/libquadmath.a"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600234SUMMARY_libquadmath-staticdev = "GNU quad-precision math library - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500235
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600236# NOTE: mudflap has been removed as of gcc 4.9 and has been superseded by the address sanitiser
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500237FILES_libmudflap = "${libdir}/libmudflap*.so.*"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600238SUMMARY_libmudflap = "Pointer debugging library for gcc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500239FILES_libmudflap-dev = "\
240 ${libdir}/libmudflap*.so \
241 ${libdir}/libmudflap.la \
242"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600243SUMMARY_libmudflap-dev = "Pointer debugging library for gcc - development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500244FILES_libmudflap-staticdev = "${libdir}/libmudflap.a"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600245SUMMARY_libmudflap-staticdev = "Pointer debugging library for gcc - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500246
247FILES_libgomp = "${libdir}/libgomp*${SOLIBS}"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600248SUMMARY_libgomp = "GNU OpenMP parallel programming library"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500249FILES_libgomp-dev = "\
250 ${libdir}/libgomp*${SOLIBSDEV} \
251 ${libdir}/libgomp*.la \
252 ${libdir}/libgomp.spec \
Brad Bishop08902b02019-08-20 09:16:51 -0400253 ${libdir}/${TARGET_SYS}/${BINV}/include/omp.h \
254 ${libdir}/${TARGET_SYS}/${BINV}/include/openacc.h \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500255"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600256SUMMARY_libgomp-dev = "GNU OpenMP parallel programming library - development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500257FILES_libgomp-staticdev = "${libdir}/libgomp*.a"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600258SUMMARY_libgomp-staticdev = "GNU OpenMP parallel programming library - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500259
260FILES_libatomic = "${libdir}/libatomic.so.*"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600261SUMMARY_libatomic = "GNU C++11 atomics support library"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500262FILES_libatomic-dev = "\
263 ${libdir}/libatomic.so \
264 ${libdir}/libatomic.la \
265"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600266SUMMARY_libatomic-dev = "GNU C++11 atomics support library - development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500267FILES_libatomic-staticdev = "${libdir}/libatomic.a"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600268SUMMARY_libatomic-staticdev = "GNU C++11 atomics support library - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500269
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500270FILES_libitm = "${libdir}/libitm.so.*"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600271SUMMARY_libitm = "GNU transactional memory support library"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500272FILES_libitm-dev = "\
273 ${libdir}/libitm.so \
274 ${libdir}/libitm.la \
275 ${libdir}/libitm.spec \
276"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600277SUMMARY_libitm-dev = "GNU transactional memory support library - development files"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500278FILES_libitm-staticdev = "${libdir}/libitm.a"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600279SUMMARY_libitm-staticdev = "GNU transactional memory support library - static development files"