scripts/addToolsVersion: properly handle .in vs. .in.2
While most components have their version in the .in file, some
have it in the .in.2 (eg. elf2flt).
Currently, to handle this case, we indiscriminately munge both files,
but this is wrong: in the elf2flt case, if we add a binutils version,
we do not want it to be added to elf2flt, and conversely.
So, for each tool, we need to explicitly know what file to munge.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
1 # This file declares functions to install the kernel headers for linux
2 # Copyright 2007 Yann E. MORIN
3 # Licensed under the GPL v2. See COPYING in the root of this package
5 CT_DoKernelTupleValues() {
6 if [ "${CT_ARCH_USE_MMU}" = "y" ]; then
7 CT_TARGET_KERNEL="linux"
9 # Some no-mmu linux targets requires a -uclinux tuple (like m68k/cf),
10 # while others must have a -linux tuple (like bfin). Other targets
11 # should be added here when someone starts to care about them.
13 blackfin) CT_TARGET_KERNEL="linux" ;;
14 m68k) CT_TARGET_KERNEL="uclinux" ;;
15 *) CT_Abort "Unsupported no-mmu arch '${CT_ARCH}'"
25 local korg_base mirror_base
27 if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then
31 if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
32 CT_GetCustom "linux" "${CT_KERNEL_VERSION}" \
33 "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"
34 else # Not a custom tarball
35 case "${CT_KERNEL_VERSION}" in
37 # 4-part versions (for 2.6 stables and long-terms), and
38 # 3-part versions (for 3.x.y stables and long-terms),
39 # we need to trash the last digit
40 k_ver="${CT_KERNEL_VERSION%.*}"
43 # 3-part version (for 2.6.x initial releases), and 2-part
44 # versions (for 3.x initial releases), use all of it
45 k_ver="${CT_KERNEL_VERSION}"
48 case "${CT_KERNEL_VERSION}" in
52 korg_base="http://ftp.kernel.org/pub/linux/kernel/${rel_dir}"
53 CT_GetFile "linux-${CT_KERNEL_VERSION}" \
55 "${korg_base}/longterm/v${k_ver}" \
56 "${korg_base}/longterm"
62 # If using a custom headers tree, nothing to do
63 if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then
67 # If using a custom directory location, nothing to do
68 if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" \
69 -a -d "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}" ]; then
73 # Otherwise, we're using either a mainstream tarball, or a custom
74 # tarball; in either case, we need to extract
75 CT_Extract "linux-${CT_KERNEL_VERSION}"
77 # If using a custom tarball, no need to patch
78 if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
81 CT_Patch "linux" "${CT_KERNEL_VERSION}"
84 # Wrapper to the actual headers install method
86 CT_DoStep INFO "Installing kernel headers"
88 if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then
97 # Install kernel headers using headers_install from kernel sources.
101 CT_DoLog DEBUG "Using kernel's headers_install"
103 mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"
105 kernel_path="${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"
106 if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
107 kernel_path="${CT_SRC_DIR}/linux-custom"
109 V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
111 CT_DoLog EXTRA "Installing kernel headers"
113 make -C "${kernel_path}" \
114 O="${CT_BUILD_DIR}/build-kernel-headers" \
116 INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
120 if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
121 CT_DoLog EXTRA "Checking installed headers"
123 make -C "${kernel_path}" \
124 O="${CT_BUILD_DIR}/build-kernel-headers" \
126 INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
132 find "${CT_SYSROOT_DIR}" -type f \
133 \( -name '.install' \
134 -o -name '..install.cmd' \
136 -o -name '..check.cmd' \
141 # Use custom headers (most probably by using make headers_install in a
142 # modified (read: customised) kernel tree, or using pre-2.6.18 headers, such
143 # as 2.4). In this case, simply copy the headers in place
147 CT_DoLog EXTRA "Installing custom kernel headers"
149 mkdir -p "${CT_SYSROOT_DIR}/usr"
150 cd "${CT_SYSROOT_DIR}/usr"
151 if [ "${CT_KERNEL_LINUX_CUSTOM_IS_TARBALL}" = "y" ]; then
152 case "${CT_KERNEL_LINUX_CUSTOM_PATH}" in
154 *.tgz) tar_opt=--gzip;;
155 *.tar.gz) tar_opt=--gzip;;
156 *.tar.bz2) tar_opt=--bzip2;;
158 CT_DoExecLog ALL tar x ${tar_opt} -vf ${CT_KERNEL_LINUX_CUSTOM_PATH}
160 CT_DoExecLog ALL cp -rv "${CT_KERNEL_LINUX_CUSTOM_PATH}/include" .