Merge pull request #3171 from MilhouseVH/le90_buildsystem_source_packages-with-drop

buildsystem: centralise package sourcing
This commit is contained in:
CvH 2018-12-29 18:18:15 +01:00 committed by GitHub
commit a98586ba33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 828 additions and 844 deletions

View File

@ -10,24 +10,6 @@ die() {
exit "${2:-1}"
}
# p1: name of potential function to execute if it exists
# return 0 if function executed, 1 if not, die if error
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
}
# return 0 if $2 in space-separated list $1, otherwise return 1
listcontains() {
if [ -n "$1" -a -n "$2" ]; then
@ -687,8 +669,7 @@ do_autoreconf() {
get_pkg_variable() {
if [ -n "$1" -a -n "$2" ] ; then
if [ "$1" != "$PKG_NAME" ]; then
cd $ROOT
. config/options $1 &>/dev/null
source_package "${1}"
fi
echo "${!2}"
fi
@ -811,6 +792,126 @@ 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
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
}
unset_functions() {
local target
unset -f configure_package
unset -f pre_unpack unpack post_unpack
unset -f pre_patch post_patch
for target in target host init bootstrap; do
unset -f pre_build_${target}
unset -f pre_configure_${target} configure_${target} post_configure_${target}
unset -f pre_make_${target} make_${target} post_make_${target}
unset -f pre_makeinstall_${target} makeinstall_${target} post_makeinstall_${target}
done
unset -f pre_install post_install
unset -f addon
}
# p1: name of package to be sourced
source_package() {
local opwd="${PWD}"
# Don't use BUILD_WITH_DEBUG in "global" package.mk - instead, call the function
# build_with_debug() directly as the function depends on various package.mk
# variables that will be in the process of being configured. Once package.mk is
# fully sourced we can set this variable and use it in situations where we know the
# package has already been sourced.
unset BUILD_WITH_DEBUG
reset_pkg_vars
unset_functions
if [ -n "${1}" ]; then
PKG_DIR="$(get_pkg_directory ${1})"
[ -n "$PKG_DIR" -a -r $PKG_DIR/package.mk ] || die "FAILURE: unable to source package - ${1}/package.mk does not exist"
cd "${ROOT}"
. ${PKG_DIR}/package.mk || die "FAILURE: an error occurred while sourcing ${PKG_DIR}/package.mk"
cd "${opwd}"
PKG_SHORTDESC="${PKG_SHORTDESC:-${PKG_NAME} (autogenerated)}"
PKG_LONGDESC="${PKG_LONGDESC:-${PKG_NAME} (autogenerated)}"
if [ "$PKG_IS_ADDON" = "yes" -o "$PKG_IS_ADDON" = "embedded" ] ; then
[ -z $PKG_SECTION ] && PKG_ADDON_ID="$PKG_NAME" || PKG_ADDON_ID="${PKG_SECTION//\//.}.$PKG_NAME"
[ "$PKG_ADDON_IS_STANDALONE" != "yes" ] && PKG_NEED_UNPACK="${PKG_NEED_UNPACK} $(get_pkg_directory $MEDIACENTER)"
fi
# Automatically set PKG_SOURCE_NAME unless it is already defined.
# PKG_SOURCE_NAME will be automatically set to a name based on
# the $PKG_NAME-$PKG_VERSION convention.
#
# Any $PKG_URL that references more than a single url will abort
# the build as these are no longer supported - use mkpkg instead.
if [ -n "$PKG_URL" -a -z "$PKG_SOURCE_NAME" ]; then
if [[ $PKG_URL =~ .*\ .* ]]; then
echo "Error - packages with multiple urls are no longer supported, use mkpkg."
echo "$PKG_URL"
die
fi
if [[ ${PKG_URL} =~ .git$ || ${PKG_URL} =~ ^git:// ]]; then
PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}
elif [[ ${PKG_URL} =~ ^file:// ]]; then
PKG_SOURCE_NAME=${PKG_URL#file://}
# if no specific PKG_TAR_COPY_OPTS then default to excluding .git and .svn as they can be huge
[ -z "${PKG_TAR_COPY_OPTS+x}" ] && PKG_TAR_COPY_OPTS="--exclude=.git --exclude=.svn"
else
PKG_SOURCE_NAME="${PKG_URL##*/}"
case $PKG_SOURCE_NAME in
${PKG_NAME}-${PKG_VERSION}.*)
PKG_SOURCE_NAME=$PKG_SOURCE_NAME
;;
*.tar | *.tbz | *.tgz | *.txz | *.7z | *.zip)
PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.${PKG_SOURCE_NAME##*\.}
;;
*.tar.bz2 | *.tar.gz | *.tar.xz)
PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.tar.${PKG_SOURCE_NAME##*\.}
;;
*.diff | *.patch | *.diff.bz2 | *.patch.bz2 | patch-*.bz2 | *.diff.gz | *.patch.gz | patch-*.gz)
PKG_SOURCE_NAME=$PKG_SOURCE_NAME
;;
*)
PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.${PKG_SOURCE_NAME##*\.}
;;
esac
fi
fi
PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}"
fi
build_with_debug && BUILD_WITH_DEBUG="yes" || BUILD_WITH_DEBUG="no"
# 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
}
### KERNEL HELPERS ###
kernel_path() {

View File

@ -94,3 +94,11 @@ check_config
. config/graphic
. config/path $1
## package processing
# If the package caches are unset, then populate them
init_package_cache
# set package metadata
source_package "${1}"

View File

@ -1,3 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
set -e
# setup initial directorys (relative to root)
@ -59,79 +62,6 @@ INSTALL_INIT=$BUILD/image/initramfs/root-image
MAKE="$TOOLCHAIN/bin/make"
MAKEINSTALL="$TOOLCHAIN/bin/make -j1 DESTDIR=$SYSROOT_PREFIX install"
unset LD_LIBRARY_PATH
# Don't use BUILD_WITH_DEBUG in "gloabl" package.mk - instead, call the function
# build_with_debug() directly as the function depends on various package.mk
# variables that will be in the process of being configured. Once package.mk is
# fully sourced we can set this variable and use it in situations where we know the
# package has already been sourced.
unset BUILD_WITH_DEBUG
# If the package caches are unset, then populate them
init_package_cache
# set package metadata
reset_pkg_vars "$1"
[ -n "$1" ] && PKG_DIR="$(get_pkg_directory $1)"
if [ -n "$PKG_DIR" -a -r $PKG_DIR/package.mk ]; then
unset -f configure_package
. $PKG_DIR/package.mk
[ -z "$PKG_SHORTDESC" ] && PKG_SHORTDESC="$PKG_NAME (autogenerated)"
[ -z "$PKG_LONGDESC" ] && PKG_LONGDESC="$PKG_NAME (autogenerated)"
fi
if [ "$PKG_IS_ADDON" = "yes" -o "$PKG_IS_ADDON" = "embedded" ] ; then
[ -z $PKG_SECTION ] && PKG_ADDON_ID="$PKG_NAME" || PKG_ADDON_ID="${PKG_SECTION//\//.}.$PKG_NAME"
[ "$PKG_ADDON_IS_STANDALONE" != "yes" ] && PKG_NEED_UNPACK="${PKG_NEED_UNPACK} $(get_pkg_directory $MEDIACENTER)"
fi
# Automatically set PKG_SOURCE_NAME unless it is already defined.
# PKG_SOURCE_NAME will be automatically set to a name based on
# the $PKG_NAME-$PKG_VERSION convention.
#
# Any $PKG_URL that references more than a single url will abort
# the build as these are no longer supported - use mkpkg instead.
if [ -n "$PKG_URL" -a -z "$PKG_SOURCE_NAME" ]; then
if [[ $PKG_URL =~ .*\ .* ]]; then
echo "Error - packages with multiple urls are no longer supported, use mkpkg:"
echo "$PKG_URL"
exit 1
fi
if [[ ${PKG_URL} =~ .git$ || ${PKG_URL} =~ ^git:// ]]; then
PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}
elif [[ ${PKG_URL} =~ ^file:// ]]; then
PKG_SOURCE_NAME=${PKG_URL#file://}
# if no specific PKG_TAR_COPY_OPTS then default to excluding .git and .svn as they can be huge
[ -z "${PKG_TAR_COPY_OPTS+x}" ] && PKG_TAR_COPY_OPTS="--exclude=.git --exclude=.svn"
else
PKG_SOURCE_NAME="${PKG_URL##*/}"
case $PKG_SOURCE_NAME in
${PKG_NAME}-${PKG_VERSION}.*)
PKG_SOURCE_NAME=$PKG_SOURCE_NAME
;;
*.tar | *.tbz | *.tgz | *.txz | *.7z | *.zip)
PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.${PKG_SOURCE_NAME##*\.}
;;
*.tar.bz2 | *.tar.gz | *.tar.xz)
PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.tar.${PKG_SOURCE_NAME##*\.}
;;
*.diff | *.patch | *.diff.bz2 | *.patch.bz2 | patch-*.bz2 | *.diff.gz | *.patch.gz | patch-*.gz)
PKG_SOURCE_NAME=$PKG_SOURCE_NAME
;;
*)
PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.${PKG_SOURCE_NAME##*\.}
;;
esac
fi
fi
PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}"
build_with_debug && BUILD_WITH_DEBUG="yes" || BUILD_WITH_DEBUG="no"
XORG_PATH_DRI=/usr/lib/dri
XORG_PATH_XKB=/usr/share/X11/xkb
XORG_PATH_XKB_OUTPUT=/var/lib/xkb
@ -151,8 +81,12 @@ fi
VERSION_SUFFIX=$TARGET_ARCH
SILENT_OUT=3
VERBOSE_OUT=4
# redirect formatted output
if [ -z "${SILENT_OUT}" -a -z "${VERBOSE_OUT}" ]; then
export BUILD_INDENT_SIZE=4
export SILENT_OUT=3
export VERBOSE_OUT=4
if [ "$VERBOSE" = yes ]; then
exec 3>&1
exec 4>&2
@ -160,13 +94,10 @@ else
exec 3>&2
exec 4>/dev/null
fi
BUILD_INDENT_SIZE=4
# If sourcing a package, configure any package variables dependent on variables we have set
if [ -n "$PKG_DIR" -a -r $PKG_DIR/package.mk ]; then
pkg_call_optional configure_package
fi
unset LD_LIBRARY_PATH
# multilib? nah
unset CONFIG_SITE

View File

@ -18,15 +18,16 @@ PKG_ICU_OPTS="--disable-extras \
--disable-tests \
--disable-tools"
PKG_CONFIGURE_OPTS_HOST="--enable-static \
--disable-shared \
$PKG_ICU_OPTS"
configure_package() {
PKG_CONFIGURE_OPTS_TARGET="--with-cross-build=$PKG_BUILD/.$HOST_NAME \
$PKG_ICU_OPTS"
PKG_CONFIGURE_SCRIPT="source/configure"
PKG_CONFIGURE_SCRIPT="${PKG_BUILD}/source/configure"
}
post_makeinstall_target() {
rm -rf $INSTALL

View File

@ -10,7 +10,9 @@ PKG_URL="http://ftp.de.debian.org/debian/pool/main/o/opencaster/opencaster_${PKG
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="A free and open source MPEG2 transport stream data generator and packet manipulator."
pre_configure_target() {
PKG_MAKE_OPTS_TARGET="CC=$CC"
}
pre_makeinstall_target() {
mkdir -p $PKG_BUILD/.install_pkg

View File

@ -11,8 +11,6 @@ PKG_DEPENDS_HOST="toolchain zlib:host"
PKG_DEPENDS_TARGET="toolchain zlib protobuf:host"
PKG_LONGDESC="Protocol Buffers for Google's data interchange format."
PKG_CMAKE_SCRIPT="$PKG_BUILD/cmake/CMakeLists.txt"
PKG_CMAKE_OPTS_HOST="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
-DBUILD_SHARED_LIBS=0 \
-Dprotobuf_BUILD_TESTS=0 \
@ -21,6 +19,10 @@ PKG_CMAKE_OPTS_HOST="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_HOST"
configure_package() {
PKG_CMAKE_SCRIPT="$PKG_BUILD/cmake/CMakeLists.txt"
}
post_makeinstall_target() {
rm -rf $INSTALL/usr/bin

View File

@ -10,7 +10,9 @@ PKG_URL="$SOURCEFORGE_SRC/keytouch/getscancodes-${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="Shows the scancode of the pressed or released key."
pre_configure_target() {
PKG_MAKE_OPTS_TARGET="CC=$CC"
}
makeinstall_target() {
: # nop

View File

@ -11,10 +11,11 @@ PKG_URL="https://github.com/groeck/lm-sensors/archive/${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="Provides user-space support for the hardware monitoring drivers."
PKG_MAKE_OPTS_TARGET="PREFIX=/usr CC=$CC AR=$AR"
PKG_MAKEINSTALL_OPTS_TARGET="PREFIX=/usr"
pre_make_target() {
PKG_MAKE_OPTS_TARGET="PREFIX=/usr CC=$CC AR=$AR"
export CFLAGS="$TARGET_CFLAGS"
export CPPFLAGS="$TARGET_CPPFLAGS"
}

View File

@ -19,6 +19,7 @@ PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Net-SNMP"
PKG_ADDON_TYPE="xbmc.service"
configure_package() {
PKG_CONFIGURE_OPTS_TARGET="--with-defaults \
--disable-applications \
--disable-manuals \
@ -40,6 +41,7 @@ PKG_CONFIGURE_OPTS_TARGET="--with-defaults \
--libdir=/storage/.kodi/addons/${PKG_ADDON_ID}/lib \
--disable-embedded-perl \
--with-sysroot=$SYSROOT_PREFIX"
}
make_target() {
make

View File

@ -46,6 +46,12 @@ if [[ "$TARGET_ARCH" != "x86_64" ]]; then
--disable-libx265"
fi
post_unpack() {
sed -e 's/VER="0.0.0~unknown"/VER="'$PKG_VERSION_NUMBER' ~ LibreELEC Tvh-addon v'$ADDON_VERSION'.'$PKG_REV'"/g' -i $PKG_BUILD/support/version
sed -e 's|'/usr/bin/pngquant'|'$TOOLCHAIN/bin/pngquant'|g' -i $PKG_BUILD/support/mkbundle
}
pre_configure_target() {
PKG_CONFIGURE_OPTS_TARGET="--prefix=/usr \
--arch=$TARGET_ARCH \
--cpu=$TARGET_CPU \
@ -71,12 +77,6 @@ PKG_CONFIGURE_OPTS_TARGET="--prefix=/usr \
--disable-bintray_cache \
--python=$TOOLCHAIN/bin/python"
post_unpack() {
sed -e 's/VER="0.0.0~unknown"/VER="'$PKG_VERSION_NUMBER' ~ LibreELEC Tvh-addon v'$ADDON_VERSION'.'$PKG_REV'"/g' -i $PKG_BUILD/support/version
sed -e 's|'/usr/bin/pngquant'|'$TOOLCHAIN/bin/pngquant'|g' -i $PKG_BUILD/support/mkbundle
}
pre_configure_target() {
# fails to build in subdirs
cd $PKG_BUILD
rm -rf .$TARGET_NAME

View File

@ -79,8 +79,7 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \
--with-soxr \
--with-module-dir=/usr/lib/pulse"
pre_configure_target()
{
pre_configure_target() {
sed -e 's|; remixing-use-all-sink-channels = yes|; remixing-use-all-sink-channels = no|' \
-i $PKG_BUILD/src/daemon/daemon.conf.in
}

View File

@ -11,9 +11,11 @@ PKG_DEPENDS_HOST="toolchain"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="lz4 data compressor/decompressor"
configure_package() {
PKG_CMAKE_SCRIPT="$PKG_BUILD/contrib/cmake_unofficial/CMakeLists.txt"
PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=0 -DCMAKE_POSITION_INDEPENDENT_CODE=0"
}
post_makeinstall_target() {
rm -rf $INSTALL

View File

@ -11,6 +11,7 @@ PKG_SOURCE_DIR=$PKG_NAME-$PKG_VERSION
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="A fast real-time compression algorithm."
configure_package() {
PKG_CMAKE_SCRIPT="$PKG_BUILD/build/cmake/CMakeLists.txt"
PKG_CMAKE_OPTS_HOST="-DTHREADS_PTHREAD_ARG=0"
}

View File

@ -13,6 +13,14 @@ PKG_LONGDESC="An Embeddable SQL Database Engine."
# libsqlite3.a(sqlite3.o): requires dynamic R_X86_64_PC32 reloc against 'sqlite3_stricmp' which may overflow at runtime
PKG_BUILD_FLAGS="+pic +pic:host -parallel"
PKG_CONFIGURE_OPTS_TARGET="--disable-static \
--enable-shared \
--disable-readline \
--enable-threadsafe \
--enable-dynamic-extensions \
--with-gnu-ld"
pre_configure_target() {
# sqlite fails to compile with fast-math link time optimization.
CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-O3|g"`
CFLAGS=`echo $CFLAGS | sed -e "s|-ffast-math||g"`
@ -43,10 +51,4 @@ PKG_BUILD_FLAGS="+pic +pic:host -parallel"
# sqlite3_config(SQLITE_CONFIG_MMAP_SIZE) call, or at run-time using the
# mmap_size pragma.
CFLAGS="$CFLAGS -DSQLITE_TEMP_STORE=3 -DSQLITE_DEFAULT_MMAP_SIZE=268435456"
PKG_CONFIGURE_OPTS_TARGET="--disable-static \
--enable-shared \
--disable-readline \
--enable-threadsafe \
--enable-dynamic-extensions \
--with-gnu-ld"
}

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="gdb"
PKG_VERSION="8.1"
@ -11,9 +12,6 @@ PKG_DEPENDS_TARGET="toolchain zlib ncurses expat"
PKG_LONGDESC="GNU Project debugger, allows you to see what is going on inside another program while it executes."
# gdb could fail on runtime if build with LTO support
CC_FOR_BUILD="$HOST_CC"
CFLAGS_FOR_BUILD="$HOST_CFLAGS"
PKG_CONFIGURE_OPTS_TARGET="bash_cv_have_mbstate_t=set \
--disable-shared \
--enable-static \
@ -30,6 +28,11 @@ PKG_CONFIGURE_OPTS_TARGET="bash_cv_have_mbstate_t=set \
--enable-libssp \
--disable-werror"
pre_configure_target() {
CC_FOR_BUILD="$HOST_CC"
CFLAGS_FOR_BUILD="$HOST_CFLAGS"
}
makeinstall_target() {
make DESTDIR=$INSTALL install
}

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="ccache"
PKG_VERSION="3.3.6"
@ -10,10 +11,12 @@ PKG_URL="https://samba.org/ftp/ccache/$PKG_NAME-$PKG_VERSION.tar.bz2"
PKG_DEPENDS_HOST="make:host"
PKG_LONGDESC="A compiler cache to speed up re-compilation of C/C++ code by caching."
PKG_CONFIGURE_OPTS_HOST="--with-bundled-zlib"
pre_configure_host() {
export CC=$LOCAL_CC
export CXX=$LOCAL_CXX
PKG_CONFIGURE_OPTS_HOST="--with-bundled-zlib"
}
post_makeinstall_host() {
# setup ccache

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="gettext"
PKG_VERSION="0.19.8.1"
@ -10,7 +11,8 @@ PKG_URL="http://ftp.gnu.org/pub/gnu/gettext/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_DEPENDS_HOST="ccache:host"
PKG_LONGDESC="A program internationalization library and tools."
PKG_CONFIGURE_SCRIPT="gettext-tools/configure"
configure_package() {
PKG_CONFIGURE_SCRIPT="${PKG_BUILD}/gettext-tools/configure"
PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared \
--disable-rpath \
@ -21,3 +23,4 @@ PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared \
--disable-native-java \
--disable-csharp \
--without-emacs"
}

View File

@ -45,8 +45,6 @@ else
PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-debug"
fi
NSS_CONF_DIR="$PKG_BUILD/nss"
pre_build_target() {
cd $PKG_BUILD
aclocal --force --verbose

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="make"
PKG_VERSION="4.2.1"
@ -10,7 +11,9 @@ PKG_URL="http://ftpmirror.gnu.org/make/$PKG_NAME-$PKG_VERSION.tar.bz2"
PKG_DEPENDS_HOST=""
PKG_LONGDESC="Utility to maintain groups of programs."
pre_configure_host() {
export CC=$LOCAL_CC
}
post_makeinstall_host() {
ln -sf make $TOOLCHAIN/bin/gmake

View File

@ -15,9 +15,9 @@ PKG_LIBNAME="fbalpha_libretro.so"
PKG_LIBPATH="$PKG_LIBNAME"
PKG_LIBVAR="FBALPHA_LIB"
pre_make_target() {
PKG_MAKE_OPTS_TARGET="-f makefile.libretro CC=$CC CXX=$CXX GIT_VERSION=${PKG_VERSION:0:7}"
pre_make_target() {
if [ "$PROJECT" = "RPi" ]; then
case $DEVICE in
RPi)

View File

@ -12,9 +12,12 @@ PKG_LONGDESC="VRAM Test from libretro"
PKG_TOOLCHAIN="manual"
PKG_LIBNAME="testsw_vram_libretro.so"
PKG_LIBPATH="$PKG_BUILD/video/software/rendering_direct_to_vram/$PKG_LIBNAME"
PKG_LIBVAR="VRAM-TEST_LIB"
configure_package() {
PKG_LIBPATH="$PKG_BUILD/video/software/rendering_direct_to_vram/$PKG_LIBNAME"
}
make_target() {
cd $PKG_BUILD/video/software/rendering_direct_to_vram
make

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="vsxu"
PKG_VERSION="0.5.1"
@ -12,13 +13,15 @@ PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain $OPENGL libX11 glew glfw zlib libpng libjpeg-turbo freetype"
PKG_LONGDESC="an OpenGL-based programming environment to visualize music and create graphic effects"
export LDFLAGS="$LDFLAGS -lX11"
PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=0 \
-DVSXU_STATIC=1 \
-DCMAKE_POSITION_INDEPENDENT_CODE=1 \
-DCMAKE_CXX_FLAGS=-I$SYSROOT_PREFIX/usr/include/freetype2"
pre_configure_target(){
export LDFLAGS="$LDFLAGS -lX11"
}
post_makeinstall_target() {
mkdir -p $SYSROOT_PREFIX/usr/lib/vsxu
cp -PR $INSTALL/usr/lib/* $SYSROOT_PREFIX/usr/lib

View File

@ -39,6 +39,15 @@ PKG_CMAKE_OPTS_COMMON="-DLLVM_INCLUDE_TOOLS=ON \
PKG_CMAKE_OPTS_HOST="$PKG_CMAKE_OPTS_COMMON \
-DCMAKE_INSTALL_RPATH=$TOOLCHAIN/lib"
pre_configure_target() {
PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_COMMON \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DLLVM_TARGET_ARCH="$TARGET_ARCH" \
-DLLVM_TABLEGEN=$TOOLCHAIN/bin/llvm-tblgen"
}
make_host() {
ninja $NINJA_OPTS llvm-config llvm-tblgen
}
@ -48,13 +57,6 @@ makeinstall_host() {
cp -a bin/llvm-tblgen $TOOLCHAIN/bin
}
PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_COMMON \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DLLVM_TARGET_ARCH="$TARGET_ARCH" \
-DLLVM_TABLEGEN=$TOOLCHAIN/bin/llvm-tblgen"
post_makeinstall_target() {
rm -rf $INSTALL/usr/bin
rm -rf $INSTALL/usr/lib/LLVMHello.so

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="dvbhdhomerun"
PKG_VERSION="20130704"
@ -13,17 +14,11 @@ PKG_NEED_UNPACK="$LINUX_DEPENDS"
PKG_LONGDESC="A linux DVB driver for the HDHomeRun TV tuner (http://www.silicondust.com)."
PKG_IS_KERNEL_PKG="yes"
PKG_CMAKE_SCRIPT="userhdhomerun/CMakeLists.txt"
pre_make_target() {
( cd ../kernel
LDFLAGS="" make dvb_hdhomerun KERNEL_DIR=$(kernel_path)
fix_module_depends dvb_hdhomerun_core.ko "dvb_core"
)
configure_package() {
PKG_CMAKE_SCRIPT="${PKG_BUILD}/userhdhomerun/CMakeLists.txt"
}
pre_configure_target() {
# use it here to be sure libhdhomerun is already built
PKG_CMAKE_OPTS_TARGET="-DLIBHDHOMERUN_PATH=$(ls -d $BUILD/libhdhomerun-*/)"
@ -34,6 +29,13 @@ pre_configure_target() {
sed -i "s|/etc/dvbhdhomerun|/tmp/dvbhdhomerun|g" ../userhdhomerun/hdhomerun_controller.cpp
}
pre_make_target() {
( cd ../kernel
LDFLAGS="" make dvb_hdhomerun KERNEL_DIR=$(kernel_path)
fix_module_depends dvb_hdhomerun_core.ko "dvb_core"
)
}
makeinstall_target() {
cd $PKG_BUILD
mkdir -p $INSTALL/$(get_full_module_dir)/hdhomerun

View File

@ -14,10 +14,12 @@ PKG_LONGDESC="gpu-aml: Linux drivers for Mali GPUs found in Amlogic Meson SoCs"
PKG_TOOLCHAIN="manual"
PKG_IS_KERNEL_PKG="yes"
configure_package() {
PKG_UTGARD_VERSION="r5p1"
PKG_UTGARD_BUILD_DIR="$PKG_BUILD/utgard/$PKG_UTGARD_VERSION"
PKG_MIDGARD_VERSION="r16p0"
PKG_MIDGARD_BUILD_DIR="$PKG_BUILD/midgard/$PKG_MIDGARD_VERSION/kernel/drivers/gpu/arm/midgard"
}
pre_configure_target() {
sed -e "s|shell date|shell date -R|g" -i $PKG_BUILD/utgard/*/Kbuild

View File

@ -206,7 +206,7 @@ make_target() {
( cd $ROOT
rm -rf $BUILD/initramfs
$SCRIPTS/install initramfs
)
) || die "FAILURE: Building initramfs"
if [ "$BOOTLOADER" = "u-boot" -a -n "$KERNEL_UBOOT_EXTRA_TARGET" ]; then
for extra_target in "$KERNEL_UBOOT_EXTRA_TARGET"; do

View File

@ -31,6 +31,7 @@ case $KODI_VENDOR in
;;
esac
configure_package() {
# Single threaded LTO is very slow so rely on Kodi for parallel LTO support
if [ "$LTO_SUPPORT" = "yes" ] && ! build_with_debug; then
PKG_KODI_USE_LTO="-DUSE_LTO=$CONCURRENCY_MAKE_LEVEL"
@ -241,6 +242,7 @@ PKG_CMAKE_OPTS_TARGET="-DNATIVEPREFIX=$TOOLCHAIN \
$KODI_OPTICAL \
$KODI_BLURAY \
$KODI_PLAYER"
}
pre_configure_target() {
export LIBS="$LIBS -lncurses"

View File

@ -13,6 +13,7 @@ PKG_NEED_UNPACK="$(get_pkg_directory heimdal) $(get_pkg_directory e2fsprogs)"
PKG_LONGDESC="A free SMB / CIFS fileserver and client."
PKG_BUILD_FLAGS="-gold"
configure_package() {
PKG_MAKE_OPTS_TARGET="V=1"
if [ "$AVAHI_DAEMON" = yes ]; then
@ -85,6 +86,7 @@ PKG_CONFIGURE_OPTS="--prefix=/usr \
PKG_SAMBA_TARGET="smbclient,client/smbclient,smbtree,testparm"
[ "$SAMBA_SERVER" = "yes" ] && PKG_SAMBA_TARGET+=",smbd/smbd,nmbd,smbpasswd"
}
pre_configure_target() {
# samba uses its own build directory

View File

@ -77,7 +77,7 @@ Additional options used when the package builds an addon.
| PKG_ADDON_IS_STANDALONE | - | no | Defines if an addon depends on Kodi (on) or is standalone (yes) |
| PKG_ADDON_BROKEN | - | no | Marks an addon as broken for the user |
#### Detail Infomations for Options
#### Detailed Information for Options
##### TOOLCHAIN options
@ -144,6 +144,7 @@ Full list of overwrittable functions.
| function | stages specific | description |
|-------------------------|--------|-------------|
| configure_package | - | Optional function to implement late binding variable assignment (see below) |
| unpack<br>pre_unpack<br>post_unpack | - | Extract the source from the downloaded file |
| pre_patch<br>post_patch | - | Apply the patches to the source, after extraction. The patch function it self is not allowed to overwritten |
| pre_build_\[stage] | yes | Runs before of the start of the build |
@ -152,41 +153,106 @@ Full list of overwrittable functions.
| makeinstall_\[stage]<br>pre_makeinstall_\[stage]<br>post_makeinstall_\[stage] | yes | Installation of the files in the correct pathes<br>host: TOOLCHAIN<br>target: SYSROOT and IMAGE<br>bootstrap and init: temporary destination
| addon | - | Copy all files together for addon creation. This is requiered for addons |
## Late Binding variable assignment
A package will be loaded only once, by the call to `config/options`. During this process, additional package specific variables will be initialised, such as:
* `PKG_BUILD` - path to the build folder
* `PKG_SOURCE_NAME` - if not already specified, generated from `PKG_URL`, `PKG_NAME` and` PKG_VERSION`
Since these variables will not exist at the time the package is loaded, they can only be referenced **after** package has loaded. This can be accomplished by referencing these variables in the `configure_package()` function which is executed once the additional variables have been assigned.
If necessary, the following variables would be configured in `configure_package()` as they are normally relative to `${PKG_BUILD}`:
```
PKG_CONFIGURE_SCRIPT
PKG_CMAKE_SCRIPT
PKG_MESON_SCRIPT
```
Further to this, toolchain variables that are defined in `setup_toolchain()` must not be referenced "globally" in the package as they will only be configured reliably after `setup_toolchain()` has been called during `scripts/build`. Any variable in the following list must instead be referenced in a package function such as `pre_build_*`, `pre_configure_*`, `pre_make_*` etc.:
```
TARGET_CFLAGS TARGET_CXXFLAGS TARGET_LDFLAGS
NINJA_OPTS MAKEFLAGS
DESTIMAGE
CC CXX CPP LD
AS AR NM RANLIB
OBJCOPY OBJDUMP
STRIP
CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
PKG_CONFIG_SYSROOT_DIR
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
PKG_CONFIG_ALLOW_SYSTEM_LIBS
CMAKE_CONF CMAKE
HOST_CC HOST_CXX HOSTCC HOSTCXX
CC_FOR_BUILD CXX_FOR_BUILD BUILD_CC BUILD_CXX
_python_sysroot _python_prefix _python_exec_prefix
```
Lastly, the following variables are assigned during `scripts/build` but some packages may need to use alternative values for these variables. To do so, the package must assign alternative values in `pre_build_*`/`pre_configure_*`/`pre_make_*` etc. functions as these functions will be called after the variables are initialised with default values in `scripts/build` but before they are used by `scripts/build`.
```
CMAKE_GENERATOR_NINJA
TARGET_CONFIGURE_OPTS
TARGET_CMAKE_OPTS
TARGET_MESON_OPTS
HOST_CONFIGURE_OPTS
HOST_CMAKE_OPTS
HOST_MESON_OPTS
INIT_CONFIGURE_OPTS
INIT_CMAKE_OPTS
INIT_MESON_OPTS
BOOTSTRAP_CONFIGURE_OPTS
BOOTSTRAP_CMAKE_OPTS
BOOTSTRAP_MESON_OPTS
```
###### Example
```
configure_package() {
# now we know where we're building, assign a value
PKG_CONFIGURE_SCRIPT="${PKG_BUILD}/gettext-tools/configure"
}
post_patch() {
# replace hardcoded stuff
sed -i $PKG_BUILD/Makefile 's|hardcoded stuff|variabled stuff|'
sed -i ${PKG_CONFIGURE_SCRIPT} 's|hardcoded stuff|variable stuff|'
}
pre_configure_target() {
# add extra flag to toolchain default
CFLAGS="$CFLAGS -DEXTRA_FLAG=yeah"
}
post_makeinstall_target() {
# remove unused executable, only library needed
# remove unused executable, install what remains
rm $INSTALL/usr/bin/bigexecutable
}
```
## Add a new package to the Image
1. Think about, why you needs it in the image.
1. Think about, why you need it in the image.
* new multimedia tool
* add a new network tool
* new kernel driver
* ...
2. Find a place in the packages-tree
* look into the package-tree, i think most is self explaind. When 1. was done, this is going fast :)
* do not place it, in an existing package (directory with includes a `package.mk`)
* when you found a place, create a directory with the name of your package (must the same like `PKG_NAME`!!)
3. Create a initial `package.mk`
* you found a template under `packages/package.mk.template`. Copy the template into the new directory and call it `package.mk`
* edit your new `package.mk`
4. Find a place in the dependency tree. When 1. was done, this is going fast, again :)
* when it extend an existing package, add it there to the `PKG_DEPENDS_TARGET`
* take a look into the path `packages/virtual`, there you should find a virtual packages, that match your new package (misc-packages should the last option)
5. now you can build your image
* after the build, under build-[...]/ should apear a directory with your package-name and -version.
2. Find a place in the packages tree
* look into the package tree structure, which is generally self explaind.
* do not place it in an existing package (directory that includes a `package.mk`)
* when you found a place, create a directory with the name of your package (use same value for `PKG_NAME`!!)
3. Create an initial `package.mk`
* you can find a template under `packages/package.mk.template`. Copy the template into the new directory and call it `package.mk`
* apply any required changes to your new `package.mk`
4. Find a place in the dependency tree
* when it extend an existing package, add it there to the `PKG_DEPENDS_TARGET`/`PKG_DEPENDS_HOST` etc.
* take a look into the path `packages/virtual`, there you should find a virtual packages, that match your new package (misc-packages should be the last option)
5. Now you can build your image
* after the build, inside the `build-*` folder you should find a directory with your package name and -version, eg. `widget-1.2.3`.
## Example
```
@ -196,25 +262,21 @@ post_makeinstall_target() {
PKG_NAME="mariadb-connector-c"
PKG_VERSION="3.0.2"
PKG_SHA256="f44f436fc35e081db3a56516de9e3bb11ae96838e75d58910be28ddd2bc56d88"
PKG_ARCH="any"
PKG_LICENSE="LGPL"
PKG_SITE="https://mariadb.org/"
PKG_URL="https://github.com/MariaDB/mariadb-connector-c/archive/v$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain zlib openssl"
PKG_SECTION="database"
PKG_SHORTDESC="mariadb-connector: library to conntect to mariadb/mysql database server"
PKG_LONGDESC="mariadb-connector: library to conntect to mariadb/mysql database server"
PKG_BUILD_FLAGS="-gold"
PKG_CMAKE_OPTS_TARGET="-DWITH_EXTERNAL_ZLIB=ON
-DAUTH_CLEARTEXT=STATIC
-DAUTH_DIALOG=STATIC
-DAUTH_OLDPASSWORD=STATIC
-DREMOTEIO=OFF
"
PKG_CMAKE_OPTS_TARGET="-DWITH_EXTERNAL_ZLIB=ON \
-DAUTH_CLEARTEXT=STATIC \
-DAUTH_DIALOG=STATIC \
-DAUTH_OLDPASSWORD=STATIC \
-DREMOTEIO=OFF"
post_makeinstall_target() {
# drop all unneeded
rm -rf $INSTALL/usr
}
```

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="libgcrypt"
PKG_VERSION="1.8.3"
@ -13,12 +14,14 @@ PKG_TOOLCHAIN="autotools"
# libgcrypt-1.7.x fails to build with LTO support
# see for example https://bugs.gentoo.org/show_bug.cgi?id=581114
pre_configure_target() {
PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC \
ac_cv_sys_symbol_underscore=no \
--enable-asm \
--with-gnu-ld \
--with-libgpg-error-prefix=$SYSROOT_PREFIX/usr \
--disable-doc"
}
post_makeinstall_target() {
sed -e "s:\(['= ]\)\"/usr:\\1\"$SYSROOT_PREFIX/usr:g" -i src/$PKG_NAME-config

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="libgpg-error"
PKG_VERSION="1.27"
@ -10,9 +11,9 @@ PKG_URL="https://www.gnupg.org/ftp/gcrypt/libgpg-error/$PKG_NAME-$PKG_VERSION.ta
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="A library that defines common error values for all GnuPG components."
pre_configure_target() {
PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC --enable-static --disable-shared --disable-nls --disable-rpath --with-gnu-ld --with-pic"
pre_configure_target() {
# inspired by openembedded
case ${TARGET_ARCH} in
aarch64)

View File

@ -15,18 +15,6 @@ PKG_LONGDESC="BusyBox combines tiny versions of many common UNIX utilities into
# busybox fails to build with GOLD support enabled with binutils-2.25
PKG_BUILD_FLAGS="-parallel -gold"
PKG_MAKE_OPTS_HOST="ARCH=$TARGET_ARCH CROSS_COMPILE= KBUILD_VERBOSE=1 install"
PKG_MAKE_OPTS_TARGET="ARCH=$TARGET_ARCH \
HOSTCC=$HOST_CC \
CROSS_COMPILE=$TARGET_PREFIX \
KBUILD_VERBOSE=1 \
install"
PKG_MAKE_OPTS_INIT="ARCH=$TARGET_ARCH \
HOSTCC=$HOST_CC \
CROSS_COMPILE=$TARGET_PREFIX \
KBUILD_VERBOSE=1 \
install"
# nano text editor
if [ "$NANO_EDITOR" = "yes" ]; then
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET nano"
@ -38,16 +26,30 @@ if [ "$NFS_SUPPORT" = yes ]; then
fi
pre_build_target() {
PKG_MAKE_OPTS_TARGET="ARCH=$TARGET_ARCH \
HOSTCC=$HOST_CC \
CROSS_COMPILE=$TARGET_PREFIX \
KBUILD_VERBOSE=1 \
install"
mkdir -p $PKG_BUILD/.$TARGET_NAME
cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME
}
pre_build_host() {
PKG_MAKE_OPTS_HOST="ARCH=$TARGET_ARCH CROSS_COMPILE= KBUILD_VERBOSE=1 install"
mkdir -p $PKG_BUILD/.$HOST_NAME
cp -RP $PKG_BUILD/* $PKG_BUILD/.$HOST_NAME
}
pre_build_init() {
PKG_MAKE_OPTS_INIT="ARCH=$TARGET_ARCH \
HOSTCC=$HOST_CC \
CROSS_COMPILE=$TARGET_PREFIX \
KBUILD_VERBOSE=1 \
install"
mkdir -p $PKG_BUILD/.$TARGET_NAME-init
cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME-init
}

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="diskdev_cmds"
PKG_VERSION="332.14"
@ -10,9 +11,9 @@ PKG_URL="http://www.opensource.apple.com/tarballs/diskdev_cmds/$PKG_NAME-$PKG_VE
PKG_DEPENDS_TARGET="toolchain openssl"
PKG_LONGDESC="The fsck and mkfs utliities for hfs and hfsplus filesystems."
pre_make_target() {
PKG_MAKE_OPTS_TARGET="-f Makefile.lnx CC=$CC"
pre_make_target() {
export CFLAGS="$TARGET_CFLAGS -g3 -Wall -I$PKG_BUILD/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1"
}

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="e2fsprogs"
PKG_VERSION="1.43.9"
@ -20,6 +21,7 @@ PKG_CONFIGURE_OPTS_HOST="--prefix=$TOOLCHAIN/ \
--bindir=$TOOLCHAIN/bin \
--sbindir=$TOOLCHAIN/sbin"
pre_configure_target() {
PKG_CONFIGURE_OPTS_TARGET="BUILD_CC=$HOST_CC \
--enable-verbose-makecmds \
--enable-symlink-install \
@ -43,9 +45,13 @@ PKG_CONFIGURE_OPTS_TARGET="BUILD_CC=$HOST_CC \
--disable-rpath \
--disable-fuse2fs \
--with-gnu-ld"
}
pre_configure_init() {
pkg_call pre_configure_target || die "pre_configure_target not found"
PKG_CONFIGURE_OPTS_INIT="$PKG_CONFIGURE_OPTS_TARGET"
}
post_makeinstall_target() {
make -C lib/et LIBMODE=644 DESTDIR=$SYSROOT_PREFIX install

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="tz"
PKG_VERSION="2018c"
@ -10,7 +11,9 @@ PKG_URL="https://github.com/eggert/tz/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="Time zone and daylight-saving time data."
pre_configure_target() {
PKG_MAKE_OPTS_TARGET="CC=$HOST_CC LDFLAGS="
}
makeinstall_target() {
make TZDIR="$INSTALL/usr/share/zoneinfo" REDO=posix_only TOPDIR="$INSTALL" install

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="v86d"
PKG_VERSION="0.1.10"
@ -11,9 +12,9 @@ PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2"
PKG_DEPENDS_INIT="toolchain gcc:init"
PKG_LONGDESC="v86d is the userspace helper that runs x86 code in an emulated environment."
pre_configure_init() {
INIT_CONFIGURE_OPTS="--with-x86emu"
pre_configure_init() {
# v86d fails to build in subdirs
cd $PKG_BUILD
rm -rf .$TARGET_NAME-init

View File

@ -2,8 +2,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
. config/options $1
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
mkdir -p $RELEASE_DIR/3rdparty/bootloader
cp -PR $BUILD/bcm2835-bootloader-*/LICENCE* $RELEASE_DIR/3rdparty/bootloader/

View File

@ -12,6 +12,7 @@ PKG_DEPENDS_TARGET="toolchain flex freetype:host"
PKG_LONGDESC="GRUB is a Multiboot boot loader."
PKG_TOOLCHAIN="configure"
pre_configure_target() {
PKG_CONFIGURE_OPTS_TARGET="--target=i386-pc-linux \
--disable-nls \
--with-platform=efi"
@ -20,9 +21,8 @@ PKG_CONFIGURE_OPTS_TARGET="--target=i386-pc-linux \
unset CPPFLAGS
unset CXXFLAGS
unset LDFLAGS
pre_configure_target() {
unset CPP
cd $PKG_BUILD
./autogen.sh
}

View File

@ -10,6 +10,7 @@ PKG_URL="https://download.qemu.org/qemu-$PKG_VERSION.tar.xz"
PKG_DEPENDS_HOST="toolchain glib:host pixman:host Python2:host zlib:host"
PKG_LONGDESC="QEMU is a generic and open source machine emulator and virtualizer."
pre_configure_host() {
HOST_CONFIGURE_OPTS="--bindir=$TOOLCHAIN/bin \
--extra-cflags=-I$TOOLCHAIN/include \
--extra-ldflags=-L$TOOLCHAIN/lib \
@ -26,3 +27,4 @@ HOST_CONFIGURE_OPTS="--bindir=$TOOLCHAIN/bin \
--disable-user \
--disable-vnc \
--disable-werror"
}

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="syslinux"
PKG_VERSION="6.03"
@ -12,6 +13,7 @@ PKG_DEPENDS_HOST="util-linux:host"
PKG_DEPENDS_TARGET="toolchain util-linux e2fsprogs syslinux:host"
PKG_LONGDESC="The SYSLINUX project covers lightweight linux bootloaders."
pre_configure_target() {
PKG_MAKE_OPTS_TARGET="CC=$CC AR=$AR RANLIB=$RANLIB installer"
# Unset all compiler FLAGS
@ -19,6 +21,7 @@ PKG_MAKE_OPTS_TARGET="CC=$CC AR=$AR RANLIB=$RANLIB installer"
unset CPPFLAGS
unset CXXFLAGS
unset LDFLAGS
}
pre_build_target() {
mkdir -p $PKG_BUILD/.$TARGET_NAME

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="initramfs"
PKG_VERSION=""
@ -15,8 +16,6 @@ if [ "$ISCSI_SUPPORT" = yes ]; then
fi
if [ "$INITRAMFS_PARTED_SUPPORT" = yes ]; then
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET util-linux:init"
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET e2fsprogs:init"
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET parted:init"
fi

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="libpciaccess"
PKG_VERSION="0.14"
@ -10,8 +11,10 @@ PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSI
PKG_DEPENDS_TARGET="toolchain util-macros zlib"
PKG_LONGDESC="X.org libpciaccess library."
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_asm_mtrr_h=set \
--with-pciids-path=/usr/share \
--with-zlib "
pre_configure_target() {
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
}

View File

@ -3,7 +3,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
. config/options $1
mkdir -p $RELEASE_DIR/3rdparty/bootloader
cp -a $INSTALL/usr/share/bootloader/* $RELEASE_DIR/3rdparty/bootloader

View File

@ -4,29 +4,29 @@
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
. config/options $1
if [ "$1" = "--all" ]; then
if [ -n "$2" ]; then
for build_dir in $(ls -1d ${ROOT}/build.*); do
load_build_config ${build_dir} && ./scripts/build $2
done
fi
exit 0
fi
. config/options "$1"
if [ -z "$1" ]; then
die "usage: $0 package_name[:<host|target|init|bootstrap>]"
fi
if [ ! -f $PKG_DIR/package.mk ]; then
die "$(print_color CLR_ERROR "$1: no package.mk file found")"
if [ "$1" = "--all" ]; then
if [ -n "$2" ]; then
for build_dir in $(ls -1d ${ROOT}/build.*); do
load_build_config ${build_dir} && ${SCRIPTS}/build "$2"
done
fi
exit 0
fi
# set defaults
PKG_CONFIGURE_SCRIPT=""
PKG_MAKE_OPTS=""
PKG_MAKEINSTALL_OPTS=""
if [ -z "${PKG_NAME}" ]; then
die "$(print_color CLR_ERROR "${1}: no package.mk file found")"
fi
if [ -n "$PKG_ARCH" ]; then
listcontains "$PKG_ARCH" "!$TARGET_ARCH" && exit 0
listcontains "$PKG_ARCH" "$TARGET_ARCH" || listcontains "$PKG_ARCH" "any" || exit 0
fi
if [ "${1//:/}" != "${1}" ]; then
PACKAGE_NAME="${1%:*}"
@ -37,18 +37,8 @@ else
fi
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
unset INSTALL
mkdir -p $STAMPS/$PACKAGE_NAME
STAMP=$STAMPS/$PACKAGE_NAME/build_$TARGET
$SCRIPTS/unpack $PACKAGE_NAME
if [ -f $STAMP ]; then
. $STAMP
PKG_DEEPHASH=$(calculate_stamp)
@ -58,62 +48,57 @@ if [ -f $STAMP ] ; then
rm -f $STAMP
elif [ "$1" = "u-boot" -a ! "$UBOOT_SYSTEM" = "$STAMP_UBOOT_SYSTEM" ]; then
rm -f $STAMP
else
# stamp matched: already built, do nothing
exit 0
fi
fi
if [ -f $STAMP ]; then
# already build, do nothing
$SCRIPTS/unpack $PACKAGE_NAME
# build dependencies, only when PKG_DEPENDS_? is filled
unset _pkg_depends
case "$TARGET" in
"target") _pkg_depends="$PKG_DEPENDS_TARGET";;
"host") _pkg_depends="$PKG_DEPENDS_HOST";;
"init") _pkg_depends="$PKG_DEPENDS_INIT";;
"bootstrap") _pkg_depends="$PKG_DEPENDS_BOOTSTRAP";;
esac
for p in $_pkg_depends; do
$SCRIPTS/build $p
done
# build this package
if [ "${BUILD_WITH_DEBUG}" = "yes" ]; then
build_msg "CLR_BUILD" "BUILD" "${PACKAGE_NAME} $(print_color "CLR_TARGET" "(${TARGET})") [DEBUG]" "indent"
else
build_msg "CLR_BUILD" "BUILD" "${PACKAGE_NAME} $(print_color "CLR_TARGET" "(${TARGET})")" "indent"
fi
# virtual packages are not built as they only contain dependencies, so dont go further here
if [ "$PKG_SECTION" = "virtual" ]; then
PKG_DEEPHASH=$(calculate_stamp)
for i in PKG_NAME PKG_DEEPHASH BUILD_WITH_DEBUG; do
echo "STAMP_$i=\"${!i}\"" >> $STAMP
done
exit 0
fi
rm -f $STAMP
setup_toolchain $TARGET
# unset functions
unset -f configure_package
unset -f pre_build_target
unset -f pre_configure_target
unset -f configure_target
unset -f post_configure_target
unset -f pre_make_target
unset -f make_target
unset -f post_make_target
unset -f pre_makeinstall_target
unset -f makeinstall_target
unset -f post_makeinstall_target
unset -f pre_build_host
unset -f pre_configure_host
unset -f configure_host
unset -f post_configure_host
unset -f pre_make_host
unset -f make_host
unset -f post_make_host
unset -f pre_makeinstall_host
unset -f makeinstall_host
unset -f post_makeinstall_host
unset -f pre_build_init
unset -f pre_configure_init
unset -f configure_init
unset -f post_configure_init
unset -f pre_make_init
unset -f make_init
unset -f post_make_init
unset -f pre_makeinstall_init
unset -f makeinstall_init
unset -f post_makeinstall_init
unset -f pre_build_bootstrap
unset -f pre_configure_bootstrap
unset -f configure_bootstrap
unset -f post_configure_bootstrap
unset -f pre_make_bootstrap
unset -f make_bootstrap
unset -f post_make_bootstrap
unset -f pre_makeinstall_bootstrap
unset -f makeinstall_bootstrap
unset -f post_makeinstall_bootstrap
# configure install directory
if [ "$TARGET" = "target" ]; then
INSTALL="$PKG_BUILD/.install_pkg"
elif [ "$TARGET" = "init" ]; then
INSTALL="$PKG_BUILD/.install_init"
else
unset INSTALL
fi
# remove previous install files
if [ -n "$INSTALL" -a -d "$INSTALL" ]; then
rm -rf "$INSTALL"
fi
# configure debug build defaults
if [ "${BUILD_WITH_DEBUG}" = "yes" ]; then
@ -124,6 +109,9 @@ else
MESON_BUILD_TYPE="plain"
fi
CMAKE_GENERATOR_NINJA="-GNinja \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
# configure TARGET build defaults
TARGET_CONFIGURE_OPTS="--host=$TARGET_NAME \
--build=$HOST_NAME \
@ -137,9 +125,6 @@ TARGET_CONFIGURE_OPTS="--host=$TARGET_NAME \
--disable-static \
--enable-shared"
CMAKE_GENERATOR_NINJA="-GNinja \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
TARGET_CMAKE_OPTS="-DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE"
@ -188,62 +173,10 @@ BOOTSTRAP_CONFIGURE_OPTS="$HOST_CONFIGURE_OPTS"
BOOTSTRAP_CMAKE_OPTS="$HOST_CMAKE_OPTS"
BOOTSTRAP_MESON_OPTS="$HOST_MESON_OPTS"
# include buildfile
. $PKG_DIR/package.mk
# finalise package configuration
pkg_call_optional configure_package
# build dependencies, only when PKG_DEPENDS_? is filled
unset _pkg_depends
case "$TARGET" in
"target") _pkg_depends="$PKG_DEPENDS_TARGET";;
"host") _pkg_depends="$PKG_DEPENDS_HOST";;
"init") _pkg_depends="$PKG_DEPENDS_INIT";;
"bootstrap") _pkg_depends="$PKG_DEPENDS_BOOTSTRAP";;
esac
for p in $_pkg_depends; do
$SCRIPTS/build $p
done
if [ "${BUILD_WITH_DEBUG}" = "yes" ]; then
build_msg "CLR_BUILD" "BUILD" "${PACKAGE_NAME} $(print_color "CLR_TARGET" "(${TARGET})") [DEBUG]" "indent"
else
build_msg "CLR_BUILD" "BUILD" "${PACKAGE_NAME} $(print_color "CLR_TARGET" "(${TARGET})")" "indent"
fi
# virtual packages dont must be build, they only contains dependencies, so dont go further here
if [ "$PKG_SECTION" = "virtual" ]; then
PKG_DEEPHASH=$(calculate_stamp)
for i in PKG_NAME PKG_DEEPHASH BUILD_WITH_DEBUG; do
echo "STAMP_$i=\"${!i}\"" >> $STAMP
done
exit 0
fi
# configure other variables
if [ "$TARGET" = "target" ]; then
INSTALL="$PKG_BUILD/.install_pkg"
elif [ "$TARGET" = "init" ]; then
INSTALL="$PKG_BUILD/.install_init"
fi
# clear previous image files
if [ -n "$INSTALL" -a -d "$INSTALL" ]; then
rm -rf "$INSTALL"
fi
# setup configure scripts
if [ -z "$PKG_CONFIGURE_SCRIPT" ]; then
PKG_CONFIGURE_SCRIPT="$PKG_BUILD/configure"
else
PKG_CONFIGURE_SCRIPT="$PKG_BUILD/$PKG_CONFIGURE_SCRIPT"
fi
PKG_CMAKE_SCRIPT="${PKG_CMAKE_SCRIPT:-$PKG_BUILD/CMakeLists.txt}"
PKG_MESON_SCRIPT="${PKG_MESON_SCRIPT:-$PKG_BUILD/meson.build}"
PKG_CONFIGURE_SCRIPT="${PKG_CONFIGURE_SCRIPT:-${PKG_BUILD}/configure}"
PKG_CMAKE_SCRIPT="${PKG_CMAKE_SCRIPT:-${PKG_BUILD}/CMakeLists.txt}"
PKG_MESON_SCRIPT="${PKG_MESON_SCRIPT:-${PKG_BUILD}/meson.build}"
# auto detect toolchain
_auto_toolchain=""
@ -516,7 +449,6 @@ PKG_DEEPHASH=$(calculate_stamp)
for i in PKG_NAME PKG_DEEPHASH BUILD_WITH_DEBUG; do
echo "STAMP_$i=\"${!i}\"" >> $STAMP
done
if [ "$1" = "u-boot" ]; then
echo "STAMP_UBOOT_SYSTEM=\"${UBOOT_SYSTEM}\"" >> $STAMP
fi

View File

@ -5,16 +5,25 @@
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
. config/options $1
. config/options "$1"
if [ -z "$1" ]; then
die "usage: $0 package_name"
fi
if [ -z "${PKG_NAME}" ]; then
die "$(print_color CLR_ERROR "${1}: no package.mk file found")"
fi
if [ -z "$INSTALL" ] ; then
die "error: '\$INSTALL' not set! this script is not intended to be run manually"
fi
if [ -n "$PKG_ARCH" ]; then
listcontains "$PKG_ARCH" "!$TARGET_ARCH" && exit 0
listcontains "$PKG_ARCH" "$TARGET_ARCH" || listcontains "$PKG_ARCH" "any" || exit 0
fi
# set defaults
if [ "${1//:/}" != "${1}" ]; then
PACKAGE_NAME="${1%:*}"
@ -26,23 +35,12 @@ fi
[ -z "$TARGET" ] && TARGET="target"
STAMP=$STAMPS_INSTALL/$PACKAGE_NAME/install_$TARGET
mkdir -p $STAMPS_INSTALL/$PACKAGE_NAME
[ -f $STAMP ] && exit 0
if [ -n "$PKG_ARCH" ]; then
listcontains "$PKG_ARCH" "!$TARGET_ARCH" && exit 0
listcontains "$PKG_ARCH" "$TARGET_ARCH" || listcontains "$PKG_ARCH" "any" || exit 0
fi
if [ ! -f $PKG_DIR/package.mk ]; then
die "$(print_color CLR_ERROR "${PACKAGE_NAME}: no package.mk file found")"
fi
mkdir -p $STAMPS_INSTALL/$PACKAGE_NAME
$SCRIPTS/build $@
build_msg "CLR_INSTALL" "INSTALL" "${PACKAGE_NAME} $(print_color CLR_TARGET "(${TARGET})")" "indent"
if [ "$TARGET" = target ] ; then
for p in $PKG_DEPENDS_TARGET; do
$SCRIPTS/install $p
@ -54,6 +52,8 @@ elif [ "$TARGET" = init ] ; then
INSTALL=$BUILD/initramfs
fi
build_msg "CLR_INSTALL" "INSTALL" "${PACKAGE_NAME} $(print_color CLR_TARGET "(${TARGET})")" "indent"
mkdir -p $INSTALL
if [ "$TARGET" = target ] ; then
@ -121,23 +121,14 @@ if [ "$TARGET" = target ] ; then
done
fi
# unset functions
unset -f pre_install
unset -f post_install
# include buildfile
. $PKG_DIR/package.mk
# install
if [ "$TARGET" = target ] ; then
pkg_call_optional pre_install
fi
if [ "$TARGET" = "target" -a -d $PKG_BUILD/.install_pkg ]; then
mkdir -p $INSTALL
cp -PR $PKG_BUILD/.install_pkg/* $INSTALL
elif [ "$TARGET" = "init" -a -d $PKG_BUILD/.install_init ]; then
mkdir -p $INSTALL
cp -PR $PKG_BUILD/.install_init/* $INSTALL
fi

View File

@ -1,93 +0,0 @@
#!/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

View File

@ -4,14 +4,14 @@
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
. config/options $1
. config/options "$1"
if [ -z "$1" ]; then
die "usage: $0 package_name"
fi
if [ ! -f $PKG_DIR/package.mk ]; then
die "$(print_color CLR_ERROR "$1: no package.mk file found")"
if [ -z "${PKG_NAME}" ]; then
die "$(print_color CLR_ERROR "${1}: no package.mk file found")"
fi
$SCRIPTS/get $1
@ -44,15 +44,6 @@ fi
if [ -d "$SOURCES/$1" -o -d "$PKG_DIR/sources" ]; then
build_msg "CLR_UNPACK" "UNPACK" "${1}" "indent"
# unset functions
unset -f pre_unpack
unset -f unpack
unset -f post_unpack
unset -f pre_patch
unset -f post_patch
. $PKG_DIR/package.mk
pkg_call_optional pre_unpack
if ! pkg_call unpack; then