diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 14:36:22 +0200 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 15:32:53 +0200 |
commit | f4cf9fe05bb3f32fabea4e54dd92d368967a80da (patch) | |
tree | 487180fa9866985ea7b28e625651765d86f515c3 /meta/recipes-devtools/gcc/gcc-cross.inc | |
download | poky-f4cf9fe05bb3f32fabea4e54dd92d368967a80da.tar.gz |
initial commit for Enea Linux 4.0
Migrated from the internal git server on the daisy-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-cross.inc')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-cross.inc | 190 |
1 files changed, 190 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc new file mode 100644 index 0000000000..777c970217 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-cross.inc | |||
@@ -0,0 +1,190 @@ | |||
1 | inherit cross | ||
2 | |||
3 | INHIBIT_DEFAULT_DEPS = "1" | ||
4 | EXTRADEPENDS = "" | ||
5 | DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc ${EXTRADEPENDS} ${NATIVEDEPS}" | ||
6 | PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" | ||
7 | python () { | ||
8 | if d.getVar("TARGET_OS", True).startswith("linux"): | ||
9 | d.setVar("EXTRADEPENDS", "linux-libc-headers") | ||
10 | } | ||
11 | |||
12 | require gcc-configure-common.inc | ||
13 | |||
14 | EXTRA_OECONF += " --enable-poison-system-directories" | ||
15 | EXTRA_OECONF_append_sh4 = " --with-multilib-list= --enable-incomplete-targets " | ||
16 | |||
17 | EXTRA_OECONF += "--disable-libunwind-exceptions \ | ||
18 | --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} \ | ||
19 | --with-system-zlib " | ||
20 | |||
21 | EXTRA_OECONF_PATHS = " \ | ||
22 | --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \ | ||
23 | --with-sysroot=${STAGING_DIR_TARGET} \ | ||
24 | --with-build-sysroot=${STAGING_DIR_TARGET}" | ||
25 | |||
26 | ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}" | ||
27 | |||
28 | do_configure_prepend () { | ||
29 | sed -i 's/BUILD_INFO=info/BUILD_INFO=/' ${S}/gcc/configure | ||
30 | } | ||
31 | |||
32 | do_compile () { | ||
33 | export CC="${BUILD_CC}" | ||
34 | export AR_FOR_TARGET="${TARGET_SYS}-ar" | ||
35 | export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib" | ||
36 | export LD_FOR_TARGET="${TARGET_SYS}-ld" | ||
37 | export NM_FOR_TARGET="${TARGET_SYS}-nm" | ||
38 | export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}" | ||
39 | export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}" | ||
40 | export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}" | ||
41 | export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}" | ||
42 | export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}" | ||
43 | |||
44 | oe_runmake all-host all-target-libgcc | ||
45 | # now generate script to drive testing | ||
46 | echo "#!/usr/bin/env sh" >${B}/${TARGET_PREFIX}testgcc | ||
47 | set >> ${B}/${TARGET_PREFIX}testgcc | ||
48 | # prune out the unneeded vars | ||
49 | sed -i -e "/^BASH/d" ${B}/${TARGET_PREFIX}testgcc | ||
50 | sed -i -e "/^USER/d" ${B}/${TARGET_PREFIX}testgcc | ||
51 | sed -i -e "/^OPT/d" ${B}/${TARGET_PREFIX}testgcc | ||
52 | sed -i -e "/^DIRSTACK/d" ${B}/${TARGET_PREFIX}testgcc | ||
53 | sed -i -e "/^EUID/d" ${B}/${TARGET_PREFIX}testgcc | ||
54 | sed -i -e "/^FUNCNAME/d" ${B}/${TARGET_PREFIX}testgcc | ||
55 | sed -i -e "/^GROUPS/d" ${B}/${TARGET_PREFIX}testgcc | ||
56 | sed -i -e "/^HOST/d" ${B}/${TARGET_PREFIX}testgcc | ||
57 | sed -i -e "/^HOME/d" ${B}/${TARGET_PREFIX}testgcc | ||
58 | sed -i -e "/^IFS/d" ${B}/${TARGET_PREFIX}testgcc | ||
59 | sed -i -e "/^LC_ALL/d" ${B}/${TARGET_PREFIX}testgcc | ||
60 | sed -i -e "/^LOGNAME/d" ${B}/${TARGET_PREFIX}testgcc | ||
61 | sed -i -e "/^MACHTYPE/d" ${B}/${TARGET_PREFIX}testgcc | ||
62 | sed -i -e "/^OSTYPE/d" ${B}/${TARGET_PREFIX}testgcc | ||
63 | sed -i -e "/^PIPE/d" ${B}/${TARGET_PREFIX}testgcc | ||
64 | sed -i -e "/^SHELL/d" ${B}/${TARGET_PREFIX}testgcc | ||
65 | sed -i -e "/^'/d" ${B}/${TARGET_PREFIX}testgcc | ||
66 | sed -i -e "/^UID/d" ${B}/${TARGET_PREFIX}testgcc | ||
67 | sed -i -e "/^TERM/d" ${B}/${TARGET_PREFIX}testgcc | ||
68 | sed -i -e "/^PATCH_GET/d" ${B}/${TARGET_PREFIX}testgcc | ||
69 | sed -i -e "/^PKG_/d" ${B}/${TARGET_PREFIX}testgcc | ||
70 | sed -i -e "/^POSIXLY_/d" ${B}/${TARGET_PREFIX}testgcc | ||
71 | sed -i -e "/^PPID/d" ${B}/${TARGET_PREFIX}testgcc | ||
72 | sed -i -e "/^PS4/d" ${B}/${TARGET_PREFIX}testgcc | ||
73 | sed -i -e "/^Q/d" ${B}/${TARGET_PREFIX}testgcc | ||
74 | sed -i -e "/^SHLVL/d" ${B}/${TARGET_PREFIX}testgcc | ||
75 | sed -i -e "/^STAGING/d" ${B}/${TARGET_PREFIX}testgcc | ||
76 | sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${TARGET_PREFIX}testgcc | ||
77 | sed -i -e "/^PSEUDO/d" ${B}/${TARGET_PREFIX}testgcc | ||
78 | |||
79 | # append execution part of the script | ||
80 | cat >> ${B}/${TARGET_PREFIX}testgcc << STOP | ||
81 | target="\$1" | ||
82 | usage () { | ||
83 | echo "Usage:" | ||
84 | echo "\$0 user@target 'extra options to dejagnu'" | ||
85 | echo "\$0 target 'extra options to dejagnu'" | ||
86 | echo "\$0 target" | ||
87 | echo "e.g. \$0 192.168.7.2 ' dg.exp=visibility-d.c'" | ||
88 | echo "will only run visibility-d.c test case" | ||
89 | echo "e.g. \$0 192.168.7.2 '/-mthumb dg.exp=visibility-d.c'" | ||
90 | echo "will only run visibility-d.c test case in thumb mode" | ||
91 | echo "You need to have dejagnu autogen expect installed" | ||
92 | echo "on the build host" | ||
93 | } | ||
94 | if [ "x\$target" = "x" ] | ||
95 | then | ||
96 | echo "Please specify the target machine and remote user in form of user@target\n" | ||
97 | usage | ||
98 | exit 1; | ||
99 | fi | ||
100 | |||
101 | shift | ||
102 | |||
103 | echo "\$target" | grep "@" 2>&1 > /dev/null | ||
104 | if [ "x\$?" = "x0" ] | ||
105 | then | ||
106 | user=\$(echo \$target | cut -d '@' -f 1) | ||
107 | target=\$(echo \$target | cut -d '@' -f 2) | ||
108 | else | ||
109 | user=\$USER | ||
110 | fi | ||
111 | ssh \$user@\$target date 2>&1 > /dev/null | ||
112 | if [ "x\$?" != "x0" ] | ||
113 | then | ||
114 | echo "Failed connecting to \$user@\$target it could be because" | ||
115 | echo "you don't have passwordless ssh setup to access \$target" | ||
116 | echo "or sometimes host key has been changed" | ||
117 | echo "in such case do something like below on build host" | ||
118 | echo "ssh-keygen -f "~/.ssh/known_hosts" -R \$target" | ||
119 | echo "and then try ssh \$user@\$target" | ||
120 | |||
121 | usage | ||
122 | exit 1 | ||
123 | fi | ||
124 | echo "lappend boards_dir [pwd]/../../.." > ${B}/site.exp | ||
125 | echo "load_generic_config \"unix\"" > ${B}/${PACKAGE_ARCH}.exp | ||
126 | echo "set_board_info username \$user" >> ${B}/${PACKAGE_ARCH}.exp | ||
127 | echo "set_board_info rsh_prog ssh" >> ${B}/${PACKAGE_ARCH}.exp | ||
128 | echo "set_board_info rcp_prog scp" >> ${B}/${PACKAGE_ARCH}.exp | ||
129 | echo "set_board_info hostname \$target" >> ${B}/${PACKAGE_ARCH}.exp | ||
130 | DEJAGNU=${B}/site.exp make -k check RUNTESTFLAGS="--target_board=${PACKAGE_ARCH}\$@" | ||
131 | |||
132 | STOP | ||
133 | |||
134 | chmod +x ${B}/${TARGET_PREFIX}testgcc | ||
135 | |||
136 | } | ||
137 | |||
138 | INHIBIT_PACKAGE_STRIP = "1" | ||
139 | |||
140 | # Compute how to get from libexecdir to bindir in python (easier than shell) | ||
141 | BINRELPATH = "${@os.path.relpath(d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${MULTIMACH_TARGET_SYS}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}" | ||
142 | |||
143 | do_install () { | ||
144 | oe_runmake 'DESTDIR=${D}' install-host | ||
145 | |||
146 | install -d ${D}${target_base_libdir} | ||
147 | install -d ${D}${target_libdir} | ||
148 | |||
149 | # Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77 | ||
150 | # gfortran is fully backwards compatible. This is a safe and practical solution. | ||
151 | ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true | ||
152 | |||
153 | |||
154 | # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are | ||
155 | # found. These need to be relative paths so they work in different locations. | ||
156 | dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/ | ||
157 | install -d $dest | ||
158 | for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do | ||
159 | ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t | ||
160 | ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t | ||
161 | done | ||
162 | |||
163 | # Remove things we don't need but keep share/java | ||
164 | for d in info man share/doc share/locale share/man share/info; do | ||
165 | rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/$d | ||
166 | done | ||
167 | |||
168 | # libquadmath headers need to be available in the gcc libexec dir | ||
169 | install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
170 | cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
171 | cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | ||
172 | |||
173 | # We use libiberty from binutils | ||
174 | find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f | ||
175 | find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f | ||
176 | |||
177 | # gcc-runtime installs libgcc into a special location in staging since it breaks doing a standalone build | ||
178 | case ${PN} in | ||
179 | *gcc-cross|*gcc-crosssdk) | ||
180 | dest=${D}/${includedir}/gcc-build-internal-${MULTIMACH_TARGET_SYS} | ||
181 | cp -fpPR . $dest | ||
182 | ;; | ||
183 | esac | ||
184 | } | ||
185 | |||
186 | do_package[noexec] = "1" | ||
187 | do_packagedata[noexec] = "1" | ||
188 | do_package_write_ipk[noexec] = "1" | ||
189 | do_package_write_rpm[noexec] = "1" | ||
190 | do_package_write_deb[noexec] = "1" | ||