diff --git a/.azure-pipelines/azure-pipelines-linux.yml b/.azure-pipelines/azure-pipelines-linux.yml index 9514627e7..4ced2e505 100755 --- a/.azure-pipelines/azure-pipelines-linux.yml +++ b/.azure-pipelines/azure-pipelines-linux.yml @@ -16,6 +16,10 @@ jobs: CONFIG: linux_aarch64_ UPLOAD_PACKAGES: 'True' DOCKER_IMAGE: quay.io/condaforge/linux-anvil-cos7-x86_64 + linux_ppc64le_: + CONFIG: linux_ppc64le_ + UPLOAD_PACKAGES: 'True' + DOCKER_IMAGE: quay.io/condaforge/linux-anvil-cos7-x86_64 timeoutInMinutes: 360 variables: {} diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml index 7708e23eb..ac0bf384e 100755 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ b/.azure-pipelines/azure-pipelines-osx.yml @@ -5,7 +5,7 @@ jobs: - job: osx pool: - vmImage: macOS-12 + vmImage: macOS-13 strategy: matrix: osx_64_: diff --git a/.ci_support/linux_ppc64le_.yaml b/.ci_support/linux_ppc64le_.yaml new file mode 100644 index 000000000..2e3b3f157 --- /dev/null +++ b/.ci_support/linux_ppc64le_.yaml @@ -0,0 +1,31 @@ +c_compiler: +- gcc +c_compiler_version: +- '13' +c_stdlib: +- sysroot +c_stdlib_version: +- '2.28' +cdt_name: +- cos7 +channel_sources: +- conda-forge +channel_targets: +- conda-forge main +cxx_compiler: +- gxx +cxx_compiler_version: +- '13' +docker_image: +- quay.io/condaforge/linux-anvil-cos7-x86_64 +target_platform: +- linux-ppc64le +zip_keys: +- - c_compiler_version + - cxx_compiler_version +- - c_stdlib_version + - cdt_name +zlib: +- '1' +zstd: +- '1.5' diff --git a/README.md b/README.md index 5aba58c8a..80450568c 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,13 @@ Current build status variant + + linux_ppc64le + + + variant + + osx_64 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 33a441c1f..67d82fab2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,6 +2,31 @@ # update the conda-forge.yml and/or the recipe/meta.yaml. # -*- mode: yaml -*- -jobs: - - template: ./.azure-pipelines/azure-pipelines-linux.yml - - template: ./.azure-pipelines/azure-pipelines-osx.yml \ No newline at end of file +stages: +- stage: Check + jobs: + - job: Skip + pool: + vmImage: 'ubuntu-22.04' + variables: + DECODE_PERCENTS: 'false' + RET: 'true' + steps: + - checkout: self + fetchDepth: '2' + - bash: | + git_log=`git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " "` + echo "##vso[task.setvariable variable=log]$git_log" + displayName: Obtain commit message + - bash: echo "##vso[task.setvariable variable=RET]false" + condition: or(contains(variables.log, '[skip azp]'), contains(variables.log, '[azp skip]'), contains(variables.log, '[skip ci]'), contains(variables.log, '[ci skip]')) + displayName: Skip build? + - bash: echo "##vso[task.setvariable variable=start_main;isOutput=true]$RET" + name: result + displayName: Export result +- stage: Build + condition: and(succeeded(), eq(dependencies.Check.outputs['Skip.result.start_main'], 'true')) + dependsOn: Check + jobs: + - template: ./.azure-pipelines/azure-pipelines-linux.yml + - template: ./.azure-pipelines/azure-pipelines-osx.yml \ No newline at end of file diff --git a/conda-forge.yml b/conda-forge.yml index bcfdbb9ea..854b24731 100644 --- a/conda-forge.yml +++ b/conda-forge.yml @@ -9,4 +9,7 @@ conda_build: build_platform: linux_aarch64: linux_64 osx_arm64: osx_64 + linux_ppc64le: linux_64 test: native_and_emulated +provider: + linux_ppc64le: default diff --git a/recipe/build.sh b/recipe/build.sh index e34c3e828..0aa8c94e1 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -18,6 +18,9 @@ case "${target_platform}" in linux-aarch64) bash "${RECIPE_DIR}"/build_scripts/cross-"${builder}"-linux-aarch64.sh ;; + linux-ppc64le) + bash "${RECIPE_DIR}"/build_scripts/cross-"${builder}"-linux-ppc64le.sh + ;; osx-arm64) bash "${RECIPE_DIR}"/build_scripts/cross-"${builder}"-osx-arm64.sh ;; diff --git a/recipe/build_scripts/cross-zig-linux-ppc64le.sh b/recipe/build_scripts/cross-zig-linux-ppc64le.sh new file mode 100644 index 000000000..8aa328176 --- /dev/null +++ b/recipe/build_scripts/cross-zig-linux-ppc64le.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +set -euxo pipefail + +# --- Functions --- + +source "${RECIPE_DIR}/build_scripts/_functions.sh" + +# --- Main --- + +export ZIG_GLOBAL_CACHE_DIR="${PWD}/zig-global-cache" +export ZIG_LOCAL_CACHE_DIR="${PWD}/zig-local-cache" + +cmake_build_dir="${SRC_DIR}/build-release" +cmake_install_dir="${SRC_DIR}/cmake-built-install" + +mkdir -p "${cmake_build_dir}" && cp -r "${SRC_DIR}"/zig-source/* "${cmake_build_dir}" +mkdir -p "${cmake_install_dir}" +mkdir -p "${SRC_DIR}"/build-level-patches +cp -r "${RECIPE_DIR}"/patches/xxxx* "${SRC_DIR}"/build-level-patches + +SYSROOT_ARCH="powerpc64le" + +zig="${BUILD_PREFIX}/bin/zig" + +_BUILD_SYSROOT_ARCH="x86_64" + +patchelf --set-interpreter "${BUILD_PREFIX}/${_BUILD_SYSROOT_ARCH}-conda-linux-gnu/sysroot/lib64/ld-2.28.so" "${BUILD_PREFIX}/bin/zig" +patchelf --set-rpath "${BUILD_PREFIX}/${_BUILD_SYSROOT_ARCH}-conda-linux-gnu/sysroot/lib64" "${BUILD_PREFIX}/bin/zig" +patchelf --add-rpath "${BUILD_PREFIX}/${_BUILD_SYSROOT_ARCH}-conda-linux-gnu/sysroot/usr/lib64" "${BUILD_PREFIX}/bin/zig" +patchelf --add-rpath "${BUILD_PREFIX}/lib" "${BUILD_PREFIX}/bin/zig" +patchelf --shrink-rpath --allowed-rpath-prefixes "${BUILD_PREFIX}" "${BUILD_PREFIX}/bin/zig" + +patchelf --remove-needed librt.so.1 "${BUILD_PREFIX}/bin/zig" +patchelf --remove-needed libdl.so.2 "${BUILD_PREFIX}/bin/zig" +patchelf --remove-needed libm.so.6 "${BUILD_PREFIX}/bin/zig" +patchelf --add-needed "${BUILD_PREFIX}/${_BUILD_SYSROOT_ARCH}-conda-linux-gnu/sysroot/lib64/librt-2.28.so" "${BUILD_PREFIX}/bin/zig" +patchelf --add-needed "${BUILD_PREFIX}/${_BUILD_SYSROOT_ARCH}-conda-linux-gnu/sysroot/lib64/libdl-2.28.so" "${BUILD_PREFIX}/bin/zig" +patchelf --add-needed "${BUILD_PREFIX}/${_BUILD_SYSROOT_ARCH}-conda-linux-gnu/sysroot/lib64/libm-2.28.so" "${BUILD_PREFIX}/bin/zig" + +EXTRA_CMAKE_ARGS+=( \ +"-DZIG_SHARED_LLVM=ON" \ +"-DZIG_USE_LLVM_CONFIG=ON" \ +"-DZIG_TARGET_TRIPLE=${SYSROOT_ARCH}-linux-gnu" \ +) +# Zig searches for libm.so/libc.so in incorrect paths (libm.so with hard-coded /usr/lib64/libmvec_nonshared.a) +modify_libc_libm_for_zig "${BUILD_PREFIX}" + +# When using installed c++ libs, zig needs libzigcpp.a +configure_cmake_zigcpp "${cmake_build_dir}" "${cmake_install_dir}" + +# Zig needs the config.h to correctly (?) find the conda installed llvm, etc +EXTRA_ZIG_ARGS+=( \ + "-Dconfig_h=${cmake_build_dir}/config.h" \ + "-Doptimize=ReleaseFast" + "-Denable-llvm" \ + "-Dstrip" \ + "-Duse-zig-libcxx=false" \ + "-Dtarget=${SYSROOT_ARCH}-linux-gnu" \ + "-fqemu" + "--glibc-runtimes" "${PREFIX}/${SYSROOT_ARCH}-conda-linux-gnu/sysroot/lib64/libc.so.6" +) + +mkdir -p "${SRC_DIR}/conda-zig-source" && cp -r "${SRC_DIR}"/zig-source/* "${SRC_DIR}/conda-zig-source" +remove_failing_langref "${SRC_DIR}/conda-zig-source" +# Cross-compiling with linux-64 zig, thus not using the emulator +CROSSCOMPILING_EMULATOR='' build_zig_with_zig "${SRC_DIR}/conda-zig-source" "${zig}" "${PREFIX}" +patchelf_installed_zig "${PREFIX}" "${PREFIX}" diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 72409b2bf..c04eea193 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -10,7 +10,7 @@ source: - url: https://github.com/ziglang/zig/archive/refs/tags/{{ version }}.tar.gz sha256: d3912858003e340f315224bf177d0f441d86b81f62854f5c141b6d51ab6b5516 patches: - - patches/0001-cross-findllvm.patch # [linux and aarch64] + - patches/0001-cross-findllvm.patch # [linux and (aarch64 or ppc64le)] folder: zig-source # We may need to use the upstream binary dist if conda ZIG cannot build a newer version @@ -25,7 +25,7 @@ source: # sha256: d45312e61ebcc48032b77bc4cf7fd6915c11fa16e4aad116b66c9468211230ea # [linux] build: - number: 3 + number: 4 skip: true # [not linux and not osx] script_env: - BUILD_WITH_CMAKE=1 # [(linux or osx) and x86_64] @@ -36,7 +36,7 @@ requirements: build: - {{ compiler('c') }} - {{ compiler('cxx') }} - - {{ c_stdlib }}_{{ build_platform }} >={{ c_stdlib_version }} # [linux and aarch64] + - {{ c_stdlib }}_{{ build_platform }} >={{ c_stdlib_version }} # [linux and (aarch64 or ppc64le)] - {{ stdlib("c") }} - cmake >=3.5 - ninja @@ -48,11 +48,11 @@ requirements: - llvmdev {{ llvm_version }} - llvm {{ llvm_version }} - lld {{ llvm_version }} - - sysroot_{{ target_platform }} >=2.28 # [linux and aarch64] + - sysroot_{{ target_platform }} >=2.28 # [linux and (aarch64 or ppc64le)] - zlib - zstd run: - - sysroot_{{ target_platform }} >=2.28 # [linux and aarch64] + - sysroot_{{ target_platform }} >=2.28 # [linux and (aarch64 or ppc64le)] test: commands: