diff options
Diffstat (limited to 'meta-microblaze/recipes-devtools/gcc/libgcc-common.inc')
| -rw-r--r-- | meta-microblaze/recipes-devtools/gcc/libgcc-common.inc | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc b/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc new file mode 100644 index 00000000..ac0a5a7b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc | |||
| @@ -0,0 +1,163 @@ | |||
| 1 | BPN = "libgcc" | ||
| 2 | |||
| 3 | require gcc-configure-common.inc | ||
| 4 | |||
| 5 | INHIBIT_DEFAULT_DEPS = "1" | ||
| 6 | |||
| 7 | do_configure () { | ||
| 8 | install -d ${D}${base_libdir} ${D}${libdir} | ||
| 9 | mkdir -p ${B}/${BPN} | ||
| 10 | mkdir -p ${B}/${TARGET_SYS}/${BPN}/ | ||
| 11 | cd ${B}/${BPN} | ||
| 12 | chmod a+x ${S}/${BPN}/configure | ||
| 13 | ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} | ||
| 14 | } | ||
| 15 | EXTRACONFFUNCS += "extract_stashed_builddir" | ||
| 16 | do_configure[depends] += "${COMPILERDEP}" | ||
| 17 | |||
| 18 | do_compile () { | ||
| 19 | cd ${B}/${BPN} | ||
| 20 | oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/${BPN}/ | ||
| 21 | } | ||
| 22 | |||
| 23 | do_install () { | ||
| 24 | cd ${B}/${BPN} | ||
| 25 | oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/${BPN}/ install | ||
| 26 | |||
| 27 | # Move libgcc_s into /lib | ||
| 28 | mkdir -p ${D}${base_libdir} | ||
| 29 | if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then | ||
| 30 | mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir} | ||
| 31 | else | ||
| 32 | mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true | ||
| 33 | fi | ||
| 34 | |||
| 35 | # install the runtime in /usr/lib/ not in /usr/lib/gcc on target | ||
| 36 | # so that cross-gcc can find it in the sysroot | ||
| 37 | |||
| 38 | mv ${D}${libdir}/gcc/* ${D}${libdir} | ||
| 39 | rm -rf ${D}${libdir}/gcc/ | ||
| 40 | # unwind.h is installed here which is shipped in gcc-cross | ||
| 41 | # as well as target gcc and they are identical so we dont | ||
| 42 | # ship one with libgcc here | ||
| 43 | rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include | ||
| 44 | } | ||
| 45 | |||
| 46 | do_install:append:libc-baremetal () { | ||
| 47 | if [ "${base_libdir}" != "${libdir}" ]; then | ||
| 48 | rmdir ${D}${base_libdir} | ||
| 49 | fi | ||
| 50 | } | ||
| 51 | do_install:append:libc-newlib () { | ||
| 52 | if [ "${base_libdir}" != "${libdir}" ]; then | ||
| 53 | rmdir ${D}${base_libdir} | ||
| 54 | fi | ||
| 55 | } | ||
| 56 | |||
| 57 | # No rpm package is actually created but -dev depends on it, avoid dnf error | ||
| 58 | DEV_PKG_DEPENDENCY:libc-baremetal = "" | ||
| 59 | DEV_PKG_DEPENDENCY:libc-newlib = "" | ||
| 60 | |||
| 61 | #BBCLASSEXTEND = "nativesdk" | ||
| 62 | |||
| 63 | addtask multilib_install after do_install before do_package do_populate_sysroot | ||
| 64 | # this makes multilib gcc files findable for target gcc | ||
| 65 | # e.g. | ||
| 66 | # /usr/lib/i586-pokymllib32-linux/4.7/ | ||
| 67 | # by creating this symlink to it | ||
| 68 | # /usr/lib64/x86_64-poky-linux/4.7/32 | ||
| 69 | |||
| 70 | fakeroot python do_multilib_install() { | ||
| 71 | import re | ||
| 72 | |||
| 73 | multilibs = d.getVar('MULTILIB_VARIANTS') | ||
| 74 | if not multilibs or bb.data.inherits_class('nativesdk', d): | ||
| 75 | return | ||
| 76 | |||
| 77 | binv = d.getVar('BINV') | ||
| 78 | |||
| 79 | mlprefix = d.getVar('MLPREFIX') | ||
| 80 | if ('%slibgcc' % mlprefix) != d.getVar('PN'): | ||
| 81 | return | ||
| 82 | |||
| 83 | if mlprefix: | ||
| 84 | orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL') | ||
| 85 | orig_tune_params = get_tune_parameters(orig_tune, d) | ||
| 86 | orig_tune_baselib = orig_tune_params['baselib'] | ||
| 87 | orig_tune_bitness = orig_tune_baselib.replace('lib', '') | ||
| 88 | if not orig_tune_bitness: | ||
| 89 | orig_tune_bitness = '32' | ||
| 90 | |||
| 91 | src = '../../../' + orig_tune_baselib + '/' + \ | ||
| 92 | d.getVar('TARGET_SYS_MULTILIB_ORIGINAL') + '/' + binv + '/' | ||
| 93 | |||
| 94 | dest = d.getVar('D') + d.getVar('libdir') + '/' + \ | ||
| 95 | d.getVar('TARGET_SYS') + '/' + binv + '/' + orig_tune_bitness | ||
| 96 | |||
| 97 | if os.path.lexists(dest): | ||
| 98 | os.unlink(dest) | ||
| 99 | os.symlink(src, dest) | ||
| 100 | return | ||
| 101 | |||
| 102 | |||
| 103 | for ml in multilibs.split(): | ||
| 104 | tune = d.getVar('DEFAULTTUNE:virtclass-multilib-' + ml) | ||
| 105 | if not tune: | ||
| 106 | bb.warn('DEFAULTTUNE:virtclass-multilib-%s is not defined. Skipping...' % ml) | ||
| 107 | continue | ||
| 108 | |||
| 109 | tune_parameters = get_tune_parameters(tune, d) | ||
| 110 | tune_baselib = tune_parameters['baselib'] | ||
| 111 | if not tune_baselib: | ||
| 112 | bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune) | ||
| 113 | continue | ||
| 114 | |||
| 115 | tune_arch = tune_parameters['arch'] | ||
| 116 | tune_bitness = tune_baselib.replace('lib', '') | ||
| 117 | if not tune_bitness: | ||
| 118 | tune_bitness = '32' # /lib => 32bit lib | ||
| 119 | |||
| 120 | tune_abiextension = tune_parameters['abiextension'] | ||
| 121 | if tune_abiextension: | ||
| 122 | libcextension = '-gnu' + tune_abiextension | ||
| 123 | else: | ||
| 124 | libcextension = '' | ||
| 125 | |||
| 126 | src = '../../../' + tune_baselib + '/' + \ | ||
| 127 | tune_arch + d.getVar('TARGET_VENDOR') + 'ml' + ml + \ | ||
| 128 | '-' + d.getVar('TARGET_OS') + libcextension + '/' + binv + '/' | ||
| 129 | |||
| 130 | dest = d.getVar('D') + d.getVar('libdir') + '/' + \ | ||
| 131 | d.getVar('TARGET_SYS') + '/' + binv + '/' + tune_bitness | ||
| 132 | |||
| 133 | if os.path.lexists(dest): | ||
| 134 | os.unlink(dest) | ||
| 135 | os.symlink(src, dest) | ||
| 136 | } | ||
| 137 | |||
| 138 | def get_original_os(d): | ||
| 139 | vendoros = d.expand('${TARGET_ARCH}${ORIG_TARGET_VENDOR}-${TARGET_OS}') | ||
| 140 | for suffix in [d.getVar('ABIEXTENSION'), d.getVar('LIBCEXTENSION')]: | ||
| 141 | if suffix and vendoros.endswith(suffix): | ||
| 142 | vendoros = vendoros[:-len(suffix)] | ||
| 143 | # Arm must use linux-gnueabi not linux as only the former is accepted by gcc | ||
| 144 | if vendoros.startswith("arm-") and not vendoros.endswith("-gnueabi"): | ||
| 145 | vendoros = vendoros + "-gnueabi" | ||
| 146 | return vendoros | ||
| 147 | |||
| 148 | ORIG_TARGET_VENDOR := "${TARGET_VENDOR}" | ||
| 149 | BASETARGET_SYS = "${@get_original_os(d)}" | ||
| 150 | |||
| 151 | addtask extra_symlinks after do_multilib_install before do_package do_populate_sysroot | ||
| 152 | fakeroot python do_extra_symlinks() { | ||
| 153 | if bb.data.inherits_class('nativesdk', d): | ||
| 154 | return | ||
| 155 | |||
| 156 | targetsys = d.getVar('BASETARGET_SYS') | ||
| 157 | |||
| 158 | if targetsys != d.getVar('TARGET_SYS'): | ||
| 159 | dest = d.getVar('D') + d.getVar('libdir') + '/' + targetsys | ||
| 160 | src = d.getVar('TARGET_SYS') | ||
| 161 | if not os.path.lexists(dest) and os.path.lexists(d.getVar('D') + d.getVar('libdir')): | ||
| 162 | os.symlink(src, dest) | ||
| 163 | } | ||
