mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-04-21 21:17:19 +00:00
94 lines
2.5 KiB
Bash
Executable File
94 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
|
|
|
|
. config/options $1
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "usage: $0 package_name[:<host|target|init|bootstrap>]"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "${1//:/}" != "${1}" ]; then
|
|
PACKAGE_NAME="${1%:*}"
|
|
TARGET="${1#*:}"
|
|
else
|
|
PACKAGE_NAME=$1
|
|
TARGET=
|
|
fi
|
|
[ -z "$TARGET" ] && TARGET="target"
|
|
|
|
if [ -n "$PKG_ARCH" ]; then
|
|
listcontains "$PKG_ARCH" "!$TARGET_ARCH" && exit 0
|
|
listcontains "$PKG_ARCH" "$TARGET_ARCH" || listcontains "$PKG_ARCH" "any" || exit 0
|
|
fi
|
|
|
|
STAMP=$STAMPS/$PACKAGE_NAME/build_$TARGET
|
|
|
|
if [ -f $STAMP ]; then
|
|
|
|
# include buildfile
|
|
. $PKG_DIR/package.mk
|
|
|
|
# virtual packages dont must be build, they only contains dependencies, so dont go further here
|
|
if [ ! "$PKG_SECTION" = "virtual" ]; then
|
|
|
|
# setup configure script
|
|
if [ -z "$PKG_CONFIGURE_SCRIPT" ]; then
|
|
PKG_CONFIGURE_SCRIPT="$PKG_BUILD/configure"
|
|
else
|
|
PKG_CONFIGURE_SCRIPT="$PKG_BUILD/$PKG_CONFIGURE_SCRIPT"
|
|
fi
|
|
if [ -z "$PKG_CMAKE_SCRIPT" ]; then
|
|
PKG_CMAKE_SCRIPT="$PKG_BUILD/CMakeLists.txt"
|
|
else
|
|
PKG_CMAKE_SCRIPT="$PKG_BUILD/$PKG_CMAKE_SCRIPT"
|
|
fi
|
|
|
|
# ensure $PKG_BUILD is there. (installer? PKG_URL="")
|
|
if [ ! -d $PKG_BUILD ] ; then
|
|
exit 0
|
|
fi
|
|
|
|
cd $PKG_BUILD
|
|
|
|
if [ "$TARGET" = "target" ]; then
|
|
if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then
|
|
cd .$TARGET_NAME
|
|
fi
|
|
elif [ "$TARGET" = "host" ]; then
|
|
if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then
|
|
cd .$HOST_NAME
|
|
fi
|
|
elif [ "$TARGET" = "init" ]; then
|
|
if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then
|
|
cd .$TARGET_NAME-init
|
|
fi
|
|
elif [ "$TARGET" = "bootstrap" ]; then
|
|
if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then
|
|
cd .$TARGET_NAME-bootstrap
|
|
fi
|
|
fi
|
|
|
|
MAKEUNINSTALL="$TOOLCHAIN/bin/make -j1 DESTDIR=$SYSROOT_PREFIX uninstall"
|
|
|
|
if [ "$TARGET" = "target" ]; then
|
|
$MAKEUNINSTALL $PKG_MAKEINSTALL_OPTS_TARGET
|
|
elif [ "$TARGET" = "host" ]; then
|
|
make uninstall $PKG_MAKEINSTALL_OPTS_HOST
|
|
elif [ "$TARGET" = "init" ]; then
|
|
make uninstall DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_INIT
|
|
elif [ "$TARGET" = "bootstrap" ]; then
|
|
$MAKEUNINSTALL $PKG_MAKEINSTALL_OPTS_BOOTSTRAP
|
|
fi
|
|
|
|
cd $ROOT
|
|
fi # ! "$PKG_SECTION" = "virtual"
|
|
|
|
if [ -f "$STAMP" ]; then
|
|
rm -f $STAMP
|
|
fi
|
|
|
|
fi
|