diff --git a/.azure-pipelines/azure-pipelines-linux.yml b/.azure-pipelines/azure-pipelines-linux.yml new file mode 100644 index 0000000..a20f315 --- /dev/null +++ b/.azure-pipelines/azure-pipelines-linux.yml @@ -0,0 +1,40 @@ +# This file was generated automatically from conda-smithy. To update this configuration, +# update the conda-forge.yml and/or the recipe/meta.yaml. +# -*- mode: yaml -*- + +jobs: +- job: linux + pool: + vmImage: ubuntu-latest + strategy: + matrix: + linux_64_: + CONFIG: linux_64_ + UPLOAD_PACKAGES: 'True' + DOCKER_IMAGE: quay.io/condaforge/linux-anvil-cos7-x86_64 + timeoutInMinutes: 360 + + steps: + # configure qemu binfmt-misc running. This allows us to run docker containers + # embedded qemu-static + - script: | + docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes + ls /proc/sys/fs/binfmt_misc/ + condition: not(startsWith(variables['CONFIG'], 'linux_64')) + displayName: Configure binfmt_misc + + - script: | + export CI=azure + export GIT_BRANCH=$BUILD_SOURCEBRANCHNAME + export FEEDSTOCK_NAME=$(basename ${BUILD_REPOSITORY_NAME}) + if [[ "${BUILD_REASON:-}" == "PullRequest" ]]; then + export IS_PR_BUILD="True" + else + export IS_PR_BUILD="False" + fi + .scripts/run_docker_build.sh + displayName: Run docker build + env: + BINSTAR_TOKEN: $(BINSTAR_TOKEN) + FEEDSTOCK_TOKEN: $(FEEDSTOCK_TOKEN) + STAGING_BINSTAR_TOKEN: $(STAGING_BINSTAR_TOKEN) \ No newline at end of file diff --git a/.azure-pipelines/azure-pipelines-win.yml b/.azure-pipelines/azure-pipelines-win.yml index 1fd8ea1..4819fc2 100755 --- a/.azure-pipelines/azure-pipelines-win.yml +++ b/.azure-pipelines/azure-pipelines-win.yml @@ -5,7 +5,7 @@ jobs: - job: win pool: - vmImage: vs2017-win2016 + vmImage: windows-2022 strategy: matrix: win_64_: @@ -14,48 +14,31 @@ jobs: timeoutInMinutes: 360 variables: CONDA_BLD_PATH: D:\\bld\\ + SET_PAGEFILE: 'True' + UPLOAD_TEMP: D:\\tmp steps: - - script: | - choco install vcpython27 -fdv -y --debug - condition: contains(variables['CONFIG'], 'vs2008') - displayName: Install vcpython27.msi (if needed) - - # Cygwin's git breaks conda-build. (See https://github.com/conda-forge/conda-smithy-feedstock/pull/2.) - # - script: rmdir C:\cygwin /s /q - # continueOnError: true - - - powershell: | - Set-PSDebug -Trace 1 - - $batchcontent = @" - ECHO ON - SET vcpython=C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0 - - DIR "%vcpython%" - - CALL "%vcpython%\vcvarsall.bat" %* - "@ - - $batchDir = "C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC" - $batchPath = "$batchDir" + "\vcvarsall.bat" - New-Item -Path $batchPath -ItemType "file" -Force - - Set-Content -Value $batchcontent -Path $batchPath - - Get-ChildItem -Path $batchDir + - task: PythonScript@0 + displayName: 'Download Miniforge' + inputs: + scriptSource: inline + script: | + import urllib.request + url = 'https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Windows-x86_64.exe' + path = r"$(Build.ArtifactStagingDirectory)/Miniforge.exe" + urllib.request.urlretrieve(url, path) - Get-ChildItem -Path ($batchDir + '\..') + - script: | + start /wait "" %BUILD_ARTIFACTSTAGINGDIRECTORY%\Miniforge.exe /InstallationType=JustMe /RegisterPython=0 /S /D=C:\Miniforge + displayName: Install Miniforge - condition: contains(variables['CONFIG'], 'vs2008') - displayName: Patch vs2008 (if needed) + - powershell: Write-Host "##vso[task.prependpath]C:\Miniforge\Scripts" + displayName: Add conda to PATH - - task: CondaEnvironment@1 - inputs: - packageSpecs: 'python=3.6 conda-build conda "conda-forge-ci-setup=3" pip' # Optional - installOptions: "-c conda-forge" - updateConda: true - displayName: Install conda-build and activate environment + - script: | + call activate base + mamba.exe install "python=3.10" conda-build conda pip boa conda-forge-ci-setup=3 -c conda-forge --strict-channel-priority --yes + displayName: Install conda-build - script: set PYTHONUNBUFFERED=1 displayName: Set PYTHONUNBUFFERED @@ -72,25 +55,16 @@ jobs: call activate base run_conda_forge_build_setup displayName: conda-forge build setup - - - # Special cased version setting some more things! - - script: | - call activate base - conda.exe build "recipe" -m .ci_support\%CONFIG%.yaml - displayName: Build recipe (vs2008) - env: - VS90COMNTOOLS: "C:\\Program Files (x86)\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\VC\\bin" - PYTHONUNBUFFERED: 1 - condition: contains(variables['CONFIG'], 'vs2008') - script: | call activate base - conda.exe build "recipe" -m .ci_support\%CONFIG%.yaml + if EXIST LICENSE.txt ( + copy LICENSE.txt "recipe\\recipe-scripts-license.txt" + ) + conda.exe mambabuild "recipe" -m .ci_support\%CONFIG%.yaml --suppress-variables %EXTRA_CB_OPTIONS% displayName: Build recipe env: PYTHONUNBUFFERED: 1 - condition: not(contains(variables['CONFIG'], 'vs2008')) - script: | set "FEEDSTOCK_NAME=%BUILD_REPOSITORY_NAME:*/=%" call activate base @@ -100,6 +74,9 @@ jobs: - script: | set "GIT_BRANCH=%BUILD_SOURCEBRANCHNAME%" set "FEEDSTOCK_NAME=%BUILD_REPOSITORY_NAME:*/=%" + set "TEMP=$(UPLOAD_TEMP)" + if not exist "%TEMP%\" md "%TEMP%" + set "TMP=%TEMP%" call activate base upload_package --validate --feedstock-name="%FEEDSTOCK_NAME%" .\ ".\recipe" .ci_support\%CONFIG%.yaml displayName: Upload package @@ -107,4 +84,4 @@ jobs: BINSTAR_TOKEN: $(BINSTAR_TOKEN) FEEDSTOCK_TOKEN: $(FEEDSTOCK_TOKEN) STAGING_BINSTAR_TOKEN: $(STAGING_BINSTAR_TOKEN) - condition: and(succeeded(), not(eq(variables['UPLOAD_PACKAGES'], 'False'))) \ No newline at end of file + condition: and(succeeded(), not(eq(variables['UPLOAD_PACKAGES'], 'False')), not(eq(variables['Build.Reason'], 'PullRequest'))) \ No newline at end of file diff --git a/.ci_support/README b/.ci_support/README index e4e2dce..a47316b 100644 --- a/.ci_support/README +++ b/.ci_support/README @@ -1 +1,6 @@ -This file is automatically generated by conda-smithy. To change any matrix elements, you should change conda-smithy's input conda_build_config.yaml and re-render the recipe, rather than editing these files directly. \ No newline at end of file +This file is automatically generated by conda-smithy. If any +particular build configuration is expected, but it is not found, +please make sure all dependencies are satisfiable. To add/modify any +matrix elements, you should create/change conda-smithy's input +recipe/conda_build_config.yaml and re-render the recipe, rather than +editing these files directly. diff --git a/.ci_support/linux_64_.yaml b/.ci_support/linux_64_.yaml new file mode 100644 index 0000000..e0b4086 --- /dev/null +++ b/.ci_support/linux_64_.yaml @@ -0,0 +1,23 @@ +c_compiler: +- gcc +c_compiler_version: +- '12' +cdt_name: +- cos6 +channel_sources: +- conda-forge/label/llvm_rc,conda-forge +channel_targets: +- conda-forge llvm_rc +cxx_compiler: +- gxx +cxx_compiler_version: +- '12' +docker_image: +- quay.io/condaforge/linux-anvil-cos7-x86_64 +target_platform: +- linux-64 +zip_keys: +- - c_compiler_version + - cxx_compiler_version +zlib: +- '1.2' diff --git a/.ci_support/win_64_.yaml b/.ci_support/win_64_.yaml index 5875235..eb1ff89 100644 --- a/.ci_support/win_64_.yaml +++ b/.ci_support/win_64_.yaml @@ -1,12 +1,12 @@ c_compiler: -- vs2017 +- vs2019 channel_sources: -- conda-forge,defaults +- conda-forge/label/llvm_rc,conda-forge channel_targets: -- conda-forge main +- conda-forge llvm_rc cxx_compiler: -- vs2017 +- vs2019 target_platform: - win-64 -vc: -- '14' +zlib: +- '1.2' diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ad461b..8b4ef2f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,13 +1,14 @@ # This file was generated automatically from conda-smithy. To update this configuration, # update the conda-forge.yml and/or the recipe/meta.yaml. -# -*- mode: yaml -*- +# -*- mode: jinja-yaml -*- version: 2 jobs: build: working_directory: ~/test - machine: true + machine: + image: ubuntu-2004:current steps: - run: # The Circle-CI build should not be active, but if this is not true for some reason, do a fast finish. diff --git a/.gitattributes b/.gitattributes index 9060b27..7f32763 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,6 +9,7 @@ bld.bat text eol=crlf # github helper pieces to make some files not show up in diffs automatically .azure-pipelines/* linguist-generated=true .circleci/* linguist-generated=true +.ci_support/README linguist-generated=true .drone/* linguist-generated=true .drone.yml linguist-generated=true .github/* linguist-generated=true @@ -18,6 +19,7 @@ bld.bat text eol=crlf .gitignore linguist-generated=true .travis.yml linguist-generated=true .scripts/* linguist-generated=true +.woodpecker.yml linguist-generated=true LICENSE.txt linguist-generated=true README.md linguist-generated=true azure-pipelines.yml linguist-generated=true diff --git a/.scripts/build_steps.sh b/.scripts/build_steps.sh new file mode 100755 index 0000000..595f8b5 --- /dev/null +++ b/.scripts/build_steps.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +# PLEASE NOTE: This script has been automatically generated by conda-smithy. Any changes here +# will be lost next time ``conda smithy rerender`` is run. If you would like to make permanent +# changes to this script, consider a proposal to conda-smithy so that other feedstocks can also +# benefit from the improvement. + +# -*- mode: jinja-shell -*- + +set -xeuo pipefail +export FEEDSTOCK_ROOT="${FEEDSTOCK_ROOT:-/home/conda/feedstock_root}" +source ${FEEDSTOCK_ROOT}/.scripts/logging_utils.sh + + +( endgroup "Start Docker" ) 2> /dev/null + +( startgroup "Configuring conda" ) 2> /dev/null + +export PYTHONUNBUFFERED=1 +export RECIPE_ROOT="${RECIPE_ROOT:-/home/conda/recipe_root}" +export CI_SUPPORT="${FEEDSTOCK_ROOT}/.ci_support" +export CONFIG_FILE="${CI_SUPPORT}/${CONFIG}.yaml" + +cat >~/.condarc < /dev/null + +if [[ -f "${FEEDSTOCK_ROOT}/LICENSE.txt" ]]; then + cp "${FEEDSTOCK_ROOT}/LICENSE.txt" "${RECIPE_ROOT}/recipe-scripts-license.txt" +fi + +if [[ "${BUILD_WITH_CONDA_DEBUG:-0}" == 1 ]]; then + if [[ "x${BUILD_OUTPUT_ID:-}" != "x" ]]; then + EXTRA_CB_OPTIONS="${EXTRA_CB_OPTIONS:-} --output-id ${BUILD_OUTPUT_ID}" + fi + conda debug "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ + ${EXTRA_CB_OPTIONS:-} \ + --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" + + # Drop into an interactive shell + /bin/bash +else + conda mambabuild "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ + --suppress-variables ${EXTRA_CB_OPTIONS:-} \ + --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" + ( startgroup "Validating outputs" ) 2> /dev/null + + validate_recipe_outputs "${FEEDSTOCK_NAME}" + + ( endgroup "Validating outputs" ) 2> /dev/null + + ( startgroup "Uploading packages" ) 2> /dev/null + + if [[ "${UPLOAD_PACKAGES}" != "False" ]] && [[ "${IS_PR_BUILD}" == "False" ]]; then + upload_package --validate --feedstock-name="${FEEDSTOCK_NAME}" "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" + fi + + ( endgroup "Uploading packages" ) 2> /dev/null +fi + +( startgroup "Final checks" ) 2> /dev/null + +touch "${FEEDSTOCK_ROOT}/build_artifacts/conda-forge-build-done-${CONFIG}" \ No newline at end of file diff --git a/.scripts/logging_utils.sh b/.scripts/logging_utils.sh new file mode 100755 index 0000000..57bc95c --- /dev/null +++ b/.scripts/logging_utils.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Provide a unified interface for the different logging +# utilities CI providers offer. If unavailable, provide +# a compatible fallback (e.g. bare `echo xxxxxx`). + +function startgroup { + # Start a foldable group of log lines + # Pass a single argument, quoted + case ${CI:-} in + azure ) + echo "##[group]$1";; + travis ) + echo "$1" + echo -en 'travis_fold:start:'"${1// /}"'\\r';; + github_actions ) + echo "::group::$1";; + * ) + echo "$1";; + esac +} 2> /dev/null + +function endgroup { + # End a foldable group of log lines + # Pass a single argument, quoted + + case ${CI:-} in + azure ) + echo "##[endgroup]";; + travis ) + echo -en 'travis_fold:end:'"${1// /}"'\\r';; + github_actions ) + echo "::endgroup::";; + esac +} 2> /dev/null diff --git a/.scripts/run_docker_build.sh b/.scripts/run_docker_build.sh new file mode 100755 index 0000000..9236239 --- /dev/null +++ b/.scripts/run_docker_build.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +# PLEASE NOTE: This script has been automatically generated by conda-smithy. Any changes here +# will be lost next time ``conda smithy rerender`` is run. If you would like to make permanent +# changes to this script, consider a proposal to conda-smithy so that other feedstocks can also +# benefit from the improvement. + +source .scripts/logging_utils.sh + +( startgroup "Configure Docker" ) 2> /dev/null + +set -xeo pipefail + +THISDIR="$( cd "$( dirname "$0" )" >/dev/null && pwd )" +PROVIDER_DIR="$(basename $THISDIR)" + +FEEDSTOCK_ROOT="$( cd "$( dirname "$0" )/.." >/dev/null && pwd )" +RECIPE_ROOT="${FEEDSTOCK_ROOT}/recipe" + +if [ -z ${FEEDSTOCK_NAME} ]; then + export FEEDSTOCK_NAME=$(basename ${FEEDSTOCK_ROOT}) +fi + +docker info + +# In order for the conda-build process in the container to write to the mounted +# volumes, we need to run with the same id as the host machine, which is +# normally the owner of the mounted volumes, or at least has write permission +export HOST_USER_ID=$(id -u) +# Check if docker-machine is being used (normally on OSX) and get the uid from +# the VM +if hash docker-machine 2> /dev/null && docker-machine active > /dev/null; then + export HOST_USER_ID=$(docker-machine ssh $(docker-machine active) id -u) +fi + +ARTIFACTS="$FEEDSTOCK_ROOT/build_artifacts" + +if [ -z "$CONFIG" ]; then + set +x + FILES=`ls .ci_support/linux_*` + CONFIGS="" + for file in $FILES; do + CONFIGS="${CONFIGS}'${file:12:-5}' or "; + done + echo "Need to set CONFIG env variable. Value can be one of ${CONFIGS:0:-4}" + exit 1 +fi + +if [ -z "${DOCKER_IMAGE}" ]; then + SHYAML_INSTALLED="$(shyaml -h || echo NO)" + if [ "${SHYAML_INSTALLED}" == "NO" ]; then + echo "WARNING: DOCKER_IMAGE variable not set and shyaml not installed. Trying to parse with coreutils" + DOCKER_IMAGE=$(cat .ci_support/${CONFIG}.yaml | grep '^docker_image:$' -A 1 | tail -n 1 | cut -b 3-) + if [ "${DOCKER_IMAGE}" = "" ]; then + echo "No docker_image entry found in ${CONFIG}. Falling back to quay.io/condaforge/linux-anvil-comp7" + DOCKER_IMAGE="quay.io/condaforge/linux-anvil-comp7" + fi + else + DOCKER_IMAGE="$(cat "${FEEDSTOCK_ROOT}/.ci_support/${CONFIG}.yaml" | shyaml get-value docker_image.0 quay.io/condaforge/linux-anvil-comp7 )" + fi +fi + +mkdir -p "$ARTIFACTS" +DONE_CANARY="$ARTIFACTS/conda-forge-build-done-${CONFIG}" +rm -f "$DONE_CANARY" + +# Allow people to specify extra default arguments to `docker run` (e.g. `--rm`) +DOCKER_RUN_ARGS="${CONDA_FORGE_DOCKER_RUN_ARGS}" +if [ -z "${CI}" ]; then + DOCKER_RUN_ARGS="-it ${DOCKER_RUN_ARGS}" +fi + +( endgroup "Configure Docker" ) 2> /dev/null + +( startgroup "Start Docker" ) 2> /dev/null + +export UPLOAD_PACKAGES="${UPLOAD_PACKAGES:-True}" +export IS_PR_BUILD="${IS_PR_BUILD:-False}" +docker pull "${DOCKER_IMAGE}" +docker run ${DOCKER_RUN_ARGS} \ + -v "${RECIPE_ROOT}":/home/conda/recipe_root:rw,z,delegated \ + -v "${FEEDSTOCK_ROOT}":/home/conda/feedstock_root:rw,z,delegated \ + -e CONFIG \ + -e HOST_USER_ID \ + -e UPLOAD_PACKAGES \ + -e IS_PR_BUILD \ + -e GIT_BRANCH \ + -e UPLOAD_ON_BRANCH \ + -e CI \ + -e FEEDSTOCK_NAME \ + -e CPU_COUNT \ + -e BUILD_WITH_CONDA_DEBUG \ + -e BUILD_OUTPUT_ID \ + -e BINSTAR_TOKEN \ + -e FEEDSTOCK_TOKEN \ + -e STAGING_BINSTAR_TOKEN \ + "${DOCKER_IMAGE}" \ + bash \ + "/home/conda/feedstock_root/${PROVIDER_DIR}/build_steps.sh" + +# verify that the end of the script was reached +test -f "$DONE_CANARY" + +# This closes the last group opened in `build_steps.sh` +( endgroup "Final checks" ) 2> /dev/null \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt index 5f30279..2ec51d7 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,13 +1,27 @@ -BSD 3-clause license -Copyright (c) 2015-2020, conda-forge contributors +BSD-3-Clause license +Copyright (c) 2015-2022, 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: +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. + 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. -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 COPYRIGHT HOLDER 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. +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. diff --git a/README.md b/README.md index dd71227..16ba6db 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ -About flang -=========== +About flang-feedstock +===================== -Home: http://github.com/flang-compiler/flang +Feedstock license: [BSD-3-Clause](https://github.com/conda-forge/flang-feedstock/blob/main/LICENSE.txt) -Package license: Apache 2.0 +Home: https://flang.llvm.org -Feedstock license: [BSD-3-Clause](https://github.com/conda-forge/flang-feedstock/blob/master/LICENSE.txt) +Package license: Apache-2.0 Summary: Flang is a Fortran compiler targeting LLVM. +Development: https://github.com/llvm/llvm-project + Current build status ==================== @@ -20,17 +22,24 @@ Current build status
- - + + + + + @@ -48,7 +57,9 @@ Current release info | --- | --- | --- | --- | | [![Conda Recipe](https://img.shields.io/badge/recipe-flang-green.svg)](https://anaconda.org/conda-forge/flang) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/flang.svg)](https://anaconda.org/conda-forge/flang) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/flang.svg)](https://anaconda.org/conda-forge/flang) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/flang.svg)](https://anaconda.org/conda-forge/flang) | | [![Conda Recipe](https://img.shields.io/badge/recipe-flang_linux--64-green.svg)](https://anaconda.org/conda-forge/flang_linux-64) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/flang_linux-64.svg)](https://anaconda.org/conda-forge/flang_linux-64) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/flang_linux-64.svg)](https://anaconda.org/conda-forge/flang_linux-64) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/flang_linux-64.svg)](https://anaconda.org/conda-forge/flang_linux-64) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-flang_win--64-green.svg)](https://anaconda.org/conda-forge/flang_win-64) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/flang_win-64.svg)](https://anaconda.org/conda-forge/flang_win-64) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/flang_win-64.svg)](https://anaconda.org/conda-forge/flang_win-64) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/flang_win-64.svg)](https://anaconda.org/conda-forge/flang_win-64) | | [![Conda Recipe](https://img.shields.io/badge/recipe-libflang-green.svg)](https://anaconda.org/conda-forge/libflang) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libflang.svg)](https://anaconda.org/conda-forge/libflang) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libflang.svg)](https://anaconda.org/conda-forge/libflang) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libflang.svg)](https://anaconda.org/conda-forge/libflang) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-libfortran--main-green.svg)](https://anaconda.org/conda-forge/libfortran-main) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libfortran-main.svg)](https://anaconda.org/conda-forge/libfortran-main) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libfortran-main.svg)](https://anaconda.org/conda-forge/libfortran-main) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libfortran-main.svg)](https://anaconda.org/conda-forge/libfortran-main) | Installing flang ================ @@ -57,25 +68,52 @@ Installing `flang` from the `conda-forge` channel can be achieved by adding `con ``` conda config --add channels conda-forge +conda config --set channel_priority strict +``` + +Once the `conda-forge` channel has been enabled, `flang, flang_linux-64, flang_win-64, libflang, libfortran-main` can be installed with `conda`: + +``` +conda install flang flang_linux-64 flang_win-64 libflang libfortran-main ``` -Once the `conda-forge` channel has been enabled, `flang, flang_linux-64, libflang` can be installed with: +or with `mamba`: ``` -conda install flang flang_linux-64 libflang +mamba install flang flang_linux-64 flang_win-64 libflang libfortran-main ``` -It is possible to list all of the versions of `flang` available on your platform with: +It is possible to list all of the versions of `flang` available on your platform with `conda`: ``` conda search flang --channel conda-forge ``` +or with `mamba`: + +``` +mamba search flang --channel conda-forge +``` + +Alternatively, `mamba repoquery` may provide more information: + +``` +# Search all versions available on your platform: +mamba repoquery search flang --channel conda-forge + +# List packages depending on `flang`: +mamba repoquery whoneeds flang --channel conda-forge + +# List dependencies of `flang`: +mamba repoquery depends flang --channel conda-forge +``` + About conda-forge ================= -[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](http://numfocus.org) +[![Powered by +NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org) conda-forge is a community-led conda channel of installable packages. In order to provide high-quality builds, the process has been automated into the @@ -85,10 +123,12 @@ for each of the installable packages. Such a repository is known as a *feedstock A feedstock is made up of a conda recipe (the instructions on what and how to build the package) and the necessary configurations for automatic building using freely available continuous integration services. Thanks to the awesome service provided by -[CircleCI](https://circleci.com/), [AppVeyor](https://www.appveyor.com/) -and [TravisCI](https://travis-ci.com/) it is possible to build and upload installable -packages to the [conda-forge](https://anaconda.org/conda-forge) -[Anaconda-Cloud](https://anaconda.org/) channel for Linux, Windows and OSX respectively. +[Azure](https://azure.microsoft.com/en-us/services/devops/), [GitHub](https://github.com/), +[CircleCI](https://circleci.com/), [AppVeyor](https://www.appveyor.com/), +[Drone](https://cloud.drone.io/welcome), and [TravisCI](https://travis-ci.com/) +it is possible to build and upload installable packages to the +[conda-forge](https://anaconda.org/conda-forge) [Anaconda-Cloud](https://anaconda.org/) +channel for Linux, Windows and OSX respectively. To manage the continuous integration and simplify feedstock maintenance [conda-smithy](https://github.com/conda-forge/conda-smithy) has been developed. @@ -127,9 +167,9 @@ build distinct package versions. In order to produce a uniquely identifiable distribution: * If the version of a package **is not** being increased, please add or increase - the [``build/number``](https://conda.io/docs/user-guide/tasks/build-packages/define-metadata.html#build-number-and-string). + the [``build/number``](https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#build-number-and-string). * If the version of a package **is** being increased, please remember to return - the [``build/number``](https://conda.io/docs/user-guide/tasks/build-packages/define-metadata.html#build-number-and-string) + the [``build/number``](https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#build-number-and-string) back to 0. Feedstock Maintainers diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 93cf692..baa1c2b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,4 +3,5 @@ # -*- mode: yaml -*- jobs: + - template: ./.azure-pipelines/azure-pipelines-linux.yml - template: ./.azure-pipelines/azure-pipelines-win.yml \ No newline at end of file diff --git a/build-locally.py b/build-locally.py index 3453cfe..3f4b7a7 100755 --- a/build-locally.py +++ b/build-locally.py @@ -7,15 +7,21 @@ import glob import subprocess from argparse import ArgumentParser +import platform def setup_environment(ns): os.environ["CONFIG"] = ns.config os.environ["UPLOAD_PACKAGES"] = "False" + os.environ["IS_PR_BUILD"] = "True" if ns.debug: os.environ["BUILD_WITH_CONDA_DEBUG"] = "1" if ns.output_id: os.environ["BUILD_OUTPUT_ID"] = ns.output_id + if "MINIFORGE_HOME" not in os.environ: + os.environ["MINIFORGE_HOME"] = os.path.join( + os.path.dirname(__file__), "miniforge3" + ) def run_docker_build(ns): @@ -23,6 +29,11 @@ def run_docker_build(ns): subprocess.check_call([script]) +def run_osx_build(ns): + script = ".scripts/run_osx_build.sh" + subprocess.check_call([script]) + + def verify_config(ns): valid_configs = { os.path.basename(f)[:-5] for f in glob.glob(".ci_support/*.yaml") @@ -46,10 +57,17 @@ def verify_config(ns): else: raise ValueError("config " + ns.config + " is not valid") # Remove the following, as implemented - if not ns.config.startswith("linux"): + if ns.config.startswith("win"): raise ValueError( - f"only Linux configs currently supported, got {ns.config}" + f"only Linux/macOS configs currently supported, got {ns.config}" ) + elif ns.config.startswith("osx"): + if "OSX_SDK_DIR" not in os.environ: + raise RuntimeError( + "Need OSX_SDK_DIR env variable set. Run 'export OSX_SDK_DIR=SDKs' " + "to download the SDK automatically to 'SDKs/MacOSX.sdk'. " + "Setting this variable implies agreement to the licensing terms of the SDK by Apple." + ) def main(args=None): @@ -68,7 +86,19 @@ def main(args=None): verify_config(ns) setup_environment(ns) - run_docker_build(ns) + try: + if ns.config.startswith("linux") or ( + ns.config.startswith("osx") and platform.system() == "Linux" + ): + run_docker_build(ns) + elif ns.config.startswith("osx"): + run_osx_build(ns) + finally: + recipe_license_file = os.path.join( + "recipe", "recipe-scripts-license.txt" + ) + if os.path.exists(recipe_license_file): + os.remove(recipe_license_file) if __name__ == "__main__": diff --git a/conda-forge.yml b/conda-forge.yml index 2f501ce..522a138 100644 --- a/conda-forge.yml +++ b/conda-forge.yml @@ -1,3 +1,7 @@ +azure: + settings_win: + variables: + SET_PAGEFILE: "True" conda_forge_output_validation: true github: branch_name: main diff --git a/recipe/activate.sh b/recipe/activate.sh index de9978b..c7b3958 100644 --- a/recipe/activate.sh +++ b/recipe/activate.sh @@ -1,10 +1,17 @@ -export _OLD_LIBRARY_PATH=$LIBRARY_PATH export _OLD_CPATH=$CPATH +export _OLD_LIBRARY_PATH=$LIBRARY_PATH +export _OLD_FORTRANFLAGS=$FORTRANFLAGS if [ -z "$CONDA_PREFIX" ]; then - export LIBRARY_PATH=$LIBRARY_PATH:$PREFIX/lib export CPATH=$CPATH:$PREFIX/include + export LIBRARY_PATH=$LIBRARY_PATH:$PREFIX/lib + export FORTRANFLAGS="$FORTRANFLAGS -isystem ${CONDA_PREFIX}/include" else - export LIBRARY_PATH=$LIBRARY_PATH:$CONDA_PREFIX/lib export CPATH=$CPATH:$CONDA_PREFIX/include + export LIBRARY_PATH=$LIBRARY_PATH:$CONDA_PREFIX/lib + export FORTRANFLAGS="$FORTRANFLAGS -isystem ${PREFIX}/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix" + export FORTRANFLAGS="$FORTRANFLAGS --sysroot=$CONDA_BUILD_SYSROOT" fi + +export FFLAGS=$FORTRANFLAGS +export Fortran_FLAGS=$FORTRANFLAGS diff --git a/recipe/bld.bat b/recipe/bld.bat index 9c82689..e435aed 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -1,19 +1,31 @@ +@echo on + mkdir build cd build set "PROCESSOR_ARCHITECTURE=AMD64" +set "CXXFLAGS=%CXXFLAGS% -DAVOID_NATIVE_UINT128_T=1" + cmake -G "Ninja" ^ -DCMAKE_C_COMPILER=clang-cl ^ -DCMAKE_CXX_COMPILER=clang-cl ^ -DCMAKE_BUILD_TYPE="Release" ^ - -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ - -DCMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^ + -DCMAKE_CXX_STANDARD=17 ^ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ^ + -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ + -DCMAKE_MODULE_PATH=../cmake/Modules ^ + -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX%;%LIBRARY_LIB%/clang/%PKG_VERSION% ^ + -DLLVM_BUILD_MAIN_SRC_DIR=.. ^ + -DLLVM_EXTERNAL_LIT=%LIBRARY_BIN%/lit ^ + -DLLVM_LIT_ARGS=-v ^ + -DLLVM_CMAKE_DIR=%LIBRARY_LIB%/cmake/llvm ^ + -DCLANG_DIR=%LIBRARY_LIB%/cmake/clang ^ + -DFLANG_INCLUDE_TESTS=OFF ^ + -DMLIR_DIR=%LIBRARY_LIB%/cmake/mlir ^ -DTARGET_ARCHITECTURE=AMD64 ^ - %SRC_DIR% - -if errorlevel 1 exit 1 + ..\flang +if %ERRORLEVEL% neq 0 exit 1 cmake --build . -if errorlevel 1 exit 1 - +if %ERRORLEVEL% neq 0 exit 1 diff --git a/recipe/build.sh b/recipe/build.sh index 2df4080..05de59c 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -1,12 +1,28 @@ +#!/bin/bash +set -ex + mkdir build cd build -cmake \ - -DCMAKE_INSTALL_PREFIX=$PREFIX \ - -DCMAKE_PREFIX_PATH=$PREFIX \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_Fortran_COMPILER=flang \ - .. +if [[ "$CONDA_BUILD_CROSS_COMPILATION" == "1" ]]; then + CMAKE_ARGS="$CMAKE_ARGS -DLLVM_CONFIG_PATH=$BUILD_PREFIX/bin/llvm-config -DMLIR_TABLEGEN_EXE=$BUILD_PREFIX/bin/mlir-tblgen" +fi +cmake -G Ninja \ + ${CMAKE_ARGS} \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_MODULE_PATH=../cmake/Modules \ + -DCMAKE_PREFIX_PATH=$PREFIX \ + -DLLVM_EXTERNAL_LIT=$PREFIX/bin/lit \ + -DLLVM_LIT_ARGS=-v \ + -DLLVM_CMAKE_DIR=$PREFIX/lib/cmake/llvm \ + -DCLANG_DIR=$PREFIX/lib/cmake/clang \ + -DFLANG_INCLUDE_TESTS=OFF \ + -DMLIR_DIR=$PREFIX/lib/cmake/mlir \ + ../flang -make -j${CPU_COUNT} +cmake --build . -j1 diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml new file mode 100644 index 0000000..b2aedab --- /dev/null +++ b/recipe/conda_build_config.yaml @@ -0,0 +1,5 @@ +channel_targets: + - conda-forge llvm_rc + +channel_sources: + - conda-forge/label/llvm_rc,conda-forge diff --git a/recipe/deactivate.sh b/recipe/deactivate.sh index 5695966..a58df93 100644 --- a/recipe/deactivate.sh +++ b/recipe/deactivate.sh @@ -1,2 +1,3 @@ -export LIBRARY_PATH=$_OLD_LIBRARY_PATH export CPATH=$_OLD_CPATH +export FORTRANFLAGS=$_OLD_FORTRANFLAGS +export LIBRARY_PATH=$_OLD_LIBRARY_PATH diff --git a/recipe/install_flang.bat b/recipe/install_flang.bat index 3d64e5d..9e023d5 100644 --- a/recipe/install_flang.bat +++ b/recipe/install_flang.bat @@ -2,12 +2,7 @@ cd %SRC_DIR%\build call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 cmake --build . --target install -if errorlevel 1 exit 1 - -rm %LIBRARY_BIN%\flang.dll -rm %LIBRARY_BIN%\flangrti.dll -rm %LIBRARY_BIN%\ompstub.dll -rm %LIBRARY_BIN%\pgmath.dll +if %ERRORLEVEL% neq 0 exit 1 :: Copy the [de]activate scripts to %PREFIX%\etc\conda\[de]activate.d. :: This will allow them to be run on environment activation. diff --git a/recipe/install_flang.sh b/recipe/install_flang.sh index 4ca1655..31a88c0 100644 --- a/recipe/install_flang.sh +++ b/recipe/install_flang.sh @@ -1,8 +1,9 @@ +#!/bin/bash +set -ex + cd $SRC_DIR/build -make install -rm $PREFIX/lib/libflang${SHLIB_EXT} -rm $PREFIX/lib/libflangrti${SHLIB_EXT} -rm $PREFIX/lib/libompstub${SHLIB_EXT} + +cmake --install . for CHANGE in "activate" "deactivate" do diff --git a/recipe/install_libflang.bat b/recipe/install_libflang.bat index 087c483..8a0d3e2 100644 --- a/recipe/install_libflang.bat +++ b/recipe/install_libflang.bat @@ -1,4 +1,4 @@ -cp %SRC_DIR%/build/bin/flang.dll %LIBRARY_BIN%\ -cp %SRC_DIR%/build/bin/flangrti.dll %LIBRARY_BIN%\ -cp %SRC_DIR%/build/bin/ompstub.dll %LIBRARY_BIN%\ -cp %SRC_DIR%/build/bin/pgmath.dll %LIBRARY_BIN%\ +@echo on + +cp build\lib\FortranRuntime.lib %LIBRARY_LIB% +cp build\lib\FortranDecimal.lib %LIBRARY_LIB% diff --git a/recipe/install_libflang.sh b/recipe/install_libflang.sh index 5827c97..0e3f13a 100644 --- a/recipe/install_libflang.sh +++ b/recipe/install_libflang.sh @@ -1,3 +1,13 @@ -cp $SRC_DIR/build/lib/libflang${SHLIB_EXT} $PREFIX/lib -cp $SRC_DIR/build/lib/libflangrti${SHLIB_EXT} $PREFIX/lib -cp $SRC_DIR/build/lib/libompstub${SHLIB_EXT} $PREFIX/lib +#!/bin/bash +set -ex + +if [[ "${target_platform}" == linux-* ]]; then + # copy symlink & its target, e.g. libFortranRuntime.so.16 & libFortranRuntime.so + cp $SRC_DIR/build/lib/libFortranRuntime*${SHLIB_EXT}* $PREFIX/lib + # same for libFortranDecimal + cp $SRC_DIR/build/lib/libFortranDecimal*${SHLIB_EXT}* $PREFIX/lib +else + # static builds on unix due to segfaults with shared ones + cp $SRC_DIR/build/lib/libFortranRuntime.a $PREFIX/lib + cp $SRC_DIR/build/lib/libFortranDecimal.a $PREFIX/lib +fi diff --git a/recipe/install_libfortran_main.bat b/recipe/install_libfortran_main.bat new file mode 100644 index 0000000..07afb25 --- /dev/null +++ b/recipe/install_libfortran_main.bat @@ -0,0 +1,3 @@ +@echo on + +cp build\lib\Fortran_main.lib %LIBRARY_LIB% diff --git a/recipe/install_libfortran_main.sh b/recipe/install_libfortran_main.sh new file mode 100644 index 0000000..4240bdd --- /dev/null +++ b/recipe/install_libfortran_main.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -ex + +cp $SRC_DIR/build/lib/libFortran_main.a $PREFIX/lib diff --git a/recipe/meta.yaml b/recipe/meta.yaml index eff7340..5a1f064 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,24 +1,23 @@ -{% set clang_variant = os.environ.get('CLANG_VARIANT', 'flang') %} -{% set flang_commit = "1192ff0775ddf94f7944dc40181406c088b4d575" %} -{% set llvm_version = "11.0.1" %} -{% set version = llvm_version %} -{% set sha256 = "e4fa46a0b29cabf4c4583231b79f923d6296efc4196099cbaebf5828f03a2607" %} -{% set build_number = "20210131" %} +{% set version = "17.0.0.rc3" %} package: name: flang-split version: {{ version }} source: - url: https://github.com/xoviat/flang/archive/{{ flang_commit }}.tar.gz - sha256: {{ sha256 }} + url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/llvm-project-{{ version.replace(".rc", "rc") }}.src.tar.xz + sha256: 60493f4e974fcca7b739aea4901af2d957b0eaea34b42815359be59cf6c88fa2 + patches: + # link compiler-rt libs (upstream's find_compiler_rt_library doesn't work correctly); + # probably related to https://github.com/llvm/llvm-project/issues/63286 + # - patches/0001-always-link-in-compiler-rt-builtins-on-windows-apple.patch + # backport https://reviews.llvm.org/D154660 + - patches/0002-flang-Allow-runtime-build-with-AVOID_NATIVE_INT128_T.patch build: - number: {{ build_number }} - skip: true # [osx] - skip: true # [unix] - skip: true # [win32] - skip: true # [win and vc<14] + number: 0 + # intentionally only windows (main target) & linux (debuggability) + skip: true # [osx] track_features: - flang @@ -28,13 +27,16 @@ requirements: - {{ compiler('cxx') }} - cmake - ninja - - m2-sed # [win] - - m2-gawk # [win] - - m2-grep # [win] + - sysroot_linux-64 ==2.17 # [linux64] + - mlir =={{ version }} # [build_platform != target_platform] host: - - clangdev =={{ llvm_version }} - - llvm-openmp =={{ llvm_version }} - - llvmdev =={{ llvm_version }} + - clangdev =={{ version }} + - compiler-rt =={{ version }} + - lit =={{ version }} + - llvm-openmp =={{ version }} + - llvmdev =={{ version }} + - mlir =={{ version }} + - zlib test: commands: @@ -46,19 +48,42 @@ outputs: script: install_libflang.bat # [win] requirements: build: + # for strong run-exports - {{ compiler('c') }} - {{ compiler('cxx') }} - - cmake - - ninja - - m2-sed # [win] - - m2-gawk # [win] - - m2-grep # [win] host: - - clangdev =={{ llvm_version }} - - llvm-openmp =={{ llvm_version }} - - llvmdev =={{ llvm_version }} + - clangdev =={{ version }} + - compiler-rt =={{ version }} + - llvmdev =={{ version }} + - mlir =={{ version }} run: - - llvm-openmp =={{ llvm_version }} + # necessary to link on windows (even for static lib), e.g. + # FortranDecimal.lib(binary-to-decimal.cpp.obj) : error LNK2019: unresolved external symbol __udivti3 ... + - compiler-rt =={{ version }} # [win] + test: + commands: + # shared lib on linux + - test -f $PREFIX/lib/libFortranRuntime.so # [linux] + # static lib on win (fails to export symbols for shared build) + - if not exist %LIBRARY_LIB%\FortranRuntime.lib exit 1 # [win] + + - name: libfortran-main + script: install_libfortran_main.sh # [unix] + script: install_libfortran_main.bat # [win] + requirements: + build: + # if there's no build env, windows fails with EnvironmentLocationNotFound (what?!) + - {{ compiler('c') }} # [win] + - {{ compiler('cxx') }} # [win] + host: + # this is just here to have a non-empty host environment + - {{ pin_subpackage('libflang', exact=True) }} + run: + # not sure what we need here + test: + commands: + - test -f $PREFIX/lib/libFortran_main.a # [unix] + - if not exist %LIBRARY_LIB%\Fortran_main.lib exit 1 # [win] - name: flang script: install_flang.sh # [unix] @@ -68,28 +93,40 @@ outputs: - libflang >={{ version }} requirements: build: - - {{ compiler('c') }} - - {{ compiler('cxx') }} - cmake - ninja - - m2-sed # [win] - - m2-gawk # [win] - - m2-grep # [win] + # for strong run-exports + - {{ compiler('c') }} + - {{ compiler('cxx') }} host: - - clangdev =={{ llvm_version }} - - llvm-openmp =={{ llvm_version }} - - llvmdev =={{ llvm_version }} + - clangdev =={{ version }} + - compiler-rt =={{ version }} + - llvm-openmp =={{ version }} + - llvmdev =={{ version }} + - mlir =={{ version }} + # for required run-exports + - llvm =={{ version }} + - libclang-cpp =={{ version }} + # ninja really wants to find z.lib on win + - zlib # [win] + - {{ pin_subpackage('libflang', exact=True) }} + - {{ pin_subpackage('libfortran-main', exact=True) }} run: - - clangdev =={{ llvm_version }} - - llvm-openmp =={{ llvm_version }} + - sysroot_{{ target_platform }} ==2.17 # [linux] + - clangdev =={{ version }} + - llvm-openmp =={{ version }} - {{ pin_subpackage('libflang', exact=True) }} + - {{ pin_subpackage('libfortran-main', exact=True) }} test: + requires: + - {{ compiler('c') }} # [win] + - {{ compiler('cxx') }} # [win] files: - hello_world.f90 commands: - # TODO - Figure out why the following line is needed. - - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 # [win64] - - flang hello_world.f90 + # see naming discussion: https://discourse.llvm.org/t/reviving-rename-flang-new-to-flang/68130/2 + # - flang hello_world.f90 + - flang-new hello_world.f90 - ./a.out # [unix] - a.exe # [win] @@ -102,10 +139,11 @@ outputs: about: - home: http://github.com/flang-compiler/flang - license: Apache 2.0 - license_file: LICENSE.txt + home: https://flang.llvm.org + license: Apache-2.0 + license_file: flang/LICENSE.TXT summary: Flang is a Fortran compiler targeting LLVM. + dev_url: https://github.com/llvm/llvm-project extra: recipe-maintainers: diff --git a/recipe/patches/0001-always-link-in-compiler-rt-builtins-on-windows-apple.patch b/recipe/patches/0001-always-link-in-compiler-rt-builtins-on-windows-apple.patch new file mode 100644 index 0000000..3af60b0 --- /dev/null +++ b/recipe/patches/0001-always-link-in-compiler-rt-builtins-on-windows-apple.patch @@ -0,0 +1,41 @@ +From 1d75402d4382084b27b32e38c1591da253200507 Mon Sep 17 00:00:00 2001 +From: "H. Vetinari" +Date: Mon, 17 Apr 2023 23:38:48 +1100 +Subject: [PATCH 1/2] always link in compiler-rt builtins on windows & apple + +rather than patching HandleCompilerRT.cmake, we just +use the fact that we know where the library is located +--- + flang/CMakeLists.txt | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt +index ac30da89995..dd68d5b417c 100644 +--- a/flang/CMakeLists.txt ++++ b/flang/CMakeLists.txt +@@ -47,9 +47,22 @@ endif() + include(GNUInstallDirs) + + # MSVC + clang-cl build requires clang_rt.builtin.${target} library +-if (MSVC AND CMAKE_CXX_COMPILER_ID MATCHES Clang) +- include(HandleCompilerRT) +- find_compiler_rt_library(builtins CLANG_RT_BUILTINS_LIBRARY) ++if (MSVC OR APPLE) ++ if (MSVC) ++ cmake_path(SET CLANG_RT_BUILTINS_LIBRARY ++ NORMALIZE ++ "$ENV{LIBRARY_LIB}/clang/$ENV{PKG_VERSION}/lib/windows/clang_rt.builtins-x86_64.lib") ++ else() ++ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") ++ cmake_path(SET CLANG_RT_BUILTINS_LIBRARY ++ NORMALIZE ++ "$ENV{PREFIX}/lib/clang/$ENV{PKG_VERSION}/lib/libclang_rt.builtins_arm64_osx.a") ++ else() ++ cmake_path(SET CLANG_RT_BUILTINS_LIBRARY ++ NORMALIZE ++ "$ENV{PREFIX}/lib/clang/$ENV{PKG_VERSION}/lib/libclang_rt.builtins_x86_64_osx.a") ++ endif() ++ endif() + get_filename_component(LIBDIR "${CLANG_RT_BUILTINS_LIBRARY}" DIRECTORY) + if (IS_DIRECTORY "${LIBDIR}") + link_libraries(${CLANG_RT_BUILTINS_LIBRARY}) diff --git a/recipe/patches/0002-flang-Allow-runtime-build-with-AVOID_NATIVE_INT128_T.patch b/recipe/patches/0002-flang-Allow-runtime-build-with-AVOID_NATIVE_INT128_T.patch new file mode 100644 index 0000000..d808901 --- /dev/null +++ b/recipe/patches/0002-flang-Allow-runtime-build-with-AVOID_NATIVE_INT128_T.patch @@ -0,0 +1,218 @@ +From 060ffd3f6425a1cfbc93a2a8b9c8f320f3d3d2d0 Mon Sep 17 00:00:00 2001 +From: Peter Klausler +Date: Thu, 6 Jul 2023 15:07:00 -0700 +Subject: [PATCH 2/2] [flang] Allow runtime build with AVOID_NATIVE_INT128_T=1 + +--- + flang/runtime/command.cpp | 10 +++++++--- + flang/runtime/io-api.cpp | 4 +++- + flang/runtime/numeric.cpp | 24 ++++++++++++------------ + flang/runtime/tools.h | 19 +++++++++++++++++-- + 4 files changed, 39 insertions(+), 18 deletions(-) + +diff --git a/flang/runtime/command.cpp b/flang/runtime/command.cpp +index 6c4f611daaa..b81a0791c5e 100644 +--- a/flang/runtime/command.cpp ++++ b/flang/runtime/command.cpp +@@ -107,9 +107,13 @@ static void StoreLengthToDescriptor( + } + + template struct FitsInIntegerKind { +- bool operator()(std::int64_t value) { +- return value <= std::numeric_limits>::max(); ++ bool operator()([[maybe_unused]] std::int64_t value) { ++ if constexpr (KIND >= 8) { ++ return true; ++ } else { ++ return value <= std::numeric_limits>::max(); ++ } + } + }; + +diff --git a/flang/runtime/io-api.cpp b/flang/runtime/io-api.cpp +index fe58bbc75f8..bf05c79ae8f 100644 +--- a/flang/runtime/io-api.cpp ++++ b/flang/runtime/io-api.cpp +@@ -1483,7 +1483,9 @@ static enum Iostat CheckUnitNumberInRangeImpl(INT unit, bool handleError, + // Only provide the bad unit number in the message if SignalError can print + // it accurately. Otherwise, the generic IostatUnitOverflow message will be + // used. +- if (static_cast(unit) == unit) { ++ if constexpr (sizeof(INT) > sizeof(std::intmax_t)) { ++ errorHandler.SignalError(IostatUnitOverflow); ++ } else if (static_cast(unit) == unit) { + errorHandler.SignalError(IostatUnitOverflow, + "UNIT number %jd is out of range", static_cast(unit)); + } else { +diff --git a/flang/runtime/numeric.cpp b/flang/runtime/numeric.cpp +index 5376bcb569f..21ee91a8681 100644 +--- a/flang/runtime/numeric.cpp ++++ b/flang/runtime/numeric.cpp +@@ -306,7 +306,7 @@ CppTypeFor RTNAME(Ceiling4_8)( + CppTypeFor x) { + return Ceiling>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Ceiling4_16)( + CppTypeFor x) { + return Ceiling>(x); +@@ -328,7 +328,7 @@ CppTypeFor RTNAME(Ceiling8_8)( + CppTypeFor x) { + return Ceiling>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Ceiling8_16)( + CppTypeFor x) { + return Ceiling>(x); +@@ -351,7 +351,7 @@ CppTypeFor RTNAME(Ceiling10_8)( + CppTypeFor x) { + return Ceiling>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Ceiling10_16)( + CppTypeFor x) { + return Ceiling>(x); +@@ -374,7 +374,7 @@ CppTypeFor RTNAME(Ceiling16_8)( + CppTypeFor x) { + return Ceiling>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Ceiling16_16)( + CppTypeFor x) { + return Ceiling>(x); +@@ -434,7 +434,7 @@ CppTypeFor RTNAME(Floor4_8)( + CppTypeFor x) { + return Floor>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Floor4_16)( + CppTypeFor x) { + return Floor>(x); +@@ -456,7 +456,7 @@ CppTypeFor RTNAME(Floor8_8)( + CppTypeFor x) { + return Floor>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Floor8_16)( + CppTypeFor x) { + return Floor>(x); +@@ -479,7 +479,7 @@ CppTypeFor RTNAME(Floor10_8)( + CppTypeFor x) { + return Floor>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Floor10_16)( + CppTypeFor x) { + return Floor>(x); +@@ -502,7 +502,7 @@ CppTypeFor RTNAME(Floor16_8)( + CppTypeFor x) { + return Floor>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Floor16_16)( + CppTypeFor x) { + return Floor>(x); +@@ -710,7 +710,7 @@ CppTypeFor RTNAME(Nint4_8)( + CppTypeFor x) { + return Nint>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Nint4_16)( + CppTypeFor x) { + return Nint>(x); +@@ -732,7 +732,7 @@ CppTypeFor RTNAME(Nint8_8)( + CppTypeFor x) { + return Nint>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Nint8_16)( + CppTypeFor x) { + return Nint>(x); +@@ -755,7 +755,7 @@ CppTypeFor RTNAME(Nint10_8)( + CppTypeFor x) { + return Nint>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Nint10_16)( + CppTypeFor x) { + return Nint>(x); +@@ -778,7 +778,7 @@ CppTypeFor RTNAME(Nint16_8)( + CppTypeFor x) { + return Nint>(x); + } +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + CppTypeFor RTNAME(Nint16_16)( + CppTypeFor x) { + return Nint>(x); +diff --git a/flang/runtime/tools.h b/flang/runtime/tools.h +index d22093a2ada..72d14982ce4 100644 +--- a/flang/runtime/tools.h ++++ b/flang/runtime/tools.h +@@ -131,7 +131,7 @@ inline RT_API_ATTRS RESULT ApplyType( + return FUNC{}(std::forward(x)...); + case 8: + return FUNC{}(std::forward(x)...); +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + case 16: + return FUNC{}(std::forward(x)...); + #endif +@@ -230,7 +230,7 @@ inline RT_API_ATTRS RESULT ApplyIntegerKind( + return FUNC<4>{}(std::forward(x)...); + case 8: + return FUNC<8>{}(std::forward(x)...); +-#ifdef __SIZEOF_INT128__ ++#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + case 16: + return FUNC<16>{}(std::forward(x)...); + #endif +@@ -310,6 +310,11 @@ std::optional> inline constexpr GetResultType( + return std::make_pair(TypeCategory::Integer, maxKind); + case TypeCategory::Real: + case TypeCategory::Complex: ++#if !(defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T) ++ if (xKind == 16) { ++ break; ++ } ++#endif + return std::make_pair(yCat, yKind); + default: + break; +@@ -318,6 +323,11 @@ std::optional> inline constexpr GetResultType( + case TypeCategory::Real: + switch (yCat) { + case TypeCategory::Integer: ++#if !(defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T) ++ if (yKind == 16) { ++ break; ++ } ++#endif + return std::make_pair(TypeCategory::Real, xKind); + case TypeCategory::Real: + case TypeCategory::Complex: +@@ -329,6 +339,11 @@ std::optional> inline constexpr GetResultType( + case TypeCategory::Complex: + switch (yCat) { + case TypeCategory::Integer: ++#if !(defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T) ++ if (yKind == 16) { ++ break; ++ } ++#endif + return std::make_pair(TypeCategory::Complex, xKind); + case TypeCategory::Real: + case TypeCategory::Complex:
VariantStatus
linux_64 + + variant + +
win_64 - - variant + + variant