summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2010-04-11 21:18:10 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2010-04-11 21:18:10 (GMT)
commitbf866279823c189becd7e0c615c7121102fda5fe (patch)
tree4a1d903b91774c1d612da8c758e6d5e94e115abc
parentd2ea451ee17c612fc62defa3a2bda40a2666cf60 (diff)
scripts/functions: make CT_Patch dumber
It is the responsibility of the caller to split the package name from its version. It already knows that.
-rw-r--r--scripts/build/binutils/binutils.sh2
-rw-r--r--scripts/build/binutils/elf2flt.sh2
-rw-r--r--scripts/build/cc/gcc.sh2
-rw-r--r--scripts/build/companion_libs/cloog.sh2
-rw-r--r--scripts/build/companion_libs/gmp.sh2
-rw-r--r--scripts/build/companion_libs/libelf.sh2
-rw-r--r--scripts/build/companion_libs/mpc.sh2
-rw-r--r--scripts/build/companion_libs/mpfr.sh2
-rw-r--r--scripts/build/companion_libs/ppl.sh2
-rw-r--r--scripts/build/companion_tools/100-m4.sh2
-rw-r--r--scripts/build/companion_tools/200-autoconf.sh2
-rw-r--r--scripts/build/companion_tools/300-automake.sh2
-rw-r--r--scripts/build/companion_tools/400-libtool.sh2
-rw-r--r--scripts/build/debug/000-template.sh2
-rw-r--r--scripts/build/debug/100-dmalloc.sh2
-rw-r--r--scripts/build/debug/200-duma.sh6
-rw-r--r--scripts/build/debug/300-gdb.sh6
-rw-r--r--scripts/build/debug/400-ltrace.sh2
-rw-r--r--scripts/build/debug/500-strace.sh2
-rw-r--r--scripts/build/kernel/linux.sh2
-rw-r--r--scripts/build/libc/eglibc.sh4
-rw-r--r--scripts/build/libc/glibc.sh4
-rw-r--r--scripts/build/libc/newlib.sh2
-rw-r--r--scripts/build/libc/uClibc.sh4
-rw-r--r--scripts/functions45
25 files changed, 54 insertions, 53 deletions
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index 2f4bbbd..0ef5861 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -12,7 +12,7 @@ do_binutils_get() {
# Extract binutils
do_binutils_extract() {
CT_Extract "binutils-${CT_BINUTILS_VERSION}"
- CT_Patch "binutils-${CT_BINUTILS_VERSION}"
+ CT_Patch "binutils" "${CT_BINUTILS_VERSION}"
}
# Build binutils
diff --git a/scripts/build/binutils/elf2flt.sh b/scripts/build/binutils/elf2flt.sh
index aa7f0e0..76d8b45 100644
--- a/scripts/build/binutils/elf2flt.sh
+++ b/scripts/build/binutils/elf2flt.sh
@@ -22,7 +22,7 @@ do_elf2flt_get() {
# Extract elf2flt
do_elf2flt_extract() {
CT_Extract "elf2flt-cvs-${CT_ELF2FLT_VERSION}"
- CT_Patch "elf2flt-cvs-${CT_ELF2FLT_VERSION}"
+ CT_Patch "elf2flt-cvs" "${CT_ELF2FLT_VERSION}"
}
# Build elf2flt
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index 96324f4..ed80463 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -28,7 +28,7 @@ do_cc_get() {
# Extract gcc
do_cc_extract() {
CT_Extract "gcc-${CT_CC_VERSION}"
- CT_Patch "gcc-${CT_CC_VERSION}"
+ CT_Patch "gcc" "${CT_CC_VERSION}"
# Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree
if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" \
diff --git a/scripts/build/companion_libs/cloog.sh b/scripts/build/companion_libs/cloog.sh
index e858931..73844ef 100644
--- a/scripts/build/companion_libs/cloog.sh
+++ b/scripts/build/companion_libs/cloog.sh
@@ -29,7 +29,7 @@ do_cloog_extract() {
*) _t="-${CT_CLOOG_VERSION}";;
esac
CT_Pushd "${CT_SRC_DIR}/cloog-ppl${_t}"
- CT_Patch nochdir "cloog-ppl-${CT_CLOOG_VERSION}"
+ CT_Patch nochdir "cloog-ppl" "${CT_CLOOG_VERSION}"
CT_Popd
}
diff --git a/scripts/build/companion_libs/gmp.sh b/scripts/build/companion_libs/gmp.sh
index 5bcc39a..11da8f7 100644
--- a/scripts/build/companion_libs/gmp.sh
+++ b/scripts/build/companion_libs/gmp.sh
@@ -18,7 +18,7 @@ do_gmp_get() {
# Extract GMP
do_gmp_extract() {
CT_Extract "gmp-${CT_GMP_VERSION}"
- CT_Patch "gmp-${CT_GMP_VERSION}"
+ CT_Patch "gmp" "${CT_GMP_VERSION}"
}
if [ "${CT_GMP}" = "y" ]; then
diff --git a/scripts/build/companion_libs/libelf.sh b/scripts/build/companion_libs/libelf.sh
index 67e85b4..59dea27 100644
--- a/scripts/build/companion_libs/libelf.sh
+++ b/scripts/build/companion_libs/libelf.sh
@@ -16,7 +16,7 @@ do_libelf_get() {
do_libelf_extract() {
CT_Extract "libelf-${CT_LIBELF_VERSION}"
- CT_Patch "libelf-${CT_LIBELF_VERSION}"
+ CT_Patch "libelf" "${CT_LIBELF_VERSION}"
}
if [ "${CT_LIBELF}" = "y" ]; then
diff --git a/scripts/build/companion_libs/mpc.sh b/scripts/build/companion_libs/mpc.sh
index 9631b52..652931f 100644
--- a/scripts/build/companion_libs/mpc.sh
+++ b/scripts/build/companion_libs/mpc.sh
@@ -19,7 +19,7 @@ do_mpc_get() {
# Extract MPC
do_mpc_extract() {
CT_Extract "mpc-${CT_MPC_VERSION}"
- CT_Patch "mpc-${CT_MPC_VERSION}"
+ CT_Patch "mpc" "${CT_MPC_VERSION}"
}
do_mpc() {
diff --git a/scripts/build/companion_libs/mpfr.sh b/scripts/build/companion_libs/mpfr.sh
index 1c14c67..ecb63c2 100644
--- a/scripts/build/companion_libs/mpfr.sh
+++ b/scripts/build/companion_libs/mpfr.sh
@@ -19,7 +19,7 @@ do_mpfr_get() {
# Extract MPFR
do_mpfr_extract() {
CT_Extract "mpfr-${CT_MPFR_VERSION}"
- CT_Patch "mpfr-${CT_MPFR_VERSION}"
+ CT_Patch "mpfr" "${CT_MPFR_VERSION}"
# OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
# same version number. Unfortunately, some tarballs of MPFR are not
diff --git a/scripts/build/companion_libs/ppl.sh b/scripts/build/companion_libs/ppl.sh
index a2c9a0e..7746af1 100644
--- a/scripts/build/companion_libs/ppl.sh
+++ b/scripts/build/companion_libs/ppl.sh
@@ -21,7 +21,7 @@ do_ppl_get() {
# Extract PPL
do_ppl_extract() {
CT_Extract "ppl-${CT_PPL_VERSION}"
- CT_Patch "ppl-${CT_PPL_VERSION}"
+ CT_Patch "ppl" "${CT_PPL_VERSION}"
}
do_ppl() {
diff --git a/scripts/build/companion_tools/100-m4.sh b/scripts/build/companion_tools/100-m4.sh
index bc40dbf..6a16a1e 100644
--- a/scripts/build/companion_tools/100-m4.sh
+++ b/scripts/build/companion_tools/100-m4.sh
@@ -9,7 +9,7 @@ do_companion_tools_m4_get() {
do_companion_tools_m4_extract() {
CT_Extract "m4-${CT_M4_VERSION}"
- CT_Patch "m4-${CT_M4_VERSION}"
+ CT_Patch "m4" "${CT_M4_VERSION}"
}
do_companion_tools_m4_build() {
diff --git a/scripts/build/companion_tools/200-autoconf.sh b/scripts/build/companion_tools/200-autoconf.sh
index 6b404c4..9ed66b5 100644
--- a/scripts/build/companion_tools/200-autoconf.sh
+++ b/scripts/build/companion_tools/200-autoconf.sh
@@ -9,7 +9,7 @@ do_companion_tools_autoconf_get() {
do_companion_tools_autoconf_extract() {
CT_Extract "autoconf-${CT_AUTOCONF_VERSION}"
- CT_Patch "autoconf-${CT_AUTOCONF_VERSION}"
+ CT_Patch "autoconf" "${CT_AUTOCONF_VERSION}"
}
do_companion_tools_autoconf_build() {
diff --git a/scripts/build/companion_tools/300-automake.sh b/scripts/build/companion_tools/300-automake.sh
index f58d938..174b2a7 100644
--- a/scripts/build/companion_tools/300-automake.sh
+++ b/scripts/build/companion_tools/300-automake.sh
@@ -9,7 +9,7 @@ do_companion_tools_automake_get() {
do_companion_tools_automake_extract() {
CT_Extract "automake-${CT_AUTOMAKE_VERSION}"
- CT_Patch "automake-${CT_AUTOMAKE_VERSION}"
+ CT_Patch "automake" "${CT_AUTOMAKE_VERSION}"
}
do_companion_tools_automake_build() {
diff --git a/scripts/build/companion_tools/400-libtool.sh b/scripts/build/companion_tools/400-libtool.sh
index 56a6bc8..eb9f82e 100644
--- a/scripts/build/companion_tools/400-libtool.sh
+++ b/scripts/build/companion_tools/400-libtool.sh
@@ -9,7 +9,7 @@ do_companion_tools_libtool_get() {
do_companion_tools_libtool_extract() {
CT_Extract "libtool-${CT_LIBTOOL_VERSION}"
- CT_Patch "libtool-${CT_LIBTOOL_VERSION}"
+ CT_Patch "libtool" "${CT_LIBTOOL_VERSION}"
}
do_companion_tools_libtool_build() {
diff --git a/scripts/build/debug/000-template.sh b/scripts/build/debug/000-template.sh
index 793d786..c76c972 100644
--- a/scripts/build/debug/000-template.sh
+++ b/scripts/build/debug/000-template.sh
@@ -11,7 +11,7 @@ do_debug_foobar_get() {
do_debug_foobar_extract() {
# For example:
# CT_Extract "foobar-${CT_FOOBAR_VERSION}"
- # CT_Patch "foobar-${CT_FOOBAR_VERSION}"
+ # CT_Patch "foobar" "${CT_FOOBAR_VERSION}"
:
}
diff --git a/scripts/build/debug/100-dmalloc.sh b/scripts/build/debug/100-dmalloc.sh
index e8965e9..c567c40 100644
--- a/scripts/build/debug/100-dmalloc.sh
+++ b/scripts/build/debug/100-dmalloc.sh
@@ -6,7 +6,7 @@ do_debug_dmalloc_get() {
do_debug_dmalloc_extract() {
CT_Extract "dmalloc-${CT_DMALLOC_VERSION}"
- CT_Patch "dmalloc-${CT_DMALLOC_VERSION}"
+ CT_Patch "dmalloc" "${CT_DMALLOC_VERSION}"
}
do_debug_dmalloc_build() {
diff --git a/scripts/build/debug/200-duma.sh b/scripts/build/debug/200-duma.sh
index de0c5c1..fe47b5e 100644
--- a/scripts/build/debug/200-duma.sh
+++ b/scripts/build/debug/200-duma.sh
@@ -12,11 +12,7 @@ do_debug_duma_get() {
do_debug_duma_extract() {
CT_Extract "duma_${CT_DUMA_VERSION}"
CT_Pushd "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}"
- # Even if DUMA uses _ and not -, crosstool-NG uses the dash to split the
- # name from the version in order to find the appropriate patches
- # YEM: FIXME: make CT_Patch more intelligent, Eg.: CT_Patch duma _ "${CT_DUMA_VERSION}"
- CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.duma-${CT_DUMA_VERSION}.extracted"
- CT_Patch nochdir "duma-${CT_DUMA_VERSION}"
+ CT_Patch nochdir "duma" "${CT_DUMA_VERSION}"
CT_Popd
}
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index da6002f..49810c6 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -57,17 +57,17 @@ do_debug_gdb_extract() {
if [ "${do_gdb}" = "y" ]; then
CT_Extract "gdb-${CT_GDB_VERSION}"
- CT_Patch "gdb-${CT_GDB_VERSION}"
+ CT_Patch "gdb" "${CT_GDB_VERSION}"
fi
if [ "${do_insight}" = "y" ]; then
CT_Extract "insight-${CT_GDB_VERSION}"
- CT_Patch "insight-${CT_GDB_VERSION}"
+ CT_Patch "insight" "${CT_GDB_VERSION}"
fi
if [ "${do_ncurses}" = "y" ]; then
CT_Extract "ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}"
- CT_Patch "ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}"
+ CT_Patch "ncurses" "${CT_DEBUG_GDB_NCURSES_VERSION}"
fi
}
diff --git a/scripts/build/debug/400-ltrace.sh b/scripts/build/debug/400-ltrace.sh
index f09277d..dd0fe4a 100644
--- a/scripts/build/debug/400-ltrace.sh
+++ b/scripts/build/debug/400-ltrace.sh
@@ -13,7 +13,7 @@ do_debug_ltrace_get() {
do_debug_ltrace_extract() {
CT_Extract "ltrace-${CT_LTRACE_VERSION}"
- CT_Patch "ltrace-${CT_LTRACE_VERSION}"
+ CT_Patch "ltrace" "${CT_LTRACE_VERSION}"
}
do_debug_ltrace_build() {
diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh
index 174c8dc..3713da5 100644
--- a/scripts/build/debug/500-strace.sh
+++ b/scripts/build/debug/500-strace.sh
@@ -8,7 +8,7 @@ do_debug_strace_get() {
do_debug_strace_extract() {
CT_Extract "strace-${CT_STRACE_VERSION}"
- CT_Patch "strace-${CT_STRACE_VERSION}"
+ CT_Patch "strace" "${CT_STRACE_VERSION}"
}
do_debug_strace_build() {
diff --git a/scripts/build/kernel/linux.sh b/scripts/build/kernel/linux.sh
index 777c104..8a568ed 100644
--- a/scripts/build/kernel/linux.sh
+++ b/scripts/build/kernel/linux.sh
@@ -23,7 +23,7 @@ do_kernel_get() {
do_kernel_extract() {
if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" != "y" ]; then
CT_Extract "linux-${CT_KERNEL_VERSION}"
- CT_Patch "linux-${CT_KERNEL_VERSION}"
+ CT_Patch "linux" "${CT_KERNEL_VERSION}"
fi
return 0
}
diff --git a/scripts/build/libc/eglibc.sh b/scripts/build/libc/eglibc.sh
index 1875a23..c8f34c0 100644
--- a/scripts/build/libc/eglibc.sh
+++ b/scripts/build/libc/eglibc.sh
@@ -94,7 +94,7 @@ do_libc_get() {
# Extract eglibc
do_libc_extract() {
CT_Extract "eglibc-${CT_LIBC_VERSION}"
- CT_Patch "eglibc-${CT_LIBC_VERSION}"
+ CT_Patch "eglibc" "${CT_LIBC_VERSION}"
# C library addons
for addon in $(do_libc_add_ons_list " "); do
@@ -110,7 +110,7 @@ do_libc_extract() {
# directory, returns true!
[ -d "${addon}" ] || ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
[ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
- CT_Patch nochdir "eglibc-${addon}-${CT_LIBC_VERSION}"
+ CT_Patch nochdir "eglibc" "${addon}-${CT_LIBC_VERSION}"
CT_Popd
done
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 233cd3b..a45aef9 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -38,7 +38,7 @@ do_libc_extract() {
CT_Extract "glibc-${CT_LIBC_VERSION}"
CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
- CT_Patch nochdir "glibc-${CT_LIBC_VERSION}"
+ CT_Patch nochdir "glibc" "${CT_LIBC_VERSION}"
# C library addons
for addon in "${addons_list[@]}"; do
@@ -54,7 +54,7 @@ do_libc_extract() {
# directory, returns true!
[ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
[ -d "glibc-${addon}-${CT_LIBC_VERSION}" ] || CT_DoExecLog ALL ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
- CT_Patch nochdir "glibc-${addon}-${CT_LIBC_VERSION}"
+ CT_Patch nochdir "glibc" "${addon}-${CT_LIBC_VERSION}"
done
# The configure files may be older than the configure.in files
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index 04c05c1..23c6d84 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -34,7 +34,7 @@ do_libc_get() {
do_libc_extract() {
CT_Extract "newlib-$(libc_newlib_version)"
- CT_Patch "newlib-$(libc_newlib_version)"
+ CT_Patch "newlib" "$(libc_newlib_version)"
if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
CT_Extract "avr32headers"
diff --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh
index 009fd14..f4aa43d 100644
--- a/scripts/build/libc/uClibc.sh
+++ b/scripts/build/libc/uClibc.sh
@@ -22,13 +22,13 @@ do_libc_get() {
# Extract uClibc
do_libc_extract() {
CT_Extract "uClibc-${CT_LIBC_VERSION}"
- CT_Patch "uClibc-${CT_LIBC_VERSION}"
+ CT_Patch "uClibc" "${CT_LIBC_VERSION}"
# uClibc locales
if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then
CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}/extra/locale"
CT_Extract nochdir "uClibc-locale-030818"
- CT_Patch nochdir "uClibc-locale-030818"
+ CT_Patch nochdir "uClibc" "locale-030818"
CT_Popd
fi
diff --git a/scripts/functions b/scripts/functions
index 4212b74..9367326 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -708,10 +708,15 @@ CT_ExtractGit() {
# Patches the specified component
# See CT_Extract, above, for explanations on 'nochdir'
-# Usage: CT_Patch [nochdir] <basename>
+# Usage: CT_Patch [nochdir] <packagename> <packageversion>
+# If the package directory is *not* packagename-packageversion, then
+# the caller must cd into the proper directory first, and call us
+# with nochdir
CT_Patch() {
local nochdir="$1"
- local basename
+ local pkgname
+ local version
+ local pkgdir
local base_file
local ver_file
local d
@@ -719,40 +724,40 @@ CT_Patch() {
local bundled_patch_dir
local local_patch_dir
+ pkgname="$1"
+ version="$2"
+ pkgdir="${pkgname}-${version}"
+
if [ "${nochdir}" = "nochdir" ]; then
shift
nochdir="$(pwd)"
else
- nochdir="${CT_SRC_DIR}/${1}"
+ nochdir="${CT_SRC_DIR}/${pkgdir}"
fi
- basename="$1"
- base_file="${basename%%-*}"
- ver_file="${basename#*-}"
-
# Check if already patched
- if [ -e "${CT_SRC_DIR}/.${basename}.patched" ]; then
- CT_DoLog DEBUG "Already patched '${basename}'"
+ if [ -e "${CT_SRC_DIR}/.${pkgdir}.patched" ]; then
+ CT_DoLog DEBUG "Already patched '${pkgdir}'"
return 0
fi
# Check if already partially patched
- if [ -e "${CT_SRC_DIR}/.${basename}.patching" ]; then
- CT_DoLog ERROR "The '${basename}' sources were partially patched."
+ if [ -e "${CT_SRC_DIR}/.${pkgdir}.patching" ]; then
+ CT_DoLog ERROR "The '${pkgdir}' sources were partially patched."
CT_DoLog ERROR "Please remove first:"
- CT_DoLog ERROR " - the source dir for '${basename}', in '${CT_SRC_DIR}'"
- CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.extracted'"
- CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.patching'"
+ CT_DoLog ERROR " - the source dir for '${pkgdir}', in '${CT_SRC_DIR}'"
+ CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${pkgdir}.extracted'"
+ CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${pkgdir}.patching'"
CT_Abort "I'll stop now to avoid any carnage..."
fi
- touch "${CT_SRC_DIR}/.${basename}.patching"
+ touch "${CT_SRC_DIR}/.${pkgdir}.patching"
CT_Pushd "${nochdir}"
- CT_DoLog EXTRA "Patching '${basename}'"
+ CT_DoLog EXTRA "Patching '${pkgdir}'"
- bundled_patch_dir="${CT_LIB_DIR}/patches/${base_file}/${ver_file}"
- local_patch_dir="${CT_LOCAL_PATCH_DIR}/${base_file}/${ver_file}"
+ bundled_patch_dir="${CT_LIB_DIR}/patches/${pkgname}/${version}"
+ local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkgname}/${version}"
case "${CT_PATCH_ORDER}" in
bundled) patch_dirs=("${bundled_patch_dir}");;
@@ -787,8 +792,8 @@ CT_Patch() {
done
fi
- CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.patched"
- CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.patching"
+ CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${pkdir}.patched"
+ CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${pkdir}.patching"
CT_Popd
}