Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ jobs:
- os: ubuntu-latest
arch: x86_64
cibw_archs: "x86_64"
container: "ci/manylinux_2_28_x86_64-vcpkg-aubio.Dockerfile"
# Linux ARM64 (native, no QEMU)
- os: ubuntu-24.04-arm
arch: aarch64
cibw_archs: "aarch64"
container: "ci/manylinux_2_28_aarch64-vcpkg-aubio.Dockerfile"
# Windows AMD64
- os: windows-latest
triplet: x64-windows-release
arch: AMD64
cibw_archs: "AMD64"
# macOS x86_64 (Intel)
Expand All @@ -88,9 +91,51 @@ jobs:
with:
submodules: 'recursive'

- name: Set up Docker Buildx
if: runner.os == 'Linux'
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
buildkitd-flags: --debug

- name: Cache Docker layers
if: runner.os == 'Linux'
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/.buildx-cache
key: ${{ runner.os }}-${{ matrix.arch }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-buildx-

- name: Build Docker image with vcpkg and aubio dependencies ${{ matrix.os }} ${{ matrix.arch }}
if: runner.os == 'Linux'
# using build-push-action (without push) to make use of cache arguments
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.container }}
tags: manylinux-${{ matrix.arch }}-vcpkg-aubio:latest
push: false
load: true
cache-from: type=local,src=${{ runner.temp }}/.buildx-cache
cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max
env:
BUILDKIT_PROGRESS: plain

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
if: runner.os == 'Linux'
run: |
rm -rf ${{ runner.temp }}/.buildx-cache
mv ${{ runner.temp }}/.buildx-cache-new ${{ runner.temp }}/.buildx-cache

# Cache vcpkg_installed directory to avoid rebuilding dependencies
# This caches the installed packages directory which is reused across builds
- name: Cache vcpkg installed packages ${{ matrix.os }} ${{ matrix.arch }}
if: runner.os != 'Linux'
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/vcpkg_installed
Expand All @@ -101,18 +146,19 @@ jobs:
- name: Install build tools (macOS)
if: runner.os == 'macOS'
run: |
echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.macoosx_deployment_target }}" >> $GITHUB_ENV
# Install nasm (required by vcpkg for ffmpeg assembly optimizations)
brew install nasm

# macOS vcpkg setup - build dependencies from source with correct deployment target
- name: Install vcpkg dependencies ${{ matrix.os }} ${{ matrix.arch }}
if: runner.os == 'macOS'
if: runner.os != 'Linux'
shell: bash
env:
VCPKG_BUILD_TYPE: "release"
run: |
echo "Building vcpkg dependencies for ${{ matrix.os }} ${{ matrix.arch }} with deployment target ${{ matrix.macoosx_deployment_target }}"
$VCPKG_INSTALLATION_ROOT/vcpkg install --triplet=${{ matrix.triplet }}
echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.macoosx_deployment_target }}" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=${{ github.workspace }}/vcpkg_installed/${{ matrix.triplet }}" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=${{ github.workspace }}/vcpkg_installed/${{ matrix.triplet }}/lib/pkgconfig:${{ github.workspace }}/vcpkg_installed/${{ matrix.triplet }}/share/pkgconfig" >> $GITHUB_ENV

Expand Down
47 changes: 47 additions & 0 deletions ci/manylinux_2_28_aarch64-vcpkg-aubio.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#This Dockerfile sets up a manylinux_2_28_aarch64 environment with vcpkg
# and installs aubio dependencies using a custom triplet.
# It is based on the official manylinux image and includes necessary
# tools and libraries for building Python wheels with aubio support.
# Use the latest stable manylinux_2_28_aarch64 image

FROM quay.io/pypa/manylinux_2_28_aarch64:2025.11.11-1


RUN dnf -y install curl zip unzip tar ninja-build git make nasm

# Install vcpkg and checkout a specific commit for reproducibility
RUN git clone https://github.com/Microsoft/vcpkg.git /opt/vcpkg && \
git -C /opt/vcpkg checkout da096fdc67db437bee863ae73c4c12e289f82789

ENV VCPKG_INSTALLATION_ROOT="/opt/vcpkg"
ENV PATH="${PATH}:/opt/vcpkg"

ENV VCPKG_DEFAULT_TRIPLET="arm64-linux-pic"
# pkgconf fails to build with default debug mode of arm64-linux host
ENV VCPKG_DEFAULT_HOST_TRIPLET="arm64-linux-release"

# Must be set when building on arm
ENV VCPKG_FORCE_SYSTEM_BINARIES=1

