mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -85,10 +85,10 @@ webxr-api = {git = "https://github.com/servo/webxr"}
|
||||||
[target.'cfg(all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_arch="arm"), not(target_arch="aarch64")))'.dependencies]
|
[target.'cfg(all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_arch="arm"), not(target_arch="aarch64")))'.dependencies]
|
||||||
gaol = {git = "https://github.com/servo/gaol"}
|
gaol = {git = "https://github.com/servo/gaol"}
|
||||||
|
|
||||||
[target.'cfg(all(not(target_os = "windows"), any(all(target_os = "android", target_arch = "arm"), target_arch = "x86_64")))'.dependencies.servo-media-gstreamer]
|
[target.'cfg(all(not(target_os = "windows"), any(target_os = "android", target_arch = "x86_64")))'.dependencies.servo-media-gstreamer]
|
||||||
git = "https://github.com/servo/media"
|
git = "https://github.com/servo/media"
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "windows", not(any(all(target_os = "android", target_arch = "arm"), target_arch = "x86_64"))))'.dependencies.servo-media-dummy]
|
[target.'cfg(any(target_os = "windows", not(any(target_os = "android", target_arch = "x86_64"))))'.dependencies.servo-media-dummy]
|
||||||
git = "https://github.com/servo/media"
|
git = "https://github.com/servo/media"
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
|
|
|
@ -127,10 +127,7 @@ pub use servo_url as url;
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
not(target_os = "windows"),
|
not(target_os = "windows"),
|
||||||
any(
|
any(target_os = "android", target_arch = "x86_64",)
|
||||||
all(target_os = "android", target_arch = "arm"),
|
|
||||||
target_arch = "x86_64",
|
|
||||||
)
|
|
||||||
))]
|
))]
|
||||||
mod media_platform {
|
mod media_platform {
|
||||||
use super::ServoMedia;
|
use super::ServoMedia;
|
||||||
|
@ -211,10 +208,7 @@ mod media_platform {
|
||||||
|
|
||||||
#[cfg(not(all(
|
#[cfg(not(all(
|
||||||
not(target_os = "windows"),
|
not(target_os = "windows"),
|
||||||
any(
|
any(target_os = "android", target_arch = "x86_64",)
|
||||||
all(target_os = "android", target_arch = "arm"),
|
|
||||||
target_arch = "x86_64",
|
|
||||||
)
|
|
||||||
)))]
|
)))]
|
||||||
mod media_platform {
|
mod media_platform {
|
||||||
use super::ServoMedia;
|
use super::ServoMedia;
|
||||||
|
|
|
@ -583,6 +583,11 @@ class MachCommands(CommandBase):
|
||||||
env.setdefault("OPENSSL_VERSION", "1.0.2k")
|
env.setdefault("OPENSSL_VERSION", "1.0.2k")
|
||||||
env.setdefault("OPENSSL_STATIC", "1")
|
env.setdefault("OPENSSL_STATIC", "1")
|
||||||
|
|
||||||
|
# GStreamer configuration
|
||||||
|
env.setdefault("GSTREAMER_DIR", path.join(target_path, target, "native", "gstreamer-1.16.0"))
|
||||||
|
env.setdefault("GSTREAMER_URL", "https://servo-deps.s3.amazonaws.com/gstreamer/gstreamer-magicleap-1.16.0-20190808-110815.tgz")
|
||||||
|
env.setdefault("PKG_CONFIG_PATH", path.join(env["GSTREAMER_DIR"], "system", "lib64", "pkgconfig"))
|
||||||
|
|
||||||
# Override the linker set in .cargo/config
|
# Override the linker set in .cargo/config
|
||||||
env.setdefault("CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER", path.join(ml_support, "fake-ld.sh"))
|
env.setdefault("CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER", path.join(ml_support, "fake-ld.sh"))
|
||||||
|
|
||||||
|
@ -594,6 +599,28 @@ class MachCommands(CommandBase):
|
||||||
if status:
|
if status:
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
# Download prebuilt Gstreamer if necessary
|
||||||
|
if not os.path.exists(path.join(env["GSTREAMER_DIR"], "system")):
|
||||||
|
if not os.path.exists(env["GSTREAMER_DIR"] + ".tgz"):
|
||||||
|
check_call([
|
||||||
|
'curl',
|
||||||
|
'-L',
|
||||||
|
'-f',
|
||||||
|
'-o', env["GSTREAMER_DIR"] + ".tgz",
|
||||||
|
env["GSTREAMER_URL"],
|
||||||
|
])
|
||||||
|
check_call([
|
||||||
|
'mkdir',
|
||||||
|
'-p',
|
||||||
|
env["GSTREAMER_DIR"],
|
||||||
|
])
|
||||||
|
check_call([
|
||||||
|
'tar',
|
||||||
|
'xzf',
|
||||||
|
env["GSTREAMER_DIR"] + ".tgz",
|
||||||
|
'-C', env["GSTREAMER_DIR"],
|
||||||
|
])
|
||||||
|
|
||||||
if very_verbose:
|
if very_verbose:
|
||||||
print (["Calling", "cargo", "build"] + opts)
|
print (["Calling", "cargo", "build"] + opts)
|
||||||
for key in env:
|
for key in env:
|
||||||
|
|
|
@ -230,6 +230,11 @@ class PackageCommands(CommandBase):
|
||||||
raise Exception("Magic Leap builds need the MAGICLEAP_SDK environment variable")
|
raise Exception("Magic Leap builds need the MAGICLEAP_SDK environment variable")
|
||||||
if not env.get("MLCERT"):
|
if not env.get("MLCERT"):
|
||||||
raise Exception("Magic Leap builds need the MLCERT environment variable")
|
raise Exception("Magic Leap builds need the MLCERT environment variable")
|
||||||
|
# GStreamer configuration
|
||||||
|
env.setdefault("GSTREAMER_DIR", path.join(
|
||||||
|
self.get_target_dir(), "magicleap", target, "native", "gstreamer-1.16.0"
|
||||||
|
))
|
||||||
|
|
||||||
mabu = path.join(env.get("MAGICLEAP_SDK"), "mabu")
|
mabu = path.join(env.get("MAGICLEAP_SDK"), "mabu")
|
||||||
packages = [
|
packages = [
|
||||||
"./support/magicleap/Servo3D/Servo3D.package",
|
"./support/magicleap/Servo3D/Servo3D.package",
|
||||||
|
@ -244,6 +249,7 @@ class PackageCommands(CommandBase):
|
||||||
mabu,
|
mabu,
|
||||||
"-o", target_dir,
|
"-o", target_dir,
|
||||||
"-t", build_type,
|
"-t", build_type,
|
||||||
|
"GSTREAMER_DIR=" + env["GSTREAMER_DIR"],
|
||||||
package
|
package
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -2,25 +2,45 @@ KIND = program
|
||||||
|
|
||||||
INCS = \
|
INCS = \
|
||||||
code/inc/ \
|
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 = \
|
SRCS = \
|
||||||
code/src/main.cpp \
|
code/src/main.cpp \
|
||||||
code/src/Servo2D.cpp
|
code/src/Servo2D.cpp
|
||||||
|
|
||||||
LIBPATHS.debug = \
|
LIBPATHS.debug = \
|
||||||
|
$(GSTREAMER_DIR)/system/lib64/ \
|
||||||
../../../target/magicleap/aarch64-linux-android/debug
|
../../../target/magicleap/aarch64-linux-android/debug
|
||||||
|
|
||||||
LIBPATHS.release = \
|
LIBPATHS.release = \
|
||||||
|
$(GSTREAMER_DIR)/system/lib64/ \
|
||||||
../../../target/magicleap/aarch64-linux-android/release
|
../../../target/magicleap/aarch64-linux-android/release
|
||||||
|
|
||||||
LDFLAGS.device = \
|
LDFLAGS.device = \
|
||||||
-L$(MLSDK)/lumin/stl/libc++/lib
|
-L$(MLSDK)/lumin/stl/libc++/lib
|
||||||
|
|
||||||
|
DATAS = \
|
||||||
|
$(GSTREAMER_DIR)/system/lib64/*.so : bin/ \
|
||||||
|
$(GSTREAMER_DIR)/system/lib64/gstreamer-1.0/*.so : bin/
|
||||||
|
|
||||||
STLIBS = \
|
STLIBS = \
|
||||||
mlservo
|
mlservo
|
||||||
|
|
||||||
SHLIBS = \
|
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 \
|
c++abi \
|
||||||
log \
|
log \
|
||||||
z
|
z
|
||||||
|
|
|
@ -173,6 +173,15 @@ int Servo2D::init() {
|
||||||
EGLSurface surf = plane_->getEGLSurface();
|
EGLSurface surf = plane_->getEGLSurface();
|
||||||
EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
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
|
// Hook into servo
|
||||||
servo_ = init_servo(ctx, surf, dpy, true,
|
servo_ = init_servo(ctx, surf, dpy, true,
|
||||||
this, logger, history, url, keyboard, uri_, args_,
|
this, logger, history, url, keyboard, uri_, args_,
|
||||||
|
|
|
@ -6,9 +6,11 @@ SRCS = \
|
||||||
USES = ml_sdk
|
USES = ml_sdk
|
||||||
|
|
||||||
LIBPATHS.debug = \
|
LIBPATHS.debug = \
|
||||||
|
$(GSTREAMER_DIR)/system/lib64 \
|
||||||
../../../target/magicleap/aarch64-linux-android/debug
|
../../../target/magicleap/aarch64-linux-android/debug
|
||||||
|
|
||||||
LIBPATHS.release = \
|
LIBPATHS.release = \
|
||||||
|
$(GSTREAMER_DIR)/system/lib64 \
|
||||||
../../../target/magicleap/aarch64-linux-android/release
|
../../../target/magicleap/aarch64-linux-android/release
|
||||||
|
|
||||||
LIBPATHS.device = \
|
LIBPATHS.device = \
|
||||||
|
@ -18,6 +20,17 @@ STLIBS = \
|
||||||
mlservo
|
mlservo
|
||||||
|
|
||||||
SHLIBS = \
|
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++ \
|
c++ \
|
||||||
ml_privileges \
|
ml_privileges \
|
||||||
log \
|
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