From d152cf70ecafce4b3eaad92e36c220a96ad38731 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 11 Jul 2024 20:16:51 +1100 Subject: [PATCH 1/5] clean-ups from link check --- recipe/meta.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index ee39d76b..5e76b30e 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -62,13 +62,13 @@ outputs: - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - {{ pin_subpackage("libllvm-c" + major_ver, exact=True) }} # [win] - {{ pin_subpackage("llvm-tools", exact=True) }} - - libxml2 - zlib - zstd run: - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - {{ pin_subpackage("libllvm-c" + major_ver, exact=True) }} # [win] - {{ pin_subpackage("llvm-tools", exact=True) }} + # we need to do this manually because clang_bootstrap has no run-export - libcxx >={{ cxx_compiler_version }} # [osx] run_constrained: - llvm {{ version }} @@ -111,10 +111,11 @@ outputs: - libcxx {{ cxx_compiler_version }} # [osx] host: - libcxx {{ cxx_compiler_version }} # [osx] - - libxml2 + - libxml2 # [unix] - zlib - zstd run: + # we need to do this manually because clang_bootstrap has no run-export - libcxx >={{ cxx_compiler_version }} # [osx] test: commands: @@ -174,6 +175,8 @@ outputs: - zstd run: - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + # we need to do this manually because clang_bootstrap has no run-export + - libcxx >={{ cxx_compiler_version }} # [osx] test: commands: - $PREFIX/bin/llc-{{ major_ver }} -version # [not win] @@ -202,7 +205,7 @@ outputs: - libcxx {{ cxx_compiler_version }} # [osx] - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [not win] - - libxml2 + - libxml2 # [win] - zlib - zstd run: @@ -245,7 +248,6 @@ outputs: host: - libcxx {{ cxx_compiler_version }} # [osx] - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - - libxml2 - zlib - zstd run_constrained: From eba56655d1b736fa45c74661c56563c4858d909f Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 11 Aug 2024 19:43:30 +1100 Subject: [PATCH 2/5] fix jinja string concatenation --- recipe/meta.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 5e76b30e..e6d2f790 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -59,14 +59,14 @@ outputs: - libcxx {{ cxx_compiler_version }} # [osx] host: - libcxx {{ cxx_compiler_version }} # [osx] - - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - - {{ pin_subpackage("libllvm-c" + major_ver, exact=True) }} # [win] + - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} + - {{ pin_subpackage("libllvm-c" ~ major_ver, exact=True) }} # [win] - {{ pin_subpackage("llvm-tools", exact=True) }} - zlib - zstd run: - - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - - {{ pin_subpackage("libllvm-c" + major_ver, exact=True) }} # [win] + - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} + - {{ pin_subpackage("libllvm-c" ~ major_ver, exact=True) }} # [win] - {{ pin_subpackage("llvm-tools", exact=True) }} # we need to do this manually because clang_bootstrap has no run-export - libcxx >={{ cxx_compiler_version }} # [osx] @@ -100,7 +100,7 @@ outputs: build: activate_in_script: true run_exports: # [not win] - - {{ pin_subpackage("libllvm" + major_ver, max_pin="x.x") }} # [not win] + - {{ pin_subpackage("libllvm" ~ major_ver, max_pin="x.x") }} # [not win] requirements: build: - {{ stdlib('c') }} @@ -131,16 +131,16 @@ outputs: - name: llvm build: run_exports: # [not win] - - {{ pin_subpackage("libllvm" + major_ver, max_pin="x.x") }} # [not win] + - {{ pin_subpackage("libllvm" ~ major_ver, max_pin="x.x") }} # [not win] requirements: build: host: - - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} # [not win] + - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} # [not win] - libxml2 - zlib - zstd run: # [not win] - - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} # [not win] + - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} # [not win] run_constrained: - llvmdev {{ version }} - llvm-tools {{ version }} @@ -174,7 +174,7 @@ outputs: - zlib - zstd run: - - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} # we need to do this manually because clang_bootstrap has no run-export - libcxx >={{ cxx_compiler_version }} # [osx] test: @@ -203,13 +203,13 @@ outputs: - libcxx {{ cxx_compiler_version }} # [osx] host: - libcxx {{ cxx_compiler_version }} # [osx] - - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [not win] - libxml2 # [win] - zlib - zstd run: - - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [not win] run_constrained: - llvm {{ version }} @@ -232,7 +232,7 @@ outputs: script: install_llvm.bat # [win] build: run_exports: - - {{ pin_subpackage("libllvm-c" + major_ver, max_pin="x.x") }} + - {{ pin_subpackage("libllvm-c" ~ major_ver, max_pin="x.x") }} activate_in_script: true # not supported on linux, see # https://github.com/llvm/llvm-project/blob/llvmorg-16.0.6/llvm/tools/llvm-shlib/CMakeLists.txt#L82-L85 @@ -247,7 +247,7 @@ outputs: - libcxx {{ cxx_compiler_version }} # [osx] host: - libcxx {{ cxx_compiler_version }} # [osx] - - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} - zlib - zstd run_constrained: From 09dfb3ef4739d783b44e675af863d4841fdc4cae Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 11 Aug 2024 19:44:42 +1100 Subject: [PATCH 3/5] switch to conda-build's new file include/exclude --- recipe/bld.bat | 16 +++++++- recipe/build.sh | 20 +++++++++ recipe/install_llvm.bat | 36 ---------------- recipe/install_llvm.sh | 59 -------------------------- recipe/meta.yaml | 91 +++++++++++++++-------------------------- 5 files changed, 68 insertions(+), 154 deletions(-) delete mode 100644 recipe/install_llvm.bat delete mode 100644 recipe/install_llvm.sh diff --git a/recipe/bld.bat b/recipe/bld.bat index 105af19c..1852322f 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -39,5 +39,19 @@ if %ERRORLEVEL% neq 0 exit 1 REM bin\opt -S -vector-library=SVML -mcpu=haswell -O3 %RECIPE_DIR%\numba-3016.ll | bin\FileCheck %RECIPE_DIR%\numba-3016.ll REM if %ERRORLEVEL% neq 0 exit 1 -cd ..\llvm\test +pushd ..\llvm\test python ..\..\build\bin\llvm-lit.py -vv Transforms ExecutionEngine Analysis CodeGen/X86 +popd + +:: install everything (will be sliced & diced in meta.yaml) +cmake --install . --prefix=%LIBRARY_PREFIX% +if %ERRORLEVEL% neq 0 exit 1 + +:: upstream picks up diaguids.lib from the windows image, see +:: https://github.com/llvm/llvm-project/blob/llvmorg-14.0.6/llvm/lib/DebugInfo/PDB/CMakeLists.txt#L17 +:: which ultimately derives from VSINSTALLDIR, see +:: https://github.com/llvm/llvm-project/blob/llvmorg-14.0.6/llvm/cmake/config-ix.cmake#L516 +:: and gets hardcoded by CMake to point to the path in our windows image. +:: This makes it non-portable between image versions (e.g. 2019 vs 2022), so replace +:: the hardcoded path with a variable again +sed -i "s,C:/Program Files/Microsoft Visual Studio/2022/Enterprise,$ENV{VSINSTALLDIR},g" %LIBRARY_LIB%\cmake\llvm\LLVMExports.cmake diff --git a/recipe/build.sh b/recipe/build.sh index 615dc40b..e0e7a44f 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -81,3 +81,23 @@ if [[ "$target_platform" == "linux-64" ]]; then cd ../llvm/test python ../../build/bin/llvm-lit -vv Transforms ExecutionEngine Analysis CodeGen/X86 fi + +# install everything (will be sliced & diced in meta.yaml) +cmake --install . --prefix=$PREFIX + +# install again in separate folder so we can handle llvm binaries +# separately from whatever else is already in $PREFIX/bin +mkdir temp_prefix +cmake --install . --prefix=./temp_prefix + +IFS='.' read -ra VER_ARR <<< "$PKG_VERSION" + +cd ./temp_prefix +for f in bin/*; do + # remove already installed binary + rm $PREFIX/bin/$(basename $f) + # version the binary + mv $f $PREFIX/bin/$(basename $f)-${VER_ARR[0]} + # create symlink from unversioned to versioned + ln -sf $PREFIX/bin/$(basename $f)-${VER_ARR[0]} $PREFIX/bin/$(basename $f) +done diff --git a/recipe/install_llvm.bat b/recipe/install_llvm.bat deleted file mode 100644 index dc0fc64f..00000000 --- a/recipe/install_llvm.bat +++ /dev/null @@ -1,36 +0,0 @@ -@echo on - -:: temporary prefix to be able to install files more granularly -mkdir temp_prefix - -if "%PKG_NAME%" == "libllvm-c%PKG_VERSION:~0,2%" ( - cmake --install .\build --prefix=.\temp_prefix - if %ERRORLEVEL% neq 0 exit 1 - REM only libLLVM-C - move .\temp_prefix\bin\LLVM-C.dll %LIBRARY_BIN% - move .\temp_prefix\lib\LLVM-C.lib %LIBRARY_LIB% -) else if "%PKG_NAME%" == "llvm-tools" ( - cmake --install ./build --prefix=./temp_prefix - if %ERRORLEVEL% neq 0 exit 1 - - mkdir %LIBRARY_PREFIX%\share - REM all the executables (not .dll's) in \bin & everything in \share - move .\temp_prefix\bin\*.exe %LIBRARY_BIN% - move .\temp_prefix\share\* %LIBRARY_PREFIX%\share - del %LIBRARY_BIN%\llvm-config.exe -) else ( - REM llvmdev: everything else - cmake --install .\build --prefix=%LIBRARY_PREFIX% - if %ERRORLEVEL% neq 0 exit 1 - - REM upstream picks up diaguids.lib from the windows image, see - REM https://github.com/llvm/llvm-project/blob/llvmorg-14.0.6/llvm/lib/DebugInfo/PDB/CMakeLists.txt#L17 - REM which ultimately derives from VSINSTALLDIR, see - REM https://github.com/llvm/llvm-project/blob/llvmorg-14.0.6/llvm/cmake/config-ix.cmake#L516 - REM and gets hardcoded by CMake to point to the path in our windows image. - REM This makes it non-portable between image versions (e.g. 2019 vs 2022), so replace - REM the hardcoded path with a variable again - sed -i "s,C:/Program Files/Microsoft Visual Studio/2022/Enterprise,$ENV{VSINSTALLDIR},g" %LIBRARY_LIB%\cmake\llvm\LLVMExports.cmake -) - -rmdir /s /q temp_prefix diff --git a/recipe/install_llvm.sh b/recipe/install_llvm.sh deleted file mode 100644 index ee47f881..00000000 --- a/recipe/install_llvm.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -set -ex - -IFS='.' read -ra VER_ARR <<< "$PKG_VERSION" - -# temporary prefix to be able to install files more granularly -mkdir temp_prefix - -MAJOR_EXT="${VER_ARR[0]}" -# default SOVER for tagged releases is major.minor version -SOVER_EXT="${VER_ARR[0]}.${VER_ARR[1]}" -# for rc's, both MAJOR_EXT & SOVER_EXT get suffixes -if [[ "${PKG_VERSION}" == *rc* ]]; then - # rc's get "rc" without the number - MAJOR_EXT="${MAJOR_EXT}rc" - SOVER_EXT="${SOVER_EXT}rc" -elif [[ "${PKG_VERSION}" == *dev0 ]]; then - # otherwise with git suffix - MAJOR_EXT="${MAJOR_EXT}git" - SOVER_EXT="${SOVER_EXT}git" -fi - -if [[ "${PKG_NAME}" == libllvm-c* ]]; then - cmake --install ./build --prefix=./temp_prefix - # only libLLVM-C - mv ./temp_prefix/lib/libLLVM-C${SOVER_EXT}${SHLIB_EXT} $PREFIX/lib -elif [[ "${PKG_NAME}" == libllvm* ]]; then - cmake --install ./build --prefix=./temp_prefix - # all other libraries - mv ./temp_prefix/lib/libLLVM-${MAJOR_EXT}${SHLIB_EXT} $PREFIX/lib - mv ./temp_prefix/lib/lib*.so.${SOVER_EXT} $PREFIX/lib || true - mv ./temp_prefix/lib/lib*.${SOVER_EXT}.dylib $PREFIX/lib || true -elif [[ "${PKG_NAME}" == "llvm-tools-${MAJOR_EXT}" ]]; then - cmake --install ./build --prefix=./temp_prefix - # install all binaries with a -${MAJOR_EXT} - pushd ./temp_prefix - for f in bin/*; do - cp $f $PREFIX/bin/$(basename $f)-${MAJOR_EXT} - done - popd - # except one binary that belongs to llvmdev - rm $PREFIX/bin/llvm-config-${MAJOR_EXT} -elif [[ "${PKG_NAME}" == "llvm-tools" ]]; then - cmake --install ./build --prefix=./temp_prefix - # Install a symlink without the major version - pushd ./temp_prefix - for f in bin/*; do - ln -sf $PREFIX/bin/$(basename $f)-${MAJOR_EXT} $PREFIX/bin/$(basename $f) - done - popd - # opt-viewer tool - mv ./temp_prefix/share/* $PREFIX/share - rm $PREFIX/bin/llvm-config -else - # llvmdev: install everything else - cmake --install ./build --prefix=$PREFIX -fi - -rm -rf temp_prefix diff --git a/recipe/meta.yaml b/recipe/meta.yaml index e6d2f790..88fbaf01 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -44,23 +44,15 @@ requirements: outputs: # Contains everything - name: llvmdev - script: install_llvm.sh # [unix] - script: install_llvm.bat # [win] - build: - activate_in_script: true + files: + include: + # everything not already in other outputs + - "*" requirements: - build: - - {{ stdlib('c') }} - - {{ compiler('cxx') }} - - cmake - - ninja - - python >=3 - - m2-sed # [win] - - libcxx {{ cxx_compiler_version }} # [osx] host: - - libcxx {{ cxx_compiler_version }} # [osx] - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} - {{ pin_subpackage("libllvm-c" ~ major_ver, exact=True) }} # [win] + - {{ pin_subpackage("llvm-tools" ~ major_ver, exact=True) }} # [unix] - {{ pin_subpackage("llvm-tools", exact=True) }} - zlib - zstd @@ -96,21 +88,18 @@ outputs: # Contains the shared libraries. To make different LLVM libraries co-installable # soversion is appended to the package name. - name: libllvm{{ major_ver }} - script: install_llvm.sh # [not win] build: - activate_in_script: true run_exports: # [not win] - {{ pin_subpackage("libllvm" ~ major_ver, max_pin="x.x") }} # [not win] + files: + include: + - lib/lib* # [unix] + exclude: + # separate output, see below + - lib/libLLVM-C.* # [unix] + - Library/**/libLLVM-C.* # [win] requirements: - build: - - {{ stdlib('c') }} - - {{ compiler('cxx') }} - - ninja # [not win] - - cmake # [not win] - - python >=3 # [not win] - - libcxx {{ cxx_compiler_version }} # [osx] host: - - libcxx {{ cxx_compiler_version }} # [osx] - libxml2 # [unix] - zlib - zstd @@ -152,24 +141,19 @@ outputs: # Contains LLVM tools with a version suffix - name: llvm-tools-{{ major_ver }} - script: install_llvm.sh # [unix] - script: install_llvm.bat # [win] build: - activate_in_script: true # On Windows there are no symlinks and copying will create a new package # that is 300MB+ skip: true # [win] + files: + include: + - bin/*-{{ major_ver }} # [unix] + exclude: + # belongs into llvmdev + - bin/llvm-config* # [unix] requirements: - build: - - {{ stdlib('c') }} - - {{ compiler('cxx') }} - - cmake - - ninja - - python >=3 - - libcxx {{ cxx_compiler_version }} # [osx] host: - libcxx {{ cxx_compiler_version }} # [osx] - - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} - libxml2 - zlib - zstd @@ -189,20 +173,19 @@ outputs: # Contains LLVM tools - name: llvm-tools - script: install_llvm.sh # [unix] - script: install_llvm.bat # [win] - build: - activate_in_script: true + files: + include: + # opt-viewer tool is in share + - bin/* # [unix] + - share/* # [unix] + - Library/bin/*.exe # [win] + - Library/share/* # [win] + exclude: + # belongs into llvmdev + - bin/llvm-config* # [unix] + - Library/bin/llvm-config* # [win] requirements: - build: - - {{ stdlib('c') }} - - {{ compiler('cxx') }} - - cmake - - ninja - - python >=3 - - libcxx {{ cxx_compiler_version }} # [osx] host: - - libcxx {{ cxx_compiler_version }} # [osx] - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [not win] - libxml2 # [win] @@ -228,33 +211,25 @@ outputs: # Contains LLVM-C shared library - name: libllvm-c{{ major_ver }} - script: install_llvm.sh # [unix] - script: install_llvm.bat # [win] build: run_exports: - {{ pin_subpackage("libllvm-c" ~ major_ver, max_pin="x.x") }} - activate_in_script: true # not supported on linux, see # https://github.com/llvm/llvm-project/blob/llvmorg-16.0.6/llvm/tools/llvm-shlib/CMakeLists.txt#L82-L85 # osx currently fails as well, see https://github.com/llvm/llvm-project/issues/64657 skip: true # [not win] + files: + include: + - Library/bin/libLLVM-C.dll # [win] + - Library/lib/libLLVM-C.lib # [win] requirements: - build: - - {{ stdlib('c') }} - - {{ compiler('cxx') }} - - cmake - - ninja - - libcxx {{ cxx_compiler_version }} # [osx] host: - - libcxx {{ cxx_compiler_version }} # [osx] - - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} - zlib - zstd run_constrained: - llvmdev {{ version }} test: commands: - - test -f $PREFIX/lib/libLLVM-C.{{ major_ver }}.dylib # [osx] - if not exist %LIBRARY_BIN%\LLVM-C.dll exit 1 # [win] - if not exist %LIBRARY_LIB%\LLVM-C.lib exit 1 # [win] From 203d17a06061acffcb714b592846a0263599c735 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 11 Aug 2024 19:52:24 +1100 Subject: [PATCH 4/5] naming --- recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 88fbaf01..5c7c133b 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -52,7 +52,7 @@ outputs: host: - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} - {{ pin_subpackage("libllvm-c" ~ major_ver, exact=True) }} # [win] - - {{ pin_subpackage("llvm-tools" ~ major_ver, exact=True) }} # [unix] + - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [unix] - {{ pin_subpackage("llvm-tools", exact=True) }} - zlib - zstd From 2903d9519af583ad5fe98a200c3c0bc7ecee7917 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Mon, 12 Aug 2024 07:02:54 +1100 Subject: [PATCH 5/5] fixes --- recipe/meta.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 5c7c133b..10322f4f 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -32,6 +32,7 @@ requirements: - cmake - ninja - python >=3 + - m2-sed # [win] - libcxx {{ cxx_compiler_version }} # [osx] host: - libcxx {{ cxx_compiler_version }} # [osx] @@ -52,7 +53,7 @@ outputs: host: - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} - {{ pin_subpackage("libllvm-c" ~ major_ver, exact=True) }} # [win] - - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [unix] + - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [unix] - {{ pin_subpackage("llvm-tools", exact=True) }} - zlib - zstd @@ -99,6 +100,10 @@ outputs: - lib/libLLVM-C.* # [unix] - Library/**/libLLVM-C.* # [win] requirements: + build: + # for run-exports + - {{ stdlib('c') }} + - {{ compiler('cxx') }} host: - libxml2 # [unix] - zlib @@ -152,6 +157,10 @@ outputs: # belongs into llvmdev - bin/llvm-config* # [unix] requirements: + build: + # for run-exports + - {{ stdlib('c') }} + - {{ compiler('cxx') }} host: - libcxx {{ cxx_compiler_version }} # [osx] - libxml2