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