diff --git a/README.md b/README.md index 6fe75ea..f1e1df6 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ Optional Functionality from source, if they have downloaded the corresponding source archive from Mentor Graphics. To so, set `TCMODE = "external-sourcery-rebuild-libc"`, rather than relying on the default value of `external-sourcery`. After setting TCMODE appropriately, you - must also set `CSL_SRC_FILE = "/path/to/your/sourcery-g++-source-tarball"`. + must also set `SOURCERY_SRC_FILE = "/path/to/your/sourcery-g++-source-tarball"` or + `SOURCERY_SRC_URI = "http://some.domain/some-path"`. Description of Behavior ----------------------- @@ -33,20 +34,9 @@ necessary. The tcmode performs a number of operations: - Sets `TARGET_PREFIX` appropriately, after determining what prefix is in use by the toolchain - Sanity checks `EXTERNAL_TOOLCHAIN`: does the path exist? does the expected sysroot exist? -- Sanity checks execution of the toolchain binaries -- Sets preferences so that the `external-sourcery-toolchain` recipe is used in preference - to rebuilding various things from source with their own recipes -- Extracts version information from the toolchain (e.g. by running `${TARGET_PREFIX}gcc -v`), - for use in the `external-sourcery-toolchain` recipe and its binary packages -- Symlinks the toolchain binaries into the toolchain portion of the sysroot. This is done - in preference to adding the toolchain path to the `PATH`, to avoid the aforementioned - ia32 issue, and to let us work around certain issues (For example, we create an `ld.bfd` - link which the kernel build expects, but isn't shipped with the toolchain) -- Adds the external toolchain `PATH` to the setup script emitted when building SDKs (e.g. - when bitbaking meta-toolchain) -- Sets `GCCVERSION` to the gcc version of the toolchain, to prefer a matching gcc version for - the target package, if possible. Certain versions of gcc have trouble being built by other - versions of gcc, so this can avoid such issues. +- Sets preferences so that external recipes are used in preference to building + them from source, including cross recipes which link/wrap the toolchain + cross binaries Contributing ------------ @@ -57,16 +47,7 @@ To contribute to this layer, please fork and submit pull requests to the above repository with github, or open issues for any bugs you find, or feature requests you have. -Content review --------------- +To Do List +---------- -- Fix `GNU_HASH` warnings / obey `LDFLAGS` - - - imx-lib - - blktrace - - hostap - - gdbm - - setserial - - irda-utils - - python - - perl +See [TODO.md](TODO.md) diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..f9775d2 --- /dev/null +++ b/TODO.md @@ -0,0 +1,57 @@ +- Handle relocating debug files based on PACKAGE_DEBUG_SPLIT_STYLE, in + a general way, as a better way to handle 6d62e6f. Possibly do a regex + search/replace: + + ``` + If debug-file-directory: + + (.*)/\.debug/([^/]*)\.debug|${libdir}/debug/\1/\2.debug + (.*)/\.debug/([^/]*)|${libdir}/debug/\1/\2.debug + + Else: + + ${libdir}/debug/(.*)/([^/]*\.debug)|\1/.debug/\2 + ``` + +- Fix extraction of patterns like `${libdir}/locale/*/*/libc.mo` (glibc) and + `${libdir}/gcc/*/*/include/omp.h` (libgomp). + +- Improvements above and beyond the existing previous features of the layer + + - Attempt to determine the available locales for locale generation/packaging + dynamically based on what's available in the sysroot. + - Don't use cp -a (we don't want the permissions/ownership from the + external toolchain to leak onto our target) + - Think about using cpio instead of cp + - Think about hard linking if possible instead of copying, as long as + do_package doesn't modify files in place, rather than + unlinking/creating. + + - Improve separation between sourcery and general external bits + - Refactor and enhance to be able to use this sysroot extraction code to + be able to support a true native MACHINE, bypassing cross-compilation + entirely. + + - Re-examine oe-core metadata for our extraction recipes to see if anything + can be reused (e.g. in libgcc, gcc-runtime) + + - Re-review the Wind River toolchain layers for useful bits + - Add hooks to be able to handle multilib configurations stored in cpio + archives rather than directly on disk. This will include: + + - a hook for the search process so we can examine the contents of the + archives instead of on-disk + - a hook for the copy process so we can extract instead of copying + + - Add minimum gcc version requirement (>=4.3) due to requirement for + -print-sysroot/--sysroot=. + - Test minimum gcc/glibc versions to actually complete a build. + + - Consider reworking external_toolchain_do_install in shell. This would need + performance testing. + - Consider reverting the split out of linux-libc-headers-external, as we don't + want to encourage folks to provide their own -- there are better mechanisms. + +- Bugs + + - 2013.11: problems with cross-localedef for bo_CN, et_VE, ar_SD, az_AZ, bo_IN diff --git a/classes/common-license.bbclass b/classes/common-license.bbclass new file mode 100644 index 0000000..f1c8ddf --- /dev/null +++ b/classes/common-license.bbclass @@ -0,0 +1,43 @@ +# Handle automatically pointing LIC_FILES_CHKSUM to a common license outside +# the recipe's source tree, based on the value of LICENSE. +LIC_FILES_CHKSUM ?= "${COMMON_LIC_CHKSUM}" + +COMMON_LIC_CHKSUM = "" +COMMON_LIC_CHKSUM_CLOSED = "" +COMMON_LIC_CHKSUM_GPL-2.0 = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" +COMMON_LIC_CHKSUM_GPL-3.0 = "file://${COREBASE}/meta/files/common-licenses/GPL-3.0;md5=c79ff39f19dfec6d293b95dea7b07891" +COMMON_LIC_CHKSUM_LGPL-2.1 = "file://${COREBASE}/meta/files/common-licenses/LGPL-2.1;md5=1a6d268fd218675ffea8be556788b780" + + +python () { + import oe.license + + #; Set LIC_FILES_CHKSUM to a common license if it's unset and LICENSE is set + licensestr = d.getVar('LICENSE', True) + licenses = oe.license.flattened_licenses(licensestr, lambda a, b: a + b) + checksums = [] + for license in licenses: + if license != 'CLOSED' and d.getVar('LIC_FILES_CHKSUM', False) == '${COMMON_LIC_CHKSUM}': + license = mapped_license(license, d) + + ext_chksum_var = 'COMMON_LIC_CHKSUM_{0}'.format(license) + if d.getVar(ext_chksum_var, True): + checksums.append('${%s}' % ext_chksum_var) + else: + lic_file_name = '${COREBASE}/meta/files/common-licenses/%s' % license + lic_file = d.expand(lic_file_name) + if os.path.exists(lic_file): + md5 = bb.utils.md5_file(lic_file) + chksum = 'file://{0};md5={1}'.format(lic_file_name, md5) + bb.fatal('{0}: No available license checksum info for this license. Either set LIC_FILES_CHKSUM, or define:\n {1} = "{2}"'.format(d.getVar('PF', True), ext_chksum_var, chksum)) + d.setVar('COMMON_LIC_CHKSUM', ' '.join(checksums)) +} + +def mapped_license(license, d): + if license.endswith('+'): + license = license[:-1] + + mapped = d.getVarFlag('SPDXLICENSEMAP', license) + if mapped: + license = mapped + return license diff --git a/classes/external-toolchain-cross.bbclass b/classes/external-toolchain-cross.bbclass new file mode 100644 index 0000000..0e70736 --- /dev/null +++ b/classes/external-toolchain-cross.bbclass @@ -0,0 +1,39 @@ +inherit external-toolchain cross + +EXTERNAL_CROSS_BINARIES ?= "" +EXTERNAL_CROSS_NOPSEUDO = "gcc g++ cpp" + +wrap_bin () { + bin="$1" + shift + script="${D}${bindir}/${TARGET_PREFIX}$bin" + printf '#!/bin/sh\n' >$script + for arg in "$@"; do + printf '%s\n' "$arg" + done >>"$script" + printf 'exec ${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}%s "$@"\n' "$bin" >>"$script" + chmod +x "$script" +} + +do_install () { + install -d ${D}${bindir} + for bin in ${EXTERNAL_CROSS_BINARIES}; do + if [ ! -e "${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}$bin" ]; then + continue + fi + + disable=0 + for nopseudo in ${EXTERNAL_CROSS_NOPSEUDO}; do + case "$bin" in + *$nopseudo) + disable=1 + ;; + esac + done + if [ $disable -eq 1 ]; then + wrap_bin "$bin" "export PSEUDO_UNLOAD=1" + else + wrap_bin "$bin" + fi + done +} diff --git a/classes/external-toolchain.bbclass b/classes/external-toolchain.bbclass new file mode 100644 index 0000000..13576ec --- /dev/null +++ b/classes/external-toolchain.bbclass @@ -0,0 +1,232 @@ +# This class provides everything necessary for a recipe to pull bits from an +# external toolchain: +# - Automatically sets LIC_FILES_CHKSUM based on LICENSE if appropriate +# - Searches the external toolchain sysroot and alternate locations for the +# patterns specified in the FILES variables, with support for checking +# alternate locations within the sysroot as well +# - Automatically PROVIDES/RPROVIDES the non-external-suffixed names +# - Usual bits to handle packaging of existing binaries +# - Automatically skips the recipe if its files aren't available in the +# external toolchain +# - Automatically grabs all the .debug files for everything included + +# Since these are prebuilt binaries, there are no source files to checksum for +# LIC_FILES_CHKSUM, so use the license from common-licenses +inherit common-license + +# Prebuilt binaries, no need for any default dependencies +INHIBIT_DEFAULT_DEPS = "1" + +EXTERNAL_PN ?= "${@PN.replace('-external', '')}" +PROVIDES += "${EXTERNAL_PN}" +LICENSE = "CLOSED" +LIC_FILES_CHKSUM = "${COMMON_LIC_CHKSUM}" + +EXTERNAL_TOOLCHAIN_SYSROOT ?= "${@external_run(d, 'gcc', *(TARGET_CC_ARCH.split() + ['-print-sysroot'])).rstrip()}" + +EXTERNAL_INSTALL_SOURCE_PATHS = "\ + ${EXTERNAL_TOOLCHAIN_SYSROOT} \ + ${EXTERNAL_TOOLCHAIN}/${EXTERNAL_TARGET_SYS} \ + ${EXTERNAL_TOOLCHAIN_SYSROOT}/.. \ + ${EXTERNAL_TOOLCHAIN} \ + ${D} \ +" + +# Potential locations within the external toolchain sysroot +FILES_MIRRORS = "\ + ${bindir}/|/usr/${baselib}/bin/\n \ + ${base_libdir}/|/usr/${baselib}/\n \ + ${libexecdir}/|/usr/libexec/\n \ + ${libexecdir}/|/usr/${baselib}/${PN}\n \ + ${mandir}/|/usr/share/man/\n \ + ${mandir}/|/usr/man/\n \ + ${mandir}/|/man/\n \ + ${mandir}/|/share/doc/*-${EXTERNAL_TARGET_SYS}/man/\n \ + ${prefix}/|${base_prefix}/\n \ +" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +EXTERNAL_PV_PREFIX ?= "" +EXTERNAL_PV_SUFFIX ?= "" +PV_prepend = "${@'${EXTERNAL_PV_PREFIX}' if '${EXTERNAL_PV_PREFIX}' else ''}" +PV_append = "${@'${EXTERNAL_PV_SUFFIX}' if '${EXTERNAL_PV_SUFFIX}' else ''}" + +EXTERNAL_EXTRA_FILES ?= "" + +# Skip this recipe if we don't have files in the external toolchain +EXTERNAL_AUTO_PROVIDE ?= "0" +EXTERNAL_AUTO_PROVIDE[type] = "boolean" +EXTERNAL_AUTO_PROVIDE_class-target ?= "1" + +python () { + # Skipping only matters up front + if d.getVar('BB_WORKERCONTEXT', True) == '1': + return + + # We're not an available provider if there's no external toolchain + if not d.getVar("EXTERNAL_TOOLCHAIN"): + raise bb.parse.SkipPackage("External toolchain not configured (EXTERNAL_TOOLCHAIN not set).") + + if not oe.data.typed_value('EXTERNAL_AUTO_PROVIDE', d): + return + + sysroots, mirrors = get_file_search_metadata(d) + pattern = d.getVar('EXTERNAL_PROVIDE_PATTERN', True) + if pattern is None: + files = gather_pkg_files(d) + expanded = expand_paths(files, mirrors) + paths = search_sysroots(expanded, sysroots) + if not any(f for p, f in paths): + raise bb.parse.SkipPackage('No files found in external toolchain sysroot') + elif not pattern: + return + else: + expanded = oe.external_toolchain.expand_paths([pattern], mirrors) + paths = oe.external_toolchain.search_sysroots(expanded, sysroots) + if not any(f for p, f in paths): + raise bb.parse.SkipPackage('No files found in external toolchain sysroot for `{}`'.format(pattern)) +} + +python do_install () { + bb.build.exec_func('external_toolchain_do_install', d) + if 'do_install_extra' in d: + bb.build.exec_func('do_install_extra', d) +} + +python external_toolchain_do_install () { + installdest = d.getVar('D', True) + sysroots, mirrors = get_file_search_metadata(d) + files = gather_pkg_files(d) + copy_from_sysroots(files, sysroots, mirrors, installdest) +} +external_toolchain_do_install[vardeps] += "${@' '.join('FILES_%s' % pkg for pkg in '${PACKAGES}'.split())}" + +def get_file_search_metadata(d): + '''Given the metadata, return the mirrors and sysroots to operate against.''' + from collections import defaultdict + + mirrors = [] + for entry in d.getVar('FILES_MIRRORS', True).replace('\\n', '\n').split('\n'): + entry = entry.strip() + if not entry: + continue + pattern, subst = entry.strip().split('|', 1) + mirrors.append(('^' + pattern, subst)) + + source_paths = [os.path.realpath(p) + for p in d.getVar('EXTERNAL_INSTALL_SOURCE_PATHS', True).split()] + + return source_paths, mirrors + +def gather_pkg_files(d): + '''Given the metadata, return all the files we want to copy to ${D} for + this recipe.''' + import itertools + files = [] + for pkg in d.getVar('PACKAGES', True).split(): + files = itertools.chain(files, (d.getVar('FILES_{}'.format(pkg), True) or '').split()) + files = itertools.chain(files, d.getVar('EXTERNAL_EXTRA_FILES', True).split()) + return files + +def copy_from_sysroots(pathnames, sysroots, mirrors, installdest): + '''Copy the specified files from the specified sysroots, also checking the + specified mirror patterns as alternate paths, to the specified destination.''' + import subprocess + + expanded_pathnames = expand_paths(pathnames, mirrors) + searched_paths = search_sysroots(expanded_pathnames, sysroots) + for path, files in searched_paths: + if not files: + bb.debug(1, 'Failed to find `{}`'.format(path)) + else: + destdir = oe.path.join(installdest, os.path.dirname(path)) + bb.utils.mkdirhier(destdir) + subprocess.check_call(['cp', '-pPR'] + list(files) + [destdir + '/']) + bb.note('Copied `{}` to `{}/`'.format(', '.join(files), destdir)) + +def expand_paths(pathnames, mirrors): + '''Apply search/replace to paths to get alternate search paths. + + Returns a generator with tuples of (pathname, expanded_paths).''' + import re + for pathname in pathnames: + expanded_paths = [pathname] + + for search, replace in mirrors: + new_pathname = re.sub(search, replace, pathname, count=1) + if new_pathname != pathname: + expanded_paths.append(new_pathname) + + yield pathname, expanded_paths + +def search_sysroots(path_entries, sysroots): + '''Search the supplied sysroots for the supplied paths, checking supplied + alternate paths. Expects entries in the format (pathname, all_paths). + + Returns a generator with tuples of (pathname, found_paths).''' + import glob + import itertools + for path, pathnames in path_entries: + for sysroot, pathname in ((s, p) for s in sysroots + for p in itertools.chain([path], pathnames)): + check_path = sysroot + os.sep + pathname + found_paths = glob.glob(check_path) + if found_paths: + yield path, found_paths + break + else: + yield path, None + +# Change do_install's CWD to EXTERNAL_TOOLCHAIN for convenience +do_install[dirs] = "${D} ${EXTERNAL_TOOLCHAIN}" + +# Debug files are likely already split out +INHIBIT_PACKAGE_STRIP = "1" + +# Toolchain shipped binaries weren't necessarily built ideally +WARN_QA_remove = "ldflags textrel" +ERROR_QA_remove = "ldflags textrel" + +RPROVIDES_${PN} += "${EXTERNAL_PN}" +RPROVIDES_${PN}-dev += "${EXTERNAL_PN}-dev" +RPROVIDES_${PN}-staticdev += "${EXTERNAL_PN}-staticdev" +RPROVIDES_${PN}-dbg += "${EXTERNAL_PN}-dbg" +RPROVIDES_${PN}-doc += "${EXTERNAL_PN}-doc" +RPROVIDES_${PN}-locale += "${EXTERNAL_PN}-locale" +LOCALEBASEPN = "${EXTERNAL_PN}" + +FILES_${PN} = "" +FILES_${PN}-dev = "" +FILES_${PN}-staticdev = "" +FILES_${PN}-doc = "" +FILES_${PN}-locale = "" + +def debug_paths(d): + l = d.createCopy() + l.finalize() + paths = [] + exclude = [ + l.getVar('datadir', True), + l.getVar('includedir', True), + ] + for p in l.getVar('PACKAGES', True).split(): + if p.endswith('-dbg'): + continue + for f in (l.getVar('FILES_%s' % p, True) or '').split(): + if any((f == x or f.startswith(x + '/')) for x in exclude): + continue + d = os.path.dirname(f) + b = os.path.basename(f) + paths.append('/usr/lib/debug{0}/{1}.debug'.format(d, b)) + paths.append('{0}/.debug/{1}'.format(d, b)) + paths.append('{0}/.debug/{1}.debug'.format(d, b)) + return set(paths) + +FILES_${PN}-dbg = "${@' '.join(debug_paths(d))}" + +# 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" diff --git a/classes/toolchain-scripts-external.bbclass b/classes/toolchain-scripts-external.bbclass deleted file mode 100644 index 408ef23..0000000 --- a/classes/toolchain-scripts-external.bbclass +++ /dev/null @@ -1,15 +0,0 @@ -toolchain_create_sdk_env_script_append () { - if [ -n "${TOOLCHAIN_PATH_ADD}" ]; then - echo 'PATH="${TOOLCHAIN_PATH_ADD}$PATH"' >>$script - fi -} -toolchain_create_tree_env_script_append () { - if [ -n "${TOOLCHAIN_PATH_ADD}" ]; then - echo 'PATH="${TOOLCHAIN_PATH_ADD}$PATH"' >>$script - fi -} -toolchain_create_sdk_env_script_for_installer_append () { - if [ -n "${TOOLCHAIN_PATH_ADD}" ]; then - echo 'PATH="${TOOLCHAIN_PATH_ADD}$PATH"' >>$script - fi -} diff --git a/conf/distro/include/csl-versions.inc b/conf/distro/include/csl-versions.inc deleted file mode 100644 index ea6109a..0000000 --- a/conf/distro/include/csl-versions.inc +++ /dev/null @@ -1,103 +0,0 @@ -def csl_run(d, cmd, *args): - import bb.process - import subprocess - - topdir = d.getVar('TOPDIR', True) - toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True) - if not toolchain_path: - return 'UNKNOWN', 'UNKNOWN' - - target_prefix = d.getVar('TARGET_PREFIX', True) - path = os.path.join(toolchain_path, 'bin', target_prefix + cmd) - args = [path] + list(args) - - return bb.process.run(args, cwd=topdir, stderr=subprocess.PIPE) - -def csl_get_version(d): - try: - stdout, stderr = csl_run(d, 'gcc', '-v') - except bb.process.CmdError as exc: - bb.error('Failed to obtain CodeSourcery toolchain version: %s' % exc) - return 'UNKNOWN' - else: - last_line = stderr.splitlines()[-1].rstrip() - return last_line - -def csl_get_main_version(d): - version = csl_get_version(d) - if version != 'UNKNOWN': - main_version = version.split()[-1].rstrip(')') - if main_version == 'Preview': - main_version = version.split()[-3] - return main_version - else: - return version - -def csl_get_gcc_version(d): - version = csl_get_version(d) - if version != 'UNKNOWN': - return version.split()[2] - else: - return version - -def csl_get_libc_version(d): - sysroot = d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT', True) - if not sysroot: - return 'UNKNOWN' - - libpath = os.path.join(sysroot, 'lib') - if os.path.exists(libpath): - for file in os.listdir(libpath): - if file.find('libc-') == 0: - return file[5:-3] - return 'UNKNOWN' - -def csl_get_kernel_version(d): - sysroot = d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT', True) - if not sysroot: - return 'UNKNOWN' - - vf = os.path.join(sysroot, 'usr/include/linux/version.h') - - try: - f = open(vf, 'r') - except (OSError, IOError): - return 'UNKNOWN' - - with f: - for line in f.readlines(): - if 'LINUX_VERSION_CODE' in line: - ver = int(line.split()[2]) - maj = ver / 65536 - ver = ver % 65536 - min = ver / 256 - ver = ver % 256 - return '%s.%s.%s' % (maj, min, ver) - return 'UNKNOWN' - -def csl_get_gdb_version(d): - try: - stdout, stderr = csl_run(d, 'gdb', '-v') - except bb.process.CmdError: - return 'UNKNOWN' - else: - first_line = stdout.splitlines()[0] - return first_line.split()[-1] - -python csl_version_handler () { - d = e.data - ld = d.createCopy() - ld.finalize() - - d.setVar('CSL_VER_MAIN', csl_get_main_version(ld)) - d.setVar('CSL_VER_GCC', csl_get_gcc_version(ld)) - d.setVar('CSL_VER_LIBC', csl_get_libc_version(ld)) - d.setVar('CSL_VER_KERNEL', csl_get_kernel_version(ld)) - d.setVar('CSL_VER_GDB', csl_get_gdb_version(ld)) -} -csl_version_handler[eventmask] = "bb.event.ConfigParsed" -addhandler csl_version_handler - -# Ensure that any variable which includes the --sysroot (CC, CXX, etc) also -# depends on the toolchain version -TOOLCHAIN_OPTIONS[vardeps] += "CSL_VER_MAIN CSL_VER_GCC" diff --git a/conf/distro/include/external-run.inc b/conf/distro/include/external-run.inc new file mode 100644 index 0000000..1d53c36 --- /dev/null +++ b/conf/distro/include/external-run.inc @@ -0,0 +1,22 @@ +def external_run(d, cmd, *args): + import subprocess + + topdir = d.getVar('TOPDIR', True) + toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True) + if toolchain_path: + target_prefix = d.getVar('EXTERNAL_TARGET_SYS', True) + '-' + path = os.path.join(toolchain_path, 'bin', target_prefix + cmd) + args = [path] + list(args) + + try: + output = oe.path.check_output(args, cwd=topdir, stderr=subprocess.STDOUT) + except oe.path.CalledProcessError as exc: + import pipes + bb.warn("{0} failed: {1}".format(' '.join(pipes.quote(a) for a in args), exc.output)) + except OSError as exc: + import pipes + bb.warn("{0} failed: {1}".format(' '.join(pipes.quote(a) for a in args), str(exc))) + else: + return output + + return 'UNKNOWN' diff --git a/conf/distro/include/sourcery-tuning.inc b/conf/distro/include/sourcery-tuning.inc new file mode 100644 index 0000000..325737a --- /dev/null +++ b/conf/distro/include/sourcery-tuning.inc @@ -0,0 +1,10 @@ +SOURCERY_GXX_IS_PRO = "${@'1' if os.path.exists('${EXTERNAL_TOOLCHAIN}/license') else '0'}" + +# Workaround for ICE of gcc-4.8.x when passing -mfloat-gprs=double +# Bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57717#c1 +# Replace double-float with single-float, revert this when above bug is fixed +PPCE500V2_CCARG = "${@'-te500v2' if d.getVar('SOURCERY_GXX_IS_PRO', True) == '1' else '-mcpu=8548 -mabi=spe -mspe -mfloat-gprs=single'}" +TUNE_CCARGS_append = "${@bb.utils.contains('TUNE_FEATURES', 'ppce500v2', ' ' + d.getVar('PPCE500V2_CCARG', True), '', d)}" + +PPCE500MC_CCARG = "${@'-te500mc' if d.getVar('SOURCERY_GXX_IS_PRO', True) == '1' else '-mcpu=e500mc'}" +TUNE_CCARGS_append = "${@bb.utils.contains('TUNE_FEATURES', 'ppce500mc', ' ' + d.getVar('PPCE500MC_CCARG', True), '', d)}" diff --git a/conf/distro/include/tcmode-external-sourcery-rebuild-libc.inc b/conf/distro/include/tcmode-external-sourcery-rebuild-libc.inc index f8a7fc5..00a9ffe 100644 --- a/conf/distro/include/tcmode-external-sourcery-rebuild-libc.inc +++ b/conf/distro/include/tcmode-external-sourcery-rebuild-libc.inc @@ -3,7 +3,8 @@ require conf/distro/include/tcmode-external-sourcery.inc PREFERRED_PROVIDER_virtual/libc = "glibc-sourcery" PREFERRED_PROVIDER_virtual/libiconv = "glibc-sourcery" PREFERRED_PROVIDER_virtual/libintl = "glibc-sourcery" +PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-initial = "glibc-sourcery" PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc = "glibc-sourcery" PREFERRED_PROVIDER_glibc = "glibc-sourcery" -CSL_SRC_URI ?= "file://${CSL_SRC_FILE}" -CSL_SRC_FILE ?= "${@bb.fatal('Please set CSL_SRC_FILE to the path to your sourcery src tarball')}" +SOURCERY_SRC_URI ?= "file://${SOURCERY_SRC_FILE}" +SOURCERY_SRC_FILE ?= "${@bb.fatal('Please set SOURCERY_SRC_FILE to the path to your sourcery src tarball')}" diff --git a/conf/distro/include/tcmode-external-sourcery.inc b/conf/distro/include/tcmode-external-sourcery.inc index 14f324c..37c0da2 100644 --- a/conf/distro/include/tcmode-external-sourcery.inc +++ b/conf/distro/include/tcmode-external-sourcery.inc @@ -9,82 +9,88 @@ EXTERNAL_TOOLCHAIN ?= "UNDEFINED" # errors or warnings. NO32LIBS ?= "0" +# We don't need or want to build a cross-compiler to ship in the sdk/ade, as +# we expect folks to use the Sourcery G++ toolchain on the SDKMACHINE as well. +TOOLCHAIN_HOST_TASK_remove = "packagegroup-cross-canadian-${MACHINE}" + # Ensure that we only attempt to package up locales which are available in the # external toolchain. In the future, we should examine the external toolchain # sysroot and determine this accurately. GLIBC_GENERATE_LOCALES_remove = "en_US.UTF-8" -# Don't ship any toolchain binaries in the sdk for the time being -# FIXME: find a way to do this just for the recipes which include those -# binaries. Potentially we could replace the packagegroup with an alternative -# version which includes nothing, or provide a bbclass which filters it out at -# RecipeParsed time. -#TOOLCHAIN_HOST_TASK ?= "nativesdk-packagegroup-sdk-host meta-environment-${TRANSLATED_TARGET_ARCH}" - -# Add the external toolchain to the sdk setup script PATH -INHERIT += "toolchain-scripts-external" - +# The binary locale files are common to the multilibs localedir = "${exec_prefix}/lib/locale" -CSL_TARGET_SYS_powerpc ?= "powerpc-linux-gnu powerpc-mentor-linux-gnu" -CSL_TARGET_SYS_powerpc64 ?= "powerpc-linux-gnu powerpc-mentor-linux-gnu" -CSL_TARGET_SYS_arm ?= "arm-none-linux-gnueabi arm-mentor-linux-gnueabi" -CSL_TARGET_SYS_mips ?= "mips-linux-gnu mips-mentor-linux-gnu" -CSL_TARGET_SYS_mipsel ?= "mips-linux-gnu mips-mentor-linux-gnu" -CSL_TARGET_SYS_mips64 ?= "mips64-nlm-linux-gnu mips-linux-gnu mips-mentor-linux-gnu" -CSL_TARGET_SYS_x86-64 ?= "i686-pc-linux-gnu i686-mentor-linux-gnu x86_64-linux-gnu x86_64-amd-linux-gnu" -CSL_TARGET_SYS_i686 ?= "i686-pc-linux-gnu i686-mentor-linux-gnu" -CSL_TARGET_SYS_i586 ?= "i686-pc-linux-gnu i686-mentor-linux-gnu" -CSL_TARGET_SYS = "${TARGET_SYS}" - -def csl_target_sys(d): - toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True) - - for triplet in d.getVar('CSL_TARGET_SYS', True).split(): - gcc = os.path.join(toolchain_path, 'bin', triplet + '-gcc') - if os.path.exists(gcc): - return triplet + '-' - return '${TARGET_SYS}-' - -TARGET_PREFIX = "${@csl_target_sys(d)}" - -PREFERRED_PROVIDER_linux-libc-headers = "external-sourcery-toolchain" -PREFERRED_PROVIDER_linux-libc-headers-dev = "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial = "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-intermediate = "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc ?= "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-initial ?= "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs = "external-sourcery-toolchain" -PREFERRED_PROVIDER_libgcc = "external-sourcery-toolchain" -PREFERRED_PROVIDER_glibc ?= "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/libc ?= "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/libintl ?= "external-sourcery-toolchain" -PREFERRED_PROVIDER_virtual/libiconv ?= "external-sourcery-toolchain" -PREFERRED_PROVIDER_gdbserver = "external-sourcery-toolchain" - # No need to re-compile the locale files -GLIBC_INTERNAL_USE_BINARY_LOCALE = "precompiled" +GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "precompiled" ENABLE_BINARY_LOCALE_GENERATION = "" +# Prefer our recipes which extract files from the external toolchain +PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc ?= "gcc-external-cross-${TARGET_ARCH}" +PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial ?= "gcc-external-cross-${TARGET_ARCH}" +PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-intermediate ?= "gcc-external-cross-${TARGET_ARCH}" +PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ ?= "gcc-external-cross-${TARGET_ARCH}" +PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils ?= "binutils-external-cross-${TARGET_ARCH}" +PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs ?= "gcc-runtime-external" +PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc ?= "glibc-external" +PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-initial ?= "glibc-external" +PREFERRED_PROVIDER_glibc ?= "glibc-external" +PREFERRED_PROVIDER_virtual/libc ?= "glibc-external" +PREFERRED_PROVIDER_virtual/libintl ?= "glibc-external" +PREFERRED_PROVIDER_virtual/libiconv ?= "glibc-external" + +PREFERRED_PROVIDER_gdbserver ??= "gdbserver-external" +PREFERRED_PROVIDER_oprofile ??= "oprofile" + +# These are defined in default-providers.inc, which is parsed before the +# tcmode, so we can't use ?= for them. +PREFERRED_PROVIDER_libgcc = "libgcc-external" +PREFERRED_PROVIDER_linux-libc-headers = "linux-libc-headers-external" + +# Ensure that we don't pull in any internal toolchain recipes +INHERIT += "blacklist" +PNBLACKLIST[uclibc] = "not building with an external toolchain" +PNBLACKLIST[uclibc-initial] = "not building with an external toolchain" +PNBLACKLIST[glibc] = "not building with an external toolchain" +PNBLACKLIST[glibc-initial] = "not building with an external toolchain" +PNBLACKLIST[glibc-intermediate] = "not building with an external toolchain" +PNBLACKLIST[binutils-cross] = "not building with an external toolchain" +PNBLACKLIST[gcc-cross] = "not building with an external toolchain" +PNBLACKLIST[gcc-cross-initial] = "not building with an external toolchain" +PNBLACKLIST[gcc-cross-intermediate] = "not building with an external toolchain" +PNBLACKLIST[gcc-runtime] = "not building with an external toolchain" +PNBLACKLIST[libgcc] = "not building with an external toolchain" +PNBLACKLIST[linux-libc-headers] = "not building with an external toolchain" +PNBLACKLIST[linux-libc-headers-yocto] = "not building with an external toolchain" +PNBLACKLIST[external-sourcery-toolchain] = "using meta-sourcery, not poky's external toolchain" + +# Determine the prefixes to check for based on the target architecture (before +# any classes alter TARGET_ARCH) +EXTERNAL_TARGET_SYSTEMS[powerpc] ?= "powerpc-linux-gnu powerpc-mentor-linux-gnu" +EXTERNAL_TARGET_SYSTEMS[powerpc64] ?= "powerpc-linux-gnu powerpc-mentor-linux-gnu" +EXTERNAL_TARGET_SYSTEMS[arm] ?= "arm-none-linux-gnueabi arm-mentor-linux-gnueabi" +EXTERNAL_TARGET_SYSTEMS[mips] ?= "mips-linux-gnu mips-mentor-linux-gnu" +EXTERNAL_TARGET_SYSTEMS[mipsel] ?= "mips-linux-gnu mips-mentor-linux-gnu" +EXTERNAL_TARGET_SYSTEMS[mips64] ?= "mips64-nlm-linux-gnu mips-linux-gnu mips-mentor-linux-gnu" +EXTERNAL_TARGET_SYSTEMS[x86_64] ?= "i686-pc-linux-gnu i686-mentor-linux-gnu x86_64-linux-gnu x86_64-amd-linux-gnu" +EXTERNAL_TARGET_SYSTEMS[i686] ?= "i686-pc-linux-gnu i686-mentor-linux-gnu" +EXTERNAL_TARGET_SYSTEMS[i586] ?= "i686-pc-linux-gnu i686-mentor-linux-gnu" +EXTERNAL_TARGET_SYSTEMS = "${TARGET_SYS}" + +def external_target_sys(d): + toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True) + + for triplet in d.getVar('EXTERNAL_TARGET_SYSTEMS', True).split(): + gcc = os.path.join(toolchain_path, 'bin', triplet + '-gcc') + if os.path.exists(gcc): + return triplet + return '${TARGET_SYS}' + +EXTERNAL_TARGET_SYS ?= "${@external_target_sys(d)}" +TARGET_PREFIX = "${EXTERNAL_TARGET_SYS}-" + TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_HOST}" -def sourcery_get_sysroot(d): - import subprocess - sysroot_cmd = "${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} -print-sysroot" - try: - toolchain_sysroot = bb.process.run(bb.data.expand(sysroot_cmd, d), - stderr=subprocess.PIPE, - env={"PATH": d.getVar('PATH', True)})[0].rstrip() - except bb.process.CmdError as exc: - bb.fatal(str(exc)) - else: - return toolchain_sysroot - -EXTERNAL_TOOLCHAIN_SYSROOT = "${@sourcery_get_sysroot(d)}" - CSL_IS_PRO = "${@'1' if os.path.exists('${EXTERNAL_TOOLCHAIN}/license') else '0'}" LDEMULATION = "" @@ -97,14 +103,10 @@ TUNE_LDARGS += "${@'-m ${LDEMULATION}' if LDEMULATION else ''}" export MGLS_LICENSE_FILE export LM_LICENSE_FILE -# Unfortunately, the CSL ia32 toolchain has non-prefixed binaries in its -# bindir (e.g. gcc, ld). To avoid this messing up our build, we avoid adding -# this bindir to our PATH, and instead add symlinks to the prefixed binaries -# to our staging toolchain bindir. - -ERROR_QA[type] ?= "list" python toolchain_metadata_setup () { import subprocess + import tempfile + d = e.data # Ensure that changes to toolchain licensing don't affect checksums @@ -112,7 +114,10 @@ python toolchain_metadata_setup () { l = d.createCopy() l.finalize() - oe_import(l) + + systems = l.getVarFlag('EXTERNAL_TARGET_SYSTEMS', l.getVar('TARGET_ARCH', True), True) + if systems: + d.setVar('EXTERNAL_TARGET_SYSTEMS', systems) # Remove already-added toolchain install paths from the PATH, as they can # break the build (in particular, the ia32 toolchain, as it provdes @@ -122,94 +127,64 @@ python toolchain_metadata_setup () { path = filter(lambda p: not p.startswith(install_prefix_default), path) d.setVar('PATH', ':'.join(path)) - external_toolchain = l.getVar('EXTERNAL_TOOLCHAIN', True) - if not external_toolchain or external_toolchain == 'UNDEFINED': - bb.fatal("Error: EXTERNAL_TOOLCHAIN must be set to the path to your sourcery toolchain") - - if not os.path.exists(external_toolchain): - bb.fatal("Error: EXTERNAL_TOOLCHAIN path '%s' does not exist" % external_toolchain) - - populate_toolchain_links(l) - # The external toolchain may not have been built with the yocto preferred # gnu hash setting, so ensure that the corresponding sanity check is a # warning, not an error. - error_qa = oe.data.typed_value('ERROR_QA', l) + error_qa = (l.getVar('ERROR_QA', True) or '').split() if 'ldflags' in error_qa: error_qa.remove('ldflags') d.setVar('ERROR_QA', ' '.join(error_qa)) d.appendVar('WARN_QA', ' ldflags') - # # Determine if '-msgxx-glibc' is a valid toolchain option. # If so then we need to use it to ensure that the libraries included with # the toolchain are used rather than the build host native libraries. - # - try: - sysroot_cmd_output = bb.process.run(bb.data.expand("${TARGET_PREFIX}gcc -msgxx-glibc -print-sysroot", l), - env={"PATH": l.getVar('PATH', True)})[0].rstrip() - except bb.process.CmdError as exc: - bb.fatal(str(exc)) - else: - if "unrecognized command line option '-msgxx-glibc'" not in sysroot_cmd_output: + with tempfile.NamedTemporaryFile(suffix='.c') as f: + try: + subprocess.check_output([d.expand('${EXTERNAL_TOOLCHAIN}/bin/${EXTERNAL_TARGET_SYS}-gcc'), '-msgxx-glibc', '-E', f.name], cwd=d.getVar('TOPDIR', True), stderr=subprocess.STDOUT) + except (OSError, subprocess.CalledProcessError): + return + else: d.appendVar('TUNE_CCARGS', ' -msgxx-glibc') } toolchain_metadata_setup[eventmask] = "bb.event.ConfigParsed" addhandler toolchain_metadata_setup -def populate_toolchain_links(d): - import errno - import os - from glob import glob +python toolchain_sanity_check () { + external_toolchain = e.data.getVar('EXTERNAL_TOOLCHAIN', True) + if not external_toolchain or external_toolchain == 'UNDEFINED': + bb.fatal("Error: EXTERNAL_TOOLCHAIN must be set to the path to your sourcery toolchain") - pattern = d.expand('${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}*') - files = glob(pattern) - if not files: - bb.fatal("Unable to populate toolchain binary symlinks in %s" % pattern) + if not os.path.exists(external_toolchain): + bb.fatal("Error: EXTERNAL_TOOLCHAIN path '%s' does not exist" % external_toolchain) +} +toolchain_sanity_check[eventmask] = "bb.event.BuildStarted" +addhandler toolchain_sanity_check - bindir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True) - bb.utils.mkdirhier(bindir) - wrapped = ['gcc', 'g++', 'cpp'] - for f in files: - base = os.path.basename(f) - newpath = os.path.join(bindir, base) - if not os.path.exists(newpath): - if any(base.endswith(w) for w in wrapped): - with open(newpath, 'w') as new: - new.write('#!/bin/sh\n') - new.write('export PSEUDO_UNLOAD=1\n') - new.write('exec {0} "$@"\n'.format(f)) - os.chmod(newpath, 0755) - else: - try: - os.symlink(f, newpath) - except OSError as exc: - if exc.errno == errno.EEXIST: - break - bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc)) +require conf/distro/include/external-run.inc - # Ensure that we have a ld.bfd available, now that KERNEL_LD uses it - ld = d.expand('${TARGET_PREFIX}ld') - ld_bfd = os.path.join(bindir, ld + '.bfd') - if not os.path.exists(ld_bfd): - try: - os.symlink(ld, ld_bfd) - except OSError as exc: - if exc.errno != errno.EEXIST: - bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (ld_bfd, exc)) +GCC_VERSION = "${@external_run(d, 'gcc', '-dumpversion').rstrip()}" +GCC_VERSION_allarch = "" +GCC_VERSION[vardepvalue] = "${GCC_VERSION}" -require conf/distro/include/csl-versions.inc - -def get_gcc_version_prefix(d): - ver = d.getVar('CSL_VER_GCC', True) - if ver: - components = ver.split('.') - if len(components) > 1: - return '.'.join(components[:2]) +def sourcery_version(d): + version = external_run(d, 'gcc', '-v').splitlines()[-1] + if version != 'UNKNOWN': + main_version = version.split()[-1].rstrip(')') + if main_version == 'Preview': + main_version = version.split()[-3] + return main_version else: - return '4.7%' + return version -# Prefer a matching gcc version -GCCVERSION ?= "${@get_gcc_version_prefix(d)}%" +SOURCERY_VERSION = "${@sourcery_version(d)}" +SOURCERY_VERSION_allarch = "" -BUILDCFG_VARS += "CSL_VER_MAIN EXTERNAL_TOOLCHAIN" +# Add sourcery toolchain version to external recipe versions +EXTERNAL_PV_SUFFIX ?= "-${SOURCERY_VERSION}" +EXTERNAL_PV_SUFFIX_allarch = "" + +BUILDCFG_VARS += "SOURCERY_VERSION GCC_VERSION EXTERNAL_TOOLCHAIN" + +# Adjust tunings to ensure we're using Sourcery G++ multilibs +require conf/distro/include/sourcery-tuning.inc diff --git a/conf/layer.conf b/conf/layer.conf index 3e52466..104dcea 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -1,15 +1,13 @@ BBPATH .= ":${LAYERDIR}" -BBFILES += "${LAYERDIR}/recipes/*/*.bb \ - ${LAYERDIR}/recipes/*/*.bbappend" +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" BBFILE_COLLECTIONS += "sourcery" -BBFILE_PRIORITY_sourcery = "10" +BBFILE_PRIORITY_sourcery = "2" BBFILE_PATTERN_sourcery = "^${LAYERDIR}/" LAYERDEPENDS_sourcery = "core" -# Let us add layer-specific bbappends which are only applied when that -# layer is included in our configuration BBFILES += "${@' '.join('${LAYERDIR}/%s/recipes*/*/*.%s' % (layer, ext) \ - for layer in BBFILE_COLLECTIONS.split() for ext in ['bb', 'bbappend'])}" + for layer in '${BBFILE_COLLECTIONS}'.split() for ext in ['bb', 'bbappend'])}" TCMODE = "external-sourcery" diff --git a/conf/machine/include/tune-ppce500mc.inc b/conf/machine/include/tune-ppce500mc.inc deleted file mode 100644 index a275c81..0000000 --- a/conf/machine/include/tune-ppce500mc.inc +++ /dev/null @@ -1,16 +0,0 @@ -DEFAULTTUNE ?= "ppce500mc" - -require conf/machine/include/powerpc/arch-powerpc.inc - -TUNEVALID[ppce500mc] = "Enable ppce500mc specific processor optimizations" - -PPCE500MC_CCARG = "${@'-te500mc' if d.getVar('CSL_IS_PRO', True) == '1' else '-mcpu=e500mc'}" -TUNE_CCARGS_append = " ${@bb.utils.contains("TUNE_FEATURES", "ppce500mc", PPCE500MC_CCARG, "", d)}" - -AVAILTUNES += "ppce500mc" -TUNE_FEATURES_tune-ppce500mc = "m32 fpu-hard ppce500mc" -TUNE_PKGARCH_tune-ppce500mc = "ppce500mc" -PACKAGE_EXTRA_ARCHS_tune-ppce500mc = "${PACKAGE_EXTRA_ARCHS_tune-powerpc} ppce500mc" - -# glibc configure options to get e500mc specific library (for sqrt) -GLIBC_EXTRA_OECONF += "${@bb.utils.contains("TUNE_FEATURES", "ppce500mc", "-with-cpu=e500mc", "", d)}" diff --git a/conf/machine/include/tune-ppce500v2.inc b/conf/machine/include/tune-ppce500v2.inc deleted file mode 100644 index f87d6e4..0000000 --- a/conf/machine/include/tune-ppce500v2.inc +++ /dev/null @@ -1,25 +0,0 @@ -DEFAULTTUNE ?= "ppce500v2" - -require conf/machine/include/powerpc/arch-powerpc.inc - -TUNEVALID[ppce500v2] = "Enable ppce500v2 specific processor optimizations" - -# FIXME -# Workaround for ICE of gcc-4.8.x when passing -mfloat-gprs=double -# Bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57717#c1 -# Replace double-float with single-float, revert this when above bug is fixed -PPCE500V2_CCARG = "${@'-te500v2' if d.getVar('CSL_IS_PRO', True) == '1' else '-mcpu=8548 -mabi=spe -mspe -mfloat-gprs=single'}" -TUNE_CCARGS_append = " ${@bb.utils.contains("TUNE_FEATURES", "ppce500v2", PPCE500V2_CCARG, "", d)}" - -# Note that SPE is implied by the ppce500v2 feature -TARGET_FPU .= "${@bb.utils.contains("TUNE_FEATURES", "ppce500v2", "ppc-efd", "", d)}" - -# spe is defined potentially in two places, so we want to be sure it will -# only write spe once to the ABIEXTENSIONS field. -SPEABIEXTENSION = "${@bb.utils.contains("TUNE_FEATURES", "ppce500v2", "spe", "", d)}" -ABIEXTENSION .= "${SPEABIEXTENSION}" - -AVAILTUNES += "ppce500v2" -TUNE_FEATURES_tune-ppce500v2 = "m32 ppce500v2" -TUNE_PKGARCH_tune-ppce500v2 = "ppce500v2" -PACKAGE_EXTRA_ARCHS_tune-ppce500v2 = "ppce500v2" diff --git a/recipes/glibc/glibc-locale_%.bbappend b/core/recipes-core/glibc/glibc-locale_%.bbappend similarity index 100% rename from recipes/glibc/glibc-locale_%.bbappend rename to core/recipes-core/glibc/glibc-locale_%.bbappend diff --git a/core/recipes-devtools/gdb/gdb_%.bbappend b/core/recipes-devtools/gdb/gdb_%.bbappend index 32da30b..504b2a5 100644 --- a/core/recipes-devtools/gdb/gdb_%.bbappend +++ b/core/recipes-devtools/gdb/gdb_%.bbappend @@ -1,5 +1,6 @@ -# Disable build of gdbserver because it is -# provided by external-sourcery-toolchain -PACKAGES := "${@oe_filter_out('gdbserver' if '${TCMODE}'.startswith('external-sourcery') else '$', '${PACKAGES}', d)}" -DISABLE_GDBSERVER := "${@'--disable-gdbserver' if '${TCMODE}'.startswith('external-sourcery') else ''}" +PROVIDES += "gdbserver" + +# Disable build of gdbserver if is provided by external-sourcery-toolchain +PACKAGES := "${@oe_filter_out('gdbserver' if '${PREFERRED_PROVIDER_gdbserver}' != '${PN}' else '$', '${PACKAGES}', d)}" +DISABLE_GDBSERVER := "${@'--disable-gdbserver' if '${PREFERRED_PROVIDER_gdbserver}' != '${PN}' else ''}" EXTRA_OECONF += "${DISABLE_GDBSERVER}" diff --git a/recipes-external/binutils/binutils-external-cross.bb b/recipes-external/binutils/binutils-external-cross.bb new file mode 100644 index 0000000..b5a9189 --- /dev/null +++ b/recipes-external/binutils/binutils-external-cross.bb @@ -0,0 +1,22 @@ +inherit external-toolchain-cross + +SUMMARY = "GNU binary utilities" +HOMEPAGE = "http://www.gnu.org/software/binutils/" +BUGTRACKER = "http://sourceware.org/bugzilla/" +SECTION = "devel" +PN .= "-${TARGET_ARCH}" +PV := "${@external_run(d, 'ld', '-v').splitlines()[0].split()[-1].rstrip()}" +LICENSE = "${@'GPLv3' if '${PV}'.split('.') > '2.17.50.0.12'.split('.') else 'GPLv2'}" + +PROVIDES += "\ + ${@'${PN}'.replace('-${TARGET_ARCH}', '')} \ + virtual/${TARGET_PREFIX}binutils \ +" + +EXTERNAL_CROSS_BINARIES = "ar as ld nm objcopy objdump ranlib strip \ + addr2line c++filt elfedit gprof readelf size \ + strings" + +do_install_append () { + ln -s ${TARGET_PREFIX}ld ${D}${bindir}/${TARGET_PREFIX}ld.bfd +} diff --git a/recipes-external/gcc/gcc-external-cross.bb b/recipes-external/gcc/gcc-external-cross.bb new file mode 100644 index 0000000..f8077d1 --- /dev/null +++ b/recipes-external/gcc/gcc-external-cross.bb @@ -0,0 +1,15 @@ +require recipes-external/gcc/gcc-external.inc +inherit external-toolchain-cross + +PN .= "-${TARGET_ARCH}" +DEPENDS += "virtual/${TARGET_PREFIX}binutils" +PROVIDES += "\ + ${@'${PN}'.replace('-${TARGET_ARCH}', '')} \ + \ + virtual/${TARGET_PREFIX}gcc-initial \ + virtual/${TARGET_PREFIX}gcc-intermediate \ + virtual/${TARGET_PREFIX}gcc \ + virtual/${TARGET_PREFIX}g++ \ +" + +EXTERNAL_CROSS_BINARIES = "${@'${gcc_binaries}'.replace('${TARGET_PREFIX}', '')}" diff --git a/recipes-external/gcc/gcc-external.inc b/recipes-external/gcc/gcc-external.inc new file mode 100644 index 0000000..ebe2e97 --- /dev/null +++ b/recipes-external/gcc/gcc-external.inc @@ -0,0 +1,19 @@ +SUMMARY = "The GNU Compiler Collection" +HOMEPAGE = "http://www.gnu.org/software/gcc/" +SECTION = "devel" +GCC_VERSION := "${@external_run(d, 'gcc', '-dumpversion').rstrip()}" +PV = "${GCC_VERSION}" + +inherit external-toolchain + +gcc_binaries = "\ + ${TARGET_PREFIX}gcc \ + ${TARGET_PREFIX}gcc-${@'${PV}'.replace('${EXTERNAL_PV_SUFFIX}', '')} \ + ${TARGET_PREFIX}gcc-ar \ + ${TARGET_PREFIX}gcc-nm \ + ${TARGET_PREFIX}gcc-ranlib \ + ${TARGET_PREFIX}gcov \ + ${TARGET_PREFIX}c++ \ + ${TARGET_PREFIX}g++ \ + ${TARGET_PREFIX}cpp \ +" diff --git a/recipes-external/gcc/gcc-runtime-external.bb b/recipes-external/gcc/gcc-runtime-external.bb new file mode 100644 index 0000000..f3f496e --- /dev/null +++ b/recipes-external/gcc/gcc-runtime-external.bb @@ -0,0 +1,106 @@ +inherit external-toolchain + +SUMMARY = "The GNU Compiler Collection - gcc runtime libraries" +HOMEPAGE = "http://www.gnu.org/software/gcc/" +SECTION = "devel" +GCC_VERSION := "${@external_run(d, 'gcc', '-dumpversion').rstrip()}" +PV = "${GCC_VERSION}" + +DEPENDS += "libgcc" +PROVIDES += "virtual/${TARGET_PREFIX}compilerlibs" + +PACKAGES =+ "\ + libstdc++ \ + libstdc++-dev \ + libstdc++-staticdev \ + libatomic \ + libatomic-dev \ + libatomic-staticdev \ + libasan \ + libasan-dev \ + libasan-staticdev \ + liblsan \ + liblsan-dev \ + liblsan-staticdev \ + libubsan \ + libubsan-dev \ + libubsan-staticdev \ + libtsan \ + libtsan-dev \ + libtsan-staticdev \ + libg2c \ + libg2c-dev \ + libg2c-staticdev \ + libfortran \ + libfortran-dev \ + libfortran-staticdev \ + libmudflap \ + libmudflap-dev \ + libmudflap-staticdev \ + libquadmath \ + libquadmath-dev \ + libquadmath-staticdev \ + libssp \ + libssp-dev \ + libssp-staticdev \ + libgomp \ + libgomp-dev \ + libgomp-staticdev \ + libitm \ + libitm-dev \ + libitm-staticdev \ +" + +SUMMARY_libitm = "The Transactional Memory runtime library" +SUMMARY_libitm-dev = "${SUMMARY_libitm} - development files" + +FILES_libstdc++ = "${libdir}/libstdc++${SOLIBS}" +FILES_libstdc++-dev = "${libdir}/libstdc++${SOLIBSDEV} \ + ${includedir}/c++/${GCC_VERSION}" +FILES_libstdc++-staticdev = "${libdir}/libstdc++.a \ + ${libdir}/libsupc++.a" +FILES_libatomic = "${libdir}/libatomic${SOLIBS}" +FILES_libatomic-dev = "${libdir}/libatomic${SOLIBSDEV}" +FILES_libatomic-staticdev = "${libdir}/libatomic.a" +FILES_libasan = "${libdir}/libasan${SOLIBS}" +FILES_libasan-dev = "${libdir}/libasan${SOLIBSDEV}" +FILES_libasan-staticdev = "${libdir}/libasan.a" +FILES_liblsan = "${libdir}/liblsan${SOLIBS}" +FILES_liblsan-dev = "${libdir}/liblsan${SOLIBSDEV}" +FILES_liblsan-staticdev = "${libdir}/liblsan.a" +FILES_libubsan = "${libdir}/libubsan${SOLIBS}" +FILES_libubsan-dev = "${libdir}/libubsan${SOLIBSDEV}" +FILES_libubsan-staticdev = "${libdir}/libubsan.a" +FILES_libtsan = "${libdir}/libtsan${SOLIBS}" +FILES_libtsan-dev = "${libdir}/libtsan${SOLIBSDEV}" +FILES_libtsan-staticdev = "${libdir}/libtsan.a" +FILES_libg2c = "${libdir}/libg2c${SOLIBS}" +FILES_libg2c-dev = "${libdir}/libg2c${SOLIBSDEV}" +FILES_libg2c-staticdev = "${libdir}/libg2c.a" +FILES_libfortran = "${libdir}/libfortran${SOLIBS}" +FILES_libfortran-dev = "${libdir}/libfortran${SOLIBSDEV}" +FILES_libfortran-staticdev = "${libdir}/libfortran.a" +FILES_libmudflap = "${libdir}/libmudflap${SOLIBS}" +FILES_libmudflap-dev = "${libdir}/libmudflap${SOLIBSDEV}" +FILES_libmudflap-staticdev = "${libdir}/libmudflap.a" +FILES_libquadmath = "${libdir}/libquadmath${SOLIBS}" +FILES_libquadmath-dev = "${libdir}/libquadmath${SOLIBSDEV}" +FILES_libquadmath-staticdev = "${libdir}/libquadmath.a" +FILES_libssp = "${libdir}/libssp${SOLIBS}" +FILES_libssp-dev = "${libdir}/libssp${SOLIBSDEV} \ + ${libdir}/gcc/*/*/include/ssp" +FILES_libssp-staticdev = "${libdir}/libssp.a" +FILES_libgomp = "${libdir}/libgomp${SOLIBS}" +FILES_libgomp-dev = "${libdir}/libgomp${SOLIBSDEV}" +FILES_libgomp-staticdev = "${libdir}/libgomp.a" +FILES_libitm = "${libdir}/libitm${SOLIBS}" +FILES_libitm-dev = "${libdir}/libitm${SOLIBSDEV}" +FILES_libitm-staticdev = "${libdir}/libitm.a" + +FILES_${PN}-dbg += "${datadir}/gdb/python/libstdcxx \ + ${datadir}/gcc-${GCC_VERSION}/python/libstdcxx" + +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" diff --git a/recipes-external/gcc/libgcc-external.bb b/recipes-external/gcc/libgcc-external.bb new file mode 100644 index 0000000..91a1984 --- /dev/null +++ b/recipes-external/gcc/libgcc-external.bb @@ -0,0 +1,31 @@ +SUMMARY = "The GNU Compiler Collection - libgcc" +HOMEPAGE = "http://www.gnu.org/software/gcc/" +SECTION = "devel" +GCC_VERSION := "${@external_run(d, 'gcc', '-dumpversion').rstrip()}" +PV = "${GCC_VERSION}" + +inherit external-toolchain + +PACKAGES =+ "libgcov-dev" + +FILES_${PN} = "${base_libdir}/libgcc_s.so.*" +FILES_${PN}-dev = "${base_libdir}/libgcc_s.so \ + ${libdir}/gcc/${EXTERNAL_TARGET_SYS}/${GCC_VERSION}/crtbegin.o \ + ${libdir}/gcc/${EXTERNAL_TARGET_SYS}/${GCC_VERSION}/crtbeginS.o \ + ${libdir}/gcc/${EXTERNAL_TARGET_SYS}/${GCC_VERSION}/crtbeginT.o \ + ${libdir}/gcc/${EXTERNAL_TARGET_SYS}/${GCC_VERSION}/crtend.o \ + ${libdir}/gcc/${EXTERNAL_TARGET_SYS}/${GCC_VERSION}/crtendS.o \ + ${libdir}/gcc/${EXTERNAL_TARGET_SYS}/${GCC_VERSION}/crtfastmath.o \ + ${libdir}/gcc/${EXTERNAL_TARGET_SYS}/${GCC_VERSION}/crtprec*.o \ + ${libdir}/gcc/${EXTERNAL_TARGET_SYS}/${GCC_VERSION}/libgcc.a \ + ${libdir}/gcc/${EXTERNAL_TARGET_SYS}/${GCC_VERSION}/libgcc_eh.a" +INSANE_SKIP_${PN}-dev += "staticdev" +FILES_${PN}-dbg += "${base_libdir}/.debug/libgcc_s.so.*.debug" +FILES_libgcov-dev = "${libdir}/gcc/${EXTERNAL_TARGET_SYS}/${GCC_VERSION}/libgcov.a" +INSANE_SKIP_libgcov-dev += "staticdev" + + +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" diff --git a/recipes-external/gdb/gdbserver-external.bb b/recipes-external/gdb/gdbserver-external.bb new file mode 100644 index 0000000..dddd5f5 --- /dev/null +++ b/recipes-external/gdb/gdbserver-external.bb @@ -0,0 +1,30 @@ +SUMMARY = "gdb - GNU debugger" +HOMEPAGE = "http://www.gnu.org/software/gdb/" +SECTION = "devel" +PV := "${@external_run(d, 'gdb', '-v').splitlines()[0].split()[-1]}" + +inherit external-toolchain + +def get_gdb_license(d): + output = external_run(d, 'gdb', '-v') + if output != 'UNKNOWN': + for line in output.splitlines(): + if line.startswith('License '): + lic = line.split(':', 1)[0] + return lic.replace('License ', '') + else: + return output + +LICENSE := "${@get_gdb_license(d)}" +LICENSE[vardepvalue] = "${LICENSE}" + +FILES_${PN} = "\ + ${bindir}/gdbserver \ + ${datadir}/gdb/guile \ + ${datadir}/gdb/python/gdb \ + ${datadir}/gdb/syscalls \ + ${datadir}/gdb/system-gdbinit \ + ${libdir}/libinproctrace.so \ +" +INSANE_SKIP_${PN} += "dev-so" +FILES_${PN}-doc = "${mandir}/man1/gdbserver.1" diff --git a/recipes-external/glibc/glibc-external.bb b/recipes-external/glibc/glibc-external.bb new file mode 100644 index 0000000..e5bd709 --- /dev/null +++ b/recipes-external/glibc/glibc-external.bb @@ -0,0 +1,133 @@ +SRC_URI = "file://SUPPORTED" + +require recipes-core/glibc/glibc-common.inc +inherit external-toolchain + +def get_external_libc_version(d): + sysroot = d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT', True) + libpath = os.path.join(sysroot, 'lib') + if os.path.exists(libpath): + for filename in os.listdir(libpath): + if filename.startswith('libc-'): + return filename[5:-3] + + return 'UNKNOWN' + +PV := "${@get_external_libc_version(d)}" + +DEPENDS += "virtual/${TARGET_PREFIX}binutils \ + linux-libc-headers" +PROVIDES += "glibc \ + virtual/${TARGET_PREFIX}libc-for-gcc \ + virtual/${TARGET_PREFIX}libc-initial \ + virtual/libc \ + virtual/libintl \ + virtual/libiconv" + +require recipes-external/glibc/glibc-sysroot-setup.inc +require recipes-external/glibc/glibc-package-adjusted.inc + +FILES_MIRRORS .= "\ + ${base_sbindir}/|/usr/bin/ \n\ + ${base_sbindir}/|/usr/${baselib}/bin/ \n\ + ${sbindir}/|/usr/bin/ \n\ + ${sbindir}/|/usr/${baselib}/bin/ \n\ +" + +python do_install () { + bb.build.exec_func('external_toolchain_do_install', d) + bb.build.exec_func('glibc_external_do_install_extra', d) +} + +glibc_external_do_install_extra () { + mkdir -p ${D}${sysconfdir} + touch ${D}${sysconfdir}/ld.so.conf + + if [ ! -e ${D}${libdir}/libc.so ]; then + bbfatal "Unable to locate installed libc.so file (${libdir}/libc.so)." \ + "This may mean that your external toolchain uses a different" \ + "multi-lib setup than your machine configuration" + fi +} + +EXTERNAL_EXTRA_FILES += "\ + ${datadir}/i18n \ + ${libdir}/gconv \ + ${localedir} \ +" + +# These files are picked up out of the sysroot by glibc-locale, so we don't +# need to keep them around ourselves. +do_install_locale_append() { + rm -rf ${D}${localedir} +} + +python () { + # Undo the do_install_append which joined shell to python + install = d.getVar('do_install', False) + python, shell = install.split('rm -f ', 1) + d.setVar('do_install_glibc', 'rm -f ' + shell) + d.setVarFlag('do_install_glibc', 'func', '1') + new_install = python + '\n bb.build.exec_func("do_install_glibc", d)\n' + d.setVar('do_install', new_install.replace('\t', ' ')) + + # Ensure that we pick up just libm, not all libs that start with m + baselibs = d.getVar('libc_baselibs', False) + baselibs.replace('${base_libdir}/libm*.so.*', '${base_libdir}/libm.so.*') + d.setVar('libc_baselibs', baselibs) +} + +# Default pattern is too greedy +FILES_${PN}-utils = "\ + ${bindir}/gencat \ + ${bindir}/getconf \ + ${bindir}/getent \ + ${bindir}/iconv \ + ${sbindir}/iconvconfig \ + ${bindir}/lddlibc4 \ + ${bindir}/locale \ + ${bindir}/makedb \ + ${bindir}/pcprofiledump \ + ${bindir}/pldd \ + ${bindir}/rpcgen \ + ${bindir}/sprof \ +" +FILES_${PN}-doc += "${infodir}/libc.info*" + +# Extract for use by do_install_locale +FILES_${PN} += "\ + ${bindir}/localedef \ + ${libdir}/gconv \ + ${libdir}/locale \ + ${datadir}/locale \ + ${datadir}/i18n \ +" + +FILES_${PN}-dev_remove := "${datadir}/aclocal" + +FILES_${PN}-dev_remove = "/lib/*.o" +FILES_${PN}-dev += "${libdir}/*crt*.o" + +libc_baselibs_dev += "${@' '.join('${libdir}/' + os.path.basename(l.replace('${SOLIBS}', '${SOLIBSDEV}')) for l in '${libc_baselibs}'.replace('${base_libdir}/ld*${SOLIBS}', '').split() if l.endswith('${SOLIBS}'))}" +FILES_${PN}-staticdev = "\ + ${@'${libc_baselibs_dev}'.replace('${SOLIBSDEV}', '.a')} \ + ${libdir}/libg.a \ + ${libdir}/libieee.a \ + ${libdir}/libmcheck.a \ + ${libdir}/librpcsvc.a \ +" + +FILES_${PN}-dev += "\ + ${libc_baselibs_dev} \ + ${libdir}/libcidn${SOLIBSDEV} \ + ${libdir}/libthread_db${SOLIBSDEV} \ + ${libdir}/libpthread${SOLIBSDEV} \ +" +libc_headers_file = "${@bb.utils.which('${FILESPATH}', 'libc.headers')}" +FILES_${PN}-dev += "\ + ${@' '.join('${includedir}/' + f.rstrip() for f in base_read_file('${libc_headers_file}').splitlines())} \ + ${includedir}/fpu_control.h \ + ${includedir}/stdc-predef.h \ + ${includedir}/uchar.h \ +" +FILES_${PN}-dev[file-checksums] += "${libc_headers_file}" diff --git a/recipes/meta/external-sourcery-toolchain/SUPPORTED b/recipes-external/glibc/glibc-external/SUPPORTED similarity index 100% rename from recipes/meta/external-sourcery-toolchain/SUPPORTED rename to recipes-external/glibc/glibc-external/SUPPORTED diff --git a/recipes-external/glibc/glibc-external/libc.headers b/recipes-external/glibc/glibc-external/libc.headers new file mode 100644 index 0000000..1a2db9d --- /dev/null +++ b/recipes-external/glibc/glibc-external/libc.headers @@ -0,0 +1,127 @@ +aio.h +aliases.h +alloca.h +a.out.h +argp.h +argz.h +ar.h +arpa +assert.h +byteswap.h +complex.h +cpio.h +crypt.h +ctype.h +dirent.h +dlfcn.h +elf.h +endian.h +envz.h +err.h +errno.h +error.h +execinfo.h +fcntl.h +features.h +fenv.h +fmtmsg.h +fnmatch.h +fstab.h +fts.h +ftw.h +_G_config.h +gconv.h +getopt.h +glob.h +gnu +gnu-versions.h +grp.h +gshadow.h +iconv.h +ieee754.h +ifaddrs.h +inttypes.h +langinfo.h +lastlog.h +libgen.h +libintl.h +libio.h +limits.h +link.h +locale.h +malloc.h +math.h +mcheck.h +memory.h +mntent.h +monetary.h +mqueue.h +net +netash +netatalk +netax25 +netdb.h +neteconet +netinet +netipx +netiucv +netpacket +netrom +netrose +nfs +nl_types.h +nss.h +obstack.h +paths.h +poll.h +printf.h +protocols +pthread.h +pty.h +pwd.h +re_comp.h +regex.h +regexp.h +resolv.h +rpc +rpcsvc +sched.h +scsi +search.h +semaphore.h +setjmp.h +sgtty.h +shadow.h +signal.h +spawn.h +stab.h +stdint.h +stdio_ext.h +stdio.h +stdlib.h +string.h +strings.h +stropts.h +syscall.h +sysexits.h +syslog.h +tar.h +termio.h +termios.h +tgmath.h +thread_db.h +time.h +ttyent.h +ucontext.h +ulimit.h +unistd.h +ustat.h +utime.h +utmp.h +utmpx.h +values.h +wait.h +wchar.h +wctype.h +wordexp.h +xlocale.h diff --git a/recipes/glibc/glibc-package-adjusted.inc b/recipes-external/glibc/glibc-package-adjusted.inc similarity index 100% rename from recipes/glibc/glibc-package-adjusted.inc rename to recipes-external/glibc/glibc-package-adjusted.inc diff --git a/recipes-external/glibc/glibc-sourcery.bb b/recipes-external/glibc/glibc-sourcery.bb new file mode 100644 index 0000000..ddb2d34 --- /dev/null +++ b/recipes-external/glibc/glibc-sourcery.bb @@ -0,0 +1,116 @@ +require recipes-core/glibc/glibc.inc + + +EXTERNAL_TOOLCHAIN_SYSROOT ?= "${@external_run(d, 'gcc', *(TARGET_CC_ARCH.split() + ['-print-sysroot'])).rstrip()}" + +LICENSE = "CLOSED" +LIC_FILES_CHKSUM = "" + +EXTERNAL_PV_PREFIX ?= "" +EXTERNAL_PV_SUFFIX ?= "" +PV_prepend = "${@'${EXTERNAL_PV_PREFIX}' if '${EXTERNAL_PV_PREFIX}' else ''}" +PV_append = "${@'${EXTERNAL_PV_SUFFIX}' if '${EXTERNAL_PV_SUFFIX}' else ''}" + +def get_external_libc_version(d): + sysroot = d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT', True) + libpath = oe.path.join(sysroot, d.getVar('base_libdir', True)) + if os.path.exists(libpath): + for filename in os.listdir(libpath): + if filename.startswith('libc-'): + return filename[5:-3] + + return 'UNKNOWN' + +PV := "${@get_external_libc_version(d)}" +SRC_PV = "${@'-'.join('${PV}'.split('-')[:-1])}" + +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS = "\ + virtual/${TARGET_PREFIX}gcc \ + linux-libc-headers \ +" +DEPENDS_remove = "libtool-cross make-native" + +PROVIDES += "glibc \ + virtual/${TARGET_PREFIX}libc-for-gcc \ + virtual/${TARGET_PREFIX}libc-initial \ + virtual/libc \ + virtual/libintl \ + virtual/libiconv" + +TOOLCHAIN_OPTIONS = "" + +SOURCERY_SRC_URI ?= "" +SRC_URI = "${SOURCERY_SRC_URI} \ + file://etc/ld.so.conf \ + file://generate-supported.mk" + +S = "${WORKDIR}/glibc-${SRC_PV}" +B = "${WORKDIR}/build-${TARGET_SYS}" + +do_unpack[vardeps] += "unpack_libc" +do_unpack[postfuncs] += "unpack_libc" + +unpack_libc () { + rm -rf ${S} + tar jxf */glibc-*.tar.bz2 + if tar jxf */glibc_ports-*.tar.bz2 2>/dev/null; then + mv glibc-ports-${SRC_PV}/ ${S}/ports + fi + + # Ensure that we can build with make 4.0 even with older glibc + #sed -i -e '/critic_missing make/s/\(\[3\.79\*[^,]*\)\],/[\1 | 4\.0],/' ${S}/configure.in + if [ -e "${S}/configure" ]; then + sed -i -e 's/\(^ *3.79\*[^)]*\))/\1 | 4.0)/' ${S}/configure + fi +} +unpack_libc[dirs] = "${WORKDIR}" + +TUNE_CCARGS_mips := "${@oe_filter_out('-march=mips32', '${TUNE_CCARGS}', d)}" +CPPFLAGS[unexport] = "1" +LDFLAGS[unexport] = "1" +BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}" +TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${layout_includedir}" + +export libc_cv_slibdir = "${base_libdir}" +EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \ + --without-cvs --disable-profile --disable-debug --without-gd \ + --enable-clocale=gnu \ + --enable-add-ons \ + --enable-obsolete-rpc \ + --with-headers=${STAGING_INCDIR} \ + --without-selinux \ + ${GLIBC_EXTRA_OECONF}" + +EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" + +oe_runmake () { + if [ "$1" = "config" ]; then + return + else + ${MAKE} ${EXTRA_OEMAKE} "$@" + fi +} + +do_configure () { + CPPFLAGS="" oe_runconf +} + +linux_include_subdirs = "asm asm-generic bits drm linux mtd rdma sound sys video" + +do_install_append () { + for dir in ${linux_include_subdirs}; do + rm -rf "${D}${includedir}/$dir" + done +} + +require recipes-external/glibc/glibc-sysroot-setup.inc +require recipes-external/glibc/glibc-package-adjusted.inc + +python () { + if not d.getVar("EXTERNAL_TOOLCHAIN"): + raise bb.parse.SkipPackage("External toolchain not configured (EXTERNAL_TOOLCHAIN not set).") + + if not d.getVar("SOURCERY_SRC_URI"): + raise bb.parse.SkipPackage("glibc-sourcery requires that SOURCERY_SRC_URI point to the sourcery source tarball") +} diff --git a/recipes/glibc/glibc-sourcery/etc/ld.so.conf b/recipes-external/glibc/glibc-sourcery/etc/ld.so.conf similarity index 100% rename from recipes/glibc/glibc-sourcery/etc/ld.so.conf rename to recipes-external/glibc/glibc-sourcery/etc/ld.so.conf diff --git a/recipes/glibc/glibc-sourcery/generate-supported.mk b/recipes-external/glibc/glibc-sourcery/generate-supported.mk similarity index 100% rename from recipes/glibc/glibc-sourcery/generate-supported.mk rename to recipes-external/glibc/glibc-sourcery/generate-supported.mk diff --git a/recipes-external/glibc/glibc-sysroot-setup.inc b/recipes-external/glibc/glibc-sysroot-setup.inc new file mode 100644 index 0000000..df02b73 --- /dev/null +++ b/recipes-external/glibc/glibc-sysroot-setup.inc @@ -0,0 +1,25 @@ +def sysroot_multilib_suffix(d): + PATH = d.getVar('PATH', True) + target_cc_arch = d.getVar('TARGET_CC_ARCH', True) + options = d.getVar('TOOLCHAIN_OPTIONS', True) or d.expand('--sysroot=${STAGING_DIR_TARGET}') + sysroot = external_run(d, 'gcc', *(target_cc_arch.split() + options.split() + ['-print-sysroot'])).rstrip() + staging = d.getVar('STAGING_DIR_HOST', True) + return os.path.relpath(sysroot, staging) + +create_multilib_link () { + dest="$1" + multilib_suffix="${@sysroot_multilib_suffix(d)}" + if [ "$multilib_suffix" != "." ]; then + rm -f $dest/$multilib_suffix + ln -s . $dest/$multilib_suffix + fi +} + +SYSROOT_PREPROCESS_FUNCS += "external_toolchain_sysroot_adjust" +external_toolchain_sysroot_adjust() { + create_multilib_link ${SYSROOT_DESTDIR} + + # If the usr/lib directory doesn't exist, the toolchain fails to even + # try to find crti.o in a completely different directory (usr/lib64) + install -d ${SYSROOT_DESTDIR}/usr/lib +} diff --git a/recipes-external/linux-libc-headers/linux-libc-headers-external.bb b/recipes-external/linux-libc-headers/linux-libc-headers-external.bb new file mode 100644 index 0000000..63663f5 --- /dev/null +++ b/recipes-external/linux-libc-headers/linux-libc-headers-external.bb @@ -0,0 +1,17 @@ +require recipes-kernel/linux-libc-headers/linux-libc-headers.inc +inherit external-toolchain + +LIC_FILES_CHKSUM = "${COMMON_LIC_CHKSUM}" +DEPENDS = "" +SRC_URI = "" + +linux_include_subdirs = "asm asm-generic bits drm linux mtd rdma sound sys video" +FILES_${PN}-dev = "${@' '.join('${includedir}/%s' % d for d in '${linux_include_subdirs}'.split())}" + +BBCLASSEXTEND = "" + +inherit multilib_header + +do_install_extra () { + oe_multilib_header bits/syscall.h +} diff --git a/recipes-external/oprofile/oprofile-external.bb b/recipes-external/oprofile/oprofile-external.bb new file mode 100644 index 0000000..1748ba9 --- /dev/null +++ b/recipes-external/oprofile/oprofile-external.bb @@ -0,0 +1,12 @@ +SUMMARY = "System-Wide Profiler" +DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \ +of profiling all running code at low overhead." +HOMEPAGE = "http://oprofile.sourceforge.net/news/" +BUGTRACKER = "http://sourceforge.net/tracker/?group_id=16191&atid=116191" +SECTION = "devel" + +inherit external-toolchain + +FILES_${PN} = "${bindir}/op* ${datadir}/oprofile" +FILES_${PN}-doc = "${docdir}/oprofile ${mandir}/man1/op*" +FILES_${PN}-staticdev = "${libdir}/oprofile/*.a" diff --git a/recipes/glibc/glibc-sourcery.bb b/recipes/glibc/glibc-sourcery.bb deleted file mode 100644 index d9ffabd..0000000 --- a/recipes/glibc/glibc-sourcery.bb +++ /dev/null @@ -1,73 +0,0 @@ -require recipes-core/glibc/glibc.inc - -PROVIDES += "glibc" - -TOOLCHAIN_OPTIONS = "" - -# sourceryg++-${CSL_VER_MAIN}-${CSL_TARGET_SYS}.src.tar.bz2 -CSL_SRC_URI ?= "" -SRC_URI = "${CSL_SRC_URI} \ - file://etc/ld.so.conf \ - file://generate-supported.mk" - -LIC_FILES_CHKSUM = "file://LICENSES;md5=98a1128c4b58120182cbea3b1752d8b9 \ - file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \ - file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ - file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff " - -S = "${WORKDIR}/glibc-${PV}" -B = "${WORKDIR}/build-${TARGET_SYS}" -LIBC_VER_MAIN = "${@'-'.join(CSL_VER_MAIN.split('-')[:-1])}" -PV = "${CSL_VER_LIBC}-${LIBC_VER_MAIN}" -PR = "r1" - -do_unpack[vardeps] += "unpack_libc" -do_unpack[postfuncs] += "unpack_libc" - -unpack_libc () { - rm -rf ${S} - tar jxf */glibc-${CSL_VER_MAIN}.tar.bz2 - if tar jxf */glibc_ports-${CSL_VER_MAIN}.tar.bz2; then - mv glibc-ports-${PV}/ ${S}/ports - fi -} -unpack_libc[dirs] = "${WORKDIR}" - -TUNE_CCARGS_mips := "${@oe_filter_out('-march=mips32', '${TUNE_CCARGS}', d)}" -CPPFLAGS[unexport] = "1" -LDFLAGS[unexport] = "1" -BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}" -TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${layout_includedir}" - -export libc_cv_slibdir = "${base_libdir}" -EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \ - --without-cvs --disable-profile --disable-debug --without-gd \ - --enable-clocale=gnu \ - --enable-add-ons \ - --with-headers=${STAGING_INCDIR} \ - --without-selinux \ - ${GLIBC_EXTRA_OECONF}" - -EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" - -oe_runmake () { - if [ "$1" = "config" ]; then - return - else - ${MAKE} ${EXTRA_OEMAKE} "$@" - fi -} - -do_configure () { - CPPFLAGS="" oe_runconf -} - -require recipes/glibc/glibc-package-adjusted.inc - -CSL_VER_MAIN ?= "" -CSL_VER_LIBC ?= "" - -python () { - if not d.getVar("CSL_VER_MAIN"): - raise bb.parse.SkipPackage("External CSL toolchain not configured (CSL_VER_MAIN not set).") -} diff --git a/recipes/meta/external-sourcery-toolchain.bb b/recipes/meta/external-sourcery-toolchain.bb deleted file mode 100644 index 5a7c3ac..0000000 --- a/recipes/meta/external-sourcery-toolchain.bb +++ /dev/null @@ -1,306 +0,0 @@ -ORIG_PACKAGES := "${PACKAGES}" - -require recipes/glibc/glibc-package-adjusted.inc - -INHIBIT_DEFAULT_DEPS = "1" - -# License applies to this recipe code, not the toolchain itself -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - -DEPENDS += "${@base_conditional('PREFERRED_PROVIDER_linux-libc-headers', PN, '', 'linux-libc-headers', d)}" -PROVIDES = "\ - virtual/${TARGET_PREFIX}gcc \ - virtual/${TARGET_PREFIX}g++ \ - virtual/${TARGET_PREFIX}gcc-initial \ - virtual/${TARGET_PREFIX}gcc-intermediate \ - virtual/${TARGET_PREFIX}binutils \ - virtual/${TARGET_PREFIX}compilerlibs \ - virtual/${TARGET_PREFIX}libc-initial \ - ${@base_conditional('PREFERRED_PROVIDER_linux-libc-headers', PN, 'linux-libc-headers', '', d)} \ - ${@base_conditional('PREFERRED_PROVIDER_virtual/libc', PN, 'virtual/libc virtual/libiconv virtual/libintl virtual/${TARGET_PREFIX}libc-for-gcc ${TCLIBC}', '', d)} \ - libgcc \ -" -PV = "${CSL_VER_MAIN}" -PR = "r22" - -#SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/${CSL_TARGET_SYS}/arm-${PV}-${TARGET_PREFIX}i686-pc-linux-gnu.tar.bz2" - -SRC_URI = "file://SUPPORTED" - -do_install() { - # Use optimized files if available - sysroot="${EXTERNAL_TOOLCHAIN_SYSROOT}" - - cp -a $sysroot${base_libdir}/. ${D}${base_libdir} - cp -a $sysroot/sbin/. ${D}${base_sbindir} - - install -d ${D}/usr - for usr_element in bin libexec sbin share ${base_libdir}; do - usr_path=$sysroot/usr/$usr_element - if [ -e "$usr_path" ]; then - cp -a $usr_path ${D}/usr/ - fi - done - if [ "${base_libdir}" != "/lib" ]; then - if [ -d $sysroot/usr/lib/locale ]; then - install -d ${D}/usr/lib - cp -a $sysroot/usr/lib/locale ${D}/usr/lib/ - fi - fi - - for datadir_element in man info; do - datadir_path=$sysroot/usr/$datadir_element - if [ -e $datadir_path ]; then - cp -a $datadir_path ${D}${datadir}/ - fi - done - - # Some toolchains have headers under the core specific area - if [ -e $sysroot/usr/include ]; then - cp -a $sysroot/usr/include/. ${D}${includedir} - else - cp -a $sysroot/../usr/include/. ${D}${includedir} - fi - - ${@base_conditional('PREFERRED_PROVIDER_linux-libc-headers', PN, 'sed -i -e "s/__packed/__attribute__ ((packed))/" ${D}${includedir}/mtd/ubi-user.h', 'rm -rf ${D}${includedir}/linux ${D}${includedir}/asm* ${D}${includedir}/drm ${D}${includedir}/video ${D}${includedir}/sound ${D}${includedir}/mtd ${D}${includedir}/rdma', d)} - rm -rf ${D}${datadir}/zoneinfo - - if [ -e ${D}${libdir}/bin ]; then - cp -a ${D}${libdir}/bin/. ${D}${bindir}/ - rm -r ${D}${libdir}/bin - install -d ${D}${libdir}/bin - ln -s ../../bin/gdbserver ${D}${libdir}/bin/sysroot-gdbserver - fi - - if [ ! -e ${D}${libdir}/libc.so ]; then - bbfatal "Unable to locate installed libc.so file (${D}${libdir}/libc.so)." \ - "This may mean that your external toolchain uses a different" \ - "multi-lib setup than your machine configuration" - fi - - sed -i -e "s# ${base_libdir}# ../..${base_libdir}#g" -e "s# ${libdir}# .#g" ${D}${libdir}/libc.so - sed -i -e "s# ${base_libdir}# ../..${base_libdir}#g" -e "s# ${libdir}# .#g" ${D}${libdir}/libpthread.so - - create_multilib_link ${D} - - rm -f ${D}${bindir}/sysroot-* - - # libuuid alone is of limited use, we'll end up building e2fsprogs anyway - rm -rf ${D}${libdir}/libuuid* ${D}${libdir}/.debug/libuuid* ${D}${includedir}/uuid - - ${@base_conditional('PREFERRED_PROVIDER_oprofile', PN, '', 'rm -rf ${D}${bindir}/op* ${D}${datadir}/oprofile ${D}${libdir}/oprofile ${D}${datadir}/stl.pat ${D}${mandir}/man1/oprofile* ${D}${docdir}/oprofile ${D}${bindir}/.debug/op* ${D}${includedir}/opagent.h', d)} - ${@base_conditional('PREFERRED_PROVIDER_popt', PN, '', 'rm -rf ${D}${libdir}/libpopt.* ${D}${includedir}/popt.h', d)} - ${@base_conditional('PREFERRED_PROVIDER_liburcu', PN, '', 'rm -rf ${D}${libdir}/liburcu*.* ${D}${includedir}/urcu*', d)} - ${@base_conditional('PREFERRED_PROVIDER_lttng-ust', PN, '', 'rm -rf ${D}${libdir}/liblttng-ust*.* ${D}${libdir}/libmet* ${D}${libdir}/mettools ${D}${includedir}/lttng/bug.h ${D}${includedir}/lttng/align.h ${D}${includedir}/lttng/ust*.h ${D}${includedir}/lttng/tracepoint*.h ${D}${includedir}/lttng/ringbuffer*.h', d)} - ${@base_conditional('PREFERRED_PROVIDER_lttng-tools', PN, '', 'rm -rf ${D}${bindir}/lttng* ${D}${libdir}/liblttng-ctl.so.* ${D}${libdir}/lttng ${D}${libdir}/liblttng-ctl.so ${D}${libdir}/liblttng-ctl.a ${D}${includedir}/lttng/lttng.h ${D}${libdir}/pkgconfig ${D}${includedir}/lttng/lttng-error.h', d)} - chown -R 0:0 ${D} - - # Remove files that are being provided by package util-linux - rm -rf ${D}${libdir}/libmount* ${D}${libdir}/libblkid* ${D}${includedir}/libmount/libmount.h ${D}${includedir}/blkid/blkid.h ${D}${datadir}/bash-completion - - if [ "${PACKAGE_DEBUG_SPLIT_STYLE}" == "debug-file-directory" ]; then - - install -d ${D}${libdir}/debug - - for dir in ${base_libdir} ${base_sbindir} ${libdir} ${bindir} ${sbindir} ${libdir}/audit ${libexecdir}/getconf; do - install -d ${D}${libdir}/debug$dir - mv ${D}$dir/.debug/*.debug ${D}${libdir}/debug$dir || true - rm -rf ${D}$dir/.debug - done - fi -} - -# These files are picked up out of the sysroot by glibc-locale, so we don't -# need to keep them around ourselves. -do_install_locale_append() { - rm -fr ${D}${exec_prefix}/lib/locale -} - -def sysroot_multilib_suffix(d): - PATH = d.getVar('PATH', True) - cmd = '${CC} -print-sysroot | sed -e "s,^${STAGING_DIR_HOST},,; s,^/,,"' - multilib_suffix = oe.path.check_output(bb.data.expand(cmd, d), shell=True, env={'PATH': PATH}).rstrip() - if multilib_suffix: - return '/' + multilib_suffix - else: - return '' - -create_multilib_link () { - dest="$1" - sysroot_multilib_suffix="${@sysroot_multilib_suffix(d)}" - if [ -n "$sysroot_multilib_suffix" ]; then - rm -f $dest/$sysroot_multilib_suffix - ln -s . $dest/$sysroot_multilib_suffix - fi -} - -SYSROOT_PREPROCESS_FUNCS += "external_toolchain_sysroot_adjust" -external_toolchain_sysroot_adjust() { - create_multilib_link ${SYSROOT_DESTDIR} - - # If the usr/lib directory doesn't exist, the toolchain fails to even - # try to find crti.o in a completely different directory (usr/lib64) - install -d ${SYSROOT_DESTDIR}/usr/lib -} - -TC_PACKAGES =+ "libgcc libgcc-dev" -TC_PACKAGES =+ "libgcov libgcov-dev" -TC_PACKAGES =+ "libgomp libgomp-dev libgomp-staticdev" -TC_PACKAGES =+ "libquadmath libquadmath-dev libquadmath-staticdev" -TC_PACKAGES =+ "libstdc++ libstdc++-dev libstdc++-staticdev" -TC_PACKAGES =+ "gdbserver gdbserver-dbg" -TC_PACKAGES =+ "libasan libasan-dev" -TC_PACKAGES =+ "libtsan libtsan-dev" -TC_PACKAGES =+ "libitm libitm-dev" -TC_PACKAGES =+ "libatomic libatomic-dev" -TC_PACKAGES =+ "libinproctrace" -TC_PACKAGES =+ "${@base_conditional('PREFERRED_PROVIDER_linux-libc-headers', PN, 'linux-libc-headers linux-libc-headers-dev', '', d)}" -TC_PACKAGES =+ "${@base_conditional('PREFERRED_PROVIDER_oprofile', PN, 'oprofile oprofile-doc', '', d)}" -TC_PACKAGES =+ "${@base_conditional('PREFERRED_PROVIDER_popt', PN, 'popt popt-dev', '', d)}" -TC_PACKAGES =+ "${@base_conditional('PREFERRED_PROVIDER_liburcu', PN, 'liburcu liburcu-dev', '', d)}" -TC_PACKAGES =+ "${@base_conditional('PREFERRED_PROVIDER_lttng-ust', PN, 'lttng-ust lttng-ust-dev', '', d)}" -TC_PACKAGES =+ "${@base_conditional('PREFERRED_PROVIDER_lttng-tools', PN, 'lttng-tools lttng-tools-dev', '', d)}" -PACKAGES =+ "${TC_PACKAGES}" - -FILES_${PN}-dev += "${@sysroot_multilib_suffix(d)}" -FILES_${PN} += "${prefix}/libexec/*" -FILES_${PN}-dbg += "${prefix}/libexec/*/.debug" - -FILES_libgcov = "${libdir}/libgcov.so.*" -FILES_libgcov-dev = "${libdir}/libgcov.so" - -SUMMARY_libasan = "The Address Sanitizer runtime library" -SUMMARY_libasan-dev = "${SUMMARY_libasan} - development files" -FILES_libasan = "${libdir}/libasan.so.*" -FILES_libasan-dev = "${libdir}/libasan.so" -FILES_libatomic = "${libdir}/libatomic.so.*" -FILES_libatomic-dev = "${libdir}/libatomic.so" -FILES_libinproctrace = "${libdir}/libinproctrace.so" -FILES_oprofile = "${bindir}/op* ${datadir}/oprofile ${libdir}/oprofile ${datadir}/stl.pat" -FILES_oprofile-doc = "${mandir}/man1/oprofile* ${docdir}/oprofile" -FILES_${PN}-dbg += "${bindir}/.debug/op*" - -SUMMARY_libtsan = "The Thread Sanitizer runtime library" -SUMMARY_libtsan-dev = "${SUMMARY_libtsan} - development files" -FILES_libtsan = "${libdir}/libtsan.so.*" -FILES_libtsan-dev = "${libdir}/libtsan.so" - -SUMMARY_libitm = "The Transactional Memory runtime library" -SUMMARY_libitm-dev = "${SUMMARY_libitm} - development files" -FILES_libitm = "${libdir}/libitm.so.*" -FILES_libitm-dev = "${libdir}/libitm.so" - -FILES_popt = "${libdir}/libpopt.so.*" -FILES_popt-dev = "${libdir}/libpopt.so ${libdir}/libpopt.a ${includedir}/popt.h" -FILES_lttng-tools = "${bindir}/lttng* ${libdir}/liblttng-ctl.so.* ${libdir}/lttng" -FILES_lttng-tools-dev = "${libdir}/liblttng-ctl.so ${libdir}/liblttng-ctl.a ${includedir}/lttng/lttng.h" -FILES_liburcu = "${libdir}/liburcu*.so.*" -FILES_liburcu-dev = "${libdir}/liburcu*.so ${libdir}/liburcu.a ${includedir}/urcu*" -FILES_lttng-ust = "${libdir}/liblttng-ust*.so.* ${libdir}/libmet*.so.* \ - ${libdir}/mettools/*.so" -FILES_lttng-ust-dev = "${libdir}/liblttng-ust*.so ${libdir}/liblttng-ust.a \ - ${libdir}/libmet*.so ${libdir}/mettools/.debug \ - ${includedir}/lttng/bug.h \ - ${includedir}/lttng/align.h \ - ${includedir}/lttng/ust*.h \ - ${includedir}/lttng/tracepoint*.h \ - ${includedir}/lttng/ringbuffer*.h \ - " -FILES_${PN}-dbg += "${libdir}/mettools/.debug" - -# Inhibit warnings about files being stripped, we can't do anything about it. -INHIBIT_PACKAGE_DEBUG_SPLIT = "1" - -# We support multiple toolchain versions, so an unpackaged file isn't -# necessarily a problem. -INSANE_SKIP_${PN} = "installed-vs-shipped" - -# This test should be fixed to ignore .a files in .debug dirs -INSANE_SKIP_${PN}-dbg = "staticdev" - -# We don't care about GNU_HASH in prebuilt binaries -INSANE_SKIP_${PN}-utils += "ldflags" -INSANE_SKIP_libgcc += "ldflags" -INSANE_SKIP_libasan += "ldflags" -INSANE_SKIP_libatomic += "ldflags" -INSANE_SKIP_libinproctrace += "ldflags" -INSANE_SKIP_libgomp += "ldflags" -INSANE_SKIP_libitm += "ldflags" -INSANE_SKIP_libquadmath += "ldflags" -INSANE_SKIP_libstdc++ += "ldflags" -INSANE_SKIP_libtsan += "ldflags" -INSANE_SKIP_gdbserver += "ldflags" - -# We don't care about rpaths in third party binaries -INSANE_SKIP_${PN}-utils += "useless-rpaths" - -PKGV = "${CSL_VER_LIBC}" -PKGV_libgcc = "${CSL_VER_GCC}" -PKGV_libgcc-dev = "${CSL_VER_GCC}" -PKGV_libasan = "${CSL_VER_GCC}" -PKGV_libasan-dev = "${CSL_VER_GCC}" -PKGV_libgomp = "${CSL_VER_GCC}" -PKGV_libgomp-dev = "${CSL_VER_GCC}" -PKGV_libgomp-staticdev = "${CSL_VER_GCC}" -PKGV_libitm = "${CSL_VER_GCC}" -PKGV_libitm-dev = "${CSL_VER_GCC}" -PKGV_libquadmath = "${CSL_VER_GCC}" -PKGV_libquadmath-dev = "${CSL_VER_GCC}" -PKGV_libquadmath-staticdev = "${CSL_VER_GCC}" -PKGV_libstdc++ = "${CSL_VER_GCC}" -PKGV_libstdc++-dev = "${CSL_VER_GCC}" -PKGV_libstdc++-staticdev = "${CSL_VER_GCC}" -PKGV_libtsan = "${CSL_VER_GCC}" -PKGV_libtsan-dev = "${CSL_VER_GCC}" -PKGV_libinproctrace = "${CSL_VER_GCC}" -PKGV_gdbserver = "${CSL_VER_GDB}" -PKGV_gdbserver-dbg = "${CSL_VER_GDB}" - -def csl_get_gdb_license(d): - try: - stdout, stderr = csl_run(d, 'gdb', '-v') - except bb.process.CmdError as c: - return 'UNKNOWN(%s)' % c - else: - for line in stdout.splitlines(): - if line.startswith('License '): - lic = line.split(':', 1)[0] - return lic.replace('License ', '') - - return 'UNKNOWN' - -CSL_LIC_GDB = "${@csl_get_gdb_license(d)}" -LICENSE_gdbserver = "${CSL_LIC_GDB}" -LICENSE_gdbserver-dbg = "${CSL_LIC_GDB}" - -FILES_libgcc = "${base_libdir}/libgcc_s.so.1" -FILES_libgcc-dev = "${base_libdir}/libgcc_s.so" -FILES_libgomp = "${libdir}/libgomp.so.*" -FILES_libgomp-dev = "${libdir}/libgomp.so" -FILES_libgomp-staticdev = "${libdir}/libgomp.a" -FILES_libquadmath = "${libdir}/libquadmath.so.*" -FILES_libquadmath-dev = "${libdir}/libquadmath.so" -FILES_libquadmath-staticdev = "${libdir}/libquadmath.so" -FILES_libstdc++ = "${libdir}/libstdc++.so.*" -FILES_libstdc++-dev = "${includedir}/c++/${PV} \ - ${libdir}/libstdc++.so \ - ${libdir}/libstdc++.la \ - ${libdir}/libsupc++.la" -FILES_libstdc++-staticdev = "${libdir}/libstdc++.a ${libdir}/libsupc++.a" -FILES_gdbserver = "${bindir}/gdbserver ${libdir}/bin/sysroot-gdbserver" -FILES_gdbserver-dbg = "${bindir}/.debug/gdbserver.debug" -FILES_gdbserver-dbg += "${libdir}/debug${bindir}/gdbserver.debug" - -CSL_VER_MAIN ??= "" - -python () { - if not d.getVar("CSL_VER_MAIN"): - raise bb.parse.SkipPackage("External CSL toolchain not configured (CSL_VER_MAIN not set).") - - pn = d.getVar('PN', True) - if d.getVar('PREFERRED_PROVIDER_virtual/libc', True) != pn: - d.setVar('PACKAGES', '${TC_PACKAGES}') - d.delVar('PKG_%s' % pn) - d.delVar('RPROVIDES_%s' % pn) -}