From 1d71845cc83c208c89b9c16ba1e1fd6e38f8de8f Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 18 Feb 2017 23:10:42 +0200 Subject: [PATCH] more work on merging with buildroot201702 --- Config.in | 401 +- Config.in.legacy | 464 ++- Makefile | 343 +- Makefile.legacy | 3 - linux/Config.ext.in | 80 +- linux/Config.in | 48 +- linux/Config.tools.in | 29 - linux/linux-ext-aufs.mk | 21 + linux/linux-ext-ev3dev-linux-drivers.mk | 12 + linux/linux-tool-cpupower.mk | 39 - linux/linux-tool-perf.mk | 101 - linux/linux.mk | 84 +- support/dependencies/check-host-cmake.mk | 18 + support/dependencies/check-host-cmake.sh | 39 + support/dependencies/dependencies.mk | 6 - support/dependencies/dependencies.sh | 13 +- support/download/bzr | 4 +- support/download/cp | 4 +- support/download/cvs | 4 +- support/download/dl-wrapper | 7 +- support/download/git | 55 +- support/download/hg | 4 +- support/download/scp | 4 +- support/download/svn | 4 +- support/download/wget | 4 +- support/dummy-external/Config.in | 0 support/dummy-external/external.mk | 0 support/gnuconfig/README.buildroot | 2 +- support/gnuconfig/config.guess | 350 +- support/gnuconfig/config.sub | 66 +- support/legal-info/README.header | 15 +- support/misc/Vagrantfile | 11 +- support/misc/toolchainfile.cmake.in | 39 +- support/misc/utils.mk | 115 + support/scripts/apply-patches.sh | 21 +- support/scripts/br2-external | 221 + support/scripts/check-host-rpath | 2 +- support/scripts/fix-configure-powerpc64.sh | 47 + support/scripts/gen-manual-lists.py | 513 --- support/scripts/get-developers | 83 + support/scripts/getdeveloperlib.py | 200 + support/scripts/graph-build-time | 2 +- support/scripts/graph-depends | 73 +- support/scripts/hardlink-or-copy | 35 + support/scripts/kconfiglib.py | 3541 ----------------- support/scripts/mkusers | 4 +- support/scripts/pkg-stats | 2 +- support/scripts/pkgutil.py | 62 + support/scripts/pycompile.py | 24 + support/scripts/readme.kconfiglib | 30 - support/scripts/scancpan | 54 +- support/scripts/scanpypi | 653 +++ support/scripts/size-stats | 13 +- support/scripts/test-pkg | 188 + system/Config.in | 165 +- system/device_table_dev.txt | 1 + system/skeleton/etc/group | 2 +- system/skeleton/etc/mtab | 2 +- .../skeleton/etc/network/if-pre-up.d/.empty | 0 system/skeleton/etc/passwd | 2 +- system/skeleton/var/lib/pcmcia | 1 - system/skeleton/var/pcmcia | 1 - system/skeleton/var/run | 2 +- toolchain/Config.in | 8 +- toolchain/helpers.mk | 80 +- toolchain/toolchain-buildroot/Config.in | 65 +- toolchain/toolchain-common.in | 89 +- toolchain/toolchain-external/Config.in | 1049 +---- .../pkg-toolchain-external.mk | 607 +++ .../Config.in | 61 + .../Config.in.options | 9 + ...toolchain-external-codescape-img-mips.hash | 4 + .../toolchain-external-codescape-img-mips.mk | 51 + .../Config.in | 72 + .../Config.in.options | 9 + ...toolchain-external-codescape-mti-mips.hash | 4 + .../toolchain-external-codescape-mti-mips.mk | 51 + .../Config.in | 17 + .../Config.in.options | 9 + ...olchain-external-codesourcery-aarch64.hash | 3 + ...toolchain-external-codesourcery-aarch64.mk | 22 + .../Config.in | 24 + .../Config.in.options | 9 + ...toolchain-external-codesourcery-amd64.hash | 3 + .../toolchain-external-codesourcery-amd64.mk | 12 + .../Config.in | 35 + .../Config.in.options | 9 + .../toolchain-external-codesourcery-arm.hash | 3 + .../toolchain-external-codesourcery-arm.mk | 13 + .../Config.in | 93 + .../Config.in.options | 9 + .../toolchain-external-codesourcery-mips.hash | 3 + .../toolchain-external-codesourcery-mips.mk | 13 + .../Config.in | 17 + .../Config.in.options | 9 + ...oolchain-external-codesourcery-niosII.hash | 3 + .../toolchain-external-codesourcery-niosII.mk | 13 + .../Config.in | 25 + .../Config.in.options | 9 + .../toolchain-external-codesourcery-sh.hash | 3 + .../toolchain-external-codesourcery-sh.mk | 13 + .../Config.in | 29 + .../Config.in.options | 9 + .../toolchain-external-codesourcery-x86.hash | 3 + .../toolchain-external-codesourcery-x86.mk | 12 + .../toolchain-external-custom/Config.in | 5 + .../Config.in.options | 349 ++ .../toolchain-external-custom.mk | 15 + .../Config.in | 15 + .../Config.in.options | 9 + .../toolchain-external-linaro-aarch64.hash | 3 + .../toolchain-external-linaro-aarch64.mk | 16 + .../toolchain-external-linaro-arm/Config.in | 27 + .../Config.in.options | 9 + .../toolchain-external-linaro-arm.hash | 3 + .../toolchain-external-linaro-arm.mk | 16 + .../toolchain-external-linaro-armeb/Config.in | 26 + .../Config.in.options | 9 + .../toolchain-external-linaro-armeb.hash | 3 + .../toolchain-external-linaro-armeb.mk | 16 + .../toolchain-external-synopsys-arc/Config.in | 18 + .../Config.in.options | 10 + .../toolchain-external-synopsys-arc.hash | 5 + .../toolchain-external-synopsys-arc.mk | 24 + .../toolchain-external.hash | 70 - .../toolchain-external/toolchain-external.mk | 793 +--- toolchain/toolchain-wrapper.c | 191 +- toolchain/toolchain-wrapper.mk | 16 +- toolchain/toolchain.mk | 4 +- toolchain/toolchain/toolchain.mk | 23 + 130 files changed, 5509 insertions(+), 7080 deletions(-) delete mode 100644 linux/Config.tools.in create mode 100644 linux/linux-ext-aufs.mk create mode 100644 linux/linux-ext-ev3dev-linux-drivers.mk delete mode 100644 linux/linux-tool-cpupower.mk delete mode 100644 linux/linux-tool-perf.mk create mode 100644 support/dependencies/check-host-cmake.mk create mode 100755 support/dependencies/check-host-cmake.sh delete mode 100644 support/dummy-external/Config.in delete mode 100644 support/dummy-external/external.mk create mode 100644 support/misc/utils.mk create mode 100755 support/scripts/br2-external create mode 100755 support/scripts/fix-configure-powerpc64.sh delete mode 100644 support/scripts/gen-manual-lists.py create mode 100755 support/scripts/get-developers create mode 100644 support/scripts/getdeveloperlib.py create mode 100755 support/scripts/hardlink-or-copy delete mode 100644 support/scripts/kconfiglib.py create mode 100644 support/scripts/pkgutil.py create mode 100644 support/scripts/pycompile.py delete mode 100644 support/scripts/readme.kconfiglib create mode 100755 support/scripts/scanpypi create mode 100755 support/scripts/test-pkg delete mode 100644 system/skeleton/etc/network/if-pre-up.d/.empty delete mode 120000 system/skeleton/var/lib/pcmcia delete mode 120000 system/skeleton/var/pcmcia create mode 100644 toolchain/toolchain-external/pkg-toolchain-external.mk create mode 100644 toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-codescape-img-mips/toolchain-external-codescape-img-mips.hash create mode 100644 toolchain/toolchain-external/toolchain-external-codescape-img-mips/toolchain-external-codescape-img-mips.mk create mode 100644 toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-codescape-mti-mips/toolchain-external-codescape-mti-mips.hash create mode 100644 toolchain/toolchain-external/toolchain-external-codescape-mti-mips/toolchain-external-codescape-mti-mips.mk create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/toolchain-external-codesourcery-aarch64.hash create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/toolchain-external-codesourcery-aarch64.mk create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-amd64/toolchain-external-codesourcery-amd64.hash create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-amd64/toolchain-external-codesourcery-amd64.mk create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-arm/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-arm/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-arm/toolchain-external-codesourcery-arm.hash create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-arm/toolchain-external-codesourcery-arm.mk create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-mips/toolchain-external-codesourcery-mips.hash create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-mips/toolchain-external-codesourcery-mips.mk create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.hash create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.mk create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-sh/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-sh/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-sh/toolchain-external-codesourcery-sh.hash create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-sh/toolchain-external-codesourcery-sh.mk create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-x86/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-x86/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-x86/toolchain-external-codesourcery-x86.hash create mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-x86/toolchain-external-codesourcery-x86.mk create mode 100644 toolchain/toolchain-external/toolchain-external-custom/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-custom/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-custom/toolchain-external-custom.mk create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-aarch64/toolchain-external-linaro-aarch64.hash create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-aarch64/toolchain-external-linaro-aarch64.mk create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-arm/toolchain-external-linaro-arm.hash create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-arm/toolchain-external-linaro-arm.mk create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-armeb/toolchain-external-linaro-armeb.hash create mode 100644 toolchain/toolchain-external/toolchain-external-linaro-armeb/toolchain-external-linaro-armeb.mk create mode 100644 toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in create mode 100644 toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in.options create mode 100644 toolchain/toolchain-external/toolchain-external-synopsys-arc/toolchain-external-synopsys-arc.hash create mode 100644 toolchain/toolchain-external/toolchain-external-synopsys-arc/toolchain-external-synopsys-arc.mk delete mode 100644 toolchain/toolchain-external/toolchain-external.hash diff --git a/Config.in b/Config.in index 9bc8e5193b..ccd777e8bb 100644 --- a/Config.in +++ b/Config.in @@ -14,18 +14,23 @@ config BR2_HOSTARCH string option env="HOSTARCH" -config BR2_EXTERNAL +config BR2_BUILD_DIR string - option env="BR2_EXTERNAL" + option env="BUILD_DIR" # Hidden config symbols for packages to check system gcc version config BR2_HOST_GCC_VERSION string option env="HOST_GCC_VERSION" +config BR2_HOST_GCC_AT_LEAST_4_5 + bool + default y if BR2_HOST_GCC_VERSION = "4 5" + config BR2_HOST_GCC_AT_LEAST_4_6 bool default y if BR2_HOST_GCC_VERSION = "4 6" + select BR2_HOST_GCC_AT_LEAST_4_5 config BR2_HOST_GCC_AT_LEAST_4_7 bool @@ -47,6 +52,11 @@ config BR2_HOST_GCC_AT_LEAST_5 default y if BR2_HOST_GCC_VERSION = "5" select BR2_HOST_GCC_AT_LEAST_4_9 +config BR2_HOST_GCC_AT_LEAST_6 + bool + default y if BR2_HOST_GCC_VERSION = "6" + select BR2_HOST_GCC_AT_LEAST_5 + # Hidden boolean selected by packages in need of Java in order to build # (example: xbmc) config BR2_NEEDS_HOST_JAVA @@ -74,6 +84,11 @@ config BR2_HOSTARCH_NEEDS_IA32_LIBS config BR2_HOSTARCH_NEEDS_IA32_COMPILER bool +# Hidden boolean selected by packages that need the host to have an +# UTF8 locale. +config BR2_NEEDS_HOST_UTF8_LOCALE + bool + source "arch/Config.in" menu "Build options" @@ -120,9 +135,9 @@ config BR2_ZCAT string "zcat command" default "gzip -d -c" help - Command to be used to extract a gzip'ed file to stdout. - zcat is identical to gunzip -c except that the former may - not be available on your system. + Command to be used to extract a gzip'ed file to stdout. zcat + is identical to gunzip -c except that the former may not be + available on your system. Default is "gzip -d -c" Other possible values include "gunzip -c" or "zcat". @@ -162,8 +177,8 @@ config BR2_DEFCONFIG default BR2_DEFCONFIG_FROM_ENV if BR2_DEFCONFIG_FROM_ENV != "" default "$(CONFIG_DIR)/defconfig" help - When running 'make savedefconfig', the defconfig file will be saved - in this location. + When running 'make savedefconfig', the defconfig file will be + saved in this location. config BR2_DL_DIR string "Download dir" @@ -171,7 +186,8 @@ config BR2_DL_DIR help Directory to store all the source files that we need to fetch. If the Linux shell environment has defined the BR2_DL_DIR - environment variable, then this overrides this configuration item. + environment variable, then this overrides this configuration + item. The default is $(TOPDIR)/dl @@ -179,9 +195,9 @@ config BR2_HOST_DIR string "Host dir" default "$(BASE_DIR)/host" help - Directory to store all the binary files that are built for the host. - This includes the cross compilation toolchain when building the - internal buildroot toolchain. + Directory to store all the binary files that are built for the + host. This includes the cross compilation toolchain when + building the internal buildroot toolchain. The default is $(BASE_DIR)/host @@ -191,9 +207,9 @@ config BR2_PRIMARY_SITE string "Primary download site" default "" help - Primary site to download from. If this option is set then buildroot - will try to download package source first from this site and try the - default if the file is not found. + Primary site to download from. If this option is set then + buildroot will try to download package source first from this + site and try the default if the file is not found. Valid URIs are: - URIs recognized by $(WGET) - local URIs of the form file://absolutepath @@ -206,11 +222,11 @@ config BR2_PRIMARY_SITE_ONLY If this option is enabled, downloads will only be attempted from the primary download site. Other locations, like the package's official download location or the backup download - site, will not be considered. Therefore, if the package is - not present on the primary site, the download fails. + site, will not be considered. Therefore, if the package is not + present on the primary site, the download fails. - This is useful for project developers who want to ensure - that the project can be built even if the upstream tarball + This is useful for project developers who want to ensure that + the project can be built even if the upstream tarball locations disappear. if !BR2_PRIMARY_SITE_ONLY @@ -219,32 +235,36 @@ config BR2_BACKUP_SITE string "Backup download site" default "http://sources.buildroot.net" help - Backup site to download from. If this option is set then buildroot - will fall back to download package sources from here if the - normal location fails. + Backup site to download from. If this option is set then + buildroot will fall back to download package sources from here + if the normal location fails. config BR2_KERNEL_MIRROR string "Kernel.org mirror" - default "https://www.kernel.org/pub" + default "https://cdn.kernel.org/pub" help - kernel.org is mirrored on a number of servers around the world. - The following allows you to select your preferred mirror. + kernel.org is mirrored on a number of servers around the + world. The following allows you to select your preferred + mirror. By default, a CDN is used, which automatically + redirects to a mirror geographically close to you. - Have a look on the kernel.org site for a list of mirrors, then enter - the URL to the base directory. Examples: + Have a look on the kernel.org site for a list of mirrors, then + enter the URL to the base directory. Examples: http://www.XX.kernel.org/pub (XX = country code) http://mirror.aarnet.edu.au/pub/ftp.kernel.org config BR2_GNU_MIRROR string "GNU Software mirror" - default "http://ftp.gnu.org/pub/gnu" + default "http://ftpmirror.gnu.org" help - GNU has multiple software mirrors scattered around the world. - The following allows you to select your preferred mirror. + GNU has multiple software mirrors scattered around the + world. The following allows you to select your preferred + mirror. By default, a generic address is used, which + automatically selects an up-to-date and local mirror. - Have a look on the gnu.org site for a list of mirrors, then enter - the URL to the base directory. Examples: + Have a look on the gnu.org site for a list of mirrors, then + enter the URL to the base directory. Examples: http://ftp.gnu.org/pub/gnu http://mirror.aarnet.edu.au/pub/gnu @@ -261,8 +281,8 @@ config BR2_CPAN_MIRROR string "CPAN mirror (Perl packages)" default "http://cpan.metacpan.org" help - CPAN (Comprehensive Perl Archive Network) is a repository - of Perl packages. It has multiple software mirrors scattered + CPAN (Comprehensive Perl Archive Network) is a repository of + Perl packages. It has multiple software mirrors scattered around the world. This option allows you to select a mirror. The list of mirrors is available at: @@ -276,24 +296,22 @@ config BR2_JLEVEL int "Number of jobs to run simultaneously (0 for auto)" default "0" help - Number of jobs to run simultaneously. If 0, determine - automatically according to number of CPUs on the host - system. + Number of jobs to run simultaneously. If 0, determine + automatically according to number of CPUs on the host system. config BR2_CCACHE bool "Enable compiler cache" help - This option will enable the use of ccache, a compiler - cache. It will cache the result of previous builds to speed - up future builds. By default, the cache is stored in + This option will enable the use of ccache, a compiler cache. + It will cache the result of previous builds to speed up future + builds. By default, the cache is stored in $HOME/.buildroot-ccache. Note that Buildroot does not try to invalidate the cache - contents when the compiler changes in an incompatible - way. Therefore, if you make a change to the compiler version - and/or configuration, you are responsible for purging the - ccache cache by removing the $HOME/.buildroot-ccache - directory. + contents when the compiler changes in an incompatible way. + Therefore, if you make a change to the compiler version and/or + configuration, you are responsible for purging the ccache + cache by removing the $HOME/.buildroot-ccache directory. if BR2_CCACHE @@ -306,16 +324,19 @@ config BR2_CCACHE_DIR config BR2_CCACHE_INITIAL_SETUP string "Compiler cache initial setup" help - Initial ccache settings to apply, such as --max-files or --max-size. + Initial ccache settings to apply, such as --max-files or + --max-size. - For example, if your project is known to require more space than the - default max cache size, then you might want to increase the cache size - to a suitable amount using the -M (--max-size) option. + For example, if your project is known to require more space + than the default max cache size, then you might want to + increase the cache size to a suitable amount using the -M + (--max-size) option. - The string you specify here is passed verbatim to ccache. Refer to - ccache documentation for more details. + The string you specify here is passed verbatim to ccache. + Refer to ccache documentation for more details. - These initial settings are applied after ccache has been compiled. + These initial settings are applied after ccache has been + compiled. config BR2_CCACHE_USE_BASEDIR bool "Use relative paths" @@ -324,55 +345,25 @@ config BR2_CCACHE_USE_BASEDIR Allow ccache to convert absolute paths within the output directory into relative paths. - During the build, many -I include directives are given with - an absolute path. These absolute paths end up in the hashes - that are computed by ccache. Therefore, when you build from a - different directory, the hash will be different and the - cached object will not be used. + During the build, many -I include directives are given with an + absolute path. These absolute paths end up in the hashes that + are computed by ccache. Therefore, when you build from a + different directory, the hash will be different and the cached + object will not be used. To improve cache performance, set this option to y. This allows ccache to rewrite absolute paths within the output - directory into relative paths. Note that only paths within - the output directory will be rewritten; therefore, if you - change BR2_HOST_DIR to point outside the output directory and + directory into relative paths. Note that only paths within the + output directory will be rewritten; therefore, if you change + BR2_HOST_DIR to point outside the output directory and subsequently move it to a different location, this will lead to cache misses. This option has as a result that the debug information in the object files also has only relative paths. Therefore, make sure you cd to the build directory before starting gdb. See - the section "COMPILING IN DIFFERENT DIRECTORIES" in the - ccache manual for more information. - -endif - -config BR2_DEPRECATED - bool "Show options and packages that are deprecated or obsolete" - help - This option shows outdated/obsolete versions of packages and - options that are otherwise hidden. - -if BR2_DEPRECATED - -config BR2_DEPRECATED_SINCE_2015_05 - bool - default y - -config BR2_DEPRECATED_SINCE_2015_08 - bool - default y - -config BR2_DEPRECATED_SINCE_2015_11 - bool - default y - -config BR2_DEPRECATED_SINCE_2016_02 - bool - default y - -config BR2_DEPRECATED_SINCE_2016_05 - bool - default y + the section "COMPILING IN DIFFERENT DIRECTORIES" in the ccache + manual for more information. endif @@ -396,11 +387,11 @@ choice config BR2_DEBUG_1 bool "debug level 1" help - Debug level 1 produces minimal information, enough - for making backtraces in parts of the program that - you don't plan to debug. This includes descriptions - of functions and external variables, but no information - about local variables and no line numbers. + Debug level 1 produces minimal information, enough for making + backtraces in parts of the program that you don't plan to + debug. This includes descriptions of functions and external + variables, but no information about local variables and no + line numbers. config BR2_DEBUG_2 bool "debug level 2" @@ -410,9 +401,9 @@ config BR2_DEBUG_2 config BR2_DEBUG_3 bool "debug level 3" help - Level 3 includes extra information, such as all the - macro definitions present in the program. Some debuggers - support macro expansion when you use -g3. + Level 3 includes extra information, such as all the macro + definitions present in the program. Some debuggers support + macro expansion when you use -g3. endchoice endif @@ -425,16 +416,15 @@ config BR2_STRIP_strip depends on !BR2_PACKAGE_HOST_ELF2FLT help Binaries and libraries in the target filesystem will be - stripped using the normal 'strip' command. This allows to - save space, mainly by removing debugging symbols. Debugging - symbols on the target are needed for native debugging, but - not when remote debugging is used. + stripped using the normal 'strip' command. This allows to save + space, mainly by removing debugging symbols. Debugging symbols + on the target are needed for native debugging, but not when + remote debugging is used. config BR2_STRIP_none bool "none" help - Do not strip binaries and libraries in the target - filesystem. + Do not strip binaries and libraries in the target filesystem. endchoice config BR2_STRIP_EXCLUDE_FILES @@ -442,19 +432,19 @@ config BR2_STRIP_EXCLUDE_FILES depends on !BR2_STRIP_none default "" help - You may specify a space-separated list of binaries and libraries - here that should not be stripped on the target. + You may specify a space-separated list of binaries and + libraries here that should not be stripped on the target. config BR2_STRIP_EXCLUDE_DIRS string "directories that should be skipped when stripping" depends on !BR2_STRIP_none default "" help - You may specify a space-separated list of directories that should - be skipped when stripping. Binaries and libraries in these - directories will not be touched. - The directories should be specified relative to the target directory, - without leading slash. + You may specify a space-separated list of directories that + should be skipped when stripping. Binaries and libraries in + these directories will not be touched. The directories should + be specified relative to the target directory, without leading + slash. choice prompt "gcc optimization level" @@ -470,54 +460,67 @@ config BR2_OPTIMIZE_0 config BR2_OPTIMIZE_1 bool "optimization level 1" help - Optimize. Optimizing compilation takes somewhat more time, - and a lot more memory for a large function. With -O, the - compiler tries to reduce code size and execution time, - without performing any optimizations that take a great deal - of compilation time. -O turns on the following optimization + Optimize. Optimizing compilation takes somewhat more time, and + a lot more memory for a large function. With -O, the compiler + tries to reduce code size and execution time, without + performing any optimizations that take a great deal of + compilation time. -O turns on the following optimization flags: -fdefer-pop -fdelayed-branch -fguess-branch-probability -fcprop-registers -floop-optimize -fif-conversion -fif-conversion2 -ftree-ccp -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs -ftree-sra -ftree-copyrename - -ftree-fre -ftree-ch -funit-at-a-time -fmerge-constants - -O also turns on -fomit-frame-pointer on machines where doing - so does not interfere with debugging. + -ftree-fre -ftree-ch -funit-at-a-time -fmerge-constants. -O + also turns on -fomit-frame-pointer on machines where doing so + does not interfere with debugging. config BR2_OPTIMIZE_2 bool "optimization level 2" help - Optimize even more. GCC performs nearly all supported optimizations - that do not involve a space-speed tradeoff. The compiler does not - perform loop unrolling or function inlining when you specify -O2. - As compared to -O, this option increases both compilation time and - the performance of the generated code. -O2 turns on all optimization - flags specified by -O. It also turns on the following optimization - flags: -fthread-jumps -fcrossjumping -foptimize-sibling-calls + Optimize even more. GCC performs nearly all supported + optimizations that do not involve a space-speed tradeoff. The + compiler does not perform loop unrolling or function inlining + when you specify -O2. As compared to -O, this option increases + both compilation time and the performance of the generated + code. -O2 turns on all optimization flags specified by -O. It + also turns on the following optimization flags: + -fthread-jumps -fcrossjumping -foptimize-sibling-calls -fcse-follow-jumps -fcse-skip-blocks -fgcse -fgcse-lm - -fexpensive-optimizations -fstrength-reduce -frerun-cse-after-loop - -frerun-loop-opt -fcaller-saves -fpeephole2 -fschedule-insns - -fschedule-insns2 -fsched-interblock -fsched-spec -fregmove - -fstrict-aliasing -fdelete-null-pointer-checks -freorder-blocks - -freorder-functions -falign-functions -falign-jumps -falign-loops - -falign-labels -ftree-vrp -ftree-pre - Please note the warning under -fgcse about invoking -O2 on programs + -fexpensive-optimizations -fstrength-reduce + -frerun-cse-after-loop -frerun-loop-opt -fcaller-saves + -fpeephole2 -fschedule-insns -fschedule-insns2 + -fsched-interblock -fsched-spec -fregmove -fstrict-aliasing + -fdelete-null-pointer-checks -freorder-blocks + -freorder-functions -falign-functions -falign-jumps + -falign-loops -falign-labels -ftree-vrp -ftree-pre. Please + note the warning under -fgcse about invoking -O2 on programs that use computed gotos. config BR2_OPTIMIZE_3 bool "optimization level 3" help - Optimize yet more. -O3 turns on all optimizations specified by -O2 - and also turns on the -finline-functions, -funswitch-loops and - -fgcse-after-reload options. + Optimize yet more. -O3 turns on all optimizations specified by + -O2 and also turns on the -finline-functions, -funswitch-loops + and -fgcse-after-reload options. + +config BR2_OPTIMIZE_G + bool "optimize for debugging" + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 + help + Optimize for debugging. This enables optimizations that do not + interfere with debugging. It should be the optimization level + of choice for the standard edit-compile-debug cycle, offering + a reasonable level of optimization while maintaining fast + compilation and a good debugging experience. config BR2_OPTIMIZE_S bool "optimize for size" help - Optimize for size. -Os enables all -O2 optimizations that do not - typically increase code size. It also performs further optimizations - designed to reduce code size. -Os disables the following optimization - flags: -falign-functions -falign-jumps -falign-loops -falign-labels - -freorder-blocks -freorder-blocks-and-partition -fprefetch-loop-arrays + Optimize for size. -Os enables all -O2 optimizations that do + not typically increase code size. It also performs further + optimizations designed to reduce code size. -Os disables the + following optimization flags: -falign-functions -falign-jumps + -falign-loops -falign-labels -freorder-blocks + -freorder-blocks-and-partition -fprefetch-loop-arrays -ftree-vect-loop-version endchoice @@ -526,16 +529,20 @@ config BR2_GOOGLE_BREAKPAD_ENABLE bool "Enable google-breakpad support" select BR2_PACKAGE_GOOGLE_BREAKPAD depends on BR2_INSTALL_LIBSTDCPP - depends on BR2_TOOLCHAIN_USES_GLIBC + depends on BR2_HOST_GCC_AT_LEAST_4_8 # C++11 + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11 + depends on BR2_USE_WCHAR + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on (BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_UCLIBC) depends on BR2_PACKAGE_GOOGLE_BREAKPAD_ARCH_SUPPORTS help - This option will enable the use of google breakpad, a - library and tool suite that allows you to distribute an - application to users with compiler-provided debugging - information removed, record crashes in compact "minidump" - files, send them back to your server and produce C and C++ - stack traces from these minidumps. Breakpad can also write - minidumps on request for programs that have not crashed. + This option will enable the use of google breakpad, a library + and tool suite that allows you to distribute an application to + users with compiler-provided debugging information removed, + record crashes in compact "minidump" files, send them back to + your server and produce C and C++ stack traces from these + minidumps. Breakpad can also write minidumps on request for + programs that have not crashed. if BR2_GOOGLE_BREAKPAD_ENABLE @@ -563,12 +570,13 @@ choice Enable stack smashing protection support using GCC's -fstack-protector option family. - See http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt + See + http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt for details. - Note that this requires the toolchain to have SSP - support. This is always the case for glibc and eglibc - toolchain, but is optional in uClibc toolchains. + Note that this requires the toolchain to have SSP support. + This is always the case for glibc and eglibc toolchain, but is + optional in uClibc toolchains. config BR2_SSP_NONE bool "None" @@ -616,20 +624,19 @@ choice help Select the type of libraries you want to use on the target. - The default is to build dynamic libraries and use those on - the target filesystem, except when the architecture and/or - the selected binary format does not support shared - libraries. + The default is to build dynamic libraries and use those on the + target filesystem, except when the architecture and/or the + selected binary format does not support shared libraries. config BR2_STATIC_LIBS bool "static only" help - Build and use only static libraries. No shared libraries - will be instaled on the target. This potentially increases - your code size and should only be used if you know what you - are doing. Note that some packages may not be available when - this option is enabled, due to their need for dynamic - library support. + Build and use only static libraries. No shared libraries will + be installed on the target. This potentially increases your + code size and should only be used if you know what you are + doing. Note that some packages may not be available when this + option is enabled, due to their need for dynamic library + support. config BR2_SHARED_LIBS bool "shared only" @@ -655,48 +662,67 @@ config BR2_PACKAGE_OVERRIDE_FILE default "$(CONFIG_DIR)/local.mk" help A package override file is a short makefile that contains - variable definitions of the form _OVERRIDE_SRCDIR, - which allows to tell Buildroot to use an existing directory - as the source directory for a particular package. See the - Buildroot documentation for more details on this feature. + variable definitions of the form _OVERRIDE_SRCDIR, which + allows to tell Buildroot to use an existing directory as the + source directory for a particular package. See the Buildroot + documentation for more details on this feature. config BR2_GLOBAL_PATCH_DIR string "global patch directories" help - You may specify a space separated list of one or more directories - containing global package patches. For a specific version - of a specific package , patches are - applied as follows: + You may specify a space separated list of one or more + directories containing global package patches. For a specific + version of a specific package , + patches are applied as follows: - First, the default Buildroot patch set for the package is applied - from the package's directory in Buildroot. + First, the default Buildroot patch set for the package is + applied from the package's directory in Buildroot. Then for every directory - - that exists in BR2_GLOBAL_PATCH_DIR, if the directory - /// exists, then all - *.patch files in this directory will be applied. + /// exists, + then all *.patch files in this directory will be applied. - Otherwise, if the directory / exists, - then all *.patch files in the directory will be applied. + Otherwise, if the directory / + exists, then all *.patch files in the directory will be + applied. menu "Advanced" config BR2_COMPILER_PARANOID_UNSAFE_PATH bool "paranoid check of library/header paths" + default y help By default, when this option is disabled, when the Buildroot - cross-compiler will encounter an unsafe library or header - path (such as /usr/include, or /usr/lib), the compiler will - display a warning. + cross-compiler will encounter an unsafe library or header path + (such as /usr/include, or /usr/lib), the compiler will display + a warning. - By enabling this option, this warning is turned into an - error, which will completely abort the build when such - unsafe paths are encountered. + By enabling this option, this warning is turned into an error, + which will completely abort the build when such unsafe paths + are encountered. Note that this mechanism is available for both the internal toolchain (through the toolchain wrapper and binutils patches) and external toolchain backends (through the toolchain wrapper). +config BR2_REPRODUCIBLE + bool "Make the build reproducible (experimental)" + help + This option will remove all sources of non-reproducibility + from the build process. For a given Buildroot configuration, + this allows to generate exactly identical binaries from one + build to the other, including on different machines. + + The current implementation is restricted to builds with the + same output directory. Many (absolute) paths are recorded in + intermediary files, and it is very likely that some of these + paths leak into the target rootfs. If you build with the + same O=... path, however, the result is identical. + + This is labeled as an experimental feature, as not all + packages behave properly to ensure reproducibility. + endmenu endmenu @@ -717,9 +743,4 @@ source "package/Config.in.host" source "Config.in.legacy" -menu "User-provided options" - depends on BR2_EXTERNAL != "support/dummy-external" - -source "$BR2_EXTERNAL/Config.in" - -endmenu +source "$BR2_BUILD_DIR/.br2-external.in" diff --git a/Config.in.legacy b/Config.in.legacy index b9c2f004f9..20445b8a17 100644 --- a/Config.in.legacy +++ b/Config.in.legacy @@ -142,6 +142,402 @@ comment "build, or run, in unpredictable ways. " comment "----------------------------------------------------" endif +############################################################################### +comment "Legacy options removed in 2017.02" + +config BR2_PACKAGE_PERL_DB_FILE + bool "perl-db-file removed" + select BR2_LEGACY + select BR2_PACKAGE_BERKELEYDB + select BR2_PACKAGE_PERL + help + DB_File can be built as a core Perl module, so the separate + perl-db-file package has been removed. + +config BR2_KERNEL_HEADERS_4_7 + bool "kernel headers version 4.7.x are no longer supported" + select BR2_KERNEL_HEADERS_4_4 + select BR2_LEGACY + help + Version 4.7.x of the Linux kernel headers are no longer + maintained upstream and are now removed. As an alternative, + version 4.4.x of the headers have been automatically + selected in your configuration. + +config BR2_KERNEL_HEADERS_4_6 + bool "kernel headers version 4.6.x are no longer supported" + select BR2_KERNEL_HEADERS_4_4 + select BR2_LEGACY + help + Version 4.6.x of the Linux kernel headers are no longer + maintained upstream and are now removed. As an alternative, + version 4.4.x of the headers have been automatically + selected in your configuration. + +config BR2_KERNEL_HEADERS_4_5 + bool "kernel headers version 4.5.x are no longer supported" + select BR2_KERNEL_HEADERS_4_4 + select BR2_LEGACY + help + Version 4.5.x of the Linux kernel headers are no longer + maintained upstream and are now removed. As an alternative, + version 4.4.x of the headers have been automatically + selected in your configuration. + +config BR2_KERNEL_HEADERS_3_14 + bool "kernel headers version 3.14.x are no longer supported" + select BR2_KERNEL_HEADERS_3_12 + select BR2_LEGACY + help + Version 3.14.x of the Linux kernel headers are no longer + maintained upstream and are now removed. As an alternative, + version 3.12.x of the headers have been automatically + selected in your configuration. + +config BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS + bool "musl-cross 1.1.12 toolchain removed" + select BR2_LEGACY + help + The support for the prebuilt toolchain based on the Musl C + library provided by the musl-cross project has been removed. + Upstream doesn't provide any prebuilt toolchain anymore, use the + Buildroot toolchain instead. + +config BR2_UCLIBC_INSTALL_TEST_SUITE + bool "uClibc tests now in uclibc-ng-test" + select BR2_LEGACY + select BR2_PACKAGE_UCLIBC_NG_TEST + help + The test suite of the uClibc C library has been moved into a + separate package, uclibc-ng-test. + +config BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX + bool "Blackfin.uclinux.org 2014R1 toolchain removed" + select BR2_LEGACY + help + The ADI Blackfin toolchain has many bugs which are fixed in + more recent gcc and uClibc-ng releases. Use the Buildroot + toolchain instead. + +config BR2_PACKAGE_MAKEDEVS + bool "makedevs removed" + select BR2_LEGACY + help + The makedevs tool is part of busybox. The Buildroot fork + should not be used outside of the Buildroot infrastructure. + +config BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV7A + bool "Arago ARMv7 2011.09 removed" + select BR2_LEGACY + help + The Arago toolchains are every old and not updated anymore. + +config BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE + bool "Arago ARMv5 2011.09 removed" + select BR2_LEGACY + help + The Arago toolchains are every old and not updated anymore. + +config BR2_PACKAGE_SNOWBALL_HDMISERVICE + bool "snowball-hdmiservice removed" + select BR2_LEGACY + help + We no longer have support for the Snowball platform in + Buildroot, so this package was no longer useful. + +config BR2_PACKAGE_SNOWBALL_INIT + bool "snowball-init removed" + select BR2_LEGACY + help + We no longer have support for the Snowball platform in + Buildroot, so this package was no longer useful. + +config BR2_GDB_VERSION_7_9 + bool "gdb 7.9 has been removed" + select BR2_LEGACY + help + The 7.9 version of gdb has been removed. Use a newer version + instead. + +############################################################################### +comment "Legacy options removed in 2016.11" + +config BR2_PACKAGE_PHP_SAPI_CLI_CGI + bool "PHP CGI and CLI options are now seperate" + select BR2_PACKAGE_PHP_SAPI_CLI + select BR2_PACKAGE_PHP_SAPI_CGI + select BR2_LEGACY + help + The PHP Interface options have been split up into a + separate option for each interface. + +config BR2_PACKAGE_PHP_SAPI_CLI_FPM + bool "PHP CLI and FPM options are now separate" + select BR2_PACKAGE_PHP_SAPI_CLI + select BR2_PACKAGE_PHP_SAPI_FPM + select BR2_LEGACY + help + The PHP Interface options have been split up into a + separate option for each interface. + +config BR2_PACKAGE_WVSTREAMS + bool "wvstreams removed" + select BR2_LEGACY + help + wvstreams is not maintained anymore since about 2009. It also + doesn't build anymore with recent compilers (GCC 5+). + +config BR2_PACKAGE_WVDIAL + bool "wvdial removed" + select BR2_LEGACY + help + wvdial is not maintained anymore since about 2009. It also + doesn't build anymore with recent compilers (GCC 5+). + +config BR2_PACKAGE_WEBKITGTK24 + bool "webkitgtk 2.4.x removed" + select BR2_LEGACY + help + This legacy package only existed because some other packages + depended on that specific version of webkitgtk. However, the + other packages have been fixed. webkitgtk 2.4 is full of + security issues so it needs to be removed. + +config BR2_PACKAGE_TORSMO + bool "torsmo removed" + select BR2_LEGACY + help + torsmo has been unmaintained for a long time, and nobody + seems to be interested in it. + +config BR2_PACKAGE_SSTRIP + bool "sstrip removed" + select BR2_LEGACY + help + sstrip is unmaintained and potentially harmful. It doesn't + save so much compared to normal binutils strip, and there is + a big risk of binaries that don't work. Use normal strip + instead. + +config BR2_KERNEL_HEADERS_4_3 + bool "kernel headers version 4.3.x are no longer supported" + select BR2_KERNEL_HEADERS_4_1 + select BR2_LEGACY + help + Version 4.3.x of the Linux kernel headers are no longer + maintained upstream and are now removed. As an alternative, + version 4.1.x of the headers have been automatically + selected in your configuration. + +config BR2_KERNEL_HEADERS_4_2 + bool "kernel headers version 4.2.x are no longer supported" + select BR2_KERNEL_HEADERS_4_1 + select BR2_LEGACY + help + Version 4.2.x of the Linux kernel headers are no longer + maintained upstream and are now removed. As an alternative, + version 4.1.x of the headers have been automatically + selected in your configuration. + +config BR2_PACKAGE_KODI_ADDON_XVDR + bool "kodi-addon-xvdr removed" + select BR2_LEGACY + help + According to the github project page: + https://github.com/pipelka/xbmc-addon-xvdr + this package is discontinued. + +config BR2_PACKAGE_IPKG + bool "ipkg removed" + select BR2_LEGACY + help + ipkg dates back to the early 2000s when Compaq started the + handhelds.org project and it hasn't seen development since 2006. + Use opkg as a replacement. + +config BR2_GCC_VERSION_4_7_X + bool "gcc 4.7.x support removed" + select BR2_LEGACY + help + Support for gcc version 4.7.x has been removed. The current + default version (4.9.x or later) has been selected instead. + +config BR2_BINUTILS_VERSION_2_24_X + bool "binutils version 2.24 support removed" + select BR2_LEGACY + help + Support for binutils version 2.24 has been removed. The + current default version (2.26 or later) has been selected + instead. + +config BR2_PACKAGE_WESTON_RPI + bool "Weston propietary RPI support is gone" + select BR2_LEGACY + help + Upstream decided the propietary (rpi-userland) weston composer + support wasn't worth the effort so it was removed. Switch to + the open VC4 support. + +config BR2_LINUX_KERNEL_TOOL_CPUPOWER + bool "linux-tool cpupower" + depends on BR2_LINUX_KERNEL + select BR2_LEGACY + select BR2_PACKAGE_LINUX_TOOLS_CPUPOWER + help + Linux tool cpupower option was renamed. + +config BR2_LINUX_KERNEL_TOOL_PERF + bool "linux-tool perf" + depends on BR2_LINUX_KERNEL + select BR2_LEGACY + select BR2_PACKAGE_LINUX_TOOLS_PERF + help + Linux tool perf option was renamed. + +config BR2_LINUX_KERNEL_TOOL_SELFTESTS + bool "linux-tool selftests" + depends on BR2_LINUX_KERNEL + select BR2_LEGACY + select BR2_PACKAGE_LINUX_TOOLS_SELFTESTS + help + Linux tool selftests option was renamed. + +config BR2_GCC_VERSION_4_8_ARC + bool "gcc arc option renamed" + select BR2_LEGACY + select BR2_GCC_VERSION_ARC + help + The option that selects the gcc version for the ARC + architecture has been renamed to BR2_GCC_VERSION_ARC. + +config BR2_KERNEL_HEADERS_4_0 + bool "kernel headers version 4.0.x are no longer supported" + select BR2_KERNEL_HEADERS_3_18 + select BR2_LEGACY + help + Version 4.0.x of the Linux kernel headers have been deprecated + for more than four buildroot releases and are now removed. + As an alternative, version 3.18.x of the headers have been + automatically selected in your configuration. + +config BR2_KERNEL_HEADERS_3_19 + bool "kernel headers version 3.19.x are no longer supported" + select BR2_KERNEL_HEADERS_3_18 + select BR2_LEGACY + help + Version 3.19.x of the Linux kernel headers have been deprecated + for more than four buildroot releases and are now removed. + As an alternative, version 3.18.x of the headers have been + automatically selected in your configuration. + +config BR2_PACKAGE_LIBEVAS_GENERIC_LOADERS + bool "libevas-generic-loaders package removed" + select BR2_LEGACY + select BR2_PACKAGE_EFL + help + With EFL 1.18, libevas-generic-loaders is now provided by the efl + package. + +config BR2_PACKAGE_ELEMENTARY + bool "elementary package removed" + select BR2_LEGACY + select BR2_PACKAGE_EFL + help + With EFL 1.18, elementary is now provided by the efl package. + +config BR2_LINUX_KERNEL_CUSTOM_LOCAL + bool "Linux kernel local directory option removed" + help + The option to select a local directory as the source of the Linux + kernel has been removed. It hurts reproducibility of builds. + + In case you were using this option during development of your + Linux kernel, use the override mechanism instead. + +############################################################################### +comment "Legacy options removed in 2016.08" + +config BR2_PACKAGE_SYSTEMD_COMPAT + bool "systemd compatibility libraries have been removed" + select BR2_LEGACY + help + The systemd option to enable the compatibility libraries has + been removed. Theses libraries have been useless since a few + version, and have been fully dropped from the source since + v230. + +config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_LIVEADDER + bool "gst1-plugins-bad liveadder plugin removed" + select BR2_LEGACY + select BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_AUDIOMIXER + help + The functionality of the liveadder plugin of the + gst1-plugins-bad package has been merged into audiomixer. + +config BR2_PACKAGE_LIBFSLVPUWRAP + bool "libfslvpuwrap has been renamed to imx-vpuwrap" + select BR2_LEGACY + select BR2_PACKAGE_IMX_VPUWRAP + help + The libfslvpuwrap has been renamed to match the renamed package. + +config BR2_PACKAGE_LIBFSLPARSER + bool "libfslparser has been renamed to imx-parser" + select BR2_LEGACY + select BR2_PACKAGE_IMX_PARSER + help + The libfslparser has been renamed to match the renamed package. + +config BR2_PACKAGE_LIBFSLCODEC + bool "libfslcodec has been renamed to imx-codec" + select BR2_LEGACY + select BR2_PACKAGE_IMX_CODEC + help + The libfslcodec has been renamed to match the renamed package. + +config BR2_PACKAGE_UBOOT_TOOLS_MKIMAGE_FIT_SIGNATURE_SUPPORT + bool "FIT support in uboot-tools has been refactored" + select BR2_LEGACY + select BR2_PACKAGE_DTC + select BR2_PACKAGE_DTC_PROGRAMS + select BR2_PACKAGE_UBOOT_TOOLS_FIT_SUPPORT + select BR2_PACKAGE_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT + select BR2_PACKAGE_UBOOT_TOOLS_MKIMAGE + help + This option has been removed in favor of a more fine-grained + configuration, which is recommended. Selecting this option + enables FIT and FIT signature support for the target packages. + It will also select the dtc and openssl packages. + +config BR2_PTHREADS_OLD + bool "linuxthreads (stable/old)" + select BR2_LEGACY + help + Linuxthreads have been reworked, BR2_PTHREADS_OLD is now + BR2_PTHREADS and the old BR2_PTHREADS - LT.new got removed. + +config BR2_BINUTILS_VERSION_2_23_X + bool "binutils 2.23 removed" + select BR2_LEGACY + help + Binutils 2.23 has been removed, using a newer version is + recommended. + +config BR2_TOOLCHAIN_BUILDROOT_EGLIBC + bool "eglibc support has been removed" + select BR2_LEGACY + help + The eglibc project no longer exists, as it has been merged + back into the glibc project. Therefore, support for eglibc + has been removed, and glibc should be used instead. + +config BR2_GDB_VERSION_7_8 + bool "gdb 7.8 has been removed" + select BR2_LEGACY + help + The 7.8 version of gdb has been removed. Use a newer version + instead. + ############################################################################### comment "Legacy options removed in 2016.05" @@ -220,12 +616,19 @@ config BR2_PACKAGE_QT5QUICK1 from upstream starting from Qt 5.6. config BR2_TARGET_UBOOT_CUSTOM_PATCH_DIR - bool "uboot custom patch dir removed" - select BR2_LEGACY + string "uboot custom patch dir has been removed" help The uboot custom patch directory option has been removed. Use the improved BR2_TARGET_UBOOT_PATCH option instead. +config BR2_TARGET_UBOOT_CUSTOM_PATCH_DIR_WRAP + bool + default y if BR2_TARGET_UBOOT_CUSTOM_PATCH_DIR != "" + select BR2_LEGACY + +# Note: BR2_TARGET_UBOOT_CUSTOM_PATCH_DIR is still referenced from +# boot/uboot/Config.in + config BR2_PACKAGE_XDRIVER_XF86_INPUT_VOID bool "xf86-input-void removed" select BR2_LEGACY @@ -235,12 +638,12 @@ config BR2_PACKAGE_XDRIVER_XF86_INPUT_VOID config BR2_KERNEL_HEADERS_3_17 bool "kernel headers version 3.17.x are no longer supported" - select BR2_KERNEL_HEADERS_3_18 + select BR2_KERNEL_HEADERS_3_12 select BR2_LEGACY help Version 3.17.x of the Linux kernel headers have been deprecated for more than four buildroot releases and are now removed. - As an alternative, version 3.18.x of the headers have been + As an alternative, version 3.12.x of the headers have been automatically selected in your configuration. config BR2_GDB_VERSION_7_7 @@ -302,7 +705,7 @@ config BR2_GCC_VERSION_4_5_X version instead. config BR2_PACKAGE_SQLITE_READLINE - bool "command-line editing support was updated" + bool "sqlite command-line editing support was updated" select BR2_PACKAGE_NCURSES select BR2_PACKAGE_READLINE select BR2_LEGACY @@ -336,7 +739,7 @@ config BR2_PACKAGE_E2FSPROGS_FINDFS This option attempted to enable findfs capabilities from e2fsprogs but has not worked since July 2015 (due to packaging changes). One can use BusyBox's findfs support or - enable the BR2_PACKAGE_UTIL_LINUX_FINDFS option. + enable the BR2_PACKAGE_UTIL_LINUX_BINARIES option. config BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL bool "openpowerlink debug option has been removed" @@ -381,12 +784,12 @@ config BR2_PACKAGE_CUPS_PDFTOPS config BR2_KERNEL_HEADERS_3_16 bool "kernel headers version 3.16.x are no longer supported" - select BR2_KERNEL_HEADERS_3_18 + select BR2_KERNEL_HEADERS_3_12 select BR2_LEGACY help Version 3.16.x of the Linux kernel headers have been deprecated for more than four buildroot releases and are now removed. - As an alternative, version 3.18.x of the headers have been + As an alternative, version 3.12.x of the headers have been automatically selected in your configuration. config BR2_PACKAGE_PYTHON_PYXML @@ -597,32 +1000,32 @@ config BR2_KERNEL_HEADERS_3_0 config BR2_KERNEL_HEADERS_3_11 bool "kernel headers version 3.11.x are no longer supported" - select BR2_KERNEL_HEADERS_3_12 + select BR2_KERNEL_HEADERS_3_10 select BR2_LEGACY help Version 3.11.x of the Linux kernel headers have been deprecated for more than four buildroot releases and are now removed. - As an alternative, version 3.12.x of the headers have been + As an alternative, version 3.10.x of the headers have been automatically selected in your configuration. config BR2_KERNEL_HEADERS_3_13 bool "kernel headers version 3.13.x are no longer supported" - select BR2_KERNEL_HEADERS_3_14 + select BR2_KERNEL_HEADERS_3_12 select BR2_LEGACY help Version 3.13.x of the Linux kernel headers have been deprecated for more than four buildroot releases and are now removed. - As an alternative, version 3.14.x of the headers have been + As an alternative, version 3.12.x of the headers have been automatically selected in your configuration. config BR2_KERNEL_HEADERS_3_15 bool "kernel headers version 3.15.x are no longer supported" - select BR2_KERNEL_HEADERS_3_18 + select BR2_KERNEL_HEADERS_3_12 select BR2_LEGACY help Version 3.15.x of the Linux kernel headers have been deprecated for more than four buildroot releases and are now removed. - As an alternative, version 3.18.x of the headers have been + As an alternative, version 3.12.x of the headers have been automatically selected in your configuration. config BR2_PACKAGE_DIRECTFB_EXAMPLES_ANDI @@ -913,11 +1316,9 @@ config BR2_PACKAGE_KODI_PVR_ADDONS config BR2_BINUTILS_VERSION_2_23_2 bool "binutils 2.23 option renamed" select BR2_LEGACY - select BR2_BINUTILS_VERSION_2_23_X help - The binutils version option has been renamed to match the - same patchlevel logic used by gcc. The new option is now - BR2_BINUTILS_VERSION_2_23_X. + Binutils 2.23.2 has been removed, using a newer version is + recommended. config BR2_BINUTILS_VERSION_2_24 bool "binutils 2.24 option renamed" @@ -1174,11 +1575,12 @@ config BR2_PACKAGE_STRONGSWAN_TOOLS deprecated. config BR2_PACKAGE_XBMC_ADDON_XVDR - bool "xbmc options have been renamed" + bool "xbmc-addon-xvdr removed" select BR2_LEGACY - select BR2_PACKAGE_KODI_ADDON_XVDR help - The XBMC media center project was renamed to Kodi entertainment center + According to the github project page: + https://github.com/pipelka/xbmc-addon-xvdr + this package is discontinued. config BR2_PACKAGE_XBMC_PVR_ADDONS bool "xbmc options have been renamed" @@ -1430,12 +1832,12 @@ config BR2_PACKAGE_LIBELF config BR2_KERNEL_HEADERS_3_8 bool "kernel headers version 3.8.x are no longer supported" - select BR2_KERNEL_HEADERS_3_10 + select BR2_KERNEL_HEADERS_3_4 select BR2_LEGACY help Version 3.8.x of the Linux kernel headers have been deprecated for more than four buildroot releases and are now removed. - As an alternative, version 3.10.x of the headers have been + As an alternative, version 3.4.x of the headers have been automatically selected in your configuration. config BR2_PACKAGE_GETTEXT_TOOLS @@ -1588,22 +1990,22 @@ config BR2_PACKAGE_EVTEST_CAPTURE config BR2_KERNEL_HEADERS_3_6 bool "kernel headers version 3.6.x are no longer supported" - select BR2_KERNEL_HEADERS_3_10 + select BR2_KERNEL_HEADERS_3_4 select BR2_LEGACY help Version 3.6.x of the Linux kernel headers have been deprecated for more than four buildroot releases and are now removed. - As an alternative, version 3.10.x of the headers have been + As an alternative, version 3.4.x of the headers have been automatically selected in your configuration. config BR2_KERNEL_HEADERS_3_7 bool "kernel headers version 3.7.x are no longer supported" - select BR2_KERNEL_HEADERS_3_10 + select BR2_KERNEL_HEADERS_3_4 select BR2_LEGACY help Version 3.7.x of the Linux kernel headers have been deprecated for more than four buildroot releases and are now removed. - As an alternative, version 3.10.x of the headers have been + As an alternative, version 3.4.x of the headers have been automatically selected in your configuration. config BR2_PACKAGE_VALA @@ -1776,22 +2178,22 @@ config BR2_KERNEL_HEADERS_3_1 config BR2_KERNEL_HEADERS_3_3 bool "kernel headers version 3.3.x are no longer supported" - select BR2_KERNEL_HEADERS_3_4 + select BR2_KERNEL_HEADERS_3_2 select BR2_LEGACY help Version 3.3.x of the Linux kernel headers have been deprecated for more than four buildroot releases and are now removed. - As an alternative, version 3.4.x of the headers have been + As an alternative, version 3.2.x of the headers have been automatically selected in your configuration. config BR2_KERNEL_HEADERS_3_5 bool "kernel headers version 3.5.x are no longer supported" - select BR2_KERNEL_HEADERS_3_10 + select BR2_KERNEL_HEADERS_3_4 select BR2_LEGACY help Version 3.5.x of the Linux kernel headers have been deprecated for more than four buildroot releases and are now removed. - As an alternative, version 3.10.x of the headers have been + As an alternative, version 3.4.x of the headers have been automatically selected in your configuration. config BR2_GDB_VERSION_7_2 diff --git a/Makefile b/Makefile index 5b89598552..f32da558a1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # # Copyright (C) 1999-2005 by Erik Andersen # Copyright (C) 2006-2014 by the Buildroot developers -# Copyright (C) 2014-2016 by the Buildroot developers +# Copyright (C) 2014-2017 by the Buildroot developers # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,24 +24,71 @@ # You shouldn't need to mess with anything beyond this point... #-------------------------------------------------------------- -# Trick for always running with a fixed umask -UMASK = 0022 -ifneq ($(shell umask),$(UMASK)) +# Delete default rules. We don't use them. This saves a bit of time. +.SUFFIXES: + +# we want bash as shell +SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ + else if [ -x /bin/bash ]; then echo /bin/bash; \ + else echo sh; fi; fi) + +# Set O variable if not already done on the command line; +# or avoid confusing packages that can use the O= syntax for out-of-tree +# build by preventing it from being forwarded to sub-make calls. +ifneq ("$(origin O)", "command line") +O := $(CURDIR)/output +endif + +# Check if the current Buildroot execution meets all the pre-requisites. +# If they are not met, Buildroot will actually do its job in a sub-make meeting +# its pre-requisites, which are: +# 1- Permissive enough umask: +# Wrong or too restrictive umask will prevent Buildroot and packages from +# creating files and directories. +# 2- Absolute canonical CWD (i.e. $(CURDIR)): +# Otherwise, some packages will use CWD as-is, others will compute its +# absolute canonical path. This makes harder tracking and fixing host +# machine path leaks. +# 3- Absolute canonical output location (i.e. $(O)): +# For the same reason as the one for CWD. + +# Remove the trailing '/.' from $(O) as it can be added by the makefile wrapper +# installed in the $(O) directory. +# Also remove the trailing '/' the user can set when on the command line. +override O := $(patsubst %/,%,$(patsubst %.,%,$(O))) +# Make sure $(O) actually exists before calling realpath on it; this is to +# avoid empty CANONICAL_O in case on non-existing entry. +CANONICAL_O := $(shell mkdir -p $(O) >/dev/null 2>&1)$(realpath $(O)) + +CANONICAL_CURDIR = $(realpath $(CURDIR)) + +REQ_UMASK = 0022 + +# Make sure O= is passed (with its absolute canonical path) everywhere the +# toplevel makefile is called back. +EXTRAMAKEARGS := O=$(CANONICAL_O) + +# Check Buildroot execution pre-requisites here. +ifneq ($(shell umask):$(CURDIR):$(O),$(REQ_UMASK):$(CANONICAL_CURDIR):$(CANONICAL_O)) .PHONY: _all $(MAKECMDGOALS) $(MAKECMDGOALS): _all @: _all: - @umask $(UMASK) && $(MAKE) --no-print-directory $(MAKECMDGOALS) + @umask $(REQ_UMASK) && \ + $(MAKE) -C $(CANONICAL_CURDIR) --no-print-directory \ + $(MAKECMDGOALS) $(EXTRAMAKEARGS) -else # umask +else # umask / $(CURDIR) / $(O) # This is our default rule, so must come first all: # Set and export the version string -export BR2_VERSION := 2016.05 +export BR2_VERSION := 2017.02-rc1 +# Actual time the release is cut (for reproducible builds) +BR2_VERSION_EPOCH = 1486825200 # Save running make version since it's clobbered by the make package RUNNING_MAKE_VERSION := $(MAKE_VERSION) @@ -81,7 +128,8 @@ export BR2_VERSION_FULL := $(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlo noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \ defconfig %_defconfig allyesconfig allnoconfig silentoldconfig release \ randpackageconfig allyespackageconfig allnopackageconfig \ - print-version olddefconfig + print-version olddefconfig distclean manual manual-html manual-split-html \ + manual-pdf manual-text manual-epub # Some global targets do not trigger a build, but are used to collect # metadata, or do various checks. When such targets are triggered, @@ -92,80 +140,63 @@ noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconf # We're building in two situations: when MAKECMDGOALS is empty # (default target is to build), or when MAKECMDGOALS contains # something else than one of the nobuild_targets. -nobuild_targets := source source-check \ - legal-info external-deps _external-deps \ - clean distclean help +nobuild_targets := source %-source source-check \ + legal-info %-legal-info external-deps _external-deps \ + clean distclean help show-targets graph-depends \ + %-graph-depends %-show-depends %-show-version \ + graph-build graph-size list-defconfigs \ + savedefconfig printvars ifeq ($(MAKECMDGOALS),) BR_BUILDING = y else ifneq ($(filter-out $(nobuild_targets),$(MAKECMDGOALS)),) BR_BUILDING = y endif -# Strip quotes and then whitespaces -qstrip = $(strip $(subst ",,$(1))) -#")) +# We call make recursively to build packages. The command-line overrides that +# are passed to Buildroot don't apply to those package build systems. In +# particular, we don't want to pass down the O= option for out-of-tree +# builds, because the value specified on the command line will not be correct +# for packages. +MAKEOVERRIDES := -# Variables for use in Make constructs -comma := , -empty := -space := $(empty) $(empty) +# Include some helper macros and variables +include support/misc/utils.mk -ifneq ("$(origin O)", "command line") -O := output -CONFIG_DIR := $(TOPDIR) +# Set variables related to in-tree or out-of-tree build. +# Here, both $(O) and $(CURDIR) are absolute canonical paths. +ifeq ($(O),$(CURDIR)/output) +CONFIG_DIR := $(CURDIR) NEED_WRAPPER = else -# other packages might also support Linux-style out of tree builds -# with the O= syntax (E.G. BusyBox does). As make automatically -# forwards command line variable definitions those packages get very -# confused. Fix this by telling make to not do so -MAKEOVERRIDES = -# strangely enough O is still passed to submakes with MAKEOVERRIDES -# (with make 3.81 atleast), the only thing that changes is the output -# of the origin function (command line -> environment). -# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+) -# To really make O go away, we have to override it. -override O := $(O) CONFIG_DIR := $(O) -# we need to pass O= everywhere we call back into the toplevel makefile -EXTRAMAKEARGS = O=$(O) NEED_WRAPPER = y endif # bash prints the name of the directory on 'cd ' if CDPATH is # set, so unset it here to not cause problems. Notice that the export -# line doesn't affect the environment of $(shell ..) calls, so -# explictly throw away any output from 'cd' here. +# line doesn't affect the environment of $(shell ..) calls. export CDPATH := -BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd) + +BASE_DIR := $(CANONICAL_O) $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist)) # Handling of BR2_EXTERNAL. # # The value of BR2_EXTERNAL is stored in .br-external in the output directory. -# On subsequent invocations of make, it is read in. It can still be overridden -# on the command line, therefore the file is re-created every time make is run. -# -# When BR2_EXTERNAL is set to an empty value (e.g. explicitly in command -# line), the .br-external file is removed and we point to -# support/dummy-external. This makes sure we can unconditionally include the -# Config.in and external.mk from the BR2_EXTERNAL directory. In this case, -# override is necessary so the user can clear BR2_EXTERNAL from the command -# line, but the dummy path is still used internally. +# The location of the external.mk makefile fragments is computed in that file. +# On subsequent invocations of make, this file is read in. BR2_EXTERNAL can +# still be overridden on the command line, therefore the file is re-created +# every time make is run. -BR2_EXTERNAL_FILE = $(BASE_DIR)/.br-external +BR2_EXTERNAL_FILE = $(BASE_DIR)/.br-external.mk -include $(BR2_EXTERNAL_FILE) -ifeq ($(BR2_EXTERNAL),) - override BR2_EXTERNAL = support/dummy-external - $(shell rm -f $(BR2_EXTERNAL_FILE)) -else - _BR2_EXTERNAL = $(shell cd $(BR2_EXTERNAL) >/dev/null 2>&1 && pwd) - ifeq ($(_BR2_EXTERNAL),) - $(error BR2_EXTERNAL='$(BR2_EXTERNAL)' does not exist, relative to $(TOPDIR)) - endif - override BR2_EXTERNAL := $(_BR2_EXTERNAL) - $(shell echo BR2_EXTERNAL ?= $(BR2_EXTERNAL) > $(BR2_EXTERNAL_FILE)) +$(shell support/scripts/br2-external \ + -m -o '$(BR2_EXTERNAL_FILE)' $(BR2_EXTERNAL)) +BR2_EXTERNAL_ERROR = +include $(BR2_EXTERNAL_FILE) +ifneq ($(BR2_EXTERNAL_ERROR),) +$(error $(BR2_EXTERNAL_ERROR)) endif # To make sure that the environment variable overrides the .config option, @@ -196,11 +227,18 @@ LICENSE_FILES_DIR_TARGET = $(LEGAL_INFO_DIR)/licenses LICENSE_FILES_DIR_HOST = $(LEGAL_INFO_DIR)/host-licenses LEGAL_MANIFEST_CSV_TARGET = $(LEGAL_INFO_DIR)/manifest.csv LEGAL_MANIFEST_CSV_HOST = $(LEGAL_INFO_DIR)/host-manifest.csv -LEGAL_LICENSES_TXT_TARGET = $(LEGAL_INFO_DIR)/licenses.txt -LEGAL_LICENSES_TXT_HOST = $(LEGAL_INFO_DIR)/host-licenses.txt LEGAL_WARNINGS = $(LEGAL_INFO_DIR)/.warnings LEGAL_REPORT = $(LEGAL_INFO_DIR)/README +################################################################################ +# +# staging and target directories do NOT list these as +# dependencies anywhere else +# +################################################################################ +$(BUILD_DIR) $(TARGET_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST): + @mkdir -p $@ + BR2_CONFIG = $(CONFIG_DIR)/.config # Pull in the user's configuration file @@ -208,6 +246,17 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) -include $(BR2_CONFIG) endif +# timezone and locale may affect build output +ifeq ($(BR2_REPRODUCIBLE),y) +export TZ = UTC +export LANG = C +export LC_ALL = C +export GZIP = -n +BR2_VERSION_GIT_EPOCH = $(shell GIT_DIR=$(TOPDIR)/.git $(GIT) log -1 --format=%at) +export SOURCE_DATE_EPOCH = $(if $(wildcard $(TOPDIR)/.git),$(BR2_VERSION_GIT_EPOCH),$(BR2_VERSION_EPOCH)) +DEPENDENCIES_HOST_PREREQ += host-fakedate +endif + # To put more focus on warnings, be less verbose as default # Use 'make V=1' to see the full commands ifeq ("$(origin V)", "command line") @@ -227,11 +276,6 @@ else Q = @ endif -# we want bash as shell -SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ - else if [ -x /bin/bash ]; then echo /bin/bash; \ - else echo sh; fi; fi) - # kconfig uses CONFIG_SHELL CONFIG_SHELL := $(SHELL) @@ -279,6 +323,7 @@ HOSTLN := $(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln) HOSTNM := $(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm) HOSTOBJCOPY := $(shell which $(HOSTOBJCOPY) || type -p $(HOSTOBJCOPY) || echo objcopy) HOSTRANLIB := $(shell which $(HOSTRANLIB) || type -p $(HOSTRANLIB) || echo ranlib) +SED := $(shell which sed || type -p sed) -i -e export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE @@ -376,6 +421,7 @@ KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \ -e s/arm.*/arm/ -e s/sa110/arm/ \ -e s/aarch64.*/arm64/ \ -e s/bfin/blackfin/ \ + -e s/or1k/openrisc/ \ -e s/parisc64/parisc/ \ -e s/powerpc64.*/powerpc/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ @@ -410,6 +456,7 @@ endif # Scripts in support/ or post-build scripts may need to reference # these locations, so export them so it is easier to use export BR2_CONFIG +export BR2_REPRODUCIBLE export TARGET_DIR export STAGING_DIR export HOST_DIR @@ -427,9 +474,7 @@ all: world # Include legacy before the other things, because package .mk files # may rely on it. -ifneq ($(BR2_DEPRECATED),y) include Makefile.legacy -endif include package/Makefile.in include support/dependencies/dependencies.mk @@ -450,7 +495,15 @@ include boot/common.mk include linux/linux.mk include fs/common.mk -include $(BR2_EXTERNAL)/external.mk +# If using a br2-external tree, the BR2_EXTERNAL_$(NAME)_PATH variables +# are also present in the .config file. Since .config is included after +# we defined them in the Makefile, the values for those variables are +# quoted. We just include the generated Makefile fragment .br2-external.mk +# a third time, which will set those variables to the un-quoted values. +include $(BR2_EXTERNAL_FILE) + +# Nothing to include if no BR2_EXTERNAL tree in use +include $(BR2_EXTERNAL_MKS) # Now we are sure we have all the packages scanned and defined. We now # check for each package in the list of enabled packages, that all its @@ -494,15 +547,6 @@ world: target-post-image legal-info legal-info-prepare legal-info-clean printvars help \ list-defconfigs target-finalize target-post-image source-check -################################################################################ -# -# staging and target directories do NOT list these as -# dependencies anywhere else -# -################################################################################ -$(BUILD_DIR) $(TARGET_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST): - @mkdir -p $@ - # Populating the staging with the base directories is handled by the skeleton package $(STAGING_DIR): @mkdir -p $(STAGING_DIR) @@ -612,7 +656,7 @@ target-finalize: $(PACKAGES) $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \ $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f - find $(TARGET_DIR)/lib $(TARGET_DIR)/usr/lib $(TARGET_DIR)/usr/libexec \ + find $(TARGET_DIR)/lib/ $(TARGET_DIR)/usr/lib/ $(TARGET_DIR)/usr/libexec/ \ \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f ifneq ($(BR2_PACKAGE_GDB),y) rm -rf $(TARGET_DIR)/usr/share/gdb @@ -627,23 +671,20 @@ endif rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc rm -rf $(TARGET_DIR)/usr/share/gtk-doc - -rmdir $(TARGET_DIR)/usr/share 2>/dev/null + rmdir $(TARGET_DIR)/usr/share 2>/dev/null || true $(STRIP_FIND_CMD) | xargs -0 $(STRIPCMD) 2>/dev/null || true - if test -d $(TARGET_DIR)/lib/modules; then \ - find $(TARGET_DIR)/lib/modules -type f -name '*.ko' -print0 | \ - xargs -0 -r $(KSTRIPCMD); fi # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads # besides the one in which crash occurred; or SIGTRAP kills my program when # I set a breakpoint" ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) - find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \ + find $(TARGET_DIR)/lib/ -type f -name 'libpthread*.so*' | \ xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG) endif # Valgrind needs ld.so with enough information, so only strip # debugging symbols. - find $(TARGET_DIR)/lib -type f -name 'ld-*.so*' | \ + find $(TARGET_DIR)/lib/ -type f -name 'ld-*.so*' | \ xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG) test -f $(TARGET_DIR)/etc/ld.so.conf && \ { echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true @@ -701,8 +742,12 @@ legal-info: dirs legal-info-clean legal-info-prepare $(foreach p,$(PACKAGES),$(p cat support/legal-info/README.warnings-header \ $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \ cat $(LEGAL_WARNINGS); fi - @echo "Legal info produced in $(LEGAL_INFO_DIR)" @rm -f $(LEGAL_WARNINGS) + @(cd $(LEGAL_INFO_DIR); \ + find * -type f -exec sha256sum {} + | LC_ALL=C sort -k2 \ + >.legal-info.sha256; \ + mv .legal-info.sha256 legal-info.sha256) + @echo "Legal info produced in $(LEGAL_INFO_DIR)" show-targets: @echo $(PACKAGES) $(TARGETS_ROOTFS) @@ -726,7 +771,7 @@ graph-depends: graph-depends-requirements @$(INSTALL) -d $(GRAPHS_DIR) @cd "$(CONFIG_DIR)"; \ $(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS) \ - -o $(GRAPHS_DIR)/$(@).dot + --direct -o $(GRAPHS_DIR)/$(@).dot dot $(BR2_GRAPH_DOT_OPTS) -T$(BR_GRAPH_OUT) \ -o $(GRAPHS_DIR)/$(@).$(BR_GRAPH_OUT) \ $(GRAPHS_DIR)/$(@).dot @@ -754,6 +799,9 @@ endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y) HOSTCFLAGS = $(CFLAGS_FOR_BUILD) export HOSTCFLAGS +.PHONY: prepare-kconfig +prepare-kconfig: outputmakefile $(BUILD_DIR)/.br2-external.in + $(BUILD_DIR)/buildroot-config/%onf: mkdir -p $(@D)/lxdialog PKG_CONFIG_PATH="$(HOST_PKG_CONFIG_PATH)" $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \ @@ -769,23 +817,23 @@ COMMON_CONFIG_ENV = \ KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \ KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \ BR2_CONFIG=$(BR2_CONFIG) \ - BR2_EXTERNAL=$(BR2_EXTERNAL) \ HOST_GCC_VERSION="$(HOSTCC_VERSION)" \ + BUILD_DIR=$(BUILD_DIR) \ SKIP_LEGACY= -xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile +xconfig: $(BUILD_DIR)/buildroot-config/qconf prepare-kconfig @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN) -gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile +gconfig: $(BUILD_DIR)/buildroot-config/gconf prepare-kconfig @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN) -menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile +menuconfig: $(BUILD_DIR)/buildroot-config/mconf prepare-kconfig @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN) -nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile +nconfig: $(BUILD_DIR)/buildroot-config/nconf prepare-kconfig @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN) -config: $(BUILD_DIR)/buildroot-config/conf outputmakefile +config: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN) # For the config targets that automatically select options, we pass @@ -793,22 +841,22 @@ config: $(BUILD_DIR)/buildroot-config/conf outputmakefile # no values are set for the legacy options so a subsequent oldconfig # will query them. Therefore, run an additional olddefconfig. -oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +oldconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN) -randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +randconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --randconfig $(CONFIG_CONFIG_IN) @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null -allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +allyesconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allyesconfig $(CONFIG_CONFIG_IN) @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null -allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +allnoconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allnoconfig $(CONFIG_CONFIG_IN) @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null -randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +randpackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \ KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ @@ -816,7 +864,7 @@ randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile @rm -f $(CONFIG_DIR)/.config.nopkg @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null -allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \ KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ @@ -824,7 +872,7 @@ allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile @rm -f $(CONFIG_DIR)/.config.nopkg @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null -allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \ KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ @@ -832,25 +880,24 @@ allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile @rm -f $(CONFIG_DIR)/.config.nopkg @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null -silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +silentoldconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN) -olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +olddefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) -defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +defconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN) +define percent_defconfig # Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig -%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile - @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(TOPDIR)/configs/$@ \ - $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN) +%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(1)/configs/%_defconfig prepare-kconfig + @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(1)/configs/$$@ \ + $$< --defconfig=$(1)/configs/$$@ $$(CONFIG_CONFIG_IN) +endef +$(eval $(foreach d,$(call reverse,$(TOPDIR) $(BR2_EXTERNAL_DIRS)),$(call percent_defconfig,$(d))$(sep))) -%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(BR2_EXTERNAL)/configs/%_defconfig outputmakefile - @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(BR2_EXTERNAL)/configs/$@ \ - $< --defconfig=$(BR2_EXTERNAL)/configs/$@ $(CONFIG_CONFIG_IN) - -savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile +savedefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @$(COMMON_CONFIG_ENV) $< \ --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \ $(CONFIG_CONFIG_IN) @@ -872,6 +919,13 @@ ifeq ($(NEED_WRAPPER),y) $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O) endif +# Even though the target is a real file, we mark it as PHONY as we +# want it to be re-generated each time make is invoked, in case the +# value of BR2_EXTERNAL is changed. +.PHONY: $(BUILD_DIR)/.br2-external.in +$(BUILD_DIR)/.br2-external.in: $(BUILD_DIR) + $(Q)support/scripts/br2-external -k -o "$(@)" $(BR2_EXTERNAL) + # printvars prints all the variables currently defined in our # Makefiles. Alternatively, if a non-empty VARS variable is passed, # only the variables matching the make pattern passed in VARS are @@ -889,13 +943,10 @@ clean: $(LEGAL_INFO_DIR) $(GRAPHS_DIR) distclean: clean -ifeq ($(DL_DIR),$(TOPDIR)/dl) - rm -rf $(DL_DIR) -endif -ifeq ($(O),output) +ifeq ($(O),$(CURDIR)/output) rm -rf $(O) endif - rm -rf $(BR2_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/..config.tmp \ + rm -rf $(TOPDIR)/dl $(BR2_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/..config.tmp \ $(CONFIG_DIR)/.auto.deps $(BR2_EXTERNAL_FILE) help: @@ -933,26 +984,17 @@ help: @echo ' -depends - Build '\''s dependencies' @echo ' -configure - Build up to the configure step' @echo ' -build - Build up to the build step' + @echo ' -show-depends - List packages on which depends' + @echo ' -show-rdepends - List packages which have as a dependency' @echo ' -graph-depends - Generate a graph of '\''s dependencies' + @echo ' -graph-rdepends - Generate a graph of '\''s reverse dependencies' @echo ' -dirclean - Remove build directory' @echo ' -reconfigure - Restart the build from the configure step' @echo ' -rebuild - Restart the build from the build step' -ifeq ($(BR2_PACKAGE_BUSYBOX),y) - @echo ' busybox-menuconfig - Run BusyBox menuconfig' -endif -ifeq ($(BR2_LINUX_KERNEL),y) - @echo ' linux-menuconfig - Run Linux kernel menuconfig' - @echo ' linux-savedefconfig - Run Linux kernel savedefconfig' - @echo ' linux-update-defconfig - Save the Linux configuration to the path specified' - @echo ' by BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE' -endif -ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) - @echo ' uclibc-menuconfig - Run uClibc menuconfig' -endif -ifeq ($(BR2_TARGET_BAREBOX),y) - @echo ' barebox-menuconfig - Run barebox menuconfig' - @echo ' barebox-savedefconfig - Run barebox savedefconfig' -endif + $(foreach p,$(HELP_PACKAGES), \ + @echo $(sep) \ + @echo '$($(p)_NAME):' $(sep) \ + $($(p)_HELP_CMDS)$(sep)) @echo @echo 'Documentation:' @echo ' manual - build manual in all formats' @@ -979,17 +1021,34 @@ endif @echo 'it on-line at http://buildroot.org/docs.html' @echo +# List the defconfig files +# $(1): base directory +# $(2): br2-external name, empty for bundled +define list-defconfigs + @first=true; \ + for defconfig in $(1)/configs/*_defconfig; do \ + [ -f "$${defconfig}" ] || continue; \ + if $${first}; then \ + if [ "$(2)" ]; then \ + printf 'External configs in "$(call qstrip,$(2))":\n'; \ + else \ + printf "Built-in configs:\n"; \ + fi; \ + first=false; \ + fi; \ + defconfig="$${defconfig##*/}"; \ + printf " %-35s - Build for %s\n" "$${defconfig}" "$${defconfig%_defconfig}"; \ + done; \ + $${first} || printf "\n" +endef + +# We iterate over BR2_EXTERNAL_NAMES rather than BR2_EXTERNAL_DIRS, +# because we want to display the name of the br2-external tree. list-defconfigs: - @echo 'Built-in configs:' - @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \ - printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);) -ifneq ($(wildcard $(BR2_EXTERNAL)/configs/*_defconfig),) - @echo - @echo 'User-provided configs:' - @$(foreach b, $(sort $(notdir $(wildcard $(BR2_EXTERNAL)/configs/*_defconfig))), \ - printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);) -endif - @echo + $(call list-defconfigs,$(TOPDIR)) + $(foreach name,$(BR2_EXTERNAL_NAMES),\ + $(call list-defconfigs,$(BR2_EXTERNAL_$(name)_PATH),\ + $(BR2_EXTERNAL_$(name)_DESC))$(sep)) release: OUT = buildroot-$(BR2_VERSION) @@ -1008,8 +1067,8 @@ print-version: @echo $(BR2_VERSION_FULL) #include docs/manual/manual.mk -#-include $(BR2_EXTERNAL)/docs/*/*.mk +#-include $(foreach dir,$(BR2_EXTERNAL_DIRS),$(dir)/docs/*/*.mk) .PHONY: $(noconfig_targets) -endif #umask +endif #umask / $(CURDIR) / $(O) diff --git a/Makefile.legacy b/Makefile.legacy index 764cfcd117..800c08926c 100644 --- a/Makefile.legacy +++ b/Makefile.legacy @@ -4,9 +4,6 @@ # This file contains placeholders to detect backward-compatibility problems. # When a buildroot "API" feature is being deprecated, a rule should be added # here that issues an error when the old feature is used. -# -# This file is not included if BR2_DEPRECATED is selected, so it is possible -# to bypass the errors (although that's usually a bad idea). ifeq ($(BR2_LEGACY),y) $(error "You have legacy configuration in your .config! Please check your configuration.") diff --git a/linux/Config.ext.in b/linux/Config.ext.in index 755c23b70f..011dffb0b1 100644 --- a/linux/Config.ext.in +++ b/linux/Config.ext.in @@ -1,11 +1,12 @@ menu "Linux Kernel Extensions" +#------------------------------------------------------------------------------- # Xenomai config BR2_LINUX_KERNEL_EXT_XENOMAI bool "Adeos/Xenomai Real-time patch" + depends on BR2_PACKAGE_XENOMAI_ARCH_SUPPORTS depends on BR2_TOOLCHAIN_HAS_THREADS - depends on BR2_i386 || BR2_x86_64 || BR2_arm || \ - BR2_bfin || BR2_powerpc || BR2_sh4 + depends on !BR2_TOOLCHAIN_USES_MUSL select BR2_PACKAGE_XENOMAI help Xenomai is split in two parts: a kernel part and a userspace @@ -24,19 +25,19 @@ config BR2_LINUX_KERNEL_EXT_XENOMAI Xenomai is know to support Blackfin, SH4, x86, ARM, NIOS2 and PowerPC architectures. -comment "xenomai needs a toolchain w/ threads" - depends on BR2_i386 || BR2_x86_64 || BR2_arm || \ - BR2_bfin || BR2_powerpc || BR2_sh4 - depends on !BR2_TOOLCHAIN_HAS_THREADS - config BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH - depends on BR2_LINUX_KERNEL_EXT_XENOMAI string "Path for Adeos patch file" + depends on BR2_LINUX_KERNEL_EXT_XENOMAI help Optionally, explicitly specify the Adeos patch to use. Download it at http://download.gna.org/adeos/patches and verify that your kernel version in buildroot matches. +comment "xenomai needs a uClibc or glibc toolchain w/ threads" + depends on BR2_PACKAGE_XENOMAI_ARCH_SUPPORTS + depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_TOOLCHAIN_USES_MUSL + +#------------------------------------------------------------------------------- # RTAI config BR2_LINUX_KERNEL_EXT_RTAI bool "RTAI Real-time patch" @@ -44,6 +45,17 @@ config BR2_LINUX_KERNEL_EXT_RTAI help RTAI Kernel part. +#------------------------------------------------------------------------------- +# ev3dev Linux drivers +config BR2_LINUX_KERNEL_EXT_EV3DEV_LINUX_DRIVERS + bool "ev3dev Linux drivers" + select BR2_PACKAGE_EV3DEV_LINUX_DRIVERS + help + Linux drivers for LEGO MINDSTORMS EV3 from the ev3dev project. + + https://github.com/ev3dev/lego-linux-drivers + +#------------------------------------------------------------------------------- # fbtft config BR2_LINUX_KERNEL_EXT_FBTFT bool "FB TFT drivers" @@ -64,4 +76,56 @@ config BR2_LINUX_KERNEL_EXT_FBTFT https://github.com/notro/fbtft +# aufs-standalone +config BR2_LINUX_KERNEL_EXT_AUFS + bool "Aufs Filesystem Module patch" + select BR2_PACKAGE_AUFS + help + Aufs is split in two parts: a kernel part and a userspace + part. Enabling this option automatically selects the aufs + standalone (module) package and patches the Linux kernel + built by Buildroot with the aufs kernel part (ie fs/aufs). + + It is important to use the correct branch of aufs-standalone. + +if BR2_LINUX_KERNEL_EXT_AUFS + +choice + bool "aufs-standalone series" + help + Select the major series of this version. This must match the + major version of your kernel (e.g. for kernels 3.x, select + aufs3.x; for kernels 4.x, select aufs4.x). + + Note: neither aufs1.x nor aufs2.x (both for kernels older than + 3.x) are supported. + +config BR2_LINUX_KERNEL_EXT_AUFS_SERIES_3 + bool "aufs3.x" + +config BR2_LINUX_KERNEL_EXT_AUFS_SERIES_4 + bool "aufs4.x" + +endchoice + +config BR2_LINUX_KERNEL_EXT_AUFS_SERIES + int + default 3 if BR2_LINUX_KERNEL_EXT_AUFS_SERIES_3 + default 4 if BR2_LINUX_KERNEL_EXT_AUFS_SERIES_4 + +config BR2_LINUX_KERNEL_EXT_AUFS_VERSION + string "aufs-standalone version" + default "" + help + The version you choose must match that of your kernel. Usually, + the sha1 of the cset you want to use; avoid using a branch name + as this yields non-reproducible builds. + + See the following resources to see what versions are available: + + For aufs3.x: https://sourceforge.net/p/aufs/aufs3-standalone/ref/master/branches/ + For aufs4.x: https://github.com/sfjro/aufs4-standalone/branches/all + +endif # aufs + endmenu diff --git a/linux/Config.in b/linux/Config.in index 4d0090520c..740dd391c9 100644 --- a/linux/Config.in +++ b/linux/Config.in @@ -18,16 +18,15 @@ config BR2_LINUX_NEEDS_MODULES # Version selection. We provide the choice between: # # 1. A single fairly recent stable kernel version -# 2. In case an internal toolchain has been built, the same kernel -# version as the kernel headers -# 3. A custom stable version -# 4. A custom tarball +# 2. A custom stable version +# 3. A custom tarball +# 4. A set of custom repository locations # choice prompt "Kernel version" config BR2_LINUX_KERNEL_LATEST_VERSION - bool "4.4.3" + bool "Latest version (4.9.9)" config BR2_LINUX_KERNEL_CUSTOM_VERSION bool "Custom version" @@ -63,11 +62,11 @@ config BR2_LINUX_KERNEL_CUSTOM_HG This option allows Buildroot to get the Linux kernel source code from a Mercurial repository. -config BR2_LINUX_KERNEL_CUSTOM_LOCAL - bool "Local directory" +config BR2_LINUX_KERNEL_CUSTOM_SVN + bool "Custom Subversion repository" help This option allows Buildroot to get the Linux kernel source - code from a local directory. + code from a Subversion repository. endchoice @@ -79,7 +78,7 @@ config BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION string "URL of custom kernel tarball" depends on BR2_LINUX_KERNEL_CUSTOM_TARBALL -if BR2_LINUX_KERNEL_CUSTOM_GIT || BR2_LINUX_KERNEL_CUSTOM_HG +if BR2_LINUX_KERNEL_CUSTOM_GIT || BR2_LINUX_KERNEL_CUSTOM_HG || BR2_LINUX_KERNEL_CUSTOM_SVN config BR2_LINUX_KERNEL_CUSTOM_REPO_URL string "URL of custom repository" @@ -91,26 +90,19 @@ config BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION default BR2_LINUX_KERNEL_CUSTOM_GIT_VERSION \ if BR2_LINUX_KERNEL_CUSTOM_GIT_VERSION != "" # legacy help - Revision to use in the typical format used by Git/Mercurial + Revision to use in the typical format used by Git/Mercurial/Subversion E.G. a sha id, a tag, branch, .. endif -config BR2_LINUX_KERNEL_CUSTOM_LOCAL_PATH - string "Path to the local directory" - depends on BR2_LINUX_KERNEL_CUSTOM_LOCAL - help - Path to the local directory with the Linux kernel source code. - config BR2_LINUX_KERNEL_VERSION string - default "4.4.3" if BR2_LINUX_KERNEL_LATEST_VERSION + default "4.9.9" if BR2_LINUX_KERNEL_LATEST_VERSION default BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE \ if BR2_LINUX_KERNEL_CUSTOM_VERSION default "custom" if BR2_LINUX_KERNEL_CUSTOM_TARBALL default BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION \ - if BR2_LINUX_KERNEL_CUSTOM_GIT || BR2_LINUX_KERNEL_CUSTOM_HG - default "custom" if BR2_LINUX_KERNEL_CUSTOM_LOCAL + if BR2_LINUX_KERNEL_CUSTOM_GIT || BR2_LINUX_KERNEL_CUSTOM_HG || BR2_LINUX_KERNEL_CUSTOM_SVN # # Patch selection @@ -118,7 +110,6 @@ config BR2_LINUX_KERNEL_VERSION config BR2_LINUX_KERNEL_PATCH string "Custom kernel patches" - depends on !BR2_LINUX_KERNEL_CUSTOM_LOCAL help A space-separated list of patches to apply to the kernel. Each patch can be described as an URL, a local file @@ -136,6 +127,14 @@ choice config BR2_LINUX_KERNEL_USE_DEFCONFIG bool "Using an in-tree defconfig file" +config BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG + bool "Use the architecture default configuration" + help + This option will use the default configuration for the + selected architecture. I.e, it is equivalent to running + "make ARCH= defconfig". This is useful on architectures + that have a single defconfig file, such as ARM64. + config BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG bool "Using a custom (def)config file" @@ -173,12 +172,13 @@ config BR2_LINUX_KERNEL_UBOOT_IMAGE choice prompt "Kernel binary format" + default BR2_LINUX_KERNEL_ZIMAGE if BR2_arm || BR2_armeb config BR2_LINUX_KERNEL_UIMAGE bool "uImage" depends on BR2_arc || BR2_arm || BR2_armeb || BR2_bfin || \ BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le || \ - BR2_sh || BR2_sh64 || BR2_mips || BR2_mipsel || \ + BR2_sh || BR2_mips || BR2_mipsel || \ BR2_mips64 || BR2_mips64el select BR2_LINUX_KERNEL_UBOOT_IMAGE @@ -197,7 +197,7 @@ config BR2_LINUX_KERNEL_ZIMAGE bool "zImage" depends on BR2_arm || BR2_armeb || BR2_powerpc || \ BR2_powerpc64 || BR2_powerpc64le || BR2_sparc || \ - BR2_sh || BR2_sh64 || BR2_xtensa + BR2_sh || BR2_xtensa config BR2_LINUX_KERNEL_ZIMAGE_EPAPR bool "zImage.epapr" @@ -234,7 +234,7 @@ config BR2_LINUX_KERNEL_LINUX_BIN config BR2_LINUX_KERNEL_VMLINUX_BIN bool "vmlinux.bin" - depends on BR2_mips || BR2_mipsel || BR2_sh || BR2_sh64 + depends on BR2_mips || BR2_mipsel || BR2_sh config BR2_LINUX_KERNEL_VMLINUX bool "vmlinux" @@ -399,7 +399,7 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET source "linux/Config.ext.in" # Linux tools -source "linux/Config.tools.in" +source "package/linux-tools/Config.in" endif # BR2_LINUX_KERNEL diff --git a/linux/Config.tools.in b/linux/Config.tools.in deleted file mode 100644 index 24ef8cd743..0000000000 --- a/linux/Config.tools.in +++ /dev/null @@ -1,29 +0,0 @@ -menu "Linux Kernel Tools" - -config BR2_LINUX_KERNEL_TOOL_CPUPOWER - bool "cpupower" - depends on !BR2_bfin # pciutils - select BR2_PACKAGE_PCIUTILS - help - cpupower is a collection of tools to examine and tune power - saving related features of your processor. - -config BR2_LINUX_KERNEL_TOOL_PERF - bool "perf" - help - perf (sometimes "Perf Events" or perf tools, originally - "Performance Counters for Linux") - is a performance - analyzing tool in Linux, available from kernel version - 2.6.31. User-space controlling utility, called 'perf' has - git-like interface with subcommands. It is capable of - statistical profiling of entire system (both kernel and user - code), single CPU or severals threads. - - This will build and install the userspace 'perf' - command. It is up to the user to ensure that the kernel - configuration has all the suitable options enabled to allow a - proper operation of 'perf'. - - https://perf.wiki.kernel.org/ - -endmenu diff --git a/linux/linux-ext-aufs.mk b/linux/linux-ext-aufs.mk new file mode 100644 index 0000000000..fb2f3560a7 --- /dev/null +++ b/linux/linux-ext-aufs.mk @@ -0,0 +1,21 @@ +################################################################################ +# Linux Aufs extensions +# +# Patch the linux kernel with aufs extension +################################################################################ + +LINUX_EXTENSIONS += aufs + +define AUFS_PREPARE_KERNEL + if test -d $(@D)/fs/aufs/; then \ + echo "Your kernel already supports AUFS."; \ + exit 1; \ + fi + $(APPLY_PATCHES) $(@D) $(AUFS_DIR) \ + aufs$(BR2_PACKAGE_AUFS_SERIES)-kbuild.patch \ + aufs$(BR2_PACKAGE_AUFS_SERIES)-base.patch \ + aufs$(BR2_PACKAGE_AUFS_SERIES)-mmap.patch \ + aufs$(BR2_PACKAGE_AUFS_SERIES)-standalone.patch + cp -r $(AUFS_DIR)/fs/aufs/ $(@D)/fs/ + cp $(AUFS_DIR)/include/uapi/linux/aufs_type.h $(@D)/include/uapi/linux/ +endef diff --git a/linux/linux-ext-ev3dev-linux-drivers.mk b/linux/linux-ext-ev3dev-linux-drivers.mk new file mode 100644 index 0000000000..c8afeeb1d5 --- /dev/null +++ b/linux/linux-ext-ev3dev-linux-drivers.mk @@ -0,0 +1,12 @@ +################################################################################ +# Linux ev3dev extensions +# +# Patch the linux kernel with ev3dev extension +################################################################################ + +LINUX_EXTENSIONS += ev3dev-linux-drivers + +define EV3DEV_LINUX_DRIVERS_PREPARE_KERNEL + mkdir -p $(LINUX_DIR)/drivers/lego + cp -dpfr $(EV3DEV_LINUX_DRIVERS_DIR)/* $(LINUX_DIR)/drivers/lego/ +endef diff --git a/linux/linux-tool-cpupower.mk b/linux/linux-tool-cpupower.mk deleted file mode 100644 index 4551cda1f1..0000000000 --- a/linux/linux-tool-cpupower.mk +++ /dev/null @@ -1,39 +0,0 @@ -################################################################################ -# -# cpupower -# -################################################################################ - -LINUX_TOOLS += cpupower - -CPUPOWER_DEPENDENCIES = pciutils - -CPUPOWER_MAKE_OPTS = CROSS=$(TARGET_CROSS) \ - CPUFREQ_BENCH=false \ - DEBUG=false - -define CPUPOWER_BUILD_CMDS - $(Q)if test ! -f $(@D)/tools/power/cpupower/Makefile ; then \ - echo "Your kernel version is too old and does not have the cpupower tool." ; \ - echo "At least kernel 3.4 must be used." ; \ - exit 1 ; \ - fi - - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \ - $(CPUPOWER_MAKE_OPTS) \ - cpupower -endef - -define CPUPOWER_INSTALL_STAGING_CMDS - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \ - $(CPUPOWER_MAKE_OPTS) \ - DESTDIR=$(STAGING_DIR) \ - cpupower_install -endef - -define CPUPOWER_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \ - $(CPUPOWER_MAKE_OPTS) \ - DESTDIR=$(TARGET_DIR) \ - cpupower_install -endef diff --git a/linux/linux-tool-perf.mk b/linux/linux-tool-perf.mk deleted file mode 100644 index 1070a1c098..0000000000 --- a/linux/linux-tool-perf.mk +++ /dev/null @@ -1,101 +0,0 @@ -################################################################################ -# -# perf -# -################################################################################ - -LINUX_TOOLS += perf - -PERF_DEPENDENCIES = host-flex host-bison - -ifeq ($(KERNEL_ARCH),x86_64) -PERF_ARCH=x86 -else -PERF_ARCH=$(KERNEL_ARCH) -endif - -PERF_MAKE_FLAGS = \ - $(LINUX_MAKE_FLAGS) \ - ARCH=$(PERF_ARCH) \ - NO_LIBAUDIT=1 \ - NO_NEWT=1 \ - NO_GTK2=1 \ - NO_LIBPERL=1 \ - NO_LIBPYTHON=1 \ - DESTDIR=$(TARGET_DIR) \ - prefix=/usr \ - WERROR=0 \ - ASCIIDOC= - -# We need to pass an argument to ld for setting the endianness when -# building it for MIPS architecture, otherwise the default one will -# always be used (which is big endian) and the compilation for little -# endian will always fail showing an error like this one: -# LD foo.o -# mips-linux-gnu-ld: foo.o: compiled for a little endian system and -# target is big endian -ifeq ($(BR2_mips)$(BR2_mips64),y) -PERF_MAKE_FLAGS += LD="$(TARGET_LD) -EB" -else ifeq ($(BR2_mipsel)$(BR2_mips64el),y) -PERF_MAKE_FLAGS += LD="$(TARGET_LD) -EL" -endif - -# The call to backtrace() function fails for ARC, because for some -# reason the unwinder from libgcc returns early. Thus the usage of -# backtrace() should be disabled in perf explicitly: at build time -# backtrace() appears to be available, but it fails at runtime: the -# backtrace will contain only several functions from the top of stack, -# instead of the complete backtrace. -ifeq ($(BR2_arc),y) -PERF_MAKE_FLAGS += NO_BACKTRACE=1 -endif - -ifeq ($(BR2_PACKAGE_SLANG),y) -PERF_DEPENDENCIES += slang -endif - -ifeq ($(BR2_PACKAGE_LIBUNWIND),y) -PERF_DEPENDENCIES += libunwind -endif - -ifeq ($(BR2_PACKAGE_NUMACTL),y) -PERF_DEPENDENCIES += numactl -endif - -ifeq ($(BR2_PACKAGE_ELFUTILS),y) -PERF_DEPENDENCIES += elfutils -else -PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1 -endif - -# O must be redefined here to overwrite the one used by Buildroot for -# out of tree build. We build perf in $(@D)/tools/perf/ and not just -# $(@D) so that it isn't built in the root directory of the kernel -# sources. -define PERF_BUILD_CMDS - $(Q)if test ! -f $(@D)/tools/perf/Makefile ; then \ - echo "Your kernel version is too old and does not have the perf tool." ; \ - echo "At least kernel 2.6.31 must be used." ; \ - exit 1 ; \ - fi - $(Q)if test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \ - if ! grep -q NO_LIBELF $(@D)/tools/perf/Makefile* ; then \ - if ! test -r $(@D)/tools/perf/config/Makefile ; then \ - echo "The perf tool in your kernel cannot be built without libelf." ; \ - echo "Either upgrade your kernel to >= 3.7, or enable the elfutils package." ; \ - exit 1 ; \ - fi \ - fi \ - fi - $(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \ - -C $(@D)/tools/perf O=$(@D)/tools/perf/ -endef - -# After installation, we remove the Perl and Python scripts from the -# target. -define PERF_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \ - -C $(@D)/tools/perf O=$(@D)/tools/perf/ install - $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/ - $(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/tests/ -endef diff --git a/linux/linux.mk b/linux/linux.mk index 7e20255956..7f4432e7b1 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -8,21 +8,28 @@ LINUX_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION)) LINUX_LICENSE = GPLv2 LINUX_LICENSE_FILES = COPYING +define LINUX_HELP_CMDS + @echo ' linux-menuconfig - Run Linux kernel menuconfig' + @echo ' linux-savedefconfig - Run Linux kernel savedefconfig' + @echo ' linux-update-defconfig - Save the Linux configuration to the path specified' + @echo ' by BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE' +endef + # Compute LINUX_SOURCE and LINUX_SITE from the configuration ifeq ($(BR2_LINUX_KERNEL_CUSTOM_TARBALL),y) LINUX_TARBALL = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION)) LINUX_SITE = $(patsubst %/,%,$(dir $(LINUX_TARBALL))) LINUX_SOURCE = $(notdir $(LINUX_TARBALL)) BR_NO_CHECK_HASH_FOR += $(LINUX_SOURCE) -else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_LOCAL),y) -LINUX_SITE = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_LOCAL_PATH)) -LINUX_SITE_METHOD = local else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_GIT),y) LINUX_SITE = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL)) LINUX_SITE_METHOD = git else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_HG),y) LINUX_SITE = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL)) LINUX_SITE_METHOD = hg +else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_SVN),y) +LINUX_SITE = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL)) +LINUX_SITE_METHOD = svn else LINUX_SOURCE = linux-$(LINUX_VERSION).tar.xz ifeq ($(BR2_LINUX_KERNEL_CUSTOM_VERSION),y) @@ -87,6 +94,14 @@ LINUX_MAKE_ENV = \ $(TARGET_MAKE_ENV) \ BR_BINARIES_DIR=$(BINARIES_DIR) +ifeq ($(BR2_REPRODUCIBLE),y) +LINUX_MAKE_ENV += \ + KBUILD_BUILD_VERSION=1 \ + KBUILD_BUILD_USER=buildroot \ + KBUILD_BUILD_HOST=buildroot \ + KBUILD_BUILD_TIMESTAMP="$(shell LC_ALL=C date -d @$(SOURCE_DATE_EPOCH))" +endif + # Get the real Linux version, which tells us where kernel modules are # going to be installed in the target filesystem. LINUX_VERSION_PROBED = `$(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null` @@ -196,6 +211,8 @@ LINUX_POST_PATCH_HOOKS += LINUX_TRY_PATCH_TIMECONST ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y) LINUX_KCONFIG_DEFCONFIG = $(call qstrip,$(BR2_LINUX_KERNEL_DEFCONFIG))_defconfig +else ifeq ($(BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG),y) +LINUX_KCONFIG_DEFCONFIG = defconfig else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG),y) LINUX_KCONFIG_FILE = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE)) endif @@ -206,6 +223,20 @@ LINUX_KCONFIG_OPTS = $(LINUX_MAKE_FLAGS) # If no package has yet set it, set it from the Kconfig option LINUX_NEEDS_MODULES ?= $(BR2_LINUX_NEEDS_MODULES) +# Make sure the Linux kernel is built with the right endianness. Not +# all architectures support +# CONFIG_CPU_BIG_ENDIAN/CONFIG_CPU_LITTLE_ENDIAN in Linux, but the +# option will be thrown away and ignored if it doesn't exist. +ifeq ($(BR2_ENDIAN),"BIG") +define LINUX_FIXUP_CONFIG_ENDIANNESS + $(call KCONFIG_ENABLE_OPT,CONFIG_CPU_BIG_ENDIAN,$(@D)/.config) +endef +else +define LINUX_FIXUP_CONFIG_ENDIANNESS + $(call KCONFIG_ENABLE_OPT,CONFIG_CPU_LITTLE_ENDIAN,$(@D)/.config) +endef +endif + define LINUX_KCONFIG_FIXUP_CMDS $(if $(LINUX_NEEDS_MODULES), $(call KCONFIG_ENABLE_OPT,CONFIG_MODULES,$(@D)/.config)) @@ -213,6 +244,7 @@ define LINUX_KCONFIG_FIXUP_CMDS $(foreach opt, $(LINUX_COMPRESSION_OPT_), $(call KCONFIG_DISABLE_OPT,$(opt),$(@D)/.config) ) + $(LINUX_FIXUP_CONFIG_ENDIANNESS) $(if $(BR2_arm)$(BR2_armeb), $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI,$(@D)/.config)) $(if $(BR2_TARGET_ROOTFS_CPIO), @@ -348,6 +380,9 @@ define LINUX_INSTALL_HOST_TOOLS # Installing dtc (device tree compiler) as host tool, if selected if grep -q "CONFIG_DTC=y" $(@D)/.config; then \ $(INSTALL) -D -m 0755 $(@D)/scripts/dtc/dtc $(HOST_DIR)/usr/bin/linux-dtc ; \ + if [ ! -e $(HOST_DIR)/usr/bin/dtc ]; then \ + ln -sf linux-dtc $(HOST_DIR)/usr/bin/dtc ; \ + fi \ fi endef @@ -357,6 +392,10 @@ define LINUX_INSTALL_IMAGES_CMDS $(call LINUX_INSTALL_DTB,$(BINARIES_DIR)) endef +ifeq ($(BR2_STRIP_strip),y) +LINUX_MAKE_FLAGS += INSTALL_MOD_STRIP=1 +endif + define LINUX_INSTALL_TARGET_CMDS $(LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET) # Install modules and remove symbolic links pointing to build @@ -369,7 +408,7 @@ define LINUX_INSTALL_TARGET_CMDS $(LINUX_INSTALL_HOST_TOOLS) endef -# Include all our extensions and tools definitions. +# Include all our extensions. # # Note: our package infrastructure uses the full-path of the last-scanned # Makefile to determine what package we're currently defining, using the @@ -380,7 +419,6 @@ endef # the current Makefile, we are OK. But this is a hard requirement: files # included here *must* be in the same directory! include $(sort $(wildcard linux/linux-ext-*.mk)) -include $(sort $(wildcard linux/linux-tool-*.mk)) LINUX_PATCH_DEPENDENCIES += $(foreach ext,$(LINUX_EXTENSIONS),\ $(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),$(ext))) @@ -389,28 +427,18 @@ LINUX_PRE_PATCH_HOOKS += $(foreach ext,$(LINUX_EXTENSIONS),\ $(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),\ $(call UPPERCASE,$(ext))_PREPARE_KERNEL)) -# Install Linux kernel tools in the staging directory since some tools -# may install shared libraries and headers (e.g. cpupower). The kernel -# image is NOT installed in the staging directory. -LINUX_INSTALL_STAGING = YES - -LINUX_DEPENDENCIES += $(foreach tool,$(LINUX_TOOLS),\ - $(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\ - $($(call UPPERCASE,$(tool))_DEPENDENCIES))) - -LINUX_POST_BUILD_HOOKS += $(foreach tool,$(LINUX_TOOLS),\ - $(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\ - $(call UPPERCASE,$(tool))_BUILD_CMDS)) - -LINUX_POST_INSTALL_STAGING_HOOKS += $(foreach tool,$(LINUX_TOOLS),\ - $(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\ - $(call UPPERCASE,$(tool))_INSTALL_STAGING_CMDS)) - -LINUX_POST_INSTALL_TARGET_HOOKS += $(foreach tool,$(LINUX_TOOLS),\ - $(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\ - $(call UPPERCASE,$(tool))_INSTALL_TARGET_CMDS)) - # Checks to give errors that the user can understand + +# When a custom repository has been set, check for the repository version +ifeq ($(BR2_LINUX_KERNEL_CUSTOM_SVN)$(BR2_LINUX_KERNEL_CUSTOM_GIT)$(BR2_LINUX_KERNEL_CUSTOM_HG),y) +ifeq ($(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION)),) +$(error No custom repository version set. Check your BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION setting) +endif +ifeq ($(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL)),) +$(error No custom repo URL set. Check your BR2_LINUX_KERNEL_CUSTOM_REPO_URL setting) +endif +endif + ifeq ($(BR_BUILDING),y) ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y) @@ -444,8 +472,8 @@ $(LINUX_DIR)/.stamp_initramfs_rebuilt: $(LINUX_DIR)/.stamp_target_installed $(LI # Build the kernel. $(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_TARGET_NAME) $(LINUX_APPEND_DTB) - # Copy the kernel image to its final destination - cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR) + # Copy the kernel image(s) to its(their) final destination + $(call LINUX_INSTALL_IMAGE,$(BINARIES_DIR)) # If there is a .ub file copy it to the final destination test ! -f $(LINUX_IMAGE_PATH).ub || cp $(LINUX_IMAGE_PATH).ub $(BINARIES_DIR) $(Q)touch $@ diff --git a/support/dependencies/check-host-cmake.mk b/support/dependencies/check-host-cmake.mk new file mode 100644 index 0000000000..8002278a3b --- /dev/null +++ b/support/dependencies/check-host-cmake.mk @@ -0,0 +1,18 @@ +# Versions before 3.0 are affected by the bug described in +# https://git.busybox.net/buildroot/commit/?id=ef2c1970e4bff3be3992014070392b0e6bc28bd2 +# and fixed in upstream CMake in version 3.0: +# https://cmake.org/gitweb?p=cmake.git;h=e8b8b37ef6fef094940d3384df5a1d421b9fa568 +# +# Set this to either 3.0 or higher, depending on the highest minimum +# version required by any of the packages bundled in Buildroot. If a +# package is bumped or a new one added, and it requires a higher +# version, our cmake infra will catch it and whine. +# +BR2_CMAKE_VERSION_MIN = 3.1 + +BR2_CMAKE ?= cmake +ifeq ($(call suitable-host-package,cmake,\ + $(BR2_CMAKE) $(BR2_CMAKE_VERSION_MIN)),) +BR2_CMAKE = $(HOST_DIR)/usr/bin/cmake +BR2_CMAKE_HOST_DEPENDENCY = host-cmake +endif diff --git a/support/dependencies/check-host-cmake.sh b/support/dependencies/check-host-cmake.sh new file mode 100755 index 0000000000..9b63b0648d --- /dev/null +++ b/support/dependencies/check-host-cmake.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +candidate="${1}" +version_min="${2}" + +major_min="${version_min%.*}" +minor_min="${version_min#*.}" + +cmake=`which ${candidate}` +if [ ! -x "${cmake}" ]; then + # echo nothing: no suitable cmake found + exit 1 +fi + +# Extract version X.Y from versions in the form X.Y or X.Y.Z +# with X, Y and Z numbers with one or more digits each, e.g. +# 3.2 -> 3.2 +# 3.2.3 -> 3.2 +# 3.2.42 -> 3.2 +# 3.10 -> 3.10 +# 3.10.4 -> 3.10 +# 3.10.42 -> 3.10 +version="$(${cmake} --version \ + |sed -r -e '/.* ([[:digit:]]+\.[[:digit:]]+).*$/!d;' \ + -e 's//\1/' + )" +major="${version%.*}" +minor="${version#*.}" + +if [ ${major} -gt ${major_min} ]; then + echo "${cmake}" +else + if [ ${major} -eq ${major_min} -a ${minor} -ge ${minor_min} ]; then + echo "${cmake}" + else + # echo nothing: no suitable cmake found + exit 1 + fi +fi diff --git a/support/dependencies/dependencies.mk b/support/dependencies/dependencies.mk index 82327216cd..d4b0409cda 100644 --- a/support/dependencies/dependencies.mk +++ b/support/dependencies/dependencies.mk @@ -5,8 +5,6 @@ # ################################################################################ -DEPENDENCIES_HOST_PREREQ := - # suitable-host-pkg: calls check-host-$(1).sh shell script. Parameter (2) # can be the candidate to be checked. If not present, the check-host-$(1).sh # script should use 'which' to find a candidate. The script should return @@ -16,10 +14,6 @@ $(shell support/dependencies/check-host-$(1).sh $(2)) endef -include $(sort $(wildcard support/dependencies/check-host-*.mk)) -ifeq ($(BR2_STRIP_sstrip),y) -DEPENDENCIES_HOST_PREREQ += host-sstrip -endif - ifeq ($(BR2_CCACHE),y) DEPENDENCIES_HOST_PREREQ += host-ccache endif diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh index 3146401a9d..168d1960a1 100755 --- a/support/dependencies/dependencies.sh +++ b/support/dependencies/dependencies.sh @@ -69,6 +69,10 @@ check_prog_host "which" # Verify that sed is installed check_prog_host "sed" +# 'file' must be present and must be exactly /usr/bin/file, +# otherwise libtool fails in incomprehensible ways. +check_prog_host "/usr/bin/file" + # Check make MAKE=$(which make 2> /dev/null) if [ -z "$MAKE" ] ; then @@ -178,8 +182,7 @@ if test "${missing_progs}" = "yes" ; then exit 1 fi -if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \ - grep ^BR2_ENABLE_LOCALE=y $BR2_CONFIG > /dev/null ; then +if grep ^BR2_NEEDS_HOST_UTF8_LOCALE=y $BR2_CONFIG > /dev/null; then if ! which locale > /dev/null ; then echo echo "You need locale support on your build machine to build a toolchain supporting locales" @@ -238,8 +241,14 @@ fi # Check that the Perl installation is complete enough for Buildroot. required_perl_modules="Data::Dumper" # Needed to build host-autoconf +required_perl_modules="$required_perl_modules ExtUtils::MakeMaker" # Used by host-libxml-parser-perl required_perl_modules="$required_perl_modules Thread::Queue" # Used by host-automake +if grep -q ^BR2_PACKAGE_MPV=y $BR2_CONFIG ; then + required_perl_modules="$required_perl_modules Math::BigInt" + required_perl_modules="$required_perl_modules Math::BigRat" +fi + # This variable will keep the modules that are missing in your system. missing_perl_modules="" diff --git a/support/download/bzr b/support/download/bzr index e18b01f39c..75b7b415c1 100755 --- a/support/download/bzr +++ b/support/download/bzr @@ -26,6 +26,8 @@ repo="${2}" rev="${3}" basename="${4}" +shift 4 # Get rid of our options + # Caller needs to single-quote its arguments to prevent them from # being expanded a second time (in case there are spaces in them) _bzr() { @@ -49,5 +51,5 @@ if [ ${bzr_version} -ge ${bzr_min_version} ]; then fi _bzr export ${verbose} --root="'${basename}/'" --format=tgz \ - ${timestamp_opt} - "'${repo}'" -r "'${rev}'" \ + ${timestamp_opt} - "${@}" "'${repo}'" -r "'${rev}'" \ >"${output}" diff --git a/support/download/cp b/support/download/cp index 09ce3d1100..0ee1f3ba82 100755 --- a/support/download/cp +++ b/support/download/cp @@ -28,10 +28,12 @@ shift $((OPTIND-1)) output="${1}" source="${2}" +shift 2 # Get rid of our options + # Caller needs to single-quote its arguments to prevent them from # being expanded a second time (in case there are spaces in them) _localfiles() { eval ${LOCALFILES} "${@}" } -_localfiles ${verbose} "'${source}'" "'${output}'" +_localfiles ${verbose} "${@}""'${source}'" "'${output}'" diff --git a/support/download/cvs b/support/download/cvs index 7980389a4e..50050ab1c9 100755 --- a/support/download/cvs +++ b/support/download/cvs @@ -26,6 +26,8 @@ rev="${3}" rawname="${4}" basename="${5}" +shift 5 # Get rid of our options + # Caller needs to single-quote its arguments to prevent them from # being expanded a second time (in case there are spaces in them) _cvs() { @@ -48,6 +50,6 @@ fi export TZ=UTC _cvs ${verbose} -z3 -d"'${repo}'" \ - co -d "'${basename}'" ${select} "'${rev}'" -P "'${rawname}'" + co "${@}" -d "'${basename}'" ${select} "'${rev}'" -P "'${rawname}'" tar czf "${output}" "${basename}" diff --git a/support/download/dl-wrapper b/support/download/dl-wrapper index ef2d872938..f944b71db5 100755 --- a/support/download/dl-wrapper +++ b/support/download/dl-wrapper @@ -21,15 +21,16 @@ set -e main() { local OPT OPTARG - local backend output hfile quiet + local backend output hfile recurse quiet # Parse our options; anything after '--' is for the backend - while getopts :hb:o:H:q OPT; do + while getopts :hb:o:H:rq OPT; do case "${OPT}" in h) help; exit 0;; b) backend="${OPTARG}";; o) output="${OPTARG}";; H) hfile="${OPTARG}";; + r) recurse="-r";; q) quiet="-q";; :) error "option '%s' expects a mandatory argument\n" "${OPTARG}";; \?) error "unknown option '%s'\n" "${OPTARG}";; @@ -82,7 +83,7 @@ main() { # If the backend fails, we can just remove the temporary directory to # remove all the cruft it may have left behind. Then we just exit in # error too. - if ! "${OLDPWD}/support/download/${backend}" ${quiet} "${tmpf}" "${@}"; then + if ! "${OLDPWD}/support/download/${backend}" ${quiet} ${recurse} "${tmpf}" "${@}"; then rm -rf "${tmpd}" exit 1 fi diff --git a/support/download/git b/support/download/git index 314b388fbc..7921411835 100755 --- a/support/download/git +++ b/support/download/git @@ -6,15 +6,20 @@ set -e # Download helper for git, to be called from the download wrapper script # # Call it as: -# .../git [-q] OUT_FILE REPO_URL CSET BASENAME +# .../git [-q] [-r] OUT_FILE REPO_URL CSET BASENAME +# +# -q Be quiet. +# -r Clone and archive sub-modules. # # Environment: # GIT : the git command to call verbose= -while getopts :q OPT; do +recurse=0 +while getopts :qr OPT; do case "${OPT}" in q) verbose=-q; exec >/dev/null;; + r) recurse=1;; \?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;; esac done @@ -25,6 +30,8 @@ repo="${2}" cset="${3}" basename="${4}" +shift 4 # Get rid of our options + # Caller needs to single-quote its arguments to prevent them from # being expanded a second time (in case there are spaces in them) _git() { @@ -41,7 +48,7 @@ _git() { git_done=0 if [ -n "$(_git ls-remote "'${repo}'" "'${cset}'" 2>&1)" ]; then printf "Doing shallow clone\n" - if _git clone ${verbose} --depth 1 -b "'${cset}'" --bare "'${repo}'" "'${basename}'"; then + if _git clone ${verbose} "${@}" --depth 1 -b "'${cset}'" "'${repo}'" "'${basename}'"; then git_done=1 else printf "Shallow clone failed, falling back to doing a full clone\n" @@ -49,10 +56,44 @@ if [ -n "$(_git ls-remote "'${repo}'" "'${cset}'" 2>&1)" ]; then fi if [ ${git_done} -eq 0 ]; then printf "Doing full clone\n" - _git clone ${verbose} --mirror "'${repo}'" "'${basename}'" + _git clone ${verbose} "${@}" "'${repo}'" "'${basename}'" fi -GIT_DIR="${basename}" \ -_git archive --prefix="'${basename}/'" -o "'${output}.tmp'" --format=tar "'${cset}'" +pushd "${basename}" >/dev/null -gzip -n <"${output}.tmp" >"${output}" +# Try to get the special refs exposed by some forges (pull-requests for +# github, changes for gerrit...). There is no easy way to know whether +# the cset the user passed us is such a special ref or a tag or a sha1 +# or whatever else. We'll eventually fail at checking out that cset, +# below, if there is an issue anyway. Since most of the cset we're gonna +# have to clone are not such special refs, consign the output to oblivion +# so as not to alarm unsuspecting users, but still trace it as a warning. +if ! _git fetch origin "'${cset}:${cset}'" >/dev/null 2>&1; then + printf "Could not fetch special ref '%s'; assuming it is not special.\n" "${cset}" +fi + +# Checkout the required changeset, so that we can update the required +# submodules. +_git checkout -q "'${cset}'" + +# Get date of commit to generate a reproducible archive. +# %cD is RFC2822, so it's fully qualified, with TZ and all. +date="$( _git log -1 --pretty=format:%cD )" + +# There might be submodules, so fetch them. +if [ ${recurse} -eq 1 ]; then + _git submodule update --init --recursive +fi + +# We do not need the .git dir; we keep other .git files, in case they +# are the only files in their directory. +rm -rf .git + +popd >/dev/null + +# Generate the archive, sort with the C locale so that it is reproducible +find "${basename}" -not -type d >"${basename}.list" +LC_ALL=C sort <"${basename}.list" >"${basename}.list.sorted" +tar cf - --numeric-owner --owner=0 --group=0 --mtime="${date}" \ + -T "${basename}.list.sorted" >"${output}.tar" +gzip -n <"${output}.tar" >"${output}" diff --git a/support/download/hg b/support/download/hg index 25cb4e9d35..3af01690b3 100755 --- a/support/download/hg +++ b/support/download/hg @@ -25,13 +25,15 @@ repo="${2}" cset="${3}" basename="${4}" +shift 4 # Get rid of our options + # Caller needs to single-quote its arguments to prevent them from # being expanded a second time (in case there are spaces in them) _hg() { eval ${HG} "${@}" } -_hg clone ${verbose} --noupdate "'${repo}'" "'${basename}'" +_hg clone ${verbose} "${@}" --noupdate "'${repo}'" "'${basename}'" _hg archive ${verbose} --repository "'${basename}'" --type tgz \ --prefix "'${basename}'" --rev "'${cset}'" \ diff --git a/support/download/scp b/support/download/scp index 95cf502be2..825fd41c64 100755 --- a/support/download/scp +++ b/support/download/scp @@ -23,10 +23,12 @@ shift $((OPTIND-1)) output="${1}" url="${2}" +shift 2 # Get rid of our options + # Caller needs to single-quote its arguments to prevent them from # being expanded a second time (in case there are spaces in them) _scp() { eval ${SCP} "${@}" } -_scp ${verbose} "'${url}'" "'${output}'" +_scp ${verbose} "${@}" "'${url}'" "'${output}'" diff --git a/support/download/svn b/support/download/svn index 4dcdd06239..77abf3d02d 100755 --- a/support/download/svn +++ b/support/download/svn @@ -25,12 +25,14 @@ repo="${2}" rev="${3}" basename="${4}" +shift 4 # Get rid of our options + # Caller needs to single-quote its arguments to prevent them from # being expanded a second time (in case there are spaces in them) _svn() { eval ${SVN} "${@}" } -_svn export ${verbose} "'${repo}@${rev}'" "'${basename}'" +_svn export ${verbose} "${@}" "'${repo}@${rev}'" "'${basename}'" tar czf "${output}" "${basename}" diff --git a/support/download/wget b/support/download/wget index 0fc7ffa94e..768de904c3 100755 --- a/support/download/wget +++ b/support/download/wget @@ -23,10 +23,12 @@ shift $((OPTIND-1)) output="${1}" url="${2}" +shift 2 # Get rid of our options + # Caller needs to single-quote its arguments to prevent them from # being expanded a second time (in case there are spaces in them) _wget() { eval ${WGET} "${@}" } -_wget ${verbose} -O "'${output}'" "'${url}'" +_wget ${verbose} "${@}" -O "'${output}'" "'${url}'" diff --git a/support/dummy-external/Config.in b/support/dummy-external/Config.in deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/support/dummy-external/external.mk b/support/dummy-external/external.mk deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/support/gnuconfig/README.buildroot b/support/gnuconfig/README.buildroot index 0898cb541c..a71ed93010 100644 --- a/support/gnuconfig/README.buildroot +++ b/support/gnuconfig/README.buildroot @@ -24,4 +24,4 @@ Currently no patches are needed, but they may be needed again in the future. The current Buildroot version is based on the Git commit -5e4de70bb0064d974a848fbe3a445d5dafaf7b48 of the config.git repository. +dafd8e767ec87b90aac62f0fcedd11944c84b50a of the config.git repository. diff --git a/support/gnuconfig/config.guess b/support/gnuconfig/config.guess index b79252d6b1..c4bd827a7b 100755 --- a/support/gnuconfig/config.guess +++ b/support/gnuconfig/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2013-06-10' +timestamp='2016-05-15' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ timestamp='2013-06-10' # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -149,7 +149,7 @@ Linux|GNU|GNU/*) LIBC=gnu #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac @@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -579,8 +603,9 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -617,13 +642,13 @@ EOF sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -662,11 +687,11 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -679,12 +704,12 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -789,14 +814,14 @@ EOF echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -826,7 +851,7 @@ EOF *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -878,7 +903,7 @@ EOF exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -901,7 +926,7 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -932,6 +957,9 @@ EOF crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -944,6 +972,9 @@ EOF ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -969,10 +1000,10 @@ EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or1k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} exit ;; - or32:Linux:*:*) + or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) @@ -1020,7 +1051,7 @@ EOF echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1099,7 +1130,7 @@ EOF # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1248,6 +1279,9 @@ EOF SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1260,22 +1294,32 @@ EOF if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1306,7 +1350,7 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1348,7 +1392,7 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1359,171 +1403,25 @@ EOF x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/support/gnuconfig/config.sub b/support/gnuconfig/config.sub index 61cb4bc22d..6d86a1e2f7 100755 --- a/support/gnuconfig/config.sub +++ b/support/gnuconfig/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2013-10-01' +timestamp='2016-05-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ timestamp='2013-10-01' # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ timestamp='2013-10-01' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,8 +53,7 @@ timestamp='2013-10-01' me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -68,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,7 +116,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os @@ -255,12 +254,13 @@ case $basic_machine in | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ + | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ @@ -283,8 +283,10 @@ case $basic_machine in | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ @@ -296,14 +298,14 @@ case $basic_machine in | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 \ - | or1k | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -311,6 +313,7 @@ case $basic_machine in | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -325,6 +328,9 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -370,12 +376,13 @@ case $basic_machine in | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -402,8 +409,10 @@ case $basic_machine in | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ @@ -415,16 +424,18 @@ case $basic_machine in | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -432,6 +443,7 @@ case $basic_machine in | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -508,6 +520,9 @@ case $basic_machine in basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -769,6 +784,9 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -824,6 +842,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1356,11 +1378,11 @@ case $os in | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ @@ -1369,14 +1391,15 @@ case $os in | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1508,6 +1531,8 @@ case $os in ;; -nacl*) ;; + -ios) + ;; -none) ;; *) @@ -1594,9 +1619,6 @@ case $basic_machine in mips*-*) os=-elf ;; - or1k-*) - os=-elf - ;; or32-*) os=-coff ;; diff --git a/support/legal-info/README.header b/support/legal-info/README.header index d07c45d912..d3bdf71bcf 100644 --- a/support/legal-info/README.header +++ b/support/legal-info/README.header @@ -14,10 +14,17 @@ This material is composed of the following items. compiled programs. Note: this may have not been saved due to technical limitations, you may need to collect it manually. - * The source code for all packages; this has been saved in the sources/ - subdirectory (except for the non-redistributable packages, which have not - been saved); patches applied to some packages by Buildroot are included in - the Buildroot sources and were not duplicated in the sources/ subdirectory. + * The original source code for all packages; this has been saved in the + sources/ subdirectory (except for the non-redistributable packages, which + have not been saved). Patches that were applied are also saved, along + with a file named 'series' that lists the patches in the order they were + applied. Patches are under the same license as the files that they modify + in the original package. + Note: Buildroot applies additional patches to Libtool scripts of + autotools-based packages. These patches can be found under + support/libtool in the Buildroot source and, due to technical + limitations, are not saved with the package sources. You may need + to collect them manually. * A manifest file listing the configured packages and related information. * The license text of the packages; they have been saved in the licenses/ subdirectory. diff --git a/support/misc/Vagrantfile b/support/misc/Vagrantfile index b8f02afc77..dc4c15d51e 100644 --- a/support/misc/Vagrantfile +++ b/support/misc/Vagrantfile @@ -5,14 +5,14 @@ ################################################################################ # Buildroot version to use -RELEASE='2016.02' +RELEASE='2016.11.2' ### Change here for more memory/cores ### VM_MEMORY=2048 VM_CORES=1 Vagrant.configure('2') do |config| - config.vm.box = 'ubuntu/trusty64' + config.vm.box = 'bento/ubuntu-16.04' config.vm.provider :vmware_fusion do |v, override| v.vmx['memsize'] = VM_MEMORY @@ -44,10 +44,13 @@ Vagrant.configure('2') do |config| config.vm.provision 'shell', inline: "sudo dpkg --add-architecture i386 sudo apt-get -q update + sudo apt-get purge -q -y snapd lxcfs lxd ubuntu-core-launcher snap-confine + sudo apt-get -q -y upgrade sudo apt-get -q -y install build-essential libncurses5-dev \ - git bzr cvs mercurial subversion libc6:i386 unzip + git bzr cvs mercurial subversion libc6:i386 unzip bc sudo apt-get -q -y autoremove - sudo apt-get -q -y clean" + sudo apt-get -q -y clean + sudo update-locale LC_ALL=C" config.vm.provision 'shell', privileged: false, inline: "echo 'Downloading and extracting buildroot #{RELEASE}' diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in index 5cf381e96c..d4252dd9e7 100644 --- a/support/misc/toolchainfile.cmake.in +++ b/support/misc/toolchainfile.cmake.in @@ -13,12 +13,39 @@ string(REPLACE "/usr/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@) -set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@ ${CMAKE_C_FLAGS}" CACHE STRING "Buildroot CFLAGS") -set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@ ${CMAKE_CXX_FLAGS}" CACHE STRING "Buildroot CXXFLAGS") -set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@ ${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "Buildroot LDFLAGS") +# Set the {C,CXX}FLAGS appended by CMake depending on the build type +# defined by Buildroot. CMake defaults these variables with -g and/or +# -O options, and they are appended at the end of the argument list, +# so the Buildroot options are overridden. Therefore these variables +# have to be cleared, so that the options passed in CMAKE_C_FLAGS do +# apply. +# +# Note: +# if the project forces some of these flag variables, Buildroot is +# screwed up and there is nothing Buildroot can do about that :( +set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Debug CFLAGS") +set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Debug CXXFLAGS") +set(CMAKE_C_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CFLAGS") +set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CXXFLAGS") + +# Build type from the Buildroot configuration +set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configuration") + +# Buildroot defaults flags. +# If you are using this toolchainfile.cmake file outside of Buildroot and +# want to customize the compiler/linker flags, then: +# * set them all on the cmake command line, e.g.: +# cmake -DCMAKE_C_FLAGS="@@TARGET_CFLAGS@@ -Dsome_custom_flag" ... +# * and make sure the project's CMake code extends them like this if needed: +# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dsome_definitions") +set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@" CACHE STRING "Buildroot CFLAGS") +set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@" CACHE STRING "Buildroot CXXFLAGS") +set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for executables") + set(CMAKE_INSTALL_SO_NO_EXE 0) set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/usr/bin") +set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@") set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) @@ -29,3 +56,9 @@ set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@") # This toolchain file can be used both inside and outside Buildroot. set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@") set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@") +if(@@TOOLCHAIN_HAS_FORTRAN@@) + set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS") + set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS") + set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@" CACHE STRING "Buildroot FCFLAGS") + set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@") +endif() diff --git a/support/misc/utils.mk b/support/misc/utils.mk new file mode 100644 index 0000000000..c44319338e --- /dev/null +++ b/support/misc/utils.mk @@ -0,0 +1,115 @@ +################################################################################ +# +# This file contains various utility macros and variables used about +# everywhere in make constructs. +# +################################################################################ + +# Strip quotes and then whitespaces +qstrip = $(strip $(subst ",,$(1))) +#")) + +# Variables for use in Make constructs +comma := , +empty := +space := $(empty) $(empty) + +# Case conversion macros. This is inspired by the 'up' macro from gmsl +# (http://gmsl.sf.net). It is optimised very heavily because these macros +# are used a lot. It is about 5 times faster than forking a shell and tr. +# +# The caseconvert-helper creates a definition of the case conversion macro. +# After expansion by the outer $(eval ), the UPPERCASE macro is defined as: +# $(strip $(eval __tmp := $(1)) $(eval __tmp := $(subst a,A,$(__tmp))) ... ) +# In other words, every letter is substituted one by one. +# +# The caseconvert-helper allows us to create this definition out of the +# [FROM] and [TO] lists, so we don't need to write down every substition +# manually. The uses of $ and $$ quoting are chosen in order to do as +# much expansion as possible up-front. +# +# Note that it would be possible to conceive a slightly more optimal +# implementation that avoids the use of __tmp, but that would be even +# more unreadable and is not worth the effort. + +[FROM] := a b c d e f g h i j k l m n o p q r s t u v w x y z - . +[TO] := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ _ + +define caseconvert-helper +$(1) = $$(strip \ + $$(eval __tmp := $$(1))\ + $(foreach c, $(2),\ + $$(eval __tmp := $$(subst $(word 1,$(subst :, ,$c)),$(word 2,$(subst :, ,$c)),$$(__tmp))))\ + $$(__tmp)) +endef + +$(eval $(call caseconvert-helper,UPPERCASE,$(join $(addsuffix :,$([FROM])),$([TO])))) +$(eval $(call caseconvert-helper,LOWERCASE,$(join $(addsuffix :,$([TO])),$([FROM])))) + +# Reverse the orders of words in a list. Again, inspired by the gmsl +# 'reverse' macro. +reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1))) + +# Sanitize macro cleans up generic strings so it can be used as a filename +# and in rules. Particularly useful for VCS version strings, that can contain +# slashes, colons (OK in filenames but not in rules), and spaces. +sanitize = $(subst $(space),_,$(subst :,_,$(subst /,_,$(strip $(1))))) + +# MESSAGE Macro -- display a message in bold type +MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(call qstrip,$(1))$(TERM_RESET)" +TERM_BOLD := $(shell tput smso 2>/dev/null) +TERM_RESET := $(shell tput rmso 2>/dev/null) + +# Utility functions for 'find' +# findfileclauses(filelist) => -name 'X' -o -name 'Y' +findfileclauses = $(call notfirstword,$(patsubst %,-o -name '%',$(1))) +# finddirclauses(base, dirlist) => -path 'base/dirX' -o -path 'base/dirY' +finddirclauses = $(call notfirstword,$(patsubst %,-o -path '$(1)/%',$(2))) + +# Miscellaneous utility functions +# notfirstword(wordlist): returns all but the first word in wordlist +notfirstword = $(wordlist 2,$(words $(1)),$(1)) + +# Needed for the foreach loops to loop over the list of hooks, so that +# each hook call is properly separated by a newline. +define sep + + +endef + +PERCENT = % +QUOTE = ' +# ' # Meh... syntax-highlighting + +# This macro properly escapes a command string, then prints it with printf: +# +# - first, backslash '\' are self-escaped, so that they do not escape +# the following char and so that printf properly outputs a backslash; +# +# - next, single quotes are escaped by closing an existing one, adding +# an escaped one, and re-openning a new one (see below for the reason); +# +# - then '%' signs are self-escaped so that the printf does not interpret +# them as a format specifier, in case the variable contains an actual +# printf with a format; +# +# - finally, $(sep) is replaced with the literal '\n' so that make does +# not break on the so-expanded variable, but so that the printf does +# correctly output an LF. +# +# Note: this must be escaped in this order to avoid over-escaping the +# previously escaped elements. +# +# Once everything has been escaped, it is passed between single quotes +# (that's why the single-quotes are escaped they way they are, above, +# and why the dollar sign is not escaped) to printf(1). A trailing +# newline is apended, too. +# +# Note: leading or trailing spaces are *not* stripped. +# +define PRINTF + printf '$(subst $(sep),\n,\ + $(subst $(PERCENT),$(PERCENT)$(PERCENT),\ + $(subst $(QUOTE),$(QUOTE)\$(QUOTE)$(QUOTE),\ + $(subst \,\\,$(1)))))\n' +endef diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh index 201278dde7..7ccb39dd8f 100755 --- a/support/scripts/apply-patches.sh +++ b/support/scripts/apply-patches.sh @@ -31,6 +31,8 @@ # applied. The list of the patches applied is stored in '.applied_patches_list' # file in the build directory. +set -e + silent= if [ "$1" = "-s" ] ; then # add option to be used by the patch tool @@ -63,8 +65,12 @@ find ${builddir}/ '(' -name '*.rej' -o -name '.*.rej' ')' -print0 | \ xargs -0 -r rm -f function apply_patch { - path=$1 - patch=$2 + path="${1%%/}" + patch="${2}" + case "${path}" in + /*) ;; + *) path="$PWD/${path}";; + esac if [ "$3" ]; then type="series"; uncomp="cat" else @@ -99,7 +105,15 @@ function apply_patch { echo "Error: missing patch file ${path}/$patch" exit 1 fi - echo $patch >> ${builddir}/.applied_patches_list + existing="$(grep -E "/${patch}\$" ${builddir}/.applied_patches_list || true)" + if [ -n "${existing}" ]; then + echo "Error: duplicate filename '${patch}'" + echo "Conflicting files are:" + echo " already applied: ${existing}" + echo " to be applied : ${path}/${patch}" + exit 1 + fi + echo "${path}/${patch}" >> ${builddir}/.applied_patches_list ${uncomp} "${path}/$patch" | patch -g0 -p1 -E -d "${builddir}" -t -N $silent if [ $? != 0 ] ; then echo "Patch failed! Please fix ${patch}!" @@ -141,6 +155,7 @@ function scan_patchdir { fi } +touch ${builddir}/.applied_patches_list scan_patchdir "$patchdir" "$patchpattern" # Check for rejects... diff --git a/support/scripts/br2-external b/support/scripts/br2-external new file mode 100755 index 0000000000..26bcac8aa1 --- /dev/null +++ b/support/scripts/br2-external @@ -0,0 +1,221 @@ +#!/bin/bash +set -e + +# This script must be able to run with bash-3.1, so it can't use +# associative arrays. Instead, it emulates them using 'eval'. It +# can however use indexed arrays, supported since at least bash-3.0. + +# The names of the br2-external trees, once validated. +declare -a BR2_EXT_NAMES + +# URL to manual for help in converting old br2-external trees. +# Escape '#' so that make does not consider it a comment. +MANUAL_URL='https://buildroot.org/manual.html\#br2-external-converting' + +main() { + local OPT OPTARG + local br2_ext ofile ofmt + + while getopts :hkmo: OPT; do + case "${OPT}" in + h) help; exit 0;; + o) ofile="${OPTARG}";; + k) ofmt="kconfig";; + m) ofmt="mk";; + :) error "option '%s' expects a mandatory argument\n" "${OPTARG}";; + \?) error "unknown option '%s'\n" "${OPTARG}";; + esac + done + # Forget options; keep only positional args + shift $((OPTIND-1)) + + case "${ofmt}" in + mk|kconfig) + ;; + *) error "no output format specified (-m/-k)\n";; + esac + if [ -z "${ofile}" ]; then + error "no output file specified (-o)\n" + fi + + exec >"${ofile}" + + do_validate ${@//:/ } + + do_${ofmt} +} + +# Validates the br2-external trees passed as arguments. Makes each of +# them canonical and store them in the global arrays BR2_EXT_NAMES +# and BR2_EXT_PATHS. +# +# Note: since this script is always first called from Makefile context +# to generate the Makefile fragment before it is called to generate the +# Kconfig snippet, we're sure that any error in do_validate will be +# interpreted in Makefile context. Going up to generating the Kconfig +# snippet means that there were no error. +# +do_validate() { + local br2_ext + + if [ ${#} -eq 0 ]; then + # No br2-external tree is valid + return + fi + + for br2_ext in "${@}"; do + do_validate_one "${br2_ext}" + done +} + +do_validate_one() { + local br2_ext="${1}" + local br2_name br2_desc n d + + if [ ! -d "${br2_ext}" ]; then + error "'%s': no such file or directory\n" "${br2_ext}" + fi + if [ ! -r "${br2_ext}" -o ! -x "${br2_ext}" ]; then + error "'%s': permission denied\n" "${br2_ext}" + fi + if [ ! -f "${br2_ext}/external.desc" ]; then + error "'%s': does not have a name (in 'external.desc'). See %s\n" \ + "${br2_ext}" "${MANUAL_URL}" + fi + br2_name="$(sed -r -e '/^name: +(.*)$/!d; s//\1/' "${br2_ext}/external.desc")" + if [ -z "${br2_name}" ]; then + error "'%s/external.desc': does not define the name\n" "${br2_ext}" + fi + # Only ASCII chars in [A-Za-z0-9_] are permitted + n="$(sed -r -e 's/[A-Za-z0-9_]//g' <<<"${br2_name}" )" + if [ -n "${n}" ]; then + # Escape '$' so that it gets printed + error "'%s': name '%s' contains invalid chars: '%s'\n" \ + "${br2_ext}" "${br2_name//\$/\$\$}" "${n//\$/\$\$}" + fi + eval d="\"\${BR2_EXT_PATHS_${br2_name}}\"" + if [ -n "${d}" ]; then + error "'%s': name '%s' is already used in '%s'\n" \ + "${br2_ext}" "${br2_name}" "${d}" + fi + br2_desc="$(sed -r -e '/^desc: +(.*)$/!d; s//\1/' "${br2_ext}/external.desc")" + if [ ! -f "${br2_ext}/external.mk" ]; then + error "'%s/external.mk': no such file or directory\n" "${br2_ext}" + fi + if [ ! -f "${br2_ext}/Config.in" ]; then + error "'%s/Config.in': no such file or directory\n" "${br2_ext}" + fi + + # Register this br2-external tree, use an absolute canonical path + br2_ext="$( cd "${br2_ext}"; pwd )" + BR2_EXT_NAMES+=( "${br2_name}" ) + eval BR2_EXT_PATHS_${br2_name}="\"\${br2_ext}\"" + eval BR2_EXT_DESCS_${br2_name}="\"\${br2_desc:-\${br2_name}}\"" +} + +# Generate the .mk snippet that defines makefile variables +# for the br2-external tree +do_mk() { + local br2_name br2_ext + + printf '#\n# Automatically generated file; DO NOT EDIT.\n#\n' + printf '\n' + + printf 'BR2_EXTERNAL ?=' + for br2_name in "${BR2_EXT_NAMES[@]}"; do + eval br2_ext="\"\${BR2_EXT_PATHS_${br2_name}}\"" + printf ' %s' "${br2_ext}" + done + printf '\n' + + printf 'BR2_EXTERNAL_NAMES = \n' + printf 'BR2_EXTERNAL_DIRS = \n' + printf 'BR2_EXTERNAL_MKS = \n' + + if [ ${#BR2_EXT_NAMES[@]} -eq 0 ]; then + printf '\n' + printf '# No br2-external tree defined.\n' + return + fi + + for br2_name in "${BR2_EXT_NAMES[@]}"; do + eval br2_desc="\"\${BR2_EXT_DESCS_${br2_name}}\"" + eval br2_ext="\"\${BR2_EXT_PATHS_${br2_name}}\"" + printf '\n' + printf 'BR2_EXTERNAL_NAMES += %s\n' "${br2_name}" + printf 'BR2_EXTERNAL_DIRS += %s\n' "${br2_ext}" + printf 'BR2_EXTERNAL_MKS += %s/external.mk\n' "${br2_ext}" + printf 'export BR2_EXTERNAL_%s_PATH = %s\n' "${br2_name}" "${br2_ext}" + printf 'export BR2_EXTERNAL_%s_DESC = %s\n' "${br2_name}" "${br2_desc}" + done +} + +# Generate the kconfig snippet for the br2-external tree. +do_kconfig() { + local br2_name br2_ext + + printf '#\n# Automatically generated file; DO NOT EDIT.\n#\n' + printf '\n' + + if [ ${#BR2_EXT_NAMES[@]} -eq 0 ]; then + printf '# No br2-external tree defined.\n' + return + fi + + printf 'menu "External options"\n' + printf '\n' + + for br2_name in "${BR2_EXT_NAMES[@]}"; do + eval br2_desc="\"\${BR2_EXT_DESCS_${br2_name}}\"" + eval br2_ext="\"\${BR2_EXT_PATHS_${br2_name}}\"" + if [ ${#BR2_EXT_NAMES[@]} -gt 1 ]; then + printf 'menu "%s"\n' "${br2_desc}" + fi + printf 'comment "%s (in %s)"\n' "${br2_desc}" "${br2_ext}" + printf 'config BR2_EXTERNAL_%s_PATH\n' "${br2_name}" + printf '\tstring\n' + printf '\tdefault "%s"\n' "${br2_ext}" + printf 'source "%s/Config.in"\n' "${br2_ext}" + if [ ${#BR2_EXT_NAMES[@]} -gt 1 ]; then + printf 'endmenu # %s\n' "${br2_name}" + fi + printf '\n' + done + + printf "endmenu # User-provided options\n" +} + +help() { + cat <<-_EOF_ + Usage: + ${my_name} <-m|-k> -o FILE PATH + + With -m, ${my_name} generates the makefile fragment that defines + variables related to the br2-external trees passed as positional + arguments. + + With -k, ${my_name} generates the kconfig snippet to include the + configuration options specified in the br2-external trees passed + as positional arguments. + + Using -k and -m together is not possible. The last one wins. + + Options: + -m Generate the makefile fragment. + + -k Generate the kconfig snippet. + + -o FILE + FILE in which to generate the kconfig snippet or makefile + fragment. + + Returns: + 0 If no error + !0 If any error + _EOF_ +} + +error() { local fmt="${1}"; shift; printf "BR2_EXTERNAL_ERROR = ${fmt}" "${@}"; exit 1; } + +my_name="${0##*/}" +main "${@}" diff --git a/support/scripts/check-host-rpath b/support/scripts/check-host-rpath index 48d69dae63..6ce547cb04 100755 --- a/support/scripts/check-host-rpath +++ b/support/scripts/check-host-rpath @@ -26,7 +26,7 @@ main() { printf "*** ERROR: package %s installs executables without proper RPATH:\n" "${pkg}" fi printf "*** %s\n" "${file}" - done < <( find "${hostdir}"/usr/{bin,sbin} -type f -exec file {} + 2>/dev/null \ + done < <( find "${hostdir}"/{,usr/}{bin,sbin} -type f -exec file {} + 2>/dev/null \ |sed -r -e '/^([^:]+):.*\.*\.*/!d' \ -e 's//\1/' \ ) diff --git a/support/scripts/fix-configure-powerpc64.sh b/support/scripts/fix-configure-powerpc64.sh new file mode 100755 index 0000000000..ad710422a5 --- /dev/null +++ b/support/scripts/fix-configure-powerpc64.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# This is a script to find, and correct, a problem with old versions of +# configure that affect powerpc64 and powerpc64le. + +# The issue causes configure to incorrectly determine that shared library +# support is not present in the linker. This causes the package to build a +# static library rather than a dynamic one and although the build will succeed, +# it may cause packages that link with the static library it to fail due to +# undefined symbols. + +# This script searches for files named 'configure' that appear to have this +# issue (by searching for a known bad pattern) and patching them. + +set -e + +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 2 +fi + +srcdir="$1" +files=$(cd "$srcdir" && find . -name configure \ +-exec grep -qF 'Generated by GNU Autoconf' {} \; \ +-exec grep -qF 'ppc*-*linux*|powerpc*-*linux*)' {} \; -print) + +# --ignore-whitespace is needed because some packages have included +# copies of configure scripts where tabs have been replaced with spaces. +for c in $files; do + patch --ignore-whitespace "$srcdir"/"$c" <<'EOF' +--- a/configure 2016-11-16 15:31:46.097447271 +1100 ++++ b/configure 2008-07-21 12:17:23.000000000 +1000 +@@ -4433,7 +4433,10 @@ + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; +- ppc*-*linux*|powerpc*-*linux*) ++ powerpcle-*linux*) ++ LD="${LD-ld} -m elf64lppc" ++ ;; ++ powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) +EOF +done + diff --git a/support/scripts/gen-manual-lists.py b/support/scripts/gen-manual-lists.py deleted file mode 100644 index d231eda1fc..0000000000 --- a/support/scripts/gen-manual-lists.py +++ /dev/null @@ -1,513 +0,0 @@ -## gen-manual-lists.py -## -## This script generates the following Buildroot manual appendices: -## - the package tables (one for the target, the other for host tools); -## - the deprecated items. -## -## Author(s): -## - Samuel Martin -## -## Copyright (C) 2013 Samuel Martin -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -## - -from __future__ import print_function -from __future__ import unicode_literals - -import os -import re -import sys -import datetime -from argparse import ArgumentParser - -try: - import kconfiglib -except ImportError: - message = """ -Could not find the module 'kconfiglib' in the PYTHONPATH: -""" - message += "\n".join([" {0}".format(path) for path in sys.path]) - message += """ - -Make sure the Kconfiglib directory is in the PYTHONPATH, then relaunch the -script. - -You can get kconfiglib from: - https://github.com/ulfalizer/Kconfiglib - - -""" - sys.stderr.write(message) - raise - - -def get_symbol_subset(root, filter_func): - """ Return a generator of kconfig items. - - :param root_item: Root item of the generated subset of items - :param filter_func: Filter function - - """ - if hasattr(root, "get_items"): - get_items = root.get_items - elif hasattr(root, "get_top_level_items"): - get_items = root.get_top_level_items - else: - message = "The symbol does not contain any subset of symbols" - raise Exception(message) - for item in get_items(): - if item.is_symbol(): - if not filter_func(item): - continue - yield item - elif item.is_menu() or item.is_choice(): - for i in get_symbol_subset(item, filter_func): - yield i - - -def get_symbol_parents(item, root=None, enable_choice=False): - """ Return the list of the item's parents. The last item of the list is - the closest parent, the first the furthest. - - :param item: Item from which the parent list is generated - :param root: Root item stopping the search (not included in the - parent list) - :param enable_choice: Flag enabling choices to appear in the parent list - - """ - parent = item.get_parent() - parents = [] - while parent and parent != root: - if parent.is_menu(): - parents.append(parent.get_title()) - elif enable_choice and parent.is_choice(): - parents.append(parent.get_prompts()[0]) - parent = parent.get_parent() - if isinstance(root, kconfiglib.Menu) or \ - (enable_choice and isinstance(root, kconfiglib.Choice)): - parents.append("") # Dummy empty parent to get a leading arrow -> - parents.reverse() - return parents - - -def format_asciidoc_table(root, get_label_func, filter_func=lambda x: True, - format_func=lambda x: x, - enable_choice=False, sorted=True, - item_label=None): - """ Return the asciidoc formatted table of the items and their location. - - :param root: Root item of the item subset - :param get_label_func: Item's label getter function - :param filter_func: Filter function to apply on the item subset - :param format_func: Function to format a symbol and the table header - :param enable_choice: Enable choices to appear as part of the item's - location - :param sorted: Flag to alphabetically sort the table - - """ - - lines = [] - for item in get_symbol_subset(root, filter_func): - lines.append(format_func(what="symbol", symbol=item, root=root, - get_label_func=get_label_func, - enable_choice=enable_choice)) - if sorted: - lines.sort(key=lambda x: x.lower()) - table = ":halign: center\n\n" - width, columns = format_func(what="layout") - table = "[width=\"{0}\",cols=\"{1}\",options=\"header\"]\n".format(width, columns) - table += "|===================================================\n" - table += format_func(what="header", header=item_label, root=root) - table += "\n" + "".join(lines) + "\n" - table += "|===================================================\n" - return table - - -class Buildroot: - """ Buildroot configuration object. - - """ - root_config = "Config.in" - package_dirname = "package" - package_prefixes = ["BR2_PACKAGE_", "BR2_PACKAGE_HOST_"] - re_pkg_prefix = re.compile(r"^(" + "|".join(package_prefixes) + ").*") - deprecated_symbol = "BR2_DEPRECATED" - list_in = """\ -// -// Automatically generated list for Buildroot manual. -// - -{table} -""" - - list_info = { - 'target-packages': { - 'filename': "package-list", - 'root_menu': "Target packages", - 'filter': "_is_real_package", - 'format': "_format_symbol_prompt_location", - 'sorted': True, - }, - 'host-packages': { - 'filename': "host-package-list", - 'root_menu': "Host utilities", - 'filter': "_is_real_package", - 'format': "_format_symbol_prompt", - 'sorted': True, - }, - 'virtual-packages': { - 'filename': "virtual-package-list", - 'root_menu': "Target packages", - 'filter': "_is_virtual_package", - 'format': "_format_symbol_virtual", - 'sorted': True, - }, - 'deprecated': { - 'filename': "deprecated-list", - 'root_menu': None, - 'filter': "_is_deprecated_feature", - 'format': "_format_symbol_prompt_location", - 'sorted': False, - }, - } - - def __init__(self): - self.base_dir = os.environ.get("TOPDIR") - self.output_dir = os.environ.get("O") - self.package_dir = os.path.join(self.base_dir, self.package_dirname) - self.config = kconfiglib.Config(os.path.join(self.base_dir, - self.root_config), - self.base_dir) - self._deprecated = self.config.get_symbol(self.deprecated_symbol) - - self.gen_date = datetime.datetime.utcnow() - self.br_version_full = os.environ.get("BR2_VERSION_FULL") - if self.br_version_full and self.br_version_full.endswith("-git"): - self.br_version_full = self.br_version_full[:-4] - if not self.br_version_full: - self.br_version_full = "undefined" - - def _get_package_symbols(self, package_name): - """ Return a tuple containing the target and host package symbol. - - """ - symbols = re.sub("[-+.]", "_", package_name) - symbols = symbols.upper() - symbols = tuple([prefix + symbols for prefix in self.package_prefixes]) - return symbols - - def _is_deprecated(self, symbol): - """ Return True if the symbol is marked as deprecated, otherwise False. - - """ - # This also catches BR2_DEPRECATED_SINCE_xxxx_xx - return bool([ symbol for x in symbol.get_referenced_symbols() - if x.get_name().startswith(self._deprecated.get_name()) ]) - - def _is_package(self, symbol, type='real'): - """ Return True if the symbol is a package or a host package, otherwise - False. - - :param symbol: The symbol to check - :param type: Limit to 'real' or 'virtual' types of packages, - with 'real' being the default. - Note: only 'real' is (implictly) handled for now - - """ - if not symbol.is_symbol(): - return False - if type == 'real' and not symbol.get_prompts(): - return False - if type == 'virtual' and symbol.get_prompts(): - return False - if not self.re_pkg_prefix.match(symbol.get_name()): - return False - pkg_name = self._get_pkg_name(symbol) - - pattern = "^(HOST_)?" + pkg_name + "$" - pattern = re.sub("_", ".", pattern) - pattern = re.compile(pattern, re.IGNORECASE) - # Here, we cannot just check for the location of the Config.in because - # of the "virtual" package. - # - # So, to check that a symbol is a package (not a package option or - # anything else), we check for the existence of the package *.mk file. - # - # By the way, to actually check for a package, we should grep all *.mk - # files for the following regex: - # "\$\(eval \$\((host-)?(generic|autotools|cmake)-package\)\)" - # - # Implementation details: - # - # * The package list is generated from the *.mk file existence, the - # first time this function is called. Despite the memory consumption, - # this list is stored because the execution time of this script is - # noticeably shorter than rescanning the package sub-tree for each - # symbol. - if not hasattr(self, "_package_list"): - pkg_list = [] - for _, _, files in os.walk(self.package_dir): - for file_ in (f for f in files if f.endswith(".mk")): - pkg_list.append(re.sub(r"(.*?)\.mk", r"\1", file_)) - setattr(self, "_package_list", pkg_list) - for pkg in getattr(self, "_package_list"): - if type == 'real': - if pattern.match(pkg) and not self._exists_virt_symbol(pkg): - return True - if type == 'virtual': - if pattern.match('has_' + pkg): - return True - return False - - def _is_real_package(self, symbol): - return self._is_package(symbol, 'real') - - def _is_virtual_package(self, symbol): - return self._is_package(symbol, 'virtual') - - def _is_deprecated_feature(self, symbol): - return symbol.get_prompts() and self._is_deprecated(symbol) - - def _exists_virt_symbol(self, pkg_name): - """ Return True if a symbol exists that defines the package as - a virtual package, False otherwise - - :param pkg_name: The name of the package, for which to check if - a symbol exists defining it as a virtual package - - """ - virt_pattern = "BR2_PACKAGE_HAS_" + pkg_name + "$" - virt_pattern = re.sub("_", ".", virt_pattern) - virt_pattern = re.compile(virt_pattern, re.IGNORECASE) - for sym in self.config: - if virt_pattern.match(sym.get_name()): - return True - return False - - def _get_pkg_name(self, symbol): - """ Return the package name of the specified symbol. - - :param symbol: The symbol to get the package name of - - """ - - return re.sub("BR2_PACKAGE_(HOST_)?(.*)", r"\2", symbol.get_name()) - - def _get_symbol_label(self, symbol, mark_deprecated=True): - """ Return the label (a.k.a. prompt text) of the symbol. - - :param symbol: The symbol - :param mark_deprecated: Append a 'deprecated' to the label - - """ - label = symbol.get_prompts()[0] - if self._is_deprecated(symbol) and mark_deprecated: - label += " *(deprecated)*" - return label - - def _format_symbol_prompt(self, what=None, symbol=None, root=None, - enable_choice=False, header=None, - get_label_func=lambda x: x): - if what == "layout": - return ( "30%", "^1" ) - - if what == "header": - return "| {0:<40}\n".format(header) - - if what == "symbol": - return "| {0:<40}\n".format(get_label_func(symbol)) - - message = "Invalid argument 'what': '%s'\n" % str(what) - message += "Allowed values are: 'layout', 'header' and 'symbol'" - raise Exception(message) - - def _format_symbol_prompt_location(self, what=None, symbol=None, root=None, - enable_choice=False, header=None, - get_label_func=lambda x: x): - if what == "layout": - return ( "100%", "^1,4" ) - - if what == "header": - if hasattr(root, "get_title"): - loc_label = get_symbol_parents(root, None, enable_choice=enable_choice) - loc_label += [root.get_title(), "..."] - else: - loc_label = ["Location"] - return "| {0:<40} <| {1}\n".format(header, " -> ".join(loc_label)) - - if what == "symbol": - parents = get_symbol_parents(symbol, root, enable_choice) - return "| {0:<40} <| {1}\n".format(get_label_func(symbol), - " -> ".join(parents)) - - message = "Invalid argument 'what': '%s'\n" % str(what) - message += "Allowed values are: 'layout', 'header' and 'symbol'" - raise Exception(message) - - def _format_symbol_virtual(self, what=None, symbol=None, root=None, - enable_choice=False, header=None, - get_label_func=lambda x: "?"): - def _symbol_is_legacy(symbol): - selects = [ s.get_name() for s in symbol.get_selected_symbols() ] - return ("BR2_LEGACY" in selects) - - def _get_parent_package(sym): - if self._is_real_package(sym): - return None - # Trim the symbol name from its last component (separated with - # underscores), until we either find a symbol which is a real - # package, or until we have no component (i.e. just 'BR2') - name = sym.get_name() - while name != "BR2": - name = name.rsplit("_", 1)[0] - s = self.config.get_symbol(name) - if s is None: - continue - if self._is_real_package(s): - return s - return None - - def _get_providers(symbol): - providers = list() - for sym in self.config: - if not sym.is_symbol(): - continue - if _symbol_is_legacy(sym): - continue - selects = sym.get_selected_symbols() - if not selects: - continue - for s in selects: - if s == symbol: - if sym.get_prompts(): - l = self._get_symbol_label(sym,False) - parent_pkg = _get_parent_package(sym) - if parent_pkg is not None: - l = self._get_symbol_label(parent_pkg, False) \ - + " (w/ " + l + ")" - providers.append(l) - else: - providers.extend(_get_providers(sym)) - return providers - - if what == "layout": - return ( "100%", "^1,4,4" ) - - if what == "header": - return "| {0:<20} <| {1:<32} <| Providers\n".format("Virtual packages", "Symbols") - - if what == "symbol": - pkg = re.sub(r"^BR2_PACKAGE_HAS_(.+)$", r"\1", symbol.get_name()) - providers = _get_providers(symbol) - - return "| {0:<20} <| {1:<32} <| {2}\n".format(pkg.lower(), - '+' + symbol.get_name() + '+', - ", ".join(providers)) - - message = "Invalid argument 'what': '%s'\n" % str(what) - message += "Allowed values are: 'layout', 'header' and 'symbol'" - raise Exception(message) - - - def print_list(self, list_type, enable_choice=True, enable_deprecated=True, - dry_run=False, output=None): - """ Print the requested list. If not dry run, then the list is - automatically written in its own file. - - :param list_type: The list type to be generated - :param enable_choice: Flag enabling choices to appear in the list - :param enable_deprecated: Flag enabling deprecated items to appear in - the package lists - :param dry_run: Dry run (print the list in stdout instead of - writing the list file - - """ - def _get_menu(title): - """ Return the first symbol menu matching the given title. - - """ - menus = self.config.get_menus() - menu = [m for m in menus if m.get_title().lower() == title.lower()] - if not menu: - message = "No such menu: '{0}'".format(title) - raise Exception(message) - return menu[0] - - list_config = self.list_info[list_type] - root_title = list_config.get('root_menu') - if root_title: - root_item = _get_menu(root_title) - else: - root_item = self.config - filter_ = getattr(self, list_config.get('filter')) - filter_func = lambda x: filter_(x) - format_func = getattr(self, list_config.get('format')) - if not enable_deprecated and list_type != "deprecated": - filter_func = lambda x: filter_(x) and not self._is_deprecated(x) - mark_depr = list_type != "deprecated" - get_label = lambda x: self._get_symbol_label(x, mark_depr) - item_label = "Features" if list_type == "deprecated" else "Packages" - - table = format_asciidoc_table(root_item, get_label, - filter_func=filter_func, - format_func=format_func, - enable_choice=enable_choice, - sorted=list_config.get('sorted'), - item_label=item_label) - - content = self.list_in.format(table=table) - - if dry_run: - print(content) - return - - if not output: - output_dir = self.output_dir - if not output_dir: - print("Warning: Undefined output directory.") - print("\tUse source directory as output location.") - output_dir = self.base_dir - output = os.path.join(output_dir, - list_config.get('filename') + ".txt") - if not os.path.exists(os.path.dirname(output)): - os.makedirs(os.path.dirname(output)) - print("Writing the {0} list in:\n\t{1}".format(list_type, output)) - with open(output, 'w') as fout: - fout.write(content) - - -if __name__ == '__main__': - list_types = ['target-packages', 'host-packages', 'virtual-packages', 'deprecated'] - parser = ArgumentParser() - parser.add_argument("list_type", nargs="?", choices=list_types, - help="""\ -Generate the given list (generate all lists if unspecified)""") - parser.add_argument("-n", "--dry-run", dest="dry_run", action='store_true', - help="Output the generated list to stdout") - parser.add_argument("--output-target", dest="output_target", - help="Output target package file") - parser.add_argument("--output-host", dest="output_host", - help="Output host package file") - parser.add_argument("--output-virtual", dest="output_virtual", - help="Output virtual package file") - parser.add_argument("--output-deprecated", dest="output_deprecated", - help="Output deprecated file") - args = parser.parse_args() - lists = [args.list_type] if args.list_type else list_types - buildroot = Buildroot() - for list_name in lists: - output = getattr(args, "output_" + list_name.split("-", 1)[0]) - buildroot.print_list(list_name, dry_run=args.dry_run, output=output) diff --git a/support/scripts/get-developers b/support/scripts/get-developers new file mode 100755 index 0000000000..40ed08ffe1 --- /dev/null +++ b/support/scripts/get-developers @@ -0,0 +1,83 @@ +#!/usr/bin/env python + +import argparse +import getdeveloperlib + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument('patches', metavar='P', type=argparse.FileType('r'), nargs='*', + help='list of patches (use - to read patches from stdin)') + parser.add_argument('-a', dest='architecture', action='store', + help='find developers in charge of this architecture') + parser.add_argument('-p', dest='package', action='store', + help='find developers in charge of this package') + parser.add_argument('-c', dest='check', action='store_const', + const=True, help='list files not handled by any developer') + return parser.parse_args() + +def __main__(): + devs = getdeveloperlib.parse_developers() + if devs is None: + sys.exit(1) + args = parse_args() + + # Check that only one action is given + action = 0 + if args.architecture is not None: + action += 1 + if args.package is not None: + action += 1 + if args.check: + action += 1 + if len(args.patches) != 0: + action += 1 + if action > 1: + print("Cannot do more than one action") + return + if action == 0: + print("No action specified") + return + + # Handle the check action + if args.check: + files = getdeveloperlib.check_developers(devs) + for f in files: + print(f) + + # Handle the architecture action + if args.architecture is not None: + for dev in devs: + if args.architecture in dev.architectures: + print(dev.name) + return + + # Handle the package action + if args.package is not None: + for dev in devs: + if args.package in dev.packages: + print(dev.name) + return + + # Handle the patches action + if len(args.patches) != 0: + (files, infras) = getdeveloperlib.analyze_patches(args.patches) + matching_devs = set() + for dev in devs: + # See if we have developers matching by package name + for f in files: + if dev.hasfile(f): + matching_devs.add(dev.name) + # See if we have developers matching by package infra + for i in infras: + if i in dev.infras: + matching_devs.add(dev.name) + + result = "--to buildroot@buildroot.org" + for dev in matching_devs: + result += " --cc \"%s\"" % dev + + if result != "": + print("git send-email %s" % result) + +__main__() + diff --git a/support/scripts/getdeveloperlib.py b/support/scripts/getdeveloperlib.py new file mode 100644 index 0000000000..65191073a3 --- /dev/null +++ b/support/scripts/getdeveloperlib.py @@ -0,0 +1,200 @@ +import sys +import os +import re +import argparse +import glob +import subprocess + +# +# Patch parsing functions +# + +FIND_INFRA_IN_PATCH = re.compile("^\+\$\(eval \$\((host-)?([^-]*)-package\)\)$") + +def analyze_patch(patch): + """Parse one patch and return the list of files modified, added or + removed by the patch.""" + files = set() + infras = set() + for line in patch: + # If the patch is adding a package, find which infra it is + m = FIND_INFRA_IN_PATCH.match(line) + if m: + infras.add(m.group(2)) + if not line.startswith("+++ "): + continue + line.strip() + fname = line[line.find("/") + 1 : ].strip() + if fname == "dev/null": + continue + files.add(fname) + return (files, infras) + +FIND_INFRA_IN_MK = re.compile("^\$\(eval \$\((host-)?([^-]*)-package\)\)$") + +def fname_get_package_infra(fname): + """Checks whether the file name passed as argument is a Buildroot .mk + file describing a package, and find the infrastructure it's using.""" + if not fname.endswith(".mk"): + return None + + if not os.path.exists(fname): + return None + + with open(fname, "r") as f: + for l in f: + l = l.strip() + m = FIND_INFRA_IN_MK.match(l) + if m: + return m.group(2) + return None + +def get_infras(files): + """Search in the list of files for .mk files, and collect the package + infrastructures used by those .mk files.""" + infras = set() + for fname in files: + infra = fname_get_package_infra(fname) + if infra: + infras.add(infra) + return infras + +def analyze_patches(patches): + """Parse a list of patches and returns the list of files modified, + added or removed by the patches, as well as the list of package + infrastructures used by those patches (if any)""" + allfiles = set() + allinfras = set() + for patch in patches: + (files, infras) = analyze_patch(patch) + allfiles = allfiles | files + allinfras = allinfras | infras + allinfras = allinfras | get_infras(allfiles) + return (allfiles, allinfras) + +# +# DEVELOPERS file parsing functions +# + +class Developer: + def __init__(self, name, files): + self.name = name + self.files = files + self.packages = parse_developer_packages(files) + self.architectures = parse_developer_architectures(files) + self.infras = parse_developer_infras(files) + + def hasfile(self, f): + f = os.path.abspath(f) + for fs in self.files: + if f.startswith(fs): + return True + return False + +def parse_developer_packages(fnames): + """Given a list of file patterns, travel through the Buildroot source + tree to find which packages are implemented by those file + patterns, and return a list of those packages.""" + packages = set() + for fname in fnames: + for root, dirs, files in os.walk(fname): + for f in files: + path = os.path.join(root, f) + if fname_get_package_infra(path): + pkg = os.path.splitext(f)[0] + packages.add(pkg) + return packages + +def parse_arches_from_config_in(fname): + """Given a path to an arch/Config.in.* file, parse it to get the list + of BR2_ARCH values for this architecture.""" + arches = set() + with open(fname, "r") as f: + parsing_arches = False + for l in f: + l = l.strip() + if l == "config BR2_ARCH": + parsing_arches = True + continue + if parsing_arches: + m = re.match("^\s*default \"([^\"]*)\".*", l) + if m: + arches.add(m.group(1)) + else: + parsing_arches = False + return arches + +def parse_developer_architectures(fnames): + """Given a list of file names, find the ones starting by + 'arch/Config.in.', and use that to determine the architecture a + developer is working on.""" + arches = set() + for fname in fnames: + if not re.match("^.*/arch/Config\.in\..*$", fname): + continue + arches = arches | parse_arches_from_config_in(fname) + return arches + +def parse_developer_infras(fnames): + infras = set() + for fname in fnames: + m = re.match("^package/pkg-([^.]*).mk$", fname) + if m: + infras.add(m.group(1)) + return infras + +def parse_developers(basepath=None): + """Parse the DEVELOPERS file and return a list of Developer objects.""" + developers = [] + linen = 0 + if basepath == None: + basepath = os.getcwd() + with open(os.path.join(basepath, "DEVELOPERS"), "r") as f: + files = [] + name = None + for l in f: + l = l.strip() + if l.startswith("#"): + continue + elif l.startswith("N:"): + if name is not None or len(files) != 0: + print("Syntax error in DEVELOPERS file, line %d" % linen) + name = l[2:].strip() + elif l.startswith("F:"): + fname = l[2:].strip() + dev_files = glob.glob(os.path.join(basepath, fname)) + if len(dev_files) == 0: + print("WARNING: '%s' doesn't match any file" % fname) + files += dev_files + elif l == "": + if not name: + continue + developers.append(Developer(name, files)) + files = [] + name = None + else: + print("Syntax error in DEVELOPERS file, line %d: '%s'" % (linen, l)) + return None + linen += 1 + # handle last developer + if name is not None: + developers.append(Developer(name, files)) + return developers + +def check_developers(developers, basepath=None): + """Look at the list of files versioned in Buildroot, and returns the + list of files that are not handled by any developer""" + if basepath == None: + basepath = os.getcwd() + cmd = ["git", "--git-dir", os.path.join(basepath, ".git"), "ls-files"] + files = subprocess.check_output(cmd).strip().split("\n") + unhandled_files = [] + for f in files: + handled = False + for d in developers: + if d.hasfile(os.path.join(basepath, f)): + handled = True + break + if not handled: + unhandled_files.append(f) + return unhandled_files diff --git a/support/scripts/graph-build-time b/support/scripts/graph-build-time index 7eb3e47953..0ba0f2d3a7 100755 --- a/support/scripts/graph-build-time +++ b/support/scripts/graph-build-time @@ -276,7 +276,7 @@ parser.add_argument("--order", '-O', metavar="GRAPH_ORDER", help="Ordering of packages: build or duration (for histogram only)") parser.add_argument("--alternate-colors", '-c', action="store_true", help="Use alternate colour-scheme") -parser.add_argument("--input", '-i', metavar="OUTPUT", +parser.add_argument("--input", '-i', metavar="INPUT", help="Input file (usually $(O)/build/build-time.log)") parser.add_argument("--output", '-o', metavar="OUTPUT", required=True, help="Output file (.pdf or .png extension)") diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends index a00eb9d47b..fbd5917053 100755 --- a/support/scripts/graph-depends +++ b/support/scripts/graph-depends @@ -26,6 +26,8 @@ import subprocess import argparse from fnmatch import fnmatch +import pkgutil + # Modes of operation: MODE_FULL = 1 # draw full dependency graph for all selected packages MODE_PKG = 2 # draw dependency graph for a given package @@ -63,6 +65,10 @@ parser.add_argument("--transitive", dest="transitive", action='store_true', default=False) parser.add_argument("--no-transitive", dest="transitive", action='store_false', help="Draw (do not draw) transitive dependencies") +parser.add_argument("--direct", dest="direct", action='store_true', default=True, + help="Draw direct dependencies (the default)") +parser.add_argument("--reverse", dest="direct", action='store_false', + help="Draw reverse dependencies") args = parser.parse_args() check_only = args.check_only @@ -73,7 +79,7 @@ else: if check_only: sys.stderr.write("don't specify outfile and check-only at the same time\n") sys.exit(1) - outfile = open(args.outfile, "wb") + outfile = open(args.outfile, "w") if args.package is None: mode = MODE_FULL @@ -95,6 +101,16 @@ else: transitive = args.transitive +if args.direct: + get_depends_func = pkgutil.get_depends + arrow_dir = "forward" +else: + if mode == MODE_FULL: + sys.stderr.write("--reverse needs a package\n") + sys.exit(1) + get_depends_func = pkgutil.get_rdepends + arrow_dir = "back" + # Get the colours: we need exactly three colours, # so no need not split more than 4 # We'll let 'dot' validate the colours... @@ -108,28 +124,6 @@ host_colour = colours[2] allpkgs = [] -# Execute the "make -show-version" command to get the version of a given -# list of packages, and return the version formatted as a Python dictionary. -def get_version(pkgs): - sys.stderr.write("Getting version for %s\n" % pkgs) - cmd = ["make", "-s", "--no-print-directory" ] - for pkg in pkgs: - cmd.append("%s-show-version" % pkg) - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) - output = p.communicate()[0] - if p.returncode != 0: - sys.stderr.write("Error getting version %s\n" % pkgs) - sys.exit(1) - output = output.split("\n") - if len(output) != len(pkgs) + 1: - sys.stderr.write("Error getting version\n") - sys.exit(1) - version = {} - for i in range(0, len(pkgs)): - pkg = pkgs[i] - version[pkg] = output[i] - return version - # Execute the "make show-targets" command to get the list of the main # Buildroot PACKAGES and return it formatted as a Python list. This # list is used as the starting point for full dependency graphs @@ -144,33 +138,6 @@ def get_targets(): return [] return output.split(' ') -# Execute the "make -show-depends" command to get the list of -# dependencies of a given list of packages, and return the list of -# dependencies formatted as a Python dictionary. -def get_depends(pkgs): - sys.stderr.write("Getting dependencies for %s\n" % pkgs) - cmd = ["make", "-s", "--no-print-directory" ] - for pkg in pkgs: - cmd.append("%s-show-depends" % pkg) - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) - output = p.communicate()[0] - if p.returncode != 0: - sys.stderr.write("Error getting dependencies %s\n" % pkgs) - sys.exit(1) - output = output.split("\n") - if len(output) != len(pkgs) + 1: - sys.stderr.write("Error getting dependencies\n") - sys.exit(1) - deps = {} - for i in range(0, len(pkgs)): - pkg = pkgs[i] - pkg_deps = output[i].split(" ") - if pkg_deps == ['']: - deps[pkg] = [] - else: - deps[pkg] = pkg_deps - return deps - # Recursive function that builds the tree of dependencies for a given # list of packages. The dependencies are built in a list called # 'dependencies', which contains tuples of the form (pkg1 -> @@ -190,7 +157,7 @@ def get_all_depends(pkgs): if len(filtered_pkgs) == 0: return [] - depends = get_depends(filtered_pkgs) + depends = get_depends_func(filtered_pkgs) deps = set() for pkg in filtered_pkgs: @@ -363,7 +330,7 @@ if check_only: sys.exit(0) dict_deps = remove_extra_deps(dict_deps) -dict_version = get_version([pkg for pkg in allpkgs +dict_version = pkgutil.get_version([pkg for pkg in allpkgs if pkg != "all" and not pkg.startswith("root")]) # Print the attributes of a node: label and fill-color @@ -418,7 +385,7 @@ def print_pkg_deps(depth, pkg): add = False break if add: - outfile.write("%s -> %s\n" % (pkg_node_name(pkg), pkg_node_name(d))) + outfile.write("%s -> %s [dir=%s]\n" % (pkg_node_name(pkg), pkg_node_name(d), arrow_dir)) print_pkg_deps(depth+1, d) # Start printing the graph data diff --git a/support/scripts/hardlink-or-copy b/support/scripts/hardlink-or-copy new file mode 100755 index 0000000000..b046bdf059 --- /dev/null +++ b/support/scripts/hardlink-or-copy @@ -0,0 +1,35 @@ +#!/bin/bash + +# Try to hardlink a file into a directory, fallback to copy on failure. +# +# Hardlink-or-copy the source file in the first argument into the +# destination directory in the second argument, using the basename in +# the third argument as basename for the destination file. If the third +# argument is missing, use the basename of the source file as basename +# for the destination file. +# +# In either case, remove the destination prior to doing the +# hardlink-or-copy. +# +# Note that this is NOT an atomic operation. + +set -e + +main() { + local src_file="${1}" + local dst_dir="${2}" + local dst_file="${3}" + + if [ -n "${dst_file}" ]; then + dst_file="${dst_dir}/${dst_file}" + else + dst_file="${dst_dir}/${src_file##*/}" + fi + + mkdir -p "${dst_dir}" + rm -f "${dst_file}" + ln -f "${src_file}" "${dst_file}" 2>/dev/null \ + || cp -f "${src_file}" "${dst_file}" +} + +main "${@}" diff --git a/support/scripts/kconfiglib.py b/support/scripts/kconfiglib.py deleted file mode 100644 index 0a688b54c8..0000000000 --- a/support/scripts/kconfiglib.py +++ /dev/null @@ -1,3541 +0,0 @@ -# This is Kconfiglib, a Python library for scripting, debugging, and extracting -# information from Kconfig-based configuration systems. To view the -# documentation, run -# -# $ pydoc kconfiglib -# -# or, if you prefer HTML, -# -# $ pydoc -w kconfiglib -# -# The examples/ subdirectory contains examples, to be run with e.g. -# -# $ make scriptconfig SCRIPT=Kconfiglib/examples/print_tree.py -# -# Look in testsuite.py for the test suite. - -""" -Kconfiglib is a Python library for scripting and extracting information from -Kconfig-based configuration systems. Features include the following: - - - Symbol values and properties can be looked up and values assigned - programmatically. - - .config files can be read and written. - - Expressions can be evaluated in the context of a Kconfig configuration. - - Relations between symbols can be quickly determined, such as finding all - symbols that reference a particular symbol. - - Highly compatible with the scripts/kconfig/*conf utilities. The test suite - automatically compares outputs between Kconfiglib and the C implementation - for a large number of cases. - -For the Linux kernel, scripts are run using - - $ make scriptconfig [ARCH=] SCRIPT= [SCRIPT_ARG=] - -Using the 'scriptconfig' target ensures that required environment variables -(SRCARCH, ARCH, srctree, KERNELVERSION, etc.) are set up correctly. - -Scripts receive the name of the Kconfig file to load in sys.argv[1]. As of -Linux 4.1.0-rc5, this is always "Kconfig" from the kernel top-level directory. -If an argument is provided with SCRIPT_ARG, it appears as sys.argv[2]. - -To get an interactive Python prompt with Kconfiglib preloaded and a Config -object 'c' created, run - - $ make iscriptconfig [ARCH=] - -Kconfiglib currently uses Python 2. For (i)scriptconfig, the Python interpreter -to use can be passed in PYTHONCMD. It defaults to 'python', but PyPy works too -and might be faster for long-running jobs. - -The examples/ directory contains short example scripts, which can be run with -e.g. - - $ make scriptconfig SCRIPT=Kconfiglib/examples/print_tree.py - -or - - $ make scriptconfig SCRIPT=Kconfiglib/examples/help_grep.py SCRIPT_ARG=kernel - -testsuite.py contains the test suite. See the top of the script for how to run -it. - -Credits: Written by Ulf "Ulfalizer" Magnusson - -Send bug reports, suggestions and other feedback to ulfalizer a.t Google's -email service. Don't wrestle with internal APIs. Tell me what you need and I -might add it in a safe way as a client API instead.""" - -import os -import re -import sys - -# File layout: -# -# Public classes -# Public functions -# Internal classes -# Internal functions -# Internal global constants - -# -# Public classes -# - -class Config(object): - - """Represents a Kconfig configuration, e.g. for i386 or ARM. This is the - set of symbols and other items appearing in the configuration together with - their values. Creating any number of Config objects -- including for - different architectures -- is safe; Kconfiglib has no global state.""" - - # - # Public interface - # - - def __init__(self, filename = "Kconfig", base_dir = None, - print_warnings = True, print_undef_assign = False): - """Creates a new Config object, representing a Kconfig configuration. - Raises Kconfig_Syntax_Error on syntax errors. - - filename (default: "Kconfig") -- The base Kconfig file of the - configuration. For the Linux kernel, you'll probably want - "Kconfig" from the top-level directory, as environment - variables will make sure the right Kconfig is included from - there (arch//Kconfig). If you are using - kconfiglib via 'make scriptconfig', the filename of the base - base Kconfig file will be in sys.argv[1]. - - base_dir (default: None) -- The base directory relative to which - 'source' statements within Kconfig files will work. For the - Linux kernel this should be the top-level directory of the - kernel tree. $-references to existing environment variables - will be expanded. - - If None (the default), the environment variable 'srctree' will - be used if set, and the current directory otherwise. 'srctree' - is set by the Linux makefiles to the top-level kernel - directory. A default of "." would not work with an alternative - build directory. - - print_warnings (default: True) -- Set to True if warnings related to - this configuration should be printed to stderr. This can - be changed later with Config.set_print_warnings(). It is - provided as a constructor argument since warnings might - be generated during parsing. - - print_undef_assign (default: False) -- Set to True if informational - messages related to assignments to undefined symbols - should be printed to stderr for this configuration. - Can be changed later with - Config.set_print_undef_assign().""" - - # The set of all symbols, indexed by name (a string) - self.syms = {} - - # Python 2/3 compatibility hack. This is the only one needed. - if sys.version_info[0] >= 3: - self.syms_iter = self.syms.values - else: - self.syms_iter = self.syms.itervalues - - # The set of all defined symbols in the configuration in the order they - # appear in the Kconfig files. This excludes the special symbols n, m, - # and y as well as symbols that are referenced but never defined. - self.kconfig_syms = [] - - # The set of all named choices (yes, choices can have names), indexed - # by name (a string) - self.named_choices = {} - - def register_special_symbol(type_, name, val): - sym = Symbol() - sym.is_special_ = True - sym.is_defined_ = True - sym.config = self - sym.name = name - sym.type = type_ - sym.cached_val = val - self.syms[name] = sym - return sym - - # The special symbols n, m and y, used as shorthand for "n", "m" and - # "y" - self.n = register_special_symbol(TRISTATE, "n", "n") - self.m = register_special_symbol(TRISTATE, "m", "m") - self.y = register_special_symbol(TRISTATE, "y", "y") - - # DEFCONFIG_LIST uses this - register_special_symbol(STRING, "UNAME_RELEASE", os.uname()[2]) - - # The symbol with "option defconfig_list" set, containing a list of - # default .config files - self.defconfig_sym = None - - # See Symbol.get_(src)arch() - self.arch = os.environ.get("ARCH") - self.srcarch = os.environ.get("SRCARCH") - - # See Config.__init__(). We need this for get_defconfig_filename(). - self.srctree = os.environ.get("srctree") - if self.srctree is None: - self.srctree = "." - - self.filename = filename - if base_dir is None: - self.base_dir = self.srctree - else: - self.base_dir = os.path.expandvars(base_dir) - - # The 'mainmenu' text - self.mainmenu_text = None - - # The filename of the most recently loaded .config file - self.config_filename = None - - # The textual header of the most recently loaded .config, uncommented - self.config_header = None - - self.print_warnings = print_warnings - self.print_undef_assign = print_undef_assign - - # Lists containing all choices, menus and comments in the configuration - - self.choices = [] - self.menus = [] - self.comments = [] - - # For parsing routines that stop when finding a line belonging to a - # different construct, these holds that line and the tokenized version - # of that line. The purpose is to avoid having to re-tokenize the line, - # which is inefficient and causes problems when recording references to - # symbols. - self.end_line = None - self.end_line_tokens = None - - # See the comment in _parse_expr(). - self.parse_expr_cur_sym_or_choice = None - self.parse_expr_line = None - self.parse_expr_filename = None - self.parse_expr_linenr = None - self.parse_expr_transform_m = None - - # Parse the Kconfig files - self.top_block = self._parse_file(filename, None, None, None) - - # Build Symbol.dep for all symbols - self._build_dep() - - def load_config(self, filename, replace = True): - """Loads symbol values from a file in the familiar .config format. - Equivalent to calling Symbol.set_user_value() to set each of the - values. - - "# CONFIG_FOO is not set" within a .config file is treated specially - and sets the user value of FOO to 'n'. The C implementation works - the same way. - - filename -- The .config file to load. $-references to environment - variables will be expanded. For scripts to work even - when an alternative build directory is used with the - Linux kernel, you need to refer to the top-level kernel - directory with "$srctree". - - replace (default: True) -- True if the configuration should replace - the old configuration; False if it should add to it.""" - - # Put this first so that a missing file doesn't screw up our state - filename = os.path.expandvars(filename) - line_feeder = _FileFeed(filename) - - self.config_filename = filename - - # - # Read header - # - - def is_header_line(line): - return line is not None and line.startswith("#") and \ - not _unset_re_match(line) - - self.config_header = None - - line = line_feeder.peek_next() - if is_header_line(line): - self.config_header = "" - while is_header_line(line_feeder.peek_next()): - self.config_header += line_feeder.get_next()[1:] - # Remove trailing newline - if self.config_header.endswith("\n"): - self.config_header = self.config_header[:-1] - - # - # Read assignments. Hotspot for some workloads. - # - - def warn_override(filename, linenr, name, old_user_val, new_user_val): - self._warn('overriding the value of {0}. ' - 'Old value: "{1}", new value: "{2}".' - .format(name, old_user_val, new_user_val), - filename, linenr) - - # Invalidate everything to keep things simple. It might be possible to - # improve performance for the case where multiple configurations are - # loaded by only invalidating a symbol (and its dependent symbols) if - # the new user value differs from the old. One complication would be - # that symbols not mentioned in the .config must lose their user value - # when replace = True, which is the usual case. - if replace: - self.unset_user_values() - else: - self._invalidate_all() - - while 1: - line = line_feeder.get_next() - if line is None: - return - - line = line.rstrip() - - set_match = _set_re_match(line) - if set_match: - name, val = set_match.groups() - - if val.startswith(('"', "'")): - if len(val) < 2 or val[-1] != val[0]: - _parse_error(line, "malformed string literal", - line_feeder.get_filename(), - line_feeder.get_linenr()) - # Strip quotes and remove escapings. The unescaping - # producedure should be safe since " can only appear as \" - # inside the string. - val = val[1:-1].replace('\\"', '"').replace("\\\\", "\\") - - if name in self.syms: - sym = self.syms[name] - if sym.user_val is not None: - warn_override(line_feeder.get_filename(), - line_feeder.get_linenr(), - name, sym.user_val, val) - - if sym.is_choice_symbol_: - user_mode = sym.parent.user_mode - if user_mode is not None and user_mode != val: - self._warn("assignment to {0} changes mode of containing " - 'choice from "{1}" to "{2}".' - .format(name, val, user_mode), - line_feeder.get_filename(), - line_feeder.get_linenr()) - - sym._set_user_value_no_invalidate(val, True) - else: - if self.print_undef_assign: - _stderr_msg('note: attempt to assign the value "{0}" to the ' - "undefined symbol {1}.".format(val, name), - line_feeder.get_filename(), - line_feeder.get_linenr()) - else: - unset_match = _unset_re_match(line) - if unset_match: - name = unset_match.group(1) - if name in self.syms: - sym = self.syms[name] - if sym.user_val is not None: - warn_override(line_feeder.get_filename(), - line_feeder.get_linenr(), - name, sym.user_val, "n") - - sym._set_user_value_no_invalidate("n", True) - - def write_config(self, filename, header = None): - """Writes out symbol values in the familiar .config format. - - Kconfiglib makes sure the format matches what the C implementation - would generate, down to whitespace. This eases testing. - - filename -- The filename under which to save the configuration. - - header (default: None) -- A textual header that will appear at the - beginning of the file, with each line commented out - automatically. None means no header.""" - - # already_written is set when _make_conf() is called on a symbol, so - # that symbols defined in multiple locations only get one entry in the - # .config. We need to reset it prior to writing out a new .config. - for sym in self.syms_iter(): - sym.already_written = False - - with open(filename, "w") as f: - # Write header - if header is not None: - f.write(_comment(header)) - f.write("\n") - - # Write configuration. - - # Passing a list around to all the nodes and appending to it to - # avoid copying was surprisingly a lot slower with PyPy, and about - # as fast with Python. Passing the file around was slower too. Been - # a while since I last measured though. - - f.write("\n".join(_make_block_conf(self.top_block))) - f.write("\n") - - def get_kconfig_filename(self): - """Returns the name of the (base) kconfig file this configuration was - loaded from.""" - return self.filename - - def get_arch(self): - """Returns the value the environment variable ARCH had at the time the - Config instance was created, or None if ARCH was not set. For the - kernel, this corresponds to the architecture being built for, with - values such as "i386" or "mips".""" - return self.arch - - def get_srcarch(self): - """Returns the value the environment variable SRCARCH had at the time - the Config instance was created, or None if SRCARCH was not set. For - the kernel, this corresponds to the particular arch/ subdirectory - containing architecture-specific code.""" - return self.srcarch - - def get_srctree(self): - """Returns the value the environment variable srctree had at the time - the Config instance was created, or None if srctree was not defined. - This variable points to the source directory and is used when building - in a separate directory.""" - return self.srctree - - def get_config_filename(self): - """Returns the filename of the most recently loaded configuration file, - or None if no configuration has been loaded.""" - return self.config_filename - - def get_mainmenu_text(self): - """Returns the text of the 'mainmenu' statement (with $-references to - symbols replaced by symbol values), or None if the configuration has no - 'mainmenu' statement.""" - return None if self.mainmenu_text is None else \ - self._expand_sym_refs(self.mainmenu_text) - - def get_defconfig_filename(self): - """Returns the name of the defconfig file, which is the first existing - file in the list given in a symbol having 'option defconfig_list' set. - $-references to symbols will be expanded ("$FOO bar" -> "foo bar" if - FOO has the value "foo"). Returns None in case of no defconfig file. - Setting 'option defconfig_list' on multiple symbols currently results - in undefined behavior. - - If the environment variable 'srctree' was set when the Config was - created, get_defconfig_filename() will first look relative to that - directory before looking in the current directory; see - Config.__init__(). - - WARNING: A wart here is that scripts/kconfig/Makefile sometimes uses the - --defconfig= option when calling the C implementation of e.g. - 'make defconfig'. This option overrides the 'option defconfig_list' - symbol, meaning the result from get_defconfig_filename() might not - match what 'make defconfig' would use. That probably ought to be worked - around somehow, so that this function always gives the "expected" - result.""" - if self.defconfig_sym is None: - return None - for filename, cond_expr in self.defconfig_sym.def_exprs: - if self._eval_expr(cond_expr) == "y": - filename = self._expand_sym_refs(filename) - # We first look in $srctree. os.path.join() won't work here as - # an absolute path in filename would override $srctree. - srctree_filename = os.path.normpath(self.srctree + "/" + filename) - if os.path.exists(srctree_filename): - return srctree_filename - if os.path.exists(filename): - return filename - return None - - def get_symbol(self, name): - """Returns the symbol with name 'name', or None if no such symbol - appears in the configuration. An alternative shorthand is conf[name], - where conf is a Config instance, though that will instead raise - KeyError if the symbol does not exist.""" - return self.syms.get(name) - - def get_top_level_items(self): - """Returns a list containing the items (symbols, menus, choice - statements and comments) at the top level of the configuration -- that - is, all items that do not appear within a menu or choice. The items - appear in the same order as within the configuration.""" - return self.top_block - - def get_symbols(self, all_symbols = True): - """Returns a list of symbols from the configuration. An alternative for - iterating over all defined symbols (in the order of definition) is - - for sym in config: - ... - - which relies on Config implementing __iter__() and is equivalent to - - for sym in config.get_symbols(False): - ... - - all_symbols (default: True) -- If True, all symbols -- including special - and undefined symbols -- will be included in the result, in - an undefined order. If False, only symbols actually defined - and not merely referred to in the configuration will be - included in the result, and will appear in the order that - they are defined within the Kconfig configuration files.""" - return self.syms.values() if all_symbols else self.kconfig_syms - - def get_choices(self): - """Returns a list containing all choice statements in the - configuration, in the order they appear in the Kconfig files.""" - return self.choices - - def get_menus(self): - """Returns a list containing all menus in the configuration, in the - order they appear in the Kconfig files.""" - return self.menus - - def get_comments(self): - """Returns a list containing all comments in the configuration, in the - order they appear in the Kconfig files.""" - return self.comments - - def eval(self, s): - """Returns the value of the expression 's' -- where 's' is represented - as a string -- in the context of the configuration. Raises - Kconfig_Syntax_Error if syntax errors are detected in 's'. - - For example, if FOO and BAR are tristate symbols at least one of which - has the value "y", then config.eval("y && (FOO || BAR)") => "y" - - This function always yields a tristate value. To get the value of - non-bool, non-tristate symbols, use Symbol.get_value(). - - The result of this function is consistent with how evaluation works for - conditional expressions in the configuration as well as in the C - implementation. "m" and m are rewritten as '"m" && MODULES' and 'm && - MODULES', respectively, and a result of "m" will get promoted to "y" if - we're running without modules. - - Syntax checking is somewhat lax, partly to be compatible with lax - parsing in the C implementation.""" - return self._eval_expr(self._parse_expr(self._tokenize(s, True), # Feed - None, # Current symbol or choice - s)) # line - - def get_config_header(self): - """Returns the (uncommented) textual header of the .config file most - recently loaded with load_config(). Returns None if no .config file has - been loaded or if the most recently loaded .config file has no header. - The header comprises all lines up to but not including the first line - that either - - 1. Does not start with "#" - 2. Has the form "# CONFIG_FOO is not set." - """ - return self.config_header - - def get_base_dir(self): - """Returns the base directory relative to which 'source' statements - will work, passed as an argument to Config.__init__().""" - return self.base_dir - - def set_print_warnings(self, print_warnings): - """Determines whether warnings related to this configuration (for - things like attempting to assign illegal values to symbols with - Symbol.set_user_value()) should be printed to stderr. - - print_warnings -- True if warnings should be printed.""" - self.print_warnings = print_warnings - - def set_print_undef_assign(self, print_undef_assign): - """Determines whether informational messages related to assignments to - undefined symbols should be printed to stderr for this configuration. - - print_undef_assign -- If True, such messages will be printed.""" - self.print_undef_assign = print_undef_assign - - def __getitem__(self, key): - """Returns the symbol with name 'name'. Raises KeyError if the symbol - does not appear in the configuration.""" - return self.syms[key] - - def __iter__(self): - """Convenience function for iterating over the set of all defined - symbols in the configuration, used like - - for sym in conf: - ... - - The iteration happens in the order of definition within the Kconfig - configuration files. Symbols only referred to but not defined will not - be included, nor will the special symbols n, m, and y. If you want to - include such symbols as well, see config.get_symbols().""" - return iter(self.kconfig_syms) - - def unset_user_values(self): - """Resets the values of all symbols, as if Config.load_config() or - Symbol.set_user_value() had never been called.""" - for sym in self.syms_iter(): - sym._unset_user_value_no_recursive_invalidate() - - def __str__(self): - """Returns a string containing various information about the Config.""" - return _sep_lines("Configuration", - "File : " + self.filename, - "Base directory : " + self.base_dir, - "Value of $ARCH at creation time : " + - ("(not set)" if self.arch is None else self.arch), - "Value of $SRCARCH at creation time : " + - ("(not set)" if self.srcarch is None else self.srcarch), - "Source tree (derived from $srctree;", - "defaults to '.' if $srctree isn't set) : " + self.srctree, - "Most recently loaded .config : " + - ("(no .config loaded)" if self.config_filename is None else - self.config_filename), - "Print warnings : " + - bool_str[self.print_warnings], - "Print assignments to undefined symbols : " + - bool_str[self.print_undef_assign]) - - # - # Private methods - # - - def _invalidate_all(self): - for sym in self.syms_iter(): - sym._invalidate() - - def _tokenize(self, s, for_eval = False, filename = None, linenr = None): - """Returns a _Feed instance containing tokens derived from the string - 's'. Registers any new symbols encountered (via _sym_lookup()). - - (I experimented with a pure regular expression implementation, but it - came out slower, less readable, and wouldn't have been as flexible.) - - for_eval -- True when parsing an expression for a call to - Config.eval(), in which case we should not treat the first - token specially nor register new symbols.""" - - # lstrip() would work here too, but removing the '\n' at the end leads - # to earlier termination in the 'while' loop below, saving lots of - # calls - s = s.strip() - if s == "" or s[0] == "#": - return _Feed([]) - - if for_eval: - i = 0 # The current index in the string being tokenized - previous = None # The previous token seen - tokens = [] - else: - # The initial word on a line is parsed specially. Let - # command_chars = [A-Za-z0-9_]. Then - # - leading non-command_chars characters on the line are ignored, and - # - the first token consists the following one or more command_chars - # characters. - # This is why things like "----help--" are accepted. - - initial_token_match = _initial_token_re_match(s) - if initial_token_match is None: - return _Feed([]) - # The current index in the string being tokenized - i = initial_token_match.end() - - keyword = _get_keyword(initial_token_match.group(1)) - if keyword is None: - # We expect a keyword as the first token - _tokenization_error(s, filename, linenr) - if keyword == T_HELP: - # Avoid junk after "help", e.g. "---", being registered as a - # symbol - return _Feed([T_HELP]) - tokens = [keyword] - previous = keyword - - # _tokenize() is a hotspot during parsing, and this speeds things up a - # bit - strlen = len(s) - append = tokens.append - - # Main tokenization loop. (Handles tokens past the first one.) - while i < strlen: - # Test for an identifier/keyword preceded by whitespace first; this - # is the most common case. - id_keyword_match = _id_keyword_re_match(s, i) - if id_keyword_match: - # We have an identifier or keyword. The above also stripped any - # whitespace for us. - name = id_keyword_match.group(1) - # Jump past it - i = id_keyword_match.end() - - # Keyword? - keyword = _get_keyword(name) - if keyword is not None: - append(keyword) - # What would ordinarily be considered a name is treated as a - # string after certain tokens. - elif previous in string_lex: - append(name) - else: - # We're dealing with a symbol. _sym_lookup() will take care - # of allocating a new Symbol instance if it's the first - # time we see it. - sym = self._sym_lookup(name, not for_eval) - - if previous == T_CONFIG or previous == T_MENUCONFIG: - # If the previous token is T_(MENU)CONFIG - # ("(menu)config"), we're tokenizing the first line of - # a symbol definition, and should remember this as a - # location where the symbol is defined. - sym.def_locations.append((filename, linenr)) - else: - # Otherwise, it's a reference to the symbol - sym.ref_locations.append((filename, linenr)) - - append(sym) - - else: - # This restrips whitespace that could have been stripped in the - # regex above, but it's worth it since identifiers/keywords are - # more common - s = s[i:].lstrip() - if s == "": - break - c = s[0] - i = 1 - - # String literal (constant symbol) - if c == '"' or c == "'": - if "\\" in s: - # Slow path: This could probably be sped up, but it's a - # very unusual case anyway. - quote = c - val = "" - while 1: - if i >= len(s): - _tokenization_error(s, filename, linenr) - c = s[i] - if c == quote: - break - if c == "\\": - if i + 1 >= len(s): - _tokenization_error(s, filename, linenr) - val += s[i + 1] - i += 2 - else: - val += c - i += 1 - i += 1 - append(val) - else: - # Fast path: If the string contains no backslashes (almost - # always) we can simply look for the matching quote. - end = s.find(c, i) - if end == -1: - _tokenization_error(s, filename, linenr) - append(s[i:end]) - i = end + 1 - - elif c == "&": - # Invalid characters are ignored - if i >= len(s) or s[i] != "&": continue - append(T_AND) - i += 1 - - elif c == "|": - # Invalid characters are ignored - if i >= len(s) or s[i] != "|": continue - append(T_OR) - i += 1 - - elif c == "!": - if i < len(s) and s[i] == "=": - append(T_UNEQUAL) - i += 1 - else: - append(T_NOT) - - elif c == "=": append(T_EQUAL) - elif c == "(": append(T_OPEN_PAREN) - elif c == ")": append(T_CLOSE_PAREN) - elif c == "#": break # Comment - - else: continue # Invalid characters are ignored - - previous = tokens[-1] - - return _Feed(tokens) - - # - # Parsing - # - - # Expression grammar: - # - # -> - # '=' - # '!=' - # '(' ')' - # '!' - # '&&' - # '||' - - def _parse_expr(self, feed, cur_sym_or_choice, line, filename = None, - linenr = None, transform_m = True): - """Parse an expression from the tokens in 'feed' using a simple - top-down approach. The result has the form (, ). - - feed -- _Feed instance containing the tokens for the expression. - - cur_sym_or_choice -- The symbol or choice currently being parsed, or - None if we're not parsing a symbol or choice. - Used for recording references to symbols. - - line -- The line containing the expression being parsed. - - filename (default: None) -- The file containing the expression. - - linenr (default: None) -- The line number containing the expression. - - transform_m (default: False) -- Determines if 'm' should be rewritten to - 'm && MODULES' -- see - parse_val_and_cond().""" - - # Use instance variables to avoid having to pass these as arguments - # through the top-down parser in _parse_expr_2(), which is tedious and - # obfuscates the code. A profiler run shows no noticeable performance - # difference. - self.parse_expr_cur_sym_or_choice = cur_sym_or_choice - self.parse_expr_line = line - self.parse_expr_filename = filename - self.parse_expr_linenr = linenr - self.parse_expr_transform_m = transform_m - - return self._parse_expr_2(feed) - - def _parse_expr_2(self, feed): - or_terms = [self._parse_or_term(feed)] - # Keep parsing additional terms while the lookahead is '||' - while feed.check(T_OR): - or_terms.append(self._parse_or_term(feed)) - return or_terms[0] if len(or_terms) == 1 else (OR, or_terms) - - def _parse_or_term(self, feed): - and_terms = [self._parse_factor(feed)] - # Keep parsing additional terms while the lookahead is '&&' - while feed.check(T_AND): - and_terms.append(self._parse_factor(feed)) - return and_terms[0] if len(and_terms) == 1 else (AND, and_terms) - - def _parse_factor(self, feed): - if feed.check(T_OPEN_PAREN): - expr_parse = self._parse_expr_2(feed) - - if not feed.check(T_CLOSE_PAREN): - _parse_error(self.parse_expr_line, - "missing end parenthesis.", - self.parse_expr_filename, - self.parse_expr_linenr) - - return expr_parse - - if feed.check(T_NOT): - return (NOT, self._parse_factor(feed)) - - sym_or_string = feed.get_next() - - if not isinstance(sym_or_string, (Symbol, str)): - _parse_error(self.parse_expr_line, - "malformed expression.", - self.parse_expr_filename, - self.parse_expr_linenr) - - if self.parse_expr_cur_sym_or_choice is not None and \ - isinstance(sym_or_string, Symbol): - self.parse_expr_cur_sym_or_choice.referenced_syms.add(sym_or_string) - - next_token = feed.peek_next() - - # For conditional expressions ('depends on ', '... if ', - # etc.), "m" and m are rewritten to "m" && MODULES. - if next_token != T_EQUAL and next_token != T_UNEQUAL: - if self.parse_expr_transform_m and (sym_or_string is self.m or - sym_or_string == "m"): - return (AND, ["m", self._sym_lookup("MODULES")]) - return sym_or_string - - relation = EQUAL if (feed.get_next() == T_EQUAL) else UNEQUAL - sym_or_string_2 = feed.get_next() - - if self.parse_expr_cur_sym_or_choice is not None and \ - isinstance(sym_or_string_2, Symbol): - self.parse_expr_cur_sym_or_choice.referenced_syms.add(sym_or_string_2) - - if sym_or_string is self.m: - sym_or_string = "m" - if sym_or_string_2 is self.m: - sym_or_string_2 = "m" - - return (relation, sym_or_string, sym_or_string_2) - - def _parse_file(self, filename, parent, deps, visible_if_deps, res = None): - """Parses the Kconfig file 'filename'. Returns a list with the Items in - the file. See _parse_block() for the meaning of the parameters.""" - return self._parse_block(_FileFeed(filename), None, parent, deps, - visible_if_deps, res) - - def _parse_block(self, line_feeder, end_marker, parent, deps, - visible_if_deps = None, res = None): - """Parses a block, which is the contents of either a file or an if, - menu, or choice statement. Returns a list with the Items in the block. - - end_marker -- The token that ends the block, e.g. T_ENDIF ("endif") for - if's. None for files. - - parent -- The enclosing menu, choice or if, or None if we're at the top - level. - - deps -- Dependencies from enclosing menus, choices and if's. - - visible_if_deps (default: None) -- 'visible if' dependencies from - enclosing menus. - - res (default: None) -- The list to add items to. If None, a new list is - created to hold the items.""" - - block = [] if res is None else res - - while 1: - # Do we already have a tokenized line that we determined wasn't - # part of whatever we were parsing earlier? See comment in - # Config.__init__(). - if self.end_line is not None: - line = self.end_line - tokens = self.end_line_tokens - tokens.go_to_start() - - self.end_line = None - self.end_line_tokens = None - else: - line = line_feeder.get_next() - if line is None: - if end_marker is not None: - raise Kconfig_Syntax_Error( - "Unexpected end of file {0}." - .format(line_feeder.get_filename())) - return block - - tokens = self._tokenize(line, False, - line_feeder.get_filename(), - line_feeder.get_linenr()) - - t0 = tokens.get_next() - if t0 is None: - continue - - # Cases are ordered roughly by frequency, which speeds things up a - # bit - - if t0 == T_CONFIG or t0 == T_MENUCONFIG: - # The tokenizer will automatically allocate a new Symbol object - # for any new names it encounters, so we don't need to worry - # about that here. - sym = tokens.get_next() - - # Symbols defined in multiple places get the parent of their - # first definition. However, for symbols whose parents are choice - # statements, the choice statement takes precedence. - if not sym.is_defined_ or isinstance(parent, Choice): - sym.parent = parent - - sym.is_defined_ = True - - self.kconfig_syms.append(sym) - block.append(sym) - - self._parse_properties(line_feeder, sym, deps, visible_if_deps) - - elif t0 == T_SOURCE: - kconfig_file = tokens.get_next() - exp_kconfig_file = self._expand_sym_refs(kconfig_file) - f = os.path.join(self.base_dir, exp_kconfig_file) - - if not os.path.exists(f): - raise IOError('{0}:{1}: sourced file "{2}" (expands to ' - '"{3}") not found. Perhaps base_dir ' - '(argument to Config.__init__(), currently ' - '"{4}") is set to the wrong value.' - .format(line_feeder.get_filename(), - line_feeder.get_linenr(), - kconfig_file, exp_kconfig_file, - self.base_dir)) - - # Add items to the same block - self._parse_file(f, parent, deps, visible_if_deps, block) - - elif t0 == end_marker: - # We have reached the end of the block - return block - - elif t0 == T_IF: - # If statements are treated as syntactic sugar for adding - # dependencies to enclosed items and do not have an explicit - # object representation. - - dep_expr = self._parse_expr(tokens, None, line, - line_feeder.get_filename(), - line_feeder.get_linenr()) - self._parse_block(line_feeder, - T_ENDIF, - parent, - _make_and(dep_expr, deps), - visible_if_deps, - block) # Add items to the same block - - elif t0 == T_COMMENT: - comment = Comment() - - comment.config = self - comment.parent = parent - comment.filename = line_feeder.get_filename() - comment.linenr = line_feeder.get_linenr() - comment.text = tokens.get_next() - - self.comments.append(comment) - block.append(comment) - - self._parse_properties(line_feeder, comment, deps, visible_if_deps) - - elif t0 == T_MENU: - menu = Menu() - - menu.config = self - menu.parent = parent - menu.filename = line_feeder.get_filename() - menu.linenr = line_feeder.get_linenr() - menu.title = tokens.get_next() - - self.menus.append(menu) - block.append(menu) - - # Parse properties and contents - self._parse_properties(line_feeder, menu, deps, visible_if_deps) - menu.block = self._parse_block(line_feeder, - T_ENDMENU, - menu, - menu.dep_expr, - _make_and(visible_if_deps, - menu.visible_if_expr)) - - elif t0 == T_CHOICE: - name = tokens.get_next() - if name is None: - choice = Choice() - self.choices.append(choice) - else: - # Named choice - choice = self.named_choices.get(name) - if choice is None: - choice = Choice() - choice.name = name - self.named_choices[name] = choice - self.choices.append(choice) - - choice.config = self - choice.parent = parent - - choice.def_locations.append((line_feeder.get_filename(), - line_feeder.get_linenr())) - - # Parse properties and contents - self._parse_properties(line_feeder, choice, deps, visible_if_deps) - choice.block = self._parse_block(line_feeder, - T_ENDCHOICE, - choice, - deps, - visible_if_deps) - - choice._determine_actual_symbols() - - # If no type is set for the choice, its type is that of the first - # choice item - if choice.type == UNKNOWN: - for item in choice.get_symbols(): - if item.type != UNKNOWN: - choice.type = item.type - break - - # Each choice item of UNKNOWN type gets the type of the choice - for item in choice.get_symbols(): - if item.type == UNKNOWN: - item.type = choice.type - - block.append(choice) - - elif t0 == T_MAINMENU: - text = tokens.get_next() - - if self.mainmenu_text is not None: - self._warn("overriding 'mainmenu' text. " - 'Old value: "{0}", new value: "{1}".' - .format(self.mainmenu_text, text), - line_feeder.get_filename(), - line_feeder.get_linenr()) - - self.mainmenu_text = text - - else: - _parse_error(line, "unrecognized construct.", - line_feeder.get_filename(), - line_feeder.get_linenr()) - - def _parse_properties(self, line_feeder, stmt, deps, visible_if_deps): - """Parsing of properties for symbols, menus, choices, and comments.""" - - def parse_val_and_cond(tokens, line, filename, linenr): - """Parses ' if ' constructs, where the 'if' part is - optional. Returns a tuple containing the parsed expressions, with - None as the second element if the 'if' part is missing.""" - val = self._parse_expr(tokens, stmt, line, filename, linenr, False) - if tokens.check(T_IF): - return (val, self._parse_expr(tokens, stmt, line, filename, linenr)) - return (val, None) - - # In case the symbol is defined in multiple locations, we need to - # remember what prompts, defaults, and selects are new for this - # definition, as "depends on" should only apply to the local - # definition. - new_prompt = None - new_def_exprs = [] - new_selects = [] - - # Dependencies from 'depends on' statements - depends_on_expr = None - - while 1: - line = line_feeder.get_next() - if line is None: - break - - filename = line_feeder.get_filename() - linenr = line_feeder.get_linenr() - - tokens = self._tokenize(line, False, filename, linenr) - - t0 = tokens.get_next() - if t0 is None: - continue - - # Cases are ordered roughly by frequency, which speeds things up a - # bit - - if t0 == T_DEPENDS: - if not tokens.check(T_ON): - _parse_error(line, 'expected "on" after "depends".', filename, linenr) - - parsed_deps = self._parse_expr(tokens, stmt, line, filename, linenr) - - if isinstance(stmt, (Menu, Comment)): - stmt.dep_expr = _make_and(stmt.dep_expr, parsed_deps) - else: - depends_on_expr = _make_and(depends_on_expr, parsed_deps) - - elif t0 == T_HELP: - # Find first non-blank (not all-space) line and get its - # indentation - - line_feeder.remove_blank() - line = line_feeder.get_next() - if line is None: - stmt.help = "" - break - - indent = _indentation(line) - if indent == 0: - # If the first non-empty lines has zero indent, there is no - # help text - stmt.help = "" - line_feeder.go_back() - break - - # The help text goes on till the first non-empty line with less - # indent - help_lines = [_deindent(line, indent)] - while 1: - line = line_feeder.get_next() - if line is None or \ - (not line.isspace() and _indentation(line) < indent): - stmt.help = "".join(help_lines) - break - help_lines.append(_deindent(line, indent)) - - if line is None: - break - - line_feeder.go_back() - - elif t0 == T_SELECT: - target = tokens.get_next() - - stmt.referenced_syms.add(target) - stmt.selected_syms.add(target) - - if tokens.check(T_IF): - new_selects.append((target, - self._parse_expr(tokens, stmt, line, filename, linenr))) - else: - new_selects.append((target, None)) - - elif t0 in (T_BOOL, T_TRISTATE, T_INT, T_HEX, T_STRING): - stmt.type = token_to_type[t0] - if len(tokens) > 1: - new_prompt = parse_val_and_cond(tokens, line, filename, linenr) - - elif t0 == T_DEFAULT: - new_def_exprs.append(parse_val_and_cond(tokens, line, filename, linenr)) - - elif t0 == T_DEF_BOOL: - stmt.type = BOOL - if len(tokens) > 1: - new_def_exprs.append(parse_val_and_cond(tokens, line, filename, linenr)) - - elif t0 == T_PROMPT: - # 'prompt' properties override each other within a single - # definition of a symbol, but additional prompts can be added - # by defining the symbol multiple times; hence 'new_prompt' - # instead of 'prompt'. - new_prompt = parse_val_and_cond(tokens, line, filename, linenr) - - elif t0 == T_RANGE: - lower = tokens.get_next() - upper = tokens.get_next() - stmt.referenced_syms.add(lower) - stmt.referenced_syms.add(upper) - - if tokens.check(T_IF): - stmt.ranges.append((lower, upper, - self._parse_expr(tokens, stmt, line, filename, linenr))) - else: - stmt.ranges.append((lower, upper, None)) - - elif t0 == T_DEF_TRISTATE: - stmt.type = TRISTATE - if len(tokens) > 1: - new_def_exprs.append(parse_val_and_cond(tokens, line, filename, linenr)) - - elif t0 == T_OPTION: - if tokens.check(T_ENV) and tokens.check(T_EQUAL): - env_var = tokens.get_next() - - stmt.is_special_ = True - stmt.is_from_env = True - - if env_var not in os.environ: - self._warn("The symbol {0} references the " - "non-existent environment variable {1} and " - "will get the empty string as its value. " - "If you're using kconfiglib via " - "'make (i)scriptconfig', it should have " - "set up the environment correctly for you. " - "If you still got this message, that " - "might be an error, and you should email " - "ulfalizer a.t Google's email service.""" - .format(stmt.name, env_var), - filename, linenr) - - stmt.cached_val = "" - else: - stmt.cached_val = os.environ[env_var] - - elif tokens.check(T_DEFCONFIG_LIST): - self.defconfig_sym = stmt - - elif tokens.check(T_MODULES): - # To reduce warning spam, only warn if 'option modules' is - # set on some symbol that isn't MODULES, which should be - # safe. I haven't run into any projects that make use - # modules besides the kernel yet, and there it's likely to - # keep being called "MODULES". - if stmt.name != "MODULES": - self._warn("the 'modules' option is not supported. " - "Let me know if this is a problem for you; " - "it shouldn't be that hard to implement. " - "(Note that modules are still supported -- " - "Kconfiglib just assumes the symbol name " - "MODULES, like older versions of the C " - "implementation did when 'option modules' " - "wasn't used.)", - filename, linenr) - - elif tokens.check(T_ALLNOCONFIG_Y): - if not isinstance(stmt, Symbol): - _parse_error(line, - "the 'allnoconfig_y' option is only valid for symbols.", - filename, - linenr) - stmt.allnoconfig_y = True - - else: - _parse_error(line, "unrecognized option.", filename, linenr) - - elif t0 == T_VISIBLE: - if not tokens.check(T_IF): - _parse_error(line, 'expected "if" after "visible".', filename, linenr) - if not isinstance(stmt, Menu): - _parse_error(line, - "'visible if' is only valid for menus.", - filename, - linenr) - - parsed_deps = self._parse_expr(tokens, stmt, line, filename, linenr) - stmt.visible_if_expr = _make_and(stmt.visible_if_expr, parsed_deps) - - elif t0 == T_OPTIONAL: - if not isinstance(stmt, Choice): - _parse_error(line, - '"optional" is only valid for choices.', - filename, - linenr) - stmt.optional = True - - else: - # See comment in Config.__init__() - self.end_line = line - self.end_line_tokens = tokens - break - - # Propagate dependencies from enclosing menus and if's. - - # For menus and comments.. - if isinstance(stmt, (Menu, Comment)): - stmt.orig_deps = stmt.dep_expr - stmt.deps_from_containing = deps - stmt.dep_expr = _make_and(stmt.dep_expr, deps) - - stmt.all_referenced_syms = \ - stmt.referenced_syms | _get_expr_syms(deps) - - # For symbols and choices.. - else: - - # See comment for 'menu_dep' - stmt.menu_dep = depends_on_expr - - # Propagate dependencies specified with 'depends on' to any new - # default expressions, prompts, and selections. ("New" since a - # symbol might be defined in multiple places and the dependencies - # should only apply to the local definition.) - - new_def_exprs = [(val_expr, _make_and(cond_expr, depends_on_expr)) - for val_expr, cond_expr in new_def_exprs] - - new_selects = [(target, _make_and(cond_expr, depends_on_expr)) - for target, cond_expr in new_selects] - - if new_prompt is not None: - prompt, cond_expr = new_prompt - - # 'visible if' dependencies from enclosing menus get propagated - # to prompts - if visible_if_deps is not None: - cond_expr = _make_and(cond_expr, visible_if_deps) - - new_prompt = (prompt, _make_and(cond_expr, depends_on_expr)) - - # We save the original expressions -- before any menu and if - # conditions have been propagated -- so these can be retrieved - # later. - - stmt.orig_def_exprs.extend(new_def_exprs) - if new_prompt is not None: - stmt.orig_prompts.append(new_prompt) - - # Only symbols can select - if isinstance(stmt, Symbol): - stmt.orig_selects.extend(new_selects) - - # Save dependencies from enclosing menus and if's - stmt.deps_from_containing = deps - - # The set of symbols referenced directly by the symbol/choice plus - # all symbols referenced by enclosing menus and if's. - stmt.all_referenced_syms = \ - stmt.referenced_syms | _get_expr_syms(deps) - - # Propagate dependencies from enclosing menus and if's - - stmt.def_exprs.extend([(val_expr, _make_and(cond_expr, deps)) - for val_expr, cond_expr in new_def_exprs]) - - for target, cond in new_selects: - target.rev_dep = _make_or(target.rev_dep, - _make_and(stmt, - _make_and(cond, deps))) - - if new_prompt is not None: - prompt, cond_expr = new_prompt - stmt.prompts.append((prompt, _make_and(cond_expr, deps))) - - # - # Symbol table manipulation - # - - def _sym_lookup(self, name, add_sym_if_not_exists = True): - """Fetches the symbol 'name' from the symbol table, optionally adding - it if it does not exist (this is usually what we want).""" - if name in self.syms: - return self.syms[name] - - new_sym = Symbol() - new_sym.config = self - new_sym.name = name - - if add_sym_if_not_exists: - self.syms[name] = new_sym - else: - # This warning is generated while evaluating an expression - # containing undefined symbols using Config.eval() - self._warn("no symbol {0} in configuration".format(name)) - - return new_sym - - # - # Evaluation of symbols and expressions - # - - def _eval_expr(self, expr): - """Evaluates an expression and returns one of the tristate values "n", - "m" or "y".""" - res = self._eval_expr_2(expr) - - # Promote "m" to "y" if we're running without modules. Internally, "m" - # is often rewritten to "m" && MODULES by both the C implementation and - # kconfiglib, which takes care of cases where "m" should be false if - # we're running without modules. - if res == "m" and not self._has_modules(): - return "y" - - return res - - def _eval_expr_2(self, expr): - if expr is None: - return "y" - - if isinstance(expr, Symbol): - # Non-bool/tristate symbols are always "n" in a tristate sense, - # regardless of their value - if expr.type != BOOL and expr.type != TRISTATE: - return "n" - return expr.get_value() - - if isinstance(expr, str): - return expr if (expr == "y" or expr == "m") else "n" - - first_expr = expr[0] - - if first_expr == AND: - res = "y" - for subexpr in expr[1]: - ev = self._eval_expr_2(subexpr) - # Return immediately upon discovering an "n" term - if ev == "n": - return "n" - if ev == "m": - res = "m" - # 'res' is either "m" or "y" here; we already handled the - # short-circuiting "n" case in the loop. - return res - - if first_expr == OR: - res = "n" - for subexpr in expr[1]: - ev = self._eval_expr_2(subexpr) - # Return immediately upon discovering a "y" term - if ev == "y": - return "y" - if ev == "m": - res = "m" - # 'res' is either "n" or "m" here; we already handled the - # short-circuiting "y" case in the loop. - return res - - if first_expr == NOT: - ev = self._eval_expr_2(expr[1]) - if ev == "y": - return "n" - return "y" if (ev == "n") else "m" - - if first_expr == EQUAL: - return "y" if (_str_val(expr[1]) == _str_val(expr[2])) else "n" - - if first_expr == UNEQUAL: - return "y" if (_str_val(expr[1]) != _str_val(expr[2])) else "n" - - _internal_error("Internal error while evaluating expression: " - "unknown operation {0}.".format(first_expr)) - - def _eval_min(self, e1, e2): - """Returns the minimum value of the two expressions. Equates None with - 'y'.""" - e1_eval = self._eval_expr(e1) - e2_eval = self._eval_expr(e2) - return e1_eval if tri_less(e1_eval, e2_eval) else e2_eval - - def _eval_max(self, e1, e2): - """Returns the maximum value of the two expressions. Equates None with - 'y'.""" - e1_eval = self._eval_expr(e1) - e2_eval = self._eval_expr(e2) - return e1_eval if tri_greater(e1_eval, e2_eval) else e2_eval - - # - # Methods related to the MODULES symbol - # - - def _has_modules(self): - modules_sym = self.syms.get("MODULES") - return (modules_sym is not None) and (modules_sym.get_value() == "y") - - # - # Dependency tracking - # - - def _build_dep(self): - """Populates the Symbol.dep sets, linking the symbol to the symbols - that immediately depend on it in the sense that changing the value of - the symbol might affect the values of those other symbols. This is used - for caching/invalidation purposes. The calculated sets might be larger - than necessary as we don't do any complicated analysis of the - expressions.""" - - # Adds 'sym' as a directly dependent symbol to all symbols that appear - # in the expression 'e' - def add_expr_deps(e, sym): - for s in _get_expr_syms(e): - s.dep.add(sym) - - # The directly dependent symbols of a symbol are: - # - Any symbols whose prompts, default values, rev_dep (select - # condition), or ranges depend on the symbol - # - Any symbols that belong to the same choice statement as the symbol - # (these won't be included in 'dep' as that makes the dependency - # graph unwieldy, but Symbol._get_dependent() will include them) - # - Any symbols in a choice statement that depends on the symbol - for sym in self.syms_iter(): - for _, e in sym.prompts: - add_expr_deps(e, sym) - - for v, e in sym.def_exprs: - add_expr_deps(v, sym) - add_expr_deps(e, sym) - - add_expr_deps(sym.rev_dep, sym) - - for l, u, e in sym.ranges: - add_expr_deps(l, sym) - add_expr_deps(u, sym) - add_expr_deps(e, sym) - - if sym.is_choice_symbol_: - choice = sym.parent - for _, e in choice.prompts: - add_expr_deps(e, sym) - for _, e in choice.def_exprs: - add_expr_deps(e, sym) - - def _expr_val_str(self, expr, no_value_str = "(none)", get_val_instead_of_eval = False): - # Since values are valid expressions, _expr_to_str() will get a nice - # string representation for those as well. - - if expr is None: - return no_value_str - - if get_val_instead_of_eval: - if isinstance(expr, str): - return _expr_to_str(expr) - val = expr.get_value() - else: - val = self._eval_expr(expr) - - return "{0} (value: {1})".format(_expr_to_str(expr), _expr_to_str(val)) - - def _expand_sym_refs(self, s): - """Expands $-references to symbols in 's' to symbol values, or to the - empty string for undefined symbols.""" - - while 1: - sym_ref_match = _sym_ref_re_search(s) - if sym_ref_match is None: - return s - - sym_name = sym_ref_match.group(0)[1:] - sym = self.syms.get(sym_name) - expansion = "" if sym is None else sym.get_value() - - s = s[:sym_ref_match.start()] + \ - expansion + \ - s[sym_ref_match.end():] - - def _get_sym_or_choice_str(self, sc): - """Symbols and choices have many properties in common, so we factor out - common __str__() stuff here. "sc" is short for "symbol or choice".""" - - # As we deal a lot with string representations here, use some - # convenient shorthand: - s = _expr_to_str - - # - # Common symbol/choice properties - # - - user_val_str = "(no user value)" if sc.user_val is None else s(sc.user_val) - - # Build prompts string - if sc.prompts == []: - prompts_str = " (no prompts)" - else: - prompts_str_rows = [] - for prompt, cond_expr in sc.orig_prompts: - if cond_expr is None: - prompts_str_rows.append(' "{0}"'.format(prompt)) - else: - prompts_str_rows.append(' "{0}" if {1}' - .format(prompt, self._expr_val_str(cond_expr))) - prompts_str = "\n".join(prompts_str_rows) - - # Build locations string - if sc.def_locations == []: - locations_str = "(no locations)" - else: - locations_str = " ".join(["{0}:{1}".format(filename, linenr) for - (filename, linenr) in sc.def_locations]) - - # Build additional-dependencies-from-menus-and-if's string - additional_deps_str = " " + self._expr_val_str(sc.deps_from_containing, - "(no additional dependencies)") - - # - # Symbol-specific stuff - # - - if isinstance(sc, Symbol): - # Build ranges string - if isinstance(sc, Symbol): - if sc.ranges == []: - ranges_str = " (no ranges)" - else: - ranges_str_rows = [] - for l, u, cond_expr in sc.ranges: - if cond_expr is None: - ranges_str_rows.append(" [{0}, {1}]".format(s(l), s(u))) - else: - ranges_str_rows.append(" [{0}, {1}] if {2}" - .format(s(l), s(u), self._expr_val_str(cond_expr))) - ranges_str = "\n".join(ranges_str_rows) - - # Build default values string - if sc.def_exprs == []: - defaults_str = " (no default values)" - else: - defaults_str_rows = [] - for val_expr, cond_expr in sc.orig_def_exprs: - row_str = " " + self._expr_val_str(val_expr, "(none)", sc.type == STRING) - defaults_str_rows.append(row_str) - defaults_str_rows.append(" Condition: " + self._expr_val_str(cond_expr)) - defaults_str = "\n".join(defaults_str_rows) - - # Build selects string - if sc.orig_selects == []: - selects_str = " (no selects)" - else: - selects_str_rows = [] - for target, cond_expr in sc.orig_selects: - if cond_expr is None: - selects_str_rows.append(" {0}".format(target.name)) - else: - selects_str_rows.append(" {0} if ".format(target.name) + - self._expr_val_str(cond_expr)) - selects_str = "\n".join(selects_str_rows) - - res = _sep_lines("Symbol " + - ("(no name)" if sc.name is None else sc.name), - "Type : " + typename[sc.type], - "Value : " + s(sc.get_value()), - "User value : " + user_val_str, - "Visibility : " + s(sc.get_visibility()), - "Is choice item : " + bool_str[sc.is_choice_symbol_], - "Is defined : " + bool_str[sc.is_defined_], - "Is from env. : " + bool_str[sc.is_from_env], - "Is special : " + bool_str[sc.is_special_] + "\n") - if sc.ranges != []: - res += _sep_lines("Ranges:", - ranges_str + "\n") - res += _sep_lines("Prompts:", - prompts_str, - "Default values:", - defaults_str, - "Selects:", - selects_str, - "Reverse (select-related) dependencies:", - " (no reverse dependencies)" if sc.rev_dep == "n" - else " " + self._expr_val_str(sc.rev_dep), - "Additional dependencies from enclosing menus and if's:", - additional_deps_str, - "Locations: " + locations_str) - - return res - - # - # Choice-specific stuff - # - - # Build selected symbol string - sel = sc.get_selection() - sel_str = "(no selection)" if sel is None else sel.name - - # Build default values string - if sc.def_exprs == []: - defaults_str = " (no default values)" - else: - defaults_str_rows = [] - for sym, cond_expr in sc.orig_def_exprs: - if cond_expr is None: - defaults_str_rows.append(" {0}".format(sym.name)) - else: - defaults_str_rows.append(" {0} if ".format(sym.name) + - self._expr_val_str(cond_expr)) - defaults_str = "\n".join(defaults_str_rows) - - # Build contained symbols string - names = [sym.name for sym in sc.get_symbols()] - syms_string = "(empty)" if names == [] else " ".join(names) - - return _sep_lines("Choice", - "Name (for named choices): " + - ("(no name)" if sc.name is None else sc.name), - "Type : " + typename[sc.type], - "Selected symbol : " + sel_str, - "User value : " + user_val_str, - "Mode : " + s(sc.get_mode()), - "Visibility : " + s(sc.get_visibility()), - "Optional : " + bool_str[sc.optional], - "Prompts:", - prompts_str, - "Defaults:", - defaults_str, - "Choice symbols:", - " " + syms_string, - "Additional dependencies from enclosing menus and if's:", - additional_deps_str, - "Locations: " + locations_str) - - def _expr_depends_on(self, expr, sym): - """Reimplementation of expr_depends_symbol() from mconf.c. Used to - determine if a submenu should be implicitly created, which influences what - items inside choice statements are considered choice items.""" - if expr is None: - return False - - def rec(expr): - if isinstance(expr, str): - return False - if isinstance(expr, Symbol): - return expr is sym - - e0 = expr[0] - if e0 == EQUAL or e0 == UNEQUAL: - return self._eq_to_sym(expr) is sym - if e0 == AND: - for and_expr in expr[1]: - if rec(and_expr): - return True - return False - - return rec(expr) - - def _eq_to_sym(self, eq): - """_expr_depends_on() helper. For (in)equalities of the form sym = y/m - or sym != n, returns sym. For other (in)equalities, returns None.""" - relation, left, right = eq - left = self._transform_n_m_y(left) - right = self._transform_n_m_y(right) - - # Make sure the symbol (if any) appears to the left - if not isinstance(left, Symbol): - left, right = right, left - if not isinstance(left, Symbol): - return None - if (relation == EQUAL and (right == "y" or right == "m")) or \ - (relation == UNEQUAL and right == "n"): - return left - return None - - def _transform_n_m_y(self, item): - """_eq_to_sym() helper. Translates the symbols n, m, and y to their - string equivalents.""" - if item is self.n: - return "n" - if item is self.m: - return "m" - if item is self.y: - return "y" - return item - - def _warn(self, msg, filename = None, linenr = None): - """For printing warnings to stderr.""" - if self.print_warnings: - _stderr_msg("warning: " + msg, filename, linenr) - -class Item(object): - - """Base class for symbols and other Kconfig constructs. Subclasses are - Symbol, Choice, Menu, and Comment.""" - - def is_symbol(self): - """Returns True if the item is a symbol. Short for - isinstance(item, kconfiglib.Symbol).""" - return isinstance(self, Symbol) - - def is_choice(self): - """Returns True if the item is a choice. Short for - isinstance(item, kconfiglib.Choice).""" - return isinstance(self, Choice) - - def is_menu(self): - """Returns True if the item is a menu. Short for - isinstance(item, kconfiglib.Menu).""" - return isinstance(self, Menu) - - def is_comment(self): - """Returns True if the item is a comment. Short for - isinstance(item, kconfiglib.Comment).""" - return isinstance(self, Comment) - -class Symbol(Item): - - """Represents a configuration symbol - e.g. FOO for - - config FOO - ...""" - - # - # Public interface - # - - def get_value(self): - """Calculate and return the value of the symbol. See also - Symbol.set_user_value().""" - - if self.cached_val is not None: - return self.cached_val - - self.write_to_conf = False - - # As a quirk of Kconfig, undefined symbols get their name as their - # value. This is why things like "FOO = bar" work for seeing if FOO has - # the value "bar". - if self.type == UNKNOWN: - self.cached_val = self.name - return self.name - - new_val = default_value[self.type] - - vis = _get_visibility(self) - - if self.type == BOOL or self.type == TRISTATE: - # The visibility and mode (modules-only or single-selection) of - # choice items will be taken into account in _get_visibility() - if self.is_choice_symbol_: - if vis != "n": - choice = self.parent - mode = choice.get_mode() - - self.write_to_conf = (mode != "n") - - if mode == "y": - new_val = "y" if (choice.get_selection() is self) else "n" - elif mode == "m": - if self.user_val == "m" or self.user_val == "y": - new_val = "m" - - else: - # If the symbol is visible and has a user value, use that. - # Otherwise, look at defaults. - use_defaults = True - - if vis != "n": - self.write_to_conf = True - if self.user_val is not None: - new_val = self.config._eval_min(self.user_val, vis) - use_defaults = False - - if use_defaults: - for val_expr, cond_expr in self.def_exprs: - cond_eval = self.config._eval_expr(cond_expr) - if cond_eval != "n": - self.write_to_conf = True - new_val = self.config._eval_min(val_expr, cond_eval) - break - - # Reverse (select-related) dependencies take precedence - rev_dep_val = self.config._eval_expr(self.rev_dep) - if rev_dep_val != "n": - self.write_to_conf = True - new_val = self.config._eval_max(new_val, rev_dep_val) - - # Promote "m" to "y" for booleans - if new_val == "m" and self.type == BOOL: - new_val = "y" - - elif self.type == STRING: - use_defaults = True - - if vis != "n": - self.write_to_conf = True - if self.user_val is not None: - new_val = self.user_val - use_defaults = False - - if use_defaults: - for val_expr, cond_expr in self.def_exprs: - if self.config._eval_expr(cond_expr) != "n": - self.write_to_conf = True - new_val = _str_val(val_expr) - break - - elif self.type == HEX or self.type == INT: - has_active_range = False - low = None - high = None - use_defaults = True - - base = 16 if self.type == HEX else 10 - - for(l, h, cond_expr) in self.ranges: - if self.config._eval_expr(cond_expr) != "n": - has_active_range = True - - low_str = _str_val(l) - high_str = _str_val(h) - low = int(low_str, base) if \ - _is_base_n(low_str, base) else 0 - high = int(high_str, base) if \ - _is_base_n(high_str, base) else 0 - - break - - if vis != "n": - self.write_to_conf = True - - if self.user_val is not None and \ - _is_base_n(self.user_val, base) and \ - (not has_active_range or - low <= int(self.user_val, base) <= high): - - # If the user value is OK, it is stored in exactly the same - # form as specified in the assignment (with or without - # "0x", etc). - - use_defaults = False - new_val = self.user_val - - if use_defaults: - for val_expr, cond_expr in self.def_exprs: - if self.config._eval_expr(cond_expr) != "n": - self.write_to_conf = True - - # If the default value is OK, it is stored in exactly - # the same form as specified. Otherwise, it is clamped - # to the range, and the output has "0x" as appropriate - # for the type. - - new_val = _str_val(val_expr) - - if _is_base_n(new_val, base): - new_val_num = int(new_val, base) - if has_active_range: - clamped_val = None - - if new_val_num < low: - clamped_val = low - elif new_val_num > high: - clamped_val = high - - if clamped_val is not None: - new_val = (hex(clamped_val) if \ - self.type == HEX else str(clamped_val)) - - break - else: # For the for loop - # If no user value or default kicks in but the hex/int has - # an active range, then the low end of the range is used, - # provided it's > 0, with "0x" prepended as appropriate. - if has_active_range and low > 0: - new_val = (hex(low) if self.type == HEX else str(low)) - - self.cached_val = new_val - return new_val - - def set_user_value(self, v): - """Sets the user value of the symbol. - - Equal in effect to assigning the value to the symbol within a .config - file. Use get_lower/upper_bound() or get_assignable_values() to find - the range of currently assignable values for bool and tristate symbols; - setting values outside this range will cause the user value to differ - from the result of Symbol.get_value() (be truncated). Values that are - invalid for the type (such as a_bool.set_user_value("foo")) are - ignored, and a warning is emitted if an attempt is made to assign such - a value. - - For any type of symbol, is_modifiable() can be used to check if a user - value will currently have any effect on the symbol, as determined by - its visibility and range of assignable values. Any value that is valid - for the type (bool, tristate, etc.) will end up being reflected in - get_user_value() though, and might have an effect later if conditions - change. To get rid of the user value, use unset_user_value(). - - Any symbols dependent on the symbol are (recursively) invalidated, so - things will just work with regards to dependencies. - - v -- The user value to give to the symbol.""" - self._set_user_value_no_invalidate(v, False) - - # There might be something more efficient you could do here, but play - # it safe. - if self.name == "MODULES": - self.config._invalidate_all() - return - - self._invalidate() - self._invalidate_dependent() - - def unset_user_value(self): - """Resets the user value of the symbol, as if the symbol had never - gotten a user value via Config.load_config() or - Symbol.set_user_value().""" - self._unset_user_value_no_recursive_invalidate() - self._invalidate_dependent() - - def get_user_value(self): - """Returns the value assigned to the symbol in a .config or via - Symbol.set_user_value() (provided the value was valid for the type of the - symbol). Returns None in case of no user value.""" - return self.user_val - - def get_name(self): - """Returns the name of the symbol.""" - return self.name - - def get_prompts(self): - """Returns a list of prompts defined for the symbol, in the order they - appear in the configuration files. Returns the empty list for symbols - with no prompt. - - This list will have a single entry for the vast majority of symbols - having prompts, but having multiple prompts for a single symbol is - possible through having multiple 'config' entries for it.""" - return [prompt for prompt, _ in self.orig_prompts] - - def get_upper_bound(self): - """For string/hex/int symbols and for bool and tristate symbols that - cannot be modified (see is_modifiable()), returns None. - - Otherwise, returns the highest value the symbol can be set to with - Symbol.set_user_value() (that will not be truncated): one of "m" or "y", - arranged from lowest to highest. This corresponds to the highest value - the symbol could be given in e.g. the 'make menuconfig' interface. - - See also the tri_less*() and tri_greater*() functions, which could come - in handy.""" - if self.type != BOOL and self.type != TRISTATE: - return None - rev_dep = self.config._eval_expr(self.rev_dep) - # A bool selected to "m" gets promoted to "y" - if self.type == BOOL and rev_dep == "m": - rev_dep = "y" - vis = _get_visibility(self) - if (tri_to_int[vis] - tri_to_int[rev_dep]) > 0: - return vis - return None - - def get_lower_bound(self): - """For string/hex/int symbols and for bool and tristate symbols that - cannot be modified (see is_modifiable()), returns None. - - Otherwise, returns the lowest value the symbol can be set to with - Symbol.set_user_value() (that will not be truncated): one of "n" or "m", - arranged from lowest to highest. This corresponds to the lowest value - the symbol could be given in e.g. the 'make menuconfig' interface. - - See also the tri_less*() and tri_greater*() functions, which could come - in handy.""" - if self.type != BOOL and self.type != TRISTATE: - return None - rev_dep = self.config._eval_expr(self.rev_dep) - # A bool selected to "m" gets promoted to "y" - if self.type == BOOL and rev_dep == "m": - rev_dep = "y" - if (tri_to_int[_get_visibility(self)] - tri_to_int[rev_dep]) > 0: - return rev_dep - return None - - def get_assignable_values(self): - """For string/hex/int symbols and for bool and tristate symbols that - cannot be modified (see is_modifiable()), returns the empty list. - - Otherwise, returns a list containing the user values that can be - assigned to the symbol (that won't be truncated). Usage example: - - if "m" in sym.get_assignable_values(): - sym.set_user_value("m") - - This is basically a more convenient interface to - get_lower/upper_bound() when wanting to test if a particular tristate - value can be assigned.""" - if self.type != BOOL and self.type != TRISTATE: - return [] - rev_dep = self.config._eval_expr(self.rev_dep) - # A bool selected to "m" gets promoted to "y" - if self.type == BOOL and rev_dep == "m": - rev_dep = "y" - res = ["n", "m", "y"][tri_to_int[rev_dep] : - tri_to_int[_get_visibility(self)] + 1] - return res if len(res) > 1 else [] - - def get_type(self): - """Returns the type of the symbol: one of UNKNOWN, BOOL, TRISTATE, - STRING, HEX, or INT. These are defined at the top level of the module, - so you'd do something like - - if sym.get_type() == kconfiglib.STRING: - ...""" - return self.type - - def get_visibility(self): - """Returns the visibility of the symbol: one of "n", "m" or "y". For - bool and tristate symbols, this is an upper bound on the value users - can set for the symbol. For other types of symbols, a visibility of "n" - means the user value will be ignored. A visibility of "n" corresponds - to not being visible in the 'make *config' interfaces. - - Example (assuming we're running with modules enabled -- i.e., MODULES - set to 'y'): - - # Assume this has been assigned 'n' - config N_SYM - tristate "N_SYM" - - # Assume this has been assigned 'm' - config M_SYM - tristate "M_SYM" - - # Has visibility 'n' - config A - tristate "A" - depends on N_SYM - - # Has visibility 'm' - config B - tristate "B" - depends on M_SYM - - # Has visibility 'y' - config C - tristate "C" - - # Has no prompt, and hence visibility 'n' - config D - tristate - - Having visibility be tri-valued ensures that e.g. a symbol cannot be - set to "y" by the user if it depends on a symbol with value "m", which - wouldn't be safe. - - You should probably look at get_lower/upper_bound(), - get_assignable_values() and is_modifiable() before using this.""" - return _get_visibility(self) - - def get_parent(self): - """Returns the menu or choice statement that contains the symbol, or - None if the symbol is at the top level. Note that if statements are - treated as syntactic and do not have an explicit class - representation.""" - return self.parent - - def get_referenced_symbols(self, refs_from_enclosing = False): - """Returns the set() of all symbols referenced by this symbol. For - example, the symbol defined by - - config FOO - bool - prompt "foo" if A && B - default C if D - depends on E - select F if G - - references the symbols A through G. - - refs_from_enclosing (default: False) -- If True, the symbols - referenced by enclosing menus and if's will be - included in the result.""" - return self.all_referenced_syms if refs_from_enclosing else self.referenced_syms - - def get_selected_symbols(self): - """Returns the set() of all symbols X for which this symbol has a - 'select X' or 'select X if Y' (regardless of whether Y is satisfied or - not). This is a subset of the symbols returned by - get_referenced_symbols().""" - return self.selected_syms - - def get_help(self): - """Returns the help text of the symbol, or None if the symbol has no - help text.""" - return self.help - - def get_config(self): - """Returns the Config instance this symbol is from.""" - return self.config - - def get_def_locations(self): - """Returns a list of (filename, linenr) tuples, where filename (string) - and linenr (int) represent a location where the symbol is defined. For - the vast majority of symbols this list will only contain one element. - For the following Kconfig, FOO would get two entries: the lines marked - with *. - - config FOO * - bool "foo prompt 1" - - config FOO * - bool "foo prompt 2" - """ - return self.def_locations - - def get_ref_locations(self): - """Returns a list of (filename, linenr) tuples, where filename (string) - and linenr (int) represent a location where the symbol is referenced in - the configuration. For example, the lines marked by * would be included - for FOO below: - - config A - bool - default BAR || FOO * - - config B - tristate - depends on FOO * - default m if FOO * - - if FOO * - config A - bool "A" - endif - - config FOO (definition not included) - bool - """ - return self.ref_locations - - def is_modifiable(self): - """Returns True if the value of the symbol could be modified by calling - Symbol.set_user_value(). - - For bools and tristates, this corresponds to the symbol being visible - in the 'make menuconfig' interface and not already being pinned to a - specific value (e.g. because it is selected by another symbol). - - For strings and numbers, this corresponds to just being visible. (See - Symbol.get_visibility().)""" - if self.is_special_: - return False - if self.type == BOOL or self.type == TRISTATE: - rev_dep = self.config._eval_expr(self.rev_dep) - # A bool selected to "m" gets promoted to "y" - if self.type == BOOL and rev_dep == "m": - rev_dep = "y" - return (tri_to_int[_get_visibility(self)] - - tri_to_int[rev_dep]) > 0 - return _get_visibility(self) != "n" - - def is_defined(self): - """Returns False if the symbol is referred to in the Kconfig but never - actually defined.""" - return self.is_defined_ - - def is_special(self): - """Returns True if the symbol is one of the special symbols n, m, y, or - UNAME_RELEASE, or gets its value from the environment.""" - return self.is_special_ - - def is_from_environment(self): - """Returns True if the symbol gets its value from the environment.""" - return self.is_from_env - - def has_ranges(self): - """Returns True if the symbol is of type INT or HEX and has ranges that - limit what values it can take on.""" - return self.ranges != [] - - def is_choice_symbol(self): - """Returns True if the symbol is in a choice statement and is an actual - choice symbol (see Choice.get_symbols()).""" - return self.is_choice_symbol_ - - def is_choice_selection(self): - """Returns True if the symbol is contained in a choice statement and is - the selected item. Equivalent to - 'sym.is_choice_symbol() and sym.get_parent().get_selection() is sym'.""" - return self.is_choice_symbol_ and self.parent.get_selection() is self - - def is_allnoconfig_y(self): - """Returns True if the symbol has the 'allnoconfig_y' option set.""" - return self.allnoconfig_y - - def __str__(self): - """Returns a string containing various information about the symbol.""" - return self.config._get_sym_or_choice_str(self) - - # - # Private methods - # - - def __init__(self): - """Symbol constructor -- not intended to be called directly by - kconfiglib clients.""" - - self.prompts = [] - self.cached_visibility = None - - self.config = None - - self.parent = None - self.name = None - self.type = UNKNOWN - - self.def_exprs = [] - self.ranges = [] - self.rev_dep = "n" - - # The prompt, default value and select conditions without any - # dependencies from menus or if's propagated to them - - self.orig_prompts = [] - self.orig_def_exprs = [] - self.orig_selects = [] - - # Dependencies inherited from containing menus and if's - self.deps_from_containing = None - - self.help = None - - # The set of symbols referenced by this symbol (see - # get_referenced_symbols()) - self.referenced_syms = set() - - # The set of symbols selected by this symbol (see - # get_selected_symbols()) - self.selected_syms = set() - - # Like 'referenced_syms', but includes symbols from - # dependencies inherited from enclosing menus and if's - self.all_referenced_syms = set() - - # This is set to True for "actual" choice symbols. See - # Choice._determine_actual_symbols(). The trailing underscore avoids a - # collision with is_choice_symbol(). - self.is_choice_symbol_ = False - - # This records only dependencies specified with 'depends on'. Needed - # when determining actual choice items (hrrrr...). See also - # Choice._determine_actual_symbols(). - self.menu_dep = None - - # See Symbol.get_ref/def_locations(). - self.def_locations = [] - self.ref_locations = [] - - self.user_val = None - - # Flags - - # Should the symbol get an entry in .config? - self.write_to_conf = False - - # Caches the calculated value - self.cached_val = None - - # Populated in Config._build_dep() after parsing. Links the symbol to - # the symbols that immediately depend on it (in a caching/invalidation - # sense). The total set of dependent symbols for the symbol (the - # transitive closure) is calculated on an as-needed basis in - # _get_dependent(). - self.dep = set() - - # Caches the total list of dependent symbols. Calculated in - # _get_dependent(). - self.cached_deps = None - - # Does the symbol have an entry in the Kconfig file? The trailing - # underscore avoids a collision with is_defined(). - self.is_defined_ = False - - # Does the symbol get its value in some special way, e.g. from the - # environment or by being one of the special symbols n, m, and y? If - # so, the value is stored in self.cached_val, which is never - # invalidated. The trailing underscore avoids a collision with - # is_special(). - self.is_special_ = False - - # Does the symbol get its value from the environment? - self.is_from_env = False - - # Does the symbol have the 'allnoconfig_y' option set? - self.allnoconfig_y = False - - def _invalidate(self): - if self.is_special_: - return - - if self.is_choice_symbol_: - self.parent._invalidate() - - self.cached_val = None - self.cached_visibility = None - self.write_to_conf = False - - def _invalidate_dependent(self): - for sym in self._get_dependent(): - sym._invalidate() - - def _set_user_value_no_invalidate(self, v, suppress_load_warnings): - """Like set_user_value(), but does not invalidate any symbols. - - suppress_load_warnings -- - some warnings are annoying when loading a .config that can be helpful - when manually invoking set_user_value(). This flag is set to True to - suppress such warnings. - - Perhaps this could be made optional for load_config() instead.""" - - if self.is_special_: - if self.is_from_env: - self.config._warn('attempt to assign the value "{0}" to the ' - 'symbol {1}, which gets its value from the ' - 'environment. Assignment ignored.' - .format(v, self.name)) - else: - self.config._warn('attempt to assign the value "{0}" to the ' - 'special symbol {1}. Assignment ignored.' - .format(v, self.name)) - return - - if not self.is_defined_: - filename, linenr = self.ref_locations[0] - if self.config.print_undef_assign: - _stderr_msg('note: attempt to assign the value "{0}" to {1}, ' - "which is referenced at {2}:{3} but never " - "defined. Assignment ignored." - .format(v, self.name, filename, linenr)) - return - - # Check if the value is valid for our type - if not ((self.type == BOOL and (v == "y" or v == "n") ) or - (self.type == TRISTATE and (v == "y" or v == "m" or - v == "n") ) or - (self.type == STRING ) or - (self.type == INT and _is_base_n(v, 10) ) or - (self.type == HEX and _is_base_n(v, 16) )): - self.config._warn('the value "{0}" is invalid for {1}, which has type {2}. ' - "Assignment ignored." - .format(v, self.name, typename[self.type])) - return - - if self.prompts == [] and not suppress_load_warnings: - self.config._warn('assigning "{0}" to the symbol {1} which ' - 'lacks prompts and thus has visibility "n". ' - 'The assignment will have no effect.' - .format(v, self.name)) - - self.user_val = v - - if self.is_choice_symbol_ and (self.type == BOOL or - self.type == TRISTATE): - choice = self.parent - if v == "y": - choice.user_val = self - choice.user_mode = "y" - elif v == "m": - choice.user_val = None - choice.user_mode = "m" - - def _unset_user_value_no_recursive_invalidate(self): - self._invalidate() - self.user_val = None - - if self.is_choice_symbol_: - self.parent._unset_user_value() - - def _make_conf(self): - if self.already_written: - return [] - - self.already_written = True - - # Note: write_to_conf is determined in get_value() - val = self.get_value() - if not self.write_to_conf: - return [] - - if self.type == BOOL or self.type == TRISTATE: - if val == "m" or val == "y": - return ["CONFIG_{0}={1}".format(self.name, val)] - return ["# CONFIG_{0} is not set".format(self.name)] - - elif self.type == STRING: - # Escape \ and " - return ['CONFIG_{0}="{1}"' - .format(self.name, - val.replace("\\", "\\\\").replace('"', '\\"'))] - - elif self.type == INT or self.type == HEX: - return ["CONFIG_{0}={1}".format(self.name, val)] - - else: - _internal_error('Internal error while creating .config: unknown type "{0}".' - .format(self.type)) - - def _get_dependent(self): - """Returns the set of symbols that should be invalidated if the value - of the symbol changes, because they might be affected by the change. - Note that this is an internal API -- it's probably of limited - usefulness to clients.""" - if self.cached_deps is not None: - return self.cached_deps - - res = set() - - self._add_dependent_ignore_siblings(res) - if self.is_choice_symbol_: - for s in self.parent.get_symbols(): - if s is not self: - res.add(s) - s._add_dependent_ignore_siblings(res) - - self.cached_deps = res - return res - - def _add_dependent_ignore_siblings(self, to): - """Calculating dependencies gets a bit tricky for choice items as they - all depend on each other, potentially leading to infinite recursion. - This helper function calculates dependencies ignoring the other symbols - in the choice. It also works fine for symbols that are not choice - items.""" - for s in self.dep: - to.add(s) - to |= s._get_dependent() - - def _has_auto_menu_dep_on(self, on): - """See Choice._determine_actual_symbols().""" - if not isinstance(self.parent, Choice): - _internal_error("Attempt to determine auto menu dependency for symbol ouside of choice.") - - if self.prompts == []: - # If we have no prompt, use the menu dependencies instead (what was - # specified with 'depends on') - return self.menu_dep is not None and \ - self.config._expr_depends_on(self.menu_dep, on) - - for _, cond_expr in self.prompts: - if self.config._expr_depends_on(cond_expr, on): - return True - - return False - -class Menu(Item): - - """Represents a menu statement.""" - - # - # Public interface - # - - def get_config(self): - """Return the Config instance this menu is from.""" - return self.config - - def get_visibility(self): - """Returns the visibility of the menu. This also affects the visibility - of subitems. See also Symbol.get_visibility().""" - return self.config._eval_expr(self.dep_expr) - - def get_visible_if_visibility(self): - """Returns the visibility the menu gets from its 'visible if' - condition. "y" if the menu has no 'visible if' condition.""" - return self.config._eval_expr(self.visible_if_expr) - - def get_items(self, recursive = False): - """Returns a list containing the items (symbols, menus, choice - statements and comments) in in the menu, in the same order that the - items appear within the menu. - - recursive (default: False) -- True if items contained in items within - the menu should be included - recursively (preorder).""" - - if not recursive: - return self.block - - res = [] - for item in self.block: - res.append(item) - if isinstance(item, Menu): - res.extend(item.get_items(True)) - elif isinstance(item, Choice): - res.extend(item.get_items()) - return res - - def get_symbols(self, recursive = False): - """Returns a list containing the symbols in the menu, in the same order - that they appear within the menu. - - recursive (default: False) -- True if symbols contained in items within - the menu should be included - recursively.""" - - return [item for item in self.get_items(recursive) if isinstance(item, Symbol)] - - def get_title(self): - """Returns the title text of the menu.""" - return self.title - - def get_parent(self): - """Returns the menu or choice statement that contains the menu, or - None if the menu is at the top level. Note that if statements are - treated as syntactic sugar and do not have an explicit class - representation.""" - return self.parent - - def get_referenced_symbols(self, refs_from_enclosing = False): - """See Symbol.get_referenced_symbols().""" - return self.all_referenced_syms if refs_from_enclosing else self.referenced_syms - - def get_location(self): - """Returns the location of the menu as a (filename, linenr) tuple, - where filename is a string and linenr an int.""" - return (self.filename, self.linenr) - - def __str__(self): - """Returns a string containing various information about the menu.""" - depends_on_str = self.config._expr_val_str(self.orig_deps, - "(no dependencies)") - visible_if_str = self.config._expr_val_str(self.visible_if_expr, - "(no dependencies)") - - additional_deps_str = " " + self.config._expr_val_str(self.deps_from_containing, - "(no additional dependencies)") - - return _sep_lines("Menu", - "Title : " + self.title, - "'depends on' dependencies : " + depends_on_str, - "'visible if' dependencies : " + visible_if_str, - "Additional dependencies from enclosing menus and if's:", - additional_deps_str, - "Location: {0}:{1}".format(self.filename, self.linenr)) - - # - # Private methods - # - - def __init__(self): - """Menu constructor -- not intended to be called directly by - kconfiglib clients.""" - - self.config = None - - self.parent = None - self.title = None - self.block = None - self.dep_expr = None - - # Dependency expression without dependencies from enclosing menus and - # if's propagated - self.orig_deps = None - - # Dependencies inherited from containing menus and if's - self.deps_from_containing = None - - # The 'visible if' expression - self.visible_if_expr = None - - # The set of symbols referenced by this menu (see - # get_referenced_symbols()) - self.referenced_syms = set() - - # Like 'referenced_syms', but includes symbols from - # dependencies inherited from enclosing menus and if's - self.all_referenced_syms = None - - self.filename = None - self.linenr = None - - def _make_conf(self): - item_conf = _make_block_conf(self.block) - - if self.config._eval_expr(self.dep_expr) != "n" and \ - self.config._eval_expr(self.visible_if_expr) != "n": - return ["\n#\n# {0}\n#".format(self.title)] + item_conf - return item_conf - -class Choice(Item): - - """Represents a choice statement. A choice can be in one of three modes: - - "n" - The choice is not visible and no symbols can be selected. - - "m" - Any number of symbols can be set to "m". The rest will be "n". This - is safe since potentially conflicting options don't actually get - compiled into the kernel simultaneously with "m". - - "y" - One symbol will be "y" while the rest are "n". - - Only tristate choices can be in "m" mode, and the visibility of the choice - is an upper bound on the mode, so that e.g. a choice that depends on a - symbol with value "m" will be in "m" mode. - - The mode changes automatically when a value is assigned to a symbol within - the choice. - - See Symbol.get_visibility() too.""" - - # - # Public interface - # - - def get_selection(self): - """Returns the symbol selected (either by the user or through - defaults), or None if either no symbol is selected or the mode is not - "y".""" - if self.cached_selection is not None: - if self.cached_selection == NO_SELECTION: - return None - return self.cached_selection - - if self.get_mode() != "y": - return self._cache_ret(None) - - # User choice available? - if self.user_val is not None and _get_visibility(self.user_val) == "y": - return self._cache_ret(self.user_val) - - if self.optional: - return self._cache_ret(None) - - return self._cache_ret(self.get_selection_from_defaults()) - - def get_selection_from_defaults(self): - """Like Choice.get_selection(), but acts as if no symbol has been - selected by the user and no 'optional' flag is in effect.""" - - if self.actual_symbols == []: - return None - - for symbol, cond_expr in self.def_exprs: - if self.config._eval_expr(cond_expr) != "n": - chosen_symbol = symbol - break - else: - chosen_symbol = self.actual_symbols[0] - - # Is the chosen symbol visible? - if _get_visibility(chosen_symbol) != "n": - return chosen_symbol - # Otherwise, pick the first visible symbol - for sym in self.actual_symbols: - if _get_visibility(sym) != "n": - return sym - return None - - def get_user_selection(self): - """If the choice is in "y" mode and has a user-selected symbol, returns - that symbol. Otherwise, returns None.""" - return self.user_val - - def get_config(self): - """Returns the Config instance this choice is from.""" - return self.config - - def get_name(self): - """For named choices, returns the name. Returns None for unnamed - choices. No named choices appear anywhere in the kernel Kconfig files - as of Linux 3.7.0-rc8.""" - return self.name - - def get_prompts(self): - """Returns a list of prompts defined for the choice, in the order they - appear in the configuration files. Returns the empty list for choices - with no prompt. - - This list will have a single entry for the vast majority of choices - having prompts, but having multiple prompts for a single choice is - possible through having multiple 'choice' entries for it (though I'm - not sure if that ever happens in practice).""" - return [prompt for prompt, _ in self.orig_prompts] - - def get_help(self): - """Returns the help text of the choice, or None if the choice has no - help text.""" - return self.help - - def get_type(self): - """Returns the type of the choice. See Symbol.get_type().""" - return self.type - - def get_items(self): - """Gets all items contained in the choice in the same order as within - the configuration ("items" instead of "symbols" since choices and - comments might appear within choices. This only happens in one place as - of Linux 3.7.0-rc8, in drivers/usb/gadget/Kconfig).""" - return self.block - - def get_symbols(self): - """Returns a list containing the choice's symbols. - - A quirk (perhaps a bug) of Kconfig is that you can put items within a - choice that will not be considered members of the choice insofar as - selection is concerned. This happens for example if one symbol within a - choice 'depends on' the symbol preceding it, or if you put non-symbol - items within choices. - - As of Linux 3.7.0-rc8, this seems to be used intentionally in one - place: drivers/usb/gadget/Kconfig. - - This function returns the "proper" symbols of the choice in the order - they appear in the choice, excluding such items. If you want all items - in the choice, use get_items().""" - return self.actual_symbols - - def get_parent(self): - """Returns the menu or choice statement that contains the choice, or - None if the choice is at the top level. Note that if statements are - treated as syntactic sugar and do not have an explicit class - representation.""" - return self.parent - - def get_referenced_symbols(self, refs_from_enclosing = False): - """See Symbol.get_referenced_symbols().""" - return self.all_referenced_syms if refs_from_enclosing else self.referenced_syms - - def get_def_locations(self): - """Returns a list of (filename, linenr) tuples, where filename (string) - and linenr (int) represent a location where the choice is defined. For - the vast majority of choices (all of them as of Linux 3.7.0-rc8) this - list will only contain one element, but its possible for named choices - to be defined in multiple locations.""" - return self.def_locations - - def get_visibility(self): - """Returns the visibility of the choice statement: one of "n", "m" or - "y". This acts as an upper limit on the mode of the choice (though bool - choices can only have the mode "y"). See the class documentation for an - explanation of modes.""" - return _get_visibility(self) - - def get_mode(self): - """Returns the mode of the choice. See the class documentation for - an explanation of modes.""" - minimum_mode = "n" if self.optional else "m" - mode = self.user_mode if self.user_mode is not None else minimum_mode - mode = self.config._eval_min(mode, _get_visibility(self)) - - # Promote "m" to "y" for boolean choices - if mode == "m" and self.type == BOOL: - return "y" - - return mode - - def is_optional(self): - """Returns True if the choice has the 'optional' flag set (and so will - default to "n" mode).""" - return self.optional - - def __str__(self): - """Returns a string containing various information about the choice - statement.""" - return self.config._get_sym_or_choice_str(self) - - # - # Private methods - # - - def __init__(self): - """Choice constructor -- not intended to be called directly by - kconfiglib clients.""" - - self.prompts = [] - self.cached_visibility = None - - self.config = None - - self.parent = None - self.name = None # Yes, choices can be named - self.type = UNKNOWN - self.def_exprs = [] - self.help = None - self.optional = False - self.block = None - - # The prompts and default values without any dependencies from - # enclosing menus or if's propagated - - self.orig_prompts = [] - self.orig_def_exprs = [] - - # Dependencies inherited from containing menus and if's - self.deps_from_containing = None - - # We need to filter out symbols that appear within the choice block but - # are not considered choice items (see - # Choice._determine_actual_symbols()) This list holds the "actual" choice - # items. - self.actual_symbols = [] - - # The set of symbols referenced by this choice (see - # get_referenced_symbols()) - self.referenced_syms = set() - - # Like 'referenced_syms', but includes symbols from - # dependencies inherited from enclosing menus and if's - self.all_referenced_syms = set() - - # See Choice.get_def_locations() - self.def_locations = [] - - self.user_val = None - self.user_mode = None - - self.cached_selection = None - - def _determine_actual_symbols(self): - """If a symbol's visibility depends on the preceding symbol within a - choice, it is no longer viewed as a choice item. (This is quite - possibly a bug, but some things consciously use it... ugh. It stems - from automatic submenu creation.) In addition, it's possible to have - choices and comments within choices, and those shouldn't be considered - choice items either. Only drivers/usb/gadget/Kconfig seems to depend on - any of this. This method computes the "actual" items in the choice and - sets the is_choice_symbol_ flag on them (retrieved via - is_choice_symbol()). - - Don't let this scare you: an earlier version simply checked for a - sequence of symbols where all symbols after the first appeared in the - 'depends on' expression of the first, and that worked fine. The added - complexity is to be future-proof in the event that - drivers/usb/gadget/Kconfig turns even more sinister. It might very well - be overkilling things (especially if that file is refactored ;).""" - - # Items might depend on each other in a tree structure, so we need a - # stack to keep track of the current tentative parent - stack = [] - - for item in self.block: - if not isinstance(item, Symbol): - stack = [] - continue - - while stack != []: - if item._has_auto_menu_dep_on(stack[-1]): - # The item should not be viewed as a choice item, so don't - # set item.is_choice_symbol_. - stack.append(item) - break - else: - stack.pop() - else: - item.is_choice_symbol_ = True - self.actual_symbols.append(item) - stack.append(item) - - def _cache_ret(self, selection): - # As None is used to indicate the lack of a cached value we can't use - # that to cache the fact that the choice has no selection. Instead, we - # use the symbolic constant NO_SELECTION. - if selection is None: - self.cached_selection = NO_SELECTION - else: - self.cached_selection = selection - - return selection - - def _invalidate(self): - self.cached_selection = None - self.cached_visibility = None - - def _unset_user_value(self): - self._invalidate() - self.user_val = None - self.user_mode = None - - def _make_conf(self): - return _make_block_conf(self.block) - -class Comment(Item): - - """Represents a comment statement.""" - - # - # Public interface - # - - def get_config(self): - """Returns the Config instance this comment is from.""" - return self.config - - def get_visibility(self): - """Returns the visibility of the comment. See also - Symbol.get_visibility().""" - return self.config._eval_expr(self.dep_expr) - - def get_text(self): - """Returns the text of the comment.""" - return self.text - - def get_parent(self): - """Returns the menu or choice statement that contains the comment, or - None if the comment is at the top level. Note that if statements are - treated as syntactic sugar and do not have an explicit class - representation.""" - return self.parent - - def get_referenced_symbols(self, refs_from_enclosing = False): - """See Symbol.get_referenced_symbols().""" - return self.all_referenced_syms if refs_from_enclosing else self.referenced_syms - - def get_location(self): - """Returns the location of the comment as a (filename, linenr) tuple, - where filename is a string and linenr an int.""" - return (self.filename, self.linenr) - - def __str__(self): - """Returns a string containing various information about the comment.""" - dep_str = self.config._expr_val_str(self.orig_deps, "(no dependencies)") - - additional_deps_str = " " + self.config._expr_val_str(self.deps_from_containing, - "(no additional dependencies)") - - return _sep_lines("Comment", - "Text: " + str(self.text), - "Dependencies: " + dep_str, - "Additional dependencies from enclosing menus and if's:", - additional_deps_str, - "Location: {0}:{1}".format(self.filename, self.linenr)) - - # - # Private methods - # - - def __init__(self): - """Comment constructor -- not intended to be called directly by - kconfiglib clients.""" - - self.config = None - - self.parent = None - self.text = None - self.dep_expr = None - - # Dependency expression without dependencies from enclosing menus and - # if's propagated - self.orig_deps = None - - # Dependencies inherited from containing menus and if's - self.deps_from_containing = None - - # The set of symbols referenced by this comment (see - # get_referenced_symbols()) - self.referenced_syms = set() - - # Like 'referenced_syms', but includes symbols from - # dependencies inherited from enclosing menus and if's - self.all_referenced_syms = None - - self.filename = None - self.linenr = None - - def _make_conf(self): - if self.config._eval_expr(self.dep_expr) != "n": - return ["\n#\n# {0}\n#".format(self.text)] - return [] - -class Kconfig_Syntax_Error(Exception): - """Exception raised for syntax errors.""" - pass - -class Internal_Error(Exception): - """Exception raised for internal errors.""" - pass - -# -# Public functions -# - -def tri_less(v1, v2): - """Returns True if the tristate v1 is less than the tristate v2, where "n", - "m" and "y" are ordered from lowest to highest.""" - return tri_to_int[v1] < tri_to_int[v2] - -def tri_less_eq(v1, v2): - """Returns True if the tristate v1 is less than or equal to the tristate - v2, where "n", "m" and "y" are ordered from lowest to highest.""" - return tri_to_int[v1] <= tri_to_int[v2] - -def tri_greater(v1, v2): - """Returns True if the tristate v1 is greater than the tristate v2, where - "n", "m" and "y" are ordered from lowest to highest.""" - return tri_to_int[v1] > tri_to_int[v2] - -def tri_greater_eq(v1, v2): - """Returns True if the tristate v1 is greater than or equal to the tristate - v2, where "n", "m" and "y" are ordered from lowest to highest.""" - return tri_to_int[v1] >= tri_to_int[v2] - -# -# Internal classes -# - -class _Feed(object): - - """Class for working with sequences in a stream-like fashion; handy for tokens.""" - - def __init__(self, items): - self.items = items - self.length = len(self.items) - self.i = 0 - - def get_next(self): - if self.i >= self.length: - return None - - item = self.items[self.i] - self.i += 1 - return item - - def peek_next(self): - return None if self.i >= self.length else self.items[self.i] - - def check(self, token): - """Check if the next token is 'token'. If so, remove it from the token - feed and return True. Otherwise, leave it in and return False.""" - if self.i < self.length and self.items[self.i] == token: - self.i += 1 - return True - return False - - def go_back(self): - if self.i <= 0: - _internal_error("Attempt to move back in Feed while already at the beginning.") - self.i -= 1 - - def go_to_start(self): - self.i = 0 - - def __len__(self): - return self.length - -class _FileFeed(_Feed): - - """_Feed subclass that feeds lines from a file. Joins any line ending in - \\ with the following line. Keeps track of the filename and current line - number.""" - - def __init__(self, filename): - self.filename = _clean_up_path(filename) - _Feed.__init__(self, _get_lines(filename)) - - def remove_blank(self): - """Removes lines until the first non-blank (not all-space) line.""" - while self.i < self.length and self.items[self.i].isspace(): - self.i += 1 - - def get_filename(self): - return self.filename - - def get_linenr(self): - return self.i - -# -# Internal functions -# - -def _get_visibility(sc): - """Symbols and Choices have a "visibility" that acts as an upper bound on - the values a user can set for them, corresponding to the visibility in e.g. - 'make menuconfig'. This function calculates the visibility for the Symbol - or Choice 'sc' -- the logic is nearly identical.""" - if sc.cached_visibility is None: - vis = "n" - for _, cond_expr in sc.prompts: - vis = sc.config._eval_max(vis, cond_expr) - - if isinstance(sc, Symbol) and sc.is_choice_symbol_: - vis = sc.config._eval_min(vis, _get_visibility(sc.parent)) - - # Promote "m" to "y" if we're dealing with a non-tristate - if vis == "m" and sc.type != TRISTATE: - vis = "y" - - sc.cached_visibility = vis - - return sc.cached_visibility - -def _make_and(e1, e2): - """Constructs an AND (&&) expression. Performs trivial simplification. - Nones equate to 'y'. - - Note: returns None if e1 == e2 == None.""" - if e1 == "n" or e2 == "n": - return "n" - if e1 is None or e1 == "y": - return e2 - if e2 is None or e2 == "y": - return e1 - - # Prefer to merge/update argument list if possible instead of creating - # a new AND node - - if isinstance(e1, tuple) and e1[0] == AND: - if isinstance(e2, tuple) and e2[0] == AND: - return (AND, e1[1] + e2[1]) - return (AND, e1[1] + [e2]) - - if isinstance(e2, tuple) and e2[0] == AND: - return (AND, e2[1] + [e1]) - - return (AND, [e1, e2]) - -def _make_or(e1, e2): - """Constructs an OR (||) expression. Performs trivial simplification and - avoids Nones. Nones equate to 'y', which is usually what we want, but needs - to be kept in mind.""" - - # Perform trivial simplification and avoid None's (which - # correspond to y's) - if e1 is None or e2 is None or e1 == "y" or e2 == "y": - return "y" - if e1 == "n": - return e2 - if e2 == "n": - return e1 - - # Prefer to merge/update argument list if possible instead of creating - # a new OR node - - if isinstance(e1, tuple) and e1[0] == OR: - if isinstance(e2, tuple) and e2[0] == OR: - return (OR, e1[1] + e2[1]) - return (OR, e1[1] + [e2]) - - if isinstance(e2, tuple) and e2[0] == OR: - return (OR, e2[1] + [e1]) - - return (OR, [e1, e2]) - -def _get_expr_syms(expr): - """Returns the set() of symbols appearing in expr.""" - res = set() - if expr is None: - return res - - def rec(expr): - if isinstance(expr, Symbol): - res.add(expr) - return - if isinstance(expr, str): - return - - e0 = expr[0] - if e0 == AND or e0 == OR: - for term in expr[1]: - rec(term) - elif e0 == NOT: - rec(expr[1]) - elif e0 == EQUAL or e0 == UNEQUAL: - _, v1, v2 = expr - if isinstance(v1, Symbol): - res.add(v1) - if isinstance(v2, Symbol): - res.add(v2) - else: - _internal_error("Internal error while fetching symbols from an " - "expression with token stream {0}.".format(expr)) - - rec(expr) - return res - -def _str_val(obj): - """Returns the value of obj as a string. If obj is not a string (constant - symbol), it must be a Symbol.""" - return obj if isinstance(obj, str) else obj.get_value() - -def _make_block_conf(block): - """Returns a list of .config strings for a block (list) of items.""" - - # Collect the substrings in a list and later use join() instead of += to - # build the final .config contents. With older Python versions, this yields - # linear instead of quadratic complexity. - strings = [] - for item in block: - strings.extend(item._make_conf()) - return strings - -def _sym_str_string(sym_or_str): - if isinstance(sym_or_str, str): - return '"' + sym_or_str + '"' - return sym_or_str.name - -def _intersperse(lst, op): - """_expr_to_str() helper. Gets the string representation of each expression in lst - and produces a list where op has been inserted between the elements.""" - if lst == []: - return "" - - res = [] - - def handle_sub_expr(expr): - no_parens = isinstance(expr, (str, Symbol)) or \ - expr[0] in (EQUAL, UNEQUAL) or \ - precedence[op] <= precedence[expr[0]] - if not no_parens: - res.append("(") - res.extend(_expr_to_str_rec(expr)) - if not no_parens: - res.append(")") - - op_str = op_to_str[op] - - handle_sub_expr(lst[0]) - for expr in lst[1:]: - res.append(op_str) - handle_sub_expr(expr) - - return res - -def _expr_to_str_rec(expr): - if expr is None: - return [""] - - if isinstance(expr, (Symbol, str)): - return [_sym_str_string(expr)] - - e0 = expr[0] - - if e0 == AND or e0 == OR: - return _intersperse(expr[1], expr[0]) - - if e0 == NOT: - need_parens = not isinstance(expr[1], (str, Symbol)) - - res = ["!"] - if need_parens: - res.append("(") - res.extend(_expr_to_str_rec(expr[1])) - if need_parens: - res.append(")") - return res - - if e0 == EQUAL or e0 == UNEQUAL: - return [_sym_str_string(expr[1]), - op_to_str[expr[0]], - _sym_str_string(expr[2])] - -def _expr_to_str(expr): - return "".join(_expr_to_str_rec(expr)) - -def _indentation(line): - """Returns the length of the line's leading whitespace, treating tab stops - as being spaced 8 characters apart.""" - line = line.expandtabs() - return len(line) - len(line.lstrip()) - -def _deindent(line, indent): - """Deindent 'line' by 'indent' spaces.""" - line = line.expandtabs() - if len(line) <= indent: - return line - return line[indent:] - -def _is_base_n(s, n): - try: - int(s, n) - return True - except ValueError: - return False - -def _sep_lines(*args): - """Returns a string comprised of all arguments, with newlines inserted - between them.""" - return "\n".join(args) - -def _comment(s): - """Returns a new string with "#" inserted before each line in 's'.""" - if not s: - return "#" - res = "".join(["#" + line for line in s.splitlines(True)]) - if s.endswith("\n"): - return res + "#" - return res - -def _get_lines(filename): - """Returns a list of lines from 'filename', joining any line ending in \\ - with the following line.""" - with open(filename, "r") as f: - lines = [] - accum = "" - for line in f: - if line.endswith("\\\n"): - accum += line[:-2] - else: - lines.append(accum + line) - accum = "" - return lines - -def _clean_up_path(path): - """Strips an initial "./" and any trailing slashes from 'path'.""" - if path.startswith("./"): - path = path[2:] - return path.rstrip("/") - -def _stderr_msg(msg, filename, linenr): - if filename is not None: - sys.stderr.write("{0}:{1}: ".format(_clean_up_path(filename), linenr)) - sys.stderr.write(msg + "\n") - -def _tokenization_error(s, filename, linenr): - loc = "" if filename is None else "{0}:{1}: ".format(filename, linenr) - raise Kconfig_Syntax_Error("{0}Couldn't tokenize '{1}'" - .format(loc, s.strip())) - -def _parse_error(s, msg, filename, linenr): - loc = "" if filename is None else "{0}:{1}: ".format(filename, linenr) - raise Kconfig_Syntax_Error("{0}Couldn't parse '{1}'{2}" - .format(loc, s.strip(), - "." if msg is None else ": " + msg)) - -def _internal_error(msg): - raise Internal_Error(msg + - "\nSorry! You may want to send an email to ulfalizer a.t Google's " \ - "email service to tell me about this. Include the message above " \ - "and the stack trace and describe what you were doing.") - -# -# Internal global constants -# - -# Tokens -(T_AND, T_OR, T_NOT, - T_OPEN_PAREN, T_CLOSE_PAREN, - T_EQUAL, T_UNEQUAL, - T_MAINMENU, T_MENU, T_ENDMENU, - T_SOURCE, T_CHOICE, T_ENDCHOICE, - T_COMMENT, T_CONFIG, T_MENUCONFIG, - T_HELP, T_IF, T_ENDIF, T_DEPENDS, T_ON, - T_OPTIONAL, T_PROMPT, T_DEFAULT, - T_BOOL, T_TRISTATE, T_HEX, T_INT, T_STRING, - T_DEF_BOOL, T_DEF_TRISTATE, - T_SELECT, T_RANGE, T_OPTION, T_ALLNOCONFIG_Y, T_ENV, - T_DEFCONFIG_LIST, T_MODULES, T_VISIBLE) = range(39) - -# The leading underscore before the function assignments below prevent pydoc -# from listing them. The constants could be hidden too, but they're fairly -# obviously internal anyway, so don't bother spamming the code. - -# Keyword to token map. Note that the get() method is assigned directly as a -# small optimization. -_get_keyword = { "mainmenu" : T_MAINMENU, - "menu" : T_MENU, - "endmenu" : T_ENDMENU, - "endif" : T_ENDIF, - "endchoice" : T_ENDCHOICE, - "source" : T_SOURCE, - "choice" : T_CHOICE, - "config" : T_CONFIG, - "comment" : T_COMMENT, - "menuconfig" : T_MENUCONFIG, - "help" : T_HELP, - "if" : T_IF, - "depends" : T_DEPENDS, - "on" : T_ON, - "optional" : T_OPTIONAL, - "prompt" : T_PROMPT, - "default" : T_DEFAULT, - "bool" : T_BOOL, - "boolean" : T_BOOL, - "tristate" : T_TRISTATE, - "int" : T_INT, - "hex" : T_HEX, - "def_bool" : T_DEF_BOOL, - "def_tristate" : T_DEF_TRISTATE, - "string" : T_STRING, - "select" : T_SELECT, - "range" : T_RANGE, - "option" : T_OPTION, - "allnoconfig_y" : T_ALLNOCONFIG_Y, - "env" : T_ENV, - "defconfig_list" : T_DEFCONFIG_LIST, - "modules" : T_MODULES, - "visible" : T_VISIBLE }.get - -# Strings to use for True and False -bool_str = { False : "false", True : "true" } - -# Tokens after which identifier-like lexemes are treated as strings. T_CHOICE -# is included to avoid symbols being registered for named choices. -string_lex = frozenset((T_BOOL, T_TRISTATE, T_INT, T_HEX, T_STRING, T_CHOICE, - T_PROMPT, T_MENU, T_COMMENT, T_SOURCE, T_MAINMENU)) - -# Matches the initial token on a line; see _tokenize(). -_initial_token_re_match = re.compile(r"[^\w]*(\w+)").match - -# Matches an identifier/keyword optionally preceded by whitespace -_id_keyword_re_match = re.compile(r"\s*([\w./-]+)").match - -# Regular expressions for parsing .config files -_set_re_match = re.compile(r"CONFIG_(\w+)=(.*)").match -_unset_re_match = re.compile(r"# CONFIG_(\w+) is not set").match - -# Regular expression for finding $-references to symbols in strings -_sym_ref_re_search = re.compile(r"\$[A-Za-z0-9_]+").search - -# Integers representing symbol types -UNKNOWN, BOOL, TRISTATE, STRING, HEX, INT = range(6) - -# Strings to use for types -typename = { UNKNOWN : "unknown", BOOL : "bool", TRISTATE : "tristate", - STRING : "string", HEX : "hex", INT : "int" } - -# Token to type mapping -token_to_type = { T_BOOL : BOOL, T_TRISTATE : TRISTATE, T_STRING : STRING, - T_INT : INT, T_HEX : HEX } - -# Default values for symbols of different types (the value the symbol gets if -# it is not assigned a user value and none of its 'default' clauses kick in) -default_value = { BOOL : "n", TRISTATE : "n", STRING : "", INT : "", HEX : "" } - -# Indicates that no item is selected in a choice statement -NO_SELECTION = 0 - -# Integers representing expression types -AND, OR, NOT, EQUAL, UNEQUAL = range(5) - -# Map from tristate values to integers -tri_to_int = { "n" : 0, "m" : 1, "y" : 2 } - -# Printing-related stuff - -op_to_str = { AND : " && ", OR : " || ", EQUAL : " = ", UNEQUAL : " != " } -precedence = { OR : 0, AND : 1, NOT : 2 } diff --git a/support/scripts/mkusers b/support/scripts/mkusers index e2c24c7237..d834578761 100755 --- a/support/scripts/mkusers +++ b/support/scripts/mkusers @@ -35,7 +35,7 @@ PASSWD="${TARGET_DIR}/etc/passwd" SHADOW="${TARGET_DIR}/etc/shadow" GROUP="${TARGET_DIR}/etc/group" # /etc/gshadow is not part of the standard skeleton, so not everybody -# will have it, but some may hav it, and its content must be in sync +# will have it, but some may have it, and its content must be in sync # with /etc/group, so any use of gshadow must be conditional. GSHADOW="${TARGET_DIR}/etc/gshadow" @@ -43,7 +43,7 @@ GSHADOW="${TARGET_DIR}/etc/gshadow" # such as: # BR2_DEFCONFIG="$(CONFIG_DIR)/defconfig" # which when sourced from a shell script will eventually try to execute -# a command name 'CONFIG_DIR', which is plain wrong for virtually every +# a command named 'CONFIG_DIR', which is plain wrong for virtually every # systems out there. # So, we have to scan that file instead. Sigh... :-( PASSWD_METHOD="$( sed -r -e '/^BR2_TARGET_GENERIC_PASSWD_METHOD="(.*)"$/!d;' \ diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index fad7ae9c74..421fa5cf5d 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -94,10 +94,10 @@ for i in $(find boot/ linux/ package/ -name '*.mk' | sort) ; do if test \ $i = "boot/common.mk" -o \ + $i = "linux/linux-ext-ev3dev-linux-drivers.mk" -o \ $i = "linux/linux-ext-fbtft.mk" -o \ $i = "linux/linux-ext-xenomai.mk" -o \ $i = "linux/linux-ext-rtai.mk" -o \ - $i = "package/efl/efl.mk" -o \ $i = "package/freescale-imx/freescale-imx.mk" -o \ $i = "package/gcc/gcc.mk" -o \ $i = "package/gstreamer/gstreamer.mk" -o \ diff --git a/support/scripts/pkgutil.py b/support/scripts/pkgutil.py new file mode 100644 index 0000000000..a0e2352bad --- /dev/null +++ b/support/scripts/pkgutil.py @@ -0,0 +1,62 @@ +# Copyright (C) 2010-2013 Thomas Petazzoni + +import sys +import subprocess + +# Execute the "make -show-version" command to get the version of a given +# list of packages, and return the version formatted as a Python dictionary. +def get_version(pkgs): + sys.stderr.write("Getting version for %s\n" % pkgs) + cmd = ["make", "-s", "--no-print-directory" ] + for pkg in pkgs: + cmd.append("%s-show-version" % pkg) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) + output = p.communicate()[0] + if p.returncode != 0: + sys.stderr.write("Error getting version %s\n" % pkgs) + sys.exit(1) + output = output.split("\n") + if len(output) != len(pkgs) + 1: + sys.stderr.write("Error getting version\n") + sys.exit(1) + version = {} + for i in range(0, len(pkgs)): + pkg = pkgs[i] + version[pkg] = output[i] + return version + +def _get_depends(pkgs, rule): + sys.stderr.write("Getting dependencies for %s\n" % pkgs) + cmd = ["make", "-s", "--no-print-directory" ] + for pkg in pkgs: + cmd.append("%s-%s" % (pkg, rule)) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) + output = p.communicate()[0] + if p.returncode != 0: + sys.stderr.write("Error getting dependencies %s\n" % pkgs) + sys.exit(1) + output = output.split("\n") + if len(output) != len(pkgs) + 1: + sys.stderr.write("Error getting dependencies\n") + sys.exit(1) + deps = {} + for i in range(0, len(pkgs)): + pkg = pkgs[i] + pkg_deps = output[i].split(" ") + if pkg_deps == ['']: + deps[pkg] = [] + else: + deps[pkg] = pkg_deps + return deps + +# Execute the "make -show-depends" command to get the list of +# dependencies of a given list of packages, and return the list of +# dependencies formatted as a Python dictionary. +def get_depends(pkgs): + return _get_depends(pkgs, 'show-depends') + +# Execute the "make -show-rdepends" command to get the list of +# reverse dependencies of a given list of packages, and return the +# list of dependencies formatted as a Python dictionary. +def get_rdepends(pkgs): + return _get_depends(pkgs, 'show-rdepends') diff --git a/support/scripts/pycompile.py b/support/scripts/pycompile.py new file mode 100644 index 0000000000..fde711a42a --- /dev/null +++ b/support/scripts/pycompile.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# Wrapper for python2 and python3 around compileall to raise exception +# when a python byte code generation failed. +# +# Inspired from: +# http://stackoverflow.com/questions/615632/how-to-detect-errors-from-compileall-compile-dir + +from __future__ import print_function +import sys +import py_compile +import compileall + +class ReportProblem: + def __nonzero__(self): + type, value, traceback = sys.exc_info() + if type is not None and issubclass(type, py_compile.PyCompileError): + print("Cannot compile %s" %value.file) + raise value + return 1 + +report_problem = ReportProblem() + +compileall.compile_dir(sys.argv[1], quiet=report_problem) diff --git a/support/scripts/readme.kconfiglib b/support/scripts/readme.kconfiglib deleted file mode 100644 index 4b653b8446..0000000000 --- a/support/scripts/readme.kconfiglib +++ /dev/null @@ -1,30 +0,0 @@ -Readme -====== - -Kconfiglib ----------- - -This python module, developped by Ulf Magnusson and released under the ISC -license, is fetched from: - -https://github.com/ulfalizer/Kconfiglib -commit: a95f477eafc0b6708c3ce671fce7302ecec4f789 - -Kconfiglib license -~~~~~~~~~~~~~~~~~~ - -License (ISC) - -Copyright (c) 2011-2013, Ulf Magnusson - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. diff --git a/support/scripts/scancpan b/support/scripts/scancpan index 0436d2a4b9..b6123de02d 100755 --- a/support/scripts/scancpan +++ b/support/scripts/scancpan @@ -471,7 +471,7 @@ unshift @INC, sub { } # END OF FATPACK CODE -use 5.022; # same major version as target perl +use 5.010; use strict; use warnings; use Fatal qw(open close); @@ -484,6 +484,19 @@ use HTTP::Tiny; use Safe; use MetaCPAN::API::Tiny; +# Below, 5.024 should be aligned with the version of perl actually +# bundled in Buildroot: +die <<"MSG" if $] < 5.024; +This script needs a host perl with the same major version as Buildroot target perl. + +Your current host perl is: + $^X + version $] + +You may install a local one by running: + perlbrew install perl-5.24.0 +MSG + my ($help, $man, $quiet, $force, $recommend, $test, $host); my $target = 1; GetOptions( 'help|?' => \$help, @@ -505,6 +518,7 @@ my %need_host; # name -> 1 if host package is needed my %need_dlopen; # name -> 1 if requires dynamic library my %deps_build; # name -> list of host dependencies my %deps_runtime; # name -> list of target dependencies +my %deps_optional; # name -> list of optional target dependencies my %license_files; # name -> list of license files my %checksum; # author -> list of checksum my $mcpan = MetaCPAN::API::Tiny->new(); @@ -551,10 +565,10 @@ sub find_license_files { } sub fetch { - my ($name, $need_target, $need_host) = @_; + my ($name, $need_target, $need_host, $top) = @_; $need_target{$name} = $need_target if $need_target; $need_host{$name} = $need_host if $need_host; - unless ($dist{$name}) { + unless ($dist{$name} && !$top) { say qq{fetch ${name}} unless $quiet; my $result = $mcpan->release( distribution => $name ); $dist{$name} = $result; @@ -563,21 +577,26 @@ sub fetch { $license_files{$name} = find_license_files( $manifest ); my %build = (); my %runtime = (); + my %optional = (); foreach my $dep (@{$result->{dependency}}) { my $modname = ${$dep}{module}; next if $modname eq q{perl}; next if $modname =~ m|^Alien|; next if $modname =~ m|^Win32|; - next if !$test && $modname =~ m|^Test|; + next if !($test && $top) && $modname =~ m|^Test|; next if Module::CoreList::is_core( $modname, undef, $] ); # we could use the host Module::CoreList data, because host perl and # target perl have the same major version next if ${$dep}{phase} eq q{develop}; - next if !$test && ${$dep}{phase} eq q{test}; - next if !$recommend && ${$dep}{relationship} ne q{requires}; + next if !($test && $top) && ${$dep}{phase} eq q{test}; my $distname = $mcpan->module( $modname )->{distribution}; if (${$dep}{phase} eq q{runtime}) { - $runtime{$distname} = 1; + if (${$dep}{relationship} eq q{requires}) { + $runtime{$distname} = 1; + } + else { + $optional{$distname} = 1 if $recommend && $top; + } } else { # configure, build $build{$distname} = 1; @@ -585,6 +604,7 @@ sub fetch { } $deps_build{$name} = [keys %build]; $deps_runtime{$name} = [keys %runtime]; + $deps_optional{$name} = [keys %optional]; foreach my $distname (@{$deps_build{$name}}) { fetch( $distname, 0, 1 ); } @@ -592,13 +612,16 @@ sub fetch { fetch( $distname, $need_target, $need_host ); $need_dlopen{$name} ||= $need_dlopen{$distname}; } + foreach my $distname (@{$deps_optional{$name}}) { + fetch( $distname, $need_target, $need_host ); + } } return; } foreach my $distname (@ARGV) { # Command-line's distributions - fetch( $distname, !!$target, !!$host ); + fetch( $distname, !!$target, !!$host, 1 ); } say scalar keys %dist, q{ packages fetched.} unless $quiet; @@ -683,6 +706,15 @@ while (my ($distname, $dist) = each %dist) { say {$fh} qq{${brname}_LICENSE = ${license}} if $license && $license ne q{unknown}; say {$fh} qq{${brname}_LICENSE_FILES = ${license_files}} if $license_files; say {$fh} qq{}; + foreach (sort @{$deps_optional{$distname}}) { + next if grep { $_ eq $distname; } @{$deps_runtime{$_}}; # avoid cyclic dependencies + my $opt_brname = brname( $_ ); + my $opt_fsname = fsname( $_ ); + say {$fh} qq{ifeq (\$(BR2_PACKAGE_PERL_${opt_brname}),y)}; + say {$fh} qq{${brname}_DEPENDENCIES += ${opt_fsname}}; + say {$fh} qq{endif}; + say {$fh} qq{}; + } say {$fh} qq{\$(eval \$(perl-package))} if $need_target{$distname}; say {$fh} qq{\$(eval \$(host-perl-package))} if $need_host{$distname}; close $fh; @@ -727,10 +759,6 @@ support/scripts/scancpan Try-Tiny Moo =head1 SYNOPSIS -curl -kL http://install.perlbrew.pl | bash - -perlbrew install perl-5.18.2 - supports/scripts/scancpan [options] [distname ...] Options: @@ -800,7 +828,7 @@ in order to work with the right CoreList data. =head1 LICENSE -Copyright (C) 2013-2014 by Francois Perrad +Copyright (C) 2013-2016 by Francois Perrad This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/support/scripts/scanpypi b/support/scripts/scanpypi new file mode 100755 index 0000000000..e150ae588d --- /dev/null +++ b/support/scripts/scanpypi @@ -0,0 +1,653 @@ +#!/usr/bin/python2 +""" + +Utility for building Buildroot packages for existing PyPI packages + +Any package built by scanpypi should be manually checked for +errors. +""" +from __future__ import print_function +import argparse +import json +import urllib2 +import sys +import os +import shutil +import StringIO +import tarfile +import zipfile +import errno +import hashlib +import re +import textwrap +import tempfile +import imp +from functools import wraps + +def setup_decorator(func, method): + """ + Decorator for distutils.core.setup and setuptools.setup. + Puts the arguments with which setup is called as a dict + Add key 'method' which should be either 'setuptools' or 'distutils'. + + Keyword arguments: + func -- either setuptools.setup or distutils.core.setup + method -- either 'setuptools' or 'distutils' + """ + + @wraps(func) + def closure(*args, **kwargs): + # Any python packages calls its setup function to be installed. + # Argument 'name' of this setup function is the package's name + BuildrootPackage.setup_args[kwargs['name']] = kwargs + BuildrootPackage.setup_args[kwargs['name']]['method'] = method + return closure + +# monkey patch +import setuptools +setuptools.setup = setup_decorator(setuptools.setup, 'setuptools') +import distutils +distutils.core.setup = setup_decorator(setuptools.setup, 'distutils') + +def find_file_upper_case(filenames, path='./'): + """ + List generator: + Recursively find files that matches one of the specified filenames. + Returns a relative path starting with path argument. + + Keyword arguments: + filenames -- List of filenames to be found + path -- Path to the directory to search + """ + for root, dirs, files in os.walk(path): + for file in files: + if file.upper() in filenames: + yield (os.path.join(root, file)) + + +def pkg_buildroot_name(pkg_name): + """ + Returns the Buildroot package name for the PyPI package pkg_name. + Remove all non alphanumeric characters except - + Also lowers the name and adds 'python-' suffix + + Keyword arguments: + pkg_name -- String to rename + """ + name = re.sub('[^\w-]', '', pkg_name.lower()) + prefix = 'python-' + pattern = re.compile('^(?!' + prefix + ')(.+?)$') + name = pattern.sub(r'python-\1', name) + return name + +class DownloadFailed(Exception): + pass + +class BuildrootPackage(): + """This class's methods are not meant to be used individually please + use them in the correct order: + + __init__ + + download_package + + extract_package + + load_module + + get_requirements + + create_package_mk + + create_hash_file + + create_config_in + + """ + setup_args = {} + + def __init__(self, real_name, pkg_folder): + self.real_name = real_name + self.buildroot_name = pkg_buildroot_name(self.real_name) + self.pkg_dir = os.path.join(pkg_folder, self.buildroot_name) + self.mk_name = self.buildroot_name.upper().replace('-', '_') + self.as_string = None + self.md5_sum = None + self.metadata = None + self.metadata_name = None + self.metadata_url = None + self.pkg_req = None + self.setup_metadata = None + self.tmp_extract = None + self.used_url = None + self.filename = None + self.url = None + self.version = None + + def fetch_package_info(self): + """ + Fetch a package's metadata from the python package index + """ + self.metadata_url = 'https://pypi.python.org/pypi/{pkg}/json'.format( + pkg=self.real_name) + try: + pkg_json = urllib2.urlopen(self.metadata_url).read().decode() + except urllib2.HTTPError as error: + print('ERROR:', error.getcode(), error.msg, file=sys.stderr) + print('ERROR: Could not find package {pkg}.\n' + 'Check syntax inside the python package index:\n' + 'https://pypi.python.org/pypi/ ' + .format(pkg=self.real_name)) + raise + except urllib2.URLError: + print('ERROR: Could not find package {pkg}.\n' + 'Check syntax inside the python package index:\n' + 'https://pypi.python.org/pypi/ ' + .format(pkg=self.real_name)) + raise + self.metadata = json.loads(pkg_json) + self.version = self.metadata['info']['version'] + self.metadata_name = self.metadata['info']['name'] + + def download_package(self): + """ + Download a package using metadata from pypi + """ + try: + self.metadata['urls'][0]['filename'] + except IndexError: + print( + 'Non-conventional package, ', + 'please check carefully after creation') + self.metadata['urls'] = [{ + 'packagetype': 'sdist', + 'url': self.metadata['info']['download_url'], + 'md5_digest': None}] + # In this case, we can't get the name of the downloaded file + # from the pypi api, so we need to find it, this should work + urlpath = urllib2.urlparse.urlparse( + self.metadata['info']['download_url']).path + # urlparse().path give something like + # /path/to/file-version.tar.gz + # We use basename to remove /path/to + self.metadata['urls'][0]['filename'] = os.path.basename(urlpath) + for download_url in self.metadata['urls']: + if 'bdist' in download_url['packagetype']: + continue + try: + print('Downloading package {pkg} from {url}...'.format( + pkg=self.real_name, url=download_url['url'])) + download = urllib2.urlopen(download_url['url']) + except urllib2.HTTPError as http_error: + download = http_error + else: + self.used_url = download_url + self.as_string = download.read() + if not download_url['md5_digest']: + break + self.md5_sum = hashlib.md5(self.as_string).hexdigest() + if self.md5_sum == download_url['md5_digest']: + break + else: + if download.__class__ == urllib2.HTTPError: + raise download + raise DownloadFailed('Failed to downloas package {pkg}' + .format(pkg=self.real_name)) + self.filename = self.used_url['filename'] + self.url = self.used_url['url'] + + def extract_package(self, tmp_path): + """ + Extract the package contents into a directrory + + Keyword arguments: + tmp_path -- directory where you want the package to be extracted + """ + as_file = StringIO.StringIO(self.as_string) + if self.filename[-3:] == 'zip': + with zipfile.ZipFile(as_file) as as_zipfile: + tmp_pkg = os.path.join(tmp_path, self.buildroot_name) + try: + os.makedirs(tmp_pkg) + except OSError as exception: + if exception.errno != errno.EEXIST: + print("ERROR: ", exception.message, file=sys.stderr) + return None, None + print('WARNING:', exception.message, file=sys.stderr) + print('Removing {pkg}...'.format(pkg=tmp_pkg)) + shutil.rmtree(tmp_pkg) + os.makedirs(tmp_pkg) + as_zipfile.extractall(tmp_pkg) + else: + with tarfile.open(fileobj=as_file) as as_tarfile: + tmp_pkg = os.path.join(tmp_path, self.buildroot_name) + try: + os.makedirs(tmp_pkg) + except OSError as exception: + if exception.errno != errno.EEXIST: + print("ERROR: ", exception.message, file=sys.stderr) + return None, None + print('WARNING:', exception.message, file=sys.stderr) + print('Removing {pkg}...'.format(pkg=tmp_pkg)) + shutil.rmtree(tmp_pkg) + os.makedirs(tmp_pkg) + as_tarfile.extractall(tmp_pkg) + + tmp_extract = '{folder}/{name}-{version}' + self.tmp_extract = tmp_extract.format( + folder=tmp_pkg, + name=self.metadata_name, + version=self.version) + + def load_setup(self): + """ + Loads the corresponding setup and store its metadata + """ + current_dir = os.getcwd() + os.chdir(self.tmp_extract) + sys.path.append(self.tmp_extract) + s_file, s_path, s_desc = imp.find_module('setup', [self.tmp_extract]) + setup = imp.load_module('setup', s_file, s_path, s_desc) + try: + self.setup_metadata = self.setup_args[self.metadata_name] + except KeyError: + # This means setup was not called which most likely mean that it is + # called through the if __name__ == '__main__' directive. + # In this case, we can only pray that it is called through a + # function called main() in setup.py. + setup.main([]) # Will raise AttributeError if not found + self.setup_metadata = self.setup_args[self.metadata_name] + # Here we must remove the module the hard way. + # We must do this because of a very sepcific case: if a package calls + # setup from the __main__ but does not come with a 'main()' function, + # for some reason setup.main([]) will successfully call the main + # function of a previous package... + sys.modules.pop('setup',None) + del setup + os.chdir(current_dir) + sys.path.remove(self.tmp_extract) + + def get_requirements(self, pkg_folder): + """ + Retrieve dependencies from the metadata found in the setup.py script of + a pypi package. + + Keyword Arguments: + pkg_folder -- location of the already created packages + """ + if 'install_requires' not in self.setup_metadata: + self.pkg_req = None + return set() + self.pkg_req = self.setup_metadata['install_requires'] + self.pkg_req = [re.sub('([-.\w]+).*', r'\1', req) + for req in self.pkg_req] + req_not_found = self.pkg_req + self.pkg_req = map(pkg_buildroot_name, self.pkg_req) + pkg_tuples = zip(req_not_found, self.pkg_req) + # pkg_tuples is a list of tuples that looks like + # ('werkzeug','python-werkzeug') because I need both when checking if + # dependencies already exist or are already in the download list + req_not_found = set( + pkg[0] for pkg in pkg_tuples + if not os.path.isdir(pkg[1]) + ) + return req_not_found + + def __create_mk_header(self): + """ + Create the header of the .mk file + """ + header = ['#' * 80 + '\n'] + header.append('#\n') + header.append('# {name}\n'.format(name=self.buildroot_name)) + header.append('#\n') + header.append('#' * 80 + '\n') + header.append('\n') + return header + + def __create_mk_download_info(self): + """ + Create the lines refering to the download information of the + .mk file + """ + lines = [] + version_line = '{name}_VERSION = {version}\n'.format( + name=self.mk_name, + version=self.version) + lines.append(version_line) + + targz = self.filename.replace( + self.version, + '$({name}_VERSION)'.format(name=self.mk_name)) + targz_line = '{name}_SOURCE = {filename}\n'.format( + name=self.mk_name, + filename=targz) + lines.append(targz_line) + + if self.filename not in self.url: + # Sometimes the filename is in the url, sometimes it's not + site_url = self.url + else: + site_url = self.url[:self.url.find(self.filename)] + site_line = '{name}_SITE = {url}'.format(name=self.mk_name, + url=site_url) + site_line = site_line.rstrip('/') + '\n' + lines.append(site_line) + return lines + + def __create_mk_setup(self): + """ + Create the line refering to the setup method of the package of the + .mk file + + There are two things you can use to make an installer + for a python package: distutils or setuptools + distutils comes with python but does not support dependencies. + distutils is mostly still there for backward support. + setuptools is what smart people use, + but it is not shipped with python :( + """ + lines = [] + setup_type_line = '{name}_SETUP_TYPE = {method}\n'.format( + name=self.mk_name, + method=self.setup_metadata['method']) + lines.append(setup_type_line) + return lines + + def __create_mk_license(self): + """ + Create the lines referring to the package's license informations of the + .mk file + + The license is found using the metadata from pypi. + In the metadata, the license can be found either with standard names in + the classifiers part or with naming from the packager in the "License" + part. + + From the classifiers, the license is "translated" according to + buildroot standards if need be (i.e. from Apache Software License to + Apache-2.0). + + From the License part, we cannot guess what formatting the packager + used. Hence, it is likely to be incorrect. (i.e. Apache License 2.0 + instead of Apache-2.0). + + The license's files are found by searching the package for files named + license or license.txt (case insensitive). + If more than one license file is found, the user is asked to select + which ones he wants to use. + """ + license_dict = { + 'Apache Software License': 'Apache-2.0', + 'BSD License': 'BSD', + 'European Union Public Licence 1.0': 'EUPLv1.0', + 'European Union Public Licence 1.1': 'EUPLv1.1', + "GNU General Public License": "GPL", + "GNU General Public License v2": "GPLv2", + "GNU General Public License v2 or later": "GPLv2+", + "GNU General Public License v3": "GPLv3", + "GNU General Public License v3 or later": "GPLv3+", + "GNU Lesser General Public License v2": "LGPLv2.1", + "GNU Lesser General Public License v2 or later": "LGPLv2.1+", + "GNU Lesser General Public License v3": "LGPLv3", + "GNU Lesser General Public License v3 or later": "LGPLv3+", + "GNU Library or Lesser General Public License": "LGPLv2", + "ISC License": "ISC", + "MIT License": "MIT", + "Mozilla Public License 1.0": "MPL-1.0", + "Mozilla Public License 1.1": "MPL-1.1", + "Mozilla Public License 2.0": "MPL-2.0", + "Zope Public License": "ZPL" + } + regexp = re.compile('^License :* *.* *:+ (.*)( \(.*\))?$') + classifiers_licenses = [regexp.sub(r"\1", lic) + for lic in self.metadata['info']['classifiers'] + if regexp.match(lic)] + licenses = map(lambda x: license_dict[x] if x in license_dict else x, + classifiers_licenses) + lines = [] + if not len(licenses): + print('WARNING: License has been set to "{license}". It is most' + ' likely wrong, please change it if need be'.format( + license=', '.join(licenses))) + licenses = [self.metadata['info']['license']] + license_line = '{name}_LICENSE = {license}\n'.format( + name=self.mk_name, + license=', '.join(licenses)) + lines.append(license_line) + + filenames = ['LICENCE', 'LICENSE', 'LICENSE.TXT', 'COPYING', + 'COPYING.TXT'] + license_files = list(find_file_upper_case(filenames, self.tmp_extract)) + license_files = [license.replace(self.tmp_extract, '')[1:] + for license in license_files] + if len(license_files) > 0: + if len(license_files) > 1: + print('More than one file found for license:', + ', '.join(license_files)) + license_files = [filename + for index, filename in enumerate(license_files)] + license_file_line = ('{name}_LICENSE_FILES =' + ' {files}\n'.format( + name=self.mk_name, + files=' '.join(license_files))) + lines.append(license_file_line) + else: + print('WARNING: No license file found,' + ' please specify it manually afterwards') + license_file_line = '# No license file found\n' + + return lines + + def __create_mk_requirements(self): + """ + Create the lines referring to the dependencies of the of the + .mk file + + Keyword Arguments: + pkg_name -- name of the package + pkg_req -- dependencies of the package + """ + lines = [] + dependencies_line = ('{name}_DEPENDENCIES =' + ' {reqs}\n'.format( + name=self.mk_name, + reqs=' '.join(self.pkg_req))) + lines.append(dependencies_line) + return lines + + def create_package_mk(self): + """ + Create the lines corresponding to the .mk file + """ + pkg_mk = '{name}.mk'.format(name=self.buildroot_name) + path_to_mk = os.path.join(self.pkg_dir, pkg_mk) + print('Creating {file}...'.format(file=path_to_mk)) + lines = self.__create_mk_header() + lines += self.__create_mk_download_info() + lines += self.__create_mk_setup() + lines += self.__create_mk_license() + + lines.append('\n') + lines.append('$(eval $(python-package))') + lines.append('\n') + with open(path_to_mk, 'w') as mk_file: + mk_file.writelines(lines) + + def create_hash_file(self): + """ + Create the lines corresponding to the .hash files + """ + pkg_hash = '{name}.hash'.format(name=self.buildroot_name) + path_to_hash = os.path.join(self.pkg_dir, pkg_hash) + print('Creating {filename}...'.format(filename=path_to_hash)) + lines = [] + if self.used_url['md5_digest']: + md5_comment = '# md5 from {url}, sha256 locally computed\n'.format( + url=self.metadata_url) + lines.append(md5_comment) + hash_line = '{method}\t{digest} {filename}\n'.format( + method='md5', + digest=self.used_url['md5_digest'], + filename=self.filename) + lines.append(hash_line) + digest = hashlib.sha256(self.as_string).hexdigest() + hash_line = '{method}\t{digest} {filename}\n'.format( + method='sha256', + digest=digest, + filename=self.filename) + lines.append(hash_line) + + with open(path_to_hash, 'w') as hash_file: + hash_file.writelines(lines) + + def create_config_in(self): + """ + Creates the Config.in file of a package + """ + path_to_config = os.path.join(self.pkg_dir, 'Config.in') + print('Creating {file}...'.format(file=path_to_config)) + lines = [] + config_line = 'config BR2_PACKAGE_{name}\n'.format( + name=self.mk_name) + lines.append(config_line) + + bool_line = '\tbool "{name}"\n'.format(name=self.buildroot_name) + lines.append(bool_line) + if self.pkg_req: + for dep in self.pkg_req: + dep_line = '\tselect BR2_PACKAGE_{req} # runtime\n'.format( + req=dep.upper().replace('-', '_')) + lines.append(dep_line) + + lines.append('\thelp\n') + + help_lines = textwrap.wrap(self.metadata['info']['summary'], + initial_indent='\t ', + subsequent_indent='\t ') + + # make sure a help text is terminated with a full stop + if help_lines[-1][-1] != '.': + help_lines[-1] += '.' + + # \t + two spaces is 3 char long + help_lines.append('') + help_lines.append('\t ' + self.metadata['info']['home_page']) + help_lines = map(lambda x: x + '\n', help_lines) + lines += help_lines + + with open(path_to_config, 'w') as config_file: + config_file.writelines(lines) + + +def main(): + # Building the parser + parser = argparse.ArgumentParser( + description="Creates buildroot packages from the metadata of " + "an existing PyPI packages and include it " + "in menuconfig") + parser.add_argument("packages", + help="list of packages to be created", + nargs='+') + parser.add_argument("-o", "--output", + help=""" + Output directory for packages. + Default is ./package + """, + default='./package') + + args = parser.parse_args() + packages = list(set(args.packages)) + + # tmp_path is where we'll extract the files later + tmp_prefix = 'scanpypi-' + pkg_folder = args.output + tmp_path = tempfile.mkdtemp(prefix=tmp_prefix) + try: + for real_pkg_name in packages: + package = BuildrootPackage(real_pkg_name, pkg_folder) + print('buildroot package name for {}:'.format(package.real_name), + package.buildroot_name) + # First we download the package + # Most of the info we need can only be found inside the package + print('Package:', package.buildroot_name) + print('Fetching package', package.real_name) + try: + package.fetch_package_info() + except (urllib2.URLError, urllib2.HTTPError): + continue + if package.metadata_name.lower() == 'setuptools': + # setuptools imports itself, that does not work very well + # with the monkey path at the begining + print('Error: setuptools cannot be built using scanPyPI') + continue + + try: + package.download_package() + except urllib2.HTTPError as error: + print('Error: {code} {reason}'.format(code=error.code, + reason=error.reason)) + print('Error downloading package :', package.buildroot_name) + print() + continue + + # extract the tarball + try: + package.extract_package(tmp_path) + except (tarfile.ReadError, zipfile.BadZipfile): + print('Error extracting package {}'.format(package.real_name)) + print() + continue + + # Loading the package install info from the package + try: + package.load_setup() + except ImportError as err: + if 'buildutils' in err.message: + print('This package needs buildutils') + else: + raise + continue + except AttributeError: + print('Error: Could not install package {pkg}'.format( + pkg=package.real_name)) + continue + + # Package requirement are an argument of the setup function + req_not_found = package.get_requirements(pkg_folder) + req_not_found = req_not_found.difference(packages) + + packages += req_not_found + if req_not_found: + print('Added packages \'{pkgs}\' as dependencies of {pkg}' + .format(pkgs=", ".join(req_not_found), + pkg=package.buildroot_name)) + print('Checking if package {name} already exists...'.format( + name=package.pkg_dir)) + try: + os.makedirs(package.pkg_dir) + except OSError as exception: + if exception.errno != errno.EEXIST: + print("ERROR: ", exception.message, file=sys.stderr) + continue + print('Error: Package {name} already exists' + .format(name=package.pkg_dir)) + del_pkg = raw_input( + 'Do you want to delete existing package ? [y/N]') + if del_pkg.lower() == 'y': + shutil.rmtree(package.pkg_dir) + os.makedirs(package.pkg_dir) + else: + continue + package.create_package_mk() + + package.create_hash_file() + + package.create_config_in() + print() + # printing an empty line for visual confort + finally: + shutil.rmtree(tmp_path) + +if __name__ == "__main__": + main() diff --git a/support/scripts/size-stats b/support/scripts/size-stats index 81d96caa12..af45000359 100755 --- a/support/scripts/size-stats +++ b/support/scripts/size-stats @@ -66,7 +66,7 @@ def build_package_dict(builddir): filesdict = {} with open(os.path.join(builddir, "build", "packages-file-list.txt")) as filelistf: for l in filelistf.readlines(): - pkg, fpath = l.split(",") + pkg, fpath = l.split(",", 1) # remove the initial './' in each file path fpath = fpath.strip()[2:] fullpath = os.path.join(builddir, "target", fpath) @@ -88,11 +88,20 @@ def build_package_dict(builddir): def build_package_size(filesdict, builddir): pkgsize = collections.defaultdict(int) + seeninodes = set() for root, _, files in os.walk(os.path.join(builddir, "target")): for f in files: fpath = os.path.join(root, f) if os.path.islink(fpath): continue + + st = os.stat(fpath) + if st.st_ino in seeninodes: + # hard link + continue + else: + seeninodes.add(st.st_ino) + frelpath = os.path.relpath(fpath, os.path.join(builddir, "target")) if not frelpath in filesdict: print("WARNING: %s is not part of any package" % frelpath) @@ -100,7 +109,7 @@ def build_package_size(filesdict, builddir): else: pkg = filesdict[frelpath][0] - pkgsize[pkg] += os.path.getsize(fpath) + pkgsize[pkg] += st.st_size return pkgsize diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg new file mode 100755 index 0000000000..b867da8bb8 --- /dev/null +++ b/support/scripts/test-pkg @@ -0,0 +1,188 @@ +#!/bin/bash +set -e + +TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-configs.csv' + +main() { + local o O opts + local cfg dir pkg random toolchain + local -a toolchains + + o='hc:d:p:r:' + O='help,config-snippet:build-dir:package:,random:' + opts="$( getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}" )" + eval set -- "${opts}" + + random=0 + while [ ${#} -gt 0 ]; do + case "${1}" in + (-h|--help) + help; exit 0 + ;; + (-c|--config-snippet) + cfg="${2}"; shift 2 + ;; + (-d|--build-dir) + dir="${2}"; shift 2 + ;; + (-p|--package) + pkg="${2}"; shift 2 + ;; + (-r|--random) + random="${2}"; shift 2 + ;; + (--) + shift; break + ;; + esac + done + if [ -z "${cfg}" ]; then + printf "error: no config snippet specified\n" >&2; exit 1 + fi + if [ -z "${dir}" ]; then + dir="${HOME}/br-test-pkg" + fi + + # Extract the URLs of the toolchains; drop internal toolchains + # E.g.: http://server/path/to/name.config,arch,libc + # --> http://server/path/to/name.config + toolchains=( $( curl -s "${TOOLCHAINS_URL}" \ + |sed -r -e 's/,.*//; /internal/d;' \ + |if [ ${random} -gt 0 ]; then \ + sort -R |head -n ${random} + else + cat + fi |sort + ) + ) + + if [ ${#toolchains[@]} -eq 0 ]; then + printf "error: no toolchain found (networking issue?)\n" >&2; exit 1 + fi + + for toolchain in "${toolchains[@]}"; do + build_one "${dir}" "${toolchain}" "${cfg}" "${pkg}" + done +} + +build_one() { + local dir="${1}" + local url="${2}" + local cfg="${3}" + local pkg="${4}" + local toolchain line skip + + # Using basename(1) on a URL works nicely + toolchain="$( basename "${url}" .config )" + + printf "%40s: " "${toolchain}" + + dir="${dir}/${toolchain}" + mkdir -p "${dir}" + + printf "download config" + if ! curl -s "${url}" >"${dir}/.config"; then + printf ": FAILED\n" + return + fi + + cat >>"${dir}/.config" <<-_EOF_ + BR2_INIT_NONE=y + BR2_SYSTEM_BIN_SH_NONE=y + # BR2_PACKAGE_BUSYBOX is not set + # BR2_TARGET_ROOTFS_TAR is not set + _EOF_ + cat "${cfg}" >>"${dir}/.config" + + printf ", olddefconfig" + if ! make O="${dir}" olddefconfig >/dev/null 2>&1; then + printf ": FAILED\n" + return + fi + # We want all the options from the snippet to be present as-is (set + # or not set) in the actual .config; if one of them is not, it means + # some dependency from the toolchain or arch is not available, in + # which case this config is untestable and we skip it. + skip=false + while read line; do + if ! grep "^${line}\$" "${dir}/.config" >/dev/null 2>&1; then + printf "%s\n" "${line}" + skip=true + fi + done <"${cfg}" >"${dir}/missing.config" + if ${skip}; then + printf ", SKIPPED\n" + return + fi + # Remove file, it's empty anyway. + rm -f "${dir}/missing.config" + + if [ -n "${pkg}" ]; then + printf ", dirclean" + if ! make O="${dir}" "${pkg}-dirclean" >> "${dir}/logfile" 2>&1; then + printf ": FAILED\n" + return + fi + fi + + printf ", build" + # shellcheck disable=SC2086 + if ! make O="${dir}" ${pkg} >> "${dir}/logfile" 2>&1; then + printf ": FAILED\n" + return + fi + + printf ": OK\n" +} + +help() { + cat <<_EOF_ +test-pkg: test-build a package against various toolchains and architectures + +The supplied config snippet is appended to each toolchain config, the +resulting configuration is checked to ensure it still contains all options +specified in the snippet; if any is missing, the build is skipped, on the +assumption that the package under test requires a toolchain or architecture +feature that is missing. + +In case failures are noticed, you can fix the package and just re-run the +same command again; it will re-run the test where it failed. If you did +specify a package (with -p), the package build dir will be removed first. + +The list of toolchains is retrieved from the Buildroot autobuilders, available +at ${TOOLCHAINS_URL}. + +Options: + + -h, --help + Print this help. + + -c CFG, --config-snippet CFG + Use the CFG file as the source for the config snippet. This file + should contain all the config options required to build a package. + + -d DIR, --build-dir DIR + Do the builds in directory DIR, one sub-dir per toolchain. + + -p PKG, --package PKG + Test-build the package PKG, by running 'make PKG'; if not specified, + just runs 'make'. + + -r N, --random N + Limit the tests to the N randomly selected toolchains, instead of + building with all toolchains. + +Example: + + Testing libcec would require a config snippet that contains: + BR2_PACKAGE_LIBCEC=y + + Testing libcurl with openSSL support would require a snippet such as: + BR2_PACKAGE_OPENSSL=y + BR2_PACKAGE_LIBCURL=y + +_EOF_ +} + +my_name="${0##*/}" +main "${@}" diff --git a/system/Config.in b/system/Config.in index 9441467435..3ddf8433d4 100644 --- a/system/Config.in +++ b/system/Config.in @@ -1,5 +1,35 @@ menu "System configuration" +choice + prompt "Root FS skeleton" + +config BR2_ROOTFS_SKELETON_DEFAULT + bool "default target skeleton" + help + Use default target skeleton + +config BR2_ROOTFS_SKELETON_CUSTOM + bool "custom target skeleton" + help + Use custom target skeleton. + +endchoice + +if BR2_ROOTFS_SKELETON_CUSTOM + +config BR2_ROOTFS_SKELETON_CUSTOM_PATH + string "custom target skeleton path" + help + Path to custom target skeleton. + +# dummy config so merged /usr workarounds can also be activated for +# custom rootfs skeleton +config BR2_ROOTFS_MERGED_USR + +endif + +if BR2_ROOTFS_SKELETON_DEFAULT + config BR2_TARGET_GENERIC_HOSTNAME string "System hostname" default "buildroot" @@ -18,6 +48,8 @@ config BR2_TARGET_GENERIC_ISSUE Leave empty to not create /etc/issue, or to keep the one from a custom skeleton. +endif + choice bool "Passwords encoding" default BR2_TARGET_GENERIC_PASSWD_MD5 @@ -74,6 +106,7 @@ config BR2_INIT_BUSYBOX config BR2_INIT_SYSV bool "systemV" + depends on BR2_USE_MMU # sysvinit select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # sysvinit select BR2_PACKAGE_INITSCRIPTS select BR2_PACKAGE_SYSVINIT @@ -94,8 +127,9 @@ config BR2_INIT_SYSTEMD depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10 select BR2_ROOTFS_MERGED_USR select BR2_PACKAGE_SYSTEMD + select BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW if BR2_ROOTFS_SKELETON_DEFAULT -comment "systemd needs (e)glibc toolchain, headers >= 3.10" +comment "systemd needs a glibc toolchain, headers >= 3.10" depends on !(BR2_TOOLCHAIN_USES_GLIBC \ && BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10) @@ -124,7 +158,7 @@ config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV bool "Dynamic using devtmpfs + eudev" - depends on BR2_USE_WCHAR + depends on BR2_USE_WCHAR # eudev depends on !BR2_STATIC_LIBS depends on BR2_USE_MMU # eudev select BR2_PACKAGE_EUDEV @@ -162,33 +196,10 @@ config BR2_ROOTFS_STATIC_DEVICE_TABLE See package/makedevs/README for details on the usage and syntax of these files. -choice - prompt "Root FS skeleton" - -config BR2_ROOTFS_SKELETON_DEFAULT - bool "default target skeleton" +config BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES + bool "support extended attributes in device tables" help - Use default target skeleton - -config BR2_ROOTFS_SKELETON_CUSTOM - bool "custom target skeleton" - help - Use custom target skeleton. - -endchoice - -if BR2_ROOTFS_SKELETON_CUSTOM -config BR2_ROOTFS_SKELETON_CUSTOM_PATH - string "custom target skeleton path" - default "system/skeleton" - help - Path to custom target skeleton. - -# dummy config so merged /usr workarounds can also be activated for -# custom rootfs skeleton -config BR2_ROOTFS_MERGED_USR - -endif + Support extended attributes handling in device tables if BR2_ROOTFS_SKELETON_DEFAULT @@ -265,13 +276,19 @@ config BR2_SYSTEM_BIN_SH_DASH depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS select BR2_PACKAGE_DASH +config BR2_SYSTEM_BIN_SH_MKSH + bool "mksh" + depends on BR2_USE_MMU # mksh + depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS + select BR2_PACKAGE_MKSH + config BR2_SYSTEM_BIN_SH_ZSH bool "zsh" depends on BR2_USE_MMU # zsh depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS select BR2_PACKAGE_ZSH -comment "bash, dash, zsh need BR2_PACKAGE_BUSYBOX_SHOW_OTHERS" +comment "bash, dash, mksh, zsh need BR2_PACKAGE_BUSYBOX_SHOW_OTHERS" depends on !BR2_PACKAGE_BUSYBOX_SHOW_OTHERS && BR2_PACKAGE_BUSYBOX config BR2_SYSTEM_BIN_SH_NONE @@ -284,6 +301,7 @@ config BR2_SYSTEM_BIN_SH default "busybox" if BR2_SYSTEM_BIN_SH_BUSYBOX default "bash" if BR2_SYSTEM_BIN_SH_BASH default "dash" if BR2_SYSTEM_BIN_SH_DASH + default "mksh" if BR2_SYSTEM_BIN_SH_MKSH default "zsh" if BR2_SYSTEM_BIN_SH_ZSH menuconfig BR2_TARGET_GENERIC_GETTY @@ -351,13 +369,10 @@ config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW read-only. If unsure, say Y. -endif # BR2_ROOTFS_SKELETON_DEFAULT - - config BR2_SYSTEM_DHCP string "Network interface to configure through DHCP" default "" - depends on !BR2_PACKAGE_SYSTEMD_NETWORKD && (BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN) + depends on BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN || BR2_PACKAGE_SYSTEMD_NETWORKD help Enter here the name of the network interface (E.G. eth0) to automatically configure through DHCP at bootup. @@ -367,17 +382,49 @@ config BR2_SYSTEM_DHCP For more complicated network setups use an overlay to overwrite /etc/network/interfaces or add a networkd configuration file. -comment "automatic network configuration via DHCP is not compatible with networkd" - depends on BR2_PACKAGE_SYSTEMD_NETWORKD +comment "automatic network configuration via DHCP needs ifupdown or busybox or networkd" + depends on !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN || BR2_PACKAGE_SYSTEMD_NETWORKD) -comment "automatic network configuration via DHCP needs ifupdown or busybox" - depends on !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN) +endif # BR2_ROOTFS_SKELETON_DEFAULT + +config BR2_ENABLE_LOCALE_PURGE + bool "Purge unwanted locales" + default y + help + Explicitly specify what locales to install on target. If N + then all locales supported by packages are installed. + +config BR2_ENABLE_LOCALE_WHITELIST + string "Locales to keep" + default "C en_US" + depends on BR2_ENABLE_LOCALE_PURGE + help + Whitespace seperated list of locales to allow on target. + Locales not listed here will be removed from the target. + See 'locale -a' on your host for a list of locales available + on your build host, or have a look in /usr/share/locale in + the target file system for available locales. + + Notice that listing a locale here doesn't guarantee that it + will be available on the target - That purely depends on the + support for that locale in the selected packages. + +config BR2_GENERATE_LOCALE + string "Generate locale data" + default "" + depends on \ + (BR2_TOOLCHAIN_BUILDROOT_UCLIBC && BR2_ENABLE_LOCALE) || \ + BR2_TOOLCHAIN_USES_GLIBC + help + Generate support for a list of locales. Locales can be + specified with or without encoding, when no encoding is + specified, UTF-8 is assumed. Examples of locales: en_US, + fr_FR.UTF-8. config BR2_TARGET_TZ_INFO bool "Install timezone info" - # No timezone for musl; only for uClibc or (e)glibc. - depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_UCLIBC select BR2_PACKAGE_TZDATA if BR2_TOOLCHAIN_USES_GLIBC + select BR2_PACKAGE_TZDATA if BR2_TOOLCHAIN_USES_MUSL select BR2_PACKAGE_TZ if BR2_TOOLCHAIN_USES_UCLIBC help Say 'y' here to install timezone info. @@ -391,7 +438,7 @@ config BR2_TARGET_TZ_ZONELIST Space-separated list of time zones to compile. The value "default" includes all commonly used time zones. Note - that this set consumes around 5.5M for (e)glibc and 2.1M for uClibc. + that this set consumes around 5.5M for glibc and 2.1M for uClibc. The full list is the list of files in the time zone database source, not including the build and .tab files. @@ -449,6 +496,38 @@ config BR2_ROOTFS_POST_BUILD_SCRIPT argument. Make sure the exit code of those scripts are 0, otherwise make will stop after calling them. +config BR2_ROOTFS_POST_FAKEROOT_SCRIPT + string "Custom scripts to run inside the fakeroot environment" + default "" + help + Specify a space-separated list of scripts to be run at the end + of the fakeroot script right before the image(s) are actually + generated. + + This gives users the opportunity to do customisations of the + content of the rootfs, which would otherwise require root + rights. + + These scripts are called with the target directory name as + first argument. The build will fail on the first scripts that + exits with a non-zero exit code. + + Note that Buildroot already provides mechanisms to customise + the content of the rootfs: + + - BR2_ROOTFS_STATIC_DEVICE_TABLE + to create arbitrary entries statically in /dev + + - BR2_ROOTFS_DEVICE_TABLE + to set arbitrary permissions as well as extended attributes + (such as capabilities) on files and directories, + + - BR2_ROOTFS_USERS_TABLES: + to create arbitrary users and their home directories + + It is highly recommended to use those mechanisms if possible, + rather than using custom fakeroot scripts. + config BR2_ROOTFS_POST_IMAGE_SCRIPT string "Custom scripts to run after creating filesystem images" default "" @@ -468,8 +547,10 @@ config BR2_ROOTFS_POST_IMAGE_SCRIPT source directory as the current directory. config BR2_ROOTFS_POST_SCRIPT_ARGS - string "Extra post-{build,image} arguments" - depends on BR2_ROOTFS_POST_BUILD_SCRIPT != "" || BR2_ROOTFS_POST_IMAGE_SCRIPT != "" + string "Extra arguments passed to custom scripts" + depends on BR2_ROOTFS_POST_BUILD_SCRIPT != "" \ + || BR2_ROOTFS_POST_FAKEROOT_SCRIPT != "" \ + || BR2_ROOTFS_POST_IMAGE_SCRIPT != "" help Pass these additional arguments to each post-build or post-image scripts. diff --git a/system/device_table_dev.txt b/system/device_table_dev.txt index c4257a6a2c..4f0b6377a5 100644 --- a/system/device_table_dev.txt +++ b/system/device_table_dev.txt @@ -31,6 +31,7 @@ /dev/ttyAM c 666 0 0 204 16 0 1 3 /dev/ttyCPM c 666 0 0 204 46 0 1 4 /dev/ttyAMA c 666 0 0 204 64 0 1 4 +/dev/ttyBF c 666 0 0 204 64 0 1 2 /dev/ttySAC c 666 0 0 204 64 0 1 4 /dev/ttySC c 666 0 0 204 8 0 1 8 /dev/ttyPSC c 666 0 0 204 148 0 1 4 diff --git a/system/skeleton/etc/group b/system/skeleton/etc/group index c813da2022..76346b35f2 100644 --- a/system/skeleton/etc/group +++ b/system/skeleton/etc/group @@ -22,5 +22,5 @@ plugdev:x:46: staff:x:50: lock:x:54: netdev:x:82: -nogroup:x:99: users:x:100: +nogroup:x:65534: diff --git a/system/skeleton/etc/mtab b/system/skeleton/etc/mtab index 4c0a0948bc..5c4677a608 120000 --- a/system/skeleton/etc/mtab +++ b/system/skeleton/etc/mtab @@ -1 +1 @@ -/proc/mounts \ No newline at end of file +../proc/self/mounts \ No newline at end of file diff --git a/system/skeleton/etc/network/if-pre-up.d/.empty b/system/skeleton/etc/network/if-pre-up.d/.empty deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/system/skeleton/etc/passwd b/system/skeleton/etc/passwd index 883265ad6f..d8281d2585 100644 --- a/system/skeleton/etc/passwd +++ b/system/skeleton/etc/passwd @@ -6,4 +6,4 @@ sync:x:4:100:sync:/bin:/bin/sync mail:x:8:8:mail:/var/spool/mail:/bin/false www-data:x:33:33:www-data:/var/www:/bin/false operator:x:37:37:Operator:/var:/bin/false -nobody:x:99:99:nobody:/home:/bin/false +nobody:x:65534:65534:nobody:/home:/bin/false diff --git a/system/skeleton/var/lib/pcmcia b/system/skeleton/var/lib/pcmcia deleted file mode 120000 index f1fde8c107..0000000000 --- a/system/skeleton/var/lib/pcmcia +++ /dev/null @@ -1 +0,0 @@ -../../tmp \ No newline at end of file diff --git a/system/skeleton/var/pcmcia b/system/skeleton/var/pcmcia deleted file mode 120000 index 1431b0e432..0000000000 --- a/system/skeleton/var/pcmcia +++ /dev/null @@ -1 +0,0 @@ -../tmp \ No newline at end of file diff --git a/system/skeleton/var/run b/system/skeleton/var/run index 1431b0e432..84ba55b912 120000 --- a/system/skeleton/var/run +++ b/system/skeleton/var/run @@ -1 +1 @@ -../tmp \ No newline at end of file +../run \ No newline at end of file diff --git a/toolchain/Config.in b/toolchain/Config.in index e0044c14f8..de01585670 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -15,9 +15,11 @@ config BR2_TOOLCHAIN_USES_GLIBC select BR2_TOOLCHAIN_HAS_THREADS_DEBUG select BR2_TOOLCHAIN_HAS_THREADS_NPTL select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS + select BR2_TOOLCHAIN_SUPPORTS_PIE config BR2_TOOLCHAIN_USES_UCLIBC bool + select BR2_TOOLCHAIN_SUPPORTS_PIE if !BR2_m68k && !BR2_microblaze && !BR2_STATIC_LIBS config BR2_TOOLCHAIN_USES_MUSL bool @@ -26,6 +28,7 @@ config BR2_TOOLCHAIN_USES_MUSL select BR2_TOOLCHAIN_HAS_THREADS select BR2_TOOLCHAIN_HAS_THREADS_DEBUG select BR2_TOOLCHAIN_HAS_THREADS_NPTL + select BR2_TOOLCHAIN_SUPPORTS_PIE choice prompt "Toolchain type" @@ -38,8 +41,11 @@ choice config BR2_TOOLCHAIN_BUILDROOT bool "Buildroot toolchain" - depends on !BR2_bfin select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS + depends on !BR2_bf606 + depends on !BR2_bf607 + depends on !BR2_bf608 + depends on !BR2_bf609 config BR2_TOOLCHAIN_EXTERNAL bool "External toolchain" diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index b3510b6e0b..72e7292353 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -50,22 +50,10 @@ copy_toolchain_lib_root = \ # corresponding architecture variants), and we don't want to import # them. # -# Then, we need to support two types of multilib toolchains: +# Then, if the selected architecture variant is not the default one +# (i.e, if SYSROOT_DIR != ARCH_SYSROOT_DIR), then we : # -# - The toolchains that have nested sysroots: a main sysroot, and -# then additional sysroots available as subdirectories of the main -# one. This is for example used by Sourcery CodeBench toolchains. -# -# - The toolchains that have side-by-side sysroots. Each sysroot is a -# complete one, they simply leave one next to each other. This is -# for example used by MIPS Codescape toolchains. -# -# So, we first detect if the selected architecture variant is not the -# default one (i.e, if SYSROOT_DIR != ARCH_SYSROOT_DIR). -# -# If we are in the situation of a nested sysroot, we: -# -# * If needed, import the header files from the default architecture +# * Import the header files from the default architecture # variant. Header files are typically shared between the sysroots # for the different architecture variants. If we use the # non-default one, header files were not copied by the previous @@ -79,14 +67,10 @@ copy_toolchain_lib_root = \ # non-default architecture variant is used. Without this, the # compiler fails to find libraries and headers. # -# If we are in the situation of a side-by-side sysroot, we: -# -# * Create a symbolic link -# -# Finally, some toolchains (i.e Linaro binary toolchains) store -# support libraries (libstdc++, libgcc_s) outside of the sysroot, so -# we simply copy all the libraries from the "support lib directory" -# into our sysroot. +# Some toolchains (i.e Linaro binary toolchains) store support +# libraries (libstdc++, libgcc_s) outside of the sysroot, so we simply +# copy all the libraries from the "support lib directory" into our +# sysroot. # # Note that the 'locale' directories are not copied. They are huge # (400+MB) in CodeSourcery toolchains, and they are not really useful. @@ -111,25 +95,18 @@ copy_toolchain_sysroot = \ $${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \ fi ; \ done ; \ - SYSROOT_DIR_CANON=`readlink -f $${SYSROOT_DIR}` ; \ - ARCH_SYSROOT_DIR_CANON=`readlink -f $${ARCH_SYSROOT_DIR}` ; \ - if [ $${SYSROOT_DIR_CANON} != $${ARCH_SYSROOT_DIR_CANON} ] ; then \ - relpath="./" ; \ - if [ $${ARCH_SYSROOT_DIR_CANON:0:$${\#SYSROOT_DIR_CANON}} == $${SYSROOT_DIR_CANON} ] ; then \ - if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \ - cp -a $${SYSROOT_DIR}/usr/include $(STAGING_DIR)/usr ; \ - fi ; \ - mkdir -p `dirname $(STAGING_DIR)/$${ARCH_SUBDIR}` ; \ - nbslashs=`printf $${ARCH_SUBDIR} | sed 's%[^/]%%g' | wc -c` ; \ - for slash in `seq 1 $${nbslashs}` ; do \ - relpath=$${relpath}"../" ; \ - done ; \ - ln -s $${relpath} $(STAGING_DIR)/$${ARCH_SUBDIR} ; \ - echo "Symlinking $(STAGING_DIR)/$${ARCH_SUBDIR} -> $${relpath}" ; \ - elif [ `dirname $${ARCH_SYSROOT_DIR_CANON}` == `dirname $${SYSROOT_DIR_CANON}` ] ; then \ - ln -snf $${relpath} $(STAGING_DIR)/`basename $${ARCH_SYSROOT_DIR_CANON}` ; \ - echo "Symlinking $(STAGING_DIR)/`basename $${ARCH_SYSROOT_DIR_CANON}` -> $${relpath}" ; \ + if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \ + if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \ + cp -a $${SYSROOT_DIR}/usr/include $(STAGING_DIR)/usr ; \ fi ; \ + mkdir -p `dirname $(STAGING_DIR)/$${ARCH_SUBDIR}` ; \ + relpath="./" ; \ + nbslashs=`printf $${ARCH_SUBDIR} | sed 's%[^/]%%g' | wc -c` ; \ + for slash in `seq 1 $${nbslashs}` ; do \ + relpath=$${relpath}"../" ; \ + done ; \ + ln -s $${relpath} $(STAGING_DIR)/$${ARCH_SUBDIR} ; \ + echo "Symlinking $(STAGING_DIR)/$${ARCH_SUBDIR} -> $${relpath}" ; \ fi ; \ if test -n "$${SUPPORT_LIB_DIR}" ; then \ cp -a $${SUPPORT_LIB_DIR}/* $(STAGING_DIR)/lib/ ; \ @@ -168,8 +145,7 @@ check_kernel_headers_version = \ check_gcc_version = \ expected_version="$(strip $2)" ; \ if [ -z "$${expected_version}" ]; then \ - printf "Internal error, gcc version unknown (no GCC_AT_LEAST_X_Y selected)\n"; \ - exit 1 ; \ + exit 0 ; \ fi; \ real_version=`$(1) --version | sed -r -e '1!d; s/^[^)]+\) ([^[:space:]]+).*/\1/;'` ; \ if [[ ! "$${real_version}" =~ ^$${expected_version}\. ]] ; then \ @@ -333,6 +309,24 @@ check_cplusplus = \ exit 1 ; \ fi +# +# +# Check that the external toolchain supports Fortran +# +# $1: cross-gfortran path +# +check_fortran = \ + __CROSS_FC=$(strip $1) ; \ + __o=$(BUILD_DIR)/.br-toolchain-test-fortran.tmp ; \ + printf 'program hello\n\tprint *, "Hello Fortran!\\n"\nend program hello\n' | \ + $${__CROSS_FC} -x f95 -o $${__o} - ; \ + if test $$? -ne 0 ; then \ + rm -f $${__o}* ; \ + echo "Fortran support is selected but is not available in external toolchain" ; \ + exit 1 ; \ + fi ; \ + rm -f $${__o}* \ + # # Check that the cross-compiler given in the configuration exists # diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in index 0c4080111a..91cddc2374 100644 --- a/toolchain/toolchain-buildroot/Config.in +++ b/toolchain/toolchain-buildroot/Config.in @@ -2,6 +2,8 @@ if BR2_TOOLCHAIN_BUILDROOT +comment "Toolchain Buildroot Options" + config BR2_TOOLCHAIN_BUILDROOT_VENDOR string "custom toolchain vendor name" default "buildroot" @@ -18,49 +20,25 @@ config BR2_TOOLCHAIN_BUILDROOT_VENDOR If you're not sure, just leave the default "buildroot" value. -source "package/linux-headers/Config.in.host" - choice prompt "C library" default BR2_TOOLCHAIN_UCLIBC - default BR2_TOOLCHAIN_BUILDROOT_GLIBC if BR2_aarch64 || BR2_aarch64_be \ - || BR2_microblaze || BR2_powerpc64 + default BR2_TOOLCHAIN_BUILDROOT_GLIBC if BR2_powerpc64 config BR2_TOOLCHAIN_BUILDROOT_UCLIBC - bool "uClibc" + bool "uClibc-ng" select BR2_TOOLCHAIN_USES_UCLIBC - depends on BR2_arcle || BR2_arceb || BR2_arm || BR2_armeb || \ - BR2_bfin || BR2_i386 || BR2_m68k || \ + depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle || BR2_arceb || \ + BR2_arm || BR2_armeb || \ + BR2_bfin || BR2_i386 || BR2_m68k || BR2_microblaze || \ BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el || \ - BR2_powerpc || BR2_sh2a || BR2_sh4 || BR2_sh4eb || \ - BR2_sparc || BR2_xtensa || BR2_x86_64 - # Unsupported for MIPS R6 - depends on !BR2_mips_32r6 && !BR2_mips_64r6 + BR2_or1k || BR2_powerpc || BR2_sh2a || BR2_sh4 || \ + BR2_sh4eb || BR2_sparc || BR2_xtensa || BR2_x86_64 help - This option selects uClibc as the C library for the + This option selects uClibc-ng as the C library for the cross-compilation toolchain. - http://uclibc.org - -config BR2_TOOLCHAIN_BUILDROOT_EGLIBC - bool "eglibc" - depends on BR2_arm || BR2_armeb || BR2_aarch64 || \ - BR2_aarch64_be || BR2_i386 || BR2_mips || \ - BR2_mipsel || BR2_mips64 || BR2_mips64el || \ - BR2_powerpc || BR2_sh || BR2_sh64 || \ - BR2_sparc || BR2_x86_64 || BR2_microblaze || \ - BR2_powerpc64 - depends on BR2_USE_MMU - depends on !BR2_STATIC_LIBS - depends on BR2_DEPRECATED_SINCE_2015_08 - select BR2_TOOLCHAIN_USES_GLIBC - # our eglibc.mk enables RPC support - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - help - This option selects eglibc as the C library for the - cross-compilation toolchain. - - http://eglibc.org + http://uclibc-ng.org config BR2_TOOLCHAIN_BUILDROOT_GLIBC bool "glibc" @@ -68,8 +46,8 @@ config BR2_TOOLCHAIN_BUILDROOT_GLIBC BR2_aarch64_be || BR2_i386 || BR2_mips || \ BR2_mipsel || BR2_mips64 || BR2_mips64el|| \ BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le || \ - BR2_sh || BR2_sh64 || BR2_sparc64 || \ - BR2_x86_64 || BR2_microblaze || BR2_nios2 + BR2_sh || BR2_sparc64 || BR2_x86_64 || \ + BR2_microblaze || BR2_nios2 depends on BR2_USE_MMU depends on !BR2_STATIC_LIBS depends on !BR2_powerpc_SPE @@ -82,18 +60,17 @@ config BR2_TOOLCHAIN_BUILDROOT_GLIBC http://www.gnu.org/software/libc/ -comment "(e)glibc only available with shared lib support" +comment "glibc only available with shared lib support" depends on BR2_USE_MMU depends on BR2_STATIC_LIBS config BR2_TOOLCHAIN_BUILDROOT_MUSL - bool "musl (experimental)" - depends on BR2_aarch64 || BR2_arm || BR2_armeb || BR2_i386 || \ - BR2_microblaze || BR2_mips || BR2_mipsel || BR2_powerpc || \ - BR2_sh || BR2_x86_64 + bool "musl" + depends on BR2_aarch64 || BR2_arm || BR2_armeb || BR2_i386 || \ + BR2_microblaze || BR2_mips || BR2_mipsel || BR2_mips64 || \ + BR2_mips64el || BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le || \ + BR2_sh || BR2_x86_64 depends on !BR2_powerpc_SPE # not supported, build breaks - # Unsupported for MIPS R6 - depends on !BR2_mips_32r6 && !BR2_mips_64r6 # sh2 nommu is supported by musl, but we don't have support # for it in Buildroot. depends on BR2_USE_MMU @@ -107,12 +84,10 @@ endchoice config BR2_TOOLCHAIN_BUILDROOT_LIBC string default "uclibc" if BR2_TOOLCHAIN_BUILDROOT_UCLIBC - # Both glibc and eglibc are handled by the package called - # 'glibc' - default "glibc" if BR2_TOOLCHAIN_BUILDROOT_EGLIBC default "glibc" if BR2_TOOLCHAIN_BUILDROOT_GLIBC default "musl" if BR2_TOOLCHAIN_BUILDROOT_MUSL +source "package/linux-headers/Config.in.host" source "package/linux-headers/Config.in" source "package/musl/Config.in" source "package/uclibc/Config.in" diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in index be02484a76..96d5709763 100644 --- a/toolchain/toolchain-common.in +++ b/toolchain/toolchain-common.in @@ -5,6 +5,19 @@ # so put it here instead source "package/gdb/Config.in.host" +comment "Toolchain Generic Options" + +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64735 +# exception_ptr, nested_exception, and future from libstdc++ are not +# available for architectures not supporting always lock-free atomic +# ints before GCC 7 +config BR2_TOOLCHAIN_HAS_GCC_BUG_64735 + bool + default y if BR2_nios2 + default y if BR2_ARM_CPU_ARMV4 + default y if BR2_ARM_CPU_ARMV5 + default y if BR2_sparc_v8 + # https://sourceware.org/bugzilla/show_bug.cgi?id=19405 config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_19405 bool @@ -21,6 +34,9 @@ config BR2_ENABLE_LOCALE config BR2_INSTALL_LIBSTDCPP bool +config BR2_TOOLCHAIN_HAS_FORTRAN + bool + config BR2_TOOLCHAIN_HAS_THREADS bool @@ -36,38 +52,8 @@ config BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS config BR2_TOOLCHAIN_HAS_SSP bool -config BR2_ENABLE_LOCALE_PURGE - bool "Purge unwanted locales" - help - Explicitly specify what locales to install on target. If N - then all locales supported by packages are installed. - -config BR2_ENABLE_LOCALE_WHITELIST - string "Locales to keep" - default "C en_US de fr" - depends on BR2_ENABLE_LOCALE_PURGE - help - Whitespace seperated list of locales to allow on target. - Locales not listed here will be removed from the target. - See 'locale -a' on your host for a list of locales available - on your build host, or have a look in /usr/share/locale in - the target file system for available locales. - - Notice that listing a locale here doesn't guarantee that it - will be available on the target - That purely depends on the - support for that locale in the selected packages. - -config BR2_GENERATE_LOCALE - string "Generate locale data" - default "" - depends on \ - (BR2_TOOLCHAIN_BUILDROOT_UCLIBC && BR2_ENABLE_LOCALE) || \ - BR2_TOOLCHAIN_USES_GLIBC - help - Generate support for a list of locales. Locales can be - specified with or without encoding, when no encoding is - specified, UTF-8 is assumed. Examples of locales: en_US, - fr_FR.UTF-8. +config BR2_TOOLCHAIN_SUPPORTS_PIE + bool config BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY bool "Copy gconv libraries" @@ -241,10 +227,30 @@ config BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5 bool select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_4 +config BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_6 + bool + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5 + +config BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_7 + bool + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_6 + +config BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8 + bool + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_7 + +config BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_9 + bool + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8 + # This order guarantees that the highest version is set, as kconfig # stops affecting a value on the first matching default. config BR2_TOOLCHAIN_HEADERS_AT_LEAST string + default "4.9" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_9 + default "4.8" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8 + default "4.7" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_7 + default "4.6" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_6 default "4.5" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5 default "4.4" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_4 default "4.3" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_3 @@ -326,6 +332,7 @@ config BR2_TOOLCHAIN_HAS_SYNC_1 bool default y depends on !BR2_bfin + depends on !BR2_m68k_cf depends on !BR2_microblaze depends on !BR2_sparc depends on !(BR2_arc && !BR2_ARC_ATOMIC_EXT) @@ -337,6 +344,7 @@ config BR2_TOOLCHAIN_HAS_SYNC_2 config BR2_TOOLCHAIN_HAS_SYNC_4 bool default y + depends on !BR2_m68k_cf depends on !BR2_sparc depends on !(BR2_arc && !BR2_ARC_ATOMIC_EXT) @@ -385,11 +393,14 @@ config BR2_TOOLCHAIN_HAS_SYNC_8 default y if BR2_TOOLCHAIN_X86_HAS_SYNC_8 # libatomic is available since gcc 4.8, when thread support is -# enabled. +# enabled. Also, libatomic doesn't recognize "uclinux" as a valid OS +# part of the tuple, and is therefore not build on uclinux targets, +# which is why BR2_BINFMT_FLAT configurations are excluded. config BR2_TOOLCHAIN_HAS_LIBATOMIC bool default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 && \ - BR2_TOOLCHAIN_HAS_THREADS + BR2_TOOLCHAIN_HAS_THREADS && \ + !BR2_BINFMT_FLAT # __atomic intrinsics are available: # - with gcc 4.8, either through built-ins or libatomic, on all @@ -412,3 +423,13 @@ config BR2_TOOLCHAIN_HAS_ATOMIC default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_armeb default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_xtensa default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_ARCH_IS_64 + +# - libquadmath is not needed/available on all architectures (but gcc +# correctly handles this already). +# - At least, libquadmath is available on: +# - i*86 +# - x86_64 +# - When available, libquadmath requires wchar support. +config BR2_TOOLCHAIN_HAS_LIBQUADMATH + bool + default y if BR2_i386 || BR2_x86_64 diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in index 8a8195d57e..35db582498 100644 --- a/toolchain/toolchain-external/Config.in +++ b/toolchain/toolchain-external/Config.in @@ -1,636 +1,49 @@ if BR2_TOOLCHAIN_EXTERNAL +comment "Toolchain External Options" + choice prompt "Toolchain" -comment "(e)glibc toolchains only available with shared lib support" +comment "glibc toolchains only available with shared lib support" depends on BR2_STATIC_LIBS -comment "Linaro toolchains available for Cortex-A + EABIhf" - depends on BR2_arm || BR2_armeb - depends on !BR2_ARM_CPU_ARMV7A || !BR2_ARM_EABIHF - depends on !BR2_STATIC_LIBS +# Kept toolchains sorted by architecture in order to use some toolchain +# as default choice -# Note: we use the same symbol for both Linaro toolchains. -# Since they have different dependencies (the host), we can -# give them different prompts and different help texts. -config BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM - bool "Linaro ARM 2014.09" - depends on BR2_arm - depends on BR2_ARM_CPU_ARMV7A - depends on BR2_HOSTARCH = "x86" - depends on BR2_ARM_EABIHF - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_1 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 - help - Linaro toolchain for the ARM architecture. It uses Linaro - GCC 2014.09 (based on gcc 4.9), Linaro GDB 2013.10 (based on - GDB 7.6), eglibc 2.19, Binutils 2014.09 (based on 2.24). It - generates code that runs on all Cortex-A profile devices, - but tuned for the Cortex-A9. The code generated is Thumb 2, - with the hard floating point calling convention, and uses - the VFPv3-D16 FPU instructions. +# Aarch64 (use Linaro toolchain by default) +source "toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in" +source "toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/Config.in" -# See the note above. -config BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM - bool "Linaro ARM 2016.02" - depends on BR2_arm - depends on BR2_ARM_CPU_ARMV7A - depends on BR2_HOSTARCH = "x86_64" - depends on BR2_ARM_EABIHF - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 - select BR2_TOOLCHAIN_GCC_AT_LEAST_5 - help - Linaro toolchain for the ARM architecture. It uses Linaro - GCC 2016.02 (based on gcc 5.3), Linaro GDB 2016.02 (based on - GDB 7.10), glibc 2.21, Binutils 2015.10 (based on 2.25). It - generates code that runs on all Cortex-A profile devices, - but tuned for the Cortex-A9. The code generated is Thumb 2, - with the hard floating point calling convention, and uses - the VFPv3-D16 FPU instructions. +# ARC +source "toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in" -# See the note above. -config BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB - bool "Linaro armeb 2014.09" - depends on BR2_armeb - depends on BR2_ARM_CPU_ARMV7A - depends on BR2_HOSTARCH = "x86" - depends on BR2_ARM_EABIHF - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_1 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 - help - Linaro toolchain for the ARM big endian architecture. It - uses Linaro GCC 2014.09 (based on gcc 4.9), Linaro GDB - 2013.10 (based on GDB 7.6), eglibc 2.19, Binutils 2014.09 - (based on 2.24). It generates code that runs on all Cortex-A - profile devices, but tuned for the Cortex-A9. The code - generated is Thumb 2, with the hard floating point calling - convention, and uses the VFPv3-D16 FPU instructions. +# ARM (use Linaro toolchain by default) +source "toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in" +source "toolchain/toolchain-external/toolchain-external-codesourcery-arm/Config.in" -# See the note above. -config BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB - bool "Linaro armeb 2016.02" - depends on BR2_armeb - depends on BR2_ARM_CPU_ARMV7A - depends on BR2_HOSTARCH = "x86_64" - depends on BR2_ARM_EABIHF - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 - select BR2_TOOLCHAIN_GCC_AT_LEAST_5 - help - Linaro toolchain for the ARM big endian architecture. It - uses Linaro GCC 2016.02 (based on gcc 5.3), Linaro GDB - 2016.02 (based on GDB 7.10), glibc 2.21, Binutils 2015.10 - (based on 2.25). It generates code that runs on all Cortex-A - profile devices, but tuned for the Cortex-A9. The code - generated is Thumb 2, with the hard floating point calling - convention, and uses the VFPv3-D16 FPU instructions. +# ARM big-endian +source "toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in" -config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM - bool "Sourcery CodeBench ARM 2014.05" - depends on BR2_arm - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on BR2_ARM_EABI - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 - help - Sourcery CodeBench toolchain for the ARM architecture, from - Mentor Graphics. It uses gcc 4.8.3, binutils 2.24.51, glibc - 2.18 and gdb 7.7.50, kernel headers 3.13. It has support - for the following variants: - - ARMv5TE, little endian, soft-float, glibc - Select ARM926T, ARM10T, XScale or another ARMv5 core - Select BR2_SOFT_FLOAT - - ARMv4T, little endian, soft-float, glibc - Select ARM720T, ARM920T, ARM922T or another ARMv4 core - Select BR2_SOFT_FLOAT - - ARMv7-A, Thumb 2, little endian, soft-float, glibc - Select Cortex-A8, Cortex-A9 or another ARMv7-A core - Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -mthumb +# MIPS (use codesourcery toolchain by default) +source "toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in" +source "toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in" +source "toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in" -comment "Sourcery CodeBench toolchains available for the EABI ABI" - depends on BR2_arm - depends on !BR2_ARM_EABI - depends on !BR2_STATIC_LIBS +# NIOSII +source "toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in" -config BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV7A - bool "Arago ARMv7 2011.09" - depends on BR2_arm - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on BR2_ARM_CPU_ARMV7A - depends on BR2_ARM_EABI - depends on BR2_ARM_CPU_HAS_VFPV3 - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 - # kernel headers: 2.6.31 - help - Texas Instruments Arago 2011.09 toolchain, with gcc 4.5.3, - binutils 2.20.1, glibc 2.12, gdb 7.2. +# SH4a +source "toolchain/toolchain-external/toolchain-external-codesourcery-sh/Config.in" - This toolchain uses -mfloat-abi=softfp (i.e can use FPU - instructions, but passes floating point function arguments - in integer registers), and requires a VFPv3 floating point - unit to work properly. This unit is available on most - Cortex-A ARM processors, but not all. +# x86/x86_64 (use amd64 toolchain by default for AMD64) +source "toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Config.in" +source "toolchain/toolchain-external/toolchain-external-codesourcery-x86/Config.in" -config BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE - bool "Arago ARMv5 2011.09" - depends on BR2_arm - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on !BR2_ARM_CPU_ARMV4 - depends on BR2_ARM_EABI - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 - # kernel headers: 2.6.31 - help - Texas Instruments Arago ARMv5 2011.09 toolchain, with gcc - 4.5.3, binutils 2.20.1, glibc 2.12, gdb 7.2. - - This toolchain uses software-floating point. - -config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS - bool "Sourcery CodeBench MIPS 2016.05" - depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el - depends on BR2_mips_32r2 || BR2_mips_64r2 - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on !BR2_MIPS_NABI32 - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_4 - select BR2_TOOLCHAIN_GCC_AT_LEAST_5 - help - Sourcery CodeBench toolchain for the MIPS architecture, from - Mentor Graphics. It uses gcc 5.3, binutils 2.25.51, glibc - 2.23, uClibc 0.9.30 and gdb 7.10.50, kernel headers 4.4.1. It - has support for the following variants: - - MIPS32r2 - Big-Endian, 2008 NaN, O32 - Select MIPS (big endian) core - Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -mnan=2008 - - MIPS32r2 - Big-Endian, O32 - Select MIPS (big endian) core - Disable BR2_SOFT_FLOAT - - MIPS32r2 - Big-Endian, O32, MIPS16 - Select MIPS (big endian) core - Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -mips16 - - MIPS32r2 - Big-Endian, Soft-Float, O32 - Select MIPS (big endian) core - Select BR2_SOFT_FLOAT - - MIPS32r2 - Big-Endian, Soft-Float, O32, MIPS16 - Select MIPS (big endian) core - Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -mips16 - - MIPS32r2 - Little-Endian, 2008 NaN, O32 - Select MIPS (little endian) core - Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -mnan=2008 - - MIPS32r2 - Little-Endian, O32 - Select MIPS (little endian) core - Disable BR2_SOFT_FLOAT - - MIPS32r2 - Little-Endian, O32, MIPS16 - Select MIPS (little endian) core - Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -mips16 - - MIPS32r2 - Little-Endian, Soft-Float, O32 - Select MIPS (little endian) core - Select BR2_SOFT_FLOAT - - MIPS32r2 - Little-Endian, Soft-Float, O32, MIPS16 - Select MIPS (little endian) core - Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -mips16 - - MIPS32r2 - Little-Endian, Soft-Float, O32, microMIPS - Select MIPS (little endian) core - Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -mmicromips - - MIPS32r2 - uClibc, Big-Endian, 2008 NaN, O32 - Not usable in Buildroot yet. - - MIPS32r2 - uClibc, Big-Endian, O32 - Not usable in Buildroot yet. - - MIPS32r2 - uClibc, Big-Endian, Soft-Float, O32 - Not usable in Buildroot yet. - - MIPS32r2 - uClibc, Little-Endian, 2008 NaN, O32 - Not usable in Buildroot yet. - - MIPS32r2 - uClibc, Little-Endian, O32 - Not usable in Buildroot yet. - - MIPS32r2 - uClibc, Little-Endian, Soft-Float, O32 - Not usable in Buildroot yet. - - MIPS64r2 - Big-Endian, N64 - Select MIPS64 (big endian) core - Select the n64 ABI - Disable BR2_SOFT_FLOAT - - MIPS64r2 - Big-Endian, Soft-Float, N64 - Select MIPS64 (big endian) core - Select the n64 ABI - Select BR2_SOFT_FLOAT - - MIPS64r2 - Little-Endian, N64 - Select MIPS64 (little endian) core - Select the n64 ABI - Disable BR2_SOFT_FLOAT - - MIPS64r2 - Little-Endian, Soft-Float, N64 - Select MIPS64 (little endian) core - Select the n64 ABI - Select BR2_SOFT_FLOAT - -comment "Sourcery CodeBench toolchains are only available for MIPS/MIPS64 o32 and n64" - depends on BR2_MIPS_NABI32 - depends on !BR2_STATIC_LIBS - -config BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS - bool "Codescape IMG GNU Linux Toolchain 2015.10" - depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on BR2_mips_32r6 || (BR2_mips_64r6 && !BR2_MIPS_SOFT_FLOAT) - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 - help - Codescape IMG GNU Linux Toolchain 2015.10 for the MIPS - architecture, from Imagination Technologies. It uses gcc - 4.9.2, binutils 2.24.90, glibc 2.20, gdb 7.9.1 and kernel - headers 4.0. It has support for the following variants: - - MIPS32r6 - Big-Endian, Hard-Float, 2008 NaN, o32 ABI - Select 'MIPS (big endian)' Target Architecture - Select 'mips 32r6' Target Architecture Variant - Disable 'Use soft-float' - - MIPS32r6 - Big-Endian, Soft-Float, 2008 NaN, o32 ABI - Select 'MIPS (big endian)' Target Architecture - Select 'mips 32r6' Target Architecture Variant - Enable 'Use soft-float' - - MIPS32r6 - Little-Endian, Hard-Float, 2008 NaN, o32 ABI - Select 'MIPS (little endian)' Target Architecture - Select 'mips 32r6' Target Architecture Variant - Disable 'Use soft-float' - - MIPS32r6 - Little-Endian, Soft-Float, 2008 NaN, o32 ABI - Select 'MIPS (little endian)' Target Architecture - Select 'mips 32r6' Target Architecture Variant - Enable 'Use soft-float' - - MIPS32r6 - Little-Endian, Hard-Float, 2008 NaN, o32 ABI, microMIPS - Select 'MIPS (little endian)' Target Architecture - Select 'mips 32r6' Target Architecture Variant - Disable 'Use soft-float' - Set BR2_TARGET_OPTIMIZATION to '-mmicromips' - - MIPS32r6 - Little-Endian, Soft-Float, 2008 NaN, o32 ABI, microMIPS - Select 'MIPS (little endian)' Target Architecture - Select 'mips 32r6' Target Architecture Variant - Enable 'Use soft-float' - Set BR2_TARGET_OPTIMIZATION to '-mmicromips' - - MIPS64r6 - Big-Endian, Hard-Float, 2008 NaN, n32 ABI - Select 'MIPS64 (big endian)' Target Architecture - Select 'mips 64r6' Target Architecture Variant - Select 'n32' Target ABI - Disable 'Use soft-float' - - MIPS64r6 - Little-Endian, Hard-Float, 2008 NaN, n32 ABI - Select 'MIPS64 (little endian)' Target Architecture - Select 'mips 64r6' Target Architecture Variant - Select 'n32' Target ABI - Disable 'Use soft-float' - - MIPS64r6 - Big-Endian, Hard-Float, 2008 NaN, n64 ABI - Select 'MIPS64 (big endian)' Target Architecture - Select 'mips 64r6' Target Architecture Variant - Select 'n64' Target ABI - Disable 'Use soft-float' - - MIPS64r6 - Little-Endian, Hard-Float, 2008 NaN, n64 ABI - Select 'MIPS64 (little endian)' Target Architecture - Select 'mips 64r6' Target Architecture Variant - Select 'n64' Target ABI - Disable 'Use soft-float' - -config BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS - bool "Codescape MTI GNU Linux Toolchain 2015.10" - depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on BR2_mips_32r2 || (BR2_mips_64r2 && !BR2_MIPS_SOFT_FLOAT) - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 - help - Codescape MTI GNU Linux Toolchain 2015.10 for the MIPS - architecture, from Imagination Technologies. It uses gcc - 4.9.2, binutils 2.24.90, glibc 2.20, gdb 7.9.1 and kernel - headers 4.0. It has support for the following variants: - - MIPS32r2 - Big-Endian, Hard-Float, Legacy NaN, o32 ABI - Select 'MIPS (big endian)' Target Architecture - Select 'mips 32r2' Target Architecture Variant - Disable 'Use soft-float' - - MIPS32r2 - Big-Endian, Hard-Float, 2008 NaN, o32 ABI - Select 'MIPS (big endian)' Target Architecture - Select 'mips 32r2' Target Architecture Variant - Disable 'Use soft-float' - Set BR2_TARGET_OPTIMIZATION to '-mnan=2008' - - MIPS32r2 - Big-Endian, Soft-Float, Legacy NaN, o32 ABI - Select 'MIPS (big endian)' Target Architecture - Select 'mips 32r2' Target Architecture Variant - Enable 'Use soft-float' - - MIPS32r2 - Little-Endian, Hard-Float, Legacy NaN, o32 ABI - Select 'MIPS (little endian)' Target Architecture - Select 'mips 32r2' Target Architecture Variant - Disable 'Use soft-float' - - MIPS32r2 - Little-Endian, Hard-Float, 2008 NaN, o32 ABI - Select 'MIPS (little endian)' Target Architecture - Select 'mips 32r2' Target Architecture Variant - Disable 'Use soft-float' - Set BR2_TARGET_OPTIMIZATION to '-mnan=2008' - - MIPS32r2 - Little-Endian, Soft-Float, Legacy NaN, o32 ABI - Select 'MIPS (little endian)' Target Architecture - Select 'mips 32r2' Target Architecture Variant - Enable 'Use soft-float' - - MIPS32r2 - Little-Endian, Hard-Float, 2008 NaN, o32 ABI, microMIPS - Select 'MIPS (little endian)' Target Architecture - Select 'mips 32r2' Target Architecture Variant - Enable 'Use soft-float' - Set BR2_TARGET_OPTIMIZATION to '-mmicromips' - - MIPS32r2 - Little-Endian, Soft-Float, Legacy NaN, o32 ABI, microMIPS - Select 'MIPS (little endian)' Target Architecture - Select 'mips 32r2' Target Architecture Variant - Disable 'Use soft-float' - Set BR2_TARGET_OPTIMIZATION to '-mmicromips' - - MIPS64r2 - Big-Endian, Hard-Float, Legacy NaN, n32 ABI - Select 'MIPS64 (big endian)' Target Architecture - Select 'mips 64r2' Target Architecture Variant - Select 'n32' Target ABI - Disable 'Use soft-float' - - MIPS64r2 - Little-Endian, Hard-Float, Legacy NaN, n32 ABI - Select 'MIPS64 (little endian)' Target Architecture - Select 'mips 64r2' Target Architecture Variant - Select 'n32' Target ABI - Disable 'Use soft-float' - - MIPS64r2 - Big-Endian, Hard-Float, Legacy NaN, n64 ABI - Select 'MIPS64 (big endian)' Target Architecture - Select 'mips 64r2' Target Architecture Variant - Select 'n64' Target ABI - Disable 'Use soft-float' - - MIPS64r2 - Little-Endian, Hard-Float, Legacy NaN, n64 ABI - Select 'MIPS64 (little endian)' Target Architecture - Select 'mips 64r2' Target Architecture Variant - Select 'n64' Target ABI - Disable 'Use soft-float' - -config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII - bool "Sourcery CodeBench Nios-II 2015.11" - depends on BR2_nios2 - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_2 - select BR2_TOOLCHAIN_GCC_AT_LEAST_5 - select BR2_TOOLCHAIN_HAS_BINUTILS_BUG_19405 # based-on binutils-2.25.1 - help - Sourcery CodeBench toolchain for the Nios-II architecture, - from Mentor Graphics. It uses gcc 5.2, binutils 2.25.51, - glibc 2.22, gdb 7.10.50 and kernel headers 4.2. - -config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH - bool "Sourcery CodeBench SH 2012.09" - depends on BR2_sh4a || BR2_sh4aeb - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 - help - Sourcery CodeBench toolchain for the SuperH architecture, - from Mentor Graphics. It uses gcc 4.7.2, binutils 2.23.51, - glibc 2.16, uClibc 0.9.30, gdb 7.4.50 and kernel headers - 3.5.4. It has support for the following variants: - - SH4A, glibc, little endian - Default. - - SH4A, glibc, big endian - Add -mb to BR2_TARGET_OPTIMIZATION - - SH4A, uClibc, little endian - Not usable in Buildroot yet. - - SH4A, uClibc, big endian - Not usable in Buildroot yet. - -config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64 - bool "Sourcery CodeBench AMD64 2015.11" - depends on BR2_x86_64 - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on !BR2_STATIC_LIBS - depends on BR2_x86_jaguar || BR2_x86_steamroller - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_2 - select BR2_TOOLCHAIN_GCC_AT_LEAST_5 - help - Sourcery CodeBench toolchain for the amd64 (x86_64) - architectures, from Mentor Graphics. It uses gcc 5.2, - binutils 2.25.51, glibc 2.22, gdb 7.10.50 and kernel headers - 4.2. It has support for the following variants: - - AMD Puma/Jaguar (family 16h), glibc - Default for x86_64, nothing special to do. - - AMD Steamroller (family 15h), glibc - Select a steamroller core. - No other architecture variants are supported since glibc - is optimized for one of these two baselines. - -config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86 - bool "Sourcery CodeBench x86/x86_64 2012.09" - depends on BR2_i386 || BR2_x86_64 - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on !BR2_STATIC_LIBS - depends on !BR2_x86_jaguar - depends on !BR2_x86_steamroller - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 - help - Sourcery CodeBench toolchain for the x86/x86_64 - architectures, from Mentor Graphics. It uses gcc 4.7.2, - binutils 2.23.51, glibc 2.16, gdb 7.4.50 and kernel headers - 3.5.4. It has support for the following variants: - - Intel Pentium 4, glibc, 32 bits - Default for x86, nothing special to do. - - Intel Atom, glibc, 32 bits - Select an Atom core - - Intel Xeon, glibc, 64 bits - Default for x86_64, nothing special to do. - - Intel Core 2, glibc, 64 bits - Select a Core 2 core - Other architecture variants (beyond Pentium-4/Xeon) are - supported as well, but glibc is not optimised for it. - -config BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX - bool "Blackfin.uclinux.org 2014R1" - depends on BR2_bfin - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - select BR2_TOOLCHAIN_EXTERNAL_UCLIBC - select BR2_INSTALL_LIBSTDCPP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_USE_WCHAR - select BR2_TOOLCHAIN_HAS_THREADS - select BR2_TOOLCHAIN_HAS_THREADS_DEBUG - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_3 - help - Toolchain for the Blackfin architecture, from - http://blackfin.uclinux.org. - -# See note about Linaro ARM/ARMEB toolchains, above. -config BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 - bool "Linaro AArch64 14.09" - depends on BR2_aarch64 - depends on BR2_HOSTARCH = "x86" - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_INSTALL_LIBSTDCPP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_7 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 - help - Toolchain for the AArch64 architecture, from - http://www.linaro.org/engineering/armv8/ - -# See note about Linaro ARM/ARMEB toolchains, above. -config BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 - bool "Linaro AArch64 2016.02" - depends on BR2_aarch64 - depends on BR2_HOSTARCH = "x86_64" - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_INSTALL_LIBSTDCPP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 - select BR2_TOOLCHAIN_GCC_AT_LEAST_5 - help - Toolchain for the AArch64 architecture, from - http://www.linaro.org/engineering/armv8/ - -config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64 - bool "CodeSourcery AArch64 2014.11" - depends on BR2_aarch64 - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - select BR2_TOOLCHAIN_HAS_SSP - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_16 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 - help - Sourcery CodeBench toolchain for the AArch64 architecture, - from Mentor Graphics. It uses gcc 4.9.1, binutils - 2.24.51.20140217, glibc 2.20, gdb 7.7.50 and kernel headers - 3.16.2. - -config BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS - bool "Musl 1.1.12 toolchain (experimental)" - depends on (BR2_arm && BR2_ARM_EABI) || \ - (BR2_arm && BR2_ARM_EABIHF && !BR2_ARM_CPU_ARMV4) || \ - (BR2_armeb && BR2_ARM_EABI) || BR2_i386 || \ - (BR2_mips && !BR2_SOFT_FLOAT) || \ - BR2_mipsel || (BR2_powerpc && BR2_powerpc_CLASSIC) || \ - BR2_sh4 || BR2_sh4eb || \ - BR2_x86_64 - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" - # Unsupported for MIPS R6 - depends on !BR2_mips_32r6 && !BR2_mips_64r6 - select BR2_TOOLCHAIN_EXTERNAL_MUSL - select BR2_TOOLCHAIN_HAS_SSP - select BR2_INSTALL_LIBSTDCPP - select BR2_HOSTARCH_NEEDS_IA32_LIBS - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 - select BR2_TOOLCHAIN_GCC_AT_LEAST_5 - help - Toolchain based on the Musl C library, provided by the - musl-cross project. It uses gcc 5.3, binutils 2.25.1 and - musl 1.1.12. It does not have a cross debugger included. - - The ARM soft-float toolchain is built for ARMv4t, while the - ARM hard-float toolchain is built for ARMv5t. - The x86 toolchain is built for i486. - - http://musl.codu.org/ - -config BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC - bool "Synopsys ARC 2014.12 toolchain" - depends on BR2_arc - depends on BR2_HOSTARCH = "x86_64" - # does not provide IPv6, and lacks many uClibc features - # expected by Buildroot. The next Synopsys toolchain version - # should fix those problems. - depends on BROKEN - select BR2_TOOLCHAIN_EXTERNAL_UCLIBC - select BR2_INSTALL_LIBSTDCPP - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - select BR2_ENABLE_LOCALE - select BR2_USE_WCHAR - select BR2_TOOLCHAIN_HAS_THREADS - select BR2_TOOLCHAIN_HAS_THREADS_DEBUG - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13 - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 - help - Toolchain for the ARC cores, from - https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases - -config BR2_TOOLCHAIN_EXTERNAL_CUSTOM - bool "Custom toolchain" - help - Use this option to use a custom toolchain pre-installed on - your system. +# Kept last, so it remains the non-default choice, unless there isn't +# any available toolchain profile for the currently selected +# architecture. +source "toolchain/toolchain-external/toolchain-external-custom/Config.in" endchoice @@ -663,51 +76,6 @@ config BR2_TOOLCHAIN_EXTERNAL_PATH help Path to where the external toolchain is installed. -config BR2_TOOLCHAIN_EXTERNAL_URL - string "Toolchain URL" - depends on BR2_TOOLCHAIN_EXTERNAL_CUSTOM && BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD - help - URL of the custom toolchain tarball to download and install. - -config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX - string "Toolchain prefix" - depends on BR2_TOOLCHAIN_EXTERNAL_CUSTOM - default "$(ARCH)-linux" - -config BR2_TOOLCHAIN_EXTERNAL_PREFIX - string - default "arc-linux" if BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC && BR2_arcle - default "arceb-linux" if BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC && BR2_arceb - default "arm-linux-gnueabihf" if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM - default "armeb-linux-gnueabihf" if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB - default "arm-none-linux-gnueabi" if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM - default "arm-arago-linux-gnueabi" if BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV7A - default "arm-arago-linux-gnueabi" if BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE - default "aarch64-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 - default "aarch64-amd-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64 - default "mips-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS - default "nios2-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII - default "sh-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH - default "i686-pc-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86 - default "x86_64-amd-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64 - default "bfin-uclinux" if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX && BR2_BINFMT_FLAT - default "bfin-linux-uclibc" if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX && BR2_BINFMT_FDPIC - default "arm-linux-musleabi" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && BR2_arm && BR2_ARM_EABI - default "arm-linux-musleabihf" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && BR2_arm && BR2_ARM_EABIHF - default "mips-img-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS - default "mips-mti-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS - default "armeb-linux-musleabi" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && BR2_armeb - default "i486-linux-musl" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && BR2_i386 - default "mips-linux-musl" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && (BR2_mips && !BR2_SOFT_FLOAT) - default "mipsel-linux-musl" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && (BR2_mipsel && !BR2_SOFT_FLOAT) - default "mipsel-sf-linux-musl" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && (BR2_mipsel && BR2_SOFT_FLOAT) - default "powerpc-linux-musl" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && BR2_powerpc - default "sh4-linux-musl" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && BR2_sh4 - default "sh4eb-linux-musl" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && BR2_sh4eb - default "x86_64-linux-musl" if BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS && BR2_x86_64 - default BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX \ - if BR2_TOOLCHAIN_EXTERNAL_CUSTOM - config BR2_TOOLCHAIN_EXTERNAL_GLIBC bool select BR2_TOOLCHAIN_USES_GLIBC @@ -719,311 +87,55 @@ config BR2_TOOLCHAIN_EXTERNAL_UCLIBC config BR2_TOOLCHAIN_EXTERNAL_MUSL bool select BR2_TOOLCHAIN_USES_MUSL - select BR2_PACKAGE_NETBSD_QUEUE + # Compatibility headers: cdefs.h, queue.h + select BR2_PACKAGE_MUSL_COMPAT_HEADERS -if BR2_TOOLCHAIN_EXTERNAL_CUSTOM - -choice - bool "External toolchain gcc version" - default BR2_TOOLCHAIN_EXTERNAL_GCC_4_3 - help - Set to the gcc version that is used by your external - toolchain. - -config BR2_TOOLCHAIN_EXTERNAL_GCC_6 - bool "6.x" - select BR2_TOOLCHAIN_GCC_AT_LEAST_6 - -config BR2_TOOLCHAIN_EXTERNAL_GCC_5 - bool "5.x" - select BR2_TOOLCHAIN_GCC_AT_LEAST_5 - -config BR2_TOOLCHAIN_EXTERNAL_GCC_4_9 - bool "4.9.x" - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 - -config BR2_TOOLCHAIN_EXTERNAL_GCC_4_8 - bool "4.8.x" - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 - -config BR2_TOOLCHAIN_EXTERNAL_GCC_4_7 - bool "4.7.x" - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 - -config BR2_TOOLCHAIN_EXTERNAL_GCC_4_6 - bool "4.6.x" - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_6 - -config BR2_TOOLCHAIN_EXTERNAL_GCC_4_5 - bool "4.5.x" - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 - -config BR2_TOOLCHAIN_EXTERNAL_GCC_4_4 - bool "4.4.x" - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_4 - -config BR2_TOOLCHAIN_EXTERNAL_GCC_4_3 - bool "4.3.x" - select BR2_TOOLCHAIN_GCC_AT_LEAST_4_3 - -endchoice - -choice - bool "External toolchain kernel headers series" - default BR2_TOOLCHAIN_EXTERNAL_HEADERS_REALLY_OLD - help - Set to the kernel headers version that were used to build - this external toolchain. - - This is used to hide/show some packages that have strict - requirements on the version of kernel headers. - - If unsure what version your toolchain is using, you can look - at the value of LINUX_VERSION_CODE in linux/version.h in your - toolchain. The Linux version is M.m.p, with: - M = ( LINUX_VERSION_CODE >> 16 ) & 0xFF - m = ( LINUX_VERSION_CODE >> 8 ) & 0xFF - p = ( LINUX_VERSION_CODE >> 0 ) & 0xFF - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_5 - bool "4.5.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_4 - bool "4.4.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_4 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_3 - bool "4.3.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_3 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_2 - bool "4.2.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_2 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_1 - bool "4.1.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_1 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_0 - bool "4.0.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_19 - bool "3.19.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_19 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_18 - bool "3.18.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_18 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_17 - bool "3.17.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_16 - bool "3.16.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_16 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_15 - bool "3.15.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_14 - bool "3.14.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_13 - bool "3.13.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_12 - bool "3.12.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_11 - bool "3.11.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_11 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10 - bool "3.10.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_9 - bool "3.9.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_9 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_8 - bool "3.8.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_8 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_7 - bool "3.7.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_7 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_6 - bool "3.6.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_6 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_5 - bool "3.5.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_4 - bool "3.4.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_4 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_3 - bool "3.3.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_2 - bool "3.2.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_1 - bool "3.1.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_1 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_0 - bool "3.0.x" - select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 - -config BR2_TOOLCHAIN_EXTERNAL_HEADERS_REALLY_OLD - bool "2.6.x" - -endchoice - -choice - prompt "External toolchain C library" - default BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC - -config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC - bool "uClibc" - select BR2_TOOLCHAIN_EXTERNAL_UCLIBC - # For the time being, we assume that all custom external - # toolchains have shadow password support. - select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS - help - Select this option if your external toolchain uses the - uClibc C library (available from http://www.uclibc.org/). - -config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC - bool "glibc/eglibc" - depends on !BR2_STATIC_LIBS - select BR2_TOOLCHAIN_EXTERNAL_GLIBC - help - Select this option if your external toolchain uses the GNU C - library (available from https://www.gnu.org/software/libc/) - or its variant the eglibc library (http://www.eglibc.org/). - - Note: eglibc is a variant of glibc that (among other things) - can be configured to exclude some of its features. Using a - toolchain with eglibc configured to exclude key features may - cause build failures to some packages. - -comment "(e)glibc only available with shared lib support" - depends on BR2_STATIC_LIBS - -config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL - bool "musl (experimental)" - select BR2_TOOLCHAIN_EXTERNAL_MUSL - help - Select this option if your external toolchain uses the - 'musl' C library, available from http://www.musl-libc.org/. - -endchoice - -if BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC - -config BR2_TOOLCHAIN_EXTERNAL_WCHAR - bool "Toolchain has WCHAR support?" - select BR2_USE_WCHAR - help - Select this option if your external toolchain supports - WCHAR. If you don't know, leave the default value, Buildroot - will tell you if it's correct or not. - -config BR2_TOOLCHAIN_EXTERNAL_LOCALE - bool "Toolchain has locale support?" - select BR2_TOOLCHAIN_EXTERNAL_WCHAR - select BR2_ENABLE_LOCALE - help - Select this option if your external toolchain has locale - support. If you don't know, leave the default value, - Buildroot will tell you if it's correct or not. - -config BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS - bool "Toolchain has threads support?" - select BR2_TOOLCHAIN_HAS_THREADS +# Make sure the virtual-package infra checks the provider +config BR2_PACKAGE_HAS_TOOLCHAIN_EXTERNAL + bool default y - help - Select this option if your external toolchain has thread - support. If you don't know, leave the default value, - Buildroot will tell you if it's correct or not. -if BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + string -config BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG - bool "Toolchain has threads debugging support?" - select BR2_TOOLCHAIN_HAS_THREADS_DEBUG - default y - help - Select this option if your external toolchain has thread - debugging support. If you don't know, leave the default - value, Buildroot will tell you if it's correct or not. +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + string -config BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_NPTL - bool "Toolchain has NPTL threads support?" - select BR2_TOOLCHAIN_HAS_THREADS_NPTL - default y - help - Select this option if your external toolchain uses the NPTL - (Native Posix Thread Library) implementation of Posix - threads. If you don't know, leave the default value, - Buildroot will tell you if it's correct or not. +# Kept toolchains sorted as in the choice above +# The toolchain Config.in.options must define +# BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL and BR2_TOOLCHAIN_EXTERNAL_PREFIX -endif # BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS +# Aarch64 +source "toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in.options" +source "toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/Config.in.options" -endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC +# ARC +source "toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in.options" -config BR2_TOOLCHAIN_EXTERNAL_HAS_SSP - bool "Toolchain has SSP support?" - select BR2_TOOLCHAIN_HAS_SSP - default y if BR2_TOOLCHAIN_EXTERNAL_GLIBC - default y if BR2_TOOLCHAIN_EXTERNAL_MUSL - help - Selection this option if your external toolchain has Stack - Smashing Protection support enabled. If you don't know, - leave the default value, Buildroot will tell you if it's - correct or not. +# ARM +source "toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in.options" +source "toolchain/toolchain-external/toolchain-external-codesourcery-arm/Config.in.options" -config BR2_TOOLCHAIN_EXTERNAL_INET_RPC - bool "Toolchain has RPC support?" - select BR2_TOOLCHAIN_HAS_NATIVE_RPC - depends on !BR2_TOOLCHAIN_EXTERNAL_MUSL - default y if BR2_TOOLCHAIN_EXTERNAL_GLIBC - help - Select this option if your external toolchain supports - RPC. If you don't know, leave the default value, Buildroot - will tell you if it's correct or not. +# ARM big-endian +source "toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in.options" -config BR2_TOOLCHAIN_EXTERNAL_CXX - bool "Toolchain has C++ support?" - select BR2_INSTALL_LIBSTDCPP - help - Select this option if your external toolchain has C++ - support. If you don't know, leave the default value, - Buildroot will tell you if it's correct or not. +# MIPS +source "toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in.options" +source "toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in.options" +source "toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in.options" -config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS - string "Extra toolchain libraries to be copied to target" - help - If your external toolchain provides extra libraries that - need to be copied to the target filesystem, enter them - here, separated by spaces. +# NIOSII +source "toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in.options" -endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM +# SH4a +source "toolchain/toolchain-external/toolchain-external-codesourcery-sh/Config.in.options" + +# x86/x86_64 +source "toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Config.in.options" +source "toolchain/toolchain-external/toolchain-external-codesourcery-x86/Config.in.options" + +# Custom toolchains +source "toolchain/toolchain-external/toolchain-external-custom/Config.in.options" config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY bool "Copy gdb server to the Target" @@ -1032,31 +144,4 @@ config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY Copy the gdbserver provided by the external toolchain to the target. -# When the FDPIC shared binary format is used, the corresponding libraries are -# always installed. When a different binary format is used, we offer the option -# of installing the FDPIC shared libraries. -config BR2_BFIN_INSTALL_FDPIC_SHARED - bool "Install FDPIC shared libraries" - depends on BR2_bfin && !BR2_BINFMT_FDPIC - help - The Linux kernel supports running both FDPIC and FLAT applications - concurrently if the binary format specific libraries are installed - properly. This option allows developer to install FDPIC libraries - into a buildroot rootfs image built with binary format that is not - FDPIC. - -# When the FLAT shared binary format is used, we force the installation -# of the corresponding libraries. When a different binary format is -# used, we offer the option of installing the FLAT shared libraries. -config BR2_BFIN_INSTALL_FLAT_SHARED - bool "Install FLAT shared libraries" if !BR2_BINFMT_FLAT_SHARED - depends on BR2_bfin - default y if BR2_BINFMT_FLAT_SHARED - help - The Linux kernel supports running both FDPIC and FLAT applications - concurrently if the binary format specific libraries are installed - properly. This option allows developer to install FLAT libraries - into a buildroot rootfs image built with binary format that is not - shared FLAT. - endif # BR2_TOOLCHAIN_EXTERNAL diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk new file mode 100644 index 0000000000..6658875007 --- /dev/null +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk @@ -0,0 +1,607 @@ +################################################################################ +# External toolchain package infrastructure +# +# This package infrastructure implements the support for external +# toolchains, i.e toolchains that are available pre-built, ready to +# use. Such toolchain may either be readily available on the Web +# (Linaro, Sourcery CodeBench, from processor vendors) or may be built +# with tools like Crosstool-NG or Buildroot itself. So far, we have +# tested this with: +# +# * Toolchains generated by Crosstool-NG +# * Toolchains generated by Buildroot +# * Toolchains provided by Linaro for the ARM and AArch64 +# architectures +# * Sourcery CodeBench toolchains (from Mentor Graphics) for the ARM, +# MIPS, PowerPC, x86, x86_64 and NIOS 2 architectures. For the MIPS +# toolchain, the -muclibc variant isn't supported yet, only the +# default glibc-based variant is. +# * Xilinx toolchains for the Microblaze architecture +# * Synopsys DesignWare toolchains for ARC cores +# +# The basic principle is the following +# +# 1. If the toolchain is not pre-installed, download and extract it +# in $(TOOLCHAIN_EXTERNAL_INSTALL_DIR). Otherwise, +# $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) points to were the toolchain has +# already been installed by the user. +# +# 2. For all external toolchains, perform some checks on the +# conformity between the toolchain configuration described in the +# Buildroot menuconfig system, and the real configuration of the +# external toolchain. This is for example important to make sure that +# the Buildroot configuration system knows whether the toolchain +# supports RPC, IPv6, locales, large files, etc. Unfortunately, these +# things cannot be detected automatically, since the value of these +# options (such as BR2_TOOLCHAIN_HAS_NATIVE_RPC) are needed at +# configuration time because these options are used as dependencies +# for other options. And at configuration time, we are not able to +# retrieve the external toolchain configuration. +# +# 3. Copy the libraries needed at runtime to the target directory, +# $(TARGET_DIR). Obviously, things such as the C library, the dynamic +# loader and a few other utility libraries are needed if dynamic +# applications are to be executed on the target system. +# +# 4. Copy the libraries and headers to the staging directory. This +# will allow all further calls to gcc to be made using --sysroot +# $(STAGING_DIR), which greatly simplifies the compilation of the +# packages when using external toolchains. So in the end, only the +# cross-compiler binaries remains external, all libraries and headers +# are imported into the Buildroot tree. +# +# 5. Build a toolchain wrapper which executes the external toolchain +# with a number of arguments (sysroot/march/mtune/..) hardcoded, +# so we're sure the correct configuration is always used and the +# toolchain behaves similar to an internal toolchain. +# This toolchain wrapper and symlinks are installed into +# $(HOST_DIR)/usr/bin like for the internal toolchains, and the rest +# of Buildroot is handled identical for the 2 toolchain types. +################################################################################ + +# +# Definitions of where the toolchain can be found +# + +TOOLCHAIN_EXTERNAL_PREFIX = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX)) +TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR = $(HOST_DIR)/opt/ext-toolchain + +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y) +TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR) +else +TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH)) +endif + +ifeq ($(TOOLCHAIN_EXTERNAL_INSTALL_DIR),) +ifneq ($(TOOLCHAIN_EXTERNAL_PREFIX),) +# if no path set, figure it out from path +TOOLCHAIN_EXTERNAL_BIN := $(shell dirname $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc)) +endif +else +TOOLCHAIN_EXTERNAL_BIN := $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/bin +endif + +# If this is a buildroot toolchain, it already has a wrapper which we want to +# bypass. Since this is only evaluated after it has been extracted, we can use +# $(wildcard ...) here. +TOOLCHAIN_EXTERNAL_SUFFIX = \ + $(if $(wildcard $(TOOLCHAIN_EXTERNAL_BIN)/*.br_real),.br_real) + +TOOLCHAIN_EXTERNAL_CROSS = $(TOOLCHAIN_EXTERNAL_BIN)/$(TOOLCHAIN_EXTERNAL_PREFIX)- +TOOLCHAIN_EXTERNAL_CC = $(TOOLCHAIN_EXTERNAL_CROSS)gcc$(TOOLCHAIN_EXTERNAL_SUFFIX) +TOOLCHAIN_EXTERNAL_CXX = $(TOOLCHAIN_EXTERNAL_CROSS)g++$(TOOLCHAIN_EXTERNAL_SUFFIX) +TOOLCHAIN_EXTERNAL_FC = $(TOOLCHAIN_EXTERNAL_CROSS)gfortran$(TOOLCHAIN_EXTERNAL_SUFFIX) +TOOLCHAIN_EXTERNAL_READELF = $(TOOLCHAIN_EXTERNAL_CROSS)readelf$(TOOLCHAIN_EXTERNAL_SUFFIX) + +# Normal handling of downloaded toolchain tarball extraction. +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y) +# As a regular package, the toolchain gets extracted in $(@D), but +# since it's actually a fairly special package, we need it to be moved +# into TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR. +define TOOLCHAIN_EXTERNAL_MOVE + rm -rf $(TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR) + mkdir -p $(TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR) + mv $(@D)/* $(TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR)/ +endef +endif + +# +# Definitions of the list of libraries that should be copied to the target. +# +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y) +TOOLCHAIN_EXTERNAL_LIBS += libatomic.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.* +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_ARM_EABIHF),yy) +TOOLCHAIN_EXTERNAL_LIBS += ld-linux-armhf.so.* +else +TOOLCHAIN_EXTERNAL_LIBS += ld*.so.* +endif +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) +TOOLCHAIN_EXTERNAL_LIBS += libpthread.so.* +ifneq ($(BR2_PACKAGE_GDB)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),) +TOOLCHAIN_EXTERNAL_LIBS += libthread_db.so.* +endif # gdbserver +endif # ! no threads +endif + +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y) +TOOLCHAIN_EXTERNAL_LIBS += libnss_files.so.* libnss_dns.so.* libmvec.so.* +endif + +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y) +TOOLCHAIN_EXTERNAL_LIBS += libc.so libgcc_s.so.* +endif + +ifeq ($(BR2_INSTALL_LIBSTDCPP),y) +TOOLCHAIN_EXTERNAL_LIBS += libstdc++.so.* +endif + +ifeq ($(BR2_TOOLCHAIN_HAS_FORTRAN),y) +TOOLCHAIN_EXTERNAL_LIBS += libgfortran.so.* +# fortran needs quadmath on x86 and x86_64 +ifeq ($(BR2_TOOLCHAIN_HAS_LIBQUADMATH),y) +TOOLCHAIN_EXTERNAL_LIBS += libquadmath.so* +endif +endif + +TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS)) + + +# +# Definition of the CFLAGS to use with the external toolchain, as well as the +# common toolchain wrapper build arguments +# +ifeq ($(call qstrip,$(BR2_GCC_TARGET_CPU_REVISION)),) +CC_TARGET_CPU_ := $(call qstrip,$(BR2_GCC_TARGET_CPU)) +else +CC_TARGET_CPU_ := $(call qstrip,$(BR2_GCC_TARGET_CPU)-$(BR2_GCC_TARGET_CPU_REVISION)) +endif +CC_TARGET_ARCH_ := $(call qstrip,$(BR2_GCC_TARGET_ARCH)) +CC_TARGET_ABI_ := $(call qstrip,$(BR2_GCC_TARGET_ABI)) +CC_TARGET_FPU_ := $(call qstrip,$(BR2_GCC_TARGET_FPU)) +CC_TARGET_FLOAT_ABI_ := $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI)) +CC_TARGET_MODE_ := $(call qstrip,$(BR2_GCC_TARGET_MODE)) + +# march/mtune/floating point mode needs to be passed to the external toolchain +# to select the right multilib variant +ifeq ($(BR2_x86_64),y) +TOOLCHAIN_EXTERNAL_CFLAGS += -m64 +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_64 +endif +ifneq ($(CC_TARGET_ARCH_),) +TOOLCHAIN_EXTERNAL_CFLAGS += -march=$(CC_TARGET_ARCH_) +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ARCH='"$(CC_TARGET_ARCH_)"' +endif +ifneq ($(CC_TARGET_CPU_),) +TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_) +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"' +endif +ifneq ($(CC_TARGET_ABI_),) +TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_) +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"' +endif +ifneq ($(CC_TARGET_FPU_),) +TOOLCHAIN_EXTERNAL_CFLAGS += -mfpu=$(CC_TARGET_FPU_) +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FPU='"$(CC_TARGET_FPU_)"' +endif +ifneq ($(CC_TARGET_FLOAT_ABI_),) +TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(CC_TARGET_FLOAT_ABI_) +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(CC_TARGET_FLOAT_ABI_)"' +endif +ifneq ($(CC_TARGET_MODE_),) +TOOLCHAIN_EXTERNAL_CFLAGS += -m$(CC_TARGET_MODE_) +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MODE='"$(CC_TARGET_MODE_)"' +endif +ifeq ($(BR2_BINFMT_FLAT),y) +TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_BINFMT_FLAT +endif +ifeq ($(BR2_mipsel)$(BR2_mips64el),y) +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MIPS_TARGET_LITTLE_ENDIAN +TOOLCHAIN_EXTERNAL_CFLAGS += -EL +endif +ifeq ($(BR2_mips)$(BR2_mips64),y) +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MIPS_TARGET_BIG_ENDIAN +TOOLCHAIN_EXTERNAL_CFLAGS += -EB +endif +ifeq ($(BR2_arceb),y) +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ARC_TARGET_BIG_ENDIAN +TOOLCHAIN_EXTERNAL_CFLAGS += -EB +endif + +TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION)) + +ifeq ($(BR2_SOFT_FLOAT),y) +TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_SOFTFLOAT=1 +endif + +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += \ + -DBR_CROSS_PATH_SUFFIX='"$(TOOLCHAIN_EXTERNAL_SUFFIX)"' + +ifeq ($(filter $(HOST_DIR)/%,$(TOOLCHAIN_EXTERNAL_BIN)),) +# TOOLCHAIN_EXTERNAL_BIN points outside HOST_DIR => absolute path +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += \ + -DBR_CROSS_PATH_ABS='"$(TOOLCHAIN_EXTERNAL_BIN)"' +else +# TOOLCHAIN_EXTERNAL_BIN points inside HOST_DIR => relative path +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += \ + -DBR_CROSS_PATH_REL='"$(TOOLCHAIN_EXTERNAL_BIN:$(HOST_DIR)/%=%)"' +endif + + +# +# The following functions creates the symbolic links needed to get the +# cross-compilation tools visible in $(HOST_DIR)/usr/bin. Some of +# links are done directly to the corresponding tool in the external +# toolchain installation directory, while some other links are done to +# the toolchain wrapper (preprocessor, C, C++ and Fortran compiler) +# +# We skip gdb symlink when we are building our own gdb to prevent two +# gdb's in $(HOST_DIR)/usr/bin. +# +# The LTO support in gcc creates wrappers for ar, ranlib and nm which load +# the lto plugin. These wrappers are called *-gcc-ar, *-gcc-ranlib, and +# *-gcc-nm and should be used instead of the real programs when -flto is +# used. However, we should not add the toolchain wrapper for them, and they +# match the *cc-* pattern. Therefore, an additional case is added for *-ar, +# *-ranlib and *-nm. +define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER + $(Q)cd $(HOST_DIR)/usr/bin; \ + for i in $(TOOLCHAIN_EXTERNAL_CROSS)*; do \ + base=$${i##*/}; \ + case "$$base" in \ + *-ar|*-ranlib|*-nm) \ + ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \ + ;; \ + *cc|*cc-*|*++|*++-*|*cpp|*-gfortran) \ + ln -sf toolchain-wrapper $$base; \ + ;; \ + *gdb|*gdbtui) \ + if test "$(BR2_PACKAGE_HOST_GDB)" != "y"; then \ + ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \ + fi \ + ;; \ + *) \ + ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \ + ;; \ + esac; \ + done +endef + + +# Various utility functions used by the external toolchain package +# infrastructure. Those functions are mainly responsible for: +# +# - installation the toolchain libraries to $(TARGET_DIR) +# - copying the toolchain sysroot to $(STAGING_DIR) +# - installing a gdbinit file +# +# Details about sysroot directory selection. +# +# To find the sysroot directory, we use the trick of looking for the +# 'libc.a' file with the -print-file-name gcc option, and then +# mangling the path to find the base directory of the sysroot. +# +# Note that we do not use the -print-sysroot option, because it is +# only available since gcc 4.4.x, and we only recently dropped support +# for 4.2.x and 4.3.x. +# +# When doing this, we don't pass any option to gcc that could select a +# multilib variant (such as -march) as we want the "main" sysroot, +# which contains all variants of the C library in the case of multilib +# toolchains. We use the TARGET_CC_NO_SYSROOT variable, which is the +# path of the cross-compiler, without the --sysroot=$(STAGING_DIR), +# since what we want to find is the location of the original toolchain +# sysroot. This "main" sysroot directory is stored in SYSROOT_DIR. +# +# Then, multilib toolchains are a little bit more complicated, since +# they in fact have multiple sysroots, one for each variant supported +# by the toolchain. So we need to find the particular sysroot we're +# interested in. +# +# To do so, we ask the compiler where its sysroot is by passing all +# flags (including -march and al.), except the --sysroot flag since we +# want to the compiler to tell us where its original sysroot +# is. ARCH_SUBDIR will contain the subdirectory, in the main +# SYSROOT_DIR, that corresponds to the selected architecture +# variant. ARCH_SYSROOT_DIR will contain the full path to this +# location. +# +# One might wonder why we don't just bother with ARCH_SYSROOT_DIR. The +# fact is that in multilib toolchains, the header files are often only +# present in the main sysroot, and only the libraries are available in +# each variant-specific sysroot directory. + + +# toolchain_find_sysroot returns the sysroot location for the given +# compiler + flags. We need to handle cases where libc.a is in: +# +# - lib/ +# - usr/lib/ +# - lib32/ +# - lib64/ +# - lib32-fp/ (Cavium toolchain) +# - lib64-fp/ (Cavium toolchain) +# - usr/lib// (Linaro toolchain) +# +# And variations on these. +define toolchain_find_sysroot +$$(printf $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:(usr/)?lib(32|64)?([^/]*)?/([^/]*/)?libc\.a::') +endef + +# Returns the lib subdirectory for the given compiler + flags (i.e +# typically lib32 or lib64 for some toolchains) +define toolchain_find_libdir +$$(printf $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:.*/(usr/)?(lib(32|64)?([^/]*)?)/([^/]*/)?libc.a:\2:') +endef + +# Returns the location of the libc.a file for the given compiler + flags +define toolchain_find_libc_a +$$(readlink -f $$(LANG=C $(1) -print-file-name=libc.a)) +endef + +# Integration of the toolchain into Buildroot: find the main sysroot +# and the variant-specific sysroot, then copy the needed libraries to +# the $(TARGET_DIR) and copy the whole sysroot (libraries and headers) +# to $(STAGING_DIR). +# +# Variables are defined as follows: +# +# SYSROOT_DIR: the main sysroot directory, deduced from the location of +# the libc.a file in the default multilib variant, by +# removing the usr/lib[32|64]/libc.a part of the path. +# Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/ +# +# ARCH_SYSROOT_DIR: the sysroot of the selected multilib variant, +# deduced from the location of the libc.a file in the +# selected multilib variant (taking into account the +# CFLAGS), by removing usr/lib[32|64]/libc.a at the end +# of the path. +# Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/mips16/soft-float/el/ +# +# ARCH_LIB_DIR: 'lib', 'lib32' or 'lib64' depending on where libraries +# are stored. Deduced from the location of the libc.a file +# in the selected multilib variant, by looking at +# usr/lib??/libc.a. +# Ex: lib +# +# ARCH_SUBDIR: the relative location of the sysroot of the selected +# multilib variant compared to the main sysroot. +# Ex: mips16/soft-float/el +# +# SUPPORT_LIB_DIR: some toolchains, such as recent Linaro toolchains, +# store GCC support libraries (libstdc++, +# libgcc_s, etc.) outside of the sysroot. In +# this case, SUPPORT_LIB_DIR is set to a +# non-empty value, and points to the directory +# where these support libraries are +# available. Those libraries will be copied to +# our sysroot, and the directory will also be +# considered when searching libraries for copy +# to the target filesystem. +# +# Please be very careful to check the major toolchain sources: +# Buildroot, Crosstool-NG, CodeSourcery and Linaro +# before doing any modification on the below logic. + +ifeq ($(BR2_STATIC_LIBS),) +define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS + $(Q)$(call MESSAGE,"Copying external toolchain libraries to target...") + $(Q)for libs in $(TOOLCHAIN_EXTERNAL_LIBS); do \ + $(call copy_toolchain_lib_root,$$libs); \ + done +endef +endif + +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),y) +define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER + $(Q)$(call MESSAGE,"Copying gdbserver") + $(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + gdbserver_found=0 ; \ + for d in $${ARCH_SYSROOT_DIR}/usr \ + $${ARCH_SYSROOT_DIR}/../debug-root/usr \ + $${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} \ + $(TOOLCHAIN_EXTERNAL_INSTALL_DIR); do \ + if test -f $${d}/bin/gdbserver ; then \ + install -m 0755 -D $${d}/bin/gdbserver $(TARGET_DIR)/usr/bin/gdbserver ; \ + gdbserver_found=1 ; \ + break ; \ + fi ; \ + done ; \ + if [ $${gdbserver_found} -eq 0 ] ; then \ + echo "Could not find gdbserver in external toolchain" ; \ + exit 1 ; \ + fi +endef +endif + +define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS + $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \ + ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + SUPPORT_LIB_DIR="" ; \ + if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \ + LIBSTDCPP_A_LOCATION=$$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \ + if [ -e "$${LIBSTDCPP_A_LOCATION}" ]; then \ + SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \ + fi ; \ + fi ; \ + if [ "$${SYSROOT_DIR}" == "$${ARCH_SYSROOT_DIR}" ] ; then \ + ARCH_SUBDIR="" ; \ + elif [ "`dirname $${ARCH_SYSROOT_DIR}`" = "`dirname $${SYSROOT_DIR}`" ] ; then \ + SYSROOT_DIR_DIRNAME=`dirname $${SYSROOT_DIR}`/ ; \ + ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR_DIRNAME}(.*)/$$:\1:"` ; \ + else \ + ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \ + fi ; \ + $(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \ + $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) +endef + +# Create a symlink from (usr/)$(ARCH_LIB_DIR) to lib. +# Note: the skeleton package additionally creates lib32->lib or lib64->lib +# (as appropriate) +# +# $1: destination directory (TARGET_DIR / STAGING_DIR) +create_lib_symlinks = \ + $(Q)DESTDIR="$(strip $1)" ; \ + ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + if [ ! -e "$${DESTDIR}/$${ARCH_LIB_DIR}" -a ! -e "$${DESTDIR}/usr/$${ARCH_LIB_DIR}" ]; then \ + ln -snf lib "$${DESTDIR}/$${ARCH_LIB_DIR}" ; \ + ln -snf lib "$${DESTDIR}/usr/$${ARCH_LIB_DIR}" ; \ + fi + +define TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK + $(call create_lib_symlinks,$(STAGING_DIR)) +endef + +define TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK + $(call create_lib_symlinks,$(TARGET_DIR)) +endef + +# +# Generate gdbinit file for use with Buildroot +# +define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT + $(Q)if test -f $(TARGET_CROSS)gdb ; then \ + $(call MESSAGE,"Installing gdbinit"); \ + $(gen_gdbinit_file); \ + fi +endef + +# Various utility functions used by the external toolchain based on musl. + +# With the musl C library, the libc.so library directly plays the role +# of the dynamic library loader. We just need to create a symbolic +# link to libc.so with the appropriate name. +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y) +ifeq ($(BR2_i386),y) +MUSL_ARCH = i386 +else ifeq ($(BR2_ARM_EABIHF),y) +MUSL_ARCH = armhf +else ifeq ($(BR2_mipsel):$(BR2_SOFT_FLOAT),y:y) +MUSL_ARCH = mipsel-sf +else ifeq ($(BR2_sh),y) +MUSL_ARCH = sh +else +MUSL_ARCH = $(ARCH) +endif +define TOOLCHAIN_EXTERNAL_MUSL_LD_LINK + ln -sf libc.so $(TARGET_DIR)/lib/ld-musl-$(MUSL_ARCH).so.1 +endef +endif + +# uClibc-ng dynamic loader is called ld-uClibc.so.1, but gcc is not +# patched specifically for uClibc-ng, so it continues to generate +# binaries that expect the dynamic loader to be named ld-uClibc.so.0, +# like with the original uClibc. Therefore, we create an additional +# symbolic link to make uClibc-ng systems work properly. +define TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO + $(Q)if test -e $(TARGET_DIR)/lib/ld-uClibc.so.1; then \ + ln -sf ld-uClibc.so.1 $(TARGET_DIR)/lib/ld-uClibc.so.0 ; \ + fi + $(Q)if test -e $(TARGET_DIR)/lib/ld64-uClibc.so.1; then \ + ln -sf ld64-uClibc.so.1 $(TARGET_DIR)/lib/ld64-uClibc.so.0 ; \ + fi +endef + + +################################################################################ +# inner-toolchain-external-package -- defines the generic installation rules +# for external toolchain packages +# +# argument 1 is the lowercase package name +# argument 2 is the uppercase package name, including a HOST_ prefix +# for host packages +# argument 3 is the uppercase package name, without the HOST_ prefix +# for host packages +# argument 4 is the type (target or host) +################################################################################ +define inner-toolchain-external-package + +$(2)_INSTALL_STAGING = YES +$(2)_ADD_TOOLCHAIN_DEPENDENCY = NO + +# In fact, we don't need to download the toolchain, since it is already +# available on the system, so force the site and source to be empty so +# that nothing will be downloaded/extracted. +ifeq ($$(BR2_TOOLCHAIN_EXTERNAL_PREINSTALLED),y) +$(2)_SITE = +$(2)_SOURCE = +endif + +ifeq ($$(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y) +$(2)_EXCLUDES = usr/lib/locale/* + +$(2)_POST_EXTRACT_HOOKS += \ + TOOLCHAIN_EXTERNAL_MOVE +endif + +# Checks for an already installed toolchain: check the toolchain +# location, check that it is usable, and then verify that it +# matches the configuration provided in Buildroot: ABI, C++ support, +# kernel headers version, type of C library and all C library features. +define $(2)_CONFIGURE_CMDS + $$(Q)$$(call check_cross_compiler_exists,$$(TOOLCHAIN_EXTERNAL_CC)) + $$(Q)$$(call check_unusable_toolchain,$$(TOOLCHAIN_EXTERNAL_CC)) + $$(Q)SYSROOT_DIR="$$(call toolchain_find_sysroot,$$(TOOLCHAIN_EXTERNAL_CC))" ; \ + $$(call check_kernel_headers_version,\ + $$(call toolchain_find_sysroot,$$(TOOLCHAIN_EXTERNAL_CC)),\ + $$(call qstrip,$$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \ + $$(call check_gcc_version,$$(TOOLCHAIN_EXTERNAL_CC),\ + $$(call qstrip,$$(BR2_TOOLCHAIN_GCC_AT_LEAST))); \ + if test "$$(BR2_arm)" = "y" ; then \ + $$(call check_arm_abi,\ + "$$(TOOLCHAIN_EXTERNAL_CC) $$(TOOLCHAIN_EXTERNAL_CFLAGS)",\ + $$(TOOLCHAIN_EXTERNAL_READELF)) ; \ + fi ; \ + if test "$$(BR2_INSTALL_LIBSTDCPP)" = "y" ; then \ + $$(call check_cplusplus,$$(TOOLCHAIN_EXTERNAL_CXX)) ; \ + fi ; \ + if test "$$(BR2_TOOLCHAIN_HAS_FORTRAN)" = "y" ; then \ + $$(call check_fortran,$$(TOOLCHAIN_EXTERNAL_FC)) ; \ + fi ; \ + if test "$$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \ + $$(call check_uclibc,$$$${SYSROOT_DIR}) ; \ + elif test "$$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \ + $$(call check_musl,$$$${SYSROOT_DIR}) ; \ + else \ + $$(call check_glibc,$$$${SYSROOT_DIR}) ; \ + fi + $$(Q)$$(call check_toolchain_ssp,$$(TOOLCHAIN_EXTERNAL_CC)) +endef + +$(2)_TOOLCHAIN_WRAPPER_ARGS += $$(TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS) + +$(2)_BUILD_CMDS = $$(TOOLCHAIN_WRAPPER_BUILD) + +define $(2)_INSTALL_STAGING_CMDS + $$(TOOLCHAIN_WRAPPER_INSTALL) + $$(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK) + $$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS) + $$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER) + $$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT) +endef + +ifeq ($$(BR2_TOOLCHAIN_EXTERNAL_MUSL),y) +$(2)_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_MUSL_LD_LINK +endif + +# Even though we're installing things in both the staging, the host +# and the target directory, we do everything within the +# install-staging step, arbitrarily. +define $(2)_INSTALL_TARGET_CMDS + $$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK) + $$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS) + $$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER) + $$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO) +endef + +# Call the generic package infrastructure to generate the necessary +# make targets +$(call inner-generic-package,$(1),$(2),$(3),$(4)) + +endef + +toolchain-external-package = $(call inner-toolchain-external-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target) diff --git a/toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in b/toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in new file mode 100644 index 0000000000..e29c4dcb87 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in @@ -0,0 +1,61 @@ +config BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS + bool "Codescape IMG GNU Linux Toolchain 2016.05" + depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on BR2_MIPS_CPU_MIPS32R6 || (BR2_MIPS_CPU_MIPS64R6 && !BR2_MIPS_SOFT_FLOAT) + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_INSTALL_LIBSTDCPP + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_7 + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + select BR2_TOOLCHAIN_HAS_FORTRAN + help + Codescape IMG GNU Linux Toolchain 2016.05 for the MIPS + architecture, from Imagination Technologies. It uses gcc + 4.9.2, binutils 2.24.90, glibc 2.20, gdb 7.9.1 and kernel + headers 4.7. It has support for the following variants: + - MIPS32r6 - Big-Endian, Hard-Float, 2008 NaN, o32 ABI + Select 'MIPS (big endian)' Target Architecture + Select 'mips 32r6' Target Architecture Variant + Disable 'Use soft-float' + - MIPS32r6 - Big-Endian, Soft-Float, 2008 NaN, o32 ABI + Select 'MIPS (big endian)' Target Architecture + Select 'mips 32r6' Target Architecture Variant + Enable 'Use soft-float' + - MIPS32r6 - Little-Endian, Hard-Float, 2008 NaN, o32 ABI + Select 'MIPS (little endian)' Target Architecture + Select 'mips 32r6' Target Architecture Variant + Disable 'Use soft-float' + - MIPS32r6 - Little-Endian, Soft-Float, 2008 NaN, o32 ABI + Select 'MIPS (little endian)' Target Architecture + Select 'mips 32r6' Target Architecture Variant + Enable 'Use soft-float' + - MIPS32r6 - Little-Endian, Hard-Float, 2008 NaN, o32 ABI, microMIPS + Select 'MIPS (little endian)' Target Architecture + Select 'mips 32r6' Target Architecture Variant + Disable 'Use soft-float' + Set BR2_TARGET_OPTIMIZATION to '-mmicromips' + - MIPS32r6 - Little-Endian, Soft-Float, 2008 NaN, o32 ABI, microMIPS + Select 'MIPS (little endian)' Target Architecture + Select 'mips 32r6' Target Architecture Variant + Enable 'Use soft-float' + Set BR2_TARGET_OPTIMIZATION to '-mmicromips' + - MIPS64r6 - Big-Endian, Hard-Float, 2008 NaN, n32 ABI + Select 'MIPS64 (big endian)' Target Architecture + Select 'mips 64r6' Target Architecture Variant + Select 'n32' Target ABI + Disable 'Use soft-float' + - MIPS64r6 - Little-Endian, Hard-Float, 2008 NaN, n32 ABI + Select 'MIPS64 (little endian)' Target Architecture + Select 'mips 64r6' Target Architecture Variant + Select 'n32' Target ABI + Disable 'Use soft-float' + - MIPS64r6 - Big-Endian, Hard-Float, 2008 NaN, n64 ABI + Select 'MIPS64 (big endian)' Target Architecture + Select 'mips 64r6' Target Architecture Variant + Select 'n64' Target ABI + Disable 'Use soft-float' + - MIPS64r6 - Little-Endian, Hard-Float, 2008 NaN, n64 ABI + Select 'MIPS64 (little endian)' Target Architecture + Select 'mips 64r6' Target Architecture Variant + Select 'n64' Target ABI + Disable 'Use soft-float' diff --git a/toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in.options b/toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in.options new file mode 100644 index 0000000000..3eaa2a9522 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "mips-img-linux-gnu" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-codescape-img-mips" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-codescape-img-mips/toolchain-external-codescape-img-mips.hash b/toolchain/toolchain-external/toolchain-external-codescape-img-mips/toolchain-external-codescape-img-mips.hash new file mode 100644 index 0000000000..6a12cfa078 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codescape-img-mips/toolchain-external-codescape-img-mips.hash @@ -0,0 +1,4 @@ +# Codescape toolchains from Imagination Technologies +# From: http://codescape-mips-sdk.imgtec.com/components/toolchain/2016.05-06/downloads.html +sha256 8d9cdf711dd402d7bf82883d425c221038fe8ce9d0c91a3f6b30939d9d55476c Codescape.GNU.Tools.Package.2016.05-06.for.MIPS.IMG.Linux.CentOS-5.x86.tar.gz +sha256 6e2784d6df962fe4db7510c8a62ce3947b73f54207b10e18b52da59d1bc487bd Codescape.GNU.Tools.Package.2016.05-06.for.MIPS.IMG.Linux.CentOS-5.x86_64.tar.gz diff --git a/toolchain/toolchain-external/toolchain-external-codescape-img-mips/toolchain-external-codescape-img-mips.mk b/toolchain/toolchain-external/toolchain-external-codescape-img-mips/toolchain-external-codescape-img-mips.mk new file mode 100644 index 0000000000..49a7027dfb --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codescape-img-mips/toolchain-external-codescape-img-mips.mk @@ -0,0 +1,51 @@ +################################################################################ +# +# toolchain-external-codescape-img-mips +# +################################################################################ + +TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_VERSION = 2016.05-06 +TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_SITE = http://codescape-mips-sdk.imgtec.com/components/toolchain/$(TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_VERSION) +TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_STRIP_COMPONENTS = 2 + +ifeq ($(HOSTARCH),x86) +TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_SOURCE = Codescape.GNU.Tools.Package.$(TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_VERSION).for.MIPS.IMG.Linux.CentOS-5.x86.tar.gz +else +TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_SOURCE = Codescape.GNU.Tools.Package.$(TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_VERSION).for.MIPS.IMG.Linux.CentOS-5.x86_64.tar.gz +endif + +# Special fixup for Codescape MIPS toolchains, that have bin- and +# sbin- directories. We create symlinks bin -> bin- and sbin +# -> sbin- so that the rest of Buildroot can find the toolchain +# tools in the appropriate location. +ifeq ($(BR2_MIPS_OABI32),y) +TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_BIN_DIR_SUFFIX = o32 +else ifeq ($(BR2_MIPS_NABI32),y) +TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_BIN_DIR_SUFFIX = n32 +else ifeq ($(BR2_MIPS_NABI64),y) +TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_BIN_DIR_SUFFIX = n64 +endif + +define TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_STAGING_FIXUPS + rmdir $(STAGING_DIR)/usr/bin $(STAGING_DIR)/usr/sbin + ln -sf bin-$(TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_BIN_DIR_SUFFIX) $(STAGING_DIR)/usr/bin + ln -sf sbin-$(TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_BIN_DIR_SUFFIX) $(STAGING_DIR)/usr/sbin +endef + +# The Codescape toolchain uses a sysroot layout that places them +# side-by-side instead of nested like multilibs. A symlink is needed +# much like for the nested sysroots which are handled in +# copy_toolchain_sysroot but there is not enough information in there +# to determine whether the sysroot layout was nested or side-by-side. +# Add the symlink here for now. +define TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_SYMLINK + $(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))"; \ + ARCH_SUBDIR=`basename $${ARCH_SYSROOT_DIR}`; \ + ln -snf . $(STAGING_DIR)/$${ARCH_SUBDIR} +endef + +TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_POST_INSTALL_STAGING_HOOKS += \ + TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_STAGING_FIXUPS \ + TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS_SYMLINK + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in b/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in new file mode 100644 index 0000000000..efe6f8527e --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in @@ -0,0 +1,72 @@ +config BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS + bool "Codescape MTI GNU Linux Toolchain 2016.05" + depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on BR2_MIPS_CPU_MIPS32R2 || (BR2_MIPS_CPU_MIPS64R2 && !BR2_MIPS_SOFT_FLOAT) || \ + BR2_MIPS_CPU_MIPS32R5 || (BR2_MIPS_CPU_MIPS64R5 && !BR2_MIPS_SOFT_FLOAT) + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_INSTALL_LIBSTDCPP + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_7 + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + select BR2_TOOLCHAIN_HAS_FORTRAN + help + Codescape MTI GNU Linux Toolchain 2016.05 for the MIPS + architecture, from Imagination Technologies. It uses gcc + 4.9.2, binutils 2.24.90, glibc 2.20, gdb 7.9.1 and kernel + headers 4.7. It has support for the following variants: + - MIPS32r2 - Big-Endian, Hard-Float, Legacy NaN, o32 ABI + Select 'MIPS (big endian)' Target Architecture + Select 'mips 32r2' Target Architecture Variant + Disable 'Use soft-float' + - MIPS32r2 - Big-Endian, Hard-Float, 2008 NaN, o32 ABI + Select 'MIPS (big endian)' Target Architecture + Select 'mips 32r2' Target Architecture Variant + Disable 'Use soft-float' + Set BR2_TARGET_OPTIMIZATION to '-mnan=2008' + - MIPS32r2 - Big-Endian, Soft-Float, Legacy NaN, o32 ABI + Select 'MIPS (big endian)' Target Architecture + Select 'mips 32r2' Target Architecture Variant + Enable 'Use soft-float' + - MIPS32r2 - Little-Endian, Hard-Float, Legacy NaN, o32 ABI + Select 'MIPS (little endian)' Target Architecture + Select 'mips 32r2' Target Architecture Variant + Disable 'Use soft-float' + - MIPS32r2 - Little-Endian, Hard-Float, 2008 NaN, o32 ABI + Select 'MIPS (little endian)' Target Architecture + Select 'mips 32r2' Target Architecture Variant + Disable 'Use soft-float' + Set BR2_TARGET_OPTIMIZATION to '-mnan=2008' + - MIPS32r2 - Little-Endian, Soft-Float, Legacy NaN, o32 ABI + Select 'MIPS (little endian)' Target Architecture + Select 'mips 32r2' Target Architecture Variant + Enable 'Use soft-float' + - MIPS32r2 - Little-Endian, Hard-Float, 2008 NaN, o32 ABI, microMIPS + Select 'MIPS (little endian)' Target Architecture + Select 'mips 32r2' Target Architecture Variant + Enable 'Use soft-float' + Set BR2_TARGET_OPTIMIZATION to '-mmicromips' + - MIPS32r2 - Little-Endian, Soft-Float, Legacy NaN, o32 ABI, microMIPS + Select 'MIPS (little endian)' Target Architecture + Select 'mips 32r2' Target Architecture Variant + Disable 'Use soft-float' + Set BR2_TARGET_OPTIMIZATION to '-mmicromips' + - MIPS64r2 - Big-Endian, Hard-Float, Legacy NaN, n32 ABI + Select 'MIPS64 (big endian)' Target Architecture + Select 'mips 64r2' Target Architecture Variant + Select 'n32' Target ABI + Disable 'Use soft-float' + - MIPS64r2 - Little-Endian, Hard-Float, Legacy NaN, n32 ABI + Select 'MIPS64 (little endian)' Target Architecture + Select 'mips 64r2' Target Architecture Variant + Select 'n32' Target ABI + Disable 'Use soft-float' + - MIPS64r2 - Big-Endian, Hard-Float, Legacy NaN, n64 ABI + Select 'MIPS64 (big endian)' Target Architecture + Select 'mips 64r2' Target Architecture Variant + Select 'n64' Target ABI + Disable 'Use soft-float' + - MIPS64r2 - Little-Endian, Hard-Float, Legacy NaN, n64 ABI + Select 'MIPS64 (little endian)' Target Architecture + Select 'mips 64r2' Target Architecture Variant + Select 'n64' Target ABI + Disable 'Use soft-float' diff --git a/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in.options b/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in.options new file mode 100644 index 0000000000..464c9b8448 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "mips-mti-linux-gnu" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-codescape-mti-mips" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/toolchain-external-codescape-mti-mips.hash b/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/toolchain-external-codescape-mti-mips.hash new file mode 100644 index 0000000000..d31f99803b --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/toolchain-external-codescape-mti-mips.hash @@ -0,0 +1,4 @@ +# Codescape toolchains from Imagination Technologies +# From: http://codescape-mips-sdk.imgtec.com/components/toolchain/2016.05-06/downloads.html +sha256 3a7aba259beb05f0e3054b5a61a368a5085447f47361949a938ac9cc7de4227b Codescape.GNU.Tools.Package.2016.05-06.for.MIPS.MTI.Linux.CentOS-5.x86.tar.gz +sha256 a676a8b3647c8c651fb8935a75db8f00b79d36ec55676f7c05bac12b550788f7 Codescape.GNU.Tools.Package.2016.05-06.for.MIPS.MTI.Linux.CentOS-5.x86_64.tar.gz diff --git a/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/toolchain-external-codescape-mti-mips.mk b/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/toolchain-external-codescape-mti-mips.mk new file mode 100644 index 0000000000..d63a367578 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/toolchain-external-codescape-mti-mips.mk @@ -0,0 +1,51 @@ +################################################################################ +# +# toolchain-external-codescape-mti-mips +# +################################################################################ + +TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_VERSION = 2016.05-06 +TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_SITE = http://codescape-mips-sdk.imgtec.com/components/toolchain/$(TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_VERSION) +TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_STRIP_COMPONENTS = 2 + +ifeq ($(HOSTARCH),x86) +TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_SOURCE = Codescape.GNU.Tools.Package.$(TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_VERSION).for.MIPS.MTI.Linux.CentOS-5.x86.tar.gz +else +TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_SOURCE = Codescape.GNU.Tools.Package.$(TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_VERSION).for.MIPS.MTI.Linux.CentOS-5.x86_64.tar.gz +endif + +# Special fixup for Codescape MIPS toolchains, that have bin- and +# sbin- directories. We create symlinks bin -> bin- and sbin +# -> sbin- so that the rest of Buildroot can find the toolchain +# tools in the appropriate location. +ifeq ($(BR2_MIPS_OABI32),y) +TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_BIN_DIR_SUFFIX = o32 +else ifeq ($(BR2_MIPS_NABI32),y) +TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_BIN_DIR_SUFFIX = n32 +else ifeq ($(BR2_MIPS_NABI64),y) +TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_BIN_DIR_SUFFIX = n64 +endif + +define TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_STAGING_FIXUPS + rmdir $(STAGING_DIR)/usr/bin $(STAGING_DIR)/usr/sbin + ln -sf bin-$(TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_BIN_DIR_SUFFIX) $(STAGING_DIR)/usr/bin + ln -sf sbin-$(TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_BIN_DIR_SUFFIX) $(STAGING_DIR)/usr/sbin +endef + +# The Codescape toolchain uses a sysroot layout that places them +# side-by-side instead of nested like multilibs. A symlink is needed +# much like for the nested sysroots which are handled in +# copy_toolchain_sysroot but there is not enough information in there +# to determine whether the sysroot layout was nested or side-by-side. +# Add the symlink here for now. +define TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_SYMLINK + $(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))"; \ + ARCH_SUBDIR=`basename $${ARCH_SYSROOT_DIR}`; \ + ln -snf . $(STAGING_DIR)/$${ARCH_SUBDIR} +endef + +TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_POST_INSTALL_STAGING_HOOKS += \ + TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_STAGING_FIXUPS \ + TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_SYMLINK + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/Config.in b/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/Config.in new file mode 100644 index 0000000000..2fbb218ecc --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/Config.in @@ -0,0 +1,17 @@ +config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64 + bool "CodeSourcery AArch64 2014.11" + depends on BR2_aarch64 + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on !BR2_STATIC_LIBS + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_TOOLCHAIN_HAS_SSP + select BR2_INSTALL_LIBSTDCPP + select BR2_HOSTARCH_NEEDS_IA32_LIBS + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_16 + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + help + Sourcery CodeBench toolchain for the AArch64 architecture, + from Mentor Graphics. It uses gcc 4.9.1, binutils + 2.24.51.20140217, glibc 2.20, gdb 7.7.50 and kernel headers + 3.16.2. diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/Config.in.options b/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/Config.in.options new file mode 100644 index 0000000000..1eab839216 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64 + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "aarch64-amd-linux-gnu" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-codesourcery-aarch64" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/toolchain-external-codesourcery-aarch64.hash b/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/toolchain-external-codesourcery-aarch64.hash new file mode 100644 index 0000000000..f7d3f29fdc --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/toolchain-external-codesourcery-aarch64.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 405aada821146755c5f2df566375c2a682456d6b8451ee47b88cf1a52b093676 aarch64-amd-2014.11-95-aarch64-amd-linux-gnu-i686-pc-linux-gnu.tar.bz2 +sha256 3f50dd6ee433eb5b6992a1071b988e50379a738f54f58722bc60081613764716 aarch64-amd-2014.11-95-aarch64-amd-linux-gnu.src.tar.bz2 diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/toolchain-external-codesourcery-aarch64.mk b/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/toolchain-external-codesourcery-aarch64.mk new file mode 100644 index 0000000000..bc58c44c71 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-aarch64/toolchain-external-codesourcery-aarch64.mk @@ -0,0 +1,22 @@ +################################################################################ +# +# toolchain-external-codesourcery-aarch64 +# +################################################################################ + +TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_SITE = http://sourcery.mentor.com/public/gnu_toolchain/$(TOOLCHAIN_EXTERNAL_PREFIX) +TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_VERSION = 2014.11-95 +TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_SOURCE = aarch64-amd-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX)-i686-pc-linux-gnu.tar.bz2 +TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_ACTUAL_SOURCE_TARBALL = aarch64-amd-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX).src.tar.bz2 + +define TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_STAGING_FIXUP + ln -sf ld-2.20.so $(STAGING_DIR)/lib/ld-linux-aarch64.so.1 +endef +TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_STAGING_FIXUP + +define TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_TARGET_FIXUP + ln -sf ld-2.20.so $(TARGET_DIR)/lib/ld-linux-aarch64.so.1 +endef +TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_POST_INSTALL_TARGET_HOOKS += TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_TARGET_FIXUP + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Config.in b/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Config.in new file mode 100644 index 0000000000..32d79eba1c --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Config.in @@ -0,0 +1,24 @@ +config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64 + bool "Sourcery CodeBench AMD64 2016.11" + depends on BR2_x86_64 + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on !BR2_STATIC_LIBS + depends on BR2_x86_jaguar || BR2_x86_steamroller + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_TOOLCHAIN_HAS_SSP + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_INSTALL_LIBSTDCPP + select BR2_HOSTARCH_NEEDS_IA32_LIBS + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_7 + select BR2_TOOLCHAIN_GCC_AT_LEAST_6 + help + Sourcery CodeBench toolchain for the amd64 (x86_64) + architectures, from Mentor Graphics. It uses gcc 6.2, + binutils 2.26, glibc 2.24, gdb 7.11 and kernel headers + 4.7. It has support for the following variants: + - AMD Puma/Jaguar (family 16h), glibc + Default for x86_64, nothing special to do. + - AMD Steamroller (family 15h), glibc + Select a steamroller core. + No other architecture variants are supported since glibc + is optimized for one of these two baselines. diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Config.in.options b/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Config.in.options new file mode 100644 index 0000000000..2ab23026e9 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64 + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "x86_64-amd-linux-gnu" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-codesourcery-amd64" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/toolchain-external-codesourcery-amd64.hash b/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/toolchain-external-codesourcery-amd64.hash new file mode 100644 index 0000000000..291e6a59f6 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/toolchain-external-codesourcery-amd64.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 a6c23837dd45a33866c60a2fd8d7af40520cd84ff1059abda797952d7ee0fafd amd-2016.11-19-x86_64-amd-linux-gnu-i686-pc-linux-gnu.tar.bz2 +sha256 d61ce0b5648ad63cca16fe233c82e7eaa6a3212a549d69a527e7a2d5350f7b4a amd-2016.11-19-x86_64-amd-linux-gnu.src.tar.bz2 diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/toolchain-external-codesourcery-amd64.mk b/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/toolchain-external-codesourcery-amd64.mk new file mode 100644 index 0000000000..1697e5e679 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-amd64/toolchain-external-codesourcery-amd64.mk @@ -0,0 +1,12 @@ +################################################################################ +# +# toolchain-external-codesourcery-amd64 +# +################################################################################ + +TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64_SITE = https://sourcery.mentor.com/public/gnu_toolchain/$(TOOLCHAIN_EXTERNAL_PREFIX) +TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64_VERSION = 2016.11-19 +TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64_SOURCE = amd-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX)-i686-pc-linux-gnu.tar.bz2 +TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64_ACTUAL_SOURCE_TARBALL = amd-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX).src.tar.bz2 + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-arm/Config.in b/toolchain/toolchain-external/toolchain-external-codesourcery-arm/Config.in new file mode 100644 index 0000000000..6331873dbd --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-arm/Config.in @@ -0,0 +1,35 @@ +config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM + bool "Sourcery CodeBench ARM 2014.05" + depends on BR2_arm + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on BR2_ARM_EABI + # Unsupported ARM cores + depends on !BR2_cortex_a12 && !BR2_cortex_a17 && !BR2_ARM_CPU_ARMV8 + depends on !BR2_STATIC_LIBS + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_TOOLCHAIN_HAS_SSP + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_INSTALL_LIBSTDCPP + select BR2_HOSTARCH_NEEDS_IA32_LIBS + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13 + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 + help + Sourcery CodeBench toolchain for the ARM architecture, from + Mentor Graphics. It uses gcc 4.8.3, binutils 2.24.51, glibc + 2.18 and gdb 7.7.50, kernel headers 3.13. It has support + for the following variants: + - ARMv5TE, little endian, soft-float, glibc + Select ARM926T, ARM10T, XScale or another ARMv5 core + Select BR2_SOFT_FLOAT + - ARMv4T, little endian, soft-float, glibc + Select ARM720T, ARM920T, ARM922T or another ARMv4 core + Select BR2_SOFT_FLOAT + - ARMv7-A, Thumb 2, little endian, soft-float, glibc + Select Cortex-A8, Cortex-A9 or another ARMv7-A core + Select BR2_SOFT_FLOAT + Set BR2_TARGET_OPTIMIZATION to -mthumb + +comment "Sourcery CodeBench toolchains available for the EABI ABI" + depends on BR2_arm + depends on !BR2_ARM_EABI + depends on !BR2_STATIC_LIBS diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-arm/Config.in.options b/toolchain/toolchain-external/toolchain-external-codesourcery-arm/Config.in.options new file mode 100644 index 0000000000..7f3654dc70 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-arm/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "arm-none-linux-gnueabi" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-codesourcery-arm" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-arm/toolchain-external-codesourcery-arm.hash b/toolchain/toolchain-external/toolchain-external-codesourcery-arm/toolchain-external-codesourcery-arm.hash new file mode 100644 index 0000000000..535f4aaf99 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-arm/toolchain-external-codesourcery-arm.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 39ee0e789034334ecc89af94e838e3a4815400ac5ff980f808f466b04778532e arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 +sha256 e16a5b1e41d7ff1e74161f9405182001bc8d1360d89564e73911032e6966cc0d arm-2014.05-29-arm-none-linux-gnueabi.src.tar.bz2 diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-arm/toolchain-external-codesourcery-arm.mk b/toolchain/toolchain-external/toolchain-external-codesourcery-arm/toolchain-external-codesourcery-arm.mk new file mode 100644 index 0000000000..f96a0e0b6e --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-arm/toolchain-external-codesourcery-arm.mk @@ -0,0 +1,13 @@ +################################################################################ +# +# toolchain-external-codesourcery-arm +# +################################################################################ + +TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM_VERSION = 2014.05-29 + +TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM_SITE = http://sourcery.mentor.com/public/gnu_toolchain/$(TOOLCHAIN_EXTERNAL_PREFIX) +TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM_SOURCE = arm-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX)-i686-pc-linux-gnu.tar.bz2 +TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM_ACTUAL_SOURCE_TARBALL = arm-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX).src.tar.bz2 + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in b/toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in new file mode 100644 index 0000000000..6a13ae6cd6 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in @@ -0,0 +1,93 @@ +config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS + bool "Sourcery CodeBench MIPS 2016.05" + depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el + depends on BR2_MIPS_CPU_MIPS32R2 || BR2_MIPS_CPU_MIPS64R2 + # Unsupported MIPS cores + depends on !BR2_mips_interaptiv + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on !BR2_MIPS_NABI32 + depends on !BR2_STATIC_LIBS + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_TOOLCHAIN_HAS_SSP + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_INSTALL_LIBSTDCPP + select BR2_HOSTARCH_NEEDS_IA32_LIBS + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_4 + select BR2_TOOLCHAIN_GCC_AT_LEAST_5 + help + Sourcery CodeBench toolchain for the MIPS architecture, from + Mentor Graphics. It uses gcc 5.3, binutils 2.25.51, glibc + 2.23, uClibc 0.9.30 and gdb 7.10.50, kernel headers 4.4.1. It + has support for the following variants: + - MIPS32r2 - Big-Endian, 2008 NaN, O32 + Select MIPS (big endian) core + Disable BR2_SOFT_FLOAT + Set BR2_TARGET_OPTIMIZATION to -mnan=2008 + - MIPS32r2 - Big-Endian, O32 + Select MIPS (big endian) core + Disable BR2_SOFT_FLOAT + - MIPS32r2 - Big-Endian, O32, MIPS16 + Select MIPS (big endian) core + Disable BR2_SOFT_FLOAT + Set BR2_TARGET_OPTIMIZATION to -mips16 + - MIPS32r2 - Big-Endian, Soft-Float, O32 + Select MIPS (big endian) core + Select BR2_SOFT_FLOAT + - MIPS32r2 - Big-Endian, Soft-Float, O32, MIPS16 + Select MIPS (big endian) core + Select BR2_SOFT_FLOAT + Set BR2_TARGET_OPTIMIZATION to -mips16 + - MIPS32r2 - Little-Endian, 2008 NaN, O32 + Select MIPS (little endian) core + Disable BR2_SOFT_FLOAT + Set BR2_TARGET_OPTIMIZATION to -mnan=2008 + - MIPS32r2 - Little-Endian, O32 + Select MIPS (little endian) core + Disable BR2_SOFT_FLOAT + - MIPS32r2 - Little-Endian, O32, MIPS16 + Select MIPS (little endian) core + Disable BR2_SOFT_FLOAT + Set BR2_TARGET_OPTIMIZATION to -mips16 + - MIPS32r2 - Little-Endian, Soft-Float, O32 + Select MIPS (little endian) core + Select BR2_SOFT_FLOAT + - MIPS32r2 - Little-Endian, Soft-Float, O32, MIPS16 + Select MIPS (little endian) core + Select BR2_SOFT_FLOAT + Set BR2_TARGET_OPTIMIZATION to -mips16 + - MIPS32r2 - Little-Endian, Soft-Float, O32, microMIPS + Select MIPS (little endian) core + Select BR2_SOFT_FLOAT + Set BR2_TARGET_OPTIMIZATION to -mmicromips + - MIPS32r2 - uClibc, Big-Endian, 2008 NaN, O32 + Not usable in Buildroot yet. + - MIPS32r2 - uClibc, Big-Endian, O32 + Not usable in Buildroot yet. + - MIPS32r2 - uClibc, Big-Endian, Soft-Float, O32 + Not usable in Buildroot yet. + - MIPS32r2 - uClibc, Little-Endian, 2008 NaN, O32 + Not usable in Buildroot yet. + - MIPS32r2 - uClibc, Little-Endian, O32 + Not usable in Buildroot yet. + - MIPS32r2 - uClibc, Little-Endian, Soft-Float, O32 + Not usable in Buildroot yet. + - MIPS64r2 - Big-Endian, N64 + Select MIPS64 (big endian) core + Select the n64 ABI + Disable BR2_SOFT_FLOAT + - MIPS64r2 - Big-Endian, Soft-Float, N64 + Select MIPS64 (big endian) core + Select the n64 ABI + Select BR2_SOFT_FLOAT + - MIPS64r2 - Little-Endian, N64 + Select MIPS64 (little endian) core + Select the n64 ABI + Disable BR2_SOFT_FLOAT + - MIPS64r2 - Little-Endian, Soft-Float, N64 + Select MIPS64 (little endian) core + Select the n64 ABI + Select BR2_SOFT_FLOAT + +comment "Sourcery CodeBench toolchains are only available for MIPS/MIPS64 o32 and n64" + depends on BR2_MIPS_NABI32 + depends on !BR2_STATIC_LIBS diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in.options b/toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in.options new file mode 100644 index 0000000000..677cc67d67 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "mips-linux-gnu" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-codesourcery-mips" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-mips/toolchain-external-codesourcery-mips.hash b/toolchain/toolchain-external/toolchain-external-codesourcery-mips/toolchain-external-codesourcery-mips.hash new file mode 100644 index 0000000000..2d80338e7b --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-mips/toolchain-external-codesourcery-mips.hash @@ -0,0 +1,3 @@ +# Locally computed +sha256 d354447c4c5160439dafd5464fa3a0266dd41e79f973477238e4f0215a6b5397 mips-2016.05-8-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2 +sha256 2658e55d5b71bba25d6f77e868e18b200ea5f75c8add7ed3a9266e716d9adfff mips-2016.05-8-mips-linux-gnu.src.tar.bz2 diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-mips/toolchain-external-codesourcery-mips.mk b/toolchain/toolchain-external/toolchain-external-codesourcery-mips/toolchain-external-codesourcery-mips.mk new file mode 100644 index 0000000000..5117d475cb --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-mips/toolchain-external-codesourcery-mips.mk @@ -0,0 +1,13 @@ +################################################################################ +# +# toolchain-external-codesourcery-mips +# +################################################################################ + +TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS_VERSION = 2016.05-8 + +TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS_SITE = http://sourcery.mentor.com/public/gnu_toolchain/$(TOOLCHAIN_EXTERNAL_PREFIX) +TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS_SOURCE = mips-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX)-i686-pc-linux-gnu.tar.bz2 +TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS_ACTUAL_SOURCE_TARBALL = mips-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX).src.tar.bz2 + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in b/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in new file mode 100644 index 0000000000..9675c67a15 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in @@ -0,0 +1,17 @@ +config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII + bool "Sourcery CodeBench Nios-II 2016.11" + depends on BR2_nios2 + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on !BR2_STATIC_LIBS + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_TOOLCHAIN_HAS_SSP + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_INSTALL_LIBSTDCPP + select BR2_HOSTARCH_NEEDS_IA32_LIBS + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_7 + select BR2_TOOLCHAIN_GCC_AT_LEAST_6 + select BR2_TOOLCHAIN_HAS_BINUTILS_BUG_19405 # based-on binutils-2.26 + help + Sourcery CodeBench toolchain for the Nios-II architecture, + from Mentor Graphics. It uses gcc 6.2, binutils 2.26, + glibc 2.24, gdb 7.11 and kernel headers 4.7. diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in.options b/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in.options new file mode 100644 index 0000000000..07cc5ede94 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "nios2-linux-gnu" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-codesourcery-niosII" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.hash b/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.hash new file mode 100644 index 0000000000..17130b422d --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 97e3b878c67e46430f2b9a42b11bc95b1ef9fef263e6b5ee9103d1239c9e847d sourceryg++-2016.11-32-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2 +sha256 ee2c4391137be8fee987411301bbf9f0e4a823400e37c9f8c1cae9900485cbca sourceryg++-2016.11-32-nios2-linux-gnu.src.tar.bz2 diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.mk b/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.mk new file mode 100644 index 0000000000..7381061cec --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.mk @@ -0,0 +1,13 @@ +################################################################################ +# +# toolchain-external-codesourcery-niosII +# +################################################################################ + +TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_VERSION = 2016.11-32 + +TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_SITE = http://sourcery.mentor.com/public/gnu_toolchain/$(TOOLCHAIN_EXTERNAL_PREFIX) +TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_SOURCE = sourceryg++-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX)-i686-pc-linux-gnu.tar.bz2 +TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_ACTUAL_SOURCE_TARBALL = sourceryg++-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX).src.tar.bz2 + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-sh/Config.in b/toolchain/toolchain-external/toolchain-external-codesourcery-sh/Config.in new file mode 100644 index 0000000000..a47dab7611 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-sh/Config.in @@ -0,0 +1,25 @@ +config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH + bool "Sourcery CodeBench SH 2012.09" + depends on BR2_sh4a || BR2_sh4aeb + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on !BR2_STATIC_LIBS + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_TOOLCHAIN_HAS_SSP + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_INSTALL_LIBSTDCPP + select BR2_HOSTARCH_NEEDS_IA32_LIBS + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5 + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 + help + Sourcery CodeBench toolchain for the SuperH architecture, + from Mentor Graphics. It uses gcc 4.7.2, binutils 2.23.51, + glibc 2.16, uClibc 0.9.30, gdb 7.4.50 and kernel headers + 3.5.4. It has support for the following variants: + - SH4A, glibc, little endian + Default. + - SH4A, glibc, big endian + Add -mb to BR2_TARGET_OPTIMIZATION + - SH4A, uClibc, little endian + Not usable in Buildroot yet. + - SH4A, uClibc, big endian + Not usable in Buildroot yet. diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-sh/Config.in.options b/toolchain/toolchain-external/toolchain-external-codesourcery-sh/Config.in.options new file mode 100644 index 0000000000..90061cef49 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-sh/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "sh-linux-gnu" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-codesourcery-sh" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-sh/toolchain-external-codesourcery-sh.hash b/toolchain/toolchain-external/toolchain-external-codesourcery-sh/toolchain-external-codesourcery-sh.hash new file mode 100644 index 0000000000..ff2ba5f473 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-sh/toolchain-external-codesourcery-sh.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 59d6766fde244931aa52db01433d5acd051998762a931121c5fc109536a1a802 renesas-2012.09-61-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2 +sha256 e2e58c10e52395d5d35157e35f85233f713c6f9223a652dfc56194cfd2eed004 renesas-2012.09-61-sh-linux-gnu.src.tar.bz2 diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-sh/toolchain-external-codesourcery-sh.mk b/toolchain/toolchain-external/toolchain-external-codesourcery-sh/toolchain-external-codesourcery-sh.mk new file mode 100644 index 0000000000..5370bb22a8 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-sh/toolchain-external-codesourcery-sh.mk @@ -0,0 +1,13 @@ +################################################################################ +# +# toolchain-external-sourcery-sh +# +################################################################################ + +TOOLCHAIN_EXTERNAL_CODESOURCERY_SH_VERSION = 2012.09-61 + +TOOLCHAIN_EXTERNAL_CODESOURCERY_SH_SITE = https://sourcery.mentor.com/public/gnu_toolchain/$(TOOLCHAIN_EXTERNAL_PREFIX) +TOOLCHAIN_EXTERNAL_CODESOURCERY_SH_SOURCE = renesas-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_SH_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX)-i686-pc-linux-gnu.tar.bz2 +TOOLCHAIN_EXTERNAL_CODESOURCERY_SH_ACTUAL_SOURCE_TARBALL = renesas-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_SH_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX).src.tar.bz2 + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-x86/Config.in b/toolchain/toolchain-external/toolchain-external-codesourcery-x86/Config.in new file mode 100644 index 0000000000..bcbdd26938 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-x86/Config.in @@ -0,0 +1,29 @@ +config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86 + bool "Sourcery CodeBench x86/x86_64 2012.09" + depends on BR2_i386 || BR2_x86_64 + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on !BR2_STATIC_LIBS + depends on !BR2_x86_jaguar + depends on !BR2_x86_steamroller + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_TOOLCHAIN_HAS_SSP + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_INSTALL_LIBSTDCPP + select BR2_HOSTARCH_NEEDS_IA32_LIBS + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5 + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 + help + Sourcery CodeBench toolchain for the x86/x86_64 + architectures, from Mentor Graphics. It uses gcc 4.7.2, + binutils 2.23.51, glibc 2.16, gdb 7.4.50 and kernel headers + 3.5.4. It has support for the following variants: + - Intel Pentium 4, glibc, 32 bits + Default for x86, nothing special to do. + - Intel Atom, glibc, 32 bits + Select an Atom core + - Intel Xeon, glibc, 64 bits + Default for x86_64, nothing special to do. + - Intel Core 2, glibc, 64 bits + Select a Core 2 core + Other architecture variants (beyond Pentium-4/Xeon) are + supported as well, but glibc is not optimised for it. diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-x86/Config.in.options b/toolchain/toolchain-external/toolchain-external-codesourcery-x86/Config.in.options new file mode 100644 index 0000000000..65b62f3236 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-x86/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86 + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "i686-pc-linux-gnu" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-codesourcery-x86" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-x86/toolchain-external-codesourcery-x86.hash b/toolchain/toolchain-external/toolchain-external-codesourcery-x86/toolchain-external-codesourcery-x86.hash new file mode 100644 index 0000000000..a003f7ab3c --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-x86/toolchain-external-codesourcery-x86.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 ea804cf02014369da52abc4f64e91e96bde2dd2230aca96109459013d4545458 ia32-2012.09-62-i686-pc-linux-gnu-i386-linux.tar.bz2 +sha256 1a9519e415a1e6892c760bf21f7e98f3a633a9d1c5bb8781a96d338e4dd62717 ia32-2012.09-62-i686-pc-linux-gnu.src.tar.bz2 diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-x86/toolchain-external-codesourcery-x86.mk b/toolchain/toolchain-external/toolchain-external-codesourcery-x86/toolchain-external-codesourcery-x86.mk new file mode 100644 index 0000000000..5ee6991c0c --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-x86/toolchain-external-codesourcery-x86.mk @@ -0,0 +1,12 @@ +################################################################################ +# +# toolchain-external-codesourcery-x86 +# +################################################################################ + +TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_SITE = https://sourcery.mentor.com/public/gnu_toolchain/$(TOOLCHAIN_EXTERNAL_PREFIX) +TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_VERSION = 2012.09-62 +TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_SOURCE = ia32-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX)-i386-linux.tar.bz2 +TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_ACTUAL_SOURCE_TARBALL = ia32-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX).src.tar.bz2 + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in b/toolchain/toolchain-external/toolchain-external-custom/Config.in new file mode 100644 index 0000000000..a913feb34e --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in @@ -0,0 +1,5 @@ +config BR2_TOOLCHAIN_EXTERNAL_CUSTOM + bool "Custom toolchain" + help + Use this option to use a custom toolchain pre-installed on + your system. diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options new file mode 100644 index 0000000000..ed2b082d7b --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options @@ -0,0 +1,349 @@ +if BR2_TOOLCHAIN_EXTERNAL_CUSTOM + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-custom" + +config BR2_TOOLCHAIN_EXTERNAL_URL + string "Toolchain URL" + depends on BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD + help + URL of the custom toolchain tarball to download and install. + +config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX + string "Toolchain prefix" + default "$(ARCH)-linux" + +choice + bool "External toolchain gcc version" + default BR2_TOOLCHAIN_EXTERNAL_GCC_4_3 + help + Set to the gcc version that is used by your external + toolchain. + +config BR2_TOOLCHAIN_EXTERNAL_GCC_6 + bool "6.x" + select BR2_TOOLCHAIN_GCC_AT_LEAST_6 + +config BR2_TOOLCHAIN_EXTERNAL_GCC_5 + bool "5.x" + select BR2_TOOLCHAIN_GCC_AT_LEAST_5 + +config BR2_TOOLCHAIN_EXTERNAL_GCC_4_9 + bool "4.9.x" + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + +config BR2_TOOLCHAIN_EXTERNAL_GCC_4_8 + bool "4.8.x" + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 + +config BR2_TOOLCHAIN_EXTERNAL_GCC_4_7 + bool "4.7.x" + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 + +config BR2_TOOLCHAIN_EXTERNAL_GCC_4_6 + bool "4.6.x" + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_6 + +config BR2_TOOLCHAIN_EXTERNAL_GCC_4_5 + bool "4.5.x" + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 + +config BR2_TOOLCHAIN_EXTERNAL_GCC_4_4 + bool "4.4.x" + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_4 + +config BR2_TOOLCHAIN_EXTERNAL_GCC_4_3 + bool "4.3.x" + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_3 + +config BR2_TOOLCHAIN_EXTERNAL_GCC_OLD + bool "older" + help + Use this option if your GCC version is older than any of the + above. + + Note that the Buildroot community doesn't do any testing with + such old toolchains. Some packages may fail to build in + surprising ways, or the generated root filesystem may not + work at all. Use such old toolchains at your own risk. + +endchoice + +choice + bool "External toolchain kernel headers series" + default BR2_TOOLCHAIN_EXTERNAL_HEADERS_REALLY_OLD + help + Set to the kernel headers version that were used to build + this external toolchain. + + This is used to hide/show some packages that have strict + requirements on the version of kernel headers. + + If unsure what version your toolchain is using, you can look + at the value of LINUX_VERSION_CODE in linux/version.h in your + toolchain. The Linux version is M.m.p, with: + M = ( LINUX_VERSION_CODE >> 16 ) & 0xFF + m = ( LINUX_VERSION_CODE >> 8 ) & 0xFF + p = ( LINUX_VERSION_CODE >> 0 ) & 0xFF + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_9 + bool "4.9.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_9 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_8 + bool "4.8.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_7 + bool "4.7.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_7 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_6 + bool "4.6.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_6 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_5 + bool "4.5.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_4 + bool "4.4.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_4 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_3 + bool "4.3.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_3 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_2 + bool "4.2.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_2 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_1 + bool "4.1.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_1 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_0 + bool "4.0.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_19 + bool "3.19.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_19 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_18 + bool "3.18.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_18 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_17 + bool "3.17.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_16 + bool "3.16.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_16 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_15 + bool "3.15.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_14 + bool "3.14.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_13 + bool "3.13.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_12 + bool "3.12.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_11 + bool "3.11.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_11 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10 + bool "3.10.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_9 + bool "3.9.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_9 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_8 + bool "3.8.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_8 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_7 + bool "3.7.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_7 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_6 + bool "3.6.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_6 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_5 + bool "3.5.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_4 + bool "3.4.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_4 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_3 + bool "3.3.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_2 + bool "3.2.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_1 + bool "3.1.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_1 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_0 + bool "3.0.x" + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 + +config BR2_TOOLCHAIN_EXTERNAL_HEADERS_REALLY_OLD + bool "2.6.x" + +endchoice + +choice + prompt "External toolchain C library" + default BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC + +config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC + bool "uClibc/uClibc-ng" + select BR2_TOOLCHAIN_EXTERNAL_UCLIBC + # For the time being, we assume that all custom external + # toolchains have shadow password support. + select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS + help + Select this option if your external toolchain uses the + uClibc (available from http://www.uclibc.org/) + or uClibc-ng (available from http://www.uclibc-ng.org) + C library. + +config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC + bool "glibc/eglibc" + depends on !BR2_STATIC_LIBS + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + help + Select this option if your external toolchain uses the GNU C + library (available from https://www.gnu.org/software/libc/) + or its variant the eglibc library (http://www.eglibc.org/). + + Note: eglibc is a variant of glibc that (among other things) + can be configured to exclude some of its features. Using a + toolchain with eglibc configured to exclude key features may + cause build failures to some packages. + +comment "(e)glibc only available with shared lib support" + depends on BR2_STATIC_LIBS + +config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL + bool "musl (experimental)" + select BR2_TOOLCHAIN_EXTERNAL_MUSL + help + Select this option if your external toolchain uses the + 'musl' C library, available from http://www.musl-libc.org/. + +endchoice + +if BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC + +config BR2_TOOLCHAIN_EXTERNAL_WCHAR + bool "Toolchain has WCHAR support?" + select BR2_USE_WCHAR + help + Select this option if your external toolchain supports + WCHAR. If you don't know, leave the default value, Buildroot + will tell you if it's correct or not. + +config BR2_TOOLCHAIN_EXTERNAL_LOCALE + bool "Toolchain has locale support?" + select BR2_TOOLCHAIN_EXTERNAL_WCHAR + select BR2_ENABLE_LOCALE + help + Select this option if your external toolchain has locale + support. If you don't know, leave the default value, + Buildroot will tell you if it's correct or not. + +config BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS + bool "Toolchain has threads support?" + select BR2_TOOLCHAIN_HAS_THREADS + default y + help + Select this option if your external toolchain has thread + support. If you don't know, leave the default value, + Buildroot will tell you if it's correct or not. + +if BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS + +config BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG + bool "Toolchain has threads debugging support?" + select BR2_TOOLCHAIN_HAS_THREADS_DEBUG + default y + help + Select this option if your external toolchain has thread + debugging support. If you don't know, leave the default + value, Buildroot will tell you if it's correct or not. + +config BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_NPTL + bool "Toolchain has NPTL threads support?" + select BR2_TOOLCHAIN_HAS_THREADS_NPTL + default y + help + Select this option if your external toolchain uses the NPTL + (Native Posix Thread Library) implementation of Posix + threads. If you don't know, leave the default value, + Buildroot will tell you if it's correct or not. + +endif # BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS + +endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC + +config BR2_TOOLCHAIN_EXTERNAL_HAS_SSP + bool "Toolchain has SSP support?" + select BR2_TOOLCHAIN_HAS_SSP + default y if BR2_TOOLCHAIN_EXTERNAL_GLIBC + default y if BR2_TOOLCHAIN_EXTERNAL_MUSL + help + Selection this option if your external toolchain has Stack + Smashing Protection support enabled. If you don't know, + leave the default value, Buildroot will tell you if it's + correct or not. + +config BR2_TOOLCHAIN_EXTERNAL_INET_RPC + bool "Toolchain has RPC support?" + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + depends on !BR2_TOOLCHAIN_EXTERNAL_MUSL + default y if BR2_TOOLCHAIN_EXTERNAL_GLIBC + help + Select this option if your external toolchain supports + RPC. If you don't know, leave the default value, Buildroot + will tell you if it's correct or not. + +config BR2_TOOLCHAIN_EXTERNAL_CXX + bool "Toolchain has C++ support?" + select BR2_INSTALL_LIBSTDCPP + help + Select this option if your external toolchain has C++ + support. If you don't know, leave the default value, + Buildroot will tell you if it's correct or not. + +config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS + string "Extra toolchain libraries to be copied to target" + help + If your external toolchain provides extra libraries that + need to be copied to the target filesystem, enter them + here, separated by spaces. They will be copied to the + target's /lib directory. + +endif diff --git a/toolchain/toolchain-external/toolchain-external-custom/toolchain-external-custom.mk b/toolchain/toolchain-external/toolchain-external-custom/toolchain-external-custom.mk new file mode 100644 index 0000000000..c4ae6125ef --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-custom/toolchain-external-custom.mk @@ -0,0 +1,15 @@ +################################################################################ +# +# toolchain-external-custom +# +################################################################################ + +TOOLCHAIN_EXTERNAL_CUSTOM_SITE = $(patsubst %/,%,$(dir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL)))) +TOOLCHAIN_EXTERNAL_CUSTOM_SOURCE = $(notdir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL))) + +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CUSTOM),y) +# We can't check hashes for custom downloaded toolchains +BR_NO_CHECK_HASH_FOR += $(TOOLCHAIN_EXTERNAL_SOURCE) +endif + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in b/toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in new file mode 100644 index 0000000000..4dc8dacbe4 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in @@ -0,0 +1,15 @@ +config BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 + bool "Linaro AArch64 2016.11" + depends on BR2_aarch64 + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on !BR2_STATIC_LIBS + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_TOOLCHAIN_HAS_SSP + select BR2_INSTALL_LIBSTDCPP + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_6 + select BR2_TOOLCHAIN_GCC_AT_LEAST_6 + select BR2_TOOLCHAIN_HAS_FORTRAN + help + Toolchain for the AArch64 architecture, from + http://www.linaro.org/engineering/armv8/ diff --git a/toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in.options b/toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in.options new file mode 100644 index 0000000000..099c6c0d07 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "aarch64-linux-gnu" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-linaro-aarch64" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-linaro-aarch64/toolchain-external-linaro-aarch64.hash b/toolchain/toolchain-external/toolchain-external-linaro-aarch64/toolchain-external-linaro-aarch64.hash new file mode 100644 index 0000000000..f7f4209060 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-aarch64/toolchain-external-linaro-aarch64.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 057156a47b9cd68cdc0b48adcbe96c8249e3653b082f6c051dd75cb644f64b3a gcc-linaro-6.2.1-2016.11-i686_aarch64-linux-gnu.tar.xz +sha256 539cc29320bd84178cd093aae0b06b1ee5476511cecaba989faf9c6a1d4cdf81 gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu.tar.xz diff --git a/toolchain/toolchain-external/toolchain-external-linaro-aarch64/toolchain-external-linaro-aarch64.mk b/toolchain/toolchain-external/toolchain-external-linaro-aarch64/toolchain-external-linaro-aarch64.mk new file mode 100644 index 0000000000..fb498fe273 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-aarch64/toolchain-external-linaro-aarch64.mk @@ -0,0 +1,16 @@ +################################################################################ +# +# toolchain-external-linaro-aarch64 +# +################################################################################ + +TOOLCHAIN_EXTERNAL_LINARO_AARCH64_VERSION = 2016.11 +TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SITE = https://releases.linaro.org/components/toolchain/binaries/6.2-$(TOOLCHAIN_EXTERNAL_LINARO_AARCH64_VERSION)/aarch64-linux-gnu + +ifeq ($(HOSTARCH),x86) +TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SOURCE = gcc-linaro-6.2.1-$(TOOLCHAIN_EXTERNAL_LINARO_AARCH64_VERSION)-i686_aarch64-linux-gnu.tar.xz +else +TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SOURCE = gcc-linaro-6.2.1-$(TOOLCHAIN_EXTERNAL_LINARO_AARCH64_VERSION)-x86_64_aarch64-linux-gnu.tar.xz +endif + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in b/toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in new file mode 100644 index 0000000000..78aeb8ea41 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in @@ -0,0 +1,27 @@ +comment "Linaro toolchains available for Cortex-A + EABIhf" + depends on BR2_arm + depends on !BR2_ARM_CPU_ARMV7A || !BR2_ARM_EABIHF + depends on !BR2_STATIC_LIBS + +config BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM + bool "Linaro ARM 2016.11" + depends on BR2_arm + depends on BR2_ARM_CPU_ARMV7A || BR2_ARM_CPU_ARMV8 + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on BR2_ARM_EABIHF + depends on !BR2_STATIC_LIBS + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_TOOLCHAIN_HAS_SSP + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_INSTALL_LIBSTDCPP + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_6 + select BR2_TOOLCHAIN_GCC_AT_LEAST_6 + select BR2_TOOLCHAIN_HAS_FORTRAN + help + Linaro toolchain for the ARM architecture. It uses Linaro + GCC 2016.11 (based on gcc 6.2.1), Linaro GDB 2016.11 (based on + GDB 7.12), glibc 2.23, Binutils 2016.11 (based on 2.27). It + generates code that runs on all Cortex-A profile devices, + but tuned for the Cortex-A9. The code generated is Thumb 2, + with the hard floating point calling convention, and uses + the VFPv3-D16 FPU instructions. diff --git a/toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in.options b/toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in.options new file mode 100644 index 0000000000..dcbc6599d9 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "arm-linux-gnueabihf" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-linaro-arm" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-linaro-arm/toolchain-external-linaro-arm.hash b/toolchain/toolchain-external/toolchain-external-linaro-arm/toolchain-external-linaro-arm.hash new file mode 100644 index 0000000000..d4452c3786 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-arm/toolchain-external-linaro-arm.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 a2a4968bfb8537c1b3280b4f475d90d53a1a0f05f7afc7b43efed266cc4de446 gcc-linaro-6.2.1-2016.11-i686_arm-linux-gnueabihf.tar.xz +sha256 5eb7ab2f8a0b4b960900321505cd6923a072cb3e2412102f5f72a6e74c2f0a55 gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf.tar.xz diff --git a/toolchain/toolchain-external/toolchain-external-linaro-arm/toolchain-external-linaro-arm.mk b/toolchain/toolchain-external/toolchain-external-linaro-arm/toolchain-external-linaro-arm.mk new file mode 100644 index 0000000000..e098f47757 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-arm/toolchain-external-linaro-arm.mk @@ -0,0 +1,16 @@ +################################################################################ +# +# toolchain-external-linaro-arm +# +################################################################################ + +TOOLCHAIN_EXTERNAL_LINARO_ARM_VERSION = 2016.11 +TOOLCHAIN_EXTERNAL_LINARO_ARM_SITE = https://releases.linaro.org/components/toolchain/binaries/6.2-$(TOOLCHAIN_EXTERNAL_LINARO_ARM_VERSION)/arm-linux-gnueabihf + +ifeq ($(HOSTARCH),x86) +TOOLCHAIN_EXTERNAL_LINARO_ARM_SOURCE = gcc-linaro-6.2.1-$(TOOLCHAIN_EXTERNAL_LINARO_ARM_VERSION)-i686_arm-linux-gnueabihf.tar.xz +else +TOOLCHAIN_EXTERNAL_LINARO_ARM_SOURCE = gcc-linaro-6.2.1-$(TOOLCHAIN_EXTERNAL_LINARO_ARM_VERSION)-x86_64_arm-linux-gnueabihf.tar.xz +endif + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in b/toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in new file mode 100644 index 0000000000..c7f2f5f60c --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in @@ -0,0 +1,26 @@ +comment "Linaro toolchains available for Cortex-A + EABIhf" + depends on BR2_armeb + depends on !BR2_ARM_CPU_ARMV7A || !BR2_ARM_EABIHF + depends on !BR2_STATIC_LIBS + +config BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB + bool "Linaro armeb 2016.11" + depends on BR2_armeb + depends on BR2_ARM_CPU_ARMV7A || BR2_ARM_CPU_ARMV8 + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on BR2_ARM_EABIHF + depends on !BR2_STATIC_LIBS + select BR2_TOOLCHAIN_EXTERNAL_GLIBC + select BR2_TOOLCHAIN_HAS_SSP + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_INSTALL_LIBSTDCPP + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_6 + select BR2_TOOLCHAIN_GCC_AT_LEAST_6 + help + Linaro toolchain for the ARM big endian architecture. It + uses Linaro GCC 2016.11 (based on gcc 6.2.1), Linaro GDB + 2016.11 (based on GDB 7.12), glibc 2.23, Binutils 2016.11 + (based on 2.27). It generates code that runs on all Cortex-A + profile devices, but tuned for the Cortex-A9. The code + generated is Thumb 2, with the hard floating point calling + convention, and uses the VFPv3-D16 FPU instructions. diff --git a/toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in.options b/toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in.options new file mode 100644 index 0000000000..225e90f009 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in.options @@ -0,0 +1,9 @@ +if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "armeb-linux-gnueabihf" + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-linaro-armeb" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-linaro-armeb/toolchain-external-linaro-armeb.hash b/toolchain/toolchain-external/toolchain-external-linaro-armeb/toolchain-external-linaro-armeb.hash new file mode 100644 index 0000000000..a041539ba6 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-armeb/toolchain-external-linaro-armeb.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 05a34c56da56b9b1e1a61ad1217dc4e751e1d277932dbeaa82b6c242cf0f2ec9 gcc-linaro-6.2.1-2016.11-i686_armeb-linux-gnueabihf.tar.xz +sha256 319cb7c6363a3116357b163d0b4f9e0c27cfcb6153f3c26a34edf892819f12e5 gcc-linaro-6.2.1-2016.11-x86_64_armeb-linux-gnueabihf.tar.xz diff --git a/toolchain/toolchain-external/toolchain-external-linaro-armeb/toolchain-external-linaro-armeb.mk b/toolchain/toolchain-external/toolchain-external-linaro-armeb/toolchain-external-linaro-armeb.mk new file mode 100644 index 0000000000..ba138e1b50 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-linaro-armeb/toolchain-external-linaro-armeb.mk @@ -0,0 +1,16 @@ +################################################################################ +# +# toolchain-external-linaro-armeb +# +################################################################################ + +TOOLCHAIN_EXTERNAL_LINARO_ARMEB_VERSION = 2016.11 +TOOLCHAIN_EXTERNAL_LINARO_ARMEB_SITE = https://releases.linaro.org/components/toolchain/binaries/6.2-$(TOOLCHAIN_EXTERNAL_LINARO_ARMEB_VERSION)/armeb-linux-gnueabihf + +ifeq ($(HOSTARCH),x86) +TOOLCHAIN_EXTERNAL_LINARO_ARMEB_SOURCE = gcc-linaro-6.2.1-$(TOOLCHAIN_EXTERNAL_LINARO_ARMEB_VERSION)-i686_armeb-linux-gnueabihf.tar.xz +else +TOOLCHAIN_EXTERNAL_LINARO_ARMEB_SOURCE = gcc-linaro-6.2.1-$(TOOLCHAIN_EXTERNAL_LINARO_ARMEB_VERSION)-x86_64_armeb-linux-gnueabihf.tar.xz +endif + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in b/toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in new file mode 100644 index 0000000000..f438ea765d --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in @@ -0,0 +1,18 @@ +config BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC + bool "Synopsys ARC 2016.09 toolchain" + depends on BR2_arc + depends on BR2_HOSTARCH = "x86_64" + select BR2_TOOLCHAIN_EXTERNAL_UCLIBC + select BR2_INSTALL_LIBSTDCPP + select BR2_TOOLCHAIN_HAS_NATIVE_RPC + select BR2_ENABLE_LOCALE + select BR2_USE_WCHAR + select BR2_TOOLCHAIN_HAS_THREADS + select BR2_TOOLCHAIN_HAS_THREADS_NPTL + select BR2_TOOLCHAIN_HAS_THREADS_DEBUG + select BR2_TOOLCHAIN_HAS_SSP + select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8 + select BR2_TOOLCHAIN_GCC_AT_LEAST_6 + help + Toolchain for the ARC cores, from + https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases diff --git a/toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in.options b/toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in.options new file mode 100644 index 0000000000..ceb7dd0081 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in.options @@ -0,0 +1,10 @@ +if BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + default "arc-linux" if BR2_arcle + default "arceb-linux" if BR2_arceb + +config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL + default "toolchain-external-synopsys-arc" + +endif diff --git a/toolchain/toolchain-external/toolchain-external-synopsys-arc/toolchain-external-synopsys-arc.hash b/toolchain/toolchain-external/toolchain-external-synopsys-arc/toolchain-external-synopsys-arc.hash new file mode 100644 index 0000000000..c96f53b1f6 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-synopsys-arc/toolchain-external-synopsys-arc.hash @@ -0,0 +1,5 @@ +# Locally calculated +sha256 9123e35510cc9105e5f9468d5154e0093770d7c11ed771c1a595ecf813692baf arc_gnu_2016.09_prebuilt_uclibc_le_arc700_linux_install.tar.gz +sha256 3140066cdbda2df7ed0fb60424bbd9db740fb25393928e733234b0bf65508df2 arc_gnu_2016.09_prebuilt_uclibc_be_arc700_linux_install.tar.gz +sha256 aa6edb2101b13df3ac59f8d8ccbcfba37a6f7882f0e03baa9d9883480dbed4e7 arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install.tar.gz +sha256 4de227bf73536a87784d88e5f10085b91ede62c76ef8fedf53b4bf2e215054cf arc_gnu_2016.09_prebuilt_uclibc_be_archs_linux_install.tar.gz diff --git a/toolchain/toolchain-external/toolchain-external-synopsys-arc/toolchain-external-synopsys-arc.mk b/toolchain/toolchain-external/toolchain-external-synopsys-arc/toolchain-external-synopsys-arc.mk new file mode 100644 index 0000000000..f4cb7b73a1 --- /dev/null +++ b/toolchain/toolchain-external/toolchain-external-synopsys-arc/toolchain-external-synopsys-arc.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# toolchain-external-synopsys-arc +# +################################################################################ + +TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_VERSION = 2016.09 +TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_SITE = https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_VERSION)-release + +ifeq ($(BR2_arc750d)$(BR2_arc770d),y) +TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_CORE = arc700 +else +TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_CORE = archs +endif + +ifeq ($(BR2_arcle),y) +TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_ENDIANESS = le +else +TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_ENDIANESS = be +endif + +TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_SOURCE = arc_gnu_$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_VERSION)_prebuilt_uclibc_$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_ENDIANESS)_$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_CORE)_linux_install.tar.gz + +$(eval $(toolchain-external-package)) diff --git a/toolchain/toolchain-external/toolchain-external.hash b/toolchain/toolchain-external/toolchain-external.hash deleted file mode 100644 index 9be3c7a071..0000000000 --- a/toolchain/toolchain-external/toolchain-external.hash +++ /dev/null @@ -1,70 +0,0 @@ -###################################### -# Next hashes are all locally computed - -# Blackfin toolchains from Analog Devices -sha256 e424e90d8481d942a40266d78d1488726561fed3ec38403094f98055e61889d0 blackfin-toolchain-2014R1-RC2.i386.tar.bz2 -sha256 c65b1b4b918d5185349d62a3b7bf43b4b21e1175c52598ec047ca56b3f11d857 blackfin-toolchain-uclibc-full-2014R1-RC2.i386.tar.bz2 - -# Mentor's Sourcery CodeBench Lite toolchains -# ARM -sha256 39ee0e789034334ecc89af94e838e3a4815400ac5ff980f808f466b04778532e arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 -sha256 e16a5b1e41d7ff1e74161f9405182001bc8d1360d89564e73911032e6966cc0d arm-2014.05-29-arm-none-linux-gnueabi.src.tar.bz2 -# NiosII -sha256 e43899fd950e5d06e90c2eb01527c626240b6b4a603cbbeb532fad9fb8ea58c3 sourceryg++-2015.11-130-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2 -sha256 c412375ba3f93bafc9225de22366fa5b3f4d073ef856cf19595237ddb0815e6d sourceryg++-2015.11-130-nios2-linux-gnu.src.tar.bz2 -# SuperH -sha256 59d6766fde244931aa52db01433d5acd051998762a931121c5fc109536a1a802 renesas-2012.09-61-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2 -sha256 e2e58c10e52395d5d35157e35f85233f713c6f9223a652dfc56194cfd2eed004 renesas-2012.09-61-sh-linux-gnu.src.tar.bz2 -# x86 -sha256 ea804cf02014369da52abc4f64e91e96bde2dd2230aca96109459013d4545458 ia32-2012.09-62-i686-pc-linux-gnu-i386-linux.tar.bz2 -sha256 1a9519e415a1e6892c760bf21f7e98f3a633a9d1c5bb8781a96d338e4dd62717 ia32-2012.09-62-i686-pc-linux-gnu.src.tar.bz2 -# AMD64 -sha256 3c31206c8b9277f409ee00e4777ba82dfa6da2a4ca0926501cd5fb6bbd1b407e amd-2015.11-139-x86_64-amd-linux-gnu-i686-pc-linux-gnu.tar.bz2 -sha256 0b673f5035f97d5d03c31272cddab0f117d39ad76a5ad2a3bc98c156571527de amd-2015.11-139-x86_64-amd-linux-gnu.src.tar.bz2 -# Aarch64 -sha256 405aada821146755c5f2df566375c2a682456d6b8451ee47b88cf1a52b093676 aarch64-amd-2014.11-95-aarch64-amd-linux-gnu-i686-pc-linux-gnu.tar.bz2 -sha256 3f50dd6ee433eb5b6992a1071b988e50379a738f54f58722bc60081613764716 aarch64-amd-2014.11-95-aarch64-amd-linux-gnu.src.tar.bz2 -# MIPS -sha256 d354447c4c5160439dafd5464fa3a0266dd41e79f973477238e4f0215a6b5397 mips-2016.05-8-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2 -sha256 2658e55d5b71bba25d6f77e868e18b200ea5f75c8add7ed3a9266e716d9adfff mips-2016.05-8-mips-linux-gnu.src.tar.bz2 - -# ARM toolchains from Texas Instrument's Arago project -# There is one source file that covers both binary distributions. -sha256 f2febf3b3c565536461ad4405f1bcb835d75a6afb2a8bec958a1248cb4b81fc7 arago-2011.09-armv7a-linux-gnueabi-sdk.tar.bz2 -sha256 254af7d02eb3bcc8345c78e131700bc995d65b68232caaed21150a5fd1456070 arago-2011.09-armv5te-linux-gnueabi-sdk.tar.bz2 -sha256 25fbf0513ad7322b15cbaae964cafadcbb4c939f2708f57f40b8f9f2d601122b arago-toolchain-2011.09-sources.tar.bz2 - -# ARM and Aarch64 toolchains from Linaro -sha256 0cffac0caea0eb3c8bdddfa14be011ce366680f40aeddbefc7cf23cb6d4f1891 gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz -sha256 eafeb3a5247e9ce31aa35d812e296fba5d5f1443e106d9bef9e38d3ee3ade006 gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_src.tar.bz2 -sha256 dd66f07662e1f3b555eaa0d076f133b6db702ab0b9ab18f7dfc91a23eab653c5 gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz -sha256 4bc9d86390f8fa67a693ba4768ba5b12faaf7dd37c706c05ccd9321e765226e4 gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_linux.tar.xz -sha256 bf5d3111dad5aa9aef0e955875fb7fc9e918cb24519af7014dd67a9e581a49b1 gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_src.tar.bz2 -sha256 f488caf46680b0c0a16b66b43fbfd157e3d6389df18e957983132e89529a9804 gcc-linaro-5.3-2016.02-x86_64_armeb-linux-gnueabihf.tar.xz -sha256 3954f496ab01de67241109e82abfaa9b7625fdab4f05e79e7902e9814a07b832 gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz -sha256 a7b8f842fdc9d9be22ca4e0c999429780fc6f16ea798b032421b5ec0cfa53b3e gcc-linaro-aarch64-linux-gnu-4.9-2014.09_src.tar.bz2 -sha256 1c85af550bedd378be583317b4abbdc96342b42c19fb19873c13d3093ff694ad gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu.tar.xz - -# Codescape toolchains from Imagination Technologies -# From: http://codescape-mips-sdk.imgtec.com/components/toolchain/2015.10-04/ -sha256 9222d7b08b908ce0d5fa80a3623f8c51251be51af02629600b89693f09f566c8 Codescape.GNU.Tools.Package.2015.10-04.for.MIPS.IMG.Linux.CentOS-5.x86.tar.gz -sha256 6eca906933424146e2059641a2ec85f1b163c1a3942a31c39472aba5a3f116be Codescape.GNU.Tools.Package.2015.10-04.for.MIPS.MTI.Linux.CentOS-5.x86.tar.gz - -# Synopsys DesignWare ARC toolchains -sha256 1fa4ea2c8616623205f1c7beca02ea31b019099528a7433e5b020b0876b93bf3 arc_gnu_2014.12_prebuilt_uclibc_le_arc700_linux_install.tar.gz -sha256 1080f07fcae2bfc176a3ea8d30b9ed8eaecab70fb786639d6ec70cae8322df10 arc_gnu_2014.12_prebuilt_uclibc_be_arc700_linux_install.tar.gz -sha256 aaaf6facd1f60a3cd2a537154ea39cd7d70501c175e30e01a97e8df6cb8226c7 arc_gnu_2014.12_prebuilt_uclibc_le_archs_linux_install.tar.gz -sha256 30711c5f15762764d4cd5ec1e6ced5b1fddd03aac41c424b0c4ec8a45d5d79cd arc_gnu_2014.12_prebuilt_uclibc_be_archs_linux_install.tar.gz - -# Prebuilt musl toolchains from musl-cross -sha256 e32c23d0b83639fc10ad06666ec086b66453b9be44415fe1a818c3c3b526dfb1 crossx86-armeb-linux-musleabi-1.1.12.tar.xz -sha256 eb81bd5d6ada454c6e854b18bfa8dc801333782152166f6cab9fb7cd11692987 crossx86-arm-linux-musleabi-1.1.12.tar.xz -sha256 a050da284ff22d291ae71dfc249ebdedb18334b8d626804760ce7d5963e392e6 crossx86-arm-linux-musleabihf-1.1.12.tar.xz -sha256 18d07f5c8f4cfe373461cf21cf7b1bfefa820a37e96a69b68e0f315d528b4286 crossx86-i486-linux-musl-1.1.12.tar.xz -sha256 1c1480c2618097e402fe804c1431fbd49b0d43520af81d4c1a695a2fa13a3922 crossx86-mipsel-linux-musl-1.1.12.tar.xz -sha256 f0a8b3eb0566138ab3cc77bc09648be15bc325da974ec98b9e67f2fb82be3295 crossx86-mipsel-sf-linux-musl-1.1.12.tar.xz -sha256 6a99989c3dff56776981f6760b2c54dcb9e4032be1d649968bb06c04f2e64177 crossx86-mips-linux-musl-1.1.12.tar.xz -sha256 c082adc3e8b0750bb22ca82628524fd525fd77f534517ac5a66e7ac5a297ee6e crossx86-powerpc-linux-musl-1.1.12.tar.xz -sha256 8c6c9ebb54040e47947b4d3af6823d01fef2bb6ee81b18903c801030c066092b crossx86-sh4eb-linux-musl-1.1.12.tar.xz -sha256 ae9a0a5a60226aa086a56628cfd5c1d283c9dffdca37891d7e6adc2bd21ac2e0 crossx86-sh4-linux-musl-1.1.12.tar.xz -sha256 27e0ea1043a58aebeadf1dacd67e47fd0b5c19fc36f42c9374e5fa3308df09c6 crossx86-x86_64-linux-musl-1.1.12.tar.xz diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index 47b951dfa7..48de1e71f2 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -4,790 +4,25 @@ # ################################################################################ -# -# This package implements the support for external toolchains, i.e -# toolchains that are available pre-built, ready to use. Such toolchain -# may either be readily available on the Web (Linaro, Sourcery -# CodeBench, from processor vendors) or may be built with tools like -# Crosstool-NG or Buildroot itself. So far, we have tested this -# with: -# -# * Toolchains generated by Crosstool-NG -# * Toolchains generated by Buildroot -# * Toolchains provided by Linaro for the ARM and AArch64 -# architectures -# * Sourcery CodeBench toolchains (from Mentor Graphics) for the ARM, -# MIPS, PowerPC, x86, x86_64 and NIOS 2 architectures. For the MIPS -# toolchain, the -muclibc variant isn't supported yet, only the -# default glibc-based variant is. -# * Analog Devices toolchains for the Blackfin architecture -# * Xilinx toolchains for the Microblaze architecture -# * Synopsys DesignWare toolchains for ARC cores -# -# The basic principle is the following -# -# 1. If the toolchain is not pre-installed, download and extract it -# in $(TOOLCHAIN_EXTERNAL_INSTALL_DIR). Otherwise, -# $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) points to were the toolchain has -# already been installed by the user. -# -# 2. For all external toolchains, perform some checks on the -# conformity between the toolchain configuration described in the -# Buildroot menuconfig system, and the real configuration of the -# external toolchain. This is for example important to make sure that -# the Buildroot configuration system knows whether the toolchain -# supports RPC, IPv6, locales, large files, etc. Unfortunately, these -# things cannot be detected automatically, since the value of these -# options (such as BR2_TOOLCHAIN_HAS_NATIVE_RPC) are needed at -# configuration time because these options are used as dependencies -# for other options. And at configuration time, we are not able to -# retrieve the external toolchain configuration. -# -# 3. Copy the libraries needed at runtime to the target directory, -# $(TARGET_DIR). Obviously, things such as the C library, the dynamic -# loader and a few other utility libraries are needed if dynamic -# applications are to be executed on the target system. -# -# 4. Copy the libraries and headers to the staging directory. This -# will allow all further calls to gcc to be made using --sysroot -# $(STAGING_DIR), which greatly simplifies the compilation of the -# packages when using external toolchains. So in the end, only the -# cross-compiler binaries remains external, all libraries and headers -# are imported into the Buildroot tree. -# -# 5. Build a toolchain wrapper which executes the external toolchain -# with a number of arguments (sysroot/march/mtune/..) hardcoded, -# so we're sure the correct configuration is always used and the -# toolchain behaves similar to an internal toolchain. -# This toolchain wrapper and symlinks are installed into -# $(HOST_DIR)/usr/bin like for the internal toolchains, and the rest -# of Buildroot is handled identical for the 2 toolchain types. - -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y) -TOOLCHAIN_EXTERNAL_LIBS += libatomic.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.* -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_ARM_EABIHF),yy) -TOOLCHAIN_EXTERNAL_LIBS += ld-linux-armhf.so.* -else -TOOLCHAIN_EXTERNAL_LIBS += ld*.so.* -endif -ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) -TOOLCHAIN_EXTERNAL_LIBS += libpthread.so.* -ifneq ($(BR2_PACKAGE_GDB)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),) -TOOLCHAIN_EXTERNAL_LIBS += libthread_db.so.* -endif # gdbserver -endif # ! no threads -endif - -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y) -TOOLCHAIN_EXTERNAL_LIBS += libnss_files.so.* libnss_dns.so.* -endif - -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y) -TOOLCHAIN_EXTERNAL_LIBS += libc.so libgcc_s.so.* -endif - -ifeq ($(BR2_INSTALL_LIBSTDCPP),y) -TOOLCHAIN_EXTERNAL_LIBS += libstdc++.so.* -endif - -TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS)) - -# Details about sysroot directory selection. -# -# To find the sysroot directory, we use the trick of looking for the -# 'libc.a' file with the -print-file-name gcc option, and then -# mangling the path to find the base directory of the sysroot. -# -# Note that we do not use the -print-sysroot option, because it is -# only available since gcc 4.4.x, and we only recently dropped support -# for 4.2.x and 4.3.x. -# -# When doing this, we don't pass any option to gcc that could select a -# multilib variant (such as -march) as we want the "main" sysroot, -# which contains all variants of the C library in the case of multilib -# toolchains. We use the TARGET_CC_NO_SYSROOT variable, which is the -# path of the cross-compiler, without the --sysroot=$(STAGING_DIR), -# since what we want to find is the location of the original toolchain -# sysroot. This "main" sysroot directory is stored in SYSROOT_DIR. -# -# Then, multilib toolchains are a little bit more complicated, since -# they in fact have multiple sysroots, one for each variant supported -# by the toolchain. So we need to find the particular sysroot we're -# interested in. -# -# To do so, we ask the compiler where its sysroot is by passing all -# flags (including -march and al.), except the --sysroot flag since we -# want to the compiler to tell us where its original sysroot -# is. ARCH_SUBDIR will contain the subdirectory, in the main -# SYSROOT_DIR, that corresponds to the selected architecture -# variant. ARCH_SYSROOT_DIR will contain the full path to this -# location. -# -# One might wonder why we don't just bother with ARCH_SYSROOT_DIR. The -# fact is that in multilib toolchains, the header files are often only -# present in the main sysroot, and only the libraries are available in -# each variant-specific sysroot directory. - - -TOOLCHAIN_EXTERNAL_PREFIX = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX)) -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y) -TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(HOST_DIR)/opt/ext-toolchain -else -TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH)) -endif - -ifeq ($(TOOLCHAIN_EXTERNAL_INSTALL_DIR),) -ifneq ($(TOOLCHAIN_EXTERNAL_PREFIX),) -# if no path set, figure it out from path -TOOLCHAIN_EXTERNAL_BIN := $(shell dirname $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc)) -endif -else -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX),y) -TOOLCHAIN_EXTERNAL_BIN := $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/$(TOOLCHAIN_EXTERNAL_PREFIX)/bin -else -TOOLCHAIN_EXTERNAL_BIN := $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/bin -endif -endif - -# If this is a buildroot toolchain, it already has a wrapper which we want to -# bypass. Since this is only evaluated after it has been extracted, we can use -# $(wildcard ...) here. -TOOLCHAIN_EXTERNAL_SUFFIX = \ - $(if $(wildcard $(TOOLCHAIN_EXTERNAL_BIN)/*.br_real),.br_real) -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += \ - -DBR_CROSS_PATH_SUFFIX='"$(TOOLCHAIN_EXTERNAL_SUFFIX)"' - -TOOLCHAIN_EXTERNAL_CROSS = $(TOOLCHAIN_EXTERNAL_BIN)/$(TOOLCHAIN_EXTERNAL_PREFIX)- -TOOLCHAIN_EXTERNAL_CC = $(TOOLCHAIN_EXTERNAL_CROSS)gcc$(TOOLCHAIN_EXTERNAL_SUFFIX) -TOOLCHAIN_EXTERNAL_CXX = $(TOOLCHAIN_EXTERNAL_CROSS)g++$(TOOLCHAIN_EXTERNAL_SUFFIX) -TOOLCHAIN_EXTERNAL_READELF = $(TOOLCHAIN_EXTERNAL_CROSS)readelf$(TOOLCHAIN_EXTERNAL_SUFFIX) - -ifeq ($(filter $(HOST_DIR)/%,$(TOOLCHAIN_EXTERNAL_BIN)),) -# TOOLCHAIN_EXTERNAL_BIN points outside HOST_DIR => absolute path -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += \ - -DBR_CROSS_PATH_ABS='"$(TOOLCHAIN_EXTERNAL_BIN)"' -else -# TOOLCHAIN_EXTERNAL_BIN points inside HOST_DIR => relative path -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += \ - -DBR_CROSS_PATH_REL='"$(TOOLCHAIN_EXTERNAL_BIN:$(HOST_DIR)/%=%)"' -endif - -ifeq ($(call qstrip,$(BR2_GCC_TARGET_CPU_REVISION)),) -CC_TARGET_CPU_ := $(call qstrip,$(BR2_GCC_TARGET_CPU)) -else -CC_TARGET_CPU_ := $(call qstrip,$(BR2_GCC_TARGET_CPU)-$(BR2_GCC_TARGET_CPU_REVISION)) -endif -CC_TARGET_ARCH_ := $(call qstrip,$(BR2_GCC_TARGET_ARCH)) -CC_TARGET_ABI_ := $(call qstrip,$(BR2_GCC_TARGET_ABI)) -CC_TARGET_FPU_ := $(call qstrip,$(BR2_GCC_TARGET_FPU)) -CC_TARGET_FLOAT_ABI_ := $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI)) -CC_TARGET_MODE_ := $(call qstrip,$(BR2_GCC_TARGET_MODE)) - -# march/mtune/floating point mode needs to be passed to the external toolchain -# to select the right multilib variant -ifeq ($(BR2_x86_64),y) -TOOLCHAIN_EXTERNAL_CFLAGS += -m64 -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_64 -endif -ifneq ($(CC_TARGET_ARCH_),) -TOOLCHAIN_EXTERNAL_CFLAGS += -march=$(CC_TARGET_ARCH_) -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ARCH='"$(CC_TARGET_ARCH_)"' -endif -ifneq ($(CC_TARGET_CPU_),) -TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_) -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"' -endif -ifneq ($(CC_TARGET_ABI_),) -TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_) -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"' -endif -ifneq ($(CC_TARGET_FPU_),) -TOOLCHAIN_EXTERNAL_CFLAGS += -mfpu=$(CC_TARGET_FPU_) -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FPU='"$(CC_TARGET_FPU_)"' -endif -ifneq ($(CC_TARGET_FLOAT_ABI_),) -TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(CC_TARGET_FLOAT_ABI_) -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(CC_TARGET_FLOAT_ABI_)"' -endif -ifneq ($(CC_TARGET_MODE_),) -TOOLCHAIN_EXTERNAL_CFLAGS += -m$(CC_TARGET_MODE_) -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MODE='"$(CC_TARGET_MODE_)"' -endif -ifeq ($(BR2_BINFMT_FLAT),y) -TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_BINFMT_FLAT -endif -ifeq ($(BR2_mipsel)$(BR2_mips64el),y) -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MIPS_TARGET_LITTLE_ENDIAN -TOOLCHAIN_EXTERNAL_CFLAGS += -EL -endif -ifeq ($(BR2_mips)$(BR2_mips64),y) -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MIPS_TARGET_BIG_ENDIAN -TOOLCHAIN_EXTERNAL_CFLAGS += -EB -endif -ifeq ($(BR2_arceb),y) -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ARC_TARGET_BIG_ENDIAN -TOOLCHAIN_EXTERNAL_CFLAGS += -EB -endif - -TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION)) - -ifeq ($(BR2_SOFT_FLOAT),y) -TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float -TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_SOFTFLOAT=1 -endif - -# musl does not provide a sys/queue.h implementation, so add the -# netbsd-queue package that will install a sys/queue.h file in the -# staging directory based on the NetBSD implementation. -ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) -TOOLCHAIN_EXTERNAL_DEPENDENCIES += netbsd-queue -endif - -# The Linaro ARMhf toolchain expects the libraries in -# {/usr,}/lib/arm-linux-gnueabihf, but Buildroot copies them to -# {/usr,}/lib, so we need to create a symbolic link. -define TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK - ln -snf . $(TARGET_DIR)/lib/arm-linux-gnueabihf - ln -snf . $(TARGET_DIR)/usr/lib/arm-linux-gnueabihf -endef - -define TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK - ln -snf . $(TARGET_DIR)/lib/armeb-linux-gnueabihf - ln -snf . $(TARGET_DIR)/usr/lib/armeb-linux-gnueabihf -endef - -define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK - ln -snf . $(TARGET_DIR)/lib/aarch64-linux-gnu - ln -snf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu -endef - -# Special fixup for Codescape MIPS toolchains, that have bin- and -# sbin- directories. We create symlinks bin -> bin- and sbin -# -> sbin- so that the rest of Buildroot can find the toolchain -# tools in the appropriate location. -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS)$(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS),y) -ifeq ($(BR2_MIPS_OABI32),y) -TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_BIN_DIR_SUFFIX = o32 -else ifeq ($(BR2_MIPS_NABI32),y) -TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_BIN_DIR_SUFFIX = n32 -else ifeq ($(BR2_MIPS_NABI64),y) -TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_BIN_DIR_SUFFIX = n64 -endif - -define TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_STAGING_FIXUPS - rmdir $(STAGING_DIR)/usr/bin $(STAGING_DIR)/usr/sbin - ln -sf bin-$(TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_BIN_DIR_SUFFIX) $(STAGING_DIR)/usr/bin - ln -sf sbin-$(TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_BIN_DIR_SUFFIX) $(STAGING_DIR)/usr/sbin -endef -endif - -# Special handling for Blackfin toolchain, because of the split in two -# tarballs, and the organization of tarball contents. The tarballs -# contain ./opt/uClinux/{bfin-uclinux,bfin-linux-uclibc} directories, -# which themselves contain the toolchain. This is why we strip more -# components than usual. -define TOOLCHAIN_EXTERNAL_BLACKFIN_UCLIBC_EXTRA_EXTRACT - $(call suitable-extractor,$(TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS)) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS) | \ - $(TAR) --strip-components=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) - -endef - -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM),y) -TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi -TOOLCHAIN_EXTERNAL_SOURCE = arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV7A),y) -TOOLCHAIN_EXTERNAL_SITE = http://software-dl.ti.com/sdoemb/sdoemb_public_sw/arago_toolchain/2011_09/exports -TOOLCHAIN_EXTERNAL_SOURCE = arago-2011.09-armv7a-linux-gnueabi-sdk.tar.bz2 -TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = arago-toolchain-2011.09-sources.tar.bz2 -define TOOLCHAIN_EXTERNAL_FIXUP_CMDS - mv $(@D)/arago-2011.09/armv7a/* $(@D)/ - rm -rf $(@D)/arago-2011.09/ -endef -TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS += TOOLCHAIN_EXTERNAL_FIXUP_CMDS -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE),y) -TOOLCHAIN_EXTERNAL_SITE = http://software-dl.ti.com/sdoemb/sdoemb_public_sw/arago_toolchain/2011_09/exports -TOOLCHAIN_EXTERNAL_SOURCE = arago-2011.09-armv5te-linux-gnueabi-sdk.tar.bz2 -TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = arago-toolchain-2011.09-sources.tar.bz2 -define TOOLCHAIN_EXTERNAL_FIXUP_CMDS - mv $(@D)/arago-2011.09/armv5te/* $(@D)/ - rm -rf $(@D)/arago-2011.09/ -endef -TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS += TOOLCHAIN_EXTERNAL_FIXUP_CMDS -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM),y) -ifeq ($(HOSTARCH),x86) -TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries -TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz -TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_src.tar.bz2 -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK -else -TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.3-2016.02/arm-linux-gnueabihf -TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz -endif -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB),y) -ifeq ($(HOSTARCH),x86) -TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries -TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_linux.tar.xz -TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_src.tar.bz2 -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK -else -TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.3-2016.02/armeb-linux-gnueabihf -TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.3-2016.02-x86_64_armeb-linux-gnueabihf.tar.xz -endif -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS),y) -TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/mips-linux-gnu -TOOLCHAIN_EXTERNAL_SOURCE = mips-2016.05-8-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2 -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII),y) -TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/nios2-linux-gnu -TOOLCHAIN_EXTERNAL_SOURCE = sourceryg++-2015.11-130-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2 -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH),y) -TOOLCHAIN_EXTERNAL_SITE = https://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu -TOOLCHAIN_EXTERNAL_SOURCE = renesas-2012.09-61-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2 -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86),y) -TOOLCHAIN_EXTERNAL_SITE = https://sourcery.mentor.com/public/gnu_toolchain/i686-pc-linux-gnu -TOOLCHAIN_EXTERNAL_SOURCE = ia32-2012.09-62-i686-pc-linux-gnu-i386-linux.tar.bz2 -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64),y) -TOOLCHAIN_EXTERNAL_SITE = https://sourcery.mentor.com/public/gnu_toolchain/x86_64-amd-linux-gnu -TOOLCHAIN_EXTERNAL_SOURCE = amd-2015.11-139-x86_64-amd-linux-gnu-i686-pc-linux-gnu.tar.bz2 -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS),y) -TOOLCHAIN_EXTERNAL_SITE = http://codescape-mips-sdk.imgtec.com/components/toolchain/2015.10-04 -TOOLCHAIN_EXTERNAL_SOURCE = Codescape.GNU.Tools.Package.2015.10-04.for.MIPS.IMG.Linux.CentOS-5.x86.tar.gz -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_STAGING_FIXUPS -TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS = 2 -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS),y) -TOOLCHAIN_EXTERNAL_SITE = http://codescape-mips-sdk.imgtec.com/components/toolchain/2015.10-04 -TOOLCHAIN_EXTERNAL_SOURCE = Codescape.GNU.Tools.Package.2015.10-04.for.MIPS.MTI.Linux.CentOS-5.x86.tar.gz -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_STAGING_FIXUPS -TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS = 2 -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX),y) -TOOLCHAIN_EXTERNAL_SITE = http://downloads.sourceforge.net/project/adi-toolchain/2014R1/2014R1-RC2/i386 -TOOLCHAIN_EXTERNAL_SOURCE = blackfin-toolchain-2014R1-RC2.i386.tar.bz2 -TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS = blackfin-toolchain-uclibc-full-2014R1-RC2.i386.tar.bz2 -TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS = 3 -TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS += TOOLCHAIN_EXTERNAL_BLACKFIN_UCLIBC_EXTRA_EXTRACT -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64),y) -ifeq ($(HOSTARCH),x86) -TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries -TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz -TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-aarch64-linux-gnu-4.9-2014.09_src.tar.bz2 -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK -else -TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.3-2016.02/aarch64-linux-gnu -TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu.tar.xz -endif -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64),y) -TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/aarch64-amd-linux-gnu -TOOLCHAIN_EXTERNAL_SOURCE = aarch64-amd-2014.11-95-aarch64-amd-linux-gnu-i686-pc-linux-gnu.tar.bz2 -define TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_STAGING_FIXUP - ln -sf ld-2.20.so $(STAGING_DIR)/lib/ld-linux-aarch64.so.1 -endef -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_STAGING_FIXUP -define TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_TARGET_FIXUP - ln -sf ld-2.20.so $(TARGET_DIR)/lib/ld-linux-aarch64.so.1 -endef -TOOLCHAIN_EXTERNAL_POST_INSTALL_TARGET_HOOKS += TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64_TARGET_FIXUP -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS),y) -TOOLCHAIN_EXTERNAL_VERSION = 1.1.12 -TOOLCHAIN_EXTERNAL_SITE = https://googledrive.com/host/0BwnS5DMB0YQ6bDhPZkpOYVFhbk0/musl-$(TOOLCHAIN_EXTERNAL_VERSION) -ifeq ($(BR2_arm)$(BR2_ARM_EABI),yy) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-arm-linux-musleabi-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -else ifeq ($(BR2_arm)$(BR2_ARM_EABIHF),yy) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-arm-linux-musleabihf-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -else ifeq ($(BR2_armeb),y) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-armeb-linux-musleabi-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -else ifeq ($(BR2_i386),y) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-i486-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -else ifeq ($(BR2_mips),y) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-mips-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -else ifeq ($(BR2_mipsel):$(BR2_SOFT_FLOAT),y:) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-mipsel-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -else ifeq ($(BR2_mipsel):$(BR2_SOFT_FLOAT),y:y) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-mipsel-sf-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -else ifeq ($(BR2_powerpc),y) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-powerpc-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -else ifeq ($(BR2_sh4),y) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-sh4-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -else ifeq ($(BR2_sh4eb),y) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-sh4eb-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -else ifeq ($(BR2_x86_64),y) -TOOLCHAIN_EXTERNAL_SOURCE = crossx86-x86_64-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz -endif -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC),y) -TOOLCHAIN_EXTERNAL_SITE = https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2014.12 -ifeq ($(BR2_arc750d)$(BR2_arc770d),y) -TOOLCHAIN_EXTERNAL_SYNOPSYS_CORE = arc700 -else -TOOLCHAIN_EXTERNAL_SYNOPSYS_CORE = archs -endif -ifeq ($(BR2_arcle),y) -TOOLCHAIN_EXTERNAL_SYNOPSYS_ENDIANESS = le -else -TOOLCHAIN_EXTERNAL_SYNOPSYS_ENDIANESS = be -endif -TOOLCHAIN_EXTERNAL_SOURCE = arc_gnu_2014.12_prebuilt_uclibc_$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ENDIANESS)_$(TOOLCHAIN_EXTERNAL_SYNOPSYS_CORE)_linux_install.tar.gz -else -# Custom toolchain -TOOLCHAIN_EXTERNAL_SITE = $(patsubst %/,%,$(dir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL)))) -TOOLCHAIN_EXTERNAL_SOURCE = $(notdir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL))) -# We can't check hashes for custom downloaded toolchains -BR_NO_CHECK_HASH_FOR += $(TOOLCHAIN_EXTERNAL_SOURCE) -endif - -# Some toolchain vendors have a regular file naming pattern. -# For them, mass-define _ACTUAL_SOURCE_TARBALL based _SITE. -ifneq ($(findstring sourcery.mentor.com/public/gnu_toolchain,$(TOOLCHAIN_EXTERNAL_SITE)),) -TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL ?= \ - $(subst -i686-pc-linux-gnu.tar.bz2,.src.tar.bz2,$(subst -i686-pc-linux-gnu-i386-linux.tar.bz2,-i686-pc-linux-gnu.src.tar.bz2,$(TOOLCHAIN_EXTERNAL_SOURCE))) -endif - -# In fact, we don't need to download the toolchain, since it is already -# available on the system, so force the site and source to be empty so -# that nothing will be downloaded/extracted. -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_PREINSTALLED),y) -TOOLCHAIN_EXTERNAL_SITE = -TOOLCHAIN_EXTERNAL_SOURCE = -endif - TOOLCHAIN_EXTERNAL_ADD_TOOLCHAIN_DEPENDENCY = NO -TOOLCHAIN_EXTERNAL_INSTALL_STAGING = YES - -# Normal handling of downloaded toolchain tarball extraction. -ifneq ($(TOOLCHAIN_EXTERNAL_SOURCE),) -TOOLCHAIN_EXTERNAL_EXCLUDES = usr/lib/locale/* - -# As a regular package, the toolchain gets extracted in $(@D), but -# since it's actually a fairly special package, we need it to be moved -# into TOOLCHAIN_EXTERNAL_INSTALL_DIR. -define TOOLCHAIN_EXTERNAL_MOVE - rm -rf $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/* - mkdir -p $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) - mv $(@D)/* $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/ -endef -TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS += \ - TOOLCHAIN_EXTERNAL_MOVE +# musl does not provide an implementation for sys/queue.h or sys/cdefs.h. +# So, add the musl-compat-headers package that will install those files, +# into the staging directory: +# sys/queue.h: header from NetBSD +# sys/cdefs.h: minimalist header bundled in Buildroot +ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) +TOOLCHAIN_EXTERNAL_DEPENDENCIES += musl-compat-headers endif -# Returns the location of the libc.a file for the given compiler + flags -define toolchain_find_libc_a -$$(readlink -f $$(LANG=C $(1) -print-file-name=libc.a)) -endef +$(eval $(virtual-package)) -# Returns the sysroot location for the given compiler + flags. We need -# to handle cases where libc.a is in: -# -# - lib/ -# - usr/lib/ -# - lib32/ -# - lib64/ -# - lib32-fp/ (Cavium toolchain) -# - lib64-fp/ (Cavium toolchain) -# - usr/lib// (Linaro toolchain) -# -# And variations on these. -define toolchain_find_sysroot -$$(printf $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:(usr/)?lib(32|64)?([^/]*)?/([^/]*/)?libc\.a::') -endef - -# Returns the lib subdirectory for the given compiler + flags (i.e -# typically lib32 or lib64 for some toolchains) -define toolchain_find_libdir -$$(printf $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:.*/(usr/)?(lib(32|64)?([^/]*)?)/([^/]*/)?libc.a:\2:') -endef - -# Checks for an already installed toolchain: check the toolchain -# location, check that it is usable, and then verify that it -# matches the configuration provided in Buildroot: ABI, C++ support, -# kernel headers version, type of C library and all C library features. -define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS - $(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC)) - $(Q)$(call check_unusable_toolchain,$(TOOLCHAIN_EXTERNAL_CC)) - $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \ - $(call check_kernel_headers_version,\ - $(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC)),\ - $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \ - $(call check_gcc_version,$(TOOLCHAIN_EXTERNAL_CC),\ - $(call qstrip,$(BR2_TOOLCHAIN_GCC_AT_LEAST))); \ - if test "$(BR2_arm)" = "y" ; then \ - $(call check_arm_abi,\ - "$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)",\ - $(TOOLCHAIN_EXTERNAL_READELF)) ; \ - fi ; \ - if test "$(BR2_INSTALL_LIBSTDCPP)" = "y" ; then \ - $(call check_cplusplus,$(TOOLCHAIN_EXTERNAL_CXX)) ; \ - fi ; \ - if test "$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \ - $(call check_uclibc,$${SYSROOT_DIR}) ; \ - elif test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \ - $(call check_musl,$${SYSROOT_DIR}) ; \ - else \ - $(call check_glibc,$${SYSROOT_DIR}) ; \ - fi - $(Q)$(call check_toolchain_ssp,$(TOOLCHAIN_EXTERNAL_CC)) -endef - -# With the musl C library, the libc.so library directly plays the role -# of the dynamic library loader. We just need to create a symbolic -# link to libc.so with the appropriate name. -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y) -ifeq ($(BR2_i386),y) -MUSL_ARCH = i386 -else ifeq ($(BR2_ARM_EABIHF),y) -MUSL_ARCH = armhf -else ifeq ($(BR2_mipsel):$(BR2_SOFT_FLOAT),y:y) -MUSL_ARCH = mipsel-sf -else ifeq ($(BR2_sh),y) -MUSL_ARCH = sh -else -MUSL_ARCH = $(ARCH) +# Ensure the external-toolchain package has a prefix defined. +# This comes after the virtual-package definition, which checks the provider. +ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) +ifeq ($(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX)),) +$(error No prefix selected for external toolchain package $(BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL). Configuration error) endif -define TOOLCHAIN_EXTERNAL_MUSL_LD_LINK - ln -sf libc.so $(TARGET_DIR)/lib/ld-musl-$(MUSL_ARCH).so.1 -endef -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_MUSL_LD_LINK endif -# Create a symlink from (usr/)$(ARCH_LIB_DIR) to lib. -# Note: the skeleton package additionally creates lib32->lib or lib64->lib -# (as appropriate) -# -# $1: destination directory (TARGET_DIR / STAGING_DIR) -create_lib_symlinks = \ - $(Q)DESTDIR="$(strip $1)" ; \ - ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ - if [ ! -e "$${DESTDIR}/$${ARCH_LIB_DIR}" -a ! -e "$${DESTDIR}/usr/$${ARCH_LIB_DIR}" ]; then \ - ln -snf lib "$${DESTDIR}/$${ARCH_LIB_DIR}" ; \ - ln -snf lib "$${DESTDIR}/usr/$${ARCH_LIB_DIR}" ; \ - fi - -define TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK - $(call create_lib_symlinks,$(STAGING_DIR)) -endef - -define TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK - $(call create_lib_symlinks,$(TARGET_DIR)) -endef - -# Integration of the toolchain into Buildroot: find the main sysroot -# and the variant-specific sysroot, then copy the needed libraries to -# the $(TARGET_DIR) and copy the whole sysroot (libraries and headers) -# to $(STAGING_DIR). -# -# Variables are defined as follows: -# -# LIBC_A_LOCATION: location of the libc.a file in the default -# multilib variant (allows to find the main -# sysroot directory) -# Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/usr/lib/libc.a -# -# SYSROOT_DIR: the main sysroot directory, deduced from -# LIBC_A_LOCATION by removing the -# usr/lib[32|64]/libc.a part of the path. -# Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/ -# -# ARCH_LIBC_A_LOCATION: location of the libc.a file in the selected -# multilib variant (taking into account the -# CFLAGS). Allows to find the sysroot of the -# selected multilib variant. -# Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/mips16/soft-float/el/usr/lib/libc.a -# -# ARCH_SYSROOT_DIR: the sysroot of the selected multilib variant, -# deduced from ARCH_LIBC_A_LOCATION by removing -# usr/lib[32|64]/libc.a at the end of the path. -# Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/mips16/soft-float/el/ -# -# ARCH_LIB_DIR: 'lib', 'lib32' or 'lib64' depending on where libraries -# are stored. Deduced from ARCH_LIBC_A_LOCATION by -# looking at usr/lib??/libc.a. -# Ex: lib -# -# ARCH_SUBDIR: the relative location of the sysroot of the selected -# multilib variant compared to the main sysroot. -# Ex: mips16/soft-float/el -# -# SUPPORT_LIB_DIR: some toolchains, such as recent Linaro toolchains, -# store GCC support libraries (libstdc++, -# libgcc_s, etc.) outside of the sysroot. In -# this case, SUPPORT_LIB_DIR is set to a -# non-empty value, and points to the directory -# where these support libraries are -# available. Those libraries will be copied to -# our sysroot, and the directory will also be -# considered when searching libraries for copy -# to the target filesystem. -# -# Please be very careful to check the major toolchain sources: -# Buildroot, Crosstool-NG, CodeSourcery and Linaro -# before doing any modification on the below logic. - -ifeq ($(BR2_STATIC_LIBS),) -define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS - $(Q)$(call MESSAGE,"Copying external toolchain libraries to target...") - $(Q)for libs in $(TOOLCHAIN_EXTERNAL_LIBS); do \ - $(call copy_toolchain_lib_root,$$libs); \ - done -endef -endif - -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),y) -define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER - $(Q)$(call MESSAGE,"Copying gdbserver") - $(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ - ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ - gdbserver_found=0 ; \ - for d in $${ARCH_SYSROOT_DIR}/usr \ - $${ARCH_SYSROOT_DIR}/../debug-root/usr \ - $${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} \ - $(TOOLCHAIN_EXTERNAL_INSTALL_DIR); do \ - if test -f $${d}/bin/gdbserver ; then \ - install -m 0755 -D $${d}/bin/gdbserver $(TARGET_DIR)/usr/bin/gdbserver ; \ - gdbserver_found=1 ; \ - break ; \ - fi ; \ - done ; \ - if [ $${gdbserver_found} -eq 0 ] ; then \ - echo "Could not find gdbserver in external toolchain" ; \ - exit 1 ; \ - fi -endef -endif - -define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS - $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \ - ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ - ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ - SUPPORT_LIB_DIR="" ; \ - if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \ - LIBSTDCPP_A_LOCATION=$$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \ - if [ -e "$${LIBSTDCPP_A_LOCATION}" ]; then \ - SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \ - fi ; \ - fi ; \ - ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \ - $(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \ - $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) -endef - -# Special installation target used on the Blackfin architecture when -# FDPIC is not the primary binary format being used, but the user has -# nonetheless requested the installation of the FDPIC libraries to the -# target filesystem. -ifeq ($(BR2_BFIN_INSTALL_FDPIC_SHARED),y) -define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC - $(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to staging...") - $(Q)FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \ - FDPIC_SYSROOT_DIR="$(call toolchain_find_sysroot,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ - FDPIC_LIB_DIR="$(call toolchain_find_libdir,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ - FDPIC_SUPPORT_LIB_DIR="" ; \ - if test `find $${FDPIC_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \ - FDPIC_LIBSTDCPP_A_LOCATION=$$(LANG=C $${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \ - if [ -e "$${FDPIC_LIBSTDCPP_A_LOCATION}" ]; then \ - FDPIC_SUPPORT_LIB_DIR=`readlink -f $${FDPIC_LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \ - fi ; \ - fi ; \ - $(call copy_toolchain_sysroot,$${FDPIC_SYSROOT_DIR},$${FDPIC_SYSROOT_DIR},,$${FDPIC_LIB_DIR},$${FDPIC_SUPPORT_LIB_DIR}) -endef -define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_BFIN_FDPIC - $(Q)$(call MESSAGE,"Install external toolchain FDPIC libraries to target...") - $(Q)for libs in $(TOOLCHAIN_EXTERNAL_LIBS); do \ - $(call copy_toolchain_lib_root,$$libs); \ - done -endef -endif - -# Special installation target used on the Blackfin architecture when -# shared FLAT is not the primary format being used, but the user has -# nonetheless requested the installation of the shared FLAT libraries -# to the target filesystem. The flat libraries are found and linked -# according to the index in name "libN.so". Index 1 is reserved for -# the standard C library. Customer libraries can use 4 and above. -ifeq ($(BR2_BFIN_INSTALL_FLAT_SHARED),y) -define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_BFIN_FLAT - $(Q)$(call MESSAGE,"Install external toolchain FLAT libraries to target...") - $(Q)FLAT_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))../../bfin-uclinux/bin/bfin-uclinux-gcc ; \ - FLAT_LIBC_A_LOCATION=`$${FLAT_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -mid-shared-library -print-file-name=libc`; \ - if [ -f $${FLAT_LIBC_A_LOCATION} -a ! -h $${FLAT_LIBC_A_LOCATION} ] ; then \ - $(INSTALL) -D $${FLAT_LIBC_A_LOCATION} $(TARGET_DIR)/lib/lib1.so; \ - fi -endef -endif - -# Build toolchain wrapper for preprocessor, C and C++ compiler and setup -# symlinks for everything else. Skip gdb symlink when we are building our -# own gdb to prevent two gdb's in output/host/usr/bin. -# The LTO support in gcc creates wrappers for ar, ranlib and nm which load -# the lto plugin. These wrappers are called *-gcc-ar, *-gcc-ranlib, and -# *-gcc-nm and should be used instead of the real programs when -flto is -# used. However, we should not add the toolchain wrapper for them, and they -# match the *cc-* pattern. Therefore, an additional case is added for *-ar, -# *-ranlib and *-nm. -define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER - $(Q)cd $(HOST_DIR)/usr/bin; \ - for i in $(TOOLCHAIN_EXTERNAL_CROSS)*; do \ - base=$${i##*/}; \ - case "$$base" in \ - *-ar|*-ranlib|*-nm) \ - ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \ - ;; \ - *cc|*cc-*|*++|*++-*|*cpp) \ - ln -sf toolchain-wrapper $$base; \ - ;; \ - *gdb|*gdbtui) \ - if test "$(BR2_PACKAGE_HOST_GDB)" != "y"; then \ - ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \ - fi \ - ;; \ - *) \ - ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \ - ;; \ - esac; \ - done -endef - -# -# Generate gdbinit file for use with Buildroot -# -define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT - $(Q)if test -f $(TARGET_CROSS)gdb ; then \ - $(call MESSAGE,"Installing gdbinit"); \ - $(gen_gdbinit_file); \ - fi -endef - -# uClibc-ng dynamic loader is called ld-uClibc.so.1, but gcc is not -# patched specifically for uClibc-ng, so it continues to generate -# binaries that expect the dynamic loader to be named ld-uClibc.so.0, -# like with the original uClibc. Therefore, we create an additional -# symbolic link to make uClibc-ng systems work properly. -define TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO - $(Q)if test -e $(TARGET_DIR)/lib/ld-uClibc.so.1; then \ - ln -sf ld-uClibc.so.1 $(TARGET_DIR)/lib/ld-uClibc.so.0 ; \ - fi - $(Q)if test -e $(TARGET_DIR)/lib/ld64-uClibc.so.1; then \ - ln -sf ld64-uClibc.so.1 $(TARGET_DIR)/lib/ld64-uClibc.so.0 ; \ - fi -endef - -TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_BUILD_WRAPPER) - -define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS - $(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK) - $(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS) - $(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC) - $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER) - $(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT) -endef - -# Even though we're installing things in both the staging, the host -# and the target directory, we do everything within the -# install-staging step, arbitrarily. -define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS - $(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK) - $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS) - $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER) - $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_BFIN_FDPIC) - $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_BFIN_FLAT) - $(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO) -endef - -$(eval $(generic-package)) - +include toolchain/toolchain-external/*/*.mk diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c index 887058f699..eb4ee8de4a 100644 --- a/toolchain/toolchain-wrapper.c +++ b/toolchain/toolchain-wrapper.c @@ -22,12 +22,15 @@ #include #include #include +#include #ifdef BR_CCACHE static char ccache_path[PATH_MAX]; #endif static char path[PATH_MAX]; static char sysroot[PATH_MAX]; +static char source_time[sizeof("-D__TIME__=\"HH:MM:SS\"")]; +static char source_date[sizeof("-D__DATE__=\"MMM DD YYYY\"")]; /** * GCC errors out with certain combinations of arguments (examples are @@ -39,8 +42,11 @@ static char sysroot[PATH_MAX]; * -mfloat-abi= * -march= * -mcpu= + * -D__TIME__= + * -D__DATE__= + * -Wno-builtin-macro-redefined */ -#define EXCLUSIVE_ARGS 3 +#define EXCLUSIVE_ARGS 6 static char *predef_args[] = { #ifdef BR_CCACHE @@ -66,6 +72,9 @@ static char *predef_args[] = { #ifdef BR_OMIT_LOCK_PREFIX "-Wa,-momit-lock-prefix=yes", #endif +#ifdef BR_NO_FUSED_MADD + "-mno-fused-madd", +#endif #ifdef BR_BINFMT_FLAT "-Wl,-elf2flt", #endif @@ -80,25 +89,121 @@ static char *predef_args[] = { #endif }; -static void check_unsafe_path(const char *path, int paranoid) -{ - char **c; - static char *unsafe_paths[] = { - "/lib", "/usr/include", "/usr/lib", "/usr/local/include", "/usr/local/lib", NULL, - }; +/* A {string,length} tuple, to avoid computing strlen() on constants. + * - str must be a \0-terminated string + * - len does not account for the terminating '\0' + */ +struct str_len_s { + const char *str; + size_t len; +}; - for (c = unsafe_paths; *c != NULL; c++) { - if (!strncmp(path, *c, strlen(*c))) { - fprintf(stderr, "%s: %s: unsafe header/library path used in cross-compilation: '%s'\n", - program_invocation_short_name, - paranoid ? "ERROR" : "WARNING", path); - if (paranoid) - exit(1); +/* Define a {string,length} tuple. Takes an unquoted constant string as + * parameter. sizeof() on a string literal includes the terminating \0, + * but we don't want to count it. + */ +#define STR_LEN(s) { #s, sizeof(#s)-1 } + +/* List of paths considered unsafe for cross-compilation. + * + * An unsafe path is one that points to a directory with libraries or + * headers for the build machine, which are not suitable for the target. + */ +static const struct str_len_s unsafe_paths[] = { + STR_LEN(/lib), + STR_LEN(/usr/include), + STR_LEN(/usr/lib), + STR_LEN(/usr/local/include), + STR_LEN(/usr/local/lib), + { NULL, 0 }, +}; + +/* Unsafe options are options that specify a potentialy unsafe path, + * that will be checked by check_unsafe_path(), below. + */ +static const struct str_len_s unsafe_opts[] = { + STR_LEN(-I), + STR_LEN(-idirafter), + STR_LEN(-iquote), + STR_LEN(-isystem), + STR_LEN(-L), + { NULL, 0 }, +}; + +/* Check if path is unsafe for cross-compilation. Unsafe paths are those + * pointing to the standard native include or library paths. + * + * We print the arguments leading to the failure. For some options, gcc + * accepts the path to be concatenated to the argument (e.g. -I/foo/bar) + * or separated (e.g. -I /foo/bar). In the first case, we need only print + * the argument as it already contains the path (arg_has_path), while in + * the second case we need to print both (!arg_has_path). + * + * If paranoid, exit in error instead of just printing a warning. + */ +static void check_unsafe_path(const char *arg, + const char *path, + int paranoid, + int arg_has_path) +{ + const struct str_len_s *p; + + for (p=unsafe_paths; p->str; p++) { + if (strncmp(path, p->str, p->len)) continue; - } + fprintf(stderr, + "%s: %s: unsafe header/library path used in cross-compilation: '%s%s%s'\n", + program_invocation_short_name, + paranoid ? "ERROR" : "WARNING", + arg, + arg_has_path ? "" : "' '", /* close single-quote, space, open single-quote */ + arg_has_path ? "" : path); /* so that arg and path are properly quoted. */ + if (paranoid) + exit(1); } } +/* Read SOURCE_DATE_EPOCH from environment to have a deterministic + * timestamp to replace embedded current dates to get reproducible + * results. Returns -1 if SOURCE_DATE_EPOCH is not defined. + */ +static time_t get_source_date_epoch() +{ + char *source_date_epoch; + long long epoch; + char *endptr; + + source_date_epoch = getenv("SOURCE_DATE_EPOCH"); + if (!source_date_epoch) + return (time_t) -1; + + errno = 0; + epoch = strtoll(source_date_epoch, &endptr, 10); + if ((errno == ERANGE && (epoch == LLONG_MAX || epoch == LLONG_MIN)) + || (errno != 0 && epoch == 0)) { + fprintf(stderr, "environment variable $SOURCE_DATE_EPOCH: " + "strtoll: %s\n", strerror(errno)); + exit(2); + } + if (endptr == source_date_epoch) { + fprintf(stderr, "environment variable $SOURCE_DATE_EPOCH: " + "no digits were found: %s\n", endptr); + exit(2); + } + if (*endptr != '\0') { + fprintf(stderr, "environment variable $SOURCE_DATE_EPOCH: " + "trailing garbage: %s\n", endptr); + exit(2); + } + if (epoch < 0) { + fprintf(stderr, "environment variable $SOURCE_DATE_EPOCH: " + "value must be nonnegative: %lld \n", epoch); + exit(2); + } + + return (time_t) epoch; +} + int main(int argc, char **argv) { char **args, **cur, **exec_args; @@ -109,6 +214,7 @@ int main(int argc, char **argv) char *paranoid_wrapper; int paranoid; int ret, i, count = 0, debug; + time_t source_date_epoch; /* Calculate the relative paths */ basename = strrchr(progpath, '/'); @@ -214,6 +320,28 @@ int main(int argc, char **argv) } #endif /* ARCH || CPU */ + source_date_epoch = get_source_date_epoch(); + if (source_date_epoch != -1) { + struct tm *tm = localtime(&source_date_epoch); + if (!tm) { + perror("__FILE__: localtime"); + return 3; + } + ret = strftime(source_time, sizeof(source_time), "-D__TIME__=\"%T\"", tm); + if (!ret) { + perror("__FILE__: overflow"); + return 3; + } + *cur++ = source_time; + ret = strftime(source_date, sizeof(source_date), "-D__DATE__=\"%b %e %Y\"", tm); + if (!ret) { + perror("__FILE__: overflow"); + return 3; + } + *cur++ = source_date; + *cur++ = "-Wno-builtin-macro-redefined"; + } + paranoid_wrapper = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH"); if (paranoid_wrapper && strlen(paranoid_wrapper) > 0) paranoid = 1; @@ -222,24 +350,23 @@ int main(int argc, char **argv) /* Check for unsafe library and header paths */ for (i = 1; i < argc; i++) { - - /* Skip options that do not start with -I and -L */ - if (strncmp(argv[i], "-I", 2) && strncmp(argv[i], "-L", 2)) - continue; - - /* We handle two cases: first the case where -I/-L and - * the path are separated by one space and therefore - * visible as two separate options, and then the case - * where they are stuck together forming one single - * option. - */ - if (argv[i][2] == '\0') { - i++; - if (i == argc) + const struct str_len_s *opt; + for (opt=unsafe_opts; opt->str; opt++ ) { + /* Skip any non-unsafe option. */ + if (strncmp(argv[i], opt->str, opt->len)) continue; - check_unsafe_path(argv[i], paranoid); - } else { - check_unsafe_path(argv[i] + 2, paranoid); + + /* Handle both cases: + * - path is a separate argument, + * - path is concatenated with option. + */ + if (argv[i][opt->len] == '\0') { + i++; + if (i == argc) + break; + check_unsafe_path(argv[i-1], argv[i], paranoid, 0); + } else + check_unsafe_path(argv[i], argv[i] + opt->len, paranoid, 1); } } diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk index af39071cf3..c7b50195d3 100644 --- a/toolchain/toolchain-wrapper.mk +++ b/toolchain/toolchain-wrapper.mk @@ -26,15 +26,23 @@ ifeq ($(BR2_x86_x1000),y) TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX endif +# Avoid FPU bug on XBurst CPUs +ifeq ($(BR2_mips_xburst),y) +TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD +endif + ifeq ($(BR2_CCACHE_USE_BASEDIR),y) TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"' endif -# For simplicity, build directly into the install location -define TOOLCHAIN_BUILD_WRAPPER - $(Q)mkdir -p $(HOST_DIR)/usr/bin +define TOOLCHAIN_WRAPPER_BUILD $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \ -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \ toolchain/toolchain-wrapper.c \ - -o $(HOST_DIR)/usr/bin/toolchain-wrapper + -o $(@D)/toolchain-wrapper +endef + +define TOOLCHAIN_WRAPPER_INSTALL + $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \ + $(HOST_DIR)/usr/bin/toolchain-wrapper endef diff --git a/toolchain/toolchain.mk b/toolchain/toolchain.mk index 0a35909334..59fc905caf 100644 --- a/toolchain/toolchain.mk +++ b/toolchain/toolchain.mk @@ -10,7 +10,7 @@ define GLIBC_COPY_NSSWITCH_FILE $(INSTALL) -D -m 0644 package/glibc/nsswitch.conf $(TARGET_DIR)/etc/nsswitch.conf ; \ fi endef -TARGET_FINALIZE_HOOKS += GLIBC_COPY_NSSWITCH_FILE +TOOLCHAIN_TARGET_FINALIZE_HOOKS += GLIBC_COPY_NSSWITCH_FILE endif # Install the gconv modules @@ -52,5 +52,5 @@ define COPY_GCONV_LIBS >$(TARGET_DIR)/usr/lib/gconv/gconv-modules; \ fi endef -TARGET_FINALIZE_HOOKS += COPY_GCONV_LIBS +TOOLCHAIN_TARGET_FINALIZE_HOOKS += COPY_GCONV_LIBS endif diff --git a/toolchain/toolchain/toolchain.mk b/toolchain/toolchain/toolchain.mk index c22713bfe3..b16db01501 100644 --- a/toolchain/toolchain/toolchain.mk +++ b/toolchain/toolchain/toolchain.mk @@ -12,6 +12,29 @@ endif TOOLCHAIN_ADD_TOOLCHAIN_DEPENDENCY = NO +# Apply a hack that Rick Felker suggested[1] to avoid conflicts between libc +# headers and kernel headers. This is a temporary measure until musl finds a +# better solution. +# +# Augment the original suggestion with __USE_MISC since recent kernels +# require this glibc internal macro. Also, as musl defines IFF_LOWER_UP, +# IFF_DORMANT and IFF_ECHO, add another macro to suppress them in the +# kernel header, and avoid macro/enum conflict. +# +# [1] http://www.openwall.com/lists/musl/2015/10/08/2 +ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) +define TOOLCHAIN_MUSL_KERNEL_HEADERS_COMPATIBILITY_HACK + $(SED) 's/^#if defined(__GLIBC__)$$/#if 1/' \ + $(STAGING_DIR)/usr/include/linux/libc-compat.h + $(SED) '1s/^/#define __USE_MISC\n/' \ + $(STAGING_DIR)/usr/include/linux/libc-compat.h + $(SED) '1s/^/#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0\n/' \ + $(STAGING_DIR)/usr/include/linux/libc-compat.h +endef +TOOLCHAIN_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_MUSL_KERNEL_HEADERS_COMPATIBILITY_HACK +TOOLCHAIN_INSTALL_STAGING = YES +endif + $(eval $(virtual-package)) toolchain: $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake