Vendor UWP GStreamer binaries.

This commit is contained in:
Josh Matthews 2019-07-25 12:02:32 -04:00
parent c9dde3a4bb
commit 5d3d766204
5 changed files with 68 additions and 130 deletions

View file

@ -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,14 +660,17 @@ 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):
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
@ -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",
]

View file

@ -576,6 +576,9 @@ install them, let us know by filing a bug!")
os.environ["PKG_CONFIG_PATH"] = path.join(gstpath, "lib", "pkgconfig")
os.environ["GST_PLUGIN_SCANNER"] = path.join(gstpath, "libexec", "gstreamer-1.0", "gst-plugin-scanner")
def msvc_package_dir(self, package):
return path.join(self.context.sharedir, "msvc-dependencies", package, msvc_deps[package])
def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit=False):
"""Return an extended environment dictionary."""
env = os.environ.copy()
@ -590,14 +593,9 @@ install them, let us know by filing a bug!")
extra_path = []
extra_lib = []
if "msvc" in (target or host_triple()):
msvc_deps_dir = path.join(self.context.sharedir, "msvc-dependencies")
def package_dir(package):
return path.join(msvc_deps_dir, package, msvc_deps[package])
extra_path += [path.join(package_dir("cmake"), "bin")]
extra_path += [path.join(package_dir("llvm"), "bin")]
extra_path += [path.join(package_dir("ninja"), "bin")]
extra_path += [path.join(self.msvc_package_dir("cmake"), "bin")]
extra_path += [path.join(self.msvc_package_dir("llvm"), "bin")]
extra_path += [path.join(self.msvc_package_dir("ninja"), "bin")]
arch = (target or host_triple()).split('-')[0]
vcpkg_arch = {
@ -605,7 +603,7 @@ install them, let us know by filing a bug!")
"i686": "x86-windows",
"aarch64": "arm64-windows",
}
openssl_base_dir = path.join(package_dir("openssl"), vcpkg_arch[arch])
openssl_base_dir = path.join(self.msvc_package_dir("openssl"), vcpkg_arch[arch])
# Link openssl
env["OPENSSL_INCLUDE_DIR"] = path.join(openssl_base_dir, "include")
@ -613,13 +611,13 @@ install them, let us know by filing a bug!")
env["OPENSSL_LIBS"] = "libssl:libcrypto"
# Link moztools, used for building SpiderMonkey
env["MOZTOOLS_PATH"] = os.pathsep.join([
path.join(package_dir("moztools"), "bin"),
path.join(package_dir("moztools"), "msys", "bin"),
path.join(self.msvc_package_dir("moztools"), "bin"),
path.join(self.msvc_package_dir("moztools"), "msys", "bin"),
])
# Link autoconf 2.13, used for building SpiderMonkey
env["AUTOCONF"] = path.join(package_dir("moztools"), "msys", "local", "bin", "autoconf-2.13")
env["AUTOCONF"] = path.join(self.msvc_package_dir("moztools"), "msys", "local", "bin", "autoconf-2.13")
# Link LLVM
env["LIBCLANG_PATH"] = path.join(package_dir("llvm"), "lib")
env["LIBCLANG_PATH"] = path.join(self.msvc_package_dir("llvm"), "lib")
if not os.environ.get("NATIVE_WIN32_PYTHON"):
env["NATIVE_WIN32_PYTHON"] = sys.executable

View file

@ -8,4 +8,5 @@ WINDOWS_MSVC = {
"moztools": "3.2",
"ninja": "1.7.1",
"openssl": "111.3.0+1.1.1c-vs2017",
"gstreamer-uwp": "1.16.0.3",
}

View file

