mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
Merge pull request #4054 from MilhouseVH/le10_fix_flag_enabled_var
flag_enabled(): declare is local by default - remove it
This commit is contained in:
commit
ebaff1375f
@ -148,29 +148,20 @@ safe_remove() {
|
|||||||
### BUILDSYSTEM HELPERS ###
|
### BUILDSYSTEM HELPERS ###
|
||||||
# check if a flag is enabled
|
# check if a flag is enabled
|
||||||
# $1: flag-name, $2: default (yes/no), $3: ingenious check (none,only-disable,only-enable)
|
# $1: flag-name, $2: default (yes/no), $3: ingenious check (none,only-disable,only-enable)
|
||||||
# set variable PKG_[FLAG]_[HOST/TARGET]_ENABLED=(yes/no)
|
|
||||||
# return 0 if flag is enabled, otherwise 1
|
# return 0 if flag is enabled, otherwise 1
|
||||||
flag_enabled() {
|
flag_enabled() {
|
||||||
# make flag name upper case and replace hyphen with underscore, to use as variable name
|
|
||||||
local flag_name=${1^^}
|
|
||||||
[[ $flag_name =~ : ]] || flag_name+="_TARGET"
|
|
||||||
flag_name="PKG_${flag_name//[:-]/_}_ENABLED"
|
|
||||||
|
|
||||||
# check flag
|
# check flag
|
||||||
if [ -n "${PKG_BUILD_FLAGS}" ] && listcontains "${PKG_BUILD_FLAGS}" "[+]?$1"; then
|
if [ -n "${PKG_BUILD_FLAGS}" ] && listcontains "${PKG_BUILD_FLAGS}" "[+]?$1"; then
|
||||||
if [ "${3:none}" = "only-disable" ]; then
|
if [ "${3:none}" = "only-disable" ]; then
|
||||||
die "ERROR: $1 cannot enable via PKG_BUILD_FLAGS (found in $PKG_NAME)"
|
die "ERROR: $1 cannot enable via PKG_BUILD_FLAGS (found in $PKG_NAME)"
|
||||||
fi
|
fi
|
||||||
declare ${flag_name}="yes"
|
|
||||||
return 0
|
return 0
|
||||||
elif [ "$2" = "yes" ] && ! listcontains "${PKG_BUILD_FLAGS}" "-$1"; then
|
elif [ "$2" = "yes" ] && ! listcontains "${PKG_BUILD_FLAGS}" "-$1"; then
|
||||||
declare ${flag_name}="yes"
|
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
if [ "${3:none}" = "only-enable" ]; then
|
if [ "${3:none}" = "only-enable" ]; then
|
||||||
die "ERROR: $1 cannot disable via PKG_BUILD_FLAGS (found in $PKG_NAME)"
|
die "ERROR: $1 cannot disable via PKG_BUILD_FLAGS (found in $PKG_NAME)"
|
||||||
fi
|
fi
|
||||||
declare ${flag_name}="no"
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user