Skip to content

Commit 36131f5

Browse files
committed
auto merge of #16691 : klutzy/rust/issue-15297, r=alexcrichton
First commit fixes issue regarding recognizing MSYS2 build. Second commit fixes issue regarding MSYS/Windows paths.
2 parents 1153ad3 + 7eb35bc commit 36131f5

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ To easily build on windows we can use [MSYS2](http://sourceforge.net/projects/ms
7171
3. With that now start `mingw32_shell.bat` from where you installed MSYS2 (i.e. `C:\msys`).
7272
4. From there just navigate to where you have Rust's source code, configure and build it:
7373

74-
$ ./configure --build=i686-pc-mingw32
74+
$ ./configure
7575
$ make && make install
7676

7777
[repo]: https://github.com/rust-lang/rust

configure

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,19 @@ case $CFG_OSTYPE in
299299
CFG_OSTYPE=apple-darwin
300300
;;
301301

302-
MINGW32*)
302+
MINGW*)
303+
# msys' `uname` does not print gcc configuration, but prints msys
304+
# configuration. so we cannot believe `uname -m`:
305+
# msys1 is always i686 and msys2 is always x86_64.
306+
# instead, msys defines $MSYSTEM which is MINGW32 on i686 and
307+
# MINGW64 on x86_64.
308+
CFG_CPUTYPE=i686
303309
CFG_OSTYPE=pc-mingw32
304-
;;
305-
306-
MINGW64*)
307-
# msys2, MSYSTEM=MINGW64
308-
CFG_OSTYPE=w64-mingw32
310+
if [ "$MSYSTEM" = MINGW64 ]
311+
then
312+
CFG_CPUTYPE=x86_64
313+
CFG_OSTYPE=w64-mingw32
314+
fi
309315
;;
310316

311317
# Thad's Cygwin identifers below

src/etc/maketest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
# msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
1616
# `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
1717
# the value is list of paths.
18+
# (if there is only one path, it becomes `c:/real/abs/path`.)
1819
# this causes great confusion and error: shell and Makefile doesn't like
1920
# windows paths so it is really error-prone. revert it for peace.
2021
def normalize_path(v):
21-
# c:\path -> /c/path
22-
if ':\\' in v:
23-
v = '/' + v.replace(':\\', '/')
2422
v = v.replace('\\', '/')
23+
# c:/path -> /c/path
24+
if ':/' in v:
25+
v = '/' + v.replace(':/', '/')
2526
return v
2627

2728

0 commit comments

Comments
 (0)