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