-
Notifications
You must be signed in to change notification settings - Fork 6
/
mingw_gcc.js
68 lines (59 loc) · 1.76 KB
/
mingw_gcc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const gcc = {
'9.2.0-2': [
'expat-2.2.9-1',
'libiconv-1.16-1',
'zlib-1.2.11-7',
'binutils-2.34-1',
'headers-git-8.0.0.5647.1fe2e62e-1',
'crt-git-8.0.0.5647.1fe2e62e-1',
'dlfcn-1.2.0-1',
'gmp-6.2.0-1',
'isl-0.22.1-1',
'libwinpthread-git-8.0.0.5574.33e5a2ac-1',
'make-4.3-1',
'mpc-1.1.0-1',
'mpfr-4.0.2-2',
'windows-default-manifest-6.4-3',
'winpthreads-git-8.0.0.5574.33e5a2ac-1',
'gcc-libs-9.2.0-2',
'gcc-9.2.0-2'
]
}
export const run = async (rubyVers) => {
const fs = require('fs')
const core = require('@actions/core')
const { download, execSync } = require('./common')
const uriBase = 'https://github.com/MSP-Greg/ruby-msys2-package-archive/releases/download'
const pre64 = 'mingw-w64-x86_64-'
const suff = '-any.pkg.tar.xz'
const args = '--noconfirm --noprogressbar --needed --disable-download-timeout'
let mingwFiles
let uri
if (rubyVers > '2.0') {
mingwFiles = gcc['9.2.0-2']
uri = `${uriBase}/gcc-9.2.0-2`
}
const dir = `${process.env.RUNNER_TEMP}\\msys2_gcc`
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true })
}
// download gcc files from release
const len = mingwFiles.length
for (let i = 0; i < len; i++) {
let f = `${pre64}${mingwFiles[i]}${suff}`
await download(`${uri}/${f}` , `${dir}\\${f}`)
await download(`${uri}/${f}.sig`, `${dir}\\${f}.sig`)
console.log(`downloaded ${f}`)
}
const cwd = process.cwd()
const pkgs = mingwFiles.map(f => `${pre64}${f}${suff}`).join(' ')
console.log(`pacman.exe -Udd ${args} ${pkgs}`)
try {
process.chdir(dir)
execSync(`pacman.exe -Udd ${args} ${pkgs}`)
process.chdir(cwd)
} catch (error) {
process.chdir(cwd)
core.setFailed(error.message)
}
}