mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-18 20:37:56 +00:00
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.
This commit is contained in:
parent
d2ea451ee1
commit
bf86627982
@ -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
|
||||
|
@ -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
|
||||
|
@ -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" \
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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}"
|
||||
:
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user