fix: install implicit linux dependencies

This commit is contained in:
Amin Yahyaabadi 2022-01-19 11:15:21 -08:00
parent ba55ef6ce0
commit e5f4cd37ed
7 changed files with 27 additions and 7 deletions

View File

@ -6,11 +6,11 @@ WORKDIR "/"
RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends apt-utils
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.2/setup_cpp_linux"
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.5.4/setup_cpp_linux"
RUN chmod +x ./setup_cpp_linux
# install llvm, cmake, ninja, and ccache
RUN ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true
RUN ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
# reload the environment
CMD source ~/.profile

View File

@ -6,7 +6,7 @@ ADD "./dist/" "/"
WORKDIR "/"
# run installation
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
# reload the environment
CMD source ~/.profile

View File

@ -10,7 +10,7 @@ RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends unzip
# run installation
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --conan true
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --conan true --vcpkg true
# reload the environment
CMD source ~/.profile

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

@ -5,6 +5,7 @@ import { join } from "path"
import { existsSync } from "fs"
import { tmpdir } from "os"
import { isGitHubCI } from "../env/isci"
import { setupAptPack } from "./setupAptPack"
/** A type that describes a package */
export type PackageInfo = {
@ -76,6 +77,14 @@ export async function setupBin(
// download ane extract the package into the installation directory.
if (!existsSync(binDir) || !existsSync(binFile)) {
info(`Download and extract ${name} ${version}`)
if (process.platform === "linux") {
// extraction dependencies
await setupAptPack("unzip")
await setupAptPack("tar")
await setupAptPack("xz-utils")
}
const downloaded = await downloadTool(url)
await extractFunction?.(downloaded, setupDir)
}

View File

@ -4,20 +4,31 @@ import { existsSync } from "fs"
import { dirname, join } from "path"
import which from "which"
import { addShellExtension, addShellHere } from "../utils/extension/extension"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { InstallationInfo } from "../utils/setup/setupBin"
let hasVCPKG = false
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupVcpkg(_version: string, setupDir: string, _arch: string): InstallationInfo {
export async function setupVcpkg(_version: string, setupDir: string, _arch: string): Promise<InstallationInfo> {
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") {
// vcpkg download and extraction dependencies
await setupAptPack("curl")
await setupAptPack("zip")
await setupAptPack("unzip")
await setupAptPack("tar")
}
execa.sync(addShellExtension(addShellHere("bootstrap-vcpkg")), { cwd: setupDir, shell: true })
addPath(setupDir)
// eslint-disable-next-line require-atomic-updates
hasVCPKG = true
return { binDir: setupDir }
}