diff options
| author | Mark Hatle <mark.hatle@xilinx.com> | 2021-10-12 15:10:47 -0700 |
|---|---|---|
| committer | Mark Hatle <mark.hatle@xilinx.com> | 2021-10-25 14:53:19 -0700 |
| commit | 2c819946b5258291d1725dabb3f5180d36971bd6 (patch) | |
| tree | d24e588ea770969caad776876e203525e7fce843 /meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc | |
| parent | 7f12056ccc3a978e9b69c380bffc3c04ee20520e (diff) | |
| download | meta-xilinx-2c819946b5258291d1725dabb3f5180d36971bd6.tar.gz | |
gcc: Import gatesgarth version, converted to new variable syntax
Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Diffstat (limited to 'meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc')
| -rw-r--r-- | meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc new file mode 100644 index 00000000..12310335 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc | |||
| @@ -0,0 +1,181 @@ | |||
| 1 | inherit cross-canadian | ||
| 2 | |||
| 3 | SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)" | ||
| 4 | PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
| 5 | |||
| 6 | DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc-crosssdk virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-libc nativesdk-gettext flex-native virtual/libc" | ||
| 7 | |||
| 8 | GCCMULTILIB = "--enable-multilib" | ||
| 9 | |||
| 10 | require gcc-configure-common.inc | ||
| 11 | |||
| 12 | EXTRA_OECONF_PATHS = "\ | ||
| 13 | --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \ | ||
| 14 | --with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \ | ||
| 15 | --with-sysroot=/not/exist \ | ||
| 16 | --with-build-sysroot=${STAGING_DIR_TARGET} \ | ||
| 17 | " | ||
| 18 | # We have to point gcc at a sysroot but we don't need to rebuild if this changes | ||
| 19 | # e.g. we switch between different machines with different tunes. | ||
| 20 | EXTRA_OECONF_PATHS[vardepsexclude] = "TUNE_PKGARCH" | ||
| 21 | TARGET_ARCH[vardepsexclude] = "TUNE_ARCH" | ||
| 22 | get_gcc_float_setting[vardepvalue] = "" | ||
| 23 | |||
| 24 | # | ||
| 25 | # gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky | ||
| 26 | # for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse. | ||
| 27 | # | ||
| 28 | export AR_FOR_TARGET = "${TARGET_PREFIX}ar" | ||
| 29 | export AS_FOR_TARGET = "${TARGET_PREFIX}as" | ||
| 30 | export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool" | ||
| 31 | export CC_FOR_TARGET = "${TARGET_PREFIX}gcc" | ||
| 32 | export CXX_FOR_TARGET = "${TARGET_PREFIX}g++" | ||
| 33 | export GCC_FOR_TARGET = "${TARGET_PREFIX}gcc" | ||
| 34 | export LD_FOR_TARGET = "${TARGET_PREFIX}ld" | ||
| 35 | export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo" | ||
| 36 | export NM_FOR_TARGET = "${TARGET_PREFIX}nm" | ||
| 37 | export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump" | ||
| 38 | export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib" | ||
| 39 | export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip" | ||
| 40 | export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres" | ||
| 41 | |||
| 42 | # | ||
| 43 | # We need to override this and make sure the compiler can find staging | ||
| 44 | # | ||
| 45 | export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}" | ||
| 46 | |||
| 47 | do_configure () { | ||
| 48 | export CC_FOR_BUILD="${BUILD_CC}" | ||
| 49 | export CXX_FOR_BUILD="${BUILD_CXX}" | ||
| 50 | export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}" | ||
| 51 | export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}" | ||
| 52 | export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}" | ||
| 53 | export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}" | ||
| 54 | export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}" | ||
| 55 | export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}" | ||
| 56 | export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}" | ||
| 57 | export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}" | ||
| 58 | oe_runconf | ||
| 59 | } | ||
| 60 | |||
| 61 | do_compile () { | ||
| 62 | oe_runmake all-host configure-target-libgcc | ||
| 63 | (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h) | ||
| 64 | } | ||
| 65 | |||
| 66 | PACKAGES = "${PN}-dbg ${PN} ${PN}-doc" | ||
| 67 | |||
| 68 | FILES:${PN} = "\ | ||
| 69 | ${exec_prefix}/bin/* \ | ||
| 70 | ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/* \ | ||
| 71 | ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \ | ||
| 72 | ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \ | ||
| 73 | ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \ | ||
| 74 | ${gcclibdir}/${TARGET_SYS}/${BINV}/include \ | ||
| 75 | ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \ | ||
| 76 | ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \ | ||
| 77 | ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \ | ||
| 78 | ${includedir}/c++/${BINV} \ | ||
| 79 | ${prefix}/${TARGET_SYS}/bin/* \ | ||
| 80 | ${prefix}/${TARGET_SYS}/lib/* \ | ||
| 81 | ${prefix}/${TARGET_SYS}${target_includedir}/* \ | ||
| 82 | " | ||
| 83 | INSANE_SKIP:${PN} += "dev-so" | ||
| 84 | |||
| 85 | FILES:${PN}-doc = "\ | ||
| 86 | ${infodir} \ | ||
| 87 | ${mandir} \ | ||
| 88 | ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \ | ||
| 89 | " | ||
| 90 | |||
| 91 | EXEEXT = "" | ||
| 92 | |||
| 93 | # Compute how to get from libexecdir to bindir in python (easier than shell) | ||
| 94 | BINRELPATH = "${@os.path.relpath(d.expand("${bindir}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}" | ||
| 95 | |||
| 96 | do_install () { | ||
| 97 | ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h ) | ||
| 98 | oe_runmake 'DESTDIR=${D}' install-host | ||
| 99 | |||
| 100 | # Cleanup some of the ${libdir}{,exec}/gcc stuff ... | ||
| 101 | rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools | ||
| 102 | rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools | ||
| 103 | rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude | ||
| 104 | |||
| 105 | # We care about g++ not c++ | ||
| 106 | rm -f ${D}${bindir}/*c++ | ||
| 107 | |||
| 108 | # We don't care about the gcc-<version> copies | ||
| 109 | rm -f ${D}${bindir}/*gcc-${BINV}* | ||
| 110 | |||
| 111 | # Cleanup empty directories which are not shipped | ||
| 112 | # we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted | ||
| 113 | # ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686 | ||
| 114 | local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}" | ||
| 115 | for i in $empty_dirs; do | ||
| 116 | [ -d $i ] && rmdir --ignore-fail-on-non-empty $i | ||
| 117 | done | ||
| 118 | |||
| 119 | # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are | ||
| 120 | # found. | ||
| 121 | dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/ | ||
| 122 | install -d $dest | ||
| 123 | suffix=${EXEEXT} | ||
| 124 | for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do | ||
| 125 | if [ "$t" = "g77" -o "$t" = "gfortran" ] && [ ! -e ${D}${bindir}/${TARGET_PREFIX}$t$suffix ]; then | ||
| 126 | continue | ||
| 127 | fi | ||
| 128 | |||
| 129 | ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix | ||
| 130 | done | ||
| 131 | t=real-ld | ||
| 132 | ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld$suffix $dest$t$suffix | ||
| 133 | |||
| 134 | # libquadmath headers need to be available in the gcc libexec dir | ||
| 135 | install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
| 136 | cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
| 137 | cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
| 138 | |||
| 139 | chown -R root:root ${D} | ||
| 140 | |||
| 141 | cross_canadian_bindirlinks | ||
| 142 | |||
| 143 | for i in linux ${CANADIANEXTRAOS} | ||
| 144 | do | ||
| 145 | for v in ${CANADIANEXTRAVENDOR} | ||
| 146 | do | ||
| 147 | d=${D}${bindir}/../${TARGET_ARCH}$v-$i | ||
| 148 | install -d $d | ||
| 149 | for j in ${TARGET_PREFIX}gcc${EXEEXT} ${TARGET_PREFIX}g++${EXEEXT} | ||
| 150 | do | ||
| 151 | p=${TARGET_ARCH}$v-$i-`echo $j | sed -e s,${TARGET_PREFIX},,` | ||
| 152 | case $i in | ||
| 153 | *musl*) | ||
| 154 | rm -rf $d/$p | ||
| 155 | echo "#!/usr/bin/env sh" > $d/$p | ||
| 156 | echo "exec \`dirname \$0\`/../${TARGET_SYS}/$j -mmusl \$@" >> $d/$p | ||
| 157 | chmod 0755 $d/$p | ||
| 158 | ;; | ||
| 159 | *) | ||
| 160 | ;; | ||
| 161 | esac | ||
| 162 | done | ||
| 163 | done | ||
| 164 | done | ||
| 165 | } | ||
| 166 | |||
| 167 | ELFUTILS = "nativesdk-elfutils" | ||
| 168 | DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib" | ||
| 169 | RDEPENDS:${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}" | ||
| 170 | |||
| 171 | SYSTEMHEADERS = "${target_includedir}/" | ||
| 172 | SYSTEMLIBS = "${target_base_libdir}/" | ||
| 173 | SYSTEMLIBS1 = "${target_libdir}/" | ||
| 174 | |||
| 175 | EXTRA_OECONF += "--enable-poison-system-directories" | ||
| 176 | EXTRA_OECONF:remove:elf = "--with-sysroot=/not/exist" | ||
| 177 | EXTRA_OECONF:remove:eabi = "--with-sysroot=/not/exist" | ||
| 178 | EXTRA_OECONF:append:elf = " --without-headers --with-newlib" | ||
| 179 | EXTRA_OECONF:append:eabi = " --without-headers --with-newlib" | ||
| 180 | # gcc 4.7 needs -isystem | ||
| 181 | export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}" | ||
