diff options
Diffstat (limited to 'support/magicleap/gstreamer')
-rw-r--r-- | support/magicleap/gstreamer/.gitignore | 7 | ||||
-rw-r--r-- | support/magicleap/gstreamer/README.md | 22 | ||||
-rwxr-xr-x | support/magicleap/gstreamer/gstreamer.sh | 100 | ||||
-rw-r--r-- | support/magicleap/gstreamer/mlsdk.txt.in | 37 |
4 files changed, 166 insertions, 0 deletions
diff --git a/support/magicleap/gstreamer/.gitignore b/support/magicleap/gstreamer/.gitignore new file mode 100644 index 00000000000..7bfad2c963c --- /dev/null +++ b/support/magicleap/gstreamer/.gitignore @@ -0,0 +1,7 @@ +*.tar.gz +*.tgz +_build +_install +gst-build +libiconv-1.16 +mlsdk.txt diff --git a/support/magicleap/gstreamer/README.md b/support/magicleap/gstreamer/README.md new file mode 100644 index 00000000000..2ec4e1ac5f5 --- /dev/null +++ b/support/magicleap/gstreamer/README.md @@ -0,0 +1,22 @@ +# Building the binary .tgz for magicleap gstreamer + +`mach` downloads prebuilt gstreamer libaries, which are built using this script. + +# Requirements +- Magic Leap SDK >= 0.22.0 for MacOSX + * Download from https://creator.magicleap.com/downloads/lumin-sdk/overview + * Install both `Lumin SDK` and `Lumin Runtime SDK` packages +- An application certificate + * Create one on https://creator.magicleap.com in `publish` section + +# Setup MacOSX +- Install python3 and HomeBrew +- pip3 install git+https://github.com/mesonbuild/meson.git + * Requires Meson >=0.52.0, currently only in git master. +- brew install coreutils glib bison +- export PATH=/usr/local/opt/gettext/bin:/usr/local/opt/bison/bin:$PATH + +# Build Instructions +- export MAGICLEAP_SDK=/path/to/mlsdk +- export MLCERT=/path/to/application.cert +- ./gstreamer.sh diff --git a/support/magicleap/gstreamer/gstreamer.sh b/support/magicleap/gstreamer/gstreamer.sh new file mode 100755 index 00000000000..b700bb11900 --- /dev/null +++ b/support/magicleap/gstreamer/gstreamer.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +set -o errexit +set -o nounset +set -o pipefail + +SOURCE_DIR=gst-build +BUILD_DIR=_build +INSTALL_DIR=_install +INSTALL_REAL_DIR=$(realpath ${INSTALL_DIR}) +ARCHIVE=gstreamer-magicleap-1.16.0-$(date +"%Y%m%d-%H%M%S").tgz + +function build_and_install() +{ + ninja -C ${BUILD_DIR} + DESTDIR=${INSTALL_REAL_DIR} meson install -C ${BUILD_DIR} --only-changed + echo Creating archive ${ARCHIVE}. + tar czf ${ARCHIVE} -C ${INSTALL_DIR} system +} + +if [[ "${1:-}" == "--build-only" ]]; then + build_and_install + exit +fi + +rm -rf ${BUILD_DIR} +rm -rf ${INSTALL_DIR} + +# FIXME: Download, build and install GNU libiconv because MLSDK has an old +# version of bionic that does not include iconv. +ICONV_NAME=libiconv-1.16 +if [[ ! -d ${ICONV_NAME} ]]; then + curl -O -L https://ftp.gnu.org/pub/gnu/libiconv/${ICONV_NAME}.tar.gz + tar xzf ${ICONV_NAME}.tar.gz +fi +mkdir -p ${BUILD_DIR}/${ICONV_NAME} +HOST=aarch64-linux-android +SYSROOT=${MAGICLEAP_SDK}/lumin/usr + +cd ${BUILD_DIR}/${ICONV_NAME} +env CFLAGS=--sysroot=${SYSROOT} \ + CPPFLAGS=--sysroot=${SYSROOT} \ + CC=${MAGICLEAP_SDK}/tools/toolchains/bin/${HOST}-clang \ + AR=${MAGICLEAP_SDK}/tools/toolchains/bin/${HOST}-ar \ + RANLIB=${MAGICLEAP_SDK}/tools/toolchains/bin/${HOST}-ranlib \ + ../../${ICONV_NAME}/configure --host=${HOST} \ + --with-sysroot=${SYSROOT} \ + --prefix /system \ + --libdir /system/lib64 +cd ../.. +make -C ${BUILD_DIR}/${ICONV_NAME} +DESTDIR=${INSTALL_REAL_DIR} make -C ${BUILD_DIR}/${ICONV_NAME} install + +# Clone custom repo/branch of gst-build +if [[ ! -d ${SOURCE_DIR} ]]; then + git clone https://gitlab.freedesktop.org/xclaesse/gst-build.git --branch magicleap ${SOURCE_DIR} +fi + +# Generate cross file by replacing the MLSDK location +cat mlsdk.txt.in | sed s#@MAGICLEAP_SDK@#${MAGICLEAP_SDK}# \ + | sed s#@INSTALL_DIR@#${INSTALL_REAL_DIR}# > mlsdk.txt + +meson --cross-file mlsdk.txt \ + --prefix /system \ + --libdir lib64 \ + --libexecdir bin \ + -Db_pie=true \ + -Dcpp_std=c++11 \ + -Dpython=disabled \ + -Dlibav=disabled \ + -Ddevtools=disabled \ + -Dges=disabled \ + -Drtsp_server=disabled \ + -Domx=disabled \ + -Dvaapi=disabled \ + -Dsharp=disabled \ + -Dexamples=disabled \ + -Dgtk_doc=disabled \ + -Dintrospection=disabled \ + -Dnls=disabled \ + -Dbad=enabled \ + -Dgst-plugins-base:gl=enabled \ + -Dgst-plugins-base:gl_platform=egl \ + -Dgst-plugins-base:gl_winsys=android \ + -Dgst-plugins-good:soup=enabled \ + -Dgst-plugins-bad:gl=enabled \ + -Dgst-plugins-bad:magicleap=enabled \ + -Dgst-plugins-bad:dash=enabled \ + -Dglib:iconv=gnu \ + -Dlibsoup:gssapi=false \ + -Dlibsoup:tls_check=false \ + -Dlibsoup:vapi=false \ + ${BUILD_DIR} \ + ${SOURCE_DIR} + +build_and_install diff --git a/support/magicleap/gstreamer/mlsdk.txt.in b/support/magicleap/gstreamer/mlsdk.txt.in new file mode 100644 index 00000000000..057bc9b30b0 --- /dev/null +++ b/support/magicleap/gstreamer/mlsdk.txt.in @@ -0,0 +1,37 @@ +[host_machine] +system = 'android' +cpu_family = 'aarch64' +cpu = 'armv8-a' +endian = 'little' + +[properties] +c_args = [ + '--sysroot=@MAGICLEAP_SDK@/lumin/usr', + '-I@MAGICLEAP_SDK@/include', + '-I@MAGICLEAP_SDK@/staging/include', + '-I@INSTALL_DIR@/system/include', + ] +cpp_args = [ + '--sysroot=@MAGICLEAP_SDK@/lumin/usr', + '-I@MAGICLEAP_SDK@/include', + '-I@MAGICLEAP_SDK@/staging/include', + '-I@INSTALL_DIR@/system/include', + ] +c_link_args = [ + '--sysroot=@MAGICLEAP_SDK@/lumin/usr', + '-L@MAGICLEAP_SDK@/lib/lumin', + '-L@INSTALL_DIR@/system/lib64', + '-fuse-ld=gold' + ] +cpp_link_args = [ + '--sysroot=@MAGICLEAP_SDK@/lumin/usr', + '-L@MAGICLEAP_SDK@/lib/lumin', + '-L@INSTALL_DIR@/system/lib64', + '-fuse-ld=gold' + ] + +[binaries] +c = ['ccache', '@MAGICLEAP_SDK@/tools/toolchains/bin/aarch64-linux-android-clang'] +cpp = ['ccache', '@MAGICLEAP_SDK@/tools/toolchains/bin/aarch64-linux-android-clang++'] +ar = ['@MAGICLEAP_SDK@/tools/toolchains/bin/aarch64-linux-android-ar'] +strip = ['@MAGICLEAP_SDK@/tools/toolchains/bin/aarch64-linux-android-strip'] |