summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-cross-canadian.inc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian.inc157
1 files changed, 157 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 0000000..89f8dc5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -0,0 +1,157 @@
1inherit cross-canadian
2
3SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)"
4PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
5BPN = "gcc"
6
7DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc nativesdk-gettext"
8
9GCCMULTILIB = "--enable-multilib"
10
11require gcc-configure-common.inc
12
13EXTRA_OECONF_PATHS = "--with-gxx-include-dir=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}${target_includedir}/c++ \
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# We have to point gcc at a sysroot but we don't need to rebuild if this changes
18# e.g. we switch between different machines with different tunes.
19EXTRA_OECONF_PATHS[vardepsexclude] = "TUNE_PKGARCH"
20TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
21get_gcc_fpu_setting[vardepvalue] = ""
22
23#
24# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky
25# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse.
26#
27export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
28export AS_FOR_TARGET = "${TARGET_PREFIX}as"
29export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool"
30export CC_FOR_TARGET = "${TARGET_PREFIX}gcc"
31export CXX_FOR_TARGET = "${TARGET_PREFIX}g++"
32export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
33export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo"
34export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
35export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump"
36export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
37export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip"
38export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
39
40#
41# We need to override this and make sure the compiler can find staging
42#
43export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
44
45do_configure () {
46 export CC_FOR_BUILD="${BUILD_CC}"
47 export CXX_FOR_BUILD="${BUILD_CXX}"
48 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
49 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
50 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
51 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
52 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
53 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
54 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
55 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
56 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
57 oe_runconf
58}
59
60do_compile () {
61 oe_runmake all-host
62}
63
64INHIBIT_PACKAGE_STRIP = "1"
65
66# Having anything auto depending on gcc-cross-sdk is a really bad idea...
67EXCLUDE_FROM_SHLIBS = "1"
68
69PACKAGES = "${PN} ${PN}-doc"
70
71FILES_${PN} = "\
72 ${bindir}/* \
73 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/* \
74 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
75 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
76 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \
77 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
78 ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
79 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
80 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \
81 ${includedir}/c++/${BINV} \
82 ${prefix}/${TARGET_SYS}/bin/* \
83 ${prefix}/${TARGET_SYS}/lib/* \
84 ${prefix}/${TARGET_SYS}/usr/include/* \
85 "
86INSANE_SKIP_${PN} += "dev-so"
87
88FILES_${PN}-doc = "\
89 ${infodir} \
90 ${mandir} \
91 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
92 "
93
94EXEEXT = ""
95
96# Compute how to get from libexecdir to bindir in python (easier than shell)
97BINRELPATH = "${@os.path.relpath(d.expand("${bindir}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}"
98
99do_install () {
100 oe_runmake 'DESTDIR=${D}' install-host
101
102 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
103 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
104 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
105 rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
106
107 # We care about g++ not c++
108 rm -f ${D}${bindir}/*c++
109
110 # We don't care about the gcc-<version> copies
111 rm -f ${D}${bindir}/*gcc-?.?*
112
113 # We use libiberty from binutils
114 rm -f ${D}${prefix}/${TARGET_SYS}/lib/libiberty.a
115 # Not sure where the strange paths come from
116 rm -f ${D}${libdir}/../lib/libiberty.a
117 rm -f ${D}${libdir}/libiberty.a
118
119 # Cleanup empty directories which are not shipped
120 # we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted
121 # ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686
122 local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}"
123 for i in $empty_dirs; do
124 [ -d $i ] && rmdir --ignore-fail-on-non-empty $i
125 done
126
127 # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
128 # found.
129 dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
130 install -d $dest
131 suffix=${EXEEXT}
132 for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
133 if [ "$t" = "g77" -o "$t" = "gfortran" ] && [ ! -e ${D}${bindir}/${TARGET_PREFIX}$t$suffix ]; then
134 continue
135 fi
136
137 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix
138 done
139
140 chown -R root:root ${D}
141}
142
143ELFUTILS = "nativesdk-elfutils"
144DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib"
145RDEPENDS_${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}"
146
147SYSTEMHEADERS = "/usr/include"
148SYSTEMLIBS = "${target_base_libdir}/"
149SYSTEMLIBS1 = "${target_libdir}/"
150
151EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \
152 --disable-libgomp --disable-libmudflap \
153 --with-mpfr=${STAGING_DIR_HOST}${layout_exec_prefix} \
154 --with-mpc=${STAGING_DIR_HOST}${layout_exec_prefix}"
155
156# gcc 4.7 needs -isystem
157export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"