@ -177,21 +177,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\debug\msvcp140.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\debug\simpleservo.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\debug\vcruntime140.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\release\libcrypto.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
@ -202,28 +192,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\release\msvcp140.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\release\simpleservo.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\release\vcruntime140.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\debug\api-ms-win-crt-runtime-l1-1-0.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\debug\avcodec-58.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
@ -567,13 +540,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\debug\msvcp140.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\debug\orc-0.4-0.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
@ -602,13 +568,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\debug\vcruntime140.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\debug\z-1.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
@ -616,13 +575,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\release\api-ms-win-crt-runtime-l1-1-0.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\release\avcodec-58.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
@ -966,13 +918,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\release\msvcp140.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\release\orc-0.4-0.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
@ -1001,13 +946,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\release\vcruntime140.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</DeploymentContent>
</None>
<None Include="..\..\..\target\release\z-1.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>

View file

@ -90,9 +90,6 @@
<None Include="Content\VertexShaderShared.hlsl">
<Filter>Content</Filter>
</None>
<None Include="..\..\..\target\debug\api-ms-win-crt-runtime-l1-1-0.dll">
<Filter>DebugServoDLLs</Filter>
</None>
<None Include="..\..\..\target\debug\avcodec-58.dll">
<Filter>DebugServoDLLs</Filter>
</None>
@ -243,27 +240,18 @@
<None Include="..\..\..\target\debug\libwinpthread-1.dll">
<Filter>DebugServoDLLs</Filter>
</None>
<None Include="..\..\..\target\debug\msvcp140.dll">
<Filter>DebugServoDLLs</Filter>
</None>
<None Include="..\..\..\target\debug\orc-0.4-0.dll">
<Filter>DebugServoDLLs</Filter>
</None>
<None Include="..\..\..\target\debug\swresample-3.dll">
<Filter>DebugServoDLLs</Filter>
</None>
<None Include="..\..\..\target\debug\vcruntime140.dll">
<Filter>DebugServoDLLs</Filter>
</None>
<None Include="..\..\..\target\debug\z-1.dll">
<Filter>DebugServoDLLs</Filter>
</None>
<None Include="..\..\..\target\release\z-1.dll">
<Filter>ReleaseServoDLLs</Filter>
</None>
<None Include="..\..\..\target\release\vcruntime140.dll">
<Filter>ReleaseServoDLLs</Filter>
</None>
<None Include="..\..\..\target\release\swresample-3.dll">
<Filter>ReleaseServoDLLs</Filter>
</None>
@ -273,9 +261,6 @@
<None Include="..\..\..\target\release\orc-0.4-0.dll">
<Filter>ReleaseServoDLLs</Filter>
</None>
<None Include="..\..\..\target\release\msvcp140.dll">
<Filter>ReleaseServoDLLs</Filter>
</None>
<None Include="..\..\..\target\release\libwinpthread-1.dll">
<Filter>ReleaseServoDLLs</Filter>
</None>
@ -426,9 +411,6 @@
<None Include="..\..\..\target\release\avcodec-58.dll">
<Filter>ReleaseServoDLLs</Filter>
</None>
<None Include="..\..\..\target\release\api-ms-win-crt-runtime-l1-1-0.dll">
<Filter>ReleaseServoDLLs</Filter>
</None>
<None Include="..\..\..\target\debug\simpleservo.dll">
<Filter>DebugServoDLLs</Filter>
</None>
@ -438,30 +420,18 @@
<None Include="..\..\..\target\aarch64-pc-windows-msvc\debug\libssl.dll">
<Filter>DebugARM64ServoDLLs</Filter>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\debug\msvcp140.dll">
<Filter>DebugARM64ServoDLLs</Filter>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\debug\simpleservo.dll">
<Filter>DebugARM64ServoDLLs</Filter>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\debug\vcruntime140.dll">
<Filter>DebugARM64ServoDLLs</Filter>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\release\libcrypto.dll">
<Filter>ReleaseARM64ServoDLLs</Filter>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\release\libssl.dll">
<Filter>ReleaseARM64ServoDLLs</Filter>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\release\msvcp140.dll">
<Filter>ReleaseARM64ServoDLLs</Filter>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\release\simpleservo.dll">
<Filter>ReleaseARM64ServoDLLs</Filter>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\release\vcruntime140.dll">
<Filter>ReleaseARM64ServoDLLs</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Filter Include="Assets">