Skip to content

Commit

Permalink
WIP: Build linux-aarch64 artifacts
Browse files Browse the repository at this point in the history
- verify compiler flags
  • Loading branch information
bgilbert committed Sep 9, 2024
1 parent 0a45c2d commit aecb863
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 15 deletions.
38 changes: 26 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
outputs:
archive_base: ${{ steps.prep.outputs.archive_base }}
archive: ${{ steps.prep.outputs.archive }}
systems: ${{ steps.systems.outputs.systems }}
matrix: ${{ steps.matrix.outputs.matrix }}
version: ${{ steps.prep.outputs.version }}
steps:
- name: Check out repo
Expand Down Expand Up @@ -130,27 +130,41 @@ jobs:
echo "https://pypi.org/help/#file-size-limit"
exit 1
fi
- name: Compute bdist systems
id: systems
- name: Compute bdist matrix
id: matrix
shell: python
run: |
import json, os
sys_map = {
'${{ inputs.linux_builder_repo_and_digest }}': 'linux',
'${{ inputs.macos_enable && 'true' || '' }}': 'macos',
'${{ inputs.windows_builder_repo_and_digest }}': 'windows',
}
systems = json.dumps(sorted(v for k, v in sys_map.items() if k))
matrix = []
if '${{ inputs.linux_builder_repo_and_digest }}':
matrix.append({
'os': 'linux',
'arch': 'x86_64',
})
matrix.append({
'os': 'linux',
'arch': 'aarch64',
})
if ${{ inputs.macos_enable && 1 || 0 }}:
matrix.append({
'os': 'macos',
'arch': 'arm64-x86_64',
})
if '${{ inputs.windows_builder_repo_and_digest }}':
matrix.append({
'os': 'windows',
'arch': 'x64',
})
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
fh.write(f'systems={systems}\n')
fh.write(f'matrix={json.dumps(matrix)}\n')
bdist:
name: Binaries
needs: sdist
strategy:
matrix:
os: ${{ fromJson(needs.sdist.outputs.systems) }}
runs-on: ${{ matrix.os == 'macos' && 'macos-latest' || 'ubuntu-latest' }}
include: ${{ fromJson(needs.sdist.outputs.matrix) }}
runs-on: ${{ matrix.os == 'macos' && 'macos-latest' || (matrix.os == 'linux' && matrix.arch == 'aarch64') && 'ubuntu-24.04-aarch64' || 'ubuntu-latest' }}
container: ${{ matrix.os == 'linux' && inputs.linux_builder_repo_and_digest || (matrix.os == 'windows' && inputs.windows_builder_repo_and_digest || null) }}
steps:
- name: Install dependencies (macOS)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ SDK libraries on macOS, and glibc on Linux.
## Building

For Windows and Linux, the build runs in a container image that includes the
necessary tools. To build for Windows, pull the container image on Linux or
in Windows PowerShell with WSL 2 and use it to run a build:
necessary tools. To build for Windows on x64, pull the container image on
Linux or in Windows PowerShell with WSL 2 and use it to run a build:

docker run -ti --rm -v ${PWD}:/work -w /work \
ghcr.io/openslide/winbuild-builder ./bintool bdist

Similarly, to build for Linux:
Similarly, to build for Linux on aarch64 or x86_64:

docker run -ti --rm -v ${PWD}:/work -w /work \
ghcr.io/openslide/linux-builder ./bintool bdist
Expand Down
12 changes: 12 additions & 0 deletions machines/native-linux-aarch64.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[built-in options]
prefix = '/'
c_args = ['-O2', '-g', '-fpic', '-fstack-clash-protection', '-fexceptions', '-ftree-vectorize', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2']
c_link_args = ['-Wl,-z,relro', '-Wl,-z,now', '-Wl,--exclude-libs,ALL']
cpp_args = ['-O2', '-g', '-fpic', '-fstack-clash-protection', '-fexceptions', '-ftree-vectorize', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2']
cpp_link_args = ['-Wl,-z,relro', '-Wl,-z,now', '-Wl,--exclude-libs,ALL']
pkg_config_path = ''

[properties]
pkg_config_libdir = '/native/lib/pkgconfig'
openslide_bin_platform = 'linux-aarch64'
python_platform_tag = 'manylinux_2_28_aarch64'

0 comments on commit aecb863

Please sign in to comment.