@@ -33,45 +33,26 @@ export async function execute(cmd) {
33
33
const installScript = path . join ( __dirname , "../scripts/install_llvm.sh" ) ;
34
34
await exec . exec ( `sudo ${ installScript } ` ) ;
35
35
} else if ( isMacOS ) {
36
- await exec . exec ( "brew install llvm@16" )
37
- let llvmPath = await execute ( "brew --prefix llvm@16" ) ;
38
36
let libpath = await execute ( "brew --prefix zstd" ) ;
39
- core . addPath ( `${ llvmPath } /bin` )
40
37
core . exportVariable ( 'LIBRARY_PATH' , `${ libpath } /lib` )
38
+
39
+ await exec . exec ( "sudo port install llvm-18" )
40
+ let llvmPath = await execute ( "port contents llvm-18 | grep bin | head -n 1" )
41
+ core . addPath ( llvmPath )
42
+
43
+
44
+
41
45
// core.exportVariable('LLVM_SYS_160_PREFIX', `${llvmPath}`)
42
46
} else if ( isWindows ) {
43
- const downloadUrl = "https://github.com/mun-lang /llvm-package-windows /releases/download/v16.0.5/ llvm-16.0.5-windows-x64-msvc17-mt.7z "
47
+ const downloadUrl = "https://github.com/llvm /llvm-project /releases/download/llvmorg-18.1.0/clang+ llvm-18.1.0-x86_64-pc-windows-msvc.tar.xz "
44
48
core . info ( `downloading LLVM from '${ downloadUrl } '` )
45
49
const downloadLocation = await tc . downloadTool ( downloadUrl ) ;
46
50
47
- core . info ( "Succesfully downloaded LLVM release, extracting..." )
48
- const llvmPath = "C:\\llvm" ;
49
- const _7zPath = path . join ( __dirname , '..' , 'externals' , '7zr.exe' ) ;
50
- let attempt = 1 ;
51
- while ( true ) {
52
- const args = [
53
- "x" , // extract
54
- downloadLocation ,
55
- `-o${ llvmPath } `
56
- ]
57
- const exit = await exec . exec ( _7zPath , args ) ;
58
- if ( exit === 2 && attempt <= 4 ) {
59
- attempt += 1 ;
60
- console . error ( `Error extracting LLVM release, retrying attempt #${ attempt } after 1s..` )
61
- await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
62
- }
63
- else if ( exit !== 0 ) {
64
- throw new Error ( "Could not extract LLVM and Clang binaries." ) ;
65
- }
66
- else {
67
- core . info ( "Succesfully extracted LLVM release" )
68
- break ;
69
- }
70
- }
71
-
51
+ // extract package
52
+ const llvmPath = await tc . extractTar ( downloadLocation ) ;
72
53
core . addPath ( `${ llvmPath } \\bin` )
73
54
core . exportVariable ( 'LIBCLANG_PATH' , `${ llvmPath } \\bin` )
74
- // core.exportVariable('LLVM_SYS_160_PREFIX ', `${llvmPath}`)
55
+ // core.exportVariable('LLVM_SYS_180_PREFIX ', `${llvmPath}`)
75
56
} else {
76
57
core . setFailed ( `unsupported platform '${ process . platform } '` )
77
58
}
0 commit comments