Skip to content

Commit 46fd271

Browse files
author
Michal Klocek
committed
Merge remote-tracking branch 'origin/upstream-master' into HEAD
Change-Id: Ic9b02e17d25d2355831a274ad434a3bbd10357a7
2 parents 0bf7ef4 + 2cc5391 commit 46fd271

File tree

77 files changed

+2007
-911
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

+2007
-911
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: 8 additions & 4 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
@@ -263,7 +263,7 @@ def GenerateLastCommitPosition(host, header):
263263
describe_output = subprocess.check_output(
264264
['git', 'describe', 'HEAD', '--abbrev=12', '--match', ROOT_TAG],
265265
shell=host.is_windows(), cwd=REPO_ROOT)
266-
mo = re.match(ROOT_TAG + '-(\\d+)-g([0-9a-f]+)', describe_output.decode())
266+
mo = re.match(ROOT_TAG + r'-(\d+)-g([0-9a-f]+)', describe_output.decode())
267267
if not mo:
268268
raise ValueError(
269269
'Unexpected output from git describe when generating version header')
@@ -340,7 +340,12 @@ def WriteGenericNinja(path, static_libraries, executables,
340340

341341
if platform.is_windows():
342342
executable_ext = '.exe'
343-
library_ext = '.lib'
343+
344+
if platform.is_msvc():
345+
library_ext = '.lib'
346+
else:
347+
library_ext = '.a'
348+
344349
object_ext = '.obj'
345350
else:
346351
executable_ext = ''
@@ -560,7 +565,6 @@ def WriteGNNinja(path, platform, host, options, args_list):
560565
'-Wno-implicit-fallthrough',
561566
'-Wno-redundant-move',
562567
'-Wno-unused-variable',
563-
'-Wno-parentheses-equality',
564568
'-Wno-format', # Use of %llx, which is supported by _UCRT, false positive
565569
'-Wno-strict-aliasing', # Dereferencing punned pointer
566570
'-Wno-cast-function-type', # Casting FARPROC to RegDeleteKeyExPtr

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)