config: make selecting the patch origin a choice rather than a bool

This commit is contained in:
Yann E. MORIN" 2009-08-31 12:05:52 +02:00
parent c992de9eb5
commit dc836b5e4d
2 changed files with 56 additions and 30 deletions
config/global
scripts

@ -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
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.
default PATCH_BUNDLED
config CUSTOM_PATCH_ONLY
config PATCH_BUNDLED
bool
prompt "Only use custom patches"
default n
depends on CUSTOM_PATCH
prompt "Bundled only"
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 patches bundled with crosstool-NG.
config CUSTOM_PATCH_DIR
config PATCH_LOCAL
bool
prompt "Local only"
select PATCH_USE_LOCAL
help
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
prompt "Custom patch directory"
default "bundled" if PATCH_BUNDLED
default "local" if PATCH_LOCAL
default "bundled,local" if PATCH_BUNDLED_LOCAL
config PATCH_USE_LOCAL
bool
default n
config LOCAL_PATCH_DIR
string
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

@ -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}"