diff options
author | Josh Matthews <josh@joshmatthews.net> | 2019-07-25 12:02:32 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2019-07-27 09:55:42 -0400 |
commit | 5d3d766204fb24e44dee04fdf5f24e8c12047912 (patch) | |
tree | 35c55e0735fa80e3313ce9905f3055b2bfc9d3c3 /python/servo/build_commands.py | |
parent | c9dde3a4bb9a6e4c8d69888a21c7117129f8f95e (diff) | |
download | servo-5d3d766204fb24e44dee04fdf5f24e8c12047912.tar.gz servo-5d3d766204fb24e44dee04fdf5f24e8c12047912.zip |
Vendor UWP GStreamer binaries.
Diffstat (limited to 'python/servo/build_commands.py')
-rw-r--r-- | python/servo/build_commands.py | 77 |
1 files changed, 54 insertions, 23 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index f434ea4222e..591a2fc4b20 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -268,26 +268,54 @@ class MachCommands(CommandBase): print("Can't find Visual Studio 2017 installation at %s." % base_vs_path) sys.exit(1) - if 'windows' in target_triple: - gst_root = gstreamer_root(target_triple) - if gst_root: - append_to_path_env(os.path.join(gst_root, "lib"), env, "LIB") - if uwp: # Don't try and build a desktop port. libsimpleservo = True + arches = { + "aarch64": { + "angle": "arm64", + "gst": "ARM64", + "gst_root": "arm64", + }, + "x86_64": { + "angle": "x64", + "gst": "X86_64", + "gst_root": "x64", + }, + } + arch = arches.get(target_triple.split('-')[0]) + if not arch: + print("Unsupported UWP target.") + sys.exit(1) + # Ensure that the NuGet ANGLE package containing libEGL is accessible # to the Rust linker. append_to_path_env( path.join( os.getcwd(), "support", "hololens", "packages", - "ANGLE.WindowsStore.Servo.2.1.13", "bin", "UAP", "x64" + "ANGLE.WindowsStore.Servo.2.1.13", "bin", "UAP", arch['angle'] ), env, "LIB" ) + # Don't want to mix non-UWP libraries with vendored UWP libraries. + if "gstreamer" in env['LIB']: + print("Found existing GStreamer library path in LIB. Please remove it.") + sys.exit(1) + + # Override any existing GStreamer installation with the vendored libraries. + env["GSTREAMER_1_0_ROOT_" + arch['gst']] = path.join( + self.msvc_package_dir("gstreamer-uwp"), arch['gst_root'] + ) + + # Ensure that GStreamer libraries are accessible when linking. + if 'windows' in target_triple: + gst_root = gstreamer_root(target_triple, env) + if gst_root: + append_to_path_env(os.path.join(gst_root, "lib"), env, "LIB") + if android: if "ANDROID_NDK" not in env: print("Please set the ANDROID_NDK environment variable.") @@ -632,18 +660,21 @@ class MachCommands(CommandBase): for lib in libs: print("WARNING: could not find " + lib) + # UWP build has its own ANGLE library that it packages. if not uwp: package_generated_shared_libraries(["libEGL.dll", "libGLESv2.dll"], build_path, servo_exe_dir) # copy needed gstreamer DLLs in to servo.exe dir - if "aarch64" not in target_triple: - print("Packaging gstreamer DLLs") - if not package_gstreamer_dlls(servo_exe_dir, target_triple, uwp): - status = 1 - print("Packaging MSVC DLLs") - if not package_msvc_dlls(servo_exe_dir, target_triple, vcinstalldir, vs_version): + print("Packaging gstreamer DLLs") + if not package_gstreamer_dlls(env, servo_exe_dir, target_triple, uwp): status = 1 + # UWP app packaging already bundles all required DLLs for us. + if not uwp: + print("Packaging MSVC DLLs") + if not package_msvc_dlls(servo_exe_dir, target_triple, vcinstalldir, vs_version): + status = 1 + elif sys.platform == "darwin": # On the Mac, set a lovely icon. This makes it easier to pick out the Servo binary in tools # like Instruments.app. @@ -690,7 +721,7 @@ class MachCommands(CommandBase): return check_call(["cargo", "clean"] + opts, env=self.build_env(), verbose=verbose) -def gstreamer_root(target): +def gstreamer_root(target, env): arch = { "x86_64": "X86_64", "x86": "X86", @@ -699,25 +730,26 @@ def gstreamer_root(target): gst_x64 = arch[target.split('-')[0]] gst_default_path = path.join("C:\\gstreamer\\1.0", gst_x64) gst_env = "GSTREAMER_1_0_ROOT_" + gst_x64 - if os.environ.get(gst_env) is not None: - return os.environ.get(gst_env) + if env.get(gst_env) is not None: + return env.get(gst_env) elif os.path.exists(path.join(gst_default_path, "bin", "ffi-7.dll")): return gst_default_path else: return None -def package_gstreamer_dlls(servo_exe_dir, target, uwp): - gst_root = gstreamer_root(target) +def package_gstreamer_dlls(env, servo_exe_dir, target, uwp): + gst_root = gstreamer_root(target, env) if not gst_root: print("Could not find GStreamer installation directory.") return False # All the shared libraries required for starting up and loading plugins. gst_dlls = [ + "avcodec-58.dll", "avfilter-7.dll", "avformat-58.dll", - "avcodec-58.dll", + "avresample-4.dll", "avutil-56.dll", "bz2.dll", "ffi-7.dll", @@ -743,15 +775,13 @@ def package_gstreamer_dlls(servo_exe_dir, target, uwp): "gstwebrtc-1.0-0.dll", "intl-8.dll", "orc-0.4-0.dll", + "postproc-55.dll", "swresample-3.dll", + "swscale-5.dll", + "x264-157.dll", "z-1.dll", ] - # FIXME: until we build with UWP-enabled GStreamer binaries, - # almost every UWP-friendly DLL depends on this - # incompatible DLL. - gst_dlls += ["libwinpthread-1.dll"] - if not uwp: gst_dlls += [ "graphene-1.0-0.dll", @@ -770,6 +800,7 @@ def package_gstreamer_dlls(servo_exe_dir, target, uwp): "libtheoraenc-1.dll", "libvorbis-0.dll", "libvorbisenc-2.dll", + "libwinpthread-1.dll", "nice-10.dll", ] |