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