mirror of
https://github.com/servo/servo.git
synced 2025-06-29 11:33:39 +01:00
Auto merge of #24005 - ferjm:windows.pkgconfig, r=Manishearth
Simplify Windows build by not setting PKG_CONFIG_PATH - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #23177 <!-- 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/24005) <!-- Reviewable:end -->
This commit is contained in:
commit
2e0d1ad567
4 changed files with 40 additions and 33 deletions
15
README.md
15
README.md
|
@ -215,7 +215,7 @@ You should change the installation to install the "Add python.exe to Path" featu
|
|||
|
||||
2. Install Python 3.7 for Windows (https://www.python.org/downloads/release/python-374/). The Windows x86-64 MSI installer is fine. This is required in order to build the JavaScript engine, SpiderMonkey.
|
||||
|
||||
2. Install virtualenv.
|
||||
3. Install virtualenv.
|
||||
|
||||
In a normal Windows Shell (cmd.exe or "Command Prompt" from the start menu), do:
|
||||
```
|
||||
|
@ -223,14 +223,21 @@ pip install virtualenv
|
|||
```
|
||||
If this does not work, you may need to reboot for the changed PATH settings (by the python installer) to take effect.
|
||||
|
||||
3. Install the most recent [GStreamer](https://gstreamer.freedesktop.org/data/pkg/windows/) MSVC development package following [these instructions](https://github.com/sdroege/gstreamer-rs#gstreamer-binaries-1). Note that the MinGW binaries will not work, so make sure that you install the MSVC the ones.
|
||||
4. Install `pkg-config` either via [Chocolatey](https://chocolatey.org/install#installing-chocolatey)(`choco install pkgconfiglite`) or from [here](https://sourceforge.net/projects/pkgconfiglite/).
|
||||
|
||||
5. Install the most recent [GStreamer](https://gstreamer.freedesktop.org/data/pkg/windows/) MSVC packages. You need to download the two `.msi` files for your platform from the [GStreamer](https://gstreamer.freedesktop.org/data/pkg/windows/) website and install them. The currently recommended version is 1.16.0. i.e.:
|
||||
|
||||
- [gstreamer-1.0-msvc-x86_64-1.16.0.msi](https://gstreamer.freedesktop.org/data/pkg/windows/1.16.0/gstreamer-1.0-msvc-x86_64-1.16.0.msi)
|
||||
- [gstreamer-1.0-devel-msvc-x86_64-1.16.0.msi](https://gstreamer.freedesktop.org/data/pkg/windows/1.16.0/gstreamer-1.0-devel-msvc-x86_64-1.16.0.msi)
|
||||
|
||||
Note that the MinGW binaries will not work, so make sure that you install the MSVC the ones.
|
||||
|
||||
Note that you should ensure that _all_ components are installed from gstreamer, as we require many of the optional libraries that are not installed by default.
|
||||
|
||||
4. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default
|
||||
6. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default
|
||||
settings for the installer are fine).
|
||||
|
||||
5. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). You MUST add "Visual C++" to the
|
||||
7. Install Visual Studio Community 2017 (https://www.visualstudio.com/vs/community/). You MUST add "Visual C++" to the
|
||||
list of installed components. It is not on by default. Visual Studio 2017 MUST installed to the default location or mach.bat will not find it.
|
||||
|
||||
##### [Optional] Install LLVM for faster link times
|
||||
|
|
|
@ -58,7 +58,6 @@ install:
|
|||
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain none
|
||||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
|
||||
- set PKG_CONFIG_PATH=%PKG_CONFIG_PATH%;C:\gstreamer\1.0\x86_64\lib\pkgconfig
|
||||
- rustup -V
|
||||
- rustc --version
|
||||
- cargo --version
|
||||
|
|
|
@ -30,7 +30,7 @@ from mach.decorators import (
|
|||
from mach.registrar import Registrar
|
||||
|
||||
from mach_bootstrap import _get_exec_path
|
||||
from servo.command_base import CommandBase, cd, call, check_call, BIN_SUFFIX, append_to_path_env
|
||||
from servo.command_base import CommandBase, cd, call, check_call, BIN_SUFFIX, append_to_path_env, gstreamer_root
|
||||
from servo.util import host_triple
|
||||
|
||||
|
||||
|
@ -776,23 +776,6 @@ class MachCommands(CommandBase):
|
|||
return True
|
||||
|
||||
|
||||
def gstreamer_root(target, env):
|
||||
arch = {
|
||||
"x86_64": "X86_64",
|
||||
"x86": "X86",
|
||||
"aarch64": "ARM64",
|
||||
}
|
||||
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 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(env, servo_exe_dir, target, uwp):
|
||||
gst_root = gstreamer_root(target, env)
|
||||
if not gst_root:
|
||||
|
|
|
@ -239,6 +239,25 @@ def set_osmesa_env(bin_path, env):
|
|||
return env
|
||||
|
||||
|
||||
def gstreamer_root(target, env, topdir=None):
|
||||
if is_windows:
|
||||
arch = {
|
||||
"x86_64": "X86_64",
|
||||
"x86": "X86",
|
||||
"aarch64": "ARM64",
|
||||
}
|
||||
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 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
|
||||
elif sys.platform == "linux2":
|
||||
return path.join(topdir, "support", "linux", "gstreamer", "gst")
|
||||
return None
|
||||
|
||||
|
||||
class BuildNotFound(Exception):
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
|
@ -365,9 +384,6 @@ class CommandBase(object):
|
|||
build_type = "release" if release else "debug"
|
||||
return path.join(base_path, build_type, apk_name)
|
||||
|
||||
def get_gstreamer_path(self):
|
||||
return path.join(self.context.topdir, "support", "linux", "gstreamer", "gst")
|
||||
|
||||
def get_binary_path(self, release, dev, target=None, android=False, magicleap=False, simpleservo=False):
|
||||
# TODO(autrilla): this function could still use work - it shouldn't
|
||||
# handle quitting, or printing. It should return the path, or an error.
|
||||
|
@ -542,7 +558,7 @@ class CommandBase(object):
|
|||
|
||||
return self.get_executable(destination_folder)
|
||||
|
||||
def needs_gstreamer_env(self, target):
|
||||
def needs_gstreamer_env(self, target, env):
|
||||
try:
|
||||
if check_gstreamer_lib():
|
||||
return False
|
||||
|
@ -554,8 +570,8 @@ class CommandBase(object):
|
|||
if "x86_64" not in effective_target or "android" in effective_target:
|
||||
# We don't build gstreamer for non-x86_64 / android yet
|
||||
return False
|
||||
if sys.platform == "linux2":
|
||||
if path.isdir(self.get_gstreamer_path()):
|
||||
if sys.platform == "linux2" or is_windows:
|
||||
if path.isdir(gstreamer_root(effective_target, env, self.get_top_dir)):
|
||||
return True
|
||||
else:
|
||||
raise Exception("Your system's gstreamer libraries are out of date \
|
||||
|
@ -569,8 +585,10 @@ install them, let us know by filing a bug!")
|
|||
def set_run_env(self, android=False):
|
||||
"""Some commands, like test-wpt, don't use a full build env,
|
||||
but may still need dynamic search paths. This command sets that up"""
|
||||
if not android and self.needs_gstreamer_env(None):
|
||||
gstpath = self.get_gstreamer_path()
|
||||
if not android and self.needs_gstreamer_env(None, os.environ):
|
||||
gstpath = gstreamer_root(host_triple(), os.environ, self.get_top_dir)
|
||||
if gstpath is None:
|
||||
return
|
||||
os.environ["LD_LIBRARY_PATH"] = path.join(gstpath, "lib")
|
||||
os.environ["GST_PLUGIN_SYSTEM_PATH"] = path.join(gstpath, "lib", "gstreamer-1.0")
|
||||
os.environ["PKG_CONFIG_PATH"] = path.join(gstpath, "lib", "pkgconfig")
|
||||
|
@ -624,8 +642,8 @@ install them, let us know by filing a bug!")
|
|||
# Always build harfbuzz from source
|
||||
env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true"
|
||||
|
||||
if self.needs_gstreamer_env(target):
|
||||
gstpath = self.get_gstreamer_path()
|
||||
if self.needs_gstreamer_env(target or host_triple(), env):
|
||||
gstpath = gstreamer_root(target or host_triple(), env, self.get_top_dir())
|
||||
extra_path += [path.join(gstpath, "bin")]
|
||||
libpath = path.join(gstpath, "lib")
|
||||
# we append in the reverse order so that system gstreamer libraries
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue