#!/bin/bash
set -x
CLEAN="$1"
# construction zone ahead
#
# Install either one of these
#sudo apt install g++-aarch64-linux-gnu
# must adjust the CC and GXX variables (e.g. gcc-9):
#sudo apt install g++-9-aarch64-linux-gnu
#sudo apt install g++-10-aarch64-linux-gnu
export ARCH=arm64
export CROSS_COMPILE="/usr/bin/aarch64-linux-gnu-"
HERE=${PWD}
SYSROOT="${HERE}/arm64_ubuntu_focal_sysroot"
DESTDIR="${HERE}/DestDir"
PKG_CONFIG_LIBDIR="${DESTDIR}/usr/local/lib/pkgconfig"
PKG_CONFIG_LIBDIR+=":${SYSROOT}/usr/lib/aarch64-linux-gnu/pkgconfig"
PKG_CONFIG_LIBDIR+=":${SYSROOT}/usr/lib/pkgconfig"
export PKG_CONFIG_LIBDIR
#BUILDPARAM="CROSS_COMPILE=${CROSS_COMPILE} SYSROOT=${SYSROOT}"
BUILDPARAM="SYSROOT=${SYSROOT}"
BUILDPARAM+=" DESTDIR=${DESTDIR}"
BUILDPARAM+=" SDNOTIFY=1"
# enable next line to see more details
#BUILDPARAM+=" VERBOSE=1"
#export CC=${CROSS_COMPILE}gcc
export CC=${CROSS_COMPILE}g++
export CXX=${CROSS_COMPILE}g++
ResultDir=${HERE}/Result
log=$ResultDir/vdr.log
mkdir -p $ResultDir/PLUGINS
mkdir -p $DESTDIR
#MAKEINCLUDEDIRS="--include-dir=${HERE} --include-dir=."
VDRTARGETS="all install"
VDR="vdr-2.6.1"
PLUGINS=""
PLUGINS+=" vdr-plugin-satip-2.4.1"
PLUGINS+=" vdr-plugin-softhdodroid"
#PLUGINS+=" vdr-plugin-softhddevice-drm"
PLUGINS+=" vdr-plugin-devstatus-0.4.1"
PLUGINS+=" vdr-plugin-extrecmenu-2.0.11"
PLUGINS+=" vdr-plugin-live-2.3.1+git20170623.4.6335b64"
PLUGINS+=" vdr-plugin-mousemate-0.1.7"
PLUGINS+=" vdr-plugin-pulsecontrol-0.2.1"
#PLUGINS+=" vdr-plugin-streamdev-0.6.3"
# ensure our Make.config is used
cp Make.config $VDR/Make.config
CallMake()
{ local src=$1 local makeargs="$2" local targets="$3" local logextra="$4" shift; shift; shift; shift local optional=$@ # if [ -n "$CLEAN" ]; then # make -C $src clean # fi local log=$src$logextra # ensure we get the exit status even when piped set -o pipefail make -j6 -C $src $makeargs $optional $targets 2>&1 | tee $ResultDir/$log.log
}
# Remove our destination directory only once
if [ -n "$CLEAN" ]; then rm -r ${DESTDIR} rm -r ${ResultDir}/*.log rm -r ${ResultDir}/PLUGINS/*.log make -C $VDR distclean for i in $PLUGINS; do make -j6 -C PLUGINS/$i clean done exit
fi
# Build vdr
CallMake $VDR "$BUILDPARAM" "$VDRTARGETS" exit
# Install vdr dev files into our sysroot so the plugins can find the headers and vdr.pc
CallMake $VDR "$BUILDPARAM DESTDIR=${SYSROOT}" "install-pc install-includes" "_install" #|| exit
# Build plugins from manual list
for i in $PLUGINS; do CallMake PLUGINS/$i "$BUILDPARAM" # exit
done
Alles Snapshots, ohne Gewähr. Verbessungsidden sind sehr willkommen.
Warum ich das mache? Weil ichs will Habe seit ~2004 im Job viele Projekt per cross compile gebaut.
Jetzt bin ich Rentner.