Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | GCCMULTILIB = "--enable-multilib" |
| 2 | require gcc-configure-common.inc |
| 3 | |
| 4 | EXTRA_OECONF_PATHS = "\ |
| 5 | --with-sysroot=/ \ |
| 6 | --with-build-sysroot=${STAGING_DIR_TARGET} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | --with-gxx-include-dir=${includedir}/c++/${BINV} \ |
| 8 | " |
| 9 | |
| 10 | EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu" |
| 11 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 12 | # ARMv6+ adds atomic instructions that affect the ABI in libraries built |
| 13 | # with TUNE_CCARGS in gcc-runtime. Make the compiler default to a |
| 14 | # compatible architecture. armv6 and armv7a cover the minimum tune |
| 15 | # features used in OE. |
| 16 | EXTRA_OECONF_append_armv6 = " --with-arch=armv6" |
| 17 | EXTRA_OECONF_append_armv7a = " --with-arch=armv7-a" |
| 18 | EXTRA_OECONF_append_armv7ve = " --with-arch=armv7-a" |
| 19 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 20 | # libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is |
| 21 | # set in subdir gcc, so subdir libcc1 can't use it, export it here to |
| 22 | # fix the problem. |
| 23 | export gcc_cv_objdump = "${TARGET_PREFIX}objdump" |
| 24 | |
| 25 | EXTRA_OECONF_GCC_FLOAT = "${@get_gcc_float_setting(bb, d)}" |
| 26 | |
| 27 | PACKAGES = "\ |
| 28 | ${PN} ${PN}-plugins ${PN}-symlinks \ |
| 29 | g++ g++-symlinks \ |
| 30 | cpp cpp-symlinks \ |
| 31 | g77 g77-symlinks \ |
| 32 | gfortran gfortran-symlinks \ |
| 33 | gcov gcov-symlinks \ |
| 34 | ${PN}-doc \ |
| 35 | ${PN}-dev \ |
| 36 | ${PN}-dbg \ |
| 37 | " |
| 38 | |
| 39 | FILES_${PN} = "\ |
| 40 | ${bindir}/${TARGET_PREFIX}gcc* \ |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 41 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2* \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 42 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 43 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \ |
| 44 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \ |
| 45 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \ |
| 46 | ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \ |
| 47 | ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \ |
| 48 | ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \ |
| 49 | ${gcclibdir}/${TARGET_SYS}/${BINV}/include \ |
| 50 | ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \ |
| 51 | " |
| 52 | INSANE_SKIP_${PN} += "dev-so" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 53 | RRECOMMENDS_${PN} += "\ |
| 54 | libssp \ |
| 55 | libssp-dev \ |
| 56 | " |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 57 | RDEPENDS_${PN} += "cpp" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 58 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 59 | FILES_${PN}-dev = "\ |
| 60 | ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \ |
| 61 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \ |
| 62 | ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \ |
| 63 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \ |
| 64 | ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \ |
| 65 | " |
| 66 | FILES_${PN}-symlinks = "\ |
| 67 | ${bindir}/cc \ |
| 68 | ${bindir}/gcc \ |
| 69 | ${bindir}/gccbug \ |
| 70 | " |
| 71 | |
| 72 | FILES_${PN}-plugins = "\ |
| 73 | ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \ |
| 74 | " |
| 75 | ALLOW_EMPTY_${PN}-plugins = "1" |
| 76 | |
| 77 | FILES_g77 = "\ |
| 78 | ${bindir}/${TARGET_PREFIX}g77 \ |
| 79 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \ |
| 80 | " |
| 81 | FILES_g77-symlinks = "\ |
| 82 | ${bindir}/g77 \ |
| 83 | ${bindir}/f77 \ |
| 84 | " |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 85 | RRECOMMENDS_g77 = "\ |
| 86 | libg2c \ |
| 87 | libg2c-dev \ |
| 88 | " |
| 89 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 90 | FILES_gfortran = "\ |
| 91 | ${bindir}/${TARGET_PREFIX}gfortran \ |
| 92 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \ |
| 93 | " |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 94 | RRECOMMENDS_gfortran = "\ |
| 95 | libquadmath \ |
| 96 | libquadmath-dev \ |
| 97 | " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 98 | FILES_gfortran-symlinks = "\ |
| 99 | ${bindir}/gfortran \ |
| 100 | ${bindir}/f95" |
| 101 | |
| 102 | FILES_cpp = "\ |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 103 | ${bindir}/${TARGET_PREFIX}cpp* \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 104 | ${base_libdir}/cpp \ |
| 105 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1" |
| 106 | FILES_cpp-symlinks = "${bindir}/cpp" |
| 107 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 108 | FILES_gcov = "${bindir}/${TARGET_PREFIX}gcov* \ |
| 109 | ${bindir}/${TARGET_PREFIX}gcov-tool* \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | " |
| 111 | FILES_gcov-symlinks = "${bindir}/gcov \ |
| 112 | ${bindir}/gcov-tool \ |
| 113 | " |
| 114 | |
| 115 | FILES_g++ = "\ |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 116 | ${bindir}/${TARGET_PREFIX}g++* \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 117 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \ |
| 118 | " |
| 119 | FILES_g++-symlinks = "\ |
| 120 | ${bindir}/c++ \ |
| 121 | ${bindir}/g++ \ |
| 122 | " |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 123 | RRECOMMENDS_g++ = "\ |
| 124 | libstdc++ \ |
| 125 | libstdc++-dev \ |
| 126 | libatomic \ |
| 127 | libatomic-dev \ |
| 128 | " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 129 | |
| 130 | FILES_${PN}-doc = "\ |
| 131 | ${infodir} \ |
| 132 | ${mandir} \ |
| 133 | ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \ |
| 134 | " |
| 135 | |
| 136 | do_compile () { |
| 137 | oe_runmake all-host |
| 138 | } |
| 139 | |
| 140 | do_install () { |
| 141 | oe_runmake 'DESTDIR=${D}' install-host |
| 142 | |
| 143 | # Add unwind.h, it comes from libgcc which we don't want to build again |
| 144 | install ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/unwind.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ |
| 145 | |
| 146 | # Info dir listing isn't interesting at this point so remove it if it exists. |
| 147 | if [ -e "${D}${infodir}/dir" ]; then |
| 148 | rm -f ${D}${infodir}/dir |
| 149 | fi |
| 150 | |
| 151 | # Cleanup some of the ${libdir}{,exec}/gcc stuff ... |
| 152 | rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools |
| 153 | rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools |
| 154 | rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la |
| 155 | rmdir ${D}${includedir} |
| 156 | rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude |
| 157 | |
| 158 | # Hack around specs file assumptions |
| 159 | test -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs && sed -i -e '/^*cross_compile:$/ { n; s/1/0/; }' ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs |
| 160 | |
| 161 | # Cleanup manpages.. |
| 162 | rm -rf ${D}${mandir}/man7 |
| 163 | |
| 164 | cd ${D}${bindir} |
| 165 | |
| 166 | # We care about g++ not c++ |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 167 | rm -f *c++* |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 168 | |
| 169 | # We don't care about the gcc-<version> ones for this |
| 170 | rm -f *gcc-?.?* |
| 171 | |
| 172 | # We use libiberty from binutils |
| 173 | find ${D}${libdir} -name libiberty.a | xargs rm -f |
| 174 | find ${D}${libdir} -name libiberty.h | xargs rm -f |
| 175 | |
| 176 | # Not sure why we end up with these but we don't want them... |
| 177 | rm -f ${TARGET_PREFIX}${TARGET_PREFIX}* |
| 178 | |
| 179 | # Symlinks so we can use these trivially on the target |
| 180 | if [ -e ${TARGET_PREFIX}g77 ]; then |
| 181 | ln -sf ${TARGET_PREFIX}g77 g77 || true |
| 182 | ln -sf g77 f77 || true |
| 183 | fi |
| 184 | if [ -e ${TARGET_PREFIX}gfortran ]; then |
| 185 | ln -sf ${TARGET_PREFIX}gfortran gfortran || true |
| 186 | ln -sf gfortran f95 || true |
| 187 | fi |
| 188 | ln -sf ${TARGET_PREFIX}g++ g++ |
| 189 | ln -sf ${TARGET_PREFIX}gcc gcc |
| 190 | ln -sf ${TARGET_PREFIX}cpp cpp |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 191 | ln -sf ${TARGET_PREFIX}gcov gcov |
| 192 | ln -sf ${TARGET_PREFIX}gcov-tool gcov-tool |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 193 | install -d ${D}${base_libdir} |
| 194 | ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp |
| 195 | ln -sf g++ c++ |
| 196 | ln -sf gcc cc |
| 197 | |
| 198 | chown -R root:root ${D} |
| 199 | } |
| 200 | |
| 201 | do_install_append () { |
| 202 | # |
| 203 | # Thefixinc.sh script, run on the gcc's compile phase, looks into sysroot header |
| 204 | # files and places the modified files into |
| 205 | # {D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed folder. This makes the |
| 206 | # build not deterministic. The following code prunes all those headers |
| 207 | # except those under include-fixed/linux, *limits.h and README, yielding |
| 208 | # the same include-fixed folders no matter what sysroot |
| 209 | |
| 210 | include_fixed="${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed" |
| 211 | for f in $(find ${include_fixed} -type f); do |
| 212 | case $f in |
| 213 | */include-fixed/linux/*) |
| 214 | continue |
| 215 | ;; |
| 216 | */include-fixed/*limits.h) |
| 217 | continue |
| 218 | ;; |
| 219 | */include-fixed/README) |
| 220 | continue |
| 221 | ;; |
| 222 | *) |
| 223 | # remove file and directory if empty |
| 224 | bbdebug 2 "Pruning $f" |
| 225 | rm $f |
| 226 | find $(dirname $f) -maxdepth 0 -empty -exec rmdir {} \; |
| 227 | ;; |
| 228 | esac |
| 229 | done |
| 230 | } |
| 231 | |
| 232 | # Installing /usr/lib/gcc/* means we'd have two copies, one from gcc-cross |
| 233 | # and one from here. These can confuse gcc cross where includes use #include_next |
| 234 | # and builds track file dependencies (e.g. perl and its makedepends code). |
| 235 | # For determinism we don't install this ever and rely on the copy from gcc-cross. |
| 236 | # [YOCTO #7287] |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 237 | SYSROOT_DIRS_BLACKLIST += "${libdir}/gcc" |