Skip to content

Commit

Permalink
switch to conda-build's new file include/exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Aug 11, 2024
1 parent eba5665 commit 09dfb3e
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 154 deletions.
16 changes: 15 additions & 1 deletion recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 20 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
36 changes: 0 additions & 36 deletions recipe/install_llvm.bat

This file was deleted.

59 changes: 0 additions & 59 deletions recipe/install_llvm.sh

This file was deleted.

91 changes: 33 additions & 58 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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]

Expand Down

0 comments on commit 09dfb3e

Please sign in to comment.