Skip to content

Commit 6651f42

Browse files
authored
Add linux-ppc64 (little endian) as supported platform (lovell#242)
1 parent a34823b commit 6651f42

File tree

9 files changed

+148
-2
lines changed

9 files changed

+148
-2
lines changed

.github/workflows/build-release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
- 'linux-armv7'
2828
- 'linuxmusl-x64'
2929
- 'linuxmusl-arm64v8'
30+
- 'linux-ppc64le'
3031
- 'linux-s390x'
3132
- 'wasm32'
3233
- 'win32-ia32'

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ the same shared libraries within multiple containers.
2323
* [ARMv7-A glibc](platforms/linux-armv7/Dockerfile)
2424
* [ARM64v8-A glibc](platforms/linux-arm64v8/Dockerfile)
2525
* [ARM64v8-A musl](platforms/linuxmusl-arm64v8/Dockerfile)
26+
* [ppc64le glibc](platforms/linux-ppc64le/Dockerfile)
2627
* [s390x glibc](platforms/linux-s390x/Dockerfile)
2728

2829
### Windows

build.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if [ $# -lt 1 ]; then
2020
echo "- linux-armv7"
2121
echo "- linux-arm64v8"
2222
echo "- linuxmusl-arm64v8"
23+
echo "- linux-ppc64le"
2324
echo "- linux-s390x"
2425
echo "- darwin-x64"
2526
echo "- darwin-arm64v8"
@@ -101,7 +102,7 @@ for flavour in win32-ia32 win32-x64 win32-arm64v8; do
101102
done
102103

103104
# Linux (x64, ARMv6, ARMv7, ARM64v8)
104-
for flavour in linux-x64 linuxmusl-x64 linux-armv6 linux-armv7 linux-arm64v8 linuxmusl-arm64v8 linux-s390x; do
105+
for flavour in linux-x64 linuxmusl-x64 linux-armv6 linux-armv7 linux-arm64v8 linuxmusl-arm64v8 linux-ppc64le linux-s390x; do
105106
if [ $PLATFORM = "all" ] || [ $PLATFORM = $flavour ]; then
106107
echo "Building $flavour..."
107108
docker build -t vips-dev-$flavour platforms/$flavour

npm/linux-ppc64/package.json

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "@img/sharp-libvips-linux-ppc64",
3+
"version": "1.0.2",
4+
"description": "Prebuilt libvips and dependencies for use with sharp on Linux (glibc) ppc64le",
5+
"author": "Lovell Fuller <[email protected]>",
6+
"homepage": "https://sharp.pixelplumbing.com",
7+
"repository": {
8+
"type": "git",
9+
"url": "git+https://github.com/lovell/sharp-libvips.git",
10+
"directory": "npm/linux-ppc64"
11+
},
12+
"license": "LGPL-3.0-or-later",
13+
"funding": {
14+
"url": "https://opencollective.com/libvips"
15+
},
16+
"preferUnplugged": true,
17+
"publishConfig": {
18+
"access": "public"
19+
},
20+
"files": [
21+
"lib",
22+
"versions.json"
23+
],
24+
"exports": {
25+
"./lib": "./lib/index.js",
26+
"./package": "./package.json",
27+
"./versions": "./versions.json"
28+
},
29+
"type": "commonjs",
30+
"config": {
31+
"glibc": ">=2.31"
32+
},
33+
"os": [
34+
"linux"
35+
],
36+
"libc": [
37+
"glibc"
38+
],
39+
"cpu": [
40+
"ppc64"
41+
]
42+
}

npm/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"linux-arm64",
1212
"linuxmusl-arm64",
1313
"linuxmusl-x64",
14+
"linux-ppc64",
1415
"linux-s390x",
1516
"linux-x64",
1617
"win32-ia32",

npm/populate.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ CURL="curl --silent --location"
66

77
download_extract() {
88
PLATFORM="$1"
9-
PACKAGE="${1%v[68]}" # remove ARM version
9+
case $1 in
10+
*ppc64le)
11+
PACKAGE="${1%??}" # package directory is named as npm/linux-ppc64
12+
;;
13+
*)
14+
PACKAGE="${1%v[68]}" # remove ARM version
15+
;;
16+
esac
1017
echo "$PLATFORM -> $PACKAGE"
1118
rm -rf "npm/$PACKAGE/include" "npm/$PACKAGE/lib"
1219
$CURL \