# mkdir & touch -> workaround for https://github.com/microsoft/vcpkg/issues/27786
RUN bootstrap-vcpkg.sh && \
mkdir -p /root/.vcpkg/ $HOME/.vcpkg && \
touch /root/.vcpkg/vcpkg.path.txt $HOME/.vcpkg/vcpkg.path.txt && \
vcpkg integrate install && \
vcpkg integrate bash

COPY vcpkg-triplets/arm64-linux-pic.cmake opt/vcpkg/custom-triplets/arm64-linux-pic.cmake
COPY vcpkg.json opt/vcpkg/

ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/vcpkg/installed/arm64-linux-pic/lib"
RUN vcpkg install --overlay-triplets=opt/vcpkg/custom-triplets \
--feature-flags="versions,manifests" \
--x-manifest-root=opt/vcpkg \
--x-install-root=opt/vcpkg/installed \
--clean-after-build && \
vcpkg list && \
rm -rf /opt/vcpkg/buildtrees /opt/vcpkg/downloads
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/vcpkg/installed/arm64-linux-pic/lib:/opt/vcpkg/installed/arm64-linux-release/lib"
# setting git safe directory is required for properly building wheels when
# git >= 2.35.3
RUN git config --global --add safe.directory "*"
41 changes: 41 additions & 0 deletions ci/manylinux_2_28_x86_64-vcpkg-aubio.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#This Dockerfile sets up a manylinux_2_28_x86_64 environment with vcpkg
# and installs aubio dependencies using a custom triplet.
# It is based on the official manylinux image and includes necessary
# tools and libraries for building Python wheels with aubio support.
# Use the latest stable manylinux_2_28_x86_64 image

FROM quay.io/pypa/manylinux_2_28_x86_64:2025.11.11-1


RUN dnf -y install curl zip unzip tar ninja-build git make nasm
# Install vcpkg and checkout a specific commit for reproducibility
RUN git clone https://github.com/Microsoft/vcpkg.git /opt/vcpkg && \
git -C /opt/vcpkg checkout da096fdc67db437bee863ae73c4c12e289f82789

ENV VCPKG_INSTALLATION_ROOT="/opt/vcpkg"
ENV PATH="${PATH}:/opt/vcpkg"

ENV VCPKG_DEFAULT_TRIPLET="x64-linux-pic"

# mkdir & touch -> workaround for https://github.com/microsoft/vcpkg/issues/27786
RUN bootstrap-vcpkg.sh && \
mkdir -p /root/.vcpkg/ $HOME/.vcpkg && \
touch /root/.vcpkg/vcpkg.path.txt $HOME/.vcpkg/vcpkg.path.txt && \
vcpkg integrate install && \
vcpkg integrate bash

COPY vcpkg-triplets/x64-linux-pic.cmake opt/vcpkg/custom-triplets/x64-linux-pic.cmake
COPY vcpkg.json opt/vcpkg/

ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/vcpkg/installed/x64-linux-pic/lib"
RUN vcpkg install --overlay-triplets=opt/vcpkg/custom-triplets \
--feature-flags="versions,manifests" \
--x-manifest-root=opt/vcpkg \
--x-install-root=opt/vcpkg/installed \
--clean-after-build && \
vcpkg list && \
rm -rf /opt/vcpkg/buildtrees /opt/vcpkg/downloads
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/vcpkg/installed/x64-linux-pic/lib:/opt/vcpkg/installed/x64-linux/lib"
# setting git safe directory is required for properly building wheels when
# git >= 2.35.3
RUN git config --global --add safe.directory "*"
71 changes: 38 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ build = ["cp310-*", "cp311-*", "cp312-*", "cp313-*","cp314-*"]
before-build = "pip install \"meson>=1.9.0\" meson-python ninja \"numpy>=1.26.4\""
# Skip 32-bit builds and musllinux wheels
skip = ["*-win32", "*-manylinux_i686", "*-musllinux*"]

