package.bbclass: Fix handling of symlinks in debug packages

When copying the sources for the debug source package we use cpio -Ll
which means to copy files as hardlinks and to dereference symlinks.
It appears there is a bug in cpio since -Ll will copy symlinks and
not dereference them. We therefore do a second pass over copied symlinks
resolving them into files. Ideally we would copy these as hardlinks as well
however it doesn't seem worth the extra code and effort for what amounts
to a corner case for a minor space improvement.

This means that the -dbg packages no longer contain broken symlinks.

[YOCTO #5020]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
crosssdk: Construct target_exec_prefix from prefix_nativesdk

${exec_prefix_nativesdk} doesn't exist so use prefix_nativesdk instead.
This resolves issues for code which attepts to use target_exec_prefix.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
populate_sdk_base: Allow sdk tar options to be overridden

It can be useful to override or append options to the SDK tarball creation command
so add a variable to allow this.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gettext: Improve USE_NLS handling for nativesdk/crosssdk/cross-canadian

The gettext handling of USE_NLS has become a bit tricky to understand, or
alter from the SDK context. This patch introduces a SDKUSE_NLS which can
be set to configure a given SDK/ADT to use NLS or not. This is independent
of the target system NLS usage.

The code in gettext.bbclass is therefore simplified and the classes
themselves now set USE_NLS to appropriate values. No NLS is used
for native, cross and crosssdk since it is never used there and
would just increase build time.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
libiconv: Extend to nativesdk and support non-linux targets

This library is currently only available when targeting non-libc. This patch
also makes it available when targetting non-linux since it is likely of use
then.

It also adds a BBCLASSEXTEND for nativesdk since again, it can be useful
in that context.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-cross-canadian-4.8: Enable PARALLEL_MAKE

This disabling of PARALLEL_MAKE has been forward ported for gcc-cross-canadian
since at least 2009-09 and gcc 4.3.3, probably older.

I've tested this with high values of parallel make and it all seems to work and
we usually build gcc with parallel make so it seems unlikely there are issues.
Lets therefore enable it.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-package-sdk.inc: Use relative symlinks in libexec dir

We already use relative links for other gcc libexec links, this changes the sdk
do_install to match elsewhere and use relative symlinks too. This makes things
slightly easier in the SDK installation process and standardises.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-package-sdk.inc: Allow executable extension to be overridden

On platforms like windows, executables have extensions. Whilst I'm not proposing
we wholesale support windows extensions, this small tweak allows a cross compiler
targetting mingw to be built which does seem like a good use case.

The patch therefore adds an EXEEXT which the mingw layer can set for the libexec
symlinks.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-configure-sdk.inc: Don't build target-libgcc

I don't understand why we're building the target libgcc in the canadian-cross build
since it should have been built elsewhere. The compiler configuration isn't correct
to build a working target libgcc in all cases anyway.

To avoid various weird build errors, stop building it.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc: Drop gcc-cross4.inc, its pointless now

The include was useful historically, its not anymore so lets remove it.
This should have no functional change except on any layers directly depending
on it or gcc-cross.inc but even then it would only impact sh4 and is easily
fixed if there was a problem.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-cross-canadian-4.8: Allow elfutils to be a configurable dependency

Some SDK platforms have elfutils support, some do not, therefore allow
this to be configured.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-cross-canadian-4.8: Add missing dependency on nativesdk-zlib

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-cross-canadian: Merge 4.7 and 4.8 recipes into common include

This removes duplication and follows the pattern of the other gcc recipes.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Revert "nativesdk: inherit relocatable"

This reverts commit f93ddea31fcf18833c9bc6e93d93ad223c62eded.

We never run nativesdk binaries so it doesn't make sense to use the relocatable
class. The chrpath calls at packaging time will ensure the binaries are relocated
in the final packages. The binaries in the sysroot are never used.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake.conf/classes/gcc: Don't hardcode -nativesdk

Hardcoding -nativesdk as the sdk package architecture is inflexible. We may have
multiple different target OS and we need a way to be able to separate them. Turning
this into a configurable value allows the flexibility we need to build different
SDKMACHINEs with different OS targets.

The commit should have no behaviour change, just makes things more configurable.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-cross: Fold common configuration into gcc-cross.inc

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-cross-initial: Fold common configuration into gcc-cross-initial.inc

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-runtime: Fold common configuration into gcc-configure-runtime.inc

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
libgcc: Move common code to libgcc.inc

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
gcc-target: Combine gcc-target-configure.inc, gcc-target-package.inc and other common code

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>