aboutsummaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rw-r--r--support/magicleap/Servo2D/Servo2D.mabu22
-rw-r--r--support/magicleap/Servo2D/code/src/Servo2D.cpp9
-rw-r--r--support/magicleap/Servo3D/Servo3D.mabu13
-rw-r--r--support/magicleap/gstreamer/.gitignore7
-rw-r--r--support/magicleap/gstreamer/README.md22
-rwxr-xr-xsupport/magicleap/gstreamer/gstreamer.sh100
-rw-r--r--support/magicleap/gstreamer/mlsdk.txt.in37
7 files changed, 209 insertions, 1 deletions
diff --git a/support/magicleap/Servo2D/Servo2D.mabu b/support/magicleap/Servo2D/Servo2D.mabu
index 43d6fe26b3f..9bf43347d6e 100644
--- a/support/magicleap/Servo2D/Servo2D.mabu
+++ b/support/magicleap/Servo2D/Servo2D.mabu
@@ -2,25 +2,45 @@ KIND = program
INCS = \
code/inc/ \
- code/inc.gen/
+ code/inc.gen/ \
+ $(GSTREAMER_DIR)/system/include/glib-2.0 \
+ $(GSTREAMER_DIR)/system/lib64/glib-2.0/include/ \
+ $(GSTREAMER_DIR)/system/include/gstreamer-1.0
SRCS = \
code/src/main.cpp \
code/src/Servo2D.cpp
LIBPATHS.debug = \
+ $(GSTREAMER_DIR)/system/lib64/ \
../../../target/magicleap/aarch64-linux-android/debug
LIBPATHS.release = \
+ $(GSTREAMER_DIR)/system/lib64/ \
../../../target/magicleap/aarch64-linux-android/release
LDFLAGS.device = \
-L$(MLSDK)/lumin/stl/libc++/lib
+DATAS = \
+ $(GSTREAMER_DIR)/system/lib64/*.so : bin/ \
+ $(GSTREAMER_DIR)/system/lib64/gstreamer-1.0/*.so : bin/
+
STLIBS = \
mlservo
SHLIBS = \
+ glib-2.0 \
+ gobject-2.0 \
+ gstreamer-1.0 \
+ gstapp-1.0 \
+ gstaudio-1.0 \
+ gstbase-1.0 \
+ gstgl-1.0 \
+ gstplayer-1.0 \
+ gstsdp-1.0 \
+ gstvideo-1.0 \
+ gstwebrtc-1.0 \
c++abi \
log \
z
diff --git a/support/magicleap/Servo2D/code/src/Servo2D.cpp b/support/magicleap/Servo2D/code/src/Servo2D.cpp
index 2ba1d3a17cb..768abbcae21 100644
--- a/support/magicleap/Servo2D/code/src/Servo2D.cpp
+++ b/support/magicleap/Servo2D/code/src/Servo2D.cpp
@@ -173,6 +173,15 @@ int Servo2D::init() {
EGLSurface surf = plane_->getEGLSurface();
EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ // Set up gstreamer
+ auto tmpdir = getTempPath();
+ auto bindir = getPackagePath() + "bin";
+ auto registry = getWritablePath() + "gstreamer-registry.bin";
+ setenv("GIO_MODULE_DIR", bindir.c_str(), 1);
+ setenv("GST_PLUGIN_SYSTEM_PATH", bindir.c_str(), 1);
+ setenv("GST_REGISTRY", registry.c_str(), 1);
+ setenv("XDG_CACHE_HOME", tmpdir.c_str(), 1);
+
// Hook into servo
servo_ = init_servo(ctx, surf, dpy, true,
this, logger, history, url, keyboard, uri_, args_,
diff --git a/support/magicleap/Servo3D/Servo3D.mabu b/support/magicleap/Servo3D/Servo3D.mabu
index 4cd3aa1dbed..fe13b3bea31 100644
--- a/support/magicleap/Servo3D/Servo3D.mabu
+++ b/support/magicleap/Servo3D/Servo3D.mabu
@@ -6,9 +6,11 @@ SRCS = \
USES = ml_sdk
LIBPATHS.debug = \
+ $(GSTREAMER_DIR)/system/lib64 \
../../../target/magicleap/aarch64-linux-android/debug
LIBPATHS.release = \
+ $(GSTREAMER_DIR)/system/lib64 \
../../../target/magicleap/aarch64-linux-android/release
LIBPATHS.device = \
@@ -18,6 +20,17 @@ STLIBS = \
mlservo
SHLIBS = \
+ glib-2.0 \
+ gobject-2.0 \
+ gstreamer-1.0 \
+ gstapp-1.0 \
+ gstaudio-1.0 \
+ gstbase-1.0 \
+ gstgl-1.0 \
+ gstplayer-1.0 \
+ gstsdp-1.0 \
+ gstvideo-1.0 \
+ gstwebrtc-1.0 \
c++ \
ml_privileges \
log \
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']