diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-cross-canadian.inc')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc new file mode 100644 index 0000000000..e633107d52 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc | |||
@@ -0,0 +1,168 @@ | |||
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}binutils-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc nativesdk-gettext" | ||
7 | |||
8 | GCCMULTILIB = "--enable-multilib" | ||
9 | |||
10 | require gcc-configure-common.inc | ||
11 | |||
12 | EXTRA_OECONF_PATHS = "\ | ||
13 | --with-gxx-include-dir=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}${target_includedir}/c++/${BINV} \ | ||
14 | --with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \ | ||
15 | --with-sysroot=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS} \ | ||
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 | } | ||
64 | |||
65 | INHIBIT_PACKAGE_STRIP = "1" | ||
66 | |||
67 | # Having anything auto depending on gcc-cross-sdk is a really bad idea... | ||
68 | EXCLUDE_FROM_SHLIBS = "1" | ||
69 | |||
70 | PACKAGES = "${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 | ${includedir}/c++/${BINV} \ | ||
83 | ${prefix}/${TARGET_SYS}/bin/* \ | ||
84 | ${prefix}/${TARGET_SYS}/lib/* \ | ||
85 | ${prefix}/${TARGET_SYS}/usr/include/* \ | ||
86 | " | ||
87 | INSANE_SKIP_${PN} += "dev-so" | ||
88 | |||
89 | FILES_${PN}-doc = "\ | ||
90 | ${infodir} \ | ||
91 | ${mandir} \ | ||
92 | ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \ | ||
93 | " | ||
94 | |||
95 | EXEEXT = "" | ||
96 | |||
97 | # Compute how to get from libexecdir to bindir in python (easier than shell) | ||
98 | BINRELPATH = "${@os.path.relpath(d.expand("${bindir}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}" | ||
99 | |||
100 | do_install () { | ||
101 | ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h ) | ||
102 | oe_runmake 'DESTDIR=${D}' install-host | ||
103 | |||
104 | # Cleanup some of the ${libdir}{,exec}/gcc stuff ... | ||
105 | rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools | ||
106 | rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools | ||
107 | rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude | ||
108 | |||
109 | # We care about g++ not c++ | ||
110 | rm -f ${D}${bindir}/*c++ | ||
111 | |||
112 | # We don't care about the gcc-<version> copies | ||
113 | rm -f ${D}${bindir}/*gcc-?.?* | ||
114 | |||
115 | # We use libiberty from binutils | ||
116 | rm -f ${D}${prefix}/${TARGET_SYS}/lib/libiberty.a | ||
117 | # Not sure where the strange paths come from | ||
118 | rm -f ${D}${libdir}/../lib/libiberty.a | ||
119 | rm -f ${D}${libdir}/libiberty.a | ||
120 | |||
121 | # Cleanup empty directories which are not shipped | ||
122 | # we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted | ||
123 | # ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686 | ||
124 | local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}" | ||
125 | for i in $empty_dirs; do | ||
126 | [ -d $i ] && rmdir --ignore-fail-on-non-empty $i | ||
127 | done | ||
128 | |||
129 | # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are | ||
130 | # found. | ||
131 | dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/ | ||
132 | install -d $dest | ||
133 | suffix=${EXEEXT} | ||
134 | for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do | ||
135 | if [ "$t" = "g77" -o "$t" = "gfortran" ] && [ ! -e ${D}${bindir}/${TARGET_PREFIX}$t$suffix ]; then | ||
136 | continue | ||
137 | fi | ||
138 | |||
139 | ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix | ||
140 | done | ||
141 | |||
142 | # libquadmath headers need to be available in the gcc libexec dir | ||
143 | install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
144 | cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
145 | cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
146 | |||
147 | chown -R root:root ${D} | ||
148 | |||
149 | cross_canadian_bindirlinks | ||
150 | } | ||
151 | |||
152 | ELFUTILS = "nativesdk-elfutils" | ||
153 | DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib" | ||
154 | RDEPENDS_${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}" | ||
155 | |||
156 | SYSTEMHEADERS = "/usr/include" | ||
157 | SYSTEMLIBS = "${target_base_libdir}/" | ||
158 | SYSTEMLIBS1 = "${target_libdir}/" | ||
159 | |||
160 | EXTRA_OECONF += "--enable-poison-system-directories" | ||
161 | |||
162 | EXTRA_OECONF += "\ | ||
163 | --with-mpfr=${STAGING_DIR_HOST}${layout_exec_prefix} \ | ||
164 | --with-mpc=${STAGING_DIR_HOST}${layout_exec_prefix} \ | ||
165 | " | ||
166 | |||
167 | # gcc 4.7 needs -isystem | ||
168 | export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}" | ||