1.1 --- a/scripts/build/binutils.sh Mon Jan 05 21:09:37 2009 +0000
1.2 +++ b/scripts/build/binutils.sh Mon Jan 05 23:02:43 2009 +0000
1.3 @@ -11,7 +11,8 @@
1.4
1.5 # Extract binutils
1.6 do_binutils_extract() {
1.7 - CT_ExtractAndPatch "binutils-${CT_BINUTILS_VERSION}"
1.8 + CT_Extract "binutils-${CT_BINUTILS_VERSION}"
1.9 + CT_Patch "binutils-${CT_BINUTILS_VERSION}"
1.10 }
1.11
1.12 # Build binutils
2.1 --- a/scripts/build/cc/gcc.sh Mon Jan 05 21:09:37 2009 +0000
2.2 +++ b/scripts/build/cc/gcc.sh Mon Jan 05 23:02:43 2009 +0000
2.3 @@ -16,7 +16,8 @@
2.4
2.5 # Extract gcc
2.6 do_cc_extract() {
2.7 - CT_ExtractAndPatch "gcc-${CT_CC_VERSION}"
2.8 + CT_Extract "gcc-${CT_CC_VERSION}"
2.9 + CT_Patch "gcc-${CT_CC_VERSION}"
2.10 }
2.11
2.12 #------------------------------------------------------------------------------
3.1 --- a/scripts/build/debug/000-template.sh Mon Jan 05 21:09:37 2009 +0000
3.2 +++ b/scripts/build/debug/000-template.sh Mon Jan 05 23:02:43 2009 +0000
3.3 @@ -10,7 +10,8 @@
3.4 # Put your extract code here
3.5 do_debug_foobar_extract() {
3.6 # For example:
3.7 - # CT_ExtractAndPatch "foobar-${CT_FOOBAR_VERSION}"
3.8 + # CT_Extract "foobar-${CT_FOOBAR_VERSION}"
3.9 + # CT_Patch "foobar-${CT_FOOBAR_VERSION}"
3.10 :
3.11 }
3.12
4.1 --- a/scripts/build/debug/100-dmalloc.sh Mon Jan 05 21:09:37 2009 +0000
4.2 +++ b/scripts/build/debug/100-dmalloc.sh Mon Jan 05 23:02:43 2009 +0000
4.3 @@ -5,7 +5,8 @@
4.4 }
4.5
4.6 do_debug_dmalloc_extract() {
4.7 - CT_ExtractAndPatch "dmalloc-${CT_DMALLOC_VERSION}"
4.8 + CT_Extract "dmalloc-${CT_DMALLOC_VERSION}"
4.9 + CT_Patch "dmalloc-${CT_DMALLOC_VERSION}"
4.10 }
4.11
4.12 do_debug_dmalloc_build() {
5.1 --- a/scripts/build/debug/200-duma.sh Mon Jan 05 21:09:37 2009 +0000
5.2 +++ b/scripts/build/debug/200-duma.sh Mon Jan 05 23:02:43 2009 +0000
5.3 @@ -2,26 +2,23 @@
5.4
5.5 do_debug_duma_get() {
5.6 CT_GetFile "duma_${CT_DUMA_VERSION}" http://mesh.dl.sourceforge.net/sourceforge/duma/
5.7 - # D.U.M.A. doesn't separate its name from its version with a dash,
5.8 - # but with an underscore. Create a link so that crosstool-NG can
5.9 - # work correctly:
5.10 - CT_Pushd "${CT_TARBALLS_DIR}"
5.11 - duma_ext=$(CT_GetFileExtension "duma_${CT_DUMA_VERSION}")
5.12 - rm -f "duma-${CT_DUMA_VERSION}${duma_ext}"
5.13 - ln -sf "duma_${CT_DUMA_VERSION}${duma_ext}" "duma-${CT_DUMA_VERSION}${duma_ext}"
5.14 # Downloading from sourceforge leaves garbage, cleanup
5.15 - rm -f showfiles.php\?group_id\=*
5.16 - CT_Popd
5.17 + CT_DoExecLog ALL rm -f "${CT_TARBALLS_DIR}/showfiles.php"*
5.18 }
5.19
5.20 do_debug_duma_extract() {
5.21 - CT_ExtractAndPatch "duma-${CT_DUMA_VERSION}"
5.22 + CT_Extract "duma_${CT_DUMA_VERSION}"
5.23 + CT_Pushd "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}"
5.24 + # Even if DUMA uses _ and not -, crosstool-NG uses the dash to split the
5.25 + # name from the version in order to find the appropriate patches
5.26 + # YEM: FIXME: make CT_Patch more intelligent, Eg.: CT_Patch duma _ "${CT_DUMA_VERSION}"
5.27 + CT_Patch "duma-${CT_DUMA_VERSION}" nochdir
5.28 + CT_Popd
5.29 }
5.30
5.31 do_debug_duma_build() {
5.32 CT_DoStep INFO "Installing D.U.M.A."
5.33 CT_DoLog EXTRA "Copying sources"
5.34 - # DUMA separates its name from the version with an underscore, not a dash
5.35 cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}" "${CT_BUILD_DIR}/build-duma"
5.36 CT_Pushd "${CT_BUILD_DIR}/build-duma"
5.37
6.1 --- a/scripts/build/debug/300-gdb.sh Mon Jan 05 21:09:37 2009 +0000
6.2 +++ b/scripts/build/debug/300-gdb.sh Mon Jan 05 23:02:43 2009 +0000
6.3 @@ -57,15 +57,18 @@
6.4 do_debug_gdb_parts
6.5
6.6 if [ "${do_gdb}" = "y" ]; then
6.7 - CT_ExtractAndPatch "gdb$(do_debug_gdb_suffix)"
6.8 + CT_Extract "gdb$(do_debug_gdb_suffix)"
6.9 + CT_Patch "gdb$(do_debug_gdb_suffix)"
6.10 fi
6.11
6.12 if [ "${do_insight}" = "y" ]; then
6.13 - CT_ExtractAndPatch "insight-${CT_GDB_VERSION}"
6.14 + CT_Extract "insight-${CT_GDB_VERSION}"
6.15 + CT_Patch "insight-${CT_GDB_VERSION}"
6.16 fi
6.17
6.18 if [ "${do_ncurses}" = "y" ]; then
6.19 - CT_ExtractAndPatch "ncurses-${CT_NCURSES_VERSION}"
6.20 + CT_Extract "ncurses-${CT_NCURSES_VERSION}"
6.21 + CT_Patch "ncurses-${CT_NCURSES_VERSION}"
6.22 fi
6.23 }
6.24
7.1 --- a/scripts/build/debug/400-ltrace.sh Mon Jan 05 21:09:37 2009 +0000
7.2 +++ b/scripts/build/debug/400-ltrace.sh Mon Jan 05 23:02:43 2009 +0000
7.3 @@ -9,7 +9,8 @@
7.4 }
7.5
7.6 do_debug_ltrace_extract() {
7.7 - CT_ExtractAndPatch "ltrace-${CT_LTRACE_VERSION}"
7.8 + CT_Extract "ltrace-${CT_LTRACE_VERSION}"
7.9 + CT_Patch "ltrace-${CT_LTRACE_VERSION}"
7.10 }
7.11
7.12 do_debug_ltrace_build() {
8.1 --- a/scripts/build/debug/500-strace.sh Mon Jan 05 21:09:37 2009 +0000
8.2 +++ b/scripts/build/debug/500-strace.sh Mon Jan 05 23:02:43 2009 +0000
8.3 @@ -3,13 +3,12 @@
8.4 do_debug_strace_get() {
8.5 CT_GetFile "strace-${CT_STRACE_VERSION}" http://mesh.dl.sourceforge.net/sourceforge/strace/
8.6 # Downloading from sourceforge leaves garbage, cleanup
8.7 - CT_Pushd "${CT_TARBALLS_DIR}"
8.8 - rm -f showfiles.php\?group_id\=*
8.9 - CT_Popd
8.10 + CT_DoExecLog ALL rm -f "${CT_TARBALLS_DIR}/showfiles.php"*
8.11 }
8.12
8.13 do_debug_strace_extract() {
8.14 - CT_ExtractAndPatch "strace-${CT_STRACE_VERSION}"
8.15 + CT_Extract "strace-${CT_STRACE_VERSION}"
8.16 + CT_Patch "strace-${CT_STRACE_VERSION}"
8.17 }
8.18
8.19 do_debug_strace_build() {
9.1 --- a/scripts/build/gmp.sh Mon Jan 05 21:09:37 2009 +0000
9.2 +++ b/scripts/build/gmp.sh Mon Jan 05 23:02:43 2009 +0000
9.3 @@ -17,7 +17,8 @@
9.4
9.5 # Extract GMP
9.6 do_gmp_extract() {
9.7 - CT_ExtractAndPatch "gmp-${CT_GMP_VERSION}"
9.8 + CT_Extract "gmp-${CT_GMP_VERSION}"
9.9 + CT_Patch "gmp-${CT_GMP_VERSION}"
9.10 }
9.11
9.12 do_gmp() {
10.1 --- a/scripts/build/kernel/linux.sh Mon Jan 05 21:09:37 2009 +0000
10.2 +++ b/scripts/build/kernel/linux.sh Mon Jan 05 23:02:43 2009 +0000
10.3 @@ -19,7 +19,8 @@
10.4 # Extract kernel
10.5 do_kernel_extract() {
10.6 if [ "${CT_KERNEL_LINUX_USE_CUSTOM_DIR}" != "y" ]; then
10.7 - CT_ExtractAndPatch "linux-${CT_KERNEL_VERSION}"
10.8 + CT_Extract "linux-${CT_KERNEL_VERSION}"
10.9 + CT_Patch "linux-${CT_KERNEL_VERSION}"
10.10 fi
10.11 return 0
10.12 }
11.1 --- a/scripts/build/libc/eglibc.sh Mon Jan 05 21:09:37 2009 +0000
11.2 +++ b/scripts/build/libc/eglibc.sh Mon Jan 05 23:02:43 2009 +0000
11.3 @@ -92,14 +92,24 @@
11.4
11.5 # Extract eglibc
11.6 do_libc_extract() {
11.7 - CT_ExtractAndPatch "eglibc-${CT_LIBC_VERSION}"
11.8 + CT_Extract "eglibc-${CT_LIBC_VERSION}"
11.9 + CT_Patch "eglibc-${CT_LIBC_VERSION}"
11.10
11.11 # C library addons
11.12 for addon in $(do_libc_add_ons_list " "); do
11.13 # NPTL addon is not to be extracted, in any case
11.14 [ "${addon}" = "nptl" ] && continue || true
11.15 CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}"
11.16 - CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" nochdir
11.17 + CT_Extract "eglibc-${addon}-${CT_LIBC_VERSION}" nochdir
11.18 + # Some addons have the 'long' name, while others have the
11.19 + # 'short' name, but patches are non-uniformly built with
11.20 + # either the 'long' or 'short' name, whatever the addons name
11.21 + # so we have to make symlinks from the existing to the missing
11.22 + # Fortunately for us, [ -d foo ], when foo is a symlink to a
11.23 + # directory, returns true!
11.24 + [ -d "${addon}" ] || ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
11.25 + [ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
11.26 + CT_Patch "eglibc-${addon}-${CT_LIBC_VERSION}" nochdir
11.27 CT_Popd
11.28 done
11.29
12.1 --- a/scripts/build/libc/glibc.sh Mon Jan 05 21:09:37 2009 +0000
12.2 +++ b/scripts/build/libc/glibc.sh Mon Jan 05 23:02:43 2009 +0000
12.3 @@ -55,14 +55,24 @@
12.4
12.5 # Extract glibc
12.6 do_libc_extract() {
12.7 - CT_ExtractAndPatch "glibc-${CT_LIBC_VERSION}"
12.8 + CT_Extract "glibc-${CT_LIBC_VERSION}"
12.9 + CT_Patch "glibc-${CT_LIBC_VERSION}"
12.10
12.11 # C library addons
12.12 for addon in $(do_libc_add_ons_list " "); do
12.13 # NPTL addon is not to be extracted, in any case
12.14 [ "${addon}" = "nptl" ] && continue || true
12.15 CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
12.16 - CT_ExtractAndPatch "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
12.17 + CT_Extract "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
12.18 + # Some addons have the 'long' name, while others have the
12.19 + # 'short' name, but patches are non-uniformly built with
12.20 + # either the 'long' or 'short' name, whatever the addons name
12.21 + # so we have to make symlinks from the existing to the missing
12.22 + # Fortunately for us, [ -d foo ], when foo is a symlink to a
12.23 + # directory, returns true!
12.24 + [ -d "${addon}" ] || ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
12.25 + [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
12.26 + CT_Patch "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
12.27 CT_Popd
12.28 done
12.29
13.1 --- a/scripts/build/libc/uClibc.sh Mon Jan 05 21:09:37 2009 +0000
13.2 +++ b/scripts/build/libc/uClibc.sh Mon Jan 05 23:02:43 2009 +0000
13.3 @@ -12,18 +12,23 @@
13.4 # later...
13.5 CT_GetFile "uClibc-${CT_LIBC_VERSION}" ${libc_src}
13.6 # uClibc locales
13.7 - [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_GetFile "uClibc-locale-030818" ${libc_src} || true
13.8 + if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then
13.9 + CT_GetFile "uClibc-locale-030818" ${libc_src}
13.10 + fi
13.11
13.12 return 0
13.13 }
13.14
13.15 # Extract uClibc
13.16 do_libc_extract() {
13.17 - CT_ExtractAndPatch "uClibc-${CT_LIBC_VERSION}"
13.18 + CT_Extract "uClibc-${CT_LIBC_VERSION}"
13.19 + CT_Patch "uClibc-${CT_LIBC_VERSION}"
13.20 +
13.21 # uClibc locales
13.22 if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then
13.23 - CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"
13.24 - CT_ExtractAndPatch "uClibc-locale-030818" nochdir || true
13.25 + CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}/extra/locale"
13.26 + CT_Extract "uClibc-locale-030818" nochdir
13.27 + CT_Patch "uClibc-locale-030818" nochdir
13.28 CT_Popd
13.29 fi
13.30
14.1 --- a/scripts/build/mpfr.sh Mon Jan 05 21:09:37 2009 +0000
14.2 +++ b/scripts/build/mpfr.sh Mon Jan 05 23:02:43 2009 +0000
14.3 @@ -18,7 +18,8 @@
14.4
14.5 # Extract MPFR
14.6 do_mpfr_extract() {
14.7 - CT_ExtractAndPatch "mpfr-${CT_MPFR_VERSION}"
14.8 + CT_Extract "mpfr-${CT_MPFR_VERSION}"
14.9 + CT_Patch "mpfr-${CT_MPFR_VERSION}"
14.10
14.11 # OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
14.12 # same version number. Unfortunately, some tarballs of MPFR are not
15.1 --- a/scripts/build/tools/000-template.sh Mon Jan 05 21:09:37 2009 +0000
15.2 +++ b/scripts/build/tools/000-template.sh Mon Jan 05 23:02:43 2009 +0000
15.3 @@ -10,7 +10,8 @@
15.4 # Put your extract code here
15.5 do_tools_foobar_extract() {
15.6 # For example:
15.7 - # CT_ExtractAndPatch "foobar-${CT_FOOBAR_VERSION}"
15.8 + # CT_Extract "foobar-${CT_FOOBAR_VERSION}"
15.9 + # CT_Patch "foobar-${CT_FOOBAR_VERSION}"
15.10 :
15.11 }
15.12
16.1 --- a/scripts/build/tools/100-libelf.sh Mon Jan 05 21:09:37 2009 +0000
16.2 +++ b/scripts/build/tools/100-libelf.sh Mon Jan 05 23:02:43 2009 +0000
16.3 @@ -8,7 +8,8 @@
16.4 }
16.5
16.6 do_tools_libelf_extract() {
16.7 - CT_ExtractAndPatch "libelf-${CT_LIBELF_VERSION}"
16.8 + CT_Extract "libelf-${CT_LIBELF_VERSION}"
16.9 + CT_Patch "libelf-${CT_LIBELF_VERSION}"
16.10 }
16.11
16.12 do_tools_libelf_build() {
17.1 --- a/scripts/build/tools/200-sstrip.sh Mon Jan 05 21:09:37 2009 +0000
17.2 +++ b/scripts/build/tools/200-sstrip.sh Mon Jan 05 23:02:43 2009 +0000
17.3 @@ -7,7 +7,8 @@
17.4 http://www.muppetlabs.com/~breadbox/pub/software
17.5 }
17.6 do_tools_sstrip_extract() {
17.7 - CT_ExtractAndPatch "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
17.8 + CT_Extract "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
17.9 + CT_Patch "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
17.10 }
17.11 do_tools_sstrip_build() {
17.12 CT_DoStep INFO "Installing sstrip"
18.1 --- a/scripts/functions Mon Jan 05 21:09:37 2009 +0000
18.2 +++ b/scripts/functions Mon Jan 05 23:02:43 2009 +0000
18.3 @@ -554,58 +554,60 @@
18.4 CT_DoExecLog ALL rm -rf "${tmp_dir}"
18.5 }
18.6
18.7 -# Extract a tarball and patch the resulting sources if necessary.
18.8 +# Extract a tarball
18.9 # Some tarballs need to be extracted in specific places. Eg.: glibc addons
18.10 # must be extracted in the glibc directory; uCLibc locales must be extracted
18.11 # in the extra/locale sub-directory of uClibc. This is taken into account
18.12 # by the caller, that did a 'cd' into the correct path before calling us
18.13 # and sets nochdir to 'nochdir'.
18.14 -# Usage: CT_ExtractAndPatch <basename> [nochdir]
18.15 -CT_ExtractAndPatch() {
18.16 - local file="$1"
18.17 +# Usage: CT_Extract <basename> [nochdir]
18.18 +CT_Extract() {
18.19 + local basename="$1"
18.20 local nochdir="$2"
18.21 - local base_file=$(echo "${file}" |cut -d - -f 1)
18.22 - local ver_file=$(echo "${file}" |cut -d - -f 2-)
18.23 - local official_patch_dir
18.24 - local custom_patch_dir
18.25 - local ext=$(CT_GetFileExtension "${file}")
18.26 - CT_TestAndAbort "'${file}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}"
18.27 - local full_file="${CT_TARBALLS_DIR}/${file}${ext}"
18.28 + local ext=$(CT_GetFileExtension "${basename}")
18.29 + CT_TestAndAbort "'${basename}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}"
18.30 + local full_file="${CT_TARBALLS_DIR}/${basename}${ext}"
18.31 +
18.32 + # Check if already extracted
18.33 + if [ -e "${CT_SRC_DIR}/.${basename}.extracted" ]; then
18.34 + CT_DoLog DEBUG "Already extracted '${basename}'"
18.35 + return 0
18.36 + fi
18.37
18.38 [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}"
18.39
18.40 - # Check if already extracted
18.41 - if [ -e "${CT_SRC_DIR}/.${file}.extracted" ]; then
18.42 - CT_DoLog DEBUG "Already extracted '${file}'"
18.43 - return 0
18.44 - fi
18.45 -
18.46 - CT_DoLog EXTRA "Extracting and patching '${file}'"
18.47 + CT_DoLog EXTRA "Extracting '${basename}'"
18.48 case "${ext}" in
18.49 .tar.bz2) CT_DoExecLog ALL tar xvjf "${full_file}";;
18.50 .tar.gz|.tgz) CT_DoExecLog ALL tar xvzf "${full_file}";;
18.51 .tar) CT_DoExecLog ALL tar xvf "${full_file}";;
18.52 - *) CT_Abort "Don't know how to handle '${file}': unknown extension" ;;
18.53 + *) CT_Abort "Don't know how to handle '${basename}${ext}': unknown extension" ;;
18.54 esac
18.55 - touch "${CT_SRC_DIR}/.${file}.extracted"
18.56
18.57 - # Snapshots might not have the version number in the extracted directory
18.58 - # name. This is also the case for some (odd) packages, such as D.U.M.A.
18.59 - # Overcome this issue by symlink'ing the directory.
18.60 - if [ ! -d "${file}" ]; then
18.61 - case "${ext}" in
18.62 - .tar.bz2) base=$(tar tjf "${full_file}" |head -n 1 |cut -d / -f 1 || true);;
18.63 - .tar.gz|.tgz) base=$(tar tzf "${full_file}" |head -n 1 |cut -d / -f 1 || true);;
18.64 - .tar) base=$(tar tf "${full_file}" |head -n 1 |cut -d / -f 1 || true);;
18.65 - esac
18.66 - CT_TestOrAbort "There was a problem when extracting '${file}'" -d "${base}" -o "${base}" != "${file}"
18.67 - ln -s "${base}" "${file}"
18.68 + touch "${CT_SRC_DIR}/.${basename}.extracted"
18.69 +
18.70 + [ "${nochdir}" = "nochdir" ] || CT_Popd
18.71 +}
18.72 +
18.73 +# Patches the specified component
18.74 +# Usage: CT_Patch <basename> [nochdir]
18.75 +CT_Patch() {
18.76 + local basename="$1"
18.77 + local nochdir="$2"
18.78 + local base_file="${basename%%-*}"
18.79 + local ver_file="${basename#*-}"
18.80 + local official_patch_dir
18.81 + local custom_patch_dir
18.82 +
18.83 + # Check if already patched
18.84 + if [ -e "${CT_SRC_DIR}/.${basename}.patched" ]; then
18.85 + CT_DoLog DEBUG "Already patched '${basename}'"
18.86 + return 0
18.87 fi
18.88
18.89 - # Kludge: outside this function, we wouldn't know if we had just extracted
18.90 - # a libc addon, or a plain package. Apply patches now.
18.91 + [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}/${basename}"
18.92
18.93 - [ "${nochdir}" = "nochdir" ] || cd "${file}"
18.94 + CT_DoLog EXTRA "Patching '${basename}'"
18.95
18.96 official_patch_dir=
18.97 custom_patch_dir=
18.98 @@ -633,6 +635,8 @@
18.99 done
18.100 fi
18.101
18.102 + touch "${CT_SRC_DIR}/.${basename}.patched"
18.103 +
18.104 [ "${nochdir}" = "nochdir" ] || CT_Popd
18.105 }
18.106