Skip to content

Commit

Permalink
Merge pull request #282 from isuruf/versioned-tools
Browse files Browse the repository at this point in the history
version suffixed LLVM tools
  • Loading branch information
h-vetinari authored Aug 9, 2024
2 parents d552ed5 + 8cde7cc commit b6ead7f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
1 change: 1 addition & 0 deletions recipe/install_llvm.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand Down
20 changes: 17 additions & 3 deletions recipe/install_llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 42 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ source:
- patches/0002-lljit-respect-codemodel.patch

build:
number: 1
number: 2
merge_build_host: false

requirements:
Expand Down Expand Up @@ -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]
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand Down

0 comments on commit b6ead7f

Please sign in to comment.