Add config flags for omitting 'arch' and 'vendor'

... parts of the config tuple. While here, remove parts that are
setting portions of the target tuple to a value that's already
the default.

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2018-12-10 01:10:01 -08:00
parent afb17244d2
commit 5cf859d9d9
11 changed files with 113 additions and 74 deletions

View File

@ -1,9 +1,13 @@
# avr-libc options # avr-libc options
# Do not canonicalize the target tuple: avr-libc requires a non-canonical "avr" target.
#
## depends on ARCH_AVR ## depends on ARCH_AVR
## depends on BARE_METAL ## depends on BARE_METAL
## ##
## select LIBC_SUPPORT_THREADS_NONE ## select LIBC_SUPPORT_THREADS_NONE
## select OMIT_TARGET_VENDOR
## select TARGET_SKIP_CONFIG_SUB
## ##
## help The AVR Libc package provides a subset of the standard C library for ## help The AVR Libc package provides a subset of the standard C library for
## help Atmel AVR 8-bit RISC microcontrollers. In addition, the library ## help Atmel AVR 8-bit RISC microcontrollers. In addition, the library

View File

@ -19,6 +19,21 @@ config ARCH_SUFFIX
If you are not sure about what this is, leave it blank. If you are not sure about what this is, leave it blank.
config OMIT_TARGET_ARCH
bool
help
Do not include architecture into the target tuple.
config OMIT_TARGET_VENDOR
bool "Omit vendor part of the target tuple"
help
Do not include vendor into the target tuple.
config TARGET_SKIP_CONFIG_SUB
bool
help
Skip canonicalization of the target tuple.
#-------------------------------------- #--------------------------------------
comment "Generic target options" comment "Generic target options"

View File

@ -121,7 +121,7 @@ comment "Tuple completion and aliasing"
config TARGET_VENDOR config TARGET_VENDOR
string string
prompt "Tuple's vendor string" prompt "Tuple's vendor string"
depends on !LIBC_AVR_LIBC depends on !OMIT_TARGET_VENDOR
default "unknown" default "unknown"
help help
Vendor part of the target tuple. Vendor part of the target tuple.

View File

