Skip to content

Instantly share code, notes, and snippets.

@kekePower
Last active November 19, 2017 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kekePower/2431861523a287de6a76ec2dcdfaac57 to your computer and use it in GitHub Desktop.
Save kekePower/2431861523a287de6a76ec2dcdfaac57 to your computer and use it in GitHub Desktop.
build.leia extension to download, compile and install Kodi 17.4 Krypton
# Extension to build Kodi 17.6 Krypton
# See https://github.com/kekePower/build.leia
STANDALONE=true
VERSION=17.6-Krypton
VNUM=$( echo ${VERSION} | cut -d- -f1 )
SOURCE=https://github.com/xbmc/xbmc/archive/${VERSION}.tar.gz
KODI=${KODIDIR}
PREFIX=/opt/krypton
CONFARGS=" \
--disable-debug \
--enable-non-free \
--with-lirc-device=/var/run/lirc/lircd \
--enable-libcec \
--with-gnu-ld \
--disable-gtest \
--enable-libbluray \
--enable-dvdcss \
--enable-libav-compat"
# Checking to see if either wget or curl is available.
if [[ -f $( which wget ) ]]; then
DOWNLOAD=wget
elif [[ -f $( which curl ) ]]; then
DOWNLOAD="curl -o ${VERSION}.tar.gz"
else
echo "Could not find wget nor curl..."
clean_exit ${1}
fi
MSG="Preparing ${VERSION}."
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
if [[ ! -d ${KODI} ]]; then
mkdir ${KODI} > /dev/null 2>&1
fi
if [[ -f ${KODI}/${VERSION}.tar.gz ]]; then
MSG="${VERSION} exists. Will not download again."
echo "${TIME}[$(date +%T)]${END} ${Y}${MSG}${END}"
loggy ${MSG}
else
MSG="Downloading ${VERSION} to ${KODI}"
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
builtin cd ${KODI}
${DOWNLOAD} ${SOURCE} > /dev/null 2>&1
fi
if [[ -d ${KODI}/Krypton-${VNUM} ]]; then
MSG="Source for ${VERSION} exists. Will use it."
echo "${TIME}[$(date +%T)]${END} ${Y}${MSG}${END}"
loggy ${MSG}
else
MSG="Extracting ${VERSION} source to ${KODI}"
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
builtin cd ${KODI}
tar xfvz ${VERSION}.tar.gz > /dev/null 2>&1
mv xbmc-${VERSION} Krypton-${VNUM} > /dev/null 2>&1
fi
if [[ ! -f ${KODI}/Krypton-${VNUM}/configure ]]; then
MSG="Running bootstrap"
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
builtin cd ${KODI}/Krypton-${VNUM}
./bootstrap >> ${LOGGYLOGFILE} 2>&1
fi
if [[ -f ${KODI}/Krypton-${VNUM}/configure ]]; then
MSG="Configuring ${VERSION}"
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
builtin cd ${KODI}/Krypton-${VNUM}
make distclean > /dev/null 2>&1
./configure $( echo ${CONFARGS} ) --prefix=${PREFIX} >> ${LOGGYLOGFILE} 2>&1
if [[ ! -f ${KODI}/Krypton-${VNUM}/Makefile ]]; then
MSG="Configure failed. Please check the log for information."
echo "${TIME}[$(date +%T)]${END} ${WARNING}${MSG}${END}"
loggy ${MSG}
MSG="${LOGGYLOGFILE}"
echo "${TIME}[$(date +%T)]${END} ${Y}${MSG}${END}"
loggy ${MSG}
clean_exit ${1}
else
MSG="Building ${VERSION}. Please wait..."
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
make -s -j${NUMCPU} >> ${LOGGYLOGFILE} 2>&1
fi
fi
if [[ -f ${KODI}/Krypton-${VNUM}/kodi.bin ]]; then
MSG="Installing ${VERSION} to ${PREFIX}"
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
${SUDO} make -s -j${NUMCPU} install >> ${LOGGYLOGFILE} 2>&1
MSG="Building and installing the binary addons."
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
${SUDO} make -C tools/depends/target/binary-addons distclean >> ${LOGGYLOGFILE} 2>&1
${SUDO} make -s -j${NUMCPU} -C tools/depends/target/binary-addons PREFIX=${PREFIX} >> ${LOGGYLOGFILE} 2>&1
NOTBUILT=( $( grep "Following Addons failed to build: " ${LOGGYLOGFILE} | tail -1 | cut -d:
-f2 ) )
if [[ ! ${NOTBUILT} == "" ]]; then
MSG="${L_94}"
echo "${TIME}[$(date +%T)]${END} ${ARROW} ${WARNING}${MSG}${END}"
for i in ${NOTBUILT}
do
echo "${TIME}[$(date +%T)]${END} ${W}**${END} ${ARROW} ${WARNING}${i}${END}"
done
fi
else
MSG="Build of ${VERSION} failed. Please check the log for information."
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
clean_exit ${1}
fi
MSG="${VERSION} has been successfully built."
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
MSG="You can launch Kodi by running"
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}
MSG="${PREFIX}/bin/kodi"
echo "${TIME}[$(date +%T)]${END} ${ARROW} ${Y}${MSG}${END}"
loggy ${MSG}
clean_exit ${1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment