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