manylinux-x86_64-image = "manylinux-x86_64-vcpkg-aubio:latest"
manylinux-aarch64-image = "manylinux-aarch64-vcpkg-aubio:latest"
# Test the wheels - ensure they're portable by verifying imports work
test-requires = ["pytest", "numpy>=1.26.4"]
# First test: Verify aubio can be imported (ensures DLLs are bundled on Windows)
Expand Down Expand Up @@ -77,50 +78,54 @@ build-frontend = { name = "pip", args = ["--no-build-isolation"] }
# These are transitive dependencies of libsndfile[external-libs] that must be installed
# to avoid undefined symbol errors during static linking
before-all = """
yum install -y git zip unzip tar curl make nasm && \
if [ ! -d /tmp/vcpkg ]; then
git clone https://github.com/microsoft/vcpkg.git /tmp/vcpkg && \
cd /tmp/vcpkg && ./bootstrap-vcpkg.sh -disableMetrics
fi && \
if [ "$AUDITWHEEL_ARCH" = "x86_64" ]; then
VCPKG_TRIPLET=x64-linux-pic
elif [ "$AUDITWHEEL_ARCH" = "aarch64" ]; then
VCPKG_TRIPLET=arm64-linux-pic
else
echo "ERROR: Unknown architecture: $AUDITWHEEL_ARCH"
exit 1
fi && \
echo "=== Installing vcpkg dependencies for $AUDITWHEEL_ARCH (triplet: $VCPKG_TRIPLET) ===" && \
cd {project} && \
CC=/opt/rh/gcc-toolset-14/root/usr/bin/gcc \
CXX=/opt/rh/gcc-toolset-14/root/usr/bin/g++ \
VCPKG_BUILD_TYPE=release \
/tmp/vcpkg/vcpkg install --triplet=$VCPKG_TRIPLET --overlay-triplets=./vcpkg-triplets --allow-unsupported && \
echo "=== Vcpkg installation complete ===" && \
echo "Installed packages in vcpkg_installed/$VCPKG_TRIPLET/:" && \
ls -la {project}/vcpkg_installed/$VCPKG_TRIPLET/lib/pkgconfig/ 2>/dev/null || echo "No pkgconfig directory found" && \
echo "Static libraries:" && \
ls -la {project}/vcpkg_installed/$VCPKG_TRIPLET/lib/*.a 2>/dev/null | head -20 || echo "No static libraries found"
dnf install -y git zip unzip tar curl make nasm
# if [ ! -d /tmp/vcpkg ]; then
# git clone https://github.com/microsoft/vcpkg.git /tmp/vcpkg && \
# cd /tmp/vcpkg && ./bootstrap-vcpkg.sh -disableMetrics
# fi && \
# if [ "$AUDITWHEEL_ARCH" = "x86_64" ]; then
# VCPKG_TRIPLET=x64-linux-pic
# elif [ "$AUDITWHEEL_ARCH" = "aarch64" ]; then
# VCPKG_TRIPLET=arm64-linux-pic
# else
# echo "ERROR: Unknown architecture: $AUDITWHEEL_ARCH"
# exit 1
# fi && \
# echo "=== Installing vcpkg dependencies for $AUDITWHEEL_ARCH (triplet: $VCPKG_TRIPLET) ===" && \
# cd {project} && \
# CC=/opt/rh/gcc-toolset-14/root/usr/bin/gcc \
# CXX=/opt/rh/gcc-toolset-14/root/usr/bin/g++ \
# VCPKG_BUILD_TYPE=release \
# /tmp/vcpkg/vcpkg install --triplet=$VCPKG_TRIPLET --overlay-triplets=./vcpkg-triplets --allow-unsupported && \
# echo "=== Vcpkg installation complete ===" && \
# echo "Installed packages in vcpkg_installed/$VCPKG_TRIPLET/:" && \
# ls -la {project}/vcpkg_installed/$VCPKG_TRIPLET/lib/pkgconfig/ 2>/dev/null || echo "No pkgconfig directory found" && \
# echo "Static libraries:" && \
# ls -la {project}/vcpkg_installed/$VCPKG_TRIPLET/lib/*.a 2>/dev/null | head -20 || echo "No static libraries found"
"""

[tool.cibuildwheel.linux.environment]
# Set paths for both architectures - Meson will detect and use the correct one based on host_machine.cpu_family()
# This works because only one triplet directory will exist (installed in before-all based on AUDITWHEEL_ARCH)
CMAKE_PREFIX_PATH = "{project}/vcpkg_installed/x64-linux-pic:{project}/vcpkg_installed/arm64-linux-pic"
PKG_CONFIG_PATH = "{project}/vcpkg_installed/x64-linux-pic/lib/pkgconfig:{project}/vcpkg_installed/x64-linux-pic/share/pkgconfig:{project}/vcpkg_installed/arm64-linux-pic/lib/pkgconfig:{project}/vcpkg_installed/arm64-linux-pic/share/pkgconfig"
# Use gcc-toolset-14 for C++17 support (required by rubberband)
CC = "/opt/rh/gcc-toolset-14/root/usr/bin/gcc"
CXX = "/opt/rh/gcc-toolset-14/root/usr/bin/g++"


