Skip to content

Commit

Permalink
Auto merge of #16490 - aneeshusa:remove-windows-gnu-part-2, r=metajack
Browse files Browse the repository at this point in the history
Remove windows gnu part 2

<!-- Please describe your changes on the following line: -->

This is a follow-up to #16468.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because we no longer support MinGW/MSYS

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/16490)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Apr 17, 2017
2 parents fd89ddf + 022f0aa commit 485a4de
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 177 deletions.
35 changes: 4 additions & 31 deletions README.md
Expand Up @@ -21,7 +21,7 @@ Please select your operating system:
* [Arch Linux](#on-arch-linux)
* [openSUSE](#on-opensuse-linux)
* [Gentoo Linux](#on-gentoo-linux)
* [Microsoft Windows](#on-windows-msvc--mingw)
* [Microsoft Windows](#on-windows-msvc)
* [Android](#cross-compilation-for-android)

#### OS X
Expand Down Expand Up @@ -94,7 +94,7 @@ sudo emerge net-misc/curl media-libs/freeglut \
dev-python/virtualenv dev-python/pip dev-libs/openssl \
x11-libs/libXmu media-libs/glu x11-base/xorg-server
```
#### On Windows (MSVC & MinGW)
#### On Windows (MSVC)

1. Install Python for Windows (https://www.python.org/downloads/release/python-2711/). The windows x86-64 MSI installer is fine.
You should change the installation to install the "Add python.exe to Path" feature.
Expand All @@ -107,39 +107,12 @@ 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. __(MSVC only)__ Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default
3. 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).

4. __(MSVC only)__ Install Visual Studio 2015 Community Edition (https://www.visualstudio.com/). You MUST add "Visual C++" to the
4. Install Visual Studio 2015 Community Edition (https://www.visualstudio.com/). You MUST add "Visual C++" to the
list of installed components. It is not on by default.

5. __(MinGW only)__ Install MSYS2 (https://msys2.github.io/). After you have done so, open an MSYS shell
window and update the core libraries and install new packages. The extra step at the end is to
downgrade GCC to 5.4, as the GCC6 versions in mingw currently fail to compile some of our
dependencies. We are upgrading to a gcc-free build on Windows as soon as possible:

```sh
pacman -Su
pacman -Sy git mingw-w64-x86_64-toolchain mingw-w64-x86_64-icu \
mingw-w64-x86_64-nspr mingw-w64-x86_64-ca-certificates \
mingw-w64-x86_64-expat mingw-w64-x86_64-cmake tar diffutils patch \
patchutils make python2-setuptools
export GCC_URL=http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc
export GCC_EXT=5.4.0-1-any.pkg.tar.xz
pacman -U --noconfirm $GCC_URL-$GCC_EXT $GCC_URL-ada-$GCC_EXT \
$GCC_URL-fortran-$GCC_EXT $GCC_URL-libgfortran-$GCC_EXT $GCC_URL-libs-$GCC_EXT \
$GCC_URL-objc-$GCC_EXT
```

Add the following line to the end of `.profile` in your home directory:

```
export PATH=/c/Python27:/c/Python27/Scripts:$PATH
```

Now, open a MINGW64 (not MSYS!) shell window, and you should be able to build
servo as usual!

#### Cross-compilation for Android

Pre-installed Android tools are needed. See wiki for
Expand Down
20 changes: 1 addition & 19 deletions appveyor.yml
Expand Up @@ -30,7 +30,6 @@ environment:
C:\\Program Files\\AppVeyor\\BuildAgent;"
matrix:
- TARGET: nightly-x86_64-pc-windows-msvc
- TARGET: nightly-x86_64-pc-windows-gnu

branches:
only:
Expand All @@ -41,20 +40,6 @@ cache:
- .cargo -> rust-commit-hash, cargo-commit-hash
- .ccache

install:
- if %TARGET:*-msvc=msvc%==msvc set BUILD_ENV=msvc
- if %TARGET:*-gnu=gnu%==gnu set BUILD_ENV=gnu
- if %BUILD_ENV%==gnu set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin\;%PATH%
- if %BUILD_ENV%==gnu set MSYSTEM=MINGW64
- if %BUILD_ENV%==gnu set MSYS=winsymlinks=lnk
- if %BUILD_ENV%==gnu bash -lc "echo $MSYSTEM; pacman --needed --noconfirm -Sy pacman-mirrors"
- if %BUILD_ENV%==gnu bash -lc "pacman --noconfirm -Sy"
- if %BUILD_ENV%==gnu bash -lc "pacman -Sy --needed --noconfirm mingw-w64-x86_64-ccache mingw-w64-x86_64-toolchain mingw-w64-x86_64-icu mingw-w64-x86_64-nspr mingw-w64-x86_64-ca-certificates mingw-w64-x86_64-expat mingw-w64-x86_64-cmake tar diffutils patch patchutils make python2-setuptools"
# Downgrade msys2 build GCC to 5.4.0-1 - https://github.com/servo/servo/issues/12512
- if %BUILD_ENV%==gnu set GCC_URL=http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc
- if %BUILD_ENV%==gnu set GCC_EXT=5.4.0-1-any.pkg.tar.xz
- if %BUILD_ENV%==gnu bash -lc "pacman -U --noconfirm $GCC_URL-$GCC_EXT $GCC_URL-ada-$GCC_EXT $GCC_URL-fortran-$GCC_EXT $GCC_URL-libgfortran-$GCC_EXT $GCC_URL-libs-$GCC_EXT $GCC_URL-objc-$GCC_EXT"

# Uncomment these lines to expose RDP access information to the build machine in the build log.
#init:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
Expand All @@ -63,9 +48,6 @@ install:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

build_script:
- if %BUILD_ENV%==gnu bash -lc "ccache -s"
- if %BUILD_ENV%==msvc mach build -d -v && mach test-unit
- if %BUILD_ENV%==gnu bash -lc "export PATH=/c/Python27:$PATH; export CCACHE=/mingw64/bin/ccache; cd $APPVEYOR_BUILD_FOLDER; ./mach build -d -v && ./mach test-unit"
- if %BUILD_ENV%==gnu bash -lc "ccache -s"
- mach build -d -v && mach test-unit

test: off
11 changes: 1 addition & 10 deletions python/mach_bootstrap.py
Expand Up @@ -211,7 +211,7 @@ def _ensure_case_insensitive_if_windows():


def _is_windows():
return sys.platform == 'win32' or sys.platform == 'msys'
return sys.platform == 'win32'


def bootstrap(topdir):
Expand All @@ -235,15 +235,6 @@ def bootstrap(topdir):
print('Current path:', topdir)
sys.exit(1)

# We don't support MinGW Python
if os.path.join(os.sep, 'mingw64', 'bin') in sys.executable:
print('Cannot run mach with MinGW or MSYS Python.')
print('\nPlease add the path to Windows Python (usually /c/Python27) to your path.')
print('You can do this by appending the line:')
print(' export PATH=/c/Python27:$PATH')
print('to your ~/.profile.')
sys.exit(1)

# Ensure we are running Python 2.7+. We put this check here so we generate a
# user-friendly error message rather than a cryptic stack trace on module import.
if not (3, 0) > sys.version_info >= (2, 7):
Expand Down
37 changes: 1 addition & 36 deletions python/servo/bootstrap.py
Expand Up @@ -170,39 +170,6 @@ def salt(context, force=False):
return retcode


def windows_gnu(context, force=False):
'''Bootstrapper for msys2 based environments for building in Windows.'''

if not find_executable('pacman'):
print(
'The Windows GNU bootstrapper only works with msys2 with pacman. '
'Get msys2 at http://msys2.github.io/'
)
return 1

# Ensure repositories are up to date
command = ['pacman', '--sync', '--refresh']
subprocess.check_call(command)

# Install packages
command = ['pacman', '--sync', '--needed']
if force:
command.append('--noconfirm')
subprocess.check_call(command + list(packages.WINDOWS_GNU))

# Downgrade GCC to 5.4.0-1
gcc_pkgs = ["gcc", "gcc-ada", "gcc-fortran", "gcc-libgfortran", "gcc-libs", "gcc-objc"]
gcc_version = "5.4.0-1"
mingw_url = "http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-{}-{}-any.pkg.tar.xz"
gcc_list = [mingw_url.format(gcc, gcc_version) for gcc in gcc_pkgs]

# Note: `--upgrade` also does downgrades
downgrade_command = ['pacman', '--upgrade']
if force:
downgrade_command.append('--noconfirm')
subprocess.check_call(downgrade_command + gcc_list)


def windows_msvc(context, force=False):
'''Bootstrapper for MSVC building on Windows.'''

Expand Down Expand Up @@ -264,9 +231,7 @@ def bootstrap(context, force=False):

bootstrapper = None

if "windows-gnu" in host_triple():
bootstrapper = windows_gnu
elif "windows-msvc" in host_triple():
if "windows-msvc" in host_triple():
bootstrapper = windows_msvc
elif "linux-gnu" in host_triple():
distro, version, _ = platform.linux_distribution()
Expand Down
56 changes: 26 additions & 30 deletions python/servo/build_commands.py
Expand Up @@ -297,47 +297,43 @@ def build(self, target=None, release=False, dev=False, jobs=None,

cargo_binary = "cargo" + BIN_SUFFIX

if sys.platform in ("win32", "msys"):
if "msvc" not in host_triple():
env[b'RUSTFLAGS'] = b'-C link-args=-Wl,--subsystem,windows'

status = call(
[cargo_binary, "build"] + opts,
env=env, cwd=self.servo_crate(), verbose=verbose)
elapsed = time() - build_start

# Do some additional things if the build succeeded
if status == 0:
if sys.platform in ("win32", "msys"):
if sys.platform == "win32":
servo_exe_dir = path.join(base_path, "debug" if dev else "release")
# On windows, copy in our manifest
shutil.copy(path.join(self.get_top_dir(), "components", "servo", "servo.exe.manifest"),
servo_exe_dir)
if "msvc" in (target or host_triple()):
msvc_x64 = "64" if "x86_64" in (target or host_triple()) else ""
# on msvc builds, use editbin to change the subsystem to windows, but only
# on release builds -- on debug builds, it hides log output
if not dev:
call(["editbin", "/nologo", "/subsystem:windows", path.join(servo_exe_dir, "servo.exe")],
verbose=verbose)
# on msvc, we need to copy in some DLLs in to the servo.exe dir
for ssl_lib in ["libcryptoMD.dll", "libsslMD.dll"]:
shutil.copy(path.join(env['OPENSSL_LIB_DIR'], "../bin" + msvc_x64, ssl_lib),
servo_exe_dir)

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.
try:
import Cocoa
icon_path = path.join(self.get_top_dir(), "resources", "servo.png")
icon = Cocoa.NSImage.alloc().initWithContentsOfFile_(icon_path)
if icon is not None:
Cocoa.NSWorkspace.sharedWorkspace().setIcon_forFile_options_(icon,
servo_path,
0)
except ImportError:
pass

msvc_x64 = "64" if "x86_64" in (target or host_triple()) else ""
# on msvc builds, use editbin to change the subsystem to windows, but only
# on release builds -- on debug builds, it hides log output
if not dev:
call(["editbin", "/nologo", "/subsystem:windows", path.join(servo_exe_dir, "servo.exe")],
verbose=verbose)
# on msvc, we need to copy in some DLLs in to the servo.exe dir
for ssl_lib in ["libcryptoMD.dll", "libsslMD.dll"]:
shutil.copy(path.join(env['OPENSSL_LIB_DIR'], "../bin" + msvc_x64, ssl_lib),
servo_exe_dir)

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.
try:
import Cocoa
icon_path = path.join(self.get_top_dir(), "resources", "servo.png")
icon = Cocoa.NSImage.alloc().initWithContentsOfFile_(icon_path)
if icon is not None:
Cocoa.NSWorkspace.sharedWorkspace().setIcon_forFile_options_(icon,
servo_path,
0)
except ImportError:
pass

# Generate Desktop Notification if elapsed-time > some threshold value
notify_build_done(self.config, elapsed, status == 0)
Expand Down
8 changes: 2 additions & 6 deletions python/servo/command_base.py
Expand Up @@ -168,8 +168,7 @@ def check_call(*args, **kwargs):


def is_windows():
""" Detect windows, mingw, cygwin """
return sys.platform == 'win32' or sys.platform == 'msys' or sys.platform == 'cygwin'
return sys.platform == 'win32'


def is_macosx():
Expand Down Expand Up @@ -420,9 +419,6 @@ def package_dir(package):
if not self.config["tools"]["system-rust"] \
or self.config["tools"]["rust-root"]:
env["RUST_ROOT"] = self.config["tools"]["rust-root"]
# Add mingw64 binary path before rust paths to avoid conflict with libstdc++-6.dll
if sys.platform == "msys":
extra_path += [path.join(os.sep, "mingw64", "bin")]
# These paths are for when rust-root points to an unpacked installer
extra_path += [path.join(self.config["tools"]["rust-root"], "rustc", "bin")]
extra_lib += [path.join(self.config["tools"]["rust-root"], "rustc", "lib")]
Expand Down Expand Up @@ -489,7 +485,7 @@ def package_dir(package):
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " " + self.config["build"]["rustflags"]

# Don't run the gold linker if on Windows https://github.com/servo/servo/issues/9499
if self.config["tools"]["rustc-with-gold"] and sys.platform not in ("win32", "msys"):
if self.config["tools"]["rustc-with-gold"] and sys.platform != "win32":
if subprocess.call(['which', 'ld.gold'], stdout=PIPE, stderr=PIPE) == 0:
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C link-args=-fuse-ld=gold"

Expand Down
25 changes: 6 additions & 19 deletions python/servo/package_commands.py
Expand Up @@ -107,25 +107,12 @@ def copy_dependencies(binary_path, lib_path):


def copy_windows_dependencies(binary_path, destination):
try:
[shutil.copy(path.join(binary_path, d), destination) for d in ["libcryptoMD.dll", "libsslMD.dll"]]
except:
deps = [
"libstdc++-6.dll",
"libwinpthread-1.dll",
"libbz2-1.dll",
"libgcc_s_seh-1.dll",
"libexpat-1.dll",
"zlib1.dll",
"libiconv-2.dll",
"libintl-8.dll",
"libcryptoMD.dll",
"libsslMD.dll",
]
for d in deps:
dep_path = path.join("C:\\msys64\\mingw64\\bin", d)
if path.exists(dep_path):
shutil.copy(dep_path, path.join(destination, d))
deps = [
"libcryptoMD.dll",
"libsslMD.dll",
]
for d in deps:
shutil.copy(path.join(binary_path, d), destination)


def change_prefs(resources_path, platform):
Expand Down
15 changes: 0 additions & 15 deletions python/servo/packages.py
Expand Up @@ -2,21 +2,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

WINDOWS_GNU = set([
"diffutils",
"make",
"mingw-w64-x86_64-toolchain",
"mingw-w64-x86_64-icu",
"mingw-w64-x86_64-nspr",
"mingw-w64-x86_64-ca-certificates",
"mingw-w64-x86_64-expat",
"mingw-w64-x86_64-cmake",
"patch",
"patchutils",
"python2-setuptools",
"tar",
])

WINDOWS_MSVC = {
"cmake": "3.7.2",
"moztools": "0.0.1-5",
Expand Down
11 changes: 4 additions & 7 deletions python/servo/testing_commands.py
Expand Up @@ -245,13 +245,10 @@ def test_unit(self, test_name=None, package=None, bench=False, nocapture=False):
env = self.build_env()
env["RUST_BACKTRACE"] = "1"

if sys.platform in ("win32", "msys"):
if "msvc" in host_triple():
# on MSVC, we need some DLLs in the path. They were copied
# in to the servo.exe build dir, so just point PATH to that.
env["PATH"] = "%s%s%s" % (path.dirname(self.get_binary_path(False, False)), os.pathsep, env["PATH"])
else:
env["RUSTFLAGS"] = "-C link-args=-Wl,--subsystem,windows"
if "msvc" in host_triple():
# on MSVC, we need some DLLs in the path. They were copied
# in to the servo.exe build dir, so just point PATH to that.
env["PATH"] = "%s%s%s" % (path.dirname(self.get_binary_path(False, False)), os.pathsep, env["PATH"])

features = self.servo_features()
if len(packages) > 0:
Expand Down
4 changes: 0 additions & 4 deletions python/servo/util.py
Expand Up @@ -32,12 +32,8 @@ def host_platform():
# If we are in a Visual Studio environment, use msvc
if os.getenv("PLATFORM") is not None:
os_type = "pc-windows-msvc"
elif os.getenv("MSYSTEM") is not None:
os_type = "pc-windows-gnu"
else:
os_type = "unknown"
elif os_type.startswith("mingw64_nt-") or os_type.startswith("cygwin_nt-"):
os_type = "pc-windows-gnu"
elif os_type == "freebsd":
os_type = "unknown-freebsd"
else:
Expand Down

0 comments on commit 485a4de

Please sign in to comment.