You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add guidance for using MSYS2 in Windows (travis-ci#2587)
There is [demand](https://travis-ci.community/t/3658) for MSYS2 in the Windows environment, but the installation and use of it is rather tricky. Document it for the time being, until the day it is incorporated into the image.
Copy file name to clipboardExpand all lines: user/reference/windows.md
+49Lines changed: 49 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -86,3 +86,52 @@ VMs running Windows use the default file system, NTFS.
86
86
- winscp 5.13.4
87
87
- winscp.install 5.13.4
88
88
- wsl 1.0.1
89
+
90
+
## How do I use MSYS2?
91
+
92
+
[MSYS2](https://www.msys2.org/) is a popular development environment for building GCC-based projects with Unix-style build systems. While it isn't included in the Windows image, it is fairly easy to install via [the Chocolatey package](https://chocolatey.org/packages/msys2) using the following additions to the sections of your `.travis.yml`:
export MAKE=mingw32-make # so that Autotools can find it
112
+
;;
113
+
esac
114
+
115
+
before_cache:
116
+
- |-
117
+
case $TRAVIS_OS_NAME in
118
+
windows)
119
+
# https://unix.stackexchange.com/a/137322/107554
120
+
$msys2 pacman --sync --clean --noconfirm
121
+
;;
122
+
esac
123
+
124
+
cache:
125
+
directories:
126
+
- $HOME/AppData/Local/Temp/chocolatey
127
+
- /C/tools/msys64
128
+
```
129
+
{: data-file=".travis.yml"}
130
+
131
+
This will download and install MSYS2 the first time, and store both the downloaded initial archive and the MSYS2 installation in your [build cache](/user/caching/#arbitrary-directories). Subsequent builds will avoid re-downloading the initial archive and will update the cached installation before use, and cache the updated installation upon success.
132
+
133
+
MSYS2 contains two noteworthy [subsystems](https://github.com/msys2/msys2/wiki/MSYS2-introduction#subsystems): "msys2" and "mingw64". The code above prepares the `$msys2` and `$mingw64` prefixes for entering the corresponding shells. As an example, the `$msys2` prefix is used to run `pacman` appropriately. Your build commands should use the `$mingw64` prefix to build native Windows programs, and the `$msys2` prefix to build POSIX-based programs requiring the MSYS2 DLL.
134
+
135
+
A point of caution: the pre-installed "mingw" Chocolatey package should **not** be used within any MSYS2 subsystem. (In fact, the above snippet uninstalls the "mingw" Chocolatey package to be safe.) Note that the [MSYS2 wiki](https://github.com/msys2/msys2/wiki/MSYS2-introduction#path) says:
136
+
137
+
>Beware that mixing in programs from other MSYS2 installations, Cygwin installations, compiler toolchains or even various other programs is not supported and will probably break things in unexpected ways.
0 commit comments