# CMAKE_PREFIX_PATH = "{project}/vcpkg_installed/x64-linux-pic:{project}/vcpkg_installed/arm64-linux-pic"
# PKG_CONFIG_PATH = "{project}/vcpkg_installed/x64-linux-pic/lib/pkgconfig:{project}/vcpkg_installed/x64-linux-pic/share/pkgconfig:{project}/vcpkg_installed/arm64-linux-pic/lib/pkgconfig:{project}/vcpkg_installed/arm64-linux-pic/share/pkgconfig"
# # Use gcc-toolset-14 for C++17 support (required by rubberband)
# CC = "/opt/rh/gcc-toolset-14/root/usr/bin/gcc"
# CXX = "/opt/rh/gcc-toolset-14/root/usr/bin/g++"
VCPKG_INSTALL = "$VCPKG_INSTALLATION_ROOT/installed/$VCPKG_DEFAULT_TRIPLET"
PKG_CONFIG_PATH = "$VCPKG_INSTALL/lib/pkgconfig:$VCPKG_INSTALL/share/pkgconfig:$VCPKG_INSTALL/lib/pkgconfig:$VCPKG_INSTALLATION_ROOT/installed/x64-linux-release/lib/pkgconfig:$VCPKG_INSTALLATION_ROOT/installed/x64-linux-release/share/pkgconfig"

[[tool.cibuildwheel.overrides]]
select = "*-manylinux_aarch64*"
environment = { PKG_CONFIG_PATH = "$VCPKG_INSTALL/lib/pkgconfig:$VCPKG_INSTALL/share/pkgconfig:$VCPKG_INSTALL/lib/pkgconfig:$VCPKG_INSTALLATION_ROOT/installed/arm64-linux-release/lib/pkgconfig:$VCPKG_INSTALLATION_ROOT/installed/arm64-linux-release/share/pkgconfig" }
[tool.cibuildwheel.windows]
# Windows: Use vcpkg to install dependencies before building
# GitHub Actions runners have vcpkg pre-installed at VCPKG_INSTALLATION_ROOT
# Install to project directory (omit --vcpkg-root) so packages go to vcpkg_installed
# Use built-in triplet x64-windows-release for release-only builds with dynamic libs
# (rubberband requires dynamic linking on Windows)
before-all = [
"cd {project} && if not exist vcpkg_installed %VCPKG_INSTALLATION_ROOT%\\vcpkg.exe install --triplet=x64-windows-release",
# "cd {project} && if not exist vcpkg_installed %VCPKG_INSTALLATION_ROOT%\\vcpkg.exe install --triplet=x64-windows-release",
"dir {project}\\vcpkg_installed\\x64-windows-release\\lib\\pkgconfig",
]

Expand Down
10 changes: 8 additions & 2 deletions vcpkg-triplets/arm64-linux-pic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_BUILD_TYPE release)

# Force position-independent code for all static libraries
# This is critical for FFmpeg and other dependencies when linking into shared libraries
# This is critical for linking into shared objects (.so files)
set(VCPKG_C_FLAGS "-fPIC")
set(VCPKG_CXX_FLAGS "-fPIC")
if(PORT MATCHES "ffmpeg")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
if(PORT MATCHES "rubberband")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
7 changes: 7 additions & 0 deletions vcpkg-triplets/x64-linux-pic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_BUILD_TYPE release)

# Force position-independent code for all static libraries
# This is critical for linking into shared objects (.so files)
set(VCPKG_C_FLAGS "-fPIC")
set(VCPKG_CXX_FLAGS "-fPIC")
if(PORT MATCHES "ffmpeg")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
if(PORT MATCHES "rubberband")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
41 changes: 9 additions & 32 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,21 @@
"pkgconf",
{
"name": "libsndfile",
"default-features": false,
"features": ["external-libs"]
"default-features": false
},
"libsamplerate",
"fftw3",
{
"name": "mpg123",
"platform": "linux"
},
{
"name": "mp3lame",
"platform": "linux"
},
{
"name": "opus",
"platform": "linux"
},
{
"name": "libogg",
"platform": "linux"
},
{
"name": "libvorbis",
"platform": "linux"
},
{
"name": "libflac",
"platform": "linux"
},
{
"name": "rubberband",
"platform": "!linux"
},
"libvorbis",
"rubberband",
"mp3lame",
"liblzma",
"opus",
"libogg",
"libflac",
{
"name": "ffmpeg",
"default-features": false,
"features": ["avcodec", "avformat", "swresample"],
"platform": "!linux"
"features": ["avcodec", "avformat", "swresample"]
}
]
}