From d2ea1ed0f972059b508027bc4f057c30d54f216e Mon Sep 17 00:00:00 2001 From: beckermr Date: Wed, 23 Aug 2023 16:44:49 -0500 Subject: [PATCH 01/47] WIP something like this --- recipes/osx-sysroot/conda_build_config.yaml | 16 +++++++++++ recipes/osx-sysroot/meta.yaml | 32 +++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 recipes/osx-sysroot/conda_build_config.yaml create mode 100644 recipes/osx-sysroot/meta.yaml diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml new file mode 100644 index 0000000000000..4bd87f1a8dd54 --- /dev/null +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -0,0 +1,16 @@ +sdk_version: + - "10.9" + - "10.10" + - "10.11" + - "10.12" + - "10.13" + - "10.14" + - "10.15" + - "11.0" + - "11.1" + - "11.3" + +arm_sdk_version: + - "11.0" + - "11.1" + - "11.3" diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml new file mode 100644 index 0000000000000..261c050c85b2c --- /dev/null +++ b/recipes/osx-sysroot/meta.yaml @@ -0,0 +1,32 @@ +{% set name = "osx-sysroot" %} +{% set version = "1" %} + +package: + name: {{ name|lower }} + version: {{ version }} + + +build: + noarch: generic + number: 0 + +outputs: + - name: sysroot_osx-64 + version: {{ sdk_version }} + run_exports: + - __osx >={{ sdk_version }} + + - name: sysroot_osx-arm64 + version: {{ arm_sdk_version }} + run_exports: + - __osx >={{ arm_sdk_version }} + +about: + summary: metapackage to help set osx sdk version + license: BSD-3-Clause + license_family: BSD + license_file: LICENSE + +extra: + recipe-maintainers: + - beckermr From cfe0f918cf62dd28a18a3abb56ba7ff72412ad20 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Wed, 23 Aug 2023 17:08:01 -0500 Subject: [PATCH 02/47] Create LICENSE --- recipes/osx-sysroot/LICENSE | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 recipes/osx-sysroot/LICENSE diff --git a/recipes/osx-sysroot/LICENSE b/recipes/osx-sysroot/LICENSE new file mode 100644 index 0000000000000..28c446ff74a93 --- /dev/null +++ b/recipes/osx-sysroot/LICENSE @@ -0,0 +1,27 @@ +BSD-3-Clause license +Copyright (c) 2015-2023, conda-forge contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. From 2e7995b1269e2654985bcf3041460142027fc20f Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Wed, 23 Aug 2023 17:09:33 -0500 Subject: [PATCH 03/47] Update meta.yaml --- recipes/osx-sysroot/meta.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 261c050c85b2c..a70fe574a7aa0 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -1,4 +1,4 @@ -{% set name = "osx-sysroot" %} +{% set name = "macosx-sysroot" %} {% set version = "1" %} package: @@ -21,7 +21,12 @@ outputs: run_exports: - __osx >={{ arm_sdk_version }} +tests: + commands: + - echo "hi!" + about: + home: https://github.com/conda-forge/macosx-sysroot-feedstock summary: metapackage to help set osx sdk version license: BSD-3-Clause license_family: BSD From 6b02b86ec0a0e73bfdd5682c4acc828da3aa8cd1 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Wed, 23 Aug 2023 17:10:10 -0500 Subject: [PATCH 04/47] Update meta.yaml --- recipes/osx-sysroot/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index a70fe574a7aa0..a7436da8a25fc 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -21,7 +21,7 @@ outputs: run_exports: - __osx >={{ arm_sdk_version }} -tests: +test: commands: - echo "hi!" From 721729d7043eaca488baaa1df8f04103db6de8b8 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Wed, 23 Aug 2023 17:11:11 -0500 Subject: [PATCH 05/47] Update meta.yaml --- recipes/osx-sysroot/meta.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index a7436da8a25fc..503ae1047fe1b 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -15,15 +15,17 @@ outputs: version: {{ sdk_version }} run_exports: - __osx >={{ sdk_version }} + test: + commands: + - echo "hi!" - name: sysroot_osx-arm64 version: {{ arm_sdk_version }} run_exports: - __osx >={{ arm_sdk_version }} - -test: - commands: - - echo "hi!" + test: + commands: + - echo "hi!" about: home: https://github.com/conda-forge/macosx-sysroot-feedstock From 07449f8047a461ef1b0a7121ecfc63ce72af269e Mon Sep 17 00:00:00 2001 From: beckermr Date: Wed, 23 Aug 2023 19:30:22 -0500 Subject: [PATCH 06/47] WIP try this --- recipes/osx-sysroot/conda_build_config.yaml | 22 ++++++++++---------- recipes/osx-sysroot/meta.yaml | 23 +++++++++------------ 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index 4bd87f1a8dd54..e60bfce4a329f 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -1,16 +1,16 @@ sdk_version: - "10.9" - - "10.10" - - "10.11" - - "10.12" - "10.13" - - "10.14" - - "10.15" - "11.0" - - "11.1" - - "11.3" - -arm_sdk_version: - "11.0" - - "11.1" - - "11.3" + +cross_target_platform: + - osx-64 + - osx-64 + - osx-64 + - osx-arm64 + +zip_keys: + - + - sdk_version + - cross_target_platform diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 261c050c85b2c..d1caaed016b35 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -5,21 +5,18 @@ package: name: {{ name|lower }} version: {{ version }} - -build: - noarch: generic - number: 0 - outputs: - - name: sysroot_osx-64 + - name: sysroot_{{ cross_target_platform }} version: {{ sdk_version }} - run_exports: - - __osx >={{ sdk_version }} - - - name: sysroot_osx-arm64 - version: {{ arm_sdk_version }} - run_exports: - - __osx >={{ arm_sdk_version }} + build: + noarch: generic + number: 0 + run_exports: + strong: + - __osx >={{ sdk_version }} + tests: + commands: + - echo "hello world!" about: summary: metapackage to help set osx sdk version From 74a101f501e00177b47a008ee7176b3a3443e2e3 Mon Sep 17 00:00:00 2001 From: beckermr Date: Wed, 23 Aug 2023 19:31:31 -0500 Subject: [PATCH 07/47] try again --- recipes/osx-sysroot/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index c1cae059b3e68..a59795d7d714c 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -1,4 +1,4 @@ -{% set name = "macosx-sysroot" %} +{% set name = "osx-sysroot" %} {% set version = "1" %} package: From 7dbd4b4e2a18e503ae20fb66ce275f837fd45743 Mon Sep 17 00:00:00 2001 From: beckermr Date: Wed, 23 Aug 2023 19:52:10 -0500 Subject: [PATCH 08/47] test --- recipes/osx-sysroot/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index a59795d7d714c..688bf09cb4e4c 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -14,7 +14,7 @@ outputs: run_exports: strong: - __osx >={{ sdk_version }} - tests: + test: commands: - echo "hello world!" From 166558222d3daf7bc807eea44a573eaa9ea24718 Mon Sep 17 00:00:00 2001 From: beckermr Date: Wed, 23 Aug 2023 19:52:49 -0500 Subject: [PATCH 09/47] more lint --- recipes/osx-sysroot/meta.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 688bf09cb4e4c..1760a8c7586b1 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -5,15 +5,17 @@ package: name: {{ name|lower }} version: {{ version }} +build: + number: 0 + outputs: - name: sysroot_{{ cross_target_platform }} version: {{ sdk_version }} build: noarch: generic - number: 0 - run_exports: - strong: - - __osx >={{ sdk_version }} + run_exports: + strong: + - __osx >={{ sdk_version }} test: commands: - echo "hello world!" From d74309ec54b21952dbef892c48d3c08f95603956 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 06:34:52 -0500 Subject: [PATCH 10/47] ENH download SDKs and get constraints right --- recipes/osx-sysroot/activate-sdk.sh | 37 +++++++++++++++++++ recipes/osx-sysroot/activate-sysroot.sh | 6 ++++ recipes/osx-sysroot/build_sdk.sh | 9 +++++ recipes/osx-sysroot/build_sysroot.sh | 9 +++++ recipes/osx-sysroot/conda_build_config.yaml | 14 ++++++-- recipes/osx-sysroot/deactivate-sdk.sh | 28 +++++++++++++++ recipes/osx-sysroot/deactivate-sysroot.sh | 6 ++++ recipes/osx-sysroot/meta.yaml | 39 +++++++++++++++++---- 8 files changed, 140 insertions(+), 8 deletions(-) create mode 100644 recipes/osx-sysroot/activate-sdk.sh create mode 100644 recipes/osx-sysroot/activate-sysroot.sh create mode 100644 recipes/osx-sysroot/build_sdk.sh create mode 100644 recipes/osx-sysroot/build_sysroot.sh create mode 100644 recipes/osx-sysroot/deactivate-sdk.sh create mode 100644 recipes/osx-sysroot/deactivate-sysroot.sh diff --git a/recipes/osx-sysroot/activate-sdk.sh b/recipes/osx-sysroot/activate-sdk.sh new file mode 100644 index 0000000000000..d1a97bd0a6521 --- /dev/null +++ b/recipes/osx-sysroot/activate-sdk.sh @@ -0,0 +1,37 @@ +if [ -z "$MACOSX_SDK_VERSION" ]; then + export MACOSX_SDK_VERSION="@MACOSX_SDK_VERSION@" +else + export CONDA_BACKUP_MACOSX_SDK_VERSION="${MACOSX_SDK_VERSION}" + export MACOSX_SDK_VERSION="@MACOSX_SDK_VERSION@" +fi + +if [ -z "$MACOSX_SDK_CACHE_DIR" ]; then + export MACOSX_SDK_CACHE_DIR="${PREFIX}/MacOSX_SDKs" +else + export CONDA_BACKUP_MACOSX_SDK_CACHE_DIR="${MACOSX_SDK_CACHE_DIR}" +fi + +if [ -z "$CONDA_BUILD_SYSROOT" ]; then + export CONDA_BUILD_SYSROOT="${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" +else + export CONDA_BACKUP_CONDA_BUILD_SYSROOT="${CONDA_BUILD_SYSROOT}" + export CONDA_BUILD_SYSROOT="${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" +fi + +if [ -z "$SDKROOT" ]; then + export SDKROOT="${CONDA_BUILD_SYSROOT}" +else + export CONDA_BACKUP_SDKROOT="${SDKROOT}" + export SDKROOT="${CONDA_BUILD_SYSROOT}" +fi + +if [ ! -d "${CONDA_BUILD_SYSROOT}" ]; then + if [ "${MACOSX_SDK_VERSION}" = "12.3" ]; then + url="https://github.com/alexey-lysiuk/macos-sdk/releases/download/${MACOSX_SDK_VERSION}/MacOSX${MACOSX_SDK_VERSION}.tar.xz" + else + url="https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" + fi + curl -L --output "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" "${url}" + mkdir -p `dirname "$CONDA_BUILD_SYSROOT"` + tar -xf "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" -C `dirname "$CONDA_BUILD_SYSROOT"` +fi diff --git a/recipes/osx-sysroot/activate-sysroot.sh b/recipes/osx-sysroot/activate-sysroot.sh new file mode 100644 index 0000000000000..cf85b854ad9b6 --- /dev/null +++ b/recipes/osx-sysroot/activate-sysroot.sh @@ -0,0 +1,6 @@ +if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]; then + export MACOSX_DEPLOYMENT_TARGET="@MACOSX_DEPLOYMENT_TARGET@" +else + export CONDA_BACKUP_MACOSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" + export MACOSX_DEPLOYMENT_TARGET="@MACOSX_DEPLOYMENT_TARGET@" +fi diff --git a/recipes/osx-sysroot/build_sdk.sh b/recipes/osx-sysroot/build_sdk.sh new file mode 100644 index 0000000000000..38bf23b0ecc6e --- /dev/null +++ b/recipes/osx-sysroot/build_sdk.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +find "${RECIPE_DIR}" -name "activate-sdk.sh" -exec cp {} . \; +find . -name "activate-sdk.sh" -exec sed -i.bak "s|@MACOSX_SDK_VERSION@|${MACOSX_DEPLOYMENT_TARGET}|g" "{}" \; +find . -name "activate-sdk.sh.bak" -exec rm "{}" \; + +mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ +cp "${SRC_DIR}"/activate-sdk.sh "${PREFIX}"/etc/conda/activate.d/activate_"${PKG_NAME}".sh +cp "${SRC_DIR}"/deactivate-sdk.sh "${PREFIX}"/etc/conda/deactivate.d/deactivate_"${PKG_NAME}".sh diff --git a/recipes/osx-sysroot/build_sysroot.sh b/recipes/osx-sysroot/build_sysroot.sh new file mode 100644 index 0000000000000..c01a3abfebbc4 --- /dev/null +++ b/recipes/osx-sysroot/build_sysroot.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +find "${RECIPE_DIR}" -name "activate-sysroot.sh" -exec cp {} . \; +find . -name "activate-sysroot.sh" -exec sed -i.bak "s|@MACOSX_DEPLOYMENT_TARGET@|${MACOSX_DEPLOYMENT_TARGET}|g" "{}" \; +find . -name "activate-sysroot.sh.bak" -exec rm "{}" \; + +mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ +cp "${SRC_DIR}"/activate-sdk.sh "${PREFIX}"/etc/conda/activate.d/activate_"${PKG_NAME}".sh +cp "${SRC_DIR}"/deactivate-sdk.sh "${PREFIX}"/etc/conda/deactivate.d/deactivate_"${PKG_NAME}".sh diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index e60bfce4a329f..646484bbe9c3c 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -1,16 +1,26 @@ -sdk_version: +MACOSX_DEPLOYMENT_TARGET: - "10.9" - "10.13" - "11.0" - "11.0" + - "12.3" + +is_default_sdk: + - "yes" + - "no" + - "no" + - "yes" + - "no" cross_target_platform: - osx-64 - osx-64 - osx-64 - osx-arm64 + - osx-arm64 zip_keys: - - - sdk_version + - MACOSX_DEPLOYMENT_TARGET - cross_target_platform + - is_default_sdk diff --git a/recipes/osx-sysroot/deactivate-sdk.sh b/recipes/osx-sysroot/deactivate-sdk.sh new file mode 100644 index 0000000000000..c4da583955cab --- /dev/null +++ b/recipes/osx-sysroot/deactivate-sdk.sh @@ -0,0 +1,28 @@ +if [ -z "${CONDA_BACKUP_MACOSX_SDK_VERSION}" ]; then + export MACOSX_SDK_VERSION="${CONDA_BACKUP_MACOSX_SDK_VERSION}" + unset CONDA_BACKUP_MACOSX_SDK_VERSION +else + unset MACOSX_SDK_VERSION +fi + +if [ -z "${CONDA_BACKUP_MACOSX_SDK_CACHE_DIR}" ]; then + # we didn't override this so no need to reset + # backup var is here to indicate to not unset + unset CONDA_BACKUP_MACOSX_SDK_CACHE_DIR +else + unset MACOSX_SDK_CACHE_DIR +fi + +if [ -z "${CONDA_BACKUP_CONDA_BUILD_SYSROOT}" ]; then + export CONDA_BUILD_SYSROOT="${CONDA_BACKUP_CONDA_BUILD_SYSROOT}" + unset CONDA_BACKUP_CONDA_BUILD_SYSROOT +else + unset CONDA_BUILD_SYSROOT +fi + +if [ -z "${CONDA_BACKUP_SDKROOT}" ]; then + export SDKROOT="${CONDA_BACKUP_SDKROOT}" + unset CONDA_BACKUP_SDKROOT +else + unset SDKROOT +fi diff --git a/recipes/osx-sysroot/deactivate-sysroot.sh b/recipes/osx-sysroot/deactivate-sysroot.sh new file mode 100644 index 0000000000000..6d86fe02597e9 --- /dev/null +++ b/recipes/osx-sysroot/deactivate-sysroot.sh @@ -0,0 +1,6 @@ +if [ -z "${CONDA_BACKUP_MACOSX_DEPLOYMENT_TARGET}" ]; then + export MACOSX_DEPLOYMENT_TARGET="${CONDA_BACKUP_MACOSX_DEPLOYMENT_TARGET}" + unset CONDA_BACKUP_MACOSX_DEPLOYMENT_TARGET +else + unset MACOSX_DEPLOYMENT_TARGET +fi diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 1760a8c7586b1..d263872c1ab10 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -9,20 +9,47 @@ build: number: 0 outputs: + - name: macosx-sdk + version: {{ MACOSX_DEPLOYMENT_TARGET }} + script: build_sdk.sh + build: + noarch: generic + # weigh down newer sdks + track_features: #[is_default_sdk == "no"] + - macosx-sdk_{{ MACOSX_DEPLOYMENT_TARGET }} #[is_default_sdk == "no"] + test: + commands: + - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" + about: + home: https://github.com/conda-forge/osx-sysroot-feedstock + summary: package to download MacOSX SDKs + license: BSD-3-Clause + license_family: BSD + license_file: LICENSE + - name: sysroot_{{ cross_target_platform }} - version: {{ sdk_version }} + version: {{ MACOSX_DEPLOYMENT_TARGET }} build: noarch: generic - run_exports: - strong: - - __osx >={{ sdk_version }} + run_exports: + strong: + - __osx >={{ MACOSX_DEPLOYMENT_TARGET }} + requirements: + run: + - macosx-sdk >={{ MACOSX_DEPLOYMENT_TARGET }} test: commands: - echo "hello world!" + about: + home: https://github.com/conda-forge/osx-sysroot-feedstock + summary: metapackage to set the MACOSX_DEPLOYMENT_TARGET + license: BSD-3-Clause + license_family: BSD + license_file: LICENSE about: - home: https://github.com/conda-forge/macosx-sysroot-feedstock - summary: metapackage to help set osx sdk version + home: https://github.com/conda-forge/osx-sysroot-feedstock + summary: packages to download MacOSX SDKs and set MACOSX_DEPLOYMENT_TARGET license: BSD-3-Clause license_family: BSD license_file: LICENSE From d13f093fa2f235668005768bbe5158ae3da9167a Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 06:35:45 -0500 Subject: [PATCH 11/47] fix lint --- recipes/osx-sysroot/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index d263872c1ab10..424ba5e84a45a 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -15,8 +15,8 @@ outputs: build: noarch: generic # weigh down newer sdks - track_features: #[is_default_sdk == "no"] - - macosx-sdk_{{ MACOSX_DEPLOYMENT_TARGET }} #[is_default_sdk == "no"] + track_features: # [is_default_sdk == "no"] + - macosx-sdk_{{ MACOSX_DEPLOYMENT_TARGET }} # [is_default_sdk == "no"] test: commands: - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" From 846b874977dcc7c5bee1ad9735cd839efb9ae9f5 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 06:42:34 -0500 Subject: [PATCH 12/47] bug need all the files --- recipes/osx-sysroot/build_sdk.sh | 2 ++ recipes/osx-sysroot/build_sysroot.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/recipes/osx-sysroot/build_sdk.sh b/recipes/osx-sysroot/build_sdk.sh index 38bf23b0ecc6e..5e30f0756d505 100644 --- a/recipes/osx-sysroot/build_sdk.sh +++ b/recipes/osx-sysroot/build_sdk.sh @@ -1,6 +1,8 @@ #!/bin/bash find "${RECIPE_DIR}" -name "activate-sdk.sh" -exec cp {} . \; +find "${RECIPE_DIR}" -name "deactivate-sdk.sh" -exec cp {} . \; + find . -name "activate-sdk.sh" -exec sed -i.bak "s|@MACOSX_SDK_VERSION@|${MACOSX_DEPLOYMENT_TARGET}|g" "{}" \; find . -name "activate-sdk.sh.bak" -exec rm "{}" \; diff --git a/recipes/osx-sysroot/build_sysroot.sh b/recipes/osx-sysroot/build_sysroot.sh index c01a3abfebbc4..b3501d7b9ccf9 100644 --- a/recipes/osx-sysroot/build_sysroot.sh +++ b/recipes/osx-sysroot/build_sysroot.sh @@ -1,6 +1,8 @@ #!/bin/bash find "${RECIPE_DIR}" -name "activate-sysroot.sh" -exec cp {} . \; +find "${RECIPE_DIR}" -name "deactivate-sysroot.sh" -exec cp {} . \; + find . -name "activate-sysroot.sh" -exec sed -i.bak "s|@MACOSX_DEPLOYMENT_TARGET@|${MACOSX_DEPLOYMENT_TARGET}|g" "{}" \; find . -name "activate-sysroot.sh.bak" -exec rm "{}" \; From cb0942a17fe1ded5ebf8d9511a45837361b41420 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 07:05:48 -0500 Subject: [PATCH 13/47] rezip things --- recipes/osx-sysroot/build_sdk.sh | 2 +- recipes/osx-sysroot/conda_build_config.yaml | 22 ++++++++++++++------- recipes/osx-sysroot/meta.yaml | 7 ++++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/recipes/osx-sysroot/build_sdk.sh b/recipes/osx-sysroot/build_sdk.sh index 5e30f0756d505..95fff7a2fac17 100644 --- a/recipes/osx-sysroot/build_sdk.sh +++ b/recipes/osx-sysroot/build_sdk.sh @@ -3,7 +3,7 @@ find "${RECIPE_DIR}" -name "activate-sdk.sh" -exec cp {} . \; find "${RECIPE_DIR}" -name "deactivate-sdk.sh" -exec cp {} . \; -find . -name "activate-sdk.sh" -exec sed -i.bak "s|@MACOSX_SDK_VERSION@|${MACOSX_DEPLOYMENT_TARGET}|g" "{}" \; +find . -name "activate-sdk.sh" -exec sed -i.bak "s|@MACOSX_SDK_VERSION@|${MACOSX_SDK_VERSION}|g" "{}" \; find . -name "activate-sdk.sh.bak" -exec rm "{}" \; mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index 646484bbe9c3c..9b3e09952fc4b 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -5,13 +5,6 @@ MACOSX_DEPLOYMENT_TARGET: - "11.0" - "12.3" -is_default_sdk: - - "yes" - - "no" - - "no" - - "yes" - - "no" - cross_target_platform: - osx-64 - osx-64 @@ -19,8 +12,23 @@ cross_target_platform: - osx-arm64 - osx-arm64 +MACOSX_SDK_VERSION: + - "10.9" + - "10.13" + - "11.0" + - "12.3" + +is_default_sdk: + - "yes" + - "no" + - "no" + - "no" + zip_keys: - - MACOSX_DEPLOYMENT_TARGET - cross_target_platform + - MAX_MACOSX_SDK + - + - MACOSX_SDK_VERSION - is_default_sdk diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 424ba5e84a45a..88eac4c2c7a44 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -10,13 +10,13 @@ build: outputs: - name: macosx-sdk - version: {{ MACOSX_DEPLOYMENT_TARGET }} + version: {{ MACOSX_SDK_VERSION }} script: build_sdk.sh build: noarch: generic # weigh down newer sdks track_features: # [is_default_sdk == "no"] - - macosx-sdk_{{ MACOSX_DEPLOYMENT_TARGET }} # [is_default_sdk == "no"] + - macosx-sdk_{{ MACOSX_SDK_VERSION }} # [is_default_sdk == "no"] test: commands: - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" @@ -39,7 +39,8 @@ outputs: - macosx-sdk >={{ MACOSX_DEPLOYMENT_TARGET }} test: commands: - - echo "hello world!" + - "[[ ${MACOSX_DEPLOYMENT_TARGET} == "{{ MACOSX_DEPLOYMENT_TARGET }}" ]]" + - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" about: home: https://github.com/conda-forge/osx-sysroot-feedstock summary: metapackage to set the MACOSX_DEPLOYMENT_TARGET From ddb3c46d9259f3aa8698c6fb124f7ee7b7199226 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 07:07:04 -0500 Subject: [PATCH 14/47] quotes --- recipes/osx-sysroot/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 88eac4c2c7a44..6f86fde40b0aa 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -39,7 +39,7 @@ outputs: - macosx-sdk >={{ MACOSX_DEPLOYMENT_TARGET }} test: commands: - - "[[ ${MACOSX_DEPLOYMENT_TARGET} == "{{ MACOSX_DEPLOYMENT_TARGET }}" ]]" + - '[[ ${MACOSX_DEPLOYMENT_TARGET} == "{{ MACOSX_DEPLOYMENT_TARGET }}" ]]' - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" about: home: https://github.com/conda-forge/osx-sysroot-feedstock From a181c55e59cedca9a9266ea1a36a21e918988301 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 07:07:28 -0500 Subject: [PATCH 15/47] quotes --- recipes/osx-sysroot/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 6f86fde40b0aa..462051ec566aa 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -39,7 +39,7 @@ outputs: - macosx-sdk >={{ MACOSX_DEPLOYMENT_TARGET }} test: commands: - - '[[ ${MACOSX_DEPLOYMENT_TARGET} == "{{ MACOSX_DEPLOYMENT_TARGET }}" ]]' + - "[[ ${MACOSX_DEPLOYMENT_TARGET} == \"{{ MACOSX_DEPLOYMENT_TARGET }}\" ]]" - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" about: home: https://github.com/conda-forge/osx-sysroot-feedstock From 055f84e51073b754cb8cff91d9dbc37946f19aa5 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Thu, 24 Aug 2023 08:38:12 -0400 Subject: [PATCH 16/47] Update conda_build_config.yaml --- recipes/osx-sysroot/conda_build_config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index 9b3e09952fc4b..c090fd7d83af7 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -28,7 +28,6 @@ zip_keys: - - MACOSX_DEPLOYMENT_TARGET - cross_target_platform - - MAX_MACOSX_SDK - - MACOSX_SDK_VERSION - is_default_sdk From b631db85f2b0464adb0a031b833bd43b9b195bb4 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 08:29:27 -0500 Subject: [PATCH 17/47] BUG current setup makes new one not work --- recipes/osx-sysroot/build_sdk.sh | 2 +- recipes/osx-sysroot/build_sysroot.sh | 2 +- recipes/osx-sysroot/conda_build_config.yaml | 8 ++++---- recipes/osx-sysroot/meta.yaml | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/recipes/osx-sysroot/build_sdk.sh b/recipes/osx-sysroot/build_sdk.sh index 95fff7a2fac17..f148abd638104 100644 --- a/recipes/osx-sysroot/build_sdk.sh +++ b/recipes/osx-sysroot/build_sdk.sh @@ -3,7 +3,7 @@ find "${RECIPE_DIR}" -name "activate-sdk.sh" -exec cp {} . \; find "${RECIPE_DIR}" -name "deactivate-sdk.sh" -exec cp {} . \; -find . -name "activate-sdk.sh" -exec sed -i.bak "s|@MACOSX_SDK_VERSION@|${MACOSX_SDK_VERSION}|g" "{}" \; +find . -name "activate-sdk.sh" -exec sed -i.bak "s|@MACOSX_SDK_VERSION@|${_MACOSX_SDK_VERSION_}|g" "{}" \; find . -name "activate-sdk.sh.bak" -exec rm "{}" \; mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ diff --git a/recipes/osx-sysroot/build_sysroot.sh b/recipes/osx-sysroot/build_sysroot.sh index b3501d7b9ccf9..067c9fc1d8820 100644 --- a/recipes/osx-sysroot/build_sysroot.sh +++ b/recipes/osx-sysroot/build_sysroot.sh @@ -3,7 +3,7 @@ find "${RECIPE_DIR}" -name "activate-sysroot.sh" -exec cp {} . \; find "${RECIPE_DIR}" -name "deactivate-sysroot.sh" -exec cp {} . \; -find . -name "activate-sysroot.sh" -exec sed -i.bak "s|@MACOSX_DEPLOYMENT_TARGET@|${MACOSX_DEPLOYMENT_TARGET}|g" "{}" \; +find . -name "activate-sysroot.sh" -exec sed -i.bak "s|@MACOSX_DEPLOYMENT_TARGET@|${_MACOSX_DEPLOYMENT_TARGET_}|g" "{}" \; find . -name "activate-sysroot.sh.bak" -exec rm "{}" \; mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index c090fd7d83af7..c41ee13a340c2 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -1,4 +1,4 @@ -MACOSX_DEPLOYMENT_TARGET: +_MACOSX_DEPLOYMENT_TARGET_: - "10.9" - "10.13" - "11.0" @@ -12,7 +12,7 @@ cross_target_platform: - osx-arm64 - osx-arm64 -MACOSX_SDK_VERSION: +_MACOSX_SDK_VERSION_: - "10.9" - "10.13" - "11.0" @@ -26,8 +26,8 @@ is_default_sdk: zip_keys: - - - MACOSX_DEPLOYMENT_TARGET + - _MACOSX_DEPLOYMENT_TARGET_ - cross_target_platform - - - MACOSX_SDK_VERSION + - _MACOSX_SDK_VERSION_ - is_default_sdk diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 462051ec566aa..a724bac452222 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -10,13 +10,13 @@ build: outputs: - name: macosx-sdk - version: {{ MACOSX_SDK_VERSION }} + version: {{ _MACOSX_SDK_VERSION_ }} script: build_sdk.sh build: noarch: generic # weigh down newer sdks track_features: # [is_default_sdk == "no"] - - macosx-sdk_{{ MACOSX_SDK_VERSION }} # [is_default_sdk == "no"] + - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] test: commands: - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" @@ -28,18 +28,18 @@ outputs: license_file: LICENSE - name: sysroot_{{ cross_target_platform }} - version: {{ MACOSX_DEPLOYMENT_TARGET }} + version: {{ _MACOSX_DEPLOYMENT_TARGET_ }} build: noarch: generic run_exports: strong: - - __osx >={{ MACOSX_DEPLOYMENT_TARGET }} + - __osx >={{ _MACOSX_DEPLOYMENT_TARGET_ }} requirements: run: - - macosx-sdk >={{ MACOSX_DEPLOYMENT_TARGET }} + - macosx-sdk >={{ _MACOSX_DEPLOYMENT_TARGET_ }} test: commands: - - "[[ ${MACOSX_DEPLOYMENT_TARGET} == \"{{ MACOSX_DEPLOYMENT_TARGET }}\" ]]" + - "[[ ${MACOSX_DEPLOYMENT_TARGET} == \\\"{{ _MACOSX_DEPLOYMENT_TARGET_ }}\\\" ]]" - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" about: home: https://github.com/conda-forge/osx-sysroot-feedstock From d2646fe8dc7a1541e6e72e4debbb69c228a6aff2 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 08:44:20 -0500 Subject: [PATCH 18/47] bugz again --- recipes/osx-sysroot/meta.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index a724bac452222..0c21b55d7c8e8 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -29,6 +29,7 @@ outputs: - name: sysroot_{{ cross_target_platform }} version: {{ _MACOSX_DEPLOYMENT_TARGET_ }} + script: build_sysroot.sh build: noarch: generic run_exports: @@ -39,7 +40,7 @@ outputs: - macosx-sdk >={{ _MACOSX_DEPLOYMENT_TARGET_ }} test: commands: - - "[[ ${MACOSX_DEPLOYMENT_TARGET} == \\\"{{ _MACOSX_DEPLOYMENT_TARGET_ }}\\\" ]]" + - "[[ ${MACOSX_DEPLOYMENT_TARGET} == '{{ _MACOSX_DEPLOYMENT_TARGET_ }}' ]]" - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" about: home: https://github.com/conda-forge/osx-sysroot-feedstock From 5b3ac1f56759d9f5dfce704485ca4dbb30342da7 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 09:07:09 -0500 Subject: [PATCH 19/47] BUG wrong thing copied --- recipes/osx-sysroot/build_sysroot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/osx-sysroot/build_sysroot.sh b/recipes/osx-sysroot/build_sysroot.sh index 067c9fc1d8820..9cbc3eea1bbbc 100644 --- a/recipes/osx-sysroot/build_sysroot.sh +++ b/recipes/osx-sysroot/build_sysroot.sh @@ -7,5 +7,5 @@ find . -name "activate-sysroot.sh" -exec sed -i.bak "s|@MACOSX_DEPLOYMENT_TARGET find . -name "activate-sysroot.sh.bak" -exec rm "{}" \; mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ -cp "${SRC_DIR}"/activate-sdk.sh "${PREFIX}"/etc/conda/activate.d/activate_"${PKG_NAME}".sh -cp "${SRC_DIR}"/deactivate-sdk.sh "${PREFIX}"/etc/conda/deactivate.d/deactivate_"${PKG_NAME}".sh +cp "${SRC_DIR}"/activate-sysroot.sh "${PREFIX}"/etc/conda/activate.d/activate_"${PKG_NAME}".sh +cp "${SRC_DIR}"/deactivate-sysroot.sh "${PREFIX}"/etc/conda/deactivate.d/deactivate_"${PKG_NAME}".sh From f3f42e3d61442b249cba9a153719ea74a4e5ab16 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 15:46:52 -0500 Subject: [PATCH 20/47] ENH move over a bunch of compiler stuff --- recipes/osx-sysroot/activate-sdk.sh | 41 +++++++++++++-------- recipes/osx-sysroot/activate-sysroot.sh | 16 +++++++- recipes/osx-sysroot/build_sysroot.sh | 4 ++ recipes/osx-sysroot/conda_build_config.yaml | 2 +- recipes/osx-sysroot/deactivate-sdk.sh | 29 +++++++++------ recipes/osx-sysroot/deactivate-sysroot.sh | 20 ++++++++-- recipes/osx-sysroot/meta.yaml | 5 +++ 7 files changed, 85 insertions(+), 32 deletions(-) diff --git a/recipes/osx-sysroot/activate-sdk.sh b/recipes/osx-sysroot/activate-sdk.sh index d1a97bd0a6521..13e824e1d4413 100644 --- a/recipes/osx-sysroot/activate-sdk.sh +++ b/recipes/osx-sysroot/activate-sdk.sh @@ -1,37 +1,46 @@ if [ -z "$MACOSX_SDK_VERSION" ]; then export MACOSX_SDK_VERSION="@MACOSX_SDK_VERSION@" else - export CONDA_BACKUP_MACOSX_SDK_VERSION="${MACOSX_SDK_VERSION}" + export CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_VERSION="${MACOSX_SDK_VERSION}" export MACOSX_SDK_VERSION="@MACOSX_SDK_VERSION@" fi if [ -z "$MACOSX_SDK_CACHE_DIR" ]; then export MACOSX_SDK_CACHE_DIR="${PREFIX}/MacOSX_SDKs" else - export CONDA_BACKUP_MACOSX_SDK_CACHE_DIR="${MACOSX_SDK_CACHE_DIR}" -fi - -if [ -z "$CONDA_BUILD_SYSROOT" ]; then - export CONDA_BUILD_SYSROOT="${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" -else - export CONDA_BACKUP_CONDA_BUILD_SYSROOT="${CONDA_BUILD_SYSROOT}" - export CONDA_BUILD_SYSROOT="${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" + export CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_CACHE_DIR="${MACOSX_SDK_CACHE_DIR}" fi if [ -z "$SDKROOT" ]; then - export SDKROOT="${CONDA_BUILD_SYSROOT}" + export SDKROOT="${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" else - export CONDA_BACKUP_SDKROOT="${SDKROOT}" - export SDKROOT="${CONDA_BUILD_SYSROOT}" + export CONDA_MACOSX_SDK_BACKUP_SDKROOT="${SDKROOT}" + export SDKROOT="${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" fi -if [ ! -d "${CONDA_BUILD_SYSROOT}" ]; then +if [ ! -d "${SDKROOT}" ]; then if [ "${MACOSX_SDK_VERSION}" = "12.3" ]; then url="https://github.com/alexey-lysiuk/macos-sdk/releases/download/${MACOSX_SDK_VERSION}/MacOSX${MACOSX_SDK_VERSION}.tar.xz" else url="https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" fi - curl -L --output "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" "${url}" - mkdir -p `dirname "$CONDA_BUILD_SYSROOT"` - tar -xf "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" -C `dirname "$CONDA_BUILD_SYSROOT"` + curl --quiet -L --output "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" "${url}" + mkdir -p `dirname "$SDKROOT"` + tar -xf "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" -C `dirname "$SDKROOT"` +fi + +if [ -z "${CMAKE_ARGS}" ]; then + export CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT=${SDKROOT}" +else + export CONDA_MACOSX_SDK_BACKUP_CMAKE_ARGS="${CMAKE_ARGS}" + export CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT=${SDKROOT}" +fi + +if [ "${CONDA_BUILD:-0}" = "1" ]; then + if [ -z "$CONDA_BUILD_SYSROOT" ]; then + export CONDA_BUILD_SYSROOT="${SDKROOT}" + else + export CONDA_MACOSX_SDK_BACKUP_CONDA_BUILD_SYSROOT="${CONDA_BUILD_SYSROOT}" + export CONDA_BUILD_SYSROOT="${SDKROOT}" + fi fi diff --git a/recipes/osx-sysroot/activate-sysroot.sh b/recipes/osx-sysroot/activate-sysroot.sh index cf85b854ad9b6..78ccfec00a499 100644 --- a/recipes/osx-sysroot/activate-sysroot.sh +++ b/recipes/osx-sysroot/activate-sysroot.sh @@ -1,6 +1,20 @@ if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]; then export MACOSX_DEPLOYMENT_TARGET="@MACOSX_DEPLOYMENT_TARGET@" else - export CONDA_BACKUP_MACOSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" + export CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" export MACOSX_DEPLOYMENT_TARGET="@MACOSX_DEPLOYMENT_TARGET@" fi + +if [ -z "${CMAKE_ARGS}" ]; then + export CMAKE_ARGS="-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}" +else + export CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS="${CMAKE_ARGS}" + export CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}" +fi + +if [ -z "${CPPFLAGS}" ]; then + export CPPFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" +else + export CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS="${CPPFLAGS}" + export CPPFLAGS="${CPPFLAGS} -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" +fi diff --git a/recipes/osx-sysroot/build_sysroot.sh b/recipes/osx-sysroot/build_sysroot.sh index 9cbc3eea1bbbc..ef76923468b8d 100644 --- a/recipes/osx-sysroot/build_sysroot.sh +++ b/recipes/osx-sysroot/build_sysroot.sh @@ -4,8 +4,12 @@ find "${RECIPE_DIR}" -name "activate-sysroot.sh" -exec cp {} . \; find "${RECIPE_DIR}" -name "deactivate-sysroot.sh" -exec cp {} . \; find . -name "activate-sysroot.sh" -exec sed -i.bak "s|@MACOSX_DEPLOYMENT_TARGET@|${_MACOSX_DEPLOYMENT_TARGET_}|g" "{}" \; +find . -name "activate-sysroot.sh" -exec sed -i.bak "s|@PLATFORM@|${cross_target_platform//-/_}|g" "{}" \; find . -name "activate-sysroot.sh.bak" -exec rm "{}" \; +find . -name "deactivate-sysroot.sh" -exec sed -i.bak "s|@PLATFORM@|${cross_target_platform//-/_}|g" "{}" \; +find . -name "deactivate-sysroot.sh.bak" -exec rm "{}" \; + mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ cp "${SRC_DIR}"/activate-sysroot.sh "${PREFIX}"/etc/conda/activate.d/activate_"${PKG_NAME}".sh cp "${SRC_DIR}"/deactivate-sysroot.sh "${PREFIX}"/etc/conda/deactivate.d/deactivate_"${PKG_NAME}".sh diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index c41ee13a340c2..d515cb05270b7 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -19,8 +19,8 @@ _MACOSX_SDK_VERSION_: - "12.3" is_default_sdk: - - "yes" - "no" + - "yes" - "no" - "no" diff --git a/recipes/osx-sysroot/deactivate-sdk.sh b/recipes/osx-sysroot/deactivate-sdk.sh index c4da583955cab..ab7316f2ef830 100644 --- a/recipes/osx-sysroot/deactivate-sdk.sh +++ b/recipes/osx-sysroot/deactivate-sdk.sh @@ -1,28 +1,35 @@ -if [ -z "${CONDA_BACKUP_MACOSX_SDK_VERSION}" ]; then - export MACOSX_SDK_VERSION="${CONDA_BACKUP_MACOSX_SDK_VERSION}" - unset CONDA_BACKUP_MACOSX_SDK_VERSION +if [ -z "${CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_VERSION}" ]; then + export MACOSX_SDK_VERSION="${CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_VERSION}" + unset CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_VERSION else unset MACOSX_SDK_VERSION fi -if [ -z "${CONDA_BACKUP_MACOSX_SDK_CACHE_DIR}" ]; then +if [ -z "${CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_CACHE_DIR}" ]; then # we didn't override this so no need to reset # backup var is here to indicate to not unset - unset CONDA_BACKUP_MACOSX_SDK_CACHE_DIR + unset CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_CACHE_DIR else unset MACOSX_SDK_CACHE_DIR fi -if [ -z "${CONDA_BACKUP_CONDA_BUILD_SYSROOT}" ]; then - export CONDA_BUILD_SYSROOT="${CONDA_BACKUP_CONDA_BUILD_SYSROOT}" - unset CONDA_BACKUP_CONDA_BUILD_SYSROOT +if [ -z "${CONDA_MACOSX_SDK_BACKUP_CONDA_BUILD_SYSROOT}" ]; then + export CONDA_BUILD_SYSROOT="${CONDA_MACOSX_SDK_BACKUP_CONDA_BUILD_SYSROOT}" + unset CONDA_MACOSX_SDK_BACKUP_CONDA_BUILD_SYSROOT else unset CONDA_BUILD_SYSROOT fi -if [ -z "${CONDA_BACKUP_SDKROOT}" ]; then - export SDKROOT="${CONDA_BACKUP_SDKROOT}" - unset CONDA_BACKUP_SDKROOT +if [ -z "${CONDA_MACOSX_SDK_BACKUP_SDKROOT}" ]; then + export SDKROOT="${CONDA_MACOSX_SDK_BACKUP_SDKROOT}" + unset CONDA_MACOSX_SDK_BACKUP_SDKROOT else unset SDKROOT fi + +if [ -z "${CONDA_MACOSX_SDK_BACKUP_CMAKE_ARGS}" ]; then + export CMAKE_ARGS="${CONDA_MACOSX_SDK_BACKUP_CMAKE_ARGS}" + unset CONDA_MACOSX_SDK_BACKUP_CMAKE_ARGS +else + unset CMAKE_ARGS +fi diff --git a/recipes/osx-sysroot/deactivate-sysroot.sh b/recipes/osx-sysroot/deactivate-sysroot.sh index 6d86fe02597e9..a66ccd205a5a8 100644 --- a/recipes/osx-sysroot/deactivate-sysroot.sh +++ b/recipes/osx-sysroot/deactivate-sysroot.sh @@ -1,6 +1,20 @@ -if [ -z "${CONDA_BACKUP_MACOSX_DEPLOYMENT_TARGET}" ]; then - export MACOSX_DEPLOYMENT_TARGET="${CONDA_BACKUP_MACOSX_DEPLOYMENT_TARGET}" - unset CONDA_BACKUP_MACOSX_DEPLOYMENT_TARGET +if [ -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET}" ]; then + export MACOSX_DEPLOYMENT_TARGET="${CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET}" + unset CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET else unset MACOSX_DEPLOYMENT_TARGET fi + +if [ -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS}" ]; then + export CMAKE_ARGS="${CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS}" + unset CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS +else + unset CMAKE_ARGS +fi + +if [ -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS}" ]; then + export CPPFLAGS="${CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS}" + unset CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS +else + unset CPPFLAGS +fi diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 0c21b55d7c8e8..e0cb40465f379 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -19,7 +19,9 @@ outputs: - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] test: commands: + - "[[ ${MACOSX_SDK_VERSION} == '{{ _MACOSX_SDK_VERSION_ }}' ]]" - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" + - test -d "${SDKROOT}" about: home: https://github.com/conda-forge/osx-sysroot-feedstock summary: package to download MacOSX SDKs @@ -37,11 +39,14 @@ outputs: - __osx >={{ _MACOSX_DEPLOYMENT_TARGET_ }} requirements: run: + # we can use newer SDKs to build for older systems - macosx-sdk >={{ _MACOSX_DEPLOYMENT_TARGET_ }} test: commands: + - "[[ ${MACOSX_SDK_VERSION} == '{{ _MACOSX_SDK_VERSION_ }}' ]]" - "[[ ${MACOSX_DEPLOYMENT_TARGET} == '{{ _MACOSX_DEPLOYMENT_TARGET_ }}' ]]" - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" + - test -d "${SDKROOT}" about: home: https://github.com/conda-forge/osx-sysroot-feedstock summary: metapackage to set the MACOSX_DEPLOYMENT_TARGET From 18a82278c48bc7c2c7f77ca4644e9f2b4cae93b5 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 15:54:27 -0500 Subject: [PATCH 21/47] do not use future sysroots with old sdks --- recipes/osx-sysroot/meta.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index e0cb40465f379..67e4c3d3da88b 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -17,6 +17,11 @@ outputs: # weigh down newer sdks track_features: # [is_default_sdk == "no"] - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] + requirements: + run_constrained: + # we cannot build for the future! + - sysroot_osx-64 <={{ _MACOSX_SDK_VERSION_ }} + - sysroot_osx-arm64 <={{ _MACOSX_SDK_VERSION_ }} test: commands: - "[[ ${MACOSX_SDK_VERSION} == '{{ _MACOSX_SDK_VERSION_ }}' ]]" From 47ec1a72c4e2421bef58b8b66c5df29440146b12 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 16:05:04 -0500 Subject: [PATCH 22/47] ENH enable two defaults with extra feature for 10.x SDKs --- recipes/osx-sysroot/conda_build_config.yaml | 2 +- recipes/osx-sysroot/meta.yaml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index d515cb05270b7..542de2176a513 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -21,7 +21,7 @@ _MACOSX_SDK_VERSION_: is_default_sdk: - "no" - "yes" - - "no" + - "yes" - "no" zip_keys: diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 67e4c3d3da88b..b20b35313cace 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -15,8 +15,9 @@ outputs: build: noarch: generic # weigh down newer sdks - track_features: # [is_default_sdk == "no"] - - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] + track_features: # [is_default_sdk == "no" or _MACOSX_SDK_VERSION_[:2] == "10"] + - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] + - macosx-sdk_intelonly_{{ _MACOSX_SDK_VERSION_ }} # [_MACOSX_SDK_VERSION_[:2] == "10"] requirements: run_constrained: # we cannot build for the future! From 1ebe2a562dc6b23c33285842b1de1b2e9195a8d2 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 16:12:34 -0500 Subject: [PATCH 23/47] maybe this --- recipes/osx-sysroot/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index b20b35313cace..f594ecf5f53b5 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -15,9 +15,9 @@ outputs: build: noarch: generic # weigh down newer sdks - track_features: # [is_default_sdk == "no" or _MACOSX_SDK_VERSION_[:2] == "10"] + track_features: # [is_default_sdk == "no" or _MACOSX_SDK_VERSION_.startswith("10")] - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] - - macosx-sdk_intelonly_{{ _MACOSX_SDK_VERSION_ }} # [_MACOSX_SDK_VERSION_[:2] == "10"] + - macosx-sdk_intelonly_{{ _MACOSX_SDK_VERSION_ }} # [_MACOSX_SDK_VERSION_.startswith("10")] requirements: run_constrained: # we cannot build for the future! From d83f0a59bcecdfdbab86eafd8e3be9f525c2c8ca Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 16:27:46 -0500 Subject: [PATCH 24/47] maybe this --- recipes/osx-sysroot/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index f594ecf5f53b5..6f84c4445a08e 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -15,9 +15,9 @@ outputs: build: noarch: generic # weigh down newer sdks - track_features: # [is_default_sdk == "no" or _MACOSX_SDK_VERSION_.startswith("10")] + track_features: # [is_default_sdk == "no" or os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] - - macosx-sdk_intelonly_{{ _MACOSX_SDK_VERSION_ }} # [_MACOSX_SDK_VERSION_.startswith("10")] + - macosx-sdk_intelonly_{{ _MACOSX_SDK_VERSION_ }} # [os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] requirements: run_constrained: # we cannot build for the future! From 08d41cc1fcbc163a2e62a9160185448e1480ab10 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 16:46:14 -0500 Subject: [PATCH 25/47] BUG use -s --- recipes/osx-sysroot/activate-sdk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/activate-sdk.sh b/recipes/osx-sysroot/activate-sdk.sh index 13e824e1d4413..a3e42ed19cff1 100644 --- a/recipes/osx-sysroot/activate-sdk.sh +++ b/recipes/osx-sysroot/activate-sdk.sh @@ -24,7 +24,7 @@ if [ ! -d "${SDKROOT}" ]; then else url="https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" fi - curl --quiet -L --output "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" "${url}" + curl -s -L --output "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" "${url}" mkdir -p `dirname "$SDKROOT"` tar -xf "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" -C `dirname "$SDKROOT"` fi From 7093e1c5b319b77ee5f7e3ef65e698cc9868f54e Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 18:38:23 -0500 Subject: [PATCH 26/47] bugz --- recipes/osx-sysroot/meta.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 6f84c4445a08e..71dd3e68cdc3c 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -15,9 +15,9 @@ outputs: build: noarch: generic # weigh down newer sdks - track_features: # [is_default_sdk == "no" or os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] + track_features: # [is_default_sdk == "no" or not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] - - macosx-sdk_intelonly_{{ _MACOSX_SDK_VERSION_ }} # [os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] + - macosx-sdk_intelonly_{{ _MACOSX_SDK_VERSION_ }} # [not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] requirements: run_constrained: # we cannot build for the future! @@ -49,7 +49,6 @@ outputs: - macosx-sdk >={{ _MACOSX_DEPLOYMENT_TARGET_ }} test: commands: - - "[[ ${MACOSX_SDK_VERSION} == '{{ _MACOSX_SDK_VERSION_ }}' ]]" - "[[ ${MACOSX_DEPLOYMENT_TARGET} == '{{ _MACOSX_DEPLOYMENT_TARGET_ }}' ]]" - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" - test -d "${SDKROOT}" From e1b15cde13e1d3e6d7dac5e8c3356847a4c8dd03 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 19:35:46 -0500 Subject: [PATCH 27/47] one more --- recipes/osx-sysroot/meta.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 71dd3e68cdc3c..afac2378775fc 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -15,9 +15,10 @@ outputs: build: noarch: generic # weigh down newer sdks - track_features: # [is_default_sdk == "no" or not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] - - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] - - macosx-sdk_intelonly_{{ _MACOSX_SDK_VERSION_ }} # [not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] + track_features: # [is_default_sdk == "no" or not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] + - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] + - macosx-sdk_intelonly1_{{ _MACOSX_SDK_VERSION_ }} # [not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] + - macosx-sdk_intelonly2_{{ _MACOSX_SDK_VERSION_ }} # [not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] requirements: run_constrained: # we cannot build for the future! From 91b80ea2a44e4c71881728c8636c6b87abdac825 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 19:39:41 -0500 Subject: [PATCH 28/47] ENH adjust features again --- recipes/osx-sysroot/meta.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index afac2378775fc..c47ddc4604f92 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -15,10 +15,14 @@ outputs: build: noarch: generic # weigh down newer sdks + # the default osx-64 package has 0 features + # alternatives for osx-64 have 1 feature + # default for osx-arm64 has 2 features + # alternatives for osx-arm64 have 3 features track_features: # [is_default_sdk == "no" or not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] - - macosx-sdk_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] - - macosx-sdk_intelonly1_{{ _MACOSX_SDK_VERSION_ }} # [not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] - - macosx-sdk_intelonly2_{{ _MACOSX_SDK_VERSION_ }} # [not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] + - macosx-sdk_default_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] + - macosx-sdk_arm1_{{ _MACOSX_SDK_VERSION_ }} # [not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] + - macosx-sdk_arm2_{{ _MACOSX_SDK_VERSION_ }} # [not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] requirements: run_constrained: # we cannot build for the future! From ec5b9c69dc73a5ad3d57ff24147b5a2460c0a268 Mon Sep 17 00:00:00 2001 From: beckermr Date: Thu, 24 Aug 2023 20:12:04 -0500 Subject: [PATCH 29/47] fix --- recipes/osx-sysroot/conda_build_config.yaml | 7 +++++++ recipes/osx-sysroot/meta.yaml | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index 542de2176a513..b605d82fa69e8 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -24,6 +24,12 @@ is_default_sdk: - "yes" - "no" +is_arm64: + - "no" + - "no" + - "yes" + - "yes" + zip_keys: - - _MACOSX_DEPLOYMENT_TARGET_ @@ -31,3 +37,4 @@ zip_keys: - - _MACOSX_SDK_VERSION_ - is_default_sdk + - is_arm64 diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index c47ddc4604f92..0899e7e8a9f8a 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -19,10 +19,10 @@ outputs: # alternatives for osx-64 have 1 feature # default for osx-arm64 has 2 features # alternatives for osx-arm64 have 3 features - track_features: # [is_default_sdk == "no" or not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] + track_features: # [is_default_sdk == "no" or is_arm64 == "yes"] - macosx-sdk_default_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] - - macosx-sdk_arm1_{{ _MACOSX_SDK_VERSION_ }} # [not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] - - macosx-sdk_arm2_{{ _MACOSX_SDK_VERSION_ }} # [not os.environ["_MACOSX_SDK_VERSION_"].startswith("10")] + - macosx-sdk_arm1_{{ _MACOSX_SDK_VERSION_ }} # [is_arm64 == "yes"] + - macosx-sdk_arm2_{{ _MACOSX_SDK_VERSION_ }} # [is_arm64 == "yes"] requirements: run_constrained: # we cannot build for the future! From c724c14a713535697326f81a24b83c362b9292d2 Mon Sep 17 00:00:00 2001 From: beckermr Date: Fri, 25 Aug 2023 06:28:30 -0500 Subject: [PATCH 30/47] add system sdk as version 1 --- recipes/osx-sysroot/activate-sdk.sh | 17 +++++++++++------ recipes/osx-sysroot/conda_build_config.yaml | 11 +++++++++++ recipes/osx-sysroot/meta.yaml | 5 ++++- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/recipes/osx-sysroot/activate-sdk.sh b/recipes/osx-sysroot/activate-sdk.sh index a3e42ed19cff1..c0149380c0dc5 100644 --- a/recipes/osx-sysroot/activate-sdk.sh +++ b/recipes/osx-sysroot/activate-sdk.sh @@ -19,14 +19,19 @@ else fi if [ ! -d "${SDKROOT}" ]; then - if [ "${MACOSX_SDK_VERSION}" = "12.3" ]; then - url="https://github.com/alexey-lysiuk/macos-sdk/releases/download/${MACOSX_SDK_VERSION}/MacOSX${MACOSX_SDK_VERSION}.tar.xz" + if [ "${MACOSX_SDK_VERSION}" = "1" ]; then + system_sdk=`xcrun --show-sdk-path` + ln -s "${system_sdk}" "${SDKROOT}" else - url="https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" + if [ "${MACOSX_SDK_VERSION}" = "12.3" ]; then + url="https://github.com/alexey-lysiuk/macos-sdk/releases/download/${MACOSX_SDK_VERSION}/MacOSX${MACOSX_SDK_VERSION}.tar.xz" + else + url="https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" + fi + curl -s -L --output "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" "${url}" + mkdir -p `dirname "${SDKROOT}"` + tar -xf "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" -C `dirname "${SDKROOT}"` fi - curl -s -L --output "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" "${url}" - mkdir -p `dirname "$SDKROOT"` - tar -xf "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" -C `dirname "$SDKROOT"` fi if [ -z "${CMAKE_ARGS}" ]; then diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index b605d82fa69e8..d1b5a5144d77b 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -13,23 +13,33 @@ cross_target_platform: - osx-arm64 _MACOSX_SDK_VERSION_: + - "1" - "10.9" - "10.13" - "11.0" - "12.3" is_default_sdk: + - "no" - "no" - "yes" - "yes" - "no" is_arm64: + - "yes" - "no" - "no" - "yes" - "yes" +is_system_sdk: + - "yes" + - "no" + - "no" + - "no" + - "no" + zip_keys: - - _MACOSX_DEPLOYMENT_TARGET_ @@ -38,3 +48,4 @@ zip_keys: - _MACOSX_SDK_VERSION_ - is_default_sdk - is_arm64 + - is_system_sdk diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 0899e7e8a9f8a..4ae286270df5d 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -19,10 +19,12 @@ outputs: # alternatives for osx-64 have 1 feature # default for osx-arm64 has 2 features # alternatives for osx-arm64 have 3 features + # the system SDK has 4 features track_features: # [is_default_sdk == "no" or is_arm64 == "yes"] - macosx-sdk_default_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] - macosx-sdk_arm1_{{ _MACOSX_SDK_VERSION_ }} # [is_arm64 == "yes"] - macosx-sdk_arm2_{{ _MACOSX_SDK_VERSION_ }} # [is_arm64 == "yes"] + - macosx-sdk_system_{{ _MACOSX_SDK_VERSION_ }} # [is_system_sdk == "yes"] requirements: run_constrained: # we cannot build for the future! @@ -33,6 +35,7 @@ outputs: - "[[ ${MACOSX_SDK_VERSION} == '{{ _MACOSX_SDK_VERSION_ }}' ]]" - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" - test -d "${SDKROOT}" + - test -L "${SDKROOT}" # [is_system_sdk == "yes"] about: home: https://github.com/conda-forge/osx-sysroot-feedstock summary: package to download MacOSX SDKs @@ -51,7 +54,7 @@ outputs: requirements: run: # we can use newer SDKs to build for older systems - - macosx-sdk >={{ _MACOSX_DEPLOYMENT_TARGET_ }} + - macosx-sdk >={{ _MACOSX_DEPLOYMENT_TARGET_ }}|==1 test: commands: - "[[ ${MACOSX_DEPLOYMENT_TARGET} == '{{ _MACOSX_DEPLOYMENT_TARGET_ }}' ]]" From 18e0576cba39932e76efd85d6b4cf5328c625953 Mon Sep 17 00:00:00 2001 From: beckermr Date: Fri, 25 Aug 2023 06:39:45 -0500 Subject: [PATCH 31/47] rename --- .../{activate-sysroot.sh => activate-mdt.sh} | 0 recipes/osx-sysroot/build_mdt.sh | 15 +++++++++++++++ recipes/osx-sysroot/build_sysroot.sh | 15 --------------- .../{deactivate-sysroot.sh => deactivate-mdt.sh} | 0 recipes/osx-sysroot/meta.yaml | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) rename recipes/osx-sysroot/{activate-sysroot.sh => activate-mdt.sh} (100%) create mode 100644 recipes/osx-sysroot/build_mdt.sh delete mode 100644 recipes/osx-sysroot/build_sysroot.sh rename recipes/osx-sysroot/{deactivate-sysroot.sh => deactivate-mdt.sh} (100%) diff --git a/recipes/osx-sysroot/activate-sysroot.sh b/recipes/osx-sysroot/activate-mdt.sh similarity index 100% rename from recipes/osx-sysroot/activate-sysroot.sh rename to recipes/osx-sysroot/activate-mdt.sh diff --git a/recipes/osx-sysroot/build_mdt.sh b/recipes/osx-sysroot/build_mdt.sh new file mode 100644 index 0000000000000..57bf5832bc263 --- /dev/null +++ b/recipes/osx-sysroot/build_mdt.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +find "${RECIPE_DIR}" -name "activate-mdt.sh" -exec cp {} . \; +find "${RECIPE_DIR}" -name "deactivate-mdt.sh" -exec cp {} . \; + +find . -name "activate-mdt.sh" -exec sed -i.bak "s|@MACOSX_DEPLOYMENT_TARGET@|${_MACOSX_DEPLOYMENT_TARGET_}|g" "{}" \; +find . -name "activate-mdt.sh" -exec sed -i.bak "s|@PLATFORM@|${cross_target_platform//-/_}|g" "{}" \; +find . -name "activate-mdt.sh.bak" -exec rm "{}" \; + +find . -name "deactivate-mdt.sh" -exec sed -i.bak "s|@PLATFORM@|${cross_target_platform//-/_}|g" "{}" \; +find . -name "deactivate-mdt.sh.bak" -exec rm "{}" \; + +mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ +cp "${SRC_DIR}"/activate-mdt.sh "${PREFIX}"/etc/conda/activate.d/activate_"${PKG_NAME}".sh +cp "${SRC_DIR}"/deactivate-mdt.sh "${PREFIX}"/etc/conda/deactivate.d/deactivate_"${PKG_NAME}".sh diff --git a/recipes/osx-sysroot/build_sysroot.sh b/recipes/osx-sysroot/build_sysroot.sh deleted file mode 100644 index ef76923468b8d..0000000000000 --- a/recipes/osx-sysroot/build_sysroot.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -find "${RECIPE_DIR}" -name "activate-sysroot.sh" -exec cp {} . \; -find "${RECIPE_DIR}" -name "deactivate-sysroot.sh" -exec cp {} . \; - -find . -name "activate-sysroot.sh" -exec sed -i.bak "s|@MACOSX_DEPLOYMENT_TARGET@|${_MACOSX_DEPLOYMENT_TARGET_}|g" "{}" \; -find . -name "activate-sysroot.sh" -exec sed -i.bak "s|@PLATFORM@|${cross_target_platform//-/_}|g" "{}" \; -find . -name "activate-sysroot.sh.bak" -exec rm "{}" \; - -find . -name "deactivate-sysroot.sh" -exec sed -i.bak "s|@PLATFORM@|${cross_target_platform//-/_}|g" "{}" \; -find . -name "deactivate-sysroot.sh.bak" -exec rm "{}" \; - -mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ -cp "${SRC_DIR}"/activate-sysroot.sh "${PREFIX}"/etc/conda/activate.d/activate_"${PKG_NAME}".sh -cp "${SRC_DIR}"/deactivate-sysroot.sh "${PREFIX}"/etc/conda/deactivate.d/deactivate_"${PKG_NAME}".sh diff --git a/recipes/osx-sysroot/deactivate-sysroot.sh b/recipes/osx-sysroot/deactivate-mdt.sh similarity index 100% rename from recipes/osx-sysroot/deactivate-sysroot.sh rename to recipes/osx-sysroot/deactivate-mdt.sh diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 4ae286270df5d..a985c9237d6b3 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -43,9 +43,9 @@ outputs: license_family: BSD license_file: LICENSE - - name: sysroot_{{ cross_target_platform }} + - name: macosx_deployment_target_{{ cross_target_platform }} version: {{ _MACOSX_DEPLOYMENT_TARGET_ }} - script: build_sysroot.sh + script: build_mdt.sh build: noarch: generic run_exports: From 1dba2250aceb6fea3c1c4b728ecf3f0c46362623 Mon Sep 17 00:00:00 2001 From: beckermr Date: Fri, 25 Aug 2023 06:56:07 -0500 Subject: [PATCH 32/47] bug only run system sdk on osx --- recipes/osx-sysroot/meta.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index a985c9237d6b3..2ec155a3a7945 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -26,6 +26,8 @@ outputs: - macosx-sdk_arm2_{{ _MACOSX_SDK_VERSION_ }} # [is_arm64 == "yes"] - macosx-sdk_system_{{ _MACOSX_SDK_VERSION_ }} # [is_system_sdk == "yes"] requirements: + run: # [is_system_sdk == "yes"] + - __osx # [is_system_sdk == "yes"] run_constrained: # we cannot build for the future! - sysroot_osx-64 <={{ _MACOSX_SDK_VERSION_ }} From cca78f383d6c61a80bb7bf8f909e0166f0460bd0 Mon Sep 17 00:00:00 2001 From: beckermr Date: Fri, 25 Aug 2023 07:18:38 -0500 Subject: [PATCH 33/47] make a dir --- recipes/osx-sysroot/activate-sdk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/osx-sysroot/activate-sdk.sh b/recipes/osx-sysroot/activate-sdk.sh index c0149380c0dc5..067a52953c4f6 100644 --- a/recipes/osx-sysroot/activate-sdk.sh +++ b/recipes/osx-sysroot/activate-sdk.sh @@ -21,6 +21,7 @@ fi if [ ! -d "${SDKROOT}" ]; then if [ "${MACOSX_SDK_VERSION}" = "1" ]; then system_sdk=`xcrun --show-sdk-path` + mkdir -p `dirname "${SDKROOT}"` ln -s "${system_sdk}" "${SDKROOT}" else if [ "${MACOSX_SDK_VERSION}" = "12.3" ]; then From 8870a63ba7d4923f360044746ae6114f983d3c66 Mon Sep 17 00:00:00 2001 From: beckermr Date: Fri, 25 Aug 2023 07:45:33 -0500 Subject: [PATCH 34/47] debug symlink --- recipes/osx-sysroot/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 2ec155a3a7945..7ed9d783862fa 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -34,6 +34,7 @@ outputs: - sysroot_osx-arm64 <={{ _MACOSX_SDK_VERSION_ }} test: commands: + - ls -lah ${MACOSX_SDK_CACHE_DIR} - "[[ ${MACOSX_SDK_VERSION} == '{{ _MACOSX_SDK_VERSION_ }}' ]]" - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" - test -d "${SDKROOT}" From af5f7e57d0fbcd213381e0a4cc1b8a89a4a30717 Mon Sep 17 00:00:00 2001 From: beckermr Date: Fri, 25 Aug 2023 08:05:07 -0500 Subject: [PATCH 35/47] fixed the bugz --- recipes/osx-sysroot/activate-sdk.sh | 4 +--- recipes/osx-sysroot/meta.yaml | 4 ---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/recipes/osx-sysroot/activate-sdk.sh b/recipes/osx-sysroot/activate-sdk.sh index 067a52953c4f6..4f927035e421b 100644 --- a/recipes/osx-sysroot/activate-sdk.sh +++ b/recipes/osx-sysroot/activate-sdk.sh @@ -20,9 +20,7 @@ fi if [ ! -d "${SDKROOT}" ]; then if [ "${MACOSX_SDK_VERSION}" = "1" ]; then - system_sdk=`xcrun --show-sdk-path` - mkdir -p `dirname "${SDKROOT}"` - ln -s "${system_sdk}" "${SDKROOT}" + export SDKROOT=`xcrun --show-sdk-path` else if [ "${MACOSX_SDK_VERSION}" = "12.3" ]; then url="https://github.com/alexey-lysiuk/macos-sdk/releases/download/${MACOSX_SDK_VERSION}/MacOSX${MACOSX_SDK_VERSION}.tar.xz" diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 7ed9d783862fa..491b4c2f88f29 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -34,11 +34,8 @@ outputs: - sysroot_osx-arm64 <={{ _MACOSX_SDK_VERSION_ }} test: commands: - - ls -lah ${MACOSX_SDK_CACHE_DIR} - "[[ ${MACOSX_SDK_VERSION} == '{{ _MACOSX_SDK_VERSION_ }}' ]]" - - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" - test -d "${SDKROOT}" - - test -L "${SDKROOT}" # [is_system_sdk == "yes"] about: home: https://github.com/conda-forge/osx-sysroot-feedstock summary: package to download MacOSX SDKs @@ -61,7 +58,6 @@ outputs: test: commands: - "[[ ${MACOSX_DEPLOYMENT_TARGET} == '{{ _MACOSX_DEPLOYMENT_TARGET_ }}' ]]" - - test -d "${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" - test -d "${SDKROOT}" about: home: https://github.com/conda-forge/osx-sysroot-feedstock From e82d63b4e4f1db4e0fd47d1d541254a58f3d5cb0 Mon Sep 17 00:00:00 2001 From: beckermr Date: Fri, 25 Aug 2023 08:38:45 -0500 Subject: [PATCH 36/47] i think I got it --- recipes/osx-sysroot/activate-sdk.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/osx-sysroot/activate-sdk.sh b/recipes/osx-sysroot/activate-sdk.sh index 4f927035e421b..1dc711746825e 100644 --- a/recipes/osx-sysroot/activate-sdk.sh +++ b/recipes/osx-sysroot/activate-sdk.sh @@ -20,6 +20,7 @@ fi if [ ! -d "${SDKROOT}" ]; then if [ "${MACOSX_SDK_VERSION}" = "1" ]; then + unset SDKROOT export SDKROOT=`xcrun --show-sdk-path` else if [ "${MACOSX_SDK_VERSION}" = "12.3" ]; then From a4a497fe1f221657ff12d0f9318ebc132515bb94 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Sun, 27 Aug 2023 07:26:54 -0500 Subject: [PATCH 37/47] Update recipes/osx-sysroot/meta.yaml --- recipes/osx-sysroot/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 491b4c2f88f29..8e69a93f5f70c 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -20,7 +20,7 @@ outputs: # default for osx-arm64 has 2 features # alternatives for osx-arm64 have 3 features # the system SDK has 4 features - track_features: # [is_default_sdk == "no" or is_arm64 == "yes"] + track_features: # [is_default_sdk == "no" or is_arm64 == "yes" or is_system_sdk == "yes"] - macosx-sdk_default_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] - macosx-sdk_arm1_{{ _MACOSX_SDK_VERSION_ }} # [is_arm64 == "yes"] - macosx-sdk_arm2_{{ _MACOSX_SDK_VERSION_ }} # [is_arm64 == "yes"] From 9cd57c501e2f769f0d42e8549106a0205539f4fa Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Sun, 27 Aug 2023 07:27:36 -0500 Subject: [PATCH 38/47] Update recipes/osx-sysroot/meta.yaml --- recipes/osx-sysroot/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 8e69a93f5f70c..f30ffbc6fd573 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -30,8 +30,8 @@ outputs: - __osx # [is_system_sdk == "yes"] run_constrained: # we cannot build for the future! - - sysroot_osx-64 <={{ _MACOSX_SDK_VERSION_ }} - - sysroot_osx-arm64 <={{ _MACOSX_SDK_VERSION_ }} + - macosx_deployment_target_osx-64 <={{ _MACOSX_SDK_VERSION_ }} + - macosx_deployment_target_osx-arm64 <={{ _MACOSX_SDK_VERSION_ }} test: commands: - "[[ ${MACOSX_SDK_VERSION} == '{{ _MACOSX_SDK_VERSION_ }}' ]]" From e0b46e31bea1415aa0d884a4c516c7367c0e5384 Mon Sep 17 00:00:00 2001 From: beckermr Date: Sun, 27 Aug 2023 21:40:07 -0500 Subject: [PATCH 39/47] REF try this version --- recipes/osx-sysroot/activate-mdt.sh | 25 ++++++++++ recipes/osx-sysroot/activate-sdk.sh | 51 --------------------- recipes/osx-sysroot/build_sdk.sh | 11 ----- recipes/osx-sysroot/conda_build_config.yaml | 42 ----------------- recipes/osx-sysroot/deactivate-sdk.sh | 35 -------------- recipes/osx-sysroot/meta.yaml | 50 ++------------------ 6 files changed, 29 insertions(+), 185 deletions(-) delete mode 100644 recipes/osx-sysroot/activate-sdk.sh delete mode 100644 recipes/osx-sysroot/build_sdk.sh delete mode 100644 recipes/osx-sysroot/deactivate-sdk.sh diff --git a/recipes/osx-sysroot/activate-mdt.sh b/recipes/osx-sysroot/activate-mdt.sh index 78ccfec00a499..074c5077777a1 100644 --- a/recipes/osx-sysroot/activate-mdt.sh +++ b/recipes/osx-sysroot/activate-mdt.sh @@ -18,3 +18,28 @@ else export CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS="${CPPFLAGS}" export CPPFLAGS="${CPPFLAGS} -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" fi + +if [ ! -z "$MACOSX_SDK_VERSION" ]; then + sdk_parts=${MACOSX_SDK_VERSION//./' '} + sdk_parts=($sdk_parts) + mdt_parts=${MACOSX_DEPLOYMENT_TARGET//./' '} + mdt_parts=($mdt_parts) + + error_out=0 + if [ ${sdk_parts[0]} -lt ${mdt_parts[0]} ]; then + error_out=1 + elif [ ${sdk_parts[0]} -eq ${mdt_parts[0]} ]; then + if [ ${sdk_parts[1]} -lt ${mdt_parts[1]} ]; then + error_out=1 + elif [ ${sdk_parts[1]} -eq ${mdt_parts[1]} ]; then + if [ ${sdk_parts[2]} -lt ${mdt_parts[2]} ]; then + error_out=1 + fi + fi + fi + + if [ $error_out -eq 1 ]; then + echo "ERROR: MACOSX_SDK_VERSION (${MACOSX_SDK_VERSION}) must be greater than or equal to MACOSX_DEPLOYMENT_TARGET (${MACOSX_DEPLOYMENT_TARGET})" + exit 1 + fi +fi diff --git a/recipes/osx-sysroot/activate-sdk.sh b/recipes/osx-sysroot/activate-sdk.sh deleted file mode 100644 index 1dc711746825e..0000000000000 --- a/recipes/osx-sysroot/activate-sdk.sh +++ /dev/null @@ -1,51 +0,0 @@ -if [ -z "$MACOSX_SDK_VERSION" ]; then - export MACOSX_SDK_VERSION="@MACOSX_SDK_VERSION@" -else - export CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_VERSION="${MACOSX_SDK_VERSION}" - export MACOSX_SDK_VERSION="@MACOSX_SDK_VERSION@" -fi - -if [ -z "$MACOSX_SDK_CACHE_DIR" ]; then - export MACOSX_SDK_CACHE_DIR="${PREFIX}/MacOSX_SDKs" -else - export CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_CACHE_DIR="${MACOSX_SDK_CACHE_DIR}" -fi - -if [ -z "$SDKROOT" ]; then - export SDKROOT="${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" -else - export CONDA_MACOSX_SDK_BACKUP_SDKROOT="${SDKROOT}" - export SDKROOT="${MACOSX_SDK_CACHE_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" -fi - -if [ ! -d "${SDKROOT}" ]; then - if [ "${MACOSX_SDK_VERSION}" = "1" ]; then - unset SDKROOT - export SDKROOT=`xcrun --show-sdk-path` - else - if [ "${MACOSX_SDK_VERSION}" = "12.3" ]; then - url="https://github.com/alexey-lysiuk/macos-sdk/releases/download/${MACOSX_SDK_VERSION}/MacOSX${MACOSX_SDK_VERSION}.tar.xz" - else - url="https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" - fi - curl -s -L --output "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" "${url}" - mkdir -p `dirname "${SDKROOT}"` - tar -xf "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" -C `dirname "${SDKROOT}"` - fi -fi - -if [ -z "${CMAKE_ARGS}" ]; then - export CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT=${SDKROOT}" -else - export CONDA_MACOSX_SDK_BACKUP_CMAKE_ARGS="${CMAKE_ARGS}" - export CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT=${SDKROOT}" -fi - -if [ "${CONDA_BUILD:-0}" = "1" ]; then - if [ -z "$CONDA_BUILD_SYSROOT" ]; then - export CONDA_BUILD_SYSROOT="${SDKROOT}" - else - export CONDA_MACOSX_SDK_BACKUP_CONDA_BUILD_SYSROOT="${CONDA_BUILD_SYSROOT}" - export CONDA_BUILD_SYSROOT="${SDKROOT}" - fi -fi diff --git a/recipes/osx-sysroot/build_sdk.sh b/recipes/osx-sysroot/build_sdk.sh deleted file mode 100644 index f148abd638104..0000000000000 --- a/recipes/osx-sysroot/build_sdk.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -find "${RECIPE_DIR}" -name "activate-sdk.sh" -exec cp {} . \; -find "${RECIPE_DIR}" -name "deactivate-sdk.sh" -exec cp {} . \; - -find . -name "activate-sdk.sh" -exec sed -i.bak "s|@MACOSX_SDK_VERSION@|${_MACOSX_SDK_VERSION_}|g" "{}" \; -find . -name "activate-sdk.sh.bak" -exec rm "{}" \; - -mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ -cp "${SRC_DIR}"/activate-sdk.sh "${PREFIX}"/etc/conda/activate.d/activate_"${PKG_NAME}".sh -cp "${SRC_DIR}"/deactivate-sdk.sh "${PREFIX}"/etc/conda/deactivate.d/deactivate_"${PKG_NAME}".sh diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index d1b5a5144d77b..b277b71640f23 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -2,50 +2,8 @@ _MACOSX_DEPLOYMENT_TARGET_: - "10.9" - "10.13" - "11.0" - - "11.0" - "12.3" cross_target_platform: - osx-64 - - osx-64 - - osx-64 - - osx-arm64 - osx-arm64 - -_MACOSX_SDK_VERSION_: - - "1" - - "10.9" - - "10.13" - - "11.0" - - "12.3" - -is_default_sdk: - - "no" - - "no" - - "yes" - - "yes" - - "no" - -is_arm64: - - "yes" - - "no" - - "no" - - "yes" - - "yes" - -is_system_sdk: - - "yes" - - "no" - - "no" - - "no" - - "no" - -zip_keys: - - - - _MACOSX_DEPLOYMENT_TARGET_ - - cross_target_platform - - - - _MACOSX_SDK_VERSION_ - - is_default_sdk - - is_arm64 - - is_system_sdk diff --git a/recipes/osx-sysroot/deactivate-sdk.sh b/recipes/osx-sysroot/deactivate-sdk.sh deleted file mode 100644 index ab7316f2ef830..0000000000000 --- a/recipes/osx-sysroot/deactivate-sdk.sh +++ /dev/null @@ -1,35 +0,0 @@ -if [ -z "${CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_VERSION}" ]; then - export MACOSX_SDK_VERSION="${CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_VERSION}" - unset CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_VERSION -else - unset MACOSX_SDK_VERSION -fi - -if [ -z "${CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_CACHE_DIR}" ]; then - # we didn't override this so no need to reset - # backup var is here to indicate to not unset - unset CONDA_MACOSX_SDK_BACKUP_MACOSX_SDK_CACHE_DIR -else - unset MACOSX_SDK_CACHE_DIR -fi - -if [ -z "${CONDA_MACOSX_SDK_BACKUP_CONDA_BUILD_SYSROOT}" ]; then - export CONDA_BUILD_SYSROOT="${CONDA_MACOSX_SDK_BACKUP_CONDA_BUILD_SYSROOT}" - unset CONDA_MACOSX_SDK_BACKUP_CONDA_BUILD_SYSROOT -else - unset CONDA_BUILD_SYSROOT -fi - -if [ -z "${CONDA_MACOSX_SDK_BACKUP_SDKROOT}" ]; then - export SDKROOT="${CONDA_MACOSX_SDK_BACKUP_SDKROOT}" - unset CONDA_MACOSX_SDK_BACKUP_SDKROOT -else - unset SDKROOT -fi - -if [ -z "${CONDA_MACOSX_SDK_BACKUP_CMAKE_ARGS}" ]; then - export CMAKE_ARGS="${CONDA_MACOSX_SDK_BACKUP_CMAKE_ARGS}" - unset CONDA_MACOSX_SDK_BACKUP_CMAKE_ARGS -else - unset CMAKE_ARGS -fi diff --git a/recipes/osx-sysroot/meta.yaml b/recipes/osx-sysroot/meta.yaml index 491b4c2f88f29..d232df2879747 100644 --- a/recipes/osx-sysroot/meta.yaml +++ b/recipes/osx-sysroot/meta.yaml @@ -7,42 +7,11 @@ package: build: number: 0 + {% if cross_target_platform == "osx-arm64" and _MACOSX_DEPLOYMENT_TARGET_[0:2]|int < 11 %} + skip: True + {% endif %} outputs: - - name: macosx-sdk - version: {{ _MACOSX_SDK_VERSION_ }} - script: build_sdk.sh - build: - noarch: generic - # weigh down newer sdks - # the default osx-64 package has 0 features - # alternatives for osx-64 have 1 feature - # default for osx-arm64 has 2 features - # alternatives for osx-arm64 have 3 features - # the system SDK has 4 features - track_features: # [is_default_sdk == "no" or is_arm64 == "yes"] - - macosx-sdk_default_{{ _MACOSX_SDK_VERSION_ }} # [is_default_sdk == "no"] - - macosx-sdk_arm1_{{ _MACOSX_SDK_VERSION_ }} # [is_arm64 == "yes"] - - macosx-sdk_arm2_{{ _MACOSX_SDK_VERSION_ }} # [is_arm64 == "yes"] - - macosx-sdk_system_{{ _MACOSX_SDK_VERSION_ }} # [is_system_sdk == "yes"] - requirements: - run: # [is_system_sdk == "yes"] - - __osx # [is_system_sdk == "yes"] - run_constrained: - # we cannot build for the future! - - sysroot_osx-64 <={{ _MACOSX_SDK_VERSION_ }} - - sysroot_osx-arm64 <={{ _MACOSX_SDK_VERSION_ }} - test: - commands: - - "[[ ${MACOSX_SDK_VERSION} == '{{ _MACOSX_SDK_VERSION_ }}' ]]" - - test -d "${SDKROOT}" - about: - home: https://github.com/conda-forge/osx-sysroot-feedstock - summary: package to download MacOSX SDKs - license: BSD-3-Clause - license_family: BSD - license_file: LICENSE - - name: macosx_deployment_target_{{ cross_target_platform }} version: {{ _MACOSX_DEPLOYMENT_TARGET_ }} script: build_mdt.sh @@ -51,24 +20,13 @@ outputs: run_exports: strong: - __osx >={{ _MACOSX_DEPLOYMENT_TARGET_ }} - requirements: - run: - # we can use newer SDKs to build for older systems - - macosx-sdk >={{ _MACOSX_DEPLOYMENT_TARGET_ }}|==1 test: commands: - "[[ ${MACOSX_DEPLOYMENT_TARGET} == '{{ _MACOSX_DEPLOYMENT_TARGET_ }}' ]]" - - test -d "${SDKROOT}" - about: - home: https://github.com/conda-forge/osx-sysroot-feedstock - summary: metapackage to set the MACOSX_DEPLOYMENT_TARGET - license: BSD-3-Clause - license_family: BSD - license_file: LICENSE about: home: https://github.com/conda-forge/osx-sysroot-feedstock - summary: packages to download MacOSX SDKs and set MACOSX_DEPLOYMENT_TARGET + summary: metapackage to set the MACOSX_DEPLOYMENT_TARGET license: BSD-3-Clause license_family: BSD license_file: LICENSE From 3f34a3041a01941c03e90920218db405158a06bb Mon Sep 17 00:00:00 2001 From: beckermr Date: Sun, 27 Aug 2023 21:45:55 -0500 Subject: [PATCH 40/47] better error message --- recipes/osx-sysroot/activate-mdt.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/activate-mdt.sh b/recipes/osx-sysroot/activate-mdt.sh index 074c5077777a1..1370a5b83e03b 100644 --- a/recipes/osx-sysroot/activate-mdt.sh +++ b/recipes/osx-sysroot/activate-mdt.sh @@ -39,7 +39,9 @@ if [ ! -z "$MACOSX_SDK_VERSION" ]; then fi if [ $error_out -eq 1 ]; then - echo "ERROR: MACOSX_SDK_VERSION (${MACOSX_SDK_VERSION}) must be greater than or equal to MACOSX_DEPLOYMENT_TARGET (${MACOSX_DEPLOYMENT_TARGET})" + echo "ERROR: MACOSX_DEPLOYMENT_TARGET (${MACOSX_DEPLOYMENT_TARGET}) \ + must be less than or equal to MACOSX_SDK_VERSION (${MACOSX_SDK_VERSION}). Set the MACOSX_SDK_VERSION in the \ + conda_build_config.yaml file to a version greater than or equal to the MACOSX_DEPLOYMENT_TARGET." exit 1 fi fi From 39957fa3b2444c34e966344eaef0b74be2982ed1 Mon Sep 17 00:00:00 2001 From: beckermr Date: Sun, 27 Aug 2023 21:49:01 -0500 Subject: [PATCH 41/47] try this --- recipes/osx-sysroot/activate-mdt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/activate-mdt.sh b/recipes/osx-sysroot/activate-mdt.sh index 1370a5b83e03b..d118dcf87bb6d 100644 --- a/recipes/osx-sysroot/activate-mdt.sh +++ b/recipes/osx-sysroot/activate-mdt.sh @@ -40,7 +40,7 @@ if [ ! -z "$MACOSX_SDK_VERSION" ]; then if [ $error_out -eq 1 ]; then echo "ERROR: MACOSX_DEPLOYMENT_TARGET (${MACOSX_DEPLOYMENT_TARGET}) \ - must be less than or equal to MACOSX_SDK_VERSION (${MACOSX_SDK_VERSION}). Set the MACOSX_SDK_VERSION in the \ + must be less than or equal to MacOS SDK version (${MACOSX_SDK_VERSION}). Set MACOSX_SDK_VERSION in the \ conda_build_config.yaml file to a version greater than or equal to the MACOSX_DEPLOYMENT_TARGET." exit 1 fi From b5768cc628de42e818356f6b9c2f0d502b354947 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 28 Aug 2023 05:26:44 -0500 Subject: [PATCH 42/47] add sdk versions and fix a bug --- recipes/osx-sysroot/activate-mdt.sh | 24 +++++++++++++++------ recipes/osx-sysroot/conda_build_config.yaml | 13 +++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/recipes/osx-sysroot/activate-mdt.sh b/recipes/osx-sysroot/activate-mdt.sh index d118dcf87bb6d..690f00ce45dec 100644 --- a/recipes/osx-sysroot/activate-mdt.sh +++ b/recipes/osx-sysroot/activate-mdt.sh @@ -19,11 +19,23 @@ else export CPPFLAGS="${CPPFLAGS} -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" fi +if [ -z "${MACOSX_SDK_VERSION}" ] && [ $(uname) == "Darwin" ]; then + MACOSX_SDK_VERSION=$(xcrun --sdk macosx --show-sdk-version) +fi + if [ ! -z "$MACOSX_SDK_VERSION" ]; then - sdk_parts=${MACOSX_SDK_VERSION//./' '} - sdk_parts=($sdk_parts) - mdt_parts=${MACOSX_DEPLOYMENT_TARGET//./' '} - mdt_parts=($mdt_parts) + sdk_parts=(${MACOSX_SDK_VERSION//'.'/' '}) + mdt_parts=(${MACOSX_DEPLOYMENT_TARGET//'.'/' '}) + + num_sdk_parts=${#sdk_parts[@]} + num_mdt_parts=${#mdt_parts[@]} + + for ((i=$num_sdk_parts; i<3; i++)); do + sdk_parts[i]=0 + done + for ((i=$num_mdt_parts; i<3; i++)); do + mdt_parts[i]=0 + done error_out=0 if [ ${sdk_parts[0]} -lt ${mdt_parts[0]} ]; then @@ -40,8 +52,8 @@ if [ ! -z "$MACOSX_SDK_VERSION" ]; then if [ $error_out -eq 1 ]; then echo "ERROR: MACOSX_DEPLOYMENT_TARGET (${MACOSX_DEPLOYMENT_TARGET}) \ - must be less than or equal to MacOS SDK version (${MACOSX_SDK_VERSION}). Set MACOSX_SDK_VERSION in the \ - conda_build_config.yaml file to a version greater than or equal to the MACOSX_DEPLOYMENT_TARGET." + must be less than or equal to the MacOS SDK version (${MACOSX_SDK_VERSION}). Set MACOSX_SDK_VERSION in the \ + conda_build_config.yaml file of your recipe to a version greater than or equal to the MACOSX_DEPLOYMENT_TARGET." exit 1 fi fi diff --git a/recipes/osx-sysroot/conda_build_config.yaml b/recipes/osx-sysroot/conda_build_config.yaml index b277b71640f23..961c4975e1bd4 100644 --- a/recipes/osx-sysroot/conda_build_config.yaml +++ b/recipes/osx-sysroot/conda_build_config.yaml @@ -1,8 +1,21 @@ _MACOSX_DEPLOYMENT_TARGET_: - "10.9" + - "10.10" + - "10.11" + - "10.12" - "10.13" + - "10.13" + - "10.14" + - "10.15" - "11.0" + - "11.1" + - "11.3" + - "12.0" + - "12.1" - "12.3" + - "13.0" + - "13.1" + - "13.3" cross_target_platform: - osx-64 From 61540ad130be36520874197df46a173817a863d8 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 28 Aug 2023 05:28:08 -0500 Subject: [PATCH 43/47] comments --- recipes/osx-sysroot/activate-mdt.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/osx-sysroot/activate-mdt.sh b/recipes/osx-sysroot/activate-mdt.sh index 690f00ce45dec..37e5a8bdcea0b 100644 --- a/recipes/osx-sysroot/activate-mdt.sh +++ b/recipes/osx-sysroot/activate-mdt.sh @@ -24,12 +24,13 @@ if [ -z "${MACOSX_SDK_VERSION}" ] && [ $(uname) == "Darwin" ]; then fi if [ ! -z "$MACOSX_SDK_VERSION" ]; then + # read version into array (default syntax uses space separation, so just replace the dots) sdk_parts=(${MACOSX_SDK_VERSION//'.'/' '}) mdt_parts=(${MACOSX_DEPLOYMENT_TARGET//'.'/' '}) + # pad out to three elements with zeros num_sdk_parts=${#sdk_parts[@]} num_mdt_parts=${#mdt_parts[@]} - for ((i=$num_sdk_parts; i<3; i++)); do sdk_parts[i]=0 done @@ -37,6 +38,7 @@ if [ ! -z "$MACOSX_SDK_VERSION" ]; then mdt_parts[i]=0 done + # compare element by element error_out=0 if [ ${sdk_parts[0]} -lt ${mdt_parts[0]} ]; then error_out=1 From 38e4b1318d2a857ca78ee1a5b4ab384c5e3741de Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 28 Aug 2023 05:32:58 -0500 Subject: [PATCH 44/47] bug in deactivate --- recipes/osx-sysroot/deactivate-mdt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/osx-sysroot/deactivate-mdt.sh b/recipes/osx-sysroot/deactivate-mdt.sh index a66ccd205a5a8..e5a230bebc5d1 100644 --- a/recipes/osx-sysroot/deactivate-mdt.sh +++ b/recipes/osx-sysroot/deactivate-mdt.sh @@ -1,18 +1,18 @@ -if [ -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET}" ]; then +if [ ! -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET}" ]; then export MACOSX_DEPLOYMENT_TARGET="${CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET}" unset CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET else unset MACOSX_DEPLOYMENT_TARGET fi -if [ -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS}" ]; then +if [ ! -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS}" ]; then export CMAKE_ARGS="${CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS}" unset CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS else unset CMAKE_ARGS fi -if [ -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS}" ]; then +if [ ! -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS}" ]; then export CPPFLAGS="${CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS}" unset CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS else From 0804eff91fda7ef3ded95b92bf79084d76710047 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 28 Aug 2023 05:38:01 -0500 Subject: [PATCH 45/47] spacing --- recipes/osx-sysroot/activate-mdt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/osx-sysroot/activate-mdt.sh b/recipes/osx-sysroot/activate-mdt.sh index 37e5a8bdcea0b..885fb3f12e268 100644 --- a/recipes/osx-sysroot/activate-mdt.sh +++ b/recipes/osx-sysroot/activate-mdt.sh @@ -54,8 +54,8 @@ if [ ! -z "$MACOSX_SDK_VERSION" ]; then if [ $error_out -eq 1 ]; then echo "ERROR: MACOSX_DEPLOYMENT_TARGET (${MACOSX_DEPLOYMENT_TARGET}) \ - must be less than or equal to the MacOS SDK version (${MACOSX_SDK_VERSION}). Set MACOSX_SDK_VERSION in the \ - conda_build_config.yaml file of your recipe to a version greater than or equal to the MACOSX_DEPLOYMENT_TARGET." +must be less than or equal to the MacOS SDK version (${MACOSX_SDK_VERSION}). Set MACOSX_SDK_VERSION in the \ +conda_build_config.yaml file of your recipe to a version greater than or equal to the MACOSX_DEPLOYMENT_TARGET." exit 1 fi fi From e419165e42bdb08a026b3ae29d0a8189ed052393 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 28 Aug 2023 07:16:55 -0500 Subject: [PATCH 46/47] BUG make sure works for bash and zsh --- recipes/osx-sysroot/activate-mdt.sh | 86 +++++++++++++++-------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/recipes/osx-sysroot/activate-mdt.sh b/recipes/osx-sysroot/activate-mdt.sh index 885fb3f12e268..6335c2726e89a 100644 --- a/recipes/osx-sysroot/activate-mdt.sh +++ b/recipes/osx-sysroot/activate-mdt.sh @@ -1,3 +1,48 @@ +LOCAL_MACOSX_DEPLOYMENT_TARGET="@MACOSX_DEPLOYMENT_TARGET@" + +if [ -z "${MACOSX_SDK_VERSION}" ] && [ $(uname) = "Darwin" ]; then + MACOSX_SDK_VERSION=$(xcrun --sdk macosx --show-sdk-version) +fi + +if [ ! -z "$MACOSX_SDK_VERSION" ]; then + # read version into array (default syntax uses space separation, so just replace the dots) + # this works across zsh, sh and bash + sdk_parts=($(sh -c "var=$MACOSX_SDK_VERSION; echo \${var//'.'/' '}")) + mdt_parts=($(sh -c "var=$LOCAL_MACOSX_DEPLOYMENT_TARGET; echo \${var//'.'/' '}")) + + # zsh starts indexes at 1 and bash at 0 + # however both languages return an empty string for indexes out of range + # so we loop over all of 0 1 2 3 and compare missing things as equal + error_out=0 + for (( i=0; i<=3; ++i )); do + if [ "${sdk_parts[$i]}" = "" ]; then + sdk_part=0 + else + sdk_part=${sdk_parts[$i]} + fi + + if [ "${mdt_parts[$i]}" = "" ]; then + mdt_part=0 + else + mdt_part=${mdt_parts[$i]} + fi + + if [ $sdk_part -lt $mdt_part ]; then + error_out=1 + break + elif [ $sdk_part -gt $mdt_part ]; then + break + fi + done + + if [ $error_out -eq 1 ]; then + echo "ERROR: MACOSX_DEPLOYMENT_TARGET (${LOCAL_MACOSX_DEPLOYMENT_TARGET}) \ +must be less than or equal to the MacOS SDK version (${MACOSX_SDK_VERSION}). Set MACOSX_SDK_VERSION in the \ +conda_build_config.yaml file of your recipe to a version greater than or equal to the MACOSX_DEPLOYMENT_TARGET." + exit 1 + fi +fi + if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]; then export MACOSX_DEPLOYMENT_TARGET="@MACOSX_DEPLOYMENT_TARGET@" else @@ -18,44 +63,3 @@ else export CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS="${CPPFLAGS}" export CPPFLAGS="${CPPFLAGS} -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" fi - -if [ -z "${MACOSX_SDK_VERSION}" ] && [ $(uname) == "Darwin" ]; then - MACOSX_SDK_VERSION=$(xcrun --sdk macosx --show-sdk-version) -fi - -if [ ! -z "$MACOSX_SDK_VERSION" ]; then - # read version into array (default syntax uses space separation, so just replace the dots) - sdk_parts=(${MACOSX_SDK_VERSION//'.'/' '}) - mdt_parts=(${MACOSX_DEPLOYMENT_TARGET//'.'/' '}) - - # pad out to three elements with zeros - num_sdk_parts=${#sdk_parts[@]} - num_mdt_parts=${#mdt_parts[@]} - for ((i=$num_sdk_parts; i<3; i++)); do - sdk_parts[i]=0 - done - for ((i=$num_mdt_parts; i<3; i++)); do - mdt_parts[i]=0 - done - - # compare element by element - error_out=0 - if [ ${sdk_parts[0]} -lt ${mdt_parts[0]} ]; then - error_out=1 - elif [ ${sdk_parts[0]} -eq ${mdt_parts[0]} ]; then - if [ ${sdk_parts[1]} -lt ${mdt_parts[1]} ]; then - error_out=1 - elif [ ${sdk_parts[1]} -eq ${mdt_parts[1]} ]; then - if [ ${sdk_parts[2]} -lt ${mdt_parts[2]} ]; then - error_out=1 - fi - fi - fi - - if [ $error_out -eq 1 ]; then - echo "ERROR: MACOSX_DEPLOYMENT_TARGET (${MACOSX_DEPLOYMENT_TARGET}) \ -must be less than or equal to the MacOS SDK version (${MACOSX_SDK_VERSION}). Set MACOSX_SDK_VERSION in the \ -conda_build_config.yaml file of your recipe to a version greater than or equal to the MACOSX_DEPLOYMENT_TARGET." - exit 1 - fi -fi From 4b8567a3b3f7301bc0ea93f8af7d92d95efc344e Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 28 Aug 2023 12:37:06 -0500 Subject: [PATCH 47/47] ENH respond to code review --- recipes/osx-sysroot/activate-mdt.sh | 45 --------------------------- recipes/osx-sysroot/deactivate-mdt.sh | 6 ++-- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/recipes/osx-sysroot/activate-mdt.sh b/recipes/osx-sysroot/activate-mdt.sh index 6335c2726e89a..78ccfec00a499 100644 --- a/recipes/osx-sysroot/activate-mdt.sh +++ b/recipes/osx-sysroot/activate-mdt.sh @@ -1,48 +1,3 @@ -LOCAL_MACOSX_DEPLOYMENT_TARGET="@MACOSX_DEPLOYMENT_TARGET@" - -if [ -z "${MACOSX_SDK_VERSION}" ] && [ $(uname) = "Darwin" ]; then - MACOSX_SDK_VERSION=$(xcrun --sdk macosx --show-sdk-version) -fi - -if [ ! -z "$MACOSX_SDK_VERSION" ]; then - # read version into array (default syntax uses space separation, so just replace the dots) - # this works across zsh, sh and bash - sdk_parts=($(sh -c "var=$MACOSX_SDK_VERSION; echo \${var//'.'/' '}")) - mdt_parts=($(sh -c "var=$LOCAL_MACOSX_DEPLOYMENT_TARGET; echo \${var//'.'/' '}")) - - # zsh starts indexes at 1 and bash at 0 - # however both languages return an empty string for indexes out of range - # so we loop over all of 0 1 2 3 and compare missing things as equal - error_out=0 - for (( i=0; i<=3; ++i )); do - if [ "${sdk_parts[$i]}" = "" ]; then - sdk_part=0 - else - sdk_part=${sdk_parts[$i]} - fi - - if [ "${mdt_parts[$i]}" = "" ]; then - mdt_part=0 - else - mdt_part=${mdt_parts[$i]} - fi - - if [ $sdk_part -lt $mdt_part ]; then - error_out=1 - break - elif [ $sdk_part -gt $mdt_part ]; then - break - fi - done - - if [ $error_out -eq 1 ]; then - echo "ERROR: MACOSX_DEPLOYMENT_TARGET (${LOCAL_MACOSX_DEPLOYMENT_TARGET}) \ -must be less than or equal to the MacOS SDK version (${MACOSX_SDK_VERSION}). Set MACOSX_SDK_VERSION in the \ -conda_build_config.yaml file of your recipe to a version greater than or equal to the MACOSX_DEPLOYMENT_TARGET." - exit 1 - fi -fi - if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]; then export MACOSX_DEPLOYMENT_TARGET="@MACOSX_DEPLOYMENT_TARGET@" else diff --git a/recipes/osx-sysroot/deactivate-mdt.sh b/recipes/osx-sysroot/deactivate-mdt.sh index e5a230bebc5d1..93c1277383066 100644 --- a/recipes/osx-sysroot/deactivate-mdt.sh +++ b/recipes/osx-sysroot/deactivate-mdt.sh @@ -1,18 +1,18 @@ -if [ ! -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET}" ]; then +if [ -n "${CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET}" ]; then export MACOSX_DEPLOYMENT_TARGET="${CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET}" unset CONDA_SYSROOT_@PLATFORM@_BACKUP_MACOSX_DEPLOYMENT_TARGET else unset MACOSX_DEPLOYMENT_TARGET fi -if [ ! -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS}" ]; then +if [ -n "${CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS}" ]; then export CMAKE_ARGS="${CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS}" unset CONDA_SYSROOT_@PLATFORM@_BACKUP_CMAKE_ARGS else unset CMAKE_ARGS fi -if [ ! -z "${CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS}" ]; then +if [ -n "${CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS}" ]; then export CPPFLAGS="${CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS}" unset CONDA_SYSROOT_@PLATFORM@_BACKUP_CPPFLAGS else