Skip to content

Commit

Permalink
[main] Reduce deps for clang on Linux and set sysroot (#252)
Browse files Browse the repository at this point in the history
automerged PR by conda-forge/automerge-action
  • Loading branch information
github-actions[bot] authored Nov 13, 2023
2 parents 7c7be21 + 86d03ec commit aca270f
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .azure-pipelines/azure-pipelines-linux.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .azure-pipelines/azure-pipelines-osx.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .azure-pipelines/azure-pipelines-win.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .scripts/run_docker_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions .scripts/run_win_build.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions recipe/get_cpu_triplet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
get_triplet() {
local CPU_ARCH
if [[ "$1" == "linux-64" ]]; then
CPU_ARCH="x86_64"
elif [[ "$1" == "linux-ppc64le" ]]; then
CPU_ARCH="powerpc64le"
elif [[ "$1" == "linux-aarch64" ]]; then
CPU_ARCH="aarch64"
elif [[ "$1" == "linux-s390x" ]]; then
CPU_ARCH="s390x"
else
echo "Unknown architecture"
exit 1
fi
echo $CPU_ARCH-conda-linux-gnu
}
8 changes: 8 additions & 0 deletions recipe/install_clang_symlinks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ maj_version="${PKG_VERSION%%.*}"
ln -s "${PREFIX}/bin/clang-${maj_version}" "${PREFIX}/bin/clang-cl"
ln -s "${PREFIX}/bin/clang-${maj_version}" "${PREFIX}/bin/clang-cpp"
ln -s "${PREFIX}/bin/clang-${maj_version}" "${PREFIX}/bin/clang"

if [[ "$target_platform" == "linux-"* ]]; then
source ${RECIPE_DIR}/get_cpu_triplet.sh
CHOST=$(get_triplet $target_platform)
ln -s "${PREFIX}/bin/clang-${maj_version}" "${PREFIX}/bin/${CHOST}-clang"
# for background, see comment in install_clangxx.sh
echo "--sysroot ${PREFIX}/${CHOST}/sysroot" >> ${PREFIX}/bin/${CHOST}-clang.cfg
fi
14 changes: 13 additions & 1 deletion recipe/install_clangxx.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
#!/bin/bash

ln -s $PREFIX/bin/clang $PREFIX/bin/clang++
ln -s $PREFIX/bin/clang $PREFIX/bin/$HOST-clang++

if [[ "$variant" == "hcc" ]]; then
ln -s $PREFIX/bin/clang++ $PREFIX/bin/hcc
fi

if [[ "$target_platform" == "linux-"* ]]; then
source ${RECIPE_DIR}/get_cpu_triplet.sh
CHOST=$(get_triplet $target_platform)
ln -s "${PREFIX}/bin/clang++" "${PREFIX}/bin/${CHOST}-clang++"
# In the cross compiling case, we set CONDA_BUILD_SYSROOT to host platform
# which makes compiling for build platform not work correctly.
# The following overrides CONDA_BUILD_SYSROOT, so that a clang for a given
# CHOST will always use the appropriate sysroot. In particular, this means
# that a clang in the build environment will work correctly for its native
# architecture also in cross compilation scenarios.
echo "--sysroot ${PREFIX}/${CHOST}/sysroot" >> ${PREFIX}/bin/${CHOST}-clang++.cfg
fi
8 changes: 5 additions & 3 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% set version = "17.0.4" %}
{% set major_version = version.split(".")[0] %}
{% set build_number = 0 %}
{% set build_number = 1 %}

{% set minor_aware_ext = major_version %}
{% if version.split(".")[1] | int > 0 %}
Expand Down Expand Up @@ -392,7 +392,6 @@ outputs:
- zstd # [unix]
requirements:
host:
- gcc_impl_{{ target_platform }} # [linux]
- {{ pin_subpackage("clang-" ~ major_version, exact=True) }}
# Use the same requirements as the top-level requirements
- libcxx {{ cxx_compiler_version }} # [osx]
Expand All @@ -401,7 +400,9 @@ outputs:
- zlib
- zstd
run:
- gcc_impl_{{ target_platform }} # [linux]
- binutils_impl_{{ target_platform }} # [linux]
- sysroot_{{ target_platform }} # [linux]
- libgcc-devel_{{ target_platform }} # [linux]
- {{ pin_subpackage("clang-" ~ major_version, exact=True) }}
test:
commands:
Expand Down Expand Up @@ -431,6 +432,7 @@ outputs:
- zlib
- zstd
run:
- libstdcxx-devel_{{ target_platform }} # [linux]
- {{ pin_subpackage("clang", exact=True) }}
test:
requires:
Expand Down

0 comments on commit aca270f

Please sign in to comment.