Commit Graph

273 Commits

Author SHA1 Message Date
Alexey Neyman
df68f203b4 Use 'make olddefconfig' in uClibc/uClibc-ng configuration
instead of 'make oldconfig' and responding 'y'. This avoids 'Broken pipe'
errors in the log, as well as selects default setting for all options not
explicitly set.

This requires a small fix in the old uClibc. Won't have to maintain that fix
for long though :)

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-02-04 21:16:10 -08:00
Alexey Neyman
a08a4c4b88 Allow for per-tool templates when creating overrides
... will be used to implement a smarter install wrapper.

While there, correct the spelling of "OVERIDE".

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-30 12:10:47 -08:00
Alexey Neyman
eb3ae48278 Fix log saving/restoring
after the CT_Log{Enable,Disable} changes.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-25 15:45:37 -08:00
Alexey Neyman
955f5bc0b8 Get rid of .config.2.
Now handled by CT_LoadConfig.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-19 18:08:29 -08:00
Alexey Neyman
c0cc73cd6f Install canadian crosses into a separate subdir.
Makes them sorted out by host, and removes the need for similar hack in
samples.mk.

Change how canadian crosses are named: using `=' character resulted in
Glibc build failure.

Move loading config into a common function, CT_LoadConfig.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-19 18:08:29 -08:00
Alexey Neyman
c1612e9295 Use ${CT_CC} instead of gcc ...
... when refering to target's compiler.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-13 21:47:07 -08:00
Alexey Neyman
9f5a92a783 Unify fetching Linaro components.
Add CT_GetLinaro, use it from gcc/binutils/gdb/glibc/newlib.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-12 23:00:41 -08:00
Alexey Neyman
b30e779d8e Catch more make errors.
Some errors from make(1) do not include a file reference in brackets.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-18 10:14:40 -08:00
Alexey Neyman
b1ac2e7a7d Pass original multi_os_dir to iterator.
This is needed for callbacks that use that directory to look inside
GCC internal directories, e.g. moving the libraries. This broke
when I made libexpat for target honor ${CT_SHARED_LIBS}.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-17 12:10:10 -08:00
Alexey Neyman
7e44983388 Work around Cygwin idiosyncrasy.
Cygwin doesn't like directory names ending with a dot, e.g. "multilib_."

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-06 10:33:20 -08:00
Alexey Neyman
488b27f58b Partially revert 6f8e89cb5c.
The referenced commit replaced 'make' with '${make}' everywhere. This is
wrong for at least the utilities that we may build as companion tools
(make, libtool): this will always invoke the version detected by configure
by supplying the absolute path. In other words, the wrappers in
.build/tools/bin are not fallbacks - they are either temporary (in case
a respective companion tool is built) or permanent redirectors.

This is the reason why the PATH= has .build/*/buildtools/bin at higher
precedence than .build/tools/bin; the latter has the versions detected by
configure and the former has the versions built as companion tools.

Revert the rest of the gang (grep/sed/...) for consistency. After all,
we may decide to supply some of them as well (awk, for instance).

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-11-20 23:50:17 -08:00
Bryan Hundven
b18469054d Merge pull request #422 from datacom-teracom/master
scripts/functions: fix log level in call to CT_DoLog
2016-08-23 14:25:48 -07:00
Alexey Neyman
98e556d386 Support multilib in sh/uClibc.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
0fdc1887a7 Change multilib functions to set the variable.
Rather than echo-ing the new value, set the value into the variable with
the name passed as an argument (similar to CT_SanitizeVarDir). This
allows to use CT_DoLog in these functions.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
3ebc5d0c1e libc/*.sh: Deprecate libc_check_config step.
This step was only used in uClibc. However, with upcoming multilib, the
config management will have to be done for each variant differently,
anyway.

uClibc was the only user of libc_check_config step, as well as
CT_CONFIG_DIR directory. Retire these.

Two other clean-ups in uClibc.sh:
- KERNEL_HEADERS check seems to be bogus, this config option is not
  present even in 0.9.30 - which is not supported already.
- SHARED_LIB_LOADER_PREFIX was renamed to MULTILIB_DIR in 0.9.31,
  according to ChangeLog - and MULTILIB_DIR is passed from command line
  instead.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
43c303c946 libc/*.sh: handle combinations of multilib root/dir.
Install startfiles for libc variants into the most specific combination
(suffixed sysroot, if applicable + suffixed multi-os dir, if
applicable). Install headers once in every suffixed sysroot (although it
seems that GCC picks up headers from top-level sysroot, GCC manual
claims that sysroot suffix affects headers search path).

In uClibc, this requires a better sanitization of the directory: it
creates symlinks from {sysroot}/usr/lib/{multi_os_dir} to
{sysroot}/lib/{multi_os_dir} and to do so, it counts the number of path
components in the libdir. This breaks if one of such components is `..'
- symlinks contain an extra `../..' then. Since such sanitization had to
be implemented anyway, use it in other places to print more sensible
directory names.

Also, fix the description of configure --host/--target per musl's
configure help message (and its actual code).

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
82072d0cbc multilib: Determine which options may pass through.
On some arches (e.g. MIPS) the options like -mabi do not work if
specified more than once (see the comment in 100-gcc.sh). Therefore,
we need to determine which of the options produced by <arch>.sh can
be passed to multilib builds and which must be removed (i.e., which
options vary among the multilibs).

This presents a chicken-and-egg problem. GCC developers, in their
infinite wisdom, do not allow arbitrary multilib specification to be
supplied to GCC's configure. Instead, the target (and sometimes some
extra options) determine the set of multilibs - which may include
different CPUs, different ABIs, different endianness, different FPUs,
different floating-point ABIs, ... That is, we don't know which parts
vary until we build GCC and ask it.

So, the solution implemented here is:
- For multilib builds, start with empty CT_ARCH_TARGET_CFLAGS/LDFLAGS.
- For multilib builds, require core pass 1. Pass 1 does not build any
  target binaries, so at that point, our target options have not been
  used yet.
- Provide an API to modify the environment variables for the steps that
  follow the current one.
- As a part of multilib-related housekeeping, determine the variable
  part of multilibs and filter out these options; pass the rest into
  CT_TARGET_CFLAGS/LDFLAGS.

This still does not handle extra dependencies between GCC options (like
-ma implying -mcpu=X -mtune=Y, etc.) but I feel that would complicate
matters too much. Let's leave this until there's a compelling case for
it.

Also, query GCC's sysroot suffix for targets that use it (SuperH,
for example) - the default multilib may not work if the command line
specifies the default option explicitly (%sysroot_suffix_spec is not
aware of multilib defaults).

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Carlos Santos
29df8cccf4 scripts/functions: fix log level in call to CT_DoLog
It must be "DEBUG", not "Debug"

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
2016-08-16 23:56:23 -03:00
Ray Donnelly
c7da54edf4 glibc: Use common arch call to get multilib targets
The previous patch added the function 'CT_DoMultilibTarget()' to
scripts/build/arch/*.sh.

This patch calls the common function to (currently) get just the target
tuple for the current multilib target.

This patch was originally by: Cody P Schafer

Changed by Alexey Neyman: first, try `gcc -print-multiarch`. If it is
supported, use whatever it reports. Otherwise, fall back to our
guesswork. Move "i486" quirk into glibc.sh, as it is specific to glibc
(e.g. uclibc will need i386, which is what GCC reports).

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
Signed-off-by: Ray Donnelly <mingw.android@gmail.com>
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Bryan Hundven
a9e5d4a12d functions: use 'ln -sf' for softlinks
I should have just used ln -sf when I rewrote the custom locations
change. BSD based systems don't have 'cp -s', so switch to using 'ln
-sf'.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-02-19 01:24:19 -08:00
Bryan Hundven
12d24ee33b functions: Softlink custom directory
Hardlinking the custom source directory does not work across separate
mount points. Chnage this to a softlink instead.

This closes #336

Reported-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-02-08 16:06:39 -08:00
Bryan Hundven
1b31314488 CT_GetCustom: Rewrite function to meet expectations
The previous version of CT_GetCustom was a bit... funky.
It didn't handle custom versions to location very well.

This new version is exactly as it appears:

CT_GetCustom <name> <version> <location>

The name is the beginning of the archive (file or directory).
The version is the second half of the archive.
The location is where it can be found. This should be made an absolute
path, but this version is expecting the path in kconfig to be absolute.

A file should extract to a directory: <name>-<version>
A directory will be copied to: <name>-<version>

This keeps our expectations of what we should get.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-12-08 07:20:35 -08:00
Bryan Hundven
0041a8b105 CT_Extract: Move check extracted up
If we are using a custom location, and that custom location is a
directory that does not have an associated tarball, then we shouldn't
warn about not finding a tarball in CT_TARBALLS_DIR if
CT_SRC_DIR/.<basename>.extracted is found.

If the extracted file is not found, then we can warn that the tarball
was not found then error out that the tarball is missing.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-12-08 07:20:16 -08:00
Bryan Hundven
6f8e89cb5c consistency: Use exported variables of required tools
We check for apps:

* make
* sed
* grep
* awk
* libtool/libtoolize
* install
* patch
* and more

...during configure. Our scripts should be consistent about using the
variables that define where the found tool was found.

Of course, we do hard-link these tools in buildtools, but that should be
a backup for the components we are building. Our scripts should always
use the tools we find.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2015-11-17 02:48:09 -08:00
Alexey Neyman
6744ff68e4 Do not log state saving/restoring as ERROR.
These are not errors.

Signed-off-by: Alexey Neyman <stilor@att.net>
2015-11-14 15:26:46 -08:00
Bryan Hundven
c4d14a97ad functions: Add global functions for manipulating kconfig options
This commit adds 4 new functions to aid in the process of managing a
kconfig .config file:

* CT_KconfigSetOption <option> <value> <file>
* CT_KconfigEnableOption <option> <file>
* CT_KconfigDisableOption <option> <file>
* CT_KconfigDeleteOption <option> <file>

(akin to how buildroot manages the uClibc.config)

These functions are global so that we can manage any component that also
uses kconfig, or to be able to use it internally on Crosstool-NG's
kconfig files.

Last but not least, be consistent and update sed to be ${sed}!

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2015-11-12 16:15:39 -08:00
Alexey Neyman
b2f8afef85 Interpret escape sequences in CT_DoLog.
Otherwise, CT_Abort messages with \n are not displayed properly.

Signed-off-by: Alexey Neyman <stilor@att.net>
2015-10-30 16:24:52 -07:00
Alexey Neyman
1d6bed6254 Only create backtrace stamp if dir exists.
If the build is aborted before the working directory is created,
there's also an induced error message about inability to create
a 'backtrace' file. But in that case, there is no subshells executing
yet.

Signed-off-by: Alexey Neyman <stilor@att.net>
2015-10-30 16:24:52 -07:00
Erico Nunes
14cc1cb28e functions: write permission in config.{guess,sub}
avr-libc doesn't have write permissions in these by default in the 1.8.1
tar release, this caused an error during build with
CT_OVERIDE_CONFIG_GUESS_SUB enabled.

chmod u+w them before overriding to avoid an this error.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2015-06-21 20:54:16 -03:00
Erico Nunes
219c5e932f functions: add support for arch-specific patch
Add support for applying arch-specific patches found in
"patches/${pkgname}/${version}/${CT_ARCH}".

This is needed for applying a popular binutils patch specific for the
AVR architecture but which isn't isolated for AVR in binutils' code.
In this case, applying it for every architecture would end up bloating
binutils' "size" options with AVR specifics.

This feels like a bit of a hack but it is easy enough to support with
current crosstool-ng infrastructure, seems like worth it for this case.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2015-06-21 20:53:43 -03:00
Erico Nunes
b8e64a0c08 avr-libc: add support for avr-libc C library
This commit adds support for the avr-libc C library.
According to the project page at http://www.nongnu.org/avr-libc , the
avr-libc package provides a subset of the standard C library for Atmel
AVR 8-bit RISC microcontrollers. In addition, the library provides the
basic startup code needed by most applications.

Support for this library in crosstool-ng is only enabled for the AVR
8-bit target.

The avr-libc manual and most distributions build the AVR 8-bit gcc
toolchain with the "avr" (non-canonical) target.
Some experimentation also led to the conclusion that other (canonical)
targets are not very well supported, so we force the "avr" target for
crosstool-ng as well.

The manual also recommends building avr-libc after the final gcc build.
To accomplish this with crosstool-ng, a new do_libc_post_cc step is
added, in which currently only avr-libc performs its build, and is a
no-op for the other libc options.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2015-06-21 20:53:06 -03:00
Bryan Hundven
c28b4f1ceb Merge pull request #107 from bhundven/remove_experimental_musl_patches
Remove support for experimental patches and musl patches
2015-06-02 12:00:59 -07:00
Bryan Hundven
f680c00283 Merge pull request #58 from dirkhusemann/master
Update functions to grok symlinks
2015-06-02 12:00:49 -07:00
Bryan Hundven
67e6896c2b Remove support for experimental patches and musl patches
This functionality was provided so that crosstool-ng could have a
further set of patches considered experimental and unsupported.
Now that musl-libc support is making it's way upstream in gcc, I'm
removing this support and the experimental musl patches.

In later commits, backports from gcc upstream will be added to the
supported patch sets to support musl-libc.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2015-06-02 10:47:58 -07:00
Dirk Husemann
0130065c0a Update functions to grok symlinks
when specifying a custom kernel provided as a tar ball, the tar ball gets symlinked. the -e test will fail.

Signed-off-by: Dirk Husemann <dirk@d2h.net>
2015-06-02 07:45:57 +02:00
Ray Donnelly
f95b34d52f CT_GetGit: Allow cset to be a ref (branch or tag)
Pass cset as ref=somename to use this feature. CT_GetGit echos
the cset sha1 on exit since the caller will need to know that
information as it forms part of the downloaded tarball name.

Signed-off-by: Ray Donnelly <mingw.android@gmail.com>
2015-05-12 23:32:21 +01:00
Bryan Hundven
cd47c091ba eglibc: Remove eglibc support
As posted on http://www.eglibc.org/
====================
EGLIBC is no longer developed and such goals are now being addressed
directly in GLIBC.
====================

I'm not interested in maintaining build support for unsupported
software.

Older branches of crosstool-ng continue to have eglibc support.
If you find issues with older branches, I'm always open to pull
requests.

Removing eglibc also frees up glibc cleanup and build optimization.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2015-01-27 22:43:25 -08:00
Fabian Freyer
fd5720e6d9 scripts/crosstool-NG: use ${grep} instead of 'grep'
Helps building on BSD-like systems.

Reported-by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Signed-off-by: "Fabian Freyer" <fabian.freyer@physik.tu-berlin.de>
[yann.morin.1998@free.fr: split the original patch]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
2014-08-28 22:32:17 +02:00
Fabian Freyer
0e339fbbf6 scripts/functions: use ${sed} instead of 'sed'
Helps build on BSD-like systems.

Reported-by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Signed-off-by: "Fabian Freyer" <fabian.freyer@physik.tu-berlin.de>
[yann.morin.1998@free.fr: split the original patch]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
2014-08-28 22:31:57 +02:00
Bryan Hundven
52260ccebb libc/musl: add musl-libc support
This patch adds initial support for musl-libc.

Musl-libc versions currently supported:
* 1.0.3 (Stable)
* 1.1.3 (Previous Mainline)
* 1.1.4 (Mainline)

Futher improvements are needed.
* gcc-4.9.x has issues (Might be fixed in musl-1.1.4).
* Multilib support is needed.
* Checks to make sure paths are correct.
* Move to 2-step gcc build. 3-step build is not necessary.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
[yann.morin.1998@free.fr: removed the gcc musl patch, to be added later;
 removed dead code do_get_arch()]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2014-08-08 22:49:37 +02:00
Bryan Hundven
85622fdd49 Add main EXPERIMENTAL_PATCHES setting
This change adds support for experimental patches to be introduced to
crosstool-ng. The patches enabled by this option are to be located here:

    patches/experimental/<package>/<version>/XXXX-NAME.patch

Where, XXXX is the patch number to be applied in order, like:
    0001-some_patch_one.patch
    0002-some_patch_two.patch
    9999-some_patch_to_be_applied_last.patch

In the first patch series, all patches in the EXPERIMENTAL_PATCHES
option will be applied all at once, or none at all.

In a later [RFC] patch, I plan on adding finer tuned patch
enable/disable options based on the name of the patch and where it is
located in the patches/experimental sub-tree. So the name of the patch
should use underscores between words in the patch name.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
[yann.morin.1998@free.fr: slightly reword prompt]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2014-07-28 01:21:51 +02:00
Yann E. MORIN"
12e1875557 scripts/functions: introduce target_bits_32 and target_bits_64 variables
These variables behave the same for bitness as their counterparts do
for endianness: they are defined to the appropriate bitness.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Cody P Schafer <dev@codyps.com>
2014-05-11 23:55:16 +02:00
Yann E. MORIN"
bcb36bb8df scripts/functions: add target_endian_le and target_endian_be
We currently define target_endian_el and target_endian_eb to be the
tuple extension depending on endianness, defined to be respectively
'el' or 'eb' according to the endianness.

Some architecture do not use 'el' or 'eb', but use 'le' or 'be'.

Provide that as well, as two new variables: target_endian_le and
target_endian_be.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Cody P Schafer <dev@codyps.com>
2014-05-11 23:43:52 +02:00
Yann E. MORIN"
e2d2b2ae11 functions: finally fix the git helper
It's gonna soon be used by elf2flt, so we better get it working.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2014-05-11 17:47:53 +02:00
Yann E. MORIN"
4a05e37256 scripts: remove references to curl
It's been a while we're not using curl anymore.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2014-05-10 12:33:37 +02:00
Cody Schafer
490ec21217 scripts: add possibility to not override default connection timeout
Allow '-1' to be specified as CONNECTION_TIMEOUT to disable the use
of the connection timeout for wget.

Signed-off-by: Cody P Schafer <dev@codyps.com>
Message-Id: <cb33f8c2cbaf802d4f04.1399687632@localhost>
Patchwork-Id: 347582
2014-05-09 19:07:02 -07:00
Yann E. MORIN"
0226e35db7 scripts/functions: use portable 'gzip -dc'
'zcat' on MacOS-X is broken (it is not gzip's zcat, but compres' zcat).

Use 'gzip -dc' for portability, as suggested by Anthony.

Reported-by: Fernando Ortiz <fortiz2k@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Anthony Foiani <anthony.foiani@gmail.com>
2013-11-15 21:16:52 +01:00
Yann E. MORIN"
3e297d35e8 scripts: help debugging missing directories
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2013-05-05 18:34:20 +02:00
Jerzy Grzegorek"
b9934ce10a scripts/functions: add xz-ed linux tarballs
Signed-off-by: Jerzy Grzegorek <jerzy.grzegorek@trzebnica.net>
Message-Id: <d0ec17a687dc80754e0f.1363860872@NX5000>
Patchwork-Id: 229619
2013-03-21 11:01:09 +01:00
Martin Guy
e284b218a7 arch/avr32: Fix download of header files
This patch fixes the download of the avr32 headers in crosstool-ng by
fetching them directly from Atmel's web site instead of the now-broken URL
given by the original author of the avr32-header-fetching modification,
who fetched them from a copy on his own, now-defunct server.

It also adds the necessary logic to extract from a zip file, as that is
how the headers are packaged.

To configure it for avr32 after launching ct-ng menuconfig in an empty
directory:

       Paths and misc options ->
               Shell to use as CONFIG_SHELL = sh
       Target options ->
               Target Architecture = avr32
       Toolchain options ->
               Tuple's alias = avr32
       Binary utilities ->
               binutils version = 2.18a
       C compiler
               gcc version = 4.2.2
       C-library
               newlib version = 1.17.0
               Enable IOs on long long = yes
               Enable IOs on floats and doubles = yes
               Disable the syscalls supplied with newlib = yes

CONFIG_SHELL is necessary to get round the "fragment: command not
found" bug when binutils-2.18 is configured using bash.

Prepared against crosstool-ng mercurial trunk on 31 March 2012.

Signed-off-by: Martin Guy <martinwguy@gmail.com>
[yann.morin.1998@free.fr: update bundles sample accordingly]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <CAL4-wQrg_NQ7jm-NCADqeyQr9twyhtx42OUGNThP6gWeqZc=kw@mail.gmail.com>
Patchwork-Id: 232612
2013-03-31 04:07:38 +00:00