diff --git a/recipe/install_llvm.bat b/recipe/install_llvm.bat index b87e4cab..dc0fc64f 100644 --- a/recipe/install_llvm.bat +++ b/recipe/install_llvm.bat @@ -17,6 +17,7 @@ if "%PKG_NAME%" == "libllvm-c%PKG_VERSION:~0,2%" ( 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% diff --git a/recipe/install_llvm.sh b/recipe/install_llvm.sh index 20a99dd2..ee47f881 100644 --- a/recipe/install_llvm.sh +++ b/recipe/install_llvm.sh @@ -30,12 +30,26 @@ elif [[ "${PKG_NAME}" == libllvm* ]]; then 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 - # everything in /bin & /share - mv ./temp_prefix/bin/* $PREFIX/bin + # 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 - # except one binary that belongs to llvmdev rm $PREFIX/bin/llvm-config else # llvmdev: install everything else diff --git a/recipe/meta.yaml b/recipe/meta.yaml index deb5b46c..ee39d76b 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -22,7 +22,7 @@ source: - patches/0002-lljit-respect-codemodel.patch build: - number: 1 + number: 2 merge_build_host: false requirements: @@ -149,6 +149,41 @@ outputs: commands: - echo "Hello World!" + # 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] + 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 + run: + - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + test: + commands: + - $PREFIX/bin/llc-{{ major_ver }} -version # [not win] + # The test for windows is split into two lines instead of having it in one line + # like its unix variant because of a YAML parsing issue. + - if not exist "%LIBRARY_BIN%"\\llc-{{ major_ver }}.exe exit 1 # [win] + - llc-{{ major_ver }} -version # [win] + - test ! -f $PREFIX/bin/llvm-config-{{ major_ver }} # [not win] + - if exist "%LIBRARY_BIN%"\\llvm-config-{{ major_ver }}.exe exit 1 # [win] + # Contains LLVM tools - name: llvm-tools script: install_llvm.sh # [unix] @@ -166,11 +201,13 @@ outputs: host: - libcxx {{ cxx_compiler_version }} # [osx] - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [not win] - libxml2 - zlib - zstd run: - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [not win] run_constrained: - llvm {{ version }} - llvmdev {{ version }} @@ -179,8 +216,12 @@ outputs: test: commands: - $PREFIX/bin/llc -version # [not win] + # The test for windows is split into two lines instead of having it in one line + # like its unix variant because of a YAML parsing issue. - if not exist "%LIBRARY_BIN%"\\llc.exe exit 1 # [win] - llc -version # [win] + - test ! -f $PREFIX/bin/llvm-config # [not win] + - if exist "%LIBRARY_BIN%"\\llvm-config.exe exit 1 # [win] # Contains LLVM-C shared library - name: libllvm-c{{ major_ver }}