diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c777bbc8df..d7e99a859e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,7 +97,7 @@ jobs: strategy: fail-fast: false matrix: - arch: [x64, x86, arm64, arm, mipsel, mips64el, riscv64] + arch: [x64, x86, arm64, arm, mipsel, mips64el, riscv64, ppc64] env: EXTRA_FLAGS: 'target_cpu="${{ matrix.arch }}"' BUNDLE: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }} @@ -141,6 +141,9 @@ jobs: sudo dpkg -i qemu-user-static*.deb # libc6-i386 interferes with x86 build sudo apt remove libc6-i386 + - name: Import Debian patches (ppc64el) + run: ./get-ppc64le-patches.sh + if: ${{ matrix.arch == 'ppc64' }} - run: ./get-clang.sh - run: ccache -z - run: ./build.sh diff --git a/src/base/allocator/partition_allocator/partition_alloc.gni b/src/base/allocator/partition_allocator/partition_alloc.gni index b97bba61d8..16ed68b950 100644 --- a/src/base/allocator/partition_allocator/partition_alloc.gni +++ b/src/base/allocator/partition_allocator/partition_alloc.gni @@ -17,7 +17,7 @@ if (is_nacl) { has_64_bit_pointers = false } else if (current_cpu == "x64" || current_cpu == "arm64" || current_cpu == "loong64" || current_cpu == "riscv64" || - current_cpu == "mips64el") { + current_cpu == "mips64el" || current_cpu == "ppc64") { has_64_bit_pointers = true } else if (current_cpu == "x86" || current_cpu == "arm" || current_cpu == "mipsel") { has_64_bit_pointers = false diff --git a/src/build/config/compiler/BUILD.gn b/src/build/config/compiler/BUILD.gn index a8119d15dd..3a98aa4eea 100644 --- a/src/build/config/compiler/BUILD.gn +++ b/src/build/config/compiler/BUILD.gn @@ -1365,6 +1365,10 @@ config("compiler_cpu_abi") { ldflags += [ "-mips64r2" ] } } else if (current_cpu == "ppc64") { + if (is_clang && custom_toolchain == "" && current_os != "openwrt") { + cflags += [ "--target=powerpc64le-linux-gnu" ] + ldflags += [ "--target=powerpc64le-linux-gnu" ] + } if (current_os == "aix") { cflags += [ "-maix64" ] ldflags += [ "-maix64" ] diff --git a/src/build/linux/sysroot_scripts/install-sysroot.py b/src/build/linux/sysroot_scripts/install-sysroot.py index 1195f64e73..bb3f3246bb 100755 --- a/src/build/linux/sysroot_scripts/install-sysroot.py +++ b/src/build/linux/sysroot_scripts/install-sysroot.py @@ -37,7 +37,7 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) URL_PREFIX = 'https://commondatastorage.googleapis.com' URL_PATH = 'chrome-linux-sysroot/toolchain' -VALID_ARCHS = ('amd64', 'i386', 'armhf', 'arm64', 'armel', 'mipsel', 'mips64el', 'riscv64') +VALID_ARCHS = ('amd64', 'i386', 'armhf', 'arm64', 'armel', 'mipsel', 'mips64el', 'riscv64', 'ppc64el') ARCH_TRANSLATIONS = { 'x64': 'amd64', @@ -45,6 +45,7 @@ ARCH_TRANSLATIONS = { 'arm': 'armhf', 'mips': 'mipsel', 'mips64': 'mips64el', + 'ppc64': 'ppc64el', } DEFAULT_TARGET_PLATFORM = 'bullseye' diff --git a/src/build/linux/sysroot_scripts/sysroot-creator.sh b/src/build/linux/sysroot_scripts/sysroot-creator.sh index de4bd63bec..b91ccbc6cd 100755 --- a/src/build/linux/sysroot_scripts/sysroot-creator.sh +++ b/src/build/linux/sysroot_scripts/sysroot-creator.sh @@ -99,6 +99,15 @@ DEBIAN_PACKAGES_MIPS64EL=" DEBIAN_PACKAGES_RISCV64=" " +DEBIAN_PACKAGES_PPC64EL=" + libasan6 + libitm1 + liblsan0 + libquadmath0 + libtsan0 + libubsan1 +" + readonly REQUIRED_TOOLS="curl xzcat" ###################################################################### @@ -221,6 +230,10 @@ SetEnvironmentVariables() { # RISCV64 has no support in bookworm APT_SOURCES_LIST=("https://snapshot.debian.org/archive/debian-ports/20230724T141507Z/ sid main") ;; + ppc64el) + TRIPLE=powerpc64le-linux-gnu + DEBIAN_PACKAGES_ARCH="${DEBIAN_PACKAGES_PPC64EL}" + ;; *) echo "ERROR: Unsupported architecture: $ARCH" Usage diff --git a/src/build/linux/sysroot_scripts/sysroots.json b/src/build/linux/sysroot_scripts/sysroots.json index e256d2c7c5..d8da7fe9fc 100644 --- a/src/build/linux/sysroot_scripts/sysroots.json +++ b/src/build/linux/sysroot_scripts/sysroots.json @@ -46,5 +46,11 @@ "Sha1Sum": "", "SysrootDir": "debian_bullseye_riscv64-sysroot", "Tarball": "debian_bullseye_riscv64_sysroot.tar.xz" + }, + "bullseye_ppc64el": { + "Key": "", + "Sha1Sum": "", + "SysrootDir": "debian_bullseye_ppc64el-sysroot", + "Tarball": "debian_bullseye_ppc64el_sysroot.tar.xz" } } diff --git a/src/get-ppc64le-patches.sh b/src/get-ppc64le-patches.sh new file mode 100755 index 0000000000..db4ac99101 --- /dev/null +++ b/src/get-ppc64le-patches.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +set -ex + +DEBIAN_TAG_VERSION=115.0.5790.170-1 +url=https://salsa.debian.org/chromium-team/chromium/-/archive/debian/$DEBIAN_TAG_VERSION/chromium-debian-$DEBIAN_TAG_VERSION.tar.gz + +rm -rf chromium-debian-$DEBIAN_TAG_VERSION +trap "rm -rf chromium-debian-$DEBIAN_TAG_VERSION" EXIT +curl -L $url -o- | tar xzf - + +series=" +third_party/0001-Add-PPC64-support-for-boringssl.patch +third_party/0001-third_party-boringssl-Properly-detect-ppc64le-in-BUI.patch +third_party/0001-third_party-lss-Don-t-look-for-mmap2-on-ppc64.patch +third_party/0002-third_party-lss-kernel-structs.patch +third_party/0002-third-party-boringssl-add-generated-files.patch +third_party/use-sysconf-page-size-on-ppc64.patch +" +for i in $series; do + patch --batch -p1