mirror of
https://github.com/libretro/Lakka-LibreELEC.git
synced 2024-11-23 08:20:00 +00:00
buildsystem: restore set -e fail-on-error behaviour
This commit is contained in:
parent
34ac6023dc
commit
0661263dd8
@ -805,22 +805,18 @@ find_dir_path() {
|
||||
find_path -d "$1" "$2"
|
||||
}
|
||||
|
||||
# p1: name of potential function to execute if it exists
|
||||
# return 0 if function executed, 1 if not, die if error
|
||||
# p1: name of function to test for
|
||||
# return 0 if function exists, 1 if not
|
||||
pkg_call_exists() {
|
||||
[ "$(type -t ${1})" = "function" ] && return 0 || return 1
|
||||
}
|
||||
|
||||
# p1: name of function to execute unconditionally
|
||||
# testing the exit code value of this function is likely to break set -e fail-on-error behaviour
|
||||
pkg_call() {
|
||||
[ -n "${PKG_NAME}" ] || die "$(print_color CLR_ERROR "FAILURE: Cannot call ${1} package function when package is not known!")"
|
||||
|
||||
if [ "$(type -t ${1})" = "function" ]; then
|
||||
${1} || die "$(print_color CLR_ERROR "FAILURE: ${1} for package ${PKG_NAME} did not succeed!")"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# p1: name of potential function to execute if it exists
|
||||
# return 0 if function executed or not, or die if error
|
||||
pkg_call_optional() {
|
||||
pkg_call ${1} || return 0
|
||||
${1}
|
||||
}
|
||||
|
||||
unset_functions() {
|
||||
@ -922,7 +918,11 @@ source_package() {
|
||||
# Late variable binding - allow the package to now evaluate any variables
|
||||
# that we may have initialised after sourcing the package, typically
|
||||
# PKG_BUILD etc.
|
||||
[ -n "${PKG_NAME}" ] && pkg_call_optional configure_package || true
|
||||
if [ -n "${PKG_NAME}" ]; then
|
||||
if pkg_call_exists configure_package; then
|
||||
pkg_call configure_package
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,7 +48,7 @@ pre_configure_target() {
|
||||
}
|
||||
|
||||
pre_configure_init() {
|
||||
pkg_call pre_configure_target || die "pre_configure_target not found"
|
||||
pkg_call pre_configure_target
|
||||
|
||||
PKG_CONFIGURE_OPTS_INIT="$PKG_CONFIGURE_OPTS_TARGET"
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ if [ "$PKG_TOOLCHAIN" = "autotools" ]; then
|
||||
fi
|
||||
|
||||
# include build template and build
|
||||
pkg_call_optional pre_build_$TARGET
|
||||
pkg_call_exists pre_build_$TARGET && pkg_call pre_build_$TARGET
|
||||
|
||||
# ensure $PKG_BUILD is there. (installer? PKG_URL="")
|
||||
if [ ! -d "$PKG_BUILD" ] ; then
|
||||
@ -228,9 +228,11 @@ if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" -o -f "$PKG_MESON_SCRI
|
||||
fi
|
||||
|
||||
# configure
|
||||
pkg_call_optional pre_configure_$TARGET
|
||||
pkg_call_exists pre_configure_$TARGET && pkg_call pre_configure_$TARGET
|
||||
|
||||
if ! pkg_call configure_$TARGET; then
|
||||
if pkg_call_exists configure_$TARGET; then
|
||||
pkg_call configure_$TARGET
|
||||
else
|
||||
case "$PKG_TOOLCHAIN:$TARGET" in
|
||||
# meson builds
|
||||
"meson:target")
|
||||
@ -310,12 +312,14 @@ if ! pkg_call configure_$TARGET; then
|
||||
esac
|
||||
fi
|
||||
|
||||
pkg_call_optional post_configure_$TARGET
|
||||
pkg_call_exists post_configure_$TARGET && pkg_call post_configure_$TARGET
|
||||
|
||||
# make
|
||||
pkg_call_optional pre_make_$TARGET
|
||||
pkg_call_exists pre_make_$TARGET && pkg_call pre_make_$TARGET
|
||||
|
||||
if ! pkg_call make_$TARGET; then
|
||||
if pkg_call_exists make_$TARGET; then
|
||||
pkg_call make_$TARGET
|
||||
else
|
||||
case "$PKG_TOOLCHAIN:$TARGET" in
|
||||
# ninja based builds
|
||||
"meson:target"|"cmake:target"|"ninja:target")
|
||||
@ -355,12 +359,14 @@ if ! pkg_call make_$TARGET; then
|
||||
esac
|
||||
fi
|
||||
|
||||
pkg_call_optional post_make_$TARGET
|
||||
pkg_call_exists post_make_$TARGET && pkg_call post_make_$TARGET
|
||||
|
||||
# make install
|
||||
pkg_call_optional pre_makeinstall_$TARGET
|
||||
pkg_call_exists pre_makeinstall_$TARGET && pkg_call pre_makeinstall_$TARGET
|
||||
|
||||
if ! pkg_call makeinstall_$TARGET; then
|
||||
if pkg_call_exists makeinstall_$TARGET; then
|
||||
pkg_call makeinstall_$TARGET
|
||||
else
|
||||
case "$PKG_TOOLCHAIN:$TARGET" in
|
||||
# ninja based builds
|
||||
"meson:target"|"cmake:target")
|
||||
@ -394,7 +400,7 @@ if ! pkg_call makeinstall_$TARGET; then
|
||||
esac
|
||||
fi
|
||||
|
||||
pkg_call_optional post_makeinstall_$TARGET
|
||||
pkg_call_exists post_makeinstall_$TARGET && pkg_call post_makeinstall_$TARGET
|
||||
|
||||
if [ "$TARGET" = "target" -o "$TARGET" = "init" ]; then
|
||||
if [ -d $INSTALL ]; then
|
||||
|
@ -208,7 +208,9 @@ build_addon() {
|
||||
rm -rf $ADDON_BUILD
|
||||
|
||||
# install addon parts
|
||||
if ! pkg_call addon; then
|
||||
if pkg_call_exists addon; then
|
||||
pkg_call addon
|
||||
else
|
||||
install_binary_addon $PKG_ADDON_ID
|
||||
fi
|
||||
|
||||
|
@ -123,7 +123,7 @@ fi
|
||||
|
||||
# install
|
||||
if [ "$TARGET" = target ] ; then
|
||||
pkg_call_optional pre_install
|
||||
pkg_call_exists pre_install && pkg_call pre_install
|
||||
fi
|
||||
|
||||
if [ "$TARGET" = "target" -a -d $PKG_BUILD/.install_pkg ]; then
|
||||
@ -133,7 +133,7 @@ elif [ "$TARGET" = "init" -a -d $PKG_BUILD/.install_init ]; then
|
||||
fi
|
||||
|
||||
if [ "$TARGET" = target ] ; then
|
||||
pkg_call_optional post_install
|
||||
pkg_call_exists post_install && pkg_call post_install
|
||||
fi
|
||||
|
||||
touch $STAMP
|
||||
|
@ -44,9 +44,11 @@ fi
|
||||
if [ -d "$SOURCES/$1" -o -d "$PKG_DIR/sources" ]; then
|
||||
build_msg "CLR_UNPACK" "UNPACK" "${1}" "indent"
|
||||
|
||||
pkg_call_optional pre_unpack
|
||||
pkg_call_exists pre_unpack && pkg_call pre_unpack
|
||||
|
||||
if ! pkg_call unpack; then
|
||||
if pkg_call_exists unpack; then
|
||||
pkg_call unpack
|
||||
else
|
||||
if [ -n "$PKG_URL" ]; then
|
||||
$SCRIPTS/extract $1 $BUILD
|
||||
fi
|
||||
@ -69,10 +71,10 @@ if [ -d "$SOURCES/$1" -o -d "$PKG_DIR/sources" ]; then
|
||||
mkdir -p "${PKG_BUILD}"
|
||||
fi
|
||||
|
||||
pkg_call_optional post_unpack
|
||||
pkg_call_exists post_unpack && pkg_call post_unpack
|
||||
|
||||
if [ "${PKG_SKIP_PATCHES}" != "yes" ]; then
|
||||
pkg_call_optional pre_patch
|
||||
pkg_call_exists pre_patch && pkg_call pre_patch
|
||||
|
||||
if [ "$TARGET_ARCH" = "x86_64" ]; then
|
||||
PATCH_ARCH="x86"
|
||||
@ -141,7 +143,7 @@ if [ -d "$SOURCES/$1" -o -d "$PKG_DIR/sources" ]; then
|
||||
fi
|
||||
done
|
||||
|
||||
pkg_call_optional post_patch
|
||||
pkg_call_exists post_patch && pkg_call post_patch
|
||||
fi
|
||||
|
||||
if [ ! "$PKG_NAME" = "configtools" ] ; then
|
||||
|
Loading…
Reference in New Issue
Block a user