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