summaryrefslogtreecommitdiff
path: root/scripts/functions
AgeCommit message (Collapse)AuthorFilesLines
2012-10-30scripts/functions: fix endless loop in debug-shell with IO redirectionJohannes Stezenbach1-2/+3
CT_DEBUG_INTERACTIVE is disabled when stdin, stdout or stderr are redirected, but the check is only done at the start of the build and doesn't catch when individual build commands use redirection. When stdin is redirected it will cause the debug shell to exit immediately, causing and endless loop. Thus, save the stdin/our/err file handles and restore them before invoking the debug shell. Signed-off-by: Johannes Stezenbach <js@sig21.net> Message-Id: <20121030102225.GA8303@sig21.net> Patchwork-Id: 195409
2012-10-30scripts/functions: use patch -i instead of IO redirectionJohannes Stezenbach1-2/+1
This makes the patch name show up on the command line logged by CT_DoExecLog so it's easier to see what is going on. The -i for patch is specified by Posix and supported by GNU patch and busybox patch. Signed-off-by: Johannes Stezenbach <js@sig21.net> [yann.morin.1998@free.fr: remove now-useless debug message] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Message-Id: <20121030103620.GB8303@sig21.net> Patchwork-Id: 195418
2012-10-21scripts/functions: return a proper error code in CT_DoExecLogYann E. MORIN"1-0/+5
Since we added the debug-shell feature, CT_DoExecLog no longer returns the error code of the command, but always return 0. This breaks the download mechanism, which relies on CT_DoExecLog to fail _on_purpose_ to detect that the ressource was not found at the specified URL. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2012-10-17scripts/functions: properly catch failure in CT_Test* helpersYann E. MORIN"1-1/+1
So we get caught by the trap-handler and have a chance to run the debug-shell. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Johannes Stezenbach <js@sig21.net>
2012-10-06scripts: add option to start an interactive debug shellYann E. MORIN"1-3/+93
Add an option that, when a command fails: - starts an interactive shell with the failed command's environment - attempts re-execution of the failed command, continues, or aborts at user's whim. Before starting the debug-shell, the backtrace is printed. When exiting for an abort, the standard error message is printed. Based on an idea and a patch from: Johannes Stezenbach <js@sig21.net> http://sourceware.org/ml/crossgcc/2012-09/msg00144.html Signed-off-by: Johannes Stezenbach <js@sig21.net> [yann.morin.1998@free.fr: integrate in the fault handler] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Acked-by: Johannes Stezenbach <js@sig21.net> Patchwork-Id: 191571 Patchwork-Id: 191668
2012-10-14scripts: move backtrace marker to CT_WORK_DIRJohannes Stezenbach1-3/+3
Avoid error when commands in scripts/crosstool-NG.sh fail before CT_BUILD_DIR is set. So we need to remove the backtrace marker of a potential previous build. Previously, it was implicitly removed because we did remove the directory it was in, which is no longer the case. Signed-off-by: Johannes Stezenbach <js@sig21.net> [yann.morin.1998@free.fr: remove backtrace marker on start of build] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Message-Id: <20121015094615.GA18673@sig21.net> Patchwork-Id: 191498
2012-10-04scripts/functions: add a generic custom location infrastructureDavid Holsgrove1-0/+35
Add a generic custom location infrastructure (inspired by the one in kernel/linux) to allow the user to use custom tarballs or directories for any component. Signed-off-by: "David Holsgrove" <david.holsgrove@xilinx.com> [yann.morin.1998@free.fr: move config option, improve help text, fix API doc] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Message-Id: <131c163c69f9cc81d2be.1349931191@localhost.localdomain> PatchWork-Id: 190784 Message-Id: <0bbaba9190a76ba97f72.1349931192@localhost.localdomain> PatchWork-Id: 190785
2012-08-12scripts: add option to only use the mirrorYann E. MORIN"1-1/+7
Currently, if downloads are forbidden, the mirror is still tried for. Change this way: - if downlaods forbidden, do not try neither upstream locations nor mirror - add option to only use the mirror, and avoid upstream locations Signed-off-by: Austin Morton <austinpmorton@gmail.com> [yann.morin.1998@free.fr: broaden the if USE_MIRRORto enclode mirror location] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2012-08-22scripts/functions: remove rude wordingsYann E. MORIN"1-3/+2
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2012-05-06scripts/functions: tweak the endianness LDFLAGSYann E. MORIN"1-2/+2
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2011-07-25complibs: fixup the host complibs install dirYann E. MORIN"1-2/+0
It's easier to have as much as possible stuff in the same place to ease backup/restore, and make things easier to follow. Move the host companion libraries install dir as a sub-dir of the build-tools install dir (but not directly in it, it would break for canadian or cross-native). Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2012-01-01cc/gcc: install the core compilers in the build-tools dirYann E. MORIN"1-4/+0
There really is no good reason to install the core compilers in their own places, one for each pass. We can install them with the other build tools. Also, this implies that: - there are fewer directories to save/restore - there are fewer symlinks to create for binutils - the PATH is shorter Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-07-24functions: add new helpers that create a dir and cd/pushd into itYann E. MORIN"1-0/+16
A lot of places are currently doing: mkdir -p foo/bar cd foo/bar Or even: mkdir -p foo/bar pushd foo/bar [...] popd Provide both wrapper to ease doing this. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2012-01-16configure: fix kconfig option namesYann E. MORIN"1-2/+2
In the process of converting to autoconf, the kconfig option were not properly translated. Fix that. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-12-13scripts: fix dumping execution backtraceYann E. MORIN"1-43/+43
Dumping the backtrace has been broken since changeset #652e56d6d35a: scripts: execute each steps in a subshell We can spawn sub-sub-shells in some cases. The way the fault handler works is to dump the backtrace, but to avoid printing it once for every sub-shell (which could get quite confusing), it simply exits when it detects that it is being run in a sub-shell, leaving to the top-level shell the work to dump the backtrace. Because each step is executed in its own sub-shell, the variable arrays that contain the step name, the source file and line number, are lost when exiting the per-step sub-shell. Hence, the backtrace is currently limited to printing only the top-level main procedure of the shell. Fix this thus: - when dumping the bckatraces for the steps & the functions, remember it was dumped, and only dump it if it was not already dumped - at the top-level shell, print the hints Also, rename the top-level step label. Reported-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-11-22scripts/functions: extract: portable call for old and defective tarsTitus von Boxberg1-6/+6
Instead of using -J, --lzma, --use-compress-program or the like use <compressor> -dc <file> | tar -f - Signed-off-by: Titus von Boxberg <titus@v9g.de>
2011-11-20scripts/functions: use endian string in testsYann E. MORIN"1-3/+5
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-11-07scripts: use wget, not curlYann E. MORIN"1-5/+4
It seems wget is more popular than curl. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-10-19arch: add softfp supportYann E. MORIN"1-0/+4
Some architectures support a mixed hard/soft floating point, where the compiler emits hardware floating point instructions, but passes the operands in core (aka integer) registers. For example, ARM supports this mode (to come in the next changeset). Add support for softfp cross compilers to the GCC and GLIBC configuration. Needed for Ubuntu and other distros that are softfp. Signed-off-by: Michael Hope <michael.hope@linaro.org> [yann.morin.1998@anciens.enib.fr: split the original patch] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-10-19scripts: use the hardfloat option to set configure and CFLAGSYann E. MORIN"1-0/+4
When hardfloat is selected, we need to pass that selection down to ./configure and in the CFLAGS. Signed-off-by: Michael Hope <michael.hope@linaro.org> [yann.morin.1998@anciens.enib.fr: split the original patch] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-10-19scripts: introduce float type as a stringYann E. MORIN"1-1/+7
With the upcoming softfp support, the case..esac test would become a bit convoluted if it were to test three different booleans. Introduce a new blind string config option that defaults to the selected floating point type used. Signed-off-by: Michael Hope <michael.hope@linaro.org> [yann.morin.1998@anciens.enib.fr: split the original patch] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-10-07scripts/functions: Fix CT_ExtractGit function.Yann E. MORIN"1-12/+15
Change CT_ExtractGit so that it clones the repository, instead of just symlinking it. After cloning, any given ref is checked out, or if no ref is given, the HEAD of the repository is checked out. This makes CT_Extract behave similar for git repositories as it does for tarballs, so that it for example can be used for passing glibc-ports as a git repository. Signed-off-by: "Esben Haabendal" <esben.haabendal@prevas.dk> [yann.morin.1998@anciens.enib.fr: fix incomplete var rename] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-09-09scripts/functions: only use passive FTPYann E. MORIN"1-6/+8
Virtually all FTP server available on-line support passive FTP. At least, this is the case for the servers crosstool-NG needs to connect to. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-09-09scripts/functions: only use one download programYann E. MORIN"1-12/+4
Currently, we use either wget or curl, whichever is installed. In case both are installed, both are used. This means that it takes a while trying all extensions. Remove use of wget, and use only curl. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-25configure: xz-utils alone can also handle LZMA-compressed tarballsYann E. MORIN"1-2/+15
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-25configure: check for lzmaYann E. MORIN"1-0/+4
Some packages are available as LZMA tarballs. LZMA is a relatively recent compression algorithm; it's slightly better than bzip2, but offers much faster decompression. LZMA is now deprecated in favor of XZ, but some packages switched to LZMA when XZ was not yet available, or still in its infancy. Latest XZ (which totaly obsoletes LZMA) offers a backward LZMA- compatible utility, so we can check for 'lzma' nonetheless. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-14scripts/functions: add xz supportYann E. MORIN"1-0/+4
Add support for the new XZ-compressed tarballs. At least glibc uses that new format. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-05-03scripts/functions: test for decompressors before useYann E. MORIN"1-6/+14
./configure does check for the presence of gz and bzip2, so we can safely use them in the build scripts. On the other hand, more recent formats (eg. XZ) are not yet widely available, and we do not want, and can't, force the user to install them as a pre-requisite. So, build up a list of allowed tarball formats based on the available decompressors. For no, this is a static list, but the upcoming XZ support will conditionnaly add to this list. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-14scripts/functions: commonalise tar options in CT_EXtractYann E. MORIN"1-3/+7
This shortens command lines, so it's good! :-) Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-10scripts/functions: remove messages about failed downloadsYann E. MORIN"1-3/+4
When downloading via svn/cvs/... an attempt to retrieve from the mirror is made. If the mirror does not have the required tarball, an error message is printed. This is misleading, as the download may later succeed via svn/cvs/... Remove the messages about failed downloads altogether. At the same time, use "if ... then ... fi" instead of "... && ..." Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-02scripts: try the mirror even if downloads are forbiddenYann E. MORIN"1-1/+18
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-02scripts/functions: use array variables for URLs listYann E. MORIN"1-4/+6
This is needed later, when we'll conditionnally use both the upstream and the mirror URLs. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-02scripts/functions: always prefer the mirrorYann E. MORIN"1-14/+4
Currently, the mirror can be used either: - as a fallback in case upstream is unavailable (default behavior) - as the preferred source for downloads But the most common use-case seems to provide a truely-LAN mirror to speed up downloads in big corpos', and/or provide a 'trusted' source for the tarballs. So, make the following changes; - if a mirror is specified, always try that before trying upstream Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-02scripts/functions: cvs retrieval first tries the mirror for tarballsYann E. MORIN"1-5/+5
The cvs download helper looks for the local tarballs dir to see if it can find a pre-downloaded tarball, and if it does not find it, does the actual fetch to upstream via cvs. In the process, it does not even try to get a tarball from the local mirror, which can be useful if the mirror has been pre-populated manually (or with a previously downloaded tree). Fake a tarball get with the standard tarball-download helper, but without specifying any upstream URL, which makes the helper directly try the LAN mirror. Of course, if no mirror is specified, no URL wil be available, and the standard cvs retrieval will kick in. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-02scripts/functions: svn retrieval first tries the mirror for tarballsYann E. MORIN"1-5/+5
The svn download helper looks for the local tarballs dir to see if it can find a pre-downloaded tarball, and if it does not find it, does the actual fetch to upstream via svn. In the process, it does not even try to get a tarball from the local mirror, which can be useful if the mirror has been pre-populated manually (or with a previously downloaded tree). Fake a tarball get with the standard tarball-download helper, but without specifying any upstream URL, which makes the helper directly try the LAN mirror. Of course, if no mirror is specified, no URL wil be available, and the standard svn retrieval will kick in. Reported-by: ANDY KENNEDY <ANDY.KENNEDY@adtran.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-08-01scripts/functions: if no upstream URL is given, silently ignore thatYann E. MORIN"1-0/+1
When retrieving tarballs from upstream, if no URL was given, do not fail; simmply ignore that fact. This will be used later when the SVN helper will call the standard helper to try the LAN mirror before trying svn. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-07-29scripts/functions: force extract folder to archive basenameBenoît THÉBAUDEAU"1-3/+4
Some archives like those of the 2011.07 revisions of Linaro GCC contain a folder name different from the archive basename, which leads to errors afterwards, e.g. when patching. E.g.: gcc-linaro-4.5-2011.07.tar.bz2 extracts to gcc-linaro-4.5-2011.07-0/ This patch changes CT_Extract() to force the extraction of all archives to a folder named like the archive basename. E.g.: gcc-linaro-4.5-2011.07.tar.bz2 now extracts to gcc-linaro-4.5-2011.07/ Signed-off-by: "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
2011-06-02functions: save & restore the static companion libraries install dirYann E. MORIN"1-0/+2
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-06-02functions: fix downloading filesYann E. MORIN"1-5/+6
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-05-30scripts/functions: do not abort on failed svnYann E. MORIN"1-1/+4
In case of eglibc, some add-ons that were previously external are now internal (bundled with the main sources). So we do not want to fail if an add-on can't be downloaded; we want to post-pone the check until we can extract the main archive. So: - try to retrieve the add-on - if it fails, print a warning instead of calling CT_Abort - return 1 So, components that want to catch the error and want to handle it can, while components that do not will gracefuly fail thanks to our catching every errors. Bonus: it works without changing any existing retrieval procedure! :-) Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-05-30scripts/functions: do not abort on failed extractYann E. MORIN"1-2/+5
For glibc/eglibc, if the add-on can not be extracted, we want to catch the error to print a meaningful error message. So: - try to extract the tarball - if it fails, print a waring instead of calling CT_Abort - return 1 So, components that want to catch the error and want to handle it can, while components that do not will gracefuly fail thanks to our catching every errors. Bonus: it works without changing any existing extract procedure! :-) Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-05-30scripts/functions: do not abort on failed downloadYann E. MORIN"1-5/+6
In case of glibc/eglibc, some add-ons that were previously external are now internal (bundled with the main sources). So we do not want to fail if an add-on tarball can't be downloaded; we want to post-pone the check until we can extract the main archive. So: - try to download the tarball - if it fails, print a warning instead of calling CT_Abort - return 1 So, components that want to catch the error and want to handle it can, while components that do not will gracefuly fail thanks to our catching every errors. Bonus: it works without changing any existing retrieval procedure! :-) Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-04-07functions: pretty print error messagesYann E. MORIN"1-9/+43
Reformat the error messages: - strip ${CT_LIB_DIR} from scripts path names - strip ${CT_TOP_DIR} from build.log path and docs path - overall shorter lines - point to the known-issues file Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-04-07functions: fix date calculationsYann E. MORIN"1-1/+1
In case date(1) does not support nanosecond resolution, it does not interpret '%N', and leave it as-is. So we have to remove it. Note that some versions replaces '%N' with 'N', so we have to take this into account as well. Reported-by: Kyle Grieb <grieb.kyle@gmail.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-04-07functions: avoid CR when progress bar is not enabledJavier Viguera1-1/+1
Using CT-NG with progress bar disabled, still prints CR ('\r') characters on the output. When you capture the output to a file as part of an automated build, it shows extra empty lines. For example: ------------------------------------------------------------ [INFO ] Performing some trivial sanity checks [INFO ] Build started 20110404.113619 [INFO ] Building environment variables [EXTRA] Preparing working directories [EXTRA] Installing user-supplied crosstool-NG configuration ------------------------------------------------------------ Signed-off-by: Javier Viguera <javier.viguera@digi.com>
2011-04-06complibs: disable building shared libsYann E. MORIN"1-6/+0
Managing the shared version of the companion libraries has become cumbersome. Also, it will one day be possible to use the companion libraries from the host distribution, and then we will be able to easily use either shared or static libs. As a side note, while working on the canadian-rework series, it has become quite more complex to properly handle shared companion libraries, as they need to be built both for the build and gost systems. That's not easy to handle. At all. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-03-15scripts: allow logging of commands with variablesYann E. MORIN"1-2/+16
In a lot of places, we need to call some commands with specific variable settings, a-la: var1=val1 var2=val2 /foo/bar/buz opt1 opt2 Unfortunately, we currently can not log the variable settings. Enhance CT_DoExecLog with a crude heuristic that works pretty well and that can also log setting variables. Reported-by: ANDY KENNEDY <ANDY.KENNEDY@adtran.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-03-19scripts: leave changelog in build dir, copy to install dirYann E. MORIN"1-23/+20
Users tend to look for the build log in the current working directory, rather than in the toolchain's installation dir. While bundling the build log in the toolchain installation dir is nice for distribution and review, it can be easier to have the build log readily available in the working directory, as it is quicker to get to it. So, the build log stays in the working directory until the toolchain is completely and successfully built, and then a (compressed) copy is made. Reported-by: Trevor Woerner <twoerner@gmail.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-03-03scripts: do not chmod u+w the whole source directoryYann E. MORIN"1-5/+0
Doing a chmod on the whole source dir after every packages are extracted can take a hell of a lot of time. The offending packages are far from legion, and they now have their own chmod u+w to cleanup their own mess... Reported-by: ANDY KENNEDY <ANDY.KENNEDY@adtran.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2010-12-19buildtools: the buildtools dir is in fact a prefixYann E. MORIN"1-2/+2
Consider the buildtools install directory as a prefix directory, that is, install buildtools in prefix/bin/, not in prefix/. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>