[vlc-devel] [PATCH] extra: packages: add a Raspberry Pi build scripts

Steve Lhomme robux4 at ycbcr.xyz
Thu Jan 30 16:11:00 CET 2020


Tested cross compiling for armv7 with this docker image
https://code.videolan.org/robUx4/docker-images/commits/raspbian/2
---
 extras/package/raspberry/build.sh     | 169 ++++++++++++++++++++++++++
 extras/package/raspberry/configure.sh |  22 ++++
 2 files changed, 191 insertions(+)
 create mode 100755 extras/package/raspberry/build.sh
 create mode 100755 extras/package/raspberry/configure.sh

diff --git a/extras/package/raspberry/build.sh b/extras/package/raspberry/build.sh
new file mode 100755
index 00000000000..87d15797813
--- /dev/null
+++ b/extras/package/raspberry/build.sh
@@ -0,0 +1,169 @@
+#!/bin/sh
+
+set -e
+set -x
+
+info()
+{
+    local green="\033[1;32m"
+    local normal="\033[0m"
+    echo "[${green}build${normal}] $1"
+}
+
+usage()
+{
+cat << EOF
+usage: $0 [options]
+
+Build vlc in the current directory
+
+OPTIONS:
+   -h            Show some help
+   -r            Release mode (default is debug)
+   -a <arch>     Use the specified arch (default: arm, possible aarch64)
+   -p            Use a Prebuilt contrib package (speeds up compilation)
+   -c            Create a Prebuilt contrib package (rarely used)
+   -l            Enable translations (can be slow)
+   -s            Interactive shell (get correct environment variables for build)
+EOF
+}
+
+ARCH="arm"
+while getopts "hra:pcli:sd" OPTION
+do
+     case $OPTION in
+         h)
+             usage
+             exit 1
+         ;;
+         r)
+             RELEASE="yes"
+         ;;
+         a)
+             ARCH=$OPTARG
+         ;;
+         p)
+             PREBUILT="yes"
+         ;;
+         c)
+             PACKAGE="yes"
+         ;;
+         l)
+             I18N="yes"
+         ;;
+         s)
+             INTERACTIVE="yes"
+         ;;
+     esac
+done
+shift $(($OPTIND - 1))
+
+if [ "x$1" != "x" ]; then
+    usage
+    exit 1
+fi
+
+case $ARCH in
+    aarch64)
+        SHORTARCH="linuxarm64"
+        EABI="gnu"
+        ;;
+    arm)
+        SHORTARCH="linuxarm"
+        EABI="gnueabihf"
+        ;;
+    *)
+        usage
+        exit 1
+esac
+
+#####
+
+SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
+
+: ${JOBS:=$(getconf _NPROCESSORS_ONLN 2>&1)}
+TRIPLET=$ARCH-linux-$EABI
+
+info "Building extra tools"
+mkdir -p tools
+cd tools
+export PATH="$PWD/build/bin":"$PATH"
+if [ "$INTERACTIVE" != "yes" ] || [ ! -f ./Makefile ]; then
+    ${SCRIPT_PATH}/../../tools/bootstrap
+fi
+make -j$JOBS --output-sync=recurse
+cd ..
+
+export USE_FFMPEG=1
+
+if [ "$INTERACTIVE" = "yes" ]; then
+if [ "x$SHELL" != "x" ]; then
+    exec $SHELL
+else
+    exec /bin/sh
+fi
+fi
+
+info "Building contribs"
+
+mkdir -p contrib/contrib-$SHORTARCH && cd contrib/contrib-$SHORTARCH
+
+# issue with arm detection of the target (detects i686)
+CONTRIBFLAGS="$CONTRIBFLAGS --disable-x265"
+
+${SCRIPT_PATH}/../../../contrib/bootstrap --host=$TRIPLET $CONTRIBFLAGS
+
+# use the system headers for the OS and firmware
+export CFLAGS="$CFLAGS -mfpu=neon -I/usr/$TRIPLET/include -I/opt/vc/include"
+export CXXFLAGS="$CXXFLAGS -mfpu=neon -I/usr/$TRIPLET/include -I/opt/vc/include"
+export CPPFLAGS="$CPPFLAGS -mfpu=neon -I/usr/$TRIPLET/include -I/opt/vc/include"
+export LDFLAGS="$LDFLAGS -L/usr/$TRIPLET/lib -L/opt/vc/lib -L/usr/lib/$TRIPLET"
+
+# force the same compiler as current Raspbian binaries
+export CC="arm-linux-gnueabihf-gcc-8"
+export CXX="arm-linux-gnueabihf-g++-8"
+export AR="arm-linux-gnueabihf-gcc-ar-8"
+export RANLIB="arm-linux-gnueabihf-gcc-ranlib-8"
+
+export PKG_CONFIG=${TRIPLET}-pkg-config
+
+# Rebuild the contribs or use the prebuilt ones
+if [ "$PREBUILT" != "yes" ]; then
+make list
+make -j$JOBS --output-sync=recurse fetch
+make -j$JOBS --output-sync=recurse -k || make -j1
+if [ "$PACKAGE" = "yes" ]; then
+make package
+fi
+else
+make prebuilt
+fi
+cd ../..
+
+info "Bootstrapping"
+
+${SCRIPT_PATH}/../../../bootstrap
+
+info "Configuring VLC"
+mkdir $SHORTARCH || true
+cd $SHORTARCH
+
+if [ "$RELEASE" != "yes" ]; then
+     CONFIGFLAGS="$CONFIGFLAGS --enable-debug"
+else
+     CONFIGFLAGS="$CONFIGFLAGS --disable-debug"
+fi
+if [ "$I18N" != "yes" ]; then
+     CONFIGFLAGS="$CONFIGFLAGS --disable-nls"
+fi
+
+ac_cv_path_MOC="qtchooser -qt=qt5-$TRIPLET -run-tool=moc" \
+ac_cv_path_RCC="qtchooser -qt=qt5-$TRIPLET -run-tool=rcc" \
+ac_cv_path_UIC="qtchooser -qt=qt5-$TRIPLET -run-tool=uic" \
+${SCRIPT_PATH}/configure.sh --host=$TRIPLET --with-contrib=../contrib/$TRIPLET $CONFIGFLAGS \
+    CFLAGS="$CFLAGS  -Werror=incompatible-pointer-types -Werror=missing-field-initializers -g" \
+    CPPFLAGS="$CPPFLAGS -Werror=incompatible-pointer-types -Werror=missing-field-initializers -g" \
+    CXXFLAGS="$CXXFLAGS -Werror=missing-field-initializers -g"
+
+info "Compiling"
+make -j$JOBS
diff --git a/extras/package/raspberry/configure.sh b/extras/package/raspberry/configure.sh
new file mode 100755
index 00000000000..fa81c1e5259
--- /dev/null
+++ b/extras/package/raspberry/configure.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+OPTIONS="
+      --enable-mmal
+      --enable-lua
+      --enable-faad
+      --enable-flac
+      --enable-theora
+      --enable-avcodec --enable-merge-ffmpeg
+      --enable-dca
+      --enable-libass
+      --enable-schroedinger
+      --enable-live555
+      --enable-dvdread
+      --enable-shout
+      --enable-goom
+      --enable-libcddb
+      --enable-zvbi --disable-telx
+      --enable-nls
+"
+
+sh "$(dirname $0)"/../../../configure ${OPTIONS}  "$@"
-- 
2.17.1



More information about the vlc-devel mailing list