Skip to content

Commit 2ee99e2

Browse files
committed
fix: install cmake/ninja via system for alpine
1 parent 0730cb5 commit 2ee99e2

File tree

6 files changed

+34
-6
lines changed

6 files changed

+34
-6
lines changed

dist/legacy/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/legacy/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.

dist/modern/setup-cpp.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.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/cmake/cmake.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { info } from "ci-log"
22
import { addExeExt } from "patha"
33
import semverCoerce from "semver/functions/coerce"
44
import semverLte from "semver/functions/lte"
5+
import { hasApk, installApkPack } from "setup-alpine"
56
import { arm64, x86, x86_64 } from "../utils/env/arch.js"
67
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
78

@@ -66,6 +67,15 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
6667
}
6768

6869
/** Setup cmake */
69-
export function setupCmake(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
70+
export async function setupCmake(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
71+
if (await hasApk()) {
72+
return installApkPack([
73+
{
74+
name: "cmake",
75+
// version,
76+
},
77+
])
78+
}
79+
7080
return setupBin("cmake", version, getCmakePackageInfo, setupDir, arch)
7181
}

src/ninja/ninja.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import { addPath } from "envosman"
12
import { addExeExt } from "patha"
3+
import { hasApk, installApkPack } from "setup-alpine"
4+
import { rcOptions } from "../cli-options.js"
25
import { arm64, x86, x86_64 } from "../utils/env/arch.js"
36
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
47

@@ -37,6 +40,21 @@ function getNinjaPackageInfo(version: string, platform: NodeJS.Platform, arch: s
3740
}
3841
}
3942

40-
export function setupNinja(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
43+
export async function setupNinja(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
44+
if (await hasApk()) {
45+
await installApkPack([
46+
{
47+
name: "ninja",
48+
// version,
49+
},
50+
])
51+
await addPath("/usr/lib/ninja-build/bin", rcOptions)
52+
return {
53+
binDir: "/usr/lib/ninja-build/bin",
54+
installDir: "/usr/lib/ninja-build/",
55+
bin: "/usr/lib/ninja-build/bin/ninja",
56+
}
57+
}
58+
4159
return setupBin("ninja", version, getNinjaPackageInfo, setupDir, arch)
4260
}

0 commit comments

Comments
 (0)