Merge pull request #16 from aminya/linux-deps [skip ci]

This commit is contained in:
Amin Yahyaabadi 2022-01-19 16:30:01 -08:00 committed by GitHub
commit 92d98f746a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 20 deletions

View File

@ -172,8 +172,7 @@ FROM debian:bullseye
# add setup_cpp # add setup_cpp
WORKDIR "/" WORKDIR "/"
RUN apt-get update -qq RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends apt-utils RUN apt-get install -y --no-install-recommends wget
RUN apt-get install -y --no-install-recommends ca-certificates wget unzip
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.5.5/setup_cpp_linux" RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.5.5/setup_cpp_linux"
RUN chmod +x ./setup_cpp_linux RUN chmod +x ./setup_cpp_linux

View File

@ -4,8 +4,7 @@ FROM debian:bullseye
# add setup_cpp # add setup_cpp
WORKDIR "/" WORKDIR "/"
RUN apt-get update -qq RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends apt-utils RUN apt-get install -y --no-install-recommends wget
RUN apt-get install -y --no-install-recommends ca-certificates wget unzip
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.5.5/setup_cpp_linux" RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.5.5/setup_cpp_linux"
RUN chmod +x ./setup_cpp_linux RUN chmod +x ./setup_cpp_linux

View File

@ -5,10 +5,6 @@ FROM node:16-slim
ADD "./dist/" "/" ADD "./dist/" "/"
WORKDIR "/" WORKDIR "/"
# install unzip for the slim image (a standard debian already has it)
RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends unzip
# run installation # run installation
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --conan true --vcpkg true RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --conan true --vcpkg true

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,6 +9,7 @@ import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import { addBinExtension } from "../utils/extension/extension" import { addBinExtension } from "../utils/extension/extension"
import { addEnv } from "../utils/env/addEnv" import { addEnv } from "../utils/env/addEnv"
import { setOutput } from "@actions/core" import { setOutput } from "@actions/core"
import { setupAptPack } from "../utils/setup/setupAptPack"
//================================================ //================================================
// Version // Version
@ -246,6 +247,11 @@ export async function setupLLVM(
} }
export async function activateLLVM(directory: string, versionGiven: string) { export async function activateLLVM(directory: string, versionGiven: string) {
if (process.platform === "linux") {
// install llvm build dependencies
await setupAptPack("build-essential") // TODO(question) llvm needs ld. But does it need all the build-essential?
}
const version = semverCoerceIfInvalid(versionGiven) const version = semverCoerceIfInvalid(versionGiven)
const lib = path.join(directory, "lib") const lib = path.join(directory, "lib")

View File

@ -3,6 +3,7 @@ import { InstallationInfo } from "./setupBin"
import { execaSudo } from "../env/sudo" import { execaSudo } from "../env/sudo"
let didUpdate: boolean = false let didUpdate: boolean = false
let didInit: boolean = false
/** A function that installs a package using apt */ /** A function that installs a package using apt */
export async function setupAptPack( export async function setupAptPack(
@ -12,16 +13,36 @@ export async function setupAptPack(
): Promise<InstallationInfo> { ): Promise<InstallationInfo> {
const apt = "apt-get" const apt = "apt-get"
process.env.DEBIAN_FRONTEND = "noninteractive"
if (!didUpdate) {
await execaSudo(apt, ["update", "-y"])
didUpdate = true
}
if (!didInit) {
// install apt utils and certificates (usually missing from docker containers)
// set time - zone
// TZ = Canada / Pacific
// ln - snf / usr / share / zoneinfo / $TZ / etc / localtime && echo $TZ > /etc/timezone
await execaSudo(apt, [
"install",
"--fix-broken",
"-y",
"software-properties-common",
"apt-utils",
"ca-certificates",
"gnupg",
])
didInit = true
}
if (Array.isArray(repositories)) { if (Array.isArray(repositories)) {
for (const repo of repositories) { for (const repo of repositories) {
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
await execaSudo("add-apt-repository", ["--update", "-y", repo]) await execaSudo("add-apt-repository", ["--update", "-y", repo])
} }
}
if (!didUpdate || repositories === true) {
await execaSudo(apt, ["update", "-y"]) await execaSudo(apt, ["update", "-y"])
didUpdate = true
} }
if (version !== undefined && version !== "") { if (version !== undefined && version !== "") {

View File

@ -12,18 +12,20 @@ let hasVCPKG = false
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupVcpkg(_version: string, setupDir: string, _arch: string): Promise<InstallationInfo> { export async function setupVcpkg(_version: string, setupDir: string, _arch: string): Promise<InstallationInfo> {
if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) { if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) {
if (!existsSync(join(setupDir, addShellExtension("bootstrap-vcpkg")))) {
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir) })
} else {
warning(`Vcpkg folder already exists at ${setupDir}`)
}
if (process.platform === "linux") { if (process.platform === "linux") {
// vcpkg download and extraction dependencies // vcpkg download and extraction dependencies
await setupAptPack("curl") await setupAptPack("curl")
await setupAptPack("zip") await setupAptPack("zip")
await setupAptPack("unzip") await setupAptPack("unzip")
await setupAptPack("tar") await setupAptPack("tar")
await setupAptPack("git")
await setupAptPack("pkg-config")
}
if (!existsSync(join(setupDir, addShellExtension("bootstrap-vcpkg")))) {
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir) })
} else {
warning(`Vcpkg folder already exists at ${setupDir}`)
} }
execa.sync(addShellExtension(addShellHere("bootstrap-vcpkg")), { cwd: setupDir, shell: true }) execa.sync(addShellExtension(addShellHere("bootstrap-vcpkg")), { cwd: setupDir, shell: true })