Skip to content

Commit b322441

Browse files
committed
use github arm64 runner
1 parent e08727b commit b322441

File tree

2 files changed

+11
-116
lines changed

2 files changed

+11
-116
lines changed

.github/workflows/build-ffmpeg.yml

+3-73
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
- os: windows-latest
3636
arch: AMD64
3737
shell: 'msys2 {0}'
38+
- os: ubuntu-24.04-arm
39+
arch: aarch64
40+
shell: bash
3841
defaults:
3942
run:
4043
shell: ${{ matrix.shell }}
@@ -76,76 +79,3 @@ jobs:
7679
with:
7780
name: output-${{ matrix.os }}-${{ matrix.arch }}
7881
path: output/
79-
80-
build-qemu-stage-1:
81-
runs-on: ${{ matrix.os }}
82-
strategy:
83-
fail-fast: false
84-
matrix:
85-
arch: [aarch64]
86-
os: [ubuntu-latest]
87-
env:
88-
stage: 1
89-
steps:
90-
- uses: actions/checkout@v4
91-
- uses: actions/setup-python@v5
92-
with:
93-
python-version: "3.13"
94-
- name: Set up QEMU
95-
uses: docker/setup-qemu-action@v3
96-
- name: Build FFmpeg dependencies
97-
run: |
98-
docker run -v $PWD:/project:rw --workdir=/project quay.io/pypa/manylinux2014_${{ matrix.arch }} bash -exc '
99-
export PATH=/opt/python/cp39-cp39/bin:$PATH;
100-
export CIBUILDWHEEL=1;
101-
python scripts/build-ffmpeg.py /tmp/vendor --enable-gpl --stage ${{ env.stage }};
102-
cp -ar /tmp/vendor /project;
103-
'
104-
shell: bash
105-
- uses: actions/upload-artifact@v4
106-
with:
107-
name: stage-1-${{ matrix.os }}-${{ matrix.arch }}
108-
path: vendor
109-
110-
build-qemu-stage-2:
111-
needs: build-qemu-stage-1
112-
runs-on: ${{ matrix.os }}
113-
strategy:
114-
fail-fast: false
115-
matrix:
116-
arch: [aarch64]
117-
os: [ubuntu-latest]
118-
env:
119-
stage: 2
120-
steps:
121-
- uses: actions/checkout@v4
122-
- uses: actions/setup-python@v5
123-
with:
124-
python-version: "3.13"
125-
- name: Set up QEMU
126-
uses: docker/setup-qemu-action@v3
127-
- uses: actions/download-artifact@v4
128-
with:
129-
name: stage-1-${{ matrix.os }}-${{ matrix.arch }}
130-
path: vendor
131-
- name: Build FFmpeg
132-
env:
133-
CIBW_ARCHS: ${{ matrix.arch }}
134-
CIBW_BEFORE_ALL_LINUX: |
135-
yum install -y openssl-devel
136-
cp -ar vendor /tmp
137-
CIBW_BEFORE_BUILD: python scripts/build-ffmpeg.py /tmp/vendor --enable-gpl --stage ${{ env.stage }}
138-
CIBW_BUILD: cp39-*
139-
CIBW_REPAIR_WHEEL_COMMAND_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH auditwheel repair -w {dest_dir} {wheel}
140-
CIBW_SKIP: "*musllinux*"
141-
CIBW_TEST_COMMAND: python -c "import dummy"
142-
run: |
143-
pip install cibuildwheel
144-
cibuildwheel --output-dir output
145-
rm -f output/*.whl
146-
shell: bash
147-
- name: Upload FFmpeg
148-
uses: actions/upload-artifact@v4
149-
with:
150-
name: output-${{ matrix.os }}-${{ matrix.arch }}
151-
path: output/

scripts/build-ffmpeg.py

+8-43
Original file line numberDiff line numberDiff line change
@@ -204,24 +204,15 @@
204204
)
205205

206206

207-
def download_tars(use_gnutls, stage):
207+
def download_tars(use_gnutls):
208208
# Try to download all tars at the start.
209209
# If there is an curl error, do nothing, then try again in `main()`
210210

211211
local_libs = library_group
212212
if use_gnutls:
213213
local_libs += gnutls_group
214214

215-
if stage is None:
216-
the_packages = local_libs + codec_group
217-
elif stage == 0:
218-
the_packages = local_libs
219-
elif stage == 1:
220-
the_packages = codec_group
221-
else:
222-
the_packages = []
223-
224-
for package in the_packages:
215+
for package in local_libs + codec_group:
225216
tarball = os.path.join(
226217
os.path.abspath("source"),
227218
package.source_filename or package.source_url.split("/")[-1],
@@ -238,18 +229,12 @@ def main():
238229

239230
parser = argparse.ArgumentParser("build-ffmpeg")
240231
parser.add_argument("destination")
241-
parser.add_argument(
242-
"--stage",
243-
default=None,
244-
help="AArch64 build requires stage and possible values can be 1, 2",
245-
)
246232
parser.add_argument("--enable-gpl", action="store_true")
247233
parser.add_argument("--disable-gpl", action="store_true")
248234

249235
args = parser.parse_args()
250236

251237
dest_dir = args.destination
252-
build_stage = None if args.stage is None else int(args.stage) - 1
253238
disable_gpl = args.disable_gpl
254239
del args
255240

@@ -258,8 +243,6 @@ def main():
258243
# FFmpeg has native TLS backends for macOS and Windows
259244
use_gnutls = plat == "Linux"
260245

261-
if plat == "Linux" and os.environ.get("CIBUILDWHEEL") == "1":
262-
output_dir = "/output"
263246
output_tarball = os.path.join(output_dir, f"ffmpeg-{get_platform()}.tar.gz")
264247

265248
if os.path.exists(output_tarball):
@@ -268,25 +251,11 @@ def main():
268251
builder = Builder(dest_dir=dest_dir)
269252
builder.create_directories()
270253

271-
download_tars(use_gnutls, build_stage)
254+
download_tars(use_gnutls)
272255

273256
# install packages
274257
available_tools = set()
275-
if plat == "Linux" and os.environ.get("CIBUILDWHEEL") == "1":
276-
with log_group("install packages"):
277-
run(
278-
[
279-
"yum",
280-
"-y",
281-
"install",
282-
"gperf",
283-
"libuuid-devel",
284-
"libxcb-devel",
285-
"zlib-devel",
286-
]
287-
)
288-
available_tools.update(["gperf"])
289-
elif plat == "Windows":
258+
if plat == "Windows":
290259
available_tools.update(["gperf", "nasm"])
291260

292261
# print tool locations
@@ -372,10 +341,7 @@ def main():
372341
library_group += gnutls_group
373342

374343
package_groups = [library_group + codec_group, [ffmpeg_package]]
375-
if build_stage is not None:
376-
packages = package_groups[build_stage]
377-
else:
378-
packages = [p for p_list in package_groups for p in p_list]
344+
packages = [p for p_list in package_groups for p in p_list]
379345

380346
for package in packages:
381347
if disable_gpl and package.gpl:
@@ -386,7 +352,7 @@ def main():
386352
else:
387353
builder.build(package)
388354

389-
if plat == "Windows" and (build_stage is None or build_stage == 1):
355+
if plat == "Windows":
390356
# fix .lib files being installed in the wrong directory
391357
for name in (
392358
"avcodec",
@@ -436,9 +402,8 @@ def main():
436402
run(["strip", "-s"] + libraries)
437403

438404
# build output tarball
439-
if build_stage is None or build_stage == 1:
440-
os.makedirs(output_dir, exist_ok=True)
441-
run(["tar", "czvf", output_tarball, "-C", dest_dir, "bin", "include", "lib"])
405+
os.makedirs(output_dir, exist_ok=True)
406+
run(["tar", "czvf", output_tarball, "-C", dest_dir, "bin", "include", "lib"])
442407

443408

444409
if __name__ == "__main__":

0 commit comments

Comments
 (0)