From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: [PATCH] libgcc: Spit out common code into libgcc-common.inc
Date: Thu, 24 Apr 2014 10:18:42 +0100 [thread overview]
Message-ID: <1398331122.16672.174.camel@ted> (raw)
Prepare the ground for the creation of libgcc-initial by splitting common
libgcc code into a libgcc-common.inc file.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/recipes-devtools/gcc/libgcc-common.inc b/meta/recipes-devtools/gcc/libgcc-common.inc
new file mode 100644
index 0000000..c4ab885
--- /dev/null
+++ b/meta/recipes-devtools/gcc/libgcc-common.inc
@@ -0,0 +1,135 @@
+BPN = "libgcc"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+do_configure () {
+ target=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
+ install -d ${D}${base_libdir} ${D}${libdir}
+ hardlinkdir ${STAGING_INCDIR_NATIVE}/${LIBGCCBUILDTREENAME}$target/ ${B}
+ mkdir -p ${B}/${BPN}
+ cd ${B}/${BPN}
+ chmod a+x ${S}/${BPN}/configure
+ ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+}
+
+do_compile () {
+ target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
+ cd ${B}/${BPN}
+ oe_runmake MULTIBUILDTOP=${B}/$target/${BPN}/
+}
+
+do_install () {
+ target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
+ cd ${B}/${BPN}
+ oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/${BPN}/ install
+
+ # Move libgcc_s into /lib
+ mkdir -p ${D}${base_libdir}
+ if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
+ mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
+ else
+ mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
+ fi
+
+ # install the runtime in /usr/lib/ not in /usr/lib/gcc on target
+ # so that cross-gcc can find it in the sysroot
+
+ mv ${D}${libdir}/gcc/* ${D}${libdir}
+ rm -rf ${D}${libdir}/gcc/
+ # unwind.h is installed here which is shipped in gcc-cross
+ # as well as target gcc and they are identical so we dont
+ # ship one with libgcc here
+ rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include
+}
+
+BBCLASSEXTEND = "nativesdk"
+
+addtask multilib_install after do_install before do_package do_populate_sysroot
+# this makes multilib gcc files findable for target gcc
+# e.g.
+# /usr/lib/i586-pokymllib32-linux/4.7/
+# by creating this symlink to it
+# /usr/lib64/x86_64-poky-linux/4.7/32
+
+python do_multilib_install() {
+ import re
+
+ multilibs = d.getVar('MULTILIB_VARIANTS', True)
+ if not multilibs or bb.data.inherits_class('nativesdk', d):
+ return
+
+ binv = d.getVar('BINV', True)
+
+ mlprefix = d.getVar('MLPREFIX', True)
+ if ('%slibgcc' % mlprefix) != d.getVar('PN', True):
+ return
+
+ if mlprefix:
+ orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL', True)
+ orig_tune_params = get_tune_parameters(orig_tune, d)
+ orig_tune_baselib = orig_tune_params['baselib']
+ orig_tune_bitness = orig_tune_baselib.replace('lib', '')
+ if not orig_tune_bitness:
+ orig_tune_bitness = '32'
+
+ src = '../../../' + orig_tune_baselib + '/' + \
+ d.getVar('TARGET_SYS_MULTILIB_ORIGINAL', True) + '/' + binv + '/'
+
+ dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
+ d.getVar('TARGET_SYS', True) + '/' + binv + '/' + orig_tune_bitness
+
+ if os.path.lexists(dest):
+ os.unlink(dest)
+ os.symlink(src, dest)
+ return
+
+
+ for ml in multilibs.split():
+ tune = d.getVar('DEFAULTTUNE_virtclass-multilib-' + ml, True)
+ if not tune:
+ bb.warn('DEFAULTTUNE_virtclass-multilib-%s is not defined. Skipping...' % ml)
+ continue
+
+ tune_parameters = get_tune_parameters(tune, d)
+ tune_baselib = tune_parameters['baselib']
+ if not tune_baselib:
+ bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
+ continue
+
+ tune_arch = tune_parameters['arch']
+ tune_bitness = tune_baselib.replace('lib', '')
+ if not tune_bitness:
+ tune_bitness = '32' # /lib => 32bit lib
+
+ src = '../../../' + tune_baselib + '/' + \
+ tune_arch + d.getVar('TARGET_VENDOR', True) + 'ml' + ml + \
+ '-' + d.getVar('TARGET_OS', True) + '/' + binv + '/'
+
+ dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
+ d.getVar('TARGET_SYS', True) + '/' + binv + '/' + tune_bitness
+
+ if os.path.lexists(dest):
+ os.unlink(dest)
+ os.symlink(src, dest)
+}
+
+addtask extra_symlinks after do_multilib_install before do_package do_populate_sysroot
+python do_extra_symlinks() {
+ targetsysnoext = d.getVar('TARGET_SYS_NO_EXTENSION', True)
+
+ if targetsysnoext != d.getVar('TARGET_SYS', True):
+ dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + targetsysnoext
+ src = d.getVar('TARGET_SYS', True)
+ if not os.path.lexists(dest) and os.path.lexists(d.getVar('D', True) + d.getVar('libdir', True)):
+ os.symlink(src, dest)
+}
+
+python () {
+ targetsysnoext = d.getVar('TARGET_SYS', True)
+
+ for suffix in [d.getVar('ABIEXTENSION', True), d.getVar('LIBCEXTENSION', True)]:
+ if suffix and targetsysnoext.endswith(suffix):
+ targetsysnoext = targetsysnoext[:-len(suffix)]
+
+ d.setVar('TARGET_SYS_NO_EXTENSION', targetsysnoext)
+}
diff --git a/meta/recipes-devtools/gcc/libgcc.inc b/meta/recipes-devtools/gcc/libgcc.inc
index 1a1fbcc..45dd151 100644
--- a/meta/recipes-devtools/gcc/libgcc.inc
+++ b/meta/recipes-devtools/gcc/libgcc.inc
@@ -1,4 +1,4 @@
-INHIBIT_DEFAULT_DEPS = "1"
+require libgcc-common.inc
DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
@@ -24,142 +24,13 @@ FILES_libgcov-dev = " \
"
FILES_${PN}-dbg += "${base_libdir}/.debug/"
-do_configure () {
- target=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
- install -d ${D}${base_libdir} ${D}${libdir}
- hardlinkdir ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$target/ ${B}
- mkdir -p ${B}/${BPN}
- cd ${B}/${BPN}
- chmod a+x ${S}/${BPN}/configure
- ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
-}
-
-do_compile () {
- target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
- cd ${B}/${BPN}
- oe_runmake MULTIBUILDTOP=${B}/$target/${BPN}/
-}
-
-do_install () {
- target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
- cd ${B}/${BPN}
- oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/${BPN}/ install
-
- # Move libgcc_s into /lib
- mkdir -p ${D}${base_libdir}
- if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
- mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
- else
- mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
- fi
-
- # install the runtime in /usr/lib/ not in /usr/lib/gcc on target
- # so that cross-gcc can find it in the sysroot
-
- mv ${D}${libdir}/gcc/* ${D}${libdir}
- rm -rf ${D}${libdir}/gcc/
- # unwind.h is installed here which is shipped in gcc-cross
- # as well as target gcc and they are identical so we dont
- # ship one with libgcc here
- rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include
-}
+LIBGCCBUILDTREENAME = "gcc-build-internal-"
do_package[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
-BBCLASSEXTEND = "nativesdk"
-
INSANE_SKIP_${PN}-dev = "staticdev"
INSANE_SKIP_${MLPREFIX}libgcov-dev = "staticdev"
-addtask multilib_install after do_install before do_package do_populate_sysroot
-# this makes multilib gcc files findable for target gcc
-# e.g.
-# /usr/lib/i586-pokymllib32-linux/4.7/
-# by creating this symlink to it
-# /usr/lib64/x86_64-poky-linux/4.7/32
-
-python do_multilib_install() {
- import re
-
- multilibs = d.getVar('MULTILIB_VARIANTS', True)
- if not multilibs or bb.data.inherits_class('nativesdk', d):
- return
-
- binv = d.getVar('BINV', True)
-
- mlprefix = d.getVar('MLPREFIX', True)
- if ('%slibgcc' % mlprefix) != d.getVar('PN', True):
- return
-
- if mlprefix:
- orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL', True)
- orig_tune_params = get_tune_parameters(orig_tune, d)
- orig_tune_baselib = orig_tune_params['baselib']
- orig_tune_bitness = orig_tune_baselib.replace('lib', '')
- if not orig_tune_bitness:
- orig_tune_bitness = '32'
-
- src = '../../../' + orig_tune_baselib + '/' + \
- d.getVar('TARGET_SYS_MULTILIB_ORIGINAL', True) + '/' + binv + '/'
-
- dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
- d.getVar('TARGET_SYS', True) + '/' + binv + '/' + orig_tune_bitness
-
- if os.path.lexists(dest):
- os.unlink(dest)
- os.symlink(src, dest)
- return
-
-
- for ml in multilibs.split():
- tune = d.getVar('DEFAULTTUNE_virtclass-multilib-' + ml, True)
- if not tune:
- bb.warn('DEFAULTTUNE_virtclass-multilib-%s is not defined. Skipping...' % ml)
- continue
-
- tune_parameters = get_tune_parameters(tune, d)
- tune_baselib = tune_parameters['baselib']
- if not tune_baselib:
- bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
- continue
-
- tune_arch = tune_parameters['arch']
- tune_bitness = tune_baselib.replace('lib', '')
- if not tune_bitness:
- tune_bitness = '32' # /lib => 32bit lib
-
- src = '../../../' + tune_baselib + '/' + \
- tune_arch + d.getVar('TARGET_VENDOR', True) + 'ml' + ml + \
- '-' + d.getVar('TARGET_OS', True) + '/' + binv + '/'
-
- dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
- d.getVar('TARGET_SYS', True) + '/' + binv + '/' + tune_bitness
-
- if os.path.lexists(dest):
- os.unlink(dest)
- os.symlink(src, dest)
-}
-
-addtask extra_symlinks after do_multilib_install before do_package do_populate_sysroot
-python do_extra_symlinks() {
- targetsysnoext = d.getVar('TARGET_SYS_NO_EXTENSION', True)
-
- if targetsysnoext != d.getVar('TARGET_SYS', True):
- dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + targetsysnoext
- src = d.getVar('TARGET_SYS', True)
- if not os.path.lexists(dest) and os.path.lexists(d.getVar('D', True) + d.getVar('libdir', True)):
- os.symlink(src, dest)
-}
-
-python () {
- targetsysnoext = d.getVar('TARGET_SYS', True)
-
- for suffix in [d.getVar('ABIEXTENSION', True), d.getVar('LIBCEXTENSION', True)]:
- if suffix and targetsysnoext.endswith(suffix):
- targetsysnoext = targetsysnoext[:-len(suffix)]
-
- d.setVar('TARGET_SYS_NO_EXTENSION', targetsysnoext)
-}
reply other threads:[~2014-04-24 9:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1398331122.16672.174.camel@ted \
--to=richard.purdie@linuxfoundation.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.