mirror of
https://github.com/servo/servo.git
synced 2025-07-25 16:20:36 +01:00
Added gstreamer support to the magicleap port
This commit is contained in:
parent
555fa75b2c
commit
11b3d78f40
11 changed files with 246 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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_,
|
||||
|
|
|
@ -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 \
|
||||
|
|
7
support/magicleap/gstreamer/.gitignore
vendored
Normal file
7
support/magicleap/gstreamer/.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
*.tar.gz
|
||||
*.tgz
|
||||
_build
|
||||
_install
|
||||
gst-build
|
||||
libiconv-1.16
|
||||
mlsdk.txt
|
22
support/magicleap/gstreamer/README.md
Normal file
22
support/magicleap/gstreamer/README.md
Normal file
|
@ -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
|
100
support/magicleap/gstreamer/gstreamer.sh
Executable file
100
support/magicleap/gstreamer/gstreamer.sh
Executable file
|
@ -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
|
37
support/magicleap/gstreamer/mlsdk.txt.in
Normal file
37
support/magicleap/gstreamer/mlsdk.txt.in
Normal file
|
@ -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']
|
Loading…
Add table
Add a link
Reference in a new issue