platforms/linux-ppc64le/Dockerfile

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
FROM debian:bullseye
2+
LABEL maintainer="Lovell Fuller <[email protected]>"
3+
4+
# Create Debian 11 (glibc 2.31) container suitable for cross-compiling Linux ppc64le binaries
5+
6+
# Path settings
7+
ENV \
8+
RUSTUP_HOME="/usr/local/rustup" \
9+
CARGO_HOME="/usr/local/cargo" \
10+
PATH="/usr/local/cargo/bin:$PATH"
11+
12+
# Build dependencies
13+
RUN \
14+
apt-get update && \
15+
apt-get install -y curl && \
16+
dpkg --add-architecture ppc64el && \
17+
apt-get install -y \
18+
autoconf \
19+
autopoint \
20+
cmake \
21+
crossbuild-essential-ppc64el \
22+
gettext \
23+
git \
24+
gperf \
25+
jq \
26+
libssl-dev \
27+
libtool \
28+
ninja-build \
29+
pkg-config \
30+
python3-packaging \
31+
python3-pip \
32+
&& \
33+
curl https://sh.rustup.rs -sSf | sh -s -- -y \
34+
--no-modify-path \
35+
--profile minimal \
36+
&& \
37+
rustup target add powerpc64le-unknown-linux-gnu && \
38+
cargo install cargo-c && \
39+
pip3 install meson tomli
40+
41+
# Handy for debugging the compiled targets in Highway (hwy_list_targets)
42+
#RUN apt-get install -y qemu-user-static
43+
#ENV QEMU_LD_PREFIX="/usr/powerpc64le-linux-gnu"
44+
45+
# Compiler settings
46+
ENV \
47+
PKG_CONFIG="powerpc64le-linux-gnu-pkg-config --static" \
48+
PLATFORM="linux-ppc64le" \
49+
CHOST="powerpc64le-linux-gnu" \
50+
RUST_TARGET="powerpc64le-unknown-linux-gnu" \
51+
FLAGS="" \
52+
MESON="--cross-file=/root/meson.ini"
53+
54+
COPY Toolchain.cmake /root/
55+
COPY meson.ini /root/
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
set(CMAKE_SYSTEM_NAME Linux)
2+
set(CMAKE_SYSTEM_VERSION 1)
3+
set(CMAKE_SYSTEM_PROCESSOR ppc64le)
4+
5+
SET(CMAKE_C_COMPILER powerpc64le-linux-gnu-gcc)
6+
SET(CMAKE_CXX_COMPILER powerpc64le-linux-gnu-g++)
7+
SET(CMAKE_AR powerpc64le-linux-gnu-gcc-ar)
8+
SET(CMAKE_STRIP powerpc64le-linux-gnu-gcc-strip)
9+
SET(CMAKE_RANLIB powerpc64le-linux-gnu-gcc-ranlib)
10+
11+
#SET(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64le-static)
12+
13+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
14+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
15+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

platforms/linux-ppc64le/meson.ini

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[host_machine]
2+
system = 'linux'
3+
cpu_family = 'ppc64'
4+
cpu = 'powerpc64le'
5+
endian = 'little'
6+
7+
[binaries]
8+
c = 'powerpc64le-linux-gnu-gcc'
9+
cpp = 'powerpc64le-linux-gnu-g++'
10+
ar = 'powerpc64le-linux-gnu-gcc-ar'
11+
nm = 'powerpc64le-linux-gnu-gcc-nm'
12+
ld = 'powerpc64le-linux-gnu-gcc-ld'
13+
strip = 'powerpc64le-linux-gnu-strip'
14+
ranlib = 'powerpc64le-linux-gnu-gcc-ranlib'
15+
#exe_wrapper = 'qemu-ppc64le-static'
16+
17+
[built-in options]
18+
libdir = 'lib'
19+
datadir = '/usr/share'
20+
localedir = '/usr/share/locale'
21+
sysconfdir = '/etc'
22+
localstatedir = '/var'
23+
wrap_mode = 'nofallback'

0 commit comments

Comments
 (0)