config: add an option to name the sysroot directory

Depending on local policies, some users have expressed a need to
have the sysroot be named differently than the hard-coded name.

Add an option for that.
Default to 'sysroot' to match the existing literature.

While at it, replace 'sys-root' with 'sysroot' everywhere we
reference the sysroot.

Reported-by: Alexey Kuznetsov <Alexey.KUZNETSOV@youtransactor.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
Yann E. MORIN" 2011-01-25 20:31:16 +01:00
parent 15a1cc2491
commit 94be1f470c
5 changed files with 30 additions and 10 deletions

View File

@ -8,10 +8,23 @@ config USE_SYSROOT
default y
help
Use the 'shinny new' sysroot feature of gcc: libraries split between
prefix/target/sys-root/lib and prefix/target/sys-root/usr/lib
prefix/target/sysroot/lib and prefix/target/sysroot/usr/lib
You definitely want to say 'Y' here. Yes you do. I know you do. Say 'Y'.
config SYSROOT_NAME
string
prompt "sysroot directory name"
depends on USE_SYSROOT
default "sysroot"
help
Enter the base name of the sysroot directory. Usually, this simply
is 'sysroot' (the default) or 'sys-root'.
You are free to enter anything here, except for spaces, and '/'
(see SYSROOT_DIR_PREFIX, below). If you leave this empy, then the
default 'sysroot' is used.
config SYSROOT_DIR_PREFIX
string
prompt "sysroot prefix dir (READ HELP)" if ! BACKEND
@ -26,7 +39,7 @@ config SYSROOT_DIR_PREFIX
to the sysroot path, just before the actual sysroot directory.
In fact, the sysroot path is constructed as:
${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_DIR_PREFIX}/sys-root
${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_DIR_PREFIX}/${CT_SYSROOT_NAME}
config STATIC_TOOLCHAIN
bool

View File

@ -20,7 +20,7 @@ or
make CROSS_COMPILE=your-target-tuple-
and so on...
It is strongly advised not to use the toolchain sys-root directory as an
It is strongly advised not to use the toolchain sysroot directory as an
install directory for your programs/packages. If you do so, you will not be
able to use your toolchain for another project. It is even strongly advised
that your toolchain is chmod-ed to read-only once successfully build, so that

View File

@ -276,7 +276,7 @@ do_libc_min_kernel_config() {
# We can't rely on the kernel version from the configuration,
# because it might not be available if the user uses pre-installed
# headers. On the other hand, both method will have the kernel
# version installed in "usr/include/linux/version.h" in the sys-root.
# version installed in "usr/include/linux/version.h" in the sysroot.
# Parse that instead of having two code-paths.
version_code_file="${CT_SYSROOT_DIR}/usr/include/linux/version.h"
if [ ! -f "${version_code_file}" -o ! -r "${version_code_file}" ]; then

View File

@ -283,9 +283,16 @@ esac
# Setting up the rest of the environment only if not restarting
if [ -z "${CT_RESTART}" ]; then
# Arrange paths depending on wether we use sys-root or not.
case "${CT_SYSROOT_NAME}" in
"") CT_SYSROOT_NAME="sysroot";;
.) CT_Abort "Sysroot name is set to '.' which is forbidden";;
*' '*) CT_Abort "Sysroot name contains forbidden space(s): '${CT_SYSROOT_NAME}'";;
*/*) CT_Abort "Sysroot name contains forbidden slash(es): '${CT_SYSROOT_NAME}'";;
esac
# Arrange paths depending on wether we use sysroot or not.
if [ "${CT_USE_SYSROOT}" = "y" ]; then
CT_SYSROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_DIR_PREFIX}/sys-root"
CT_SYSROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_DIR_PREFIX}/${CT_SYSROOT_NAME}"
CT_DEBUGROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_DIR_PREFIX}/debug-root"
CT_HEADERS_DIR="${CT_SYSROOT_DIR}/usr/include"
BINUTILS_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
@ -325,8 +332,8 @@ if [ -z "${CT_RESTART}" ]; then
CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/usr/include"
if [ "${CT_USE_SYSROOT}" = "y" ]; then
# Prevent gcc from installing its libraries outside of the sys-root
CT_DoExecLog ALL ln -sf "./${CT_SYSROOT_DIR_PREFIX}/sys-root/lib" "${CT_PREFIX_DIR}/${CT_TARGET}/lib"
# Prevent gcc from installing its libraries outside of the sysroot
CT_DoExecLog ALL ln -sf "./${CT_SYSROOT_DIR_PREFIX}/${CT_SYSROOT_NAME}/lib" "${CT_PREFIX_DIR}/${CT_TARGET}/lib"
fi
# Since we're *not* multilib on the target side, we want all the

View File

@ -57,9 +57,9 @@ OPTIONS
-l name1[:name2[...]]
Always add the specified shared library/ies name1, name2... from the
toolchain (in the sys-root). Actual library names are searched as
toolchain (in the sysroot). Actual library names are searched as
follows (where 'name' is replaced with the given name) in the
sys-root directory:
sysroot directory:
- libname.so
- name.so
- name