summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/global/paths.in58
-rw-r--r--scripts/functions26
2 files changed, 55 insertions, 29 deletions
diff --git a/config/global/paths.in b/config/global/paths.in
index 8945dee..2a35af2 100644
--- a/config/global/paths.in
+++ b/config/global/paths.in
@@ -60,36 +60,54 @@ config INSTALL_DIR
# The reason you might also want to install elsewhere is if you are going
# to package your shinny new toolchain for distribution.
-config CUSTOM_PATCH
+choice
+ prompt "Patches origin"
bool
- prompt "Use custom patch directory"
- default n
+ default PATCH_BUNDLED
+
+config PATCH_BUNDLED
+ bool
+ prompt "Bundled only"
help
- If you have custom patches that you want to be applied, say 'Y' here and
- enter the path directory below.
-
- Note that you must ensure that the patch directory is arranged the same
- way the official directory is.
+ Only apply patches bundled with crosstool-NG.
-config CUSTOM_PATCH_ONLY
+config PATCH_LOCAL
bool
- prompt "Only use custom patches"
- default n
- depends on CUSTOM_PATCH
+ prompt "Local only"
+ select PATCH_USE_LOCAL
help
- Don't apply patches coming with crosstool-NG, only those patches available
- in the directory below.
-
- If you say 'N' here, then the patches provided with crosstool-NG will be
- applied first, and then your patches.
+ Only apply your local patches.
+
+config PATCH_BUNDLED_LOCAL
+ bool
+ prompt "Bundled, then local"
+ select PATCH_USE_LOCAL
+ help
+ Apply the patches bundled with crosstool-NG,
+ then apply your local patches.
+
+endchoice
+
+config PATCH_ORDER
+ string
+ default "bundled" if PATCH_BUNDLED
+ default "local" if PATCH_LOCAL
+ default "bundled,local" if PATCH_BUNDLED_LOCAL
-config CUSTOM_PATCH_DIR
+config PATCH_USE_LOCAL
+ bool
+ default n
+
+config LOCAL_PATCH_DIR
string
- prompt "Custom patch directory"
+ prompt "| Local patch directory"
default ""
- depends on CUSTOM_PATCH
+ depends on PATCH_USE_LOCAL
help
Enter the custom patch directory here.
+
+ Note that you must ensure that the directory contianing your custom
+ patches is arranged the same way the official directory is.
config REMOVE_DOCS
bool
diff --git a/scripts/functions b/scripts/functions
index 8da2d70..4cfa78d 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -585,8 +585,10 @@ CT_Patch() {
local nochdir="$2"
local base_file="${basename%%-*}"
local ver_file="${basename#*-}"
- local official_patch_dir
- local custom_patch_dir
+ local d
+ local -a patch_dirs
+ local bundled_patch_dir
+ local local_patch_dir
# Check if already patched
if [ -e "${CT_SRC_DIR}/.${basename}.patched" ]; then
@@ -609,13 +611,19 @@ CT_Patch() {
CT_DoLog EXTRA "Patching '${basename}'"
- official_patch_dir=
- custom_patch_dir=
- [ "${CT_CUSTOM_PATCH_ONLY}" = "y" ] || official_patch_dir="${CT_LIB_DIR}/patches/${base_file}/${ver_file}"
- [ "${CT_CUSTOM_PATCH}" = "y" ] && custom_patch_dir="${CT_CUSTOM_PATCH_DIR}/${base_file}/${ver_file}"
- for patch_dir in "${official_patch_dir}" "${custom_patch_dir}"; do
- if [ -n "${patch_dir}" -a -d "${patch_dir}" ]; then
- for p in "${patch_dir}"/*.patch; do
+ bundled_patch_dir="${CT_LIB_DIR}/patches/${base_file}/${ver_file}"
+ local_patch_dir="${CT_CUSTOM_PATCH_DIR}/${base_file}/${ver_file}"
+
+ case "${CT_PATCH_ORDER}" in
+ bundled) patch_dirs=("${bundled_patch_dir}");;
+ local) patch_dirs=("${local_patch_dir}");;
+ bundled,local) patch_dirs=("${bundled_patch_dir}" "${local_patch_dir}");;
+ esac
+
+ for d in "${patch_dirs[@]}"; do
+ CT_DoLog DEBUG "Looking for patches in '${d}'..."
+ if [ -n "${d}" -a -d "${d}" ]; then
+ for p in "${d}"/*.patch; do
if [ -f "${p}" ]; then
CT_DoLog DEBUG "Applying patch '${p}'"
CT_DoExecLog ALL patch -g0 -F1 -p1 -f <"${p}"