Skip to content

Commit

Permalink
build: add support for Linux PowerPC 64 LE
Browse files Browse the repository at this point in the history
Close #495
  • Loading branch information
Spasi committed Nov 9, 2023
1 parent 437a4ad commit b887187
Show file tree
Hide file tree
Showing 11 changed files with 310 additions and 27 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ARCH: [arm32, arm64, riscv64]
ARCH: [arm32, arm64, ppc64le, riscv64]
include:
- ARCH: arm32
CROSS_ARCH: armhf
Expand All @@ -142,6 +142,10 @@ jobs:
CROSS_ARCH: arm64
CONTAINER: ubuntu:18.04
TRIPLET: aarch64-linux-gnu
- ARCH: ppc64le
CROSS_ARCH: ppc64el
CONTAINER: ubuntu:18.04
TRIPLET: powerpc64le-linux-gnu
- ARCH: riscv64
CROSS_ARCH: riscv64
CONTAINER: ubuntu:20.04
Expand Down Expand Up @@ -174,7 +178,7 @@ jobs:
DEBIAN_FRONTEND=noninteractive apt-get -yq install ant awscli curl zstd gcc-${{matrix.TRIPLET}} g++-${{matrix.TRIPLET}} libc6-dev-${{matrix.CROSS_ARCH}}-cross
mkdir jdk8
curl -L https://cdn.azul.com/zulu/bin/zulu8.72.0.17-ca-fx-jdk8.0.382-linux_x64.tar.gz | tar xz -C jdk8 --strip-components 1
- name: Prepare cross-compilation for $${matrix.CROSS_ARCH}}
- name: Prepare cross-compilation for ${{matrix.CROSS_ARCH}}
run: |
sed -i 's/deb http/deb [arch=amd64,i386] http/' /etc/apt/sources.list
grep "ubuntu.com/ubuntu" /etc/apt/sources.list | tee /etc/apt/sources.list.d/ports.list
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ following platforms/architectures:
- Linux x64
- Linux arm64 (ARMv8/AArch64)
- Linux arm32 (ARMv7/armhf)
- Linux ppc64le
- Linux riscv64
- macOS x64
- macOS arm64
Expand Down
9 changes: 5 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ enum class Platforms(val classifier: String) {
LINUX("linux"),
LINUX_ARM64("linux-arm64"),
LINUX_ARM32("linux-arm32"),
LINUX_PPC64LE("linux-ppc64le"),
LINUX_RISCV64("linux-riscv64"),
MACOS("macos"),
MACOS_ARM64("macos-arm64"),
Expand Down Expand Up @@ -89,7 +90,7 @@ enum class Artifacts(
BGFX(
"lwjgl-bgfx", "LWJGL - bgfx bindings",
"A cross-platform, graphics API agnostic rendering library. It provides a high performance, low level abstraction for common platform graphics APIs like OpenGL, Direct3D and Apple Metal.",
Platforms.LINUX, Platforms.LINUX_ARM64, Platforms.LINUX_ARM32, Platforms.LINUX_RISCV64,
Platforms.LINUX, Platforms.LINUX_ARM64, Platforms.LINUX_ARM32, Platforms.LINUX_PPC64LE, Platforms.LINUX_RISCV64,
Platforms.MACOS, Platforms.MACOS_ARM64,
Platforms.WINDOWS, Platforms.WINDOWS_X86
),
Expand Down Expand Up @@ -137,7 +138,7 @@ enum class Artifacts(
KTX(
"lwjgl-ktx", "LWJGL - KTX (Khronos Texture) bindings",
"A lightweight container for textures for OpenGL®, Vulkan® and other GPU APIs.",
Platforms.LINUX, Platforms.LINUX_ARM64, Platforms.LINUX_ARM32, Platforms.LINUX_RISCV64,
Platforms.LINUX, Platforms.LINUX_ARM64, Platforms.LINUX_ARM32, Platforms.LINUX_PPC64LE, Platforms.LINUX_RISCV64,
Platforms.MACOS, Platforms.MACOS_ARM64,
Platforms.WINDOWS, Platforms.WINDOWS_ARM64
),
Expand Down Expand Up @@ -219,7 +220,7 @@ enum class Artifacts(
OPENXR(
"lwjgl-openxr", "LWJGL - OpenXR bindings",
"A royalty-free, open standard that provides high-performance access to Augmented Reality (AR) and Virtual Reality (VR)—collectively known as XR—platforms and devices.",
Platforms.LINUX, Platforms.LINUX_ARM64, Platforms.LINUX_ARM32, Platforms.LINUX_RISCV64,
Platforms.LINUX, Platforms.LINUX_ARM64, Platforms.LINUX_ARM32, Platforms.LINUX_PPC64LE, Platforms.LINUX_RISCV64,
Platforms.WINDOWS, Platforms.WINDOWS_X86, Platforms.WINDOWS_ARM64
),
OPUS(
Expand All @@ -240,7 +241,7 @@ enum class Artifacts(
REMOTERY(
"lwjgl-remotery", "LWJGL - Remotery bindings",
"A realtime CPU/GPU profiler hosted in a single C file with a viewer that runs in a web browser.",
Platforms.LINUX, Platforms.LINUX_ARM64, Platforms.LINUX_ARM32, Platforms.LINUX_RISCV64,
Platforms.LINUX, Platforms.LINUX_ARM64, Platforms.LINUX_ARM32, Platforms.LINUX_PPC64LE, Platforms.LINUX_RISCV64,
Platforms.MACOS, Platforms.MACOS_ARM64,
Platforms.WINDOWS, Platforms.WINDOWS_X86
),
Expand Down
28 changes: 28 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,7 @@
<element name="linux-content" optional="true"/>
<element name="linux-arm64-content" optional="true"/>
<element name="linux-arm32-content" optional="true"/>
<element name="linux-ppc64le-content" optional="true"/>
<element name="linux-riscv64-content" optional="true"/>
<element name="macos-content" optional="true"/>
<element name="macos-arm64-content" optional="true"/>
Expand Down Expand Up @@ -1208,6 +1209,9 @@
<get-release platform="linux" arch="arm32" file="lib@{native-library}.so" if:set="auto-natives"/>
<get-release platform="linux" arch="arm32" file="lib@{native-library}.so.git" if:set="git-revision"/>

<get-release platform="linux" arch="ppc64le" file="lib@{native-library}.so" if:set="auto-natives"/>
<get-release platform="linux" arch="ppc64le" file="lib@{native-library}.so.git" if:set="git-revision"/>

<get-release platform="linux" arch="riscv64" file="lib@{native-library}.so" if:set="auto-natives"/>
<get-release platform="linux" arch="riscv64" file="lib@{native-library}.so.git" if:set="git-revision"/>

Expand Down Expand Up @@ -1278,6 +1282,9 @@
<natives-jar name="@{name}" title="@{title}" platform="linux-arm32" path="linux/arm32" type="so">
<linux-arm32-content/>
</natives-jar>
<natives-jar name="@{name}" title="@{title}" platform="linux-ppc64le" path="linux/ppc64le" type="so">
<linux-ppc64le-content/>
</natives-jar>
<natives-jar name="@{name}" title="@{title}" platform="linux-riscv64" path="linux/riscv64" type="so">
<linux-riscv64-content/>
</natives-jar>
Expand Down Expand Up @@ -1309,6 +1316,7 @@
<element name="linux" optional="true"/>
<element name="linux-arm64" optional="true"/>
<element name="linux-arm32" optional="true"/>
<element name="linux-ppc64le" optional="true"/>
<element name="linux-riscv64" optional="true"/>
<element name="macos" optional="true"/>
<element name="macos-arm64" optional="true"/>
Expand Down Expand Up @@ -1337,6 +1345,7 @@
<linux-content><linux/></linux-content>
<linux-arm64-content><linux-arm64/></linux-arm64-content>
<linux-arm32-content><linux-arm32/></linux-arm32-content>
<linux-ppc64le-content><linux-ppc64le/></linux-ppc64le-content>
<linux-riscv64-content><linux-riscv64/></linux-riscv64-content>
<macos-content><macos/></macos-content>
<macos-arm64-content><macos-arm64/></macos-arm64-content>
Expand Down Expand Up @@ -1548,6 +1557,10 @@
<get-release platform="linux" arch="arm32" file="libassimp.so.git"/>
<get-release platform="linux" arch="arm32" file="libdraco.so"/>

<get-release platform="linux" arch="ppc64le" file="libassimp.so"/>
<get-release platform="linux" arch="ppc64le" file="libassimp.so.git"/>
<get-release platform="linux" arch="ppc64le" file="libdraco.so"/>

<get-release platform="linux" arch="riscv64" file="libassimp.so"/>
<get-release platform="linux" arch="riscv64" file="libassimp.so.git"/>
<get-release platform="linux" arch="riscv64" file="libdraco.so"/>
Expand Down Expand Up @@ -1586,6 +1599,9 @@
<get-release platform="linux" arch="arm32" file="libbgfx.so"/>
<get-release platform="linux" arch="arm32" file="libbgfx.so.git"/>

<get-release platform="linux" arch="ppc64le" file="libbgfx.so"/>
<get-release platform="linux" arch="ppc64le" file="libbgfx.so.git"/>

<get-release platform="linux" arch="riscv64" file="libbgfx.so"/>
<get-release platform="linux" arch="riscv64" file="libbgfx.so.git"/>

Expand Down Expand Up @@ -1627,6 +1643,9 @@
<get-release platform="linux" arch="arm32" file="libglfw.so"/>
<get-release platform="linux" arch="arm32" file="libglfw.so.git"/>

<get-release platform="linux" arch="ppc64le" file="libglfw.so"/>
<get-release platform="linux" arch="ppc64le" file="libglfw.so.git"/>

<get-release platform="linux" arch="riscv64" file="libglfw.so"/>
<get-release platform="linux" arch="riscv64" file="libglfw.so.git"/>

Expand Down Expand Up @@ -1669,6 +1688,7 @@
<get-release platform="linux" arch="x64" file="libktx.so"/>
<get-release platform="linux" arch="arm64" file="libktx.so"/>
<get-release platform="linux" arch="arm32" file="libktx.so"/>
<get-release platform="linux" arch="ppc64le" file="libktx.so"/>
<get-release platform="linux" arch="riscv64" file="libktx.so"/>
<get-release platform="macos" arch="x64" file="libktx.dylib"/>
<get-release platform="macos" arch="arm64" file="libktx.dylib"/>
Expand Down Expand Up @@ -1714,6 +1734,7 @@
<get-release platform="linux" arch="x64" file="liblwjgl_nfd_portal.so"/>
<get-release platform="linux" arch="arm64" file="liblwjgl_nfd_portal.so"/>
<get-release platform="linux" arch="arm32" file="liblwjgl_nfd_portal.so"/>
<get-release platform="linux" arch="ppc64le" file="liblwjgl_nfd_portal.so"/>
<get-release platform="linux" arch="riscv64" file="liblwjgl_nfd_portal.so"/>
</natives>
</release-module>
Expand All @@ -1736,6 +1757,9 @@
<get-release platform="linux" arch="arm32" file="libopenal.so"/>
<get-release platform="linux" arch="arm32" file="libopenal.so.git"/>

<get-release platform="linux" arch="ppc64le" file="libopenal.so"/>
<get-release platform="linux" arch="ppc64le" file="libopenal.so.git"/>

<get-release platform="linux" arch="riscv64" file="libopenal.so"/>
<get-release platform="linux" arch="riscv64" file="libopenal.so.git"/>

Expand Down Expand Up @@ -1798,6 +1822,9 @@
<get-release platform="linux" arch="arm32" file="libopenxr_loader.so"/>
<get-release platform="linux" arch="arm32" file="libopenxr_loader.so.git"/>

<get-release platform="linux" arch="ppc64le" file="libopenxr_loader.so"/>
<get-release platform="linux" arch="ppc64le" file="libopenxr_loader.so.git"/>

<get-release platform="linux" arch="riscv64" file="libopenxr_loader.so"/>
<get-release platform="linux" arch="riscv64" file="libopenxr_loader.so.git"/>

Expand Down Expand Up @@ -1832,6 +1859,7 @@
<get-release platform="linux" arch="x64" file="liblwjgl_remotery.so"/>
<get-release platform="linux" arch="arm64" file="liblwjgl_remotery.so"/>
<get-release platform="linux" arch="arm32" file="liblwjgl_remotery.so"/>
<get-release platform="linux" arch="ppc64le" file="liblwjgl_remotery.so"/>
<get-release platform="linux" arch="riscv64" file="liblwjgl_remotery.so"/>

<get-release platform="macos" arch="x64" file="liblwjgl_remotery.dylib"/>
Expand Down
12 changes: 10 additions & 2 deletions config/build-definitions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ This script is included in /build.xml and /config/update-dependencies.xml.
<contains string="${os.arch}" substring="aarch64"/>
</or>
</condition>
<condition property="build.arch.ppc" value="true">
<or>
<contains string="${build.arch}" substring="ppc"/>
<contains string="${os.arch}" substring="ppc"/>
</or>
</condition>
<condition property="build.arch.riscv" value="true">
<or>
<contains string="${build.arch}" substring="riscv"/>
Expand All @@ -43,20 +49,22 @@ This script is included in /build.xml and /config/update-dependencies.xml.
<condition property="build.arch.x64|x86" value="true">
<and>
<not><isset property="build.arch.arm"/></not>
<not><isset property="build.arch.ppc"/></not>
<not><isset property="build.arch.riscv"/></not>
</and>
</condition>

<!-- Normalize os.arch -->
<condition property="build.arch" value="arm64" unless:set="build.arch"><and><isset property="build.arch.arm"/> <istrue value="${is64Bit}"/></and></condition>
<condition property="build.arch" value="arm32" unless:set="build.arch"><and><isset property="build.arch.arm"/> <isfalse value="${is64Bit}"/></and></condition>
<condition property="build.arch" value="ppc64le" unless:set="build.arch"><and><isset property="build.arch.ppc"/> <istrue value="${is64Bit}"/></and></condition>
<condition property="build.arch" value="riscv64" unless:set="build.arch"><and><isset property="build.arch.riscv"/> <istrue value="${is64Bit}"/></and></condition>
<condition property="build.arch" value="x64" unless:set="build.arch"><and><isset property="build.arch.x64|x86"/><istrue value="${is64Bit}"/></and></condition>
<condition property="build.arch" value="x86" unless:set="build.arch"><and><isset property="build.arch.x64|x86"/><isfalse value="${is64Bit}"/></and></condition>
<property name="build.arch" value="${os.arch}" unless:set="build.arch"/>

<fail message="Invalid or unsupported build architecture: ${build.arch}. Supported: x64, x86, arm64, arm32, riscv64">
<condition><not><matches string="${build.arch}" pattern="^(x64|x86|arm64|arm32|riscv64)$"/></not></condition>
<fail message="Invalid or unsupported build architecture: ${build.arch}. Supported: x64, x86, arm64, arm32, ppc64le, riscv64">
<condition><not><matches string="${build.arch}" pattern="^(x64|x86|arm64|arm32|ppc64le|riscv64)$"/></not></condition>
</fail>

<property name="build.arch.${build.arch}" value="true"/>
Expand Down
28 changes: 10 additions & 18 deletions config/linux/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
<project name="native-linux" basedir="../.." xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="../build-definitions.xml"/>

<property name="gcc.prefix" value="aarch64-linux-gnu-" if:set="build.arch.arm64"/>
<property name="gcc.prefix" value="arm-linux-gnueabihf-" if:set="build.arch.arm32"/>
<property name="gcc.prefix" value="riscv64-linux-gnu-" if:set="build.arch.riscv64"/>

<condition property="gcc.prefix" value="${gcc.prefix}" else="">
<isset property="gcc.prefix"/>
<condition property="linux.triplet" value="arm-linux-gnueabihf"><isset property="build.arch.arm32"/></condition>
<condition property="linux.triplet" value="aarch64-linux-gnu"><isset property="build.arch.arm64"/></condition>
<condition property="linux.triplet" value="powerpc64le-linux-gnu"><isset property="build.arch.ppc64le"/></condition>
<condition property="linux.triplet" value="riscv64-linux-gnu"><isset property="build.arch.riscv64"/></condition>
<condition property="linux.triplet" value="x86_64-linux-gnu"><isset property="build.arch.x64|x86"/></condition>

<condition property="gcc.prefix" value="" else="${linux.triplet}-">
<isset property="build.arch.x64|x86"/>
</condition>
<condition property="gcc.suffix" value="-${gcc.version}" else="">
<isset property="gcc.version"/>
Expand Down Expand Up @@ -39,6 +41,7 @@
<arg line="-c -std=gnu++14" if:set="cpp"/>
<arg line="-m64" if:set="build.arch.x64"/>
<arg line="-m32 -mfpmath=sse -msse -msse2" if:set="build.arch.x86"/>
<arg line="-mcpu=powerpc64le" if:set="build.arch.ppc64le"/>
<arg line="-march=rv64g" if:set="build.arch.riscv64"/>
<arg line="-O3 @{lto} -fPIC @{flags} -pthread -DNDEBUG -DLWJGL_LINUX -DLWJGL_${build.arch}"/>
<arg line="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -D_GNU_SOURCE"/>
Expand Down Expand Up @@ -179,6 +182,7 @@
<arg value="-I${src.main.rel}/libffi"/>
<arg value="-I${src.main.rel}/libffi/aarch64" if:set="build.arch.arm64"/>
<arg value="-I${src.main.rel}/libffi/arm" if:set="build.arch.arm32"/>
<arg value="-I${src.main.rel}/libffi/ppc64le" if:set="build.arch.ppc64le"/>
<arg value="-I${src.main.rel}/libffi/riscv64" if:set="build.arch.riscv64"/>
<arg value="-I${src.main.rel}/libffi/x86" if:set="build.arch.x64|x86"/>
<arg value="-DX86_64" if:set="build.arch.x64"/> <!-- for libffi/x86/ffitarget.h -->
Expand Down Expand Up @@ -265,12 +269,6 @@
<!-- NativeFileDialog -->
<build module="nfd" simple="true" linker="g++" if:true="${binding.nfd}">
<beforeCompile>
<local name="linux.triplet"/>
<condition property="linux.triplet" value="arm-linux-gnueabihf"><isset property="build.arch.arm32"/></condition>
<condition property="linux.triplet" value="aarch64-linux-gnu"><isset property="build.arch.arm64"/></condition>
<condition property="linux.triplet" value="riscv64-linux-gnu"><isset property="build.arch.riscv64"/></condition>
<condition property="linux.triplet" value="x86_64-linux-gnu"><isset property="build.arch.x64|x86"/></condition>

<compile lang="c++">
<arg line="-I/usr/include/gtk-3.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib/${linux.triplet}/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0"/>
<arg value="-I${src.main.rel}/include"/>
Expand All @@ -289,12 +287,6 @@
</build>
<build module="nfd" suffix="_portal" simple="true" linker="g++" if:true="${binding.nfd}">
<beforeCompile>
<local name="linux.triplet"/>
<condition property="linux.triplet" value="arm-linux-gnueabihf"><isset property="build.arch.arm32"/></condition>
<condition property="linux.triplet" value="aarch64-linux-gnu"><isset property="build.arch.arm64"/></condition>
<condition property="linux.triplet" value="riscv64-linux-gnu"><isset property="build.arch.riscv64"/></condition>
<condition property="linux.triplet" value="x86_64-linux-gnu"><isset property="build.arch.x64|x86"/></condition>

<compile lang="c++">
<arg line="-I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/lib/${linux.triplet}/dbus-1.0/include"/>
<arg value="-I${src.main.rel}/include"/>
Expand Down
4 changes: 3 additions & 1 deletion doc/notes/3.3.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ This build includes the following changes:

#### Improvements

- Linux: Added support for the RISC-V 64 architecture.
- Linux: Added support for the PowerPC 64 LE architecture. (#495)
* Maven classifier: `linux-ppc64le`
- Linux: Added support for the RISC-V 64 architecture. (#890)
* Maven classifier: `linux-riscv64`
- Vulkan: Made `VkMemoryRequirements` mutable for the `vmaAllocateMemory(Pages)` functions. (#937)

Expand Down
Loading

0 comments on commit b887187

Please sign in to comment.