Skip to content

Commit

Permalink
🔋 Build wheels for PowerPC64 little-endian (ppc64le) (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Apr 29, 2024
1 parent fdd88cd commit 5c7664c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
39 changes: 38 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,42 @@ jobs:
path: ./wheelhouse/*.whl
if-no-files-found: error

linux_ppc64le_wheels:
name: ppc64le-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
with:
platforms: all

- name: Build binary distribution (wheel) on Linux (ppc64le)
uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # v2.17.0
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_LINUX: ppc64le
CIBW_BEFORE_ALL_LINUX: |
tarball="go1.22.2.linux-ppc64le.tar.gz"
curl -LJO https://golang.org/dl/$tarball
mkdir $HOME/go_installed/
tar -C $HOME/go_installed/ -xzf $tarball
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile
go version
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_TEST_COMMAND: >
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: wheels_linux_ppc64le
path: ./wheelhouse/*.whl
if-no-files-found: error

macos_amd64_wheels:
name: amd64-macos
runs-on: macos-13
Expand Down Expand Up @@ -226,7 +262,8 @@ jobs:
macos_arm64_wheels,
linux_amd64_wheels,
linux_arm64_wheels,
linux_s390x_wheels
linux_s390x_wheels,
linux_ppc64le_wheels
]

name: Publish to PyPI or TestPyPI
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ A subset of the platforms supported by Hugo itself are supported by these wheels
| Linux | amd64 ||
| Linux | arm64 ||
| Linux | s390x ||
| Linux | ppc64le ||
| Windows | x86_64 ||
| Windows | arm64 | 💡 Experimental support [^1] |
| Windows | x86 | 💡 Experimental support [^1] |
Expand Down
1 change: 1 addition & 0 deletions hugo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"aarch64": "arm64",
"x86": "386",
"s390x": "s390x",
"ppc64le": "ppc64le",
}[machine()]

# platform.machine returns AMD64 on Windows because the architecture is
Expand Down
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"aarch64": "arm64",
"x86": "386",
"s390x": "s390x",
"ppc64le": "ppc64le",
}[platform.machine()]

# Name of the Hugo binary that will be built
Expand Down Expand Up @@ -83,7 +84,7 @@ def initialize_options(self):
self.hugo_arch = None

def finalize_options(self):
# Platforms and architectures that we will build Hugo for are:
# Platforms and architectures that we will build Hugo natively for are:
# i.e., a subset of "go tool dist list":
# 1. darwin/amd64
# 2. darwin/arm64
Expand Down Expand Up @@ -200,13 +201,17 @@ def run(self):
"--branch",
f"v{HUGO_VERSION}",
Path(HUGO_CACHE_DIR) / f"hugo-{HUGO_VERSION}",
# disable warning about detached HEAD
"-c",
"advice.detachedHead=false",
]
)

subprocess.check_call(
[
"go",
"install",
"-v",
"-ldflags",
" ".join(ldflags),
"-tags",
Expand Down Expand Up @@ -368,6 +373,8 @@ def get_tag(self):
platform_tag = "linux_aarch64"
elif os.environ.get("GOARCH") == "amd64":
platform_tag = "linux_x86_64"
elif os.environ.get("GOARCH") == "ppc64le":
platform_tag = "linux_ppc64le"

# Handle cross-compilation on/to Windows via the Zig compiler
# ===========================================================
Expand Down

0 comments on commit 5c7664c

Please sign in to comment.