diff --git a/ports/cmake.ts b/ports/cmake.ts new file mode 100644 index 0000000..b0f96a8 --- /dev/null +++ b/ports/cmake.ts @@ -0,0 +1,49 @@ +import { InstallConfigFat, InstallConfigSimple } from "../port.ts"; +import { AsdfInstallConf } from "./asdf.ts"; +import { PipiInstallConf } from "./pipi.ts"; +import * as ports from "./mod.ts"; + +/** + * Port to install cmake + * + * For macOS users, you need to add python as allowed build dependencies + * as cmake is downladed via pip install. + * + * Example: + * ```typescript + * const installs = { + python_latest: ports.cpy_bs({ version: "3.12.2", releaseTag: "20240224" }), +}; + * config({ + stdDeps: true, + allowedBuildDeps: [ + installs.python_latest + ], + enableRuntimes: true +}); + * ``` + * + */ +export default function conf( + config: InstallConfigSimple, +): InstallConfigFat[] { + /* + The universal macOS cmake build downloaded by asdf crashes + due to security restrictions in macOS, so it's installed using pipi port instead, which runs with no problems. + */ + if (Deno.build.os === "darwin") { + const pipiConfig: PipiInstallConf = { + packageName: "cmake", + version: config.version, + }; + return ports.pipi(pipiConfig); + } + const asdfConfig: AsdfInstallConf = { + ...config, + pluginRepo: "https://github.com/asdf-community/asdf-cmake", + installType: "version", + version: config.version, + }; + + return [ports.asdf(asdfConfig)]; +} diff --git a/ports/mod.ts b/ports/mod.ts index c9851c1..926d6d7 100644 --- a/ports/mod.ts +++ b/ports/mod.ts @@ -2,6 +2,7 @@ export { default as act } from "./act.ts"; export { default as asdf } from "./asdf.ts"; export { default as cargo_binstall } from "./cargo-binstall.ts"; export { default as cargobi } from "./cargobi.ts"; +export { default as cmake } from "./cmake.ts"; export { default as cpy_bs } from "./cpy_bs.ts"; export { default as curl } from "./curl.ts"; export { default as deno_ghrel } from "./deno_ghrel.ts"; diff --git a/ports/pipi.ts b/ports/pipi.ts index 3079aa0..f7aa81c 100644 --- a/ports/pipi.ts +++ b/ports/pipi.ts @@ -18,7 +18,7 @@ import { import cpy_bs from "./cpy_bs.ts"; import * as std_ports from "../modules/ports/std.ts"; -const manifest = { +export const manifest = { ty: "denoWorker@v1" as const, name: "pipi_pypi", version: "0.1.0", diff --git a/tests/ports.ts b/tests/ports.ts index 0a1016f..9559bdf 100644 --- a/tests/ports.ts +++ b/tests/ports.ts @@ -144,21 +144,21 @@ const cases: CustomE2eTestCase[] = [ : `meta --version && wasmedge --version`, ignore: testTargetPlatform == "linux/aarch64", }, - // 77 meg + - { - name: "asdf-cmake", - installConf: ports.asdf({ - pluginRepo: "https://github.com/asdf-community/asdf-cmake", - installType: "version", - }), - ePoint: `cmake --version`, - }, // 80 meg { name: "cpy_bs", installConf: ports.cpy_bs(), ePoint: `python3 --version`, }, + // 77 meg +, depends on "cpy_bs" on darwin/macos + { + name: "cmake", + installConf: ports.cmake({}), + ePoint: `cmake --version`, + secureConf: { + enableRuntimes: true, + }, + }, // 80 meg + { name: "pipi-poetry",