blob: 048b5302be2df8a041e41d9825e9391cd83a6b8a [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001DEPENDS = "virtual/${TARGET_PREFIX}binutils ${NATIVEDEPS}"
2PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
3PACKAGES = ""
4
5INHIBIT_AUTOTOOLS_DEPS = "1"
6INHIBIT_DEFAULT_DEPS = "1"
7
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05008# We still need gnu-config-native
9DEPENDS_prepend = "gnu-config-native autoconf-native "
10
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011PN = "gcc-cross-initial-${TARGET_ARCH}"
12
13CROSS_TARGET_SYS_DIR_append = ".${PN}"
14
15# This is intended to be a -very- basic config
16# sysroot is needed in case we use libc-initial
17EXTRA_OECONF = "\
18 --with-newlib \
19 --without-headers \
20 --disable-shared \
21 --disable-threads \
22 --disable-multilib \
23 --disable-__cxa_atexit \
24 --enable-languages=c \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025 --program-prefix=${TARGET_PREFIX} \
26 --with-sysroot=/not/exist \
27 --with-build-sysroot=${GCCCROSS_BUILDSYSROOT} \
28 ${EXTRA_OECONF_INITIAL} \
29 ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--with-ld=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}ld.bfd', '', d)} \
30 ${EXTRA_OECONF_GCC_FLOAT} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050031 ${@get_gcc_ppc_plt_settings(bb, d)} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032"
33
34EXTRA_OECONF += "--with-native-system-header-dir=${SYSTEMHEADERS}"
35
36GCCCROSS_BUILDSYSROOT = "${B}/tmpsysroot"
37
38do_configure_prepend () {
39 sysr=${GCCCROSS_BUILDSYSROOT}${target_includedir}
40 mkdir -p $sysr
41 for t in linux asm asm-generic; do
42 rm -f $sysr/$t
43 ln -s ${STAGING_DIR_TARGET}${target_includedir}/$t $sysr/
44 done
45}
46
47do_compile () {
48 oe_runmake all-gcc configure-target-libgcc
49}
50do_install () {
51 ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h )
52 oe_runmake 'DESTDIR=${D}' install-gcc
53
54 # We don't really need this (here shares/ contains man/, info/, locale/).
55 rm -rf ${D}${datadir}/
56
57 # We use libiberty from binutils
58 find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f
59 find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f
60
61 # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
62 # found. These need to be relative paths so they work in different locations.
63 dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
64 install -d $dest
65 useld=${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '.bfd', '', d)}
66 ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld${useld} ${dest}ld
67 for t in ar as nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
68 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
69 done
70 # fixed limits.h infact includes the so called real limits.h
71 # which should come from libc but when we build libc-initial
72 # then bunch of configure tests include fixed limits.h which in turn
73 # includes real limits.h but this real limits.h is not staged yet
74 # so we overwirte the generated include-fixed/limits.h for gcc-cross-initial
75 # to get rid references to real limits.h
76 cp gcc/include-fixed/limits.h ${D}${gcclibdir}/${TARGET_SYS}/${BINV}/include/limits.h
77
78 # gcc-runtime installs libgcc into a special location in staging since it breaks doing a standalone build
79 case ${PN} in
80 *gcc-cross-initial-${TARGET_ARCH}|*gcc-crosssdk-initial-${TARGET_ARCH})
81 dest=${D}/${includedir}/gcc-build-internal-initial-${TARGET_SYS}
82 hardlinkdir . $dest
83 ;;
84 esac
85}
86#
87# Override the default sysroot staging copy since this won't look like a target system
88#
89sysroot_stage_all() {
90 sysroot_stage_dir ${D} ${SYSROOT_DESTDIR}
91 install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/
92 install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/
93 mv ${SYSROOT_DESTDIR}${target_base_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/ || true
94 mv ${SYSROOT_DESTDIR}${target_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/ || true
95}
96
97do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_HOST}/ ${SYSROOT_DESTDIR}/${STAGING_DIR_TARGET}/${target_base_libdir}/"
98do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_HOST}/ ${STAGING_DIR_TCBOOTSTRAP}/${target_base_libdir}/"
99
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500100inherit nopackages