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