forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
298 lines (254 loc) · 8.84 KB
/
mingw.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
name: Build
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
msystem: ['MINGW64','MINGW32','UCRT64','CLANG64','CLANG32']
include:
- msystem: MINGW64
prefix: mingw-w64-x86_64
- msystem: MINGW32
prefix: mingw-w64-i686
- msystem: UCRT64
prefix: mingw-w64-ucrt-x86_64
- msystem: CLANG64
prefix: mingw-w64-clang-x86_64
- msystem: CLANG32
prefix: mingw-w64-clang-i686
steps:
- name: Setup git
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
release: false
update: true
install: >-
make
binutils
autoconf
autoconf-archive
automake-wrapper
tar
gzip
${{ matrix.prefix }}-toolchain
${{ matrix.prefix }}-expat
${{ matrix.prefix }}-bzip2
${{ matrix.prefix }}-libffi
${{ matrix.prefix }}-mpdecimal
${{ matrix.prefix }}-ncurses
${{ matrix.prefix }}-openssl
${{ matrix.prefix }}-sqlite3
${{ matrix.prefix }}-tcl
${{ matrix.prefix }}-tk
${{ matrix.prefix }}-zlib
${{ matrix.prefix }}-xz
${{ matrix.prefix }}-tzdata
- name: Build Python
shell: msys2 {0}
run: |
set -ex
if [[ "${{ matrix.msystem }}" == "CLANG64" ]] || [[ "${{ matrix.msystem }}" == "CLANG32" ]]; then
export CC=clang
export CXX=clang++
fi
autoreconf -vfi
rm -Rf _build && mkdir _build && cd _build
../configure \
--prefix=${MINGW_PREFIX} \
--host=${MINGW_CHOST} \
--build=${MINGW_CHOST} \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--with-system-libmpdec \
--without-ensurepip \
--enable-loadable-sqlite-extensions \
--with-tzpath=${MINGW_PREFIX}/share/zoneinfo \
--enable-optimizations
make -j8
- name: Run Smoke Test (build)
shell: msys2 {0}
run: |
export SETUPTOOLS_USE_DISTUTILS=stdlib
SMOKETESTS="$(pwd)/mingw_smoketests.py"
cd _build
./python.exe "$SMOKETESTS"
MSYSTEM= ./python.exe "$SMOKETESTS"
- name: Run tests
shell: msys2 {0}
run: |
export SETUPTOOLS_USE_DISTUTILS=stdlib
IGNOREFILE="$(pwd)/mingw_ignorefile.txt"
cd _build
MSYSTEM= ./python.exe -m test -j8 --ignorefile "$IGNOREFILE" -W
- name: Run broken tests
continue-on-error: true
shell: msys2 {0}
run: |
export SETUPTOOLS_USE_DISTUTILS=stdlib
IGNOREFILE="$(pwd)/mingw_ignorefile.txt"
cd _build
MSYSTEM= ./python.exe -m test -j8 --matchfile "$IGNOREFILE" -W
- name: Install
shell: msys2 {0}
run: |
set -ex
cd _build
pkgdir=python_pkgdir
make -j1 install DESTDIR="${pkgdir}"
# Fix shebangs
_pybasever=$(./python.exe -c "import sys; print(f'{sys.version_info[0]}.{sys.version_info[1]}');")
for fscripts in 2to3 2to3-${_pybasever} idle3 idle${_pybasever} pydoc3 pydoc${_pybasever}; do
sed -i "s|$(cygpath -w ${MINGW_PREFIX} | sed 's|\\|\\\\|g')/bin/python${_pybasever}.exe|/usr/bin/env python${_pybasever}.exe|g" "${pkgdir}${MINGW_PREFIX}"/bin/${fscripts}
done
sed -i "s|#!${MINGW_PREFIX}/bin/python${_pybasever}.exe|#!/usr/bin/env python${_pybasever}.exe|" "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/config-${_pybasever}/python-config.py
# Create version-less aliases
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3.exe "${pkgdir}${MINGW_PREFIX}"/bin/python.exe
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3w.exe "${pkgdir}${MINGW_PREFIX}"/bin/pythonw.exe
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3-config "${pkgdir}${MINGW_PREFIX}"/bin/python-config
cp "${pkgdir}${MINGW_PREFIX}"/bin/idle3 "${pkgdir}${MINGW_PREFIX}"/bin/idle
cp "${pkgdir}${MINGW_PREFIX}"/bin/pydoc3 "${pkgdir}${MINGW_PREFIX}"/bin/pydoc
# copy to /
cp -rf "${pkgdir}"/* /
- name: Run Smoke Test (installed)
shell: msys2 {0}
run: |
export SETUPTOOLS_USE_DISTUTILS=stdlib
export PYTHONTZPATH="${MINGW_PREFIX}/share/zoneinfo"
export PYTHONLEGACYWINDOWSDLLLOADING=1
SMOKETESTS="$(pwd)/mingw_smoketests.py"
cd _build
cd python_pkgdir/${MINGW_PREFIX}/bin
./python.exe "$SMOKETESTS"
MSYSTEM= ./python.exe "$SMOKETESTS"
- name: Compress
if: always()
shell: msys2 {0}
run: |
cd _build
tar -zcf python.tar.gz python_pkgdir/
- name: Upload
uses: actions/upload-artifact@v3
if: always()
with:
name: build-${{ matrix.msystem }}
path: _build/python.tar.gz
cross-gcc-x86_64:
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
pacman --noconfirm -Suuy
pacman --needed --noconfirm -S mingw-w64-gcc autoconf-archive autoconf automake zip
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Check Python Version
run: |
which python
python --version
- name: Build
run: |
autoreconf -vfi
mkdir _build && cd _build
../configure \
--host=x86_64-w64-mingw32 \
--build=x86_64-pc-linux-gnu \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--with-system-libmpdec \
--without-ensurepip \
--enable-loadable-sqlite-extensions \
--with-build-python=python3.11
make -j8
make install DESTDIR="$(pwd)/install"
- name: 'Zip files'
run: |
zip -r install.zip _build/install
- name: Upload
uses: actions/upload-artifact@v3
with:
name: build-cross-gcc-x86_64
path: install.zip
cross-gcc-x86_64-test:
needs: [cross-gcc-x86_64]
runs-on: windows-latest
steps:
- uses: actions/download-artifact@v3
with:
name: build-cross-gcc-x86_64
- name: 'Run tests'
run: |
7z x install.zip
./_build/install/usr/local/bin/python3.exe -c "import sysconfig, pprint; pprint.pprint(sysconfig.get_config_vars())"
cross-llvm-mingw:
runs-on: ubuntu-latest
container:
image: mstorsjo/llvm-mingw:latest
strategy:
fail-fast: false
matrix:
arch: ['x86_64', 'i686', 'aarch64', 'armv7']
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get install -qqy software-properties-common
add-apt-repository --yes ppa:deadsnakes/ppa
apt-get update -qq
apt-get install -qqy autoconf-archive python3.11-dev python3.11
- name: Build
run: |
autoreconf -vfi
mkdir _build && cd _build
export CC=${{ matrix.arch }}-w64-mingw32-clang
export CXX=${CC}++
../configure \
--host=${{ matrix.arch }}-w64-mingw32 \
--build=x86_64-pc-linux-gnu \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--with-system-libmpdec \
--without-ensurepip \
--without-c-locale-coercion \
--enable-loadable-sqlite-extensions \
--with-build-python=python3.11
make -j8
make install DESTDIR="$(pwd)/install"
- name: 'Zip files'
run: |
zip -r install.zip _build/install
- name: Upload
uses: actions/upload-artifact@v3
with:
name: build-cross-llvm-mingw-${{ matrix.arch }}
path: install.zip
cross-llvm-mingw-test:
needs: [cross-llvm-mingw]
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
arch: ['x86_64', 'i686']
steps:
- uses: actions/download-artifact@v3
with:
name: build-cross-llvm-mingw-${{ matrix.arch }}
- name: 'Run tests'
run: |
7z x install.zip
./_build/install/usr/local/bin/python3.exe -c "import sysconfig, pprint; pprint.pprint(sysconfig.get_config_vars())"