@ -1,31 +1,36 @@
# This file provides the default implementations of arch-specific functions. # This file provides the default implementations of arch-specific functions.
# Set up the target tuple # Set up the target tuple
CT_DoArchTupleValues() { CT_DoArchTupleValues()
:; {
:
} }
# Adjust the list of multilibs for the target # Adjust the list of multilibs for the target
CT_DoArchMultilibList() { CT_DoArchMultilibList()
:; {
:
} }
# Multilib: change the target triplet according to CFLAGS # Multilib: change the target triplet according to CFLAGS
# Usage: CT_DoArchGlibcAdjustTuple <variable-name> <CFLAGS> # Usage: CT_DoArchGlibcAdjustTuple <variable-name> <CFLAGS>
CT_DoArchMultilibTarget() { CT_DoArchMultilibTarget()
:; {
:
} }
# Multilib: Adjust target tuple for GLIBC # Multilib: Adjust target tuple for GLIBC
# Usage: CT_DoArchGlibcAdjustTuple <variable-name> # Usage: CT_DoArchGlibcAdjustTuple <variable-name>
CT_DoArchGlibcAdjustTuple() { CT_DoArchGlibcAdjustTuple()
:; {
:
} }
# Multilib: Adjust configure arguments for GLIBC # Multilib: Adjust configure arguments for GLIBC
# Usage: CT_DoArchGlibcAdjustConfigure <configure-args-array-name> <cflags> # Usage: CT_DoArchGlibcAdjustConfigure <configure-args-array-name> <cflags>
CT_DoArchGlibcAdjustConfigure() { CT_DoArchGlibcAdjustConfigure()
:; {
:
} }
# Helper for uClibc configurators: select the architecture # Helper for uClibc configurators: select the architecture
@ -41,14 +46,16 @@ CT_DoArchUClibcSelectArch() {
# uClibc: Adjust configuration file according to the CT-NG configuration # uClibc: Adjust configuration file according to the CT-NG configuration
# Usage: CT_DoArchUClibcConfig <config-file> # Usage: CT_DoArchUClibcConfig <config-file>
CT_DoArchUClibcConfig() { CT_DoArchUClibcConfig()
{
CT_DoLog WARN "Support for '${CT_ARCH}' is not implemented in uClibc config tweaker." CT_DoLog WARN "Support for '${CT_ARCH}' is not implemented in uClibc config tweaker."
CT_DoLog WARN "Exact configuration file must be provided." CT_DoLog WARN "Exact configuration file must be provided."
} }
# Multilib/uClibc: Adjust configuration file for given CFLAGS # Multilib/uClibc: Adjust configuration file for given CFLAGS
# Usage: CT_DoArchUClibcCflags <config-file> <cflags> # Usage: CT_DoArchUClibcCflags <config-file> <cflags>
CT_DoArchUClibcCflags() { CT_DoArchUClibcCflags()
{
local cfg="${1}" local cfg="${1}"
local cflags="${2}" local cflags="${2}"
@ -63,21 +70,24 @@ CT_DoArchUClibcCflags() {
# Multilib/uClibc: Adjust header installation path for given CFLAGS # Multilib/uClibc: Adjust header installation path for given CFLAGS
# Usage: CT_DoArchUClibcHeaderDir <path-variable> <cflags> # Usage: CT_DoArchUClibcHeaderDir <path-variable> <cflags>
CT_DoArchUClibcHeaderDir() { CT_DoArchUClibcHeaderDir()
{
# Only needed if a given architecture may select different uClibc architectures. # Only needed if a given architecture may select different uClibc architectures.
:; :
} }
# Multilib/MUSL: Adjust header installation path for given CFLAGS # Multilib/MUSL: Adjust header installation path for given CFLAGS
# Usage: CT_DoArchMUSLHeaderDir <path-variable> <cflags> # Usage: CT_DoArchMUSLHeaderDir <path-variable> <cflags>
CT_DoArchMUSLHeaderDir() { CT_DoArchMUSLHeaderDir()
{
# Only needed if a given architecture may select different MUSL architectures. # Only needed if a given architecture may select different MUSL architectures.
:; :
} }
# MUSL: Perform any final adjustments on the installed libc/headers # MUSL: Perform any final adjustments on the installed libc/headers
CT_DoArchMUSLPostInstall() { CT_DoArchMUSLPostInstall()
:; {
:
} }
# Override from the actual arch implementation as needed. # Override from the actual arch implementation as needed.

View File

@ -1,23 +1,20 @@
# Compute ARC-specific values # Compute ARC-specific values
CT_DoArchTupleValues() { CT_DoArchTupleValues()
{
# The architecture part of the tuple: # The architecture part of the tuple:
CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX:-${target_endian_eb}}" CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX:-${target_endian_eb}}"
# The system part of the tuple:
case "${CT_LIBC}" in
glibc) CT_TARGET_SYS=gnu;;
uClibc) CT_TARGET_SYS=uclibc;;
esac
} }
CT_DoArchUClibcConfig() { CT_DoArchUClibcConfig()
{
local cfg="${1}" local cfg="${1}"
CT_DoArchUClibcSelectArch "${cfg}" "arc" CT_DoArchUClibcSelectArch "${cfg}" "arc"
} }
CT_DoArchUClibcCflags() { CT_DoArchUClibcCflags()
{
local cfg="${1}" local cfg="${1}"
local cflags="${2}" local cflags="${2}"
local f local f

View File

@ -2,11 +2,4 @@
CT_DoArchTupleValues() { CT_DoArchTupleValues() {
CT_TARGET_ARCH="${CT_ARCH}" CT_TARGET_ARCH="${CT_ARCH}"
case "${CT_LIBC}" in
avr-libc)
# avr-libc only seems to work with the non-canonical "avr" target.
CT_TARGET_SKIP_CONFIG_SUB=y
CT_TARGET_SYS= # CT_TARGET_SYS must be empty
;;
esac
} }

View File

@ -1,18 +1,15 @@
# Compute Xtensa-specific values # Compute Xtensa-specific values
CT_DoArchTupleValues() { CT_DoArchTupleValues()
{
# The architecture part of the tuple: # The architecture part of the tuple:
CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX}" CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX}"
CT_ARCH_ENDIAN_CFLAG="" CT_ARCH_ENDIAN_CFLAG=""
CT_ARCH_ENDIAN_LDFLAG="" CT_ARCH_ENDIAN_LDFLAG=""
# The system part of the tuple:
case "${CT_LIBC}" in
*glibc) CT_TARGET_SYS=gnu;;
uClibc) CT_TARGET_SYS=uclibc;;
esac
} }
CT_DoArchUClibcConfig() { CT_DoArchUClibcConfig()
{
local cfg="${1}" local cfg="${1}"
CT_DoArchUClibcSelectArch "${cfg}" "xtensa" CT_DoArchUClibcSelectArch "${cfg}" "xtensa"

View File

@ -2,19 +2,23 @@
# Copyright 2008 Yann E. MORIN # Copyright 2008 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package # Licensed under the GPL v2. See COPYING in the root of this package
CT_DoKernelTupleValues() { CT_DoKernelTupleValues()
{
# For bare-metal, there is no kernel part in the tuple # For bare-metal, there is no kernel part in the tuple
CT_TARGET_KERNEL= CT_TARGET_KERNEL=
} }
do_kernel_get() { do_kernel_get()
{
: :
} }
do_kernel_extract() { do_kernel_extract()
{
: :
} }
do_kernel_headers() { do_kernel_headers()
{
: :
} }

View File

@ -2,10 +2,9 @@
# Copyright 2007 Yann E. MORIN # Copyright 2007 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package # Licensed under the GPL v2. See COPYING in the root of this package
CT_DoKernelTupleValues() { CT_DoKernelTupleValues()
if [ "${CT_ARCH_USE_MMU}" = "y" ]; then {
CT_TARGET_KERNEL="linux" if [ -z "${CT_ARCH_USE_MMU}" ]; then
else
# Some no-mmu linux targets requires a -uclinux tuple (like m68k/cf), # Some no-mmu linux targets requires a -uclinux tuple (like m68k/cf),
# while others must have a -linux tuple. Other targets # while others must have a -linux tuple. Other targets
# should be added here when someone starts to care about them. # should be added here when someone starts to care about them.
@ -18,7 +17,8 @@ CT_DoKernelTupleValues() {
} }
# Download the kernel # Download the kernel
do_kernel_get() { do_kernel_get()
{
CT_Fetch LINUX CT_Fetch LINUX
} }
@ -42,7 +42,8 @@ do_kernel_extract()
} }
# Install kernel headers using headers_install from kernel sources. # Install kernel headers using headers_install from kernel sources.
do_kernel_headers() { do_kernel_headers()
{
local kernel_path local kernel_path
local kernel_arch local kernel_arch

View File

@ -2,20 +2,24 @@
# Copyright 2012 Yann Diorcet # Copyright 2012 Yann Diorcet
# Licensed under the GPL v2. See COPYING in the root of this package # Licensed under the GPL v2. See COPYING in the root of this package
CT_DoKernelTupleValues() { CT_DoKernelTupleValues()
{
# Even we compile for x86_64 target architecture, the target OS have to # Even we compile for x86_64 target architecture, the target OS have to
# bet mingw32 (require by gcc and mingw-w64) # bet mingw32 (require by gcc and mingw-w64)
CT_TARGET_KERNEL="mingw32" CT_TARGET_KERNEL="mingw32"
} }
do_kernel_get() { do_kernel_get()
{
: :
} }
do_kernel_extract() { do_kernel_extract()
{
: :
} }
do_kernel_headers() { do_kernel_headers()
{
: :
} }

View File

@ -1094,18 +1094,18 @@ CT_DoBuildTargetTuple() {
# Build the default architecture tuple part # Build the default architecture tuple part
CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX}" CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX}"
# Set defaults for the system part of the tuple. Can be overriden # Set defaults for the system part of the tuple; only C libraries that
# by architecture-specific values. # support multiple architectures. Can be overriden by architecture-specific
# values.
case "${CT_LIBC}" in case "${CT_LIBC}" in
glibc) CT_TARGET_SYS=gnu;; glibc) CT_TARGET_SYS=gnu;;
uClibc) CT_TARGET_SYS=uclibc;; uClibc) CT_TARGET_SYS=uclibc;;
musl) CT_TARGET_SYS=musl;; musl) CT_TARGET_SYS=musl;;
bionic) CT_TARGET_SYS=android;; bionic) CT_TARGET_SYS=android;;
none|newlib) none|newlib) CT_TARGET_SYS=elf;;
CT_TARGET_SYS=elf
;;
*) *)
CT_TARGET_SYS= # Keep empty for the libraries like mingw # Keep empty for the libraries like mingw or avr-libc
CT_TARGET_SYS=
;; ;;
esac esac
@ -1145,10 +1145,18 @@ CT_DoBuildTargetTuple() {
CT_DoKernelTupleValues CT_DoKernelTupleValues
# Finish the target tuple construction # Finish the target tuple construction
CT_TARGET="${CT_TARGET_ARCH}" if [ -z "${CT_OMIT_TARGET_ARCH}" ]; then
CT_TARGET="${CT_TARGET}${CT_TARGET_VENDOR:+-${CT_TARGET_VENDOR}}" CT_TARGET="${CT_TARGET_ARCH}"
CT_TARGET="${CT_TARGET}${CT_TARGET_KERNEL:+-${CT_TARGET_KERNEL}}" fi
CT_TARGET="${CT_TARGET}${CT_TARGET_SYS:+-${CT_TARGET_SYS}}" if [ -z "${CT_OMIT_TARGET_VENDOR}" -a -n "${CT_TARGET_VENDOR}" ]; then
CT_TARGET="${CT_TARGET:+${CT_TARGET}-}${CT_TARGET_VENDOR}"
fi
if [ -n "${CT_TARGET_KERNEL}" ]; then
CT_TARGET="${CT_TARGET:+${CT_TARGET}-}${CT_TARGET_KERNEL}"
fi
if [ -n "${CT_TARGET_SYS}" ]; then
CT_TARGET="${CT_TARGET:+${CT_TARGET}-}${CT_TARGET_SYS}"
fi
# Sanity checks # Sanity checks
__sed_alias="" __sed_alias=""
@ -1165,6 +1173,12 @@ CT_DoBuildTargetTuple() {
# Canonicalise it # Canonicalise it
if [ "${CT_TARGET_SKIP_CONFIG_SUB}" != "y" ]; then if [ "${CT_TARGET_SKIP_CONFIG_SUB}" != "y" ]; then
CT_TARGET=$(CT_DoConfigSub "${CT_TARGET}") CT_TARGET=$(CT_DoConfigSub "${CT_TARGET}")
if [ -n "${CT_OMIT_TARGET_VENDOR}" ]; then
# config.sub always returns a 3- or 4-part tuple, with vendor
# always being the 2nd part.
CT_TARGET="${CT_TARGET%%-*}-${CT_TARGET#*-*-}"
fi
fi fi
# Prepare the target CFLAGS # Prepare the target CFLAGS
@ -1316,7 +1330,7 @@ CT_DoSaveState() {
done | ${sed} 's/^declare /declare -g /' done | ${sed} 's/^declare /declare -g /'
echo "builtin unset ${CT_ENVVAR_UNSET}" echo "builtin unset ${CT_ENVVAR_UNSET}"
} >"${state_dir}/env.sh" } >"${state_dir}/env.sh"
# Save .config to check it hasn't changed when resuming. # Save .config to check it hasn't changed when resuming.
CT_DoExecLog STATE cp ".config" "${state_dir}/config" CT_DoExecLog STATE cp ".config" "${state_dir}/config"
@ -1804,7 +1818,7 @@ CT_Download_cvs()
fi fi
} }
# Find the most recent version from Subversion. # Find the most recent version from Subversion.
CT_GetVersion_svn() CT_GetVersion_svn()
{ {
devel_branch="${devel_branch:-/trunk}" devel_branch="${devel_branch:-/trunk}"
@ -1857,7 +1871,7 @@ CT_Download_hg()
fi fi
if [ "${devel_revision}" = "to.be.determined" ]; then if [ "${devel_revision}" = "to.be.determined" ]; then
# Report what we found out (as common message lacks the revision) # Report what we found out (as common message lacks the revision)
devel_revision=`hg identify -i` devel_revision=`hg identify -i`
unique_id="${devel_revision}" unique_id="${devel_revision}"
CT_DoLog EXTRA "Retrieved revision ${devel_revision}" CT_DoLog EXTRA "Retrieved revision ${devel_revision}"
else else
@ -2246,7 +2260,7 @@ CT_DoExtractPatch()
done done
fi fi
done done
# TBD create meta-package for config.sub/config.guess with replacement script # TBD create meta-package for config.sub/config.guess with replacement script
if [ "${CT_OVERRIDE_CONFIG_GUESS_SUB}" = "y" ]; then if [ "${CT_OVERRIDE_CONFIG_GUESS_SUB}" = "y" ]; then
CT_DoLog ALL "Overiding config.guess and config.sub" CT_DoLog ALL "Overiding config.guess and config.sub"