File tree Expand file tree Collapse file tree 2 files changed +56
-2
lines changed
Expand file tree Collapse file tree 2 files changed +56
-2
lines changed Original file line number Diff line number Diff line change 88
99env :
1010 CARGO_TERM_COLOR : always
11+ LLVM_VERSION : 21
1112
1213jobs :
1314 build :
14-
1515 runs-on : ubuntu-latest
1616
1717 steps :
18- - uses : actions/checkout@v4
18+ - name : Checkout
19+ uses : actions/checkout@v4
20+
21+ - name : Install LLVM
22+ run : |-
23+ LLVM_MAJOR_VERSION=21
24+
25+ sudo apt-cache update
26+
27+ wget https://apt.llvm.org/llvm.sh
28+ chmod +x llvm.sh
29+ sudo ./llvm.sh "${LLVM_VERSION}"
30+ rm llvm.sh
31+
32+ # Point llvm-config to llvm-config-$LLVM_VERSION so Rust doesn't whinge about it
33+ sudo ln -sf "$(command -v "llvm-config-${LLVM_VERSION}")" /usr/bin/llvm-config
34+
35+ llvm-config --version
36+
1937 - name : Build
2038 run : cargo build --verbose
39+
2140 - name : Run tests
2241 run : cargo test --verbose
Original file line number Diff line number Diff line change 1+ // Attempt to avoid pain with LLVM, probably.
2+ fn main ( ) {
3+ let output = std:: process:: Command :: new ( "llvm-config" )
4+ . arg ( "--prefix" )
5+ . output ( )
6+ . expect ( r#"
7+ Failed to run llvm-config. Is llvm-devel installed?
8+
9+ Try one of the following:
10+
11+ # Fedora
12+ - sudo dnf install llvm-devel clang-devel libffi-devel
13+
14+ # Ubuntu
15+ - wget https://apt.llvm.org/llvm.sh
16+ chmod +x llvm.sh
17+ sudo ./llvm.sh 21
18+ rm llvm.sh
19+ "# ) ;
20+
21+ let prefix = std:: str:: from_utf8 ( & output. stdout ) . unwrap ( ) . trim ( ) ;
22+
23+ let version_output = std:: process:: Command :: new ( "llvm-config" )
24+ . arg ( "--version" )
25+ . output ( )
26+ . unwrap ( ) ;
27+
28+ let version = std:: str:: from_utf8 ( & version_output. stdout ) . unwrap ( ) ;
29+ let major_version = version. split ( '.' ) . next ( ) . unwrap ( ) ;
30+
31+ // This turns "21.x.x" into "LLVM_SYS_211_PREFIX"
32+ println ! ( "cargo:rustc-env=LLVM_SYS_{}1_PREFIX={}" , major_version, prefix) ;
33+
34+ println ! ( "cargo:rustc-link-search=native={}/lib" , prefix) ;
35+ }
You can’t perform that action at this time.
0 commit comments