Skip to content

Commit 92d98f7

Browse files
authored
Merge pull request #16 from aminya/linux-deps [skip ci]
2 parents 4a419e6 + 2c63db7 commit 92d98f7

File tree

8 files changed

+43
-20
lines changed

8 files changed

+43
-20
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ FROM debian:bullseye
172172
# add setup_cpp
173173
WORKDIR "/"
174174
RUN apt-get update -qq
175-
RUN apt-get install -y --no-install-recommends apt-utils
176-
RUN apt-get install -y --no-install-recommends ca-certificates wget unzip
175+
RUN apt-get install -y --no-install-recommends wget
177176
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.5.5/setup_cpp_linux"
178177
RUN chmod +x ./setup_cpp_linux
179178

building/docker/debian.dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ FROM debian:bullseye
44
# add setup_cpp
55
WORKDIR "/"
66
RUN apt-get update -qq
7-
RUN apt-get install -y --no-install-recommends apt-utils
8-
RUN apt-get install -y --no-install-recommends ca-certificates wget unzip
7+
RUN apt-get install -y --no-install-recommends wget
98
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.5.5/setup_cpp_linux"
109
RUN chmod +x ./setup_cpp_linux
1110

building/docker/debian_node_slim.dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ FROM node:16-slim
55
ADD "./dist/" "/"
66
WORKDIR "/"
77

8-
# install unzip for the slim image (a standard debian already has it)
9-
RUN apt-get update -qq
10-
RUN apt-get install -y --no-install-recommends unzip
11-
128
# run installation
139
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --conan true --vcpkg true
1410

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/llvm/llvm.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
99
import { addBinExtension } from "../utils/extension/extension"
1010
import { addEnv } from "../utils/env/addEnv"
1111
import { setOutput } from "@actions/core"
12+
import { setupAptPack } from "../utils/setup/setupAptPack"
1213

1314
//================================================
1415
// Version
@@ -246,6 +247,11 @@ export async function setupLLVM(
246247
}
247248

248249
export async function activateLLVM(directory: string, versionGiven: string) {
250+
if (process.platform === "linux") {
251+
// install llvm build dependencies
252+
await setupAptPack("build-essential") // TODO(question) llvm needs ld. But does it need all the build-essential?
253+
}
254+
249255
const version = semverCoerceIfInvalid(versionGiven)
250256

251257
const lib = path.join(directory, "lib")

src/utils/setup/setupAptPack.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { InstallationInfo } from "./setupBin"
33
import { execaSudo } from "../env/sudo"
44

55
let didUpdate: boolean = false
6+
let didInit: boolean = false
67

78
/** A function that installs a package using apt */
89
export async function setupAptPack(
@@ -12,16 +13,36 @@ export async function setupAptPack(
1213
): Promise<InstallationInfo> {
1314
const apt = "apt-get"
1415

16+
process.env.DEBIAN_FRONTEND = "noninteractive"
17+
18+
if (!didUpdate) {
19+
await execaSudo(apt, ["update", "-y"])
20+
didUpdate = true
21+
}
22+
23+
if (!didInit) {
24+
// install apt utils and certificates (usually missing from docker containers)
25+
// set time - zone
26+
// TZ = Canada / Pacific
27+
// ln - snf / usr / share / zoneinfo / $TZ / etc / localtime && echo $TZ > /etc/timezone
28+
await execaSudo(apt, [
29+
"install",
30+
"--fix-broken",
31+
"-y",
32+
"software-properties-common",
33+
"apt-utils",
34+
"ca-certificates",
35+
"gnupg",
36+
])
37+
didInit = true
38+
}
39+
1540
if (Array.isArray(repositories)) {
1641
for (const repo of repositories) {
1742
// eslint-disable-next-line no-await-in-loop
1843
await execaSudo("add-apt-repository", ["--update", "-y", repo])
1944
}
20-
}
21-
22-
if (!didUpdate || repositories === true) {
2345
await execaSudo(apt, ["update", "-y"])
24-
didUpdate = true
2546
}
2647

2748
if (version !== undefined && version !== "") {

src/vcpkg/vcpkg.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@ let hasVCPKG = false
1212
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1313
export async function setupVcpkg(_version: string, setupDir: string, _arch: string): Promise<InstallationInfo> {
1414
if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) {
15-
if (!existsSync(join(setupDir, addShellExtension("bootstrap-vcpkg")))) {
16-
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir) })
17-
} else {
18-
warning(`Vcpkg folder already exists at ${setupDir}`)
19-
}
20-
2115
if (process.platform === "linux") {
2216
// vcpkg download and extraction dependencies
2317
await setupAptPack("curl")
2418
await setupAptPack("zip")
2519
await setupAptPack("unzip")
2620
await setupAptPack("tar")
21+
await setupAptPack("git")
22+
await setupAptPack("pkg-config")
23+
}
24+
25+
if (!existsSync(join(setupDir, addShellExtension("bootstrap-vcpkg")))) {
26+
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir) })
27+
} else {
28+
warning(`Vcpkg folder already exists at ${setupDir}`)
2729
}
2830

2931
execa.sync(addShellExtension(addShellHere("bootstrap-vcpkg")), { cwd: setupDir, shell: true })

0 commit comments

Comments
 (0)