mirror of
https://github.com/servo/servo.git
synced 2025-06-29 11:33:39 +01:00
Auto merge of #21730 - ferjm:android.gstreamer, r=paulrouget
Enable WebAudio on Android - [X] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [X] These changes fix #21619 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21730) <!-- Reviewable:end -->
This commit is contained in:
commit
6e844f2278
7 changed files with 82 additions and 23 deletions
|
@ -13,8 +13,11 @@ import datetime
|
|||
import os
|
||||
import os.path as path
|
||||
import platform
|
||||
import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib
|
||||
import zipfile
|
||||
|
||||
from time import time
|
||||
|
||||
|
@ -396,6 +399,34 @@ class MachCommands(CommandBase):
|
|||
if not os.path.exists(aar_out_dir):
|
||||
os.makedirs(aar_out_dir)
|
||||
env["AAR_OUT_DIR"] = aar_out_dir
|
||||
# GStreamer and its dependencies use pkg-config and this flag is required
|
||||
# to make it work in a cross-compilation context.
|
||||
env["PKG_CONFIG_ALLOW_CROSS"] = '1'
|
||||
# Build the name of the package containing all GStreamer dependencies
|
||||
# according to the build target.
|
||||
gst_lib = "gst-build-{}".format(self.config["android"]["lib"])
|
||||
gst_lib_zip = "%s.zip" % gst_lib
|
||||
gst_dir = os.path.join(base_path, "gstreamer")
|
||||
gst_lib_path = os.path.join(base_path, gst_dir, gst_lib)
|
||||
pkg_config_path = os.path.join(gst_lib_path, "pkgconfig")
|
||||
env["PKG_CONFIG_PATH"] = pkg_config_path
|
||||
if not os.path.exists(gst_lib_path):
|
||||
# Download GStreamer dependencies if they have not already been downloaded
|
||||
print("Downloading GStreamer dependencies")
|
||||
gst_url = "https://github.com/servo/libgstreamer_android_gen/blob/master/out/%s?raw=true" % gst_lib_zip
|
||||
urllib.urlretrieve(gst_url, gst_lib_zip)
|
||||
zip_ref = zipfile.ZipFile(gst_lib_zip, "r")
|
||||
zip_ref.extractall(gst_dir)
|
||||
os.remove(gst_lib_zip)
|
||||
|
||||
# Change pkgconfig info to make all GStreamer dependencies point
|
||||
# to the libgstreamer_android.so bundle.
|
||||
for each in os.listdir(pkg_config_path):
|
||||
if each.endswith('.pc'):
|
||||
print("Setting pkgconfig info for %s" % each)
|
||||
pc = os.path.join(pkg_config_path, each)
|
||||
expr = "s#libdir=.*#libdir=%s#g" % gst_lib_path
|
||||
subprocess.call(["perl", "-i", "-pe", expr, pc])
|
||||
|
||||
if very_verbose:
|
||||
print (["Calling", "cargo", "build"] + opts)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue