Skip to content

Commit 2cc5391

Browse files
author
Michal Klocek
committed
Update GN to master/95b0f8fe
Change-Id: I5847aa4859fb1cf5c9fc219693a1f5176fcbd7f9 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/594459 Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent 08e24b2 commit 2cc5391

File tree

77 files changed

+2017
-925
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2017
-925
lines changed

gn/AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Vewd Software AS <*@vewd.com>
2121
Vivaldi Technologies AS <*@vivaldi.com>
2222
Yandex LLC <*@yandex-team.ru>
2323

24+
Aleksei Khoroshilov <[email protected]>
2425
Alexis Menard <[email protected]>
2526
Alfredo Mazzinghi <[email protected]>
2627
Andrew Boyarshin <[email protected]>

gn/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Related resources:
1313
(all builtin help converted to a single file).
1414
* An introductory [presentation](https://docs.google.com/presentation/d/15Zwb53JcncHfEwHpnG_PoIbbzQ3GQi_cpujYwbpcbZo/edit?usp=sharing).
1515
* The [mailing list](https://groups.google.com/a/chromium.org/forum/#!forum/gn-dev).
16-
* The [bug database](https://bugs.chromium.org/p/gn/issues/list).
16+
* The [bug database](https://gn.issues.chromium.org/issues?q=status:open).
1717

1818
## What GN is for
1919

@@ -107,6 +107,10 @@ On Linux, Mac and z/OS, the default compiler is `clang++`, a recent version is
107107
expected to be found in `PATH`. This can be overridden by setting the `CC`, `CXX`,
108108
and `AR` environment variables.
109109

110+
On MSYS and MinGW, the default compiler is `g++`, a recent version is
111+
expected to be found in `PATH`. This can be overridden by setting the `CC`, `CXX`,
112+
`LD` and `AR` environment variables.
113+
110114
On z/OS, building GN requires [ZOSLIB](https://github.com/ibmruntimes/zoslib) to be
111115
installed, as described at that URL. When building with `build/gen.py`, use the option
112116
`--zoslib-dir` to specify the path to [ZOSLIB](https://github.com/ibmruntimes/zoslib):

gn/build/build_linux.ninja.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ rule cxx
55
deps = gcc
66

77
rule alink_thin
8-
command = rm -f $out && $ar rcsT $out $in
8+
command = $ar rcsT $out $in
99
description = AR $out
1010

1111
rule link

gn/build/gen.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def is_zos(self):
101101
return self._platform == 'zos'
102102

103103
def is_serenity(self):
104-
return self_.platform == 'serenity'
104+
return self._platform == 'serenity'
105105

106106
class ArgumentsList:
107107
"""Helper class to accumulate ArgumentParser argument definitions
@@ -245,7 +245,7 @@ def GenerateLastCommitPosition(host, header):
245245
describe_output = subprocess.check_output(
246246
['git', 'describe', 'HEAD', '--abbrev=12', '--match', ROOT_TAG],
247247
shell=host.is_windows(), cwd=REPO_ROOT)
248-
mo = re.match(ROOT_TAG + '-(\d+)-g([0-9a-f]+)', describe_output.decode())
248+
mo = re.match(ROOT_TAG + r'-(\d+)-g([0-9a-f]+)', describe_output.decode())
249249
if not mo:
250250
raise ValueError(
251251
'Unexpected output from git describe when generating version header')
@@ -317,7 +317,12 @@ def WriteGenericNinja(path, static_libraries, executables,
317317

318318
if platform.is_windows():
319319
executable_ext = '.exe'
320-
library_ext = '.lib'
320+
321+
if platform.is_msvc():
322+
library_ext = '.lib'
323+
else:
324+
library_ext = '.a'
325+
321326
object_ext = '.obj'
322327
else:
323328
executable_ext = ''
@@ -505,21 +510,16 @@ def WriteGNNinja(path, platform, host, options, args_list):
505510
if not options.no_static_libstdcpp:
506511
ldflags.append('-static-libstdc++')
507512

508-
if platform.is_mingw() or platform.is_msys():
509-
cflags.remove('-std=c++20')
510-
cflags.extend([
511-
'-Wno-deprecated-copy',
512-
'-Wno-implicit-fallthrough',
513-
'-Wno-redundant-move',
514-
'-Wno-unused-variable',
515-
'-Wno-format', # Use of %llx, which is supported by _UCRT, false positive
516-
'-Wno-strict-aliasing', # Dereferencing punned pointer
517-
'-Wno-cast-function-type', # Casting FARPROC to RegDeleteKeyExPtr
518-
'-std=gnu++20',
519-
])
520-
else:
521-
# This is needed by libc++.
522-
libs.append('-ldl')
513+
cflags.extend([
514+
'-Wno-deprecated-copy',
515+
'-Wno-implicit-fallthrough',
516+
'-Wno-redundant-move',
517+
'-Wno-unused-variable',
518+
'-Wno-format', # Use of %llx, which is supported by _UCRT, false positive
519+
'-Wno-strict-aliasing', # Dereferencing punned pointer
520+
'-Wno-cast-function-type', # Casting FARPROC to RegDeleteKeyExPtr
521+
])
522+
523523
elif platform.is_darwin():
524524
min_mac_version_flag = '-mmacosx-version-min=10.9'
525525
cflags.append(min_mac_version_flag)

gn/docs/mingw.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Building and using `gn` with MinGW on Windows
2+
3+
At the time of writing: 2024-04-13
4+
Test environment: Windows 11, intel x86_64 CPU
5+
6+
## Requirements
7+
8+
1. Install [MSYS2](https://www.msys2.org/)
9+
1. Start a Terminal windows for MSYS2's MinGW development by opening one of `clang32.exe`, `clang64.exe`, `clangarm64.exe`,`mingw32.exe`, `mingw64.exe`, `ucrt64.exe`.
10+
1. To download clang toolchain, Ninja and git programs, run command: `pacman -S mingw-w64-clang-x86_64-toolchain mingw-w64-clang-x86_64-ninja git`
11+
12+
## Build `gn`
13+
14+
1. To clone `gn` source code, run command: `git clone https://gn.googlesource.com/gn`
15+
1. Run command: `cd gn`
16+
1. Run command: `build/gen.py --platform mingw`
17+
This configuration generates a static executable that does not depend on MSYS2, and can be run in any development environment.
18+
Use `--help` flag to check more configuration options.
19+
Use `--allow-warning` flag to build with warnings.
20+
1. Run command: `ninja -C out`
21+
22+
## Testing
23+
24+
1. Run command: `out/gn --version`
25+
1. Run command: `out/gn_unittests`
26+
27+
> Notes:
28+
>
29+
> For "mingw-w64-clang-x86_64-toolchain" in the clang64 environment, g++ is a copy of clang++.
30+
>
31+
> The toolchain that builds `gn` does not use vendor lock-in compiler command flags,
32+
> so `gn` can be built with these clang++, g++.
33+
>
34+
> However the build rules in [examples/simple_build](../examples/simple_build/) require GCC-specific compiler macros, and thus only work in the `ucrt64` MSYS2 development environment.

0 commit comments

Comments
 (0)