Skip to content

Commit 8c58575

Browse files
committed
refactor(cmake): remove unnecessary platform-specific branches
1 parent eca2d93 commit 8c58575

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

packages/cmake/tangram.ts

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const metadata = {
2424
},
2525
};
2626

27-
export const source = () => {
27+
export const source = async () => {
2828
const { version } = metadata;
2929
const checksum =
3030
"sha256:e3cde3ca83dc2d3212105326b8f1b565116be808394384007e7ef1c253af6caa";
@@ -76,6 +76,9 @@ export const self = async (...args: std.Args<Arg>) => {
7676
const processDependency = (dep: any) =>
7777
std.env.envArgFromDependency(build, env_, host, sdk, dep);
7878

79+
const curlRoot = processDependency(
80+
std.env.runtimeDependency(curl.build, dependencyArgs.curl),
81+
);
7982
const ncursesRoot = processDependency(
8083
std.env.runtimeDependency(ncurses.build, dependencyArgs.ncurses),
8184
);
@@ -91,26 +94,26 @@ export const self = async (...args: std.Args<Arg>) => {
9194
const zstdRoot = processDependency(
9295
std.env.runtimeDependency(zstd.build, dependencyArgs.zstd),
9396
);
94-
const deps = [ncursesRoot, libpslRoot, opensslRoot, zlibRoot, zstdRoot];
97+
const deps = [
98+
curlRoot,
99+
ncursesRoot,
100+
libpslRoot,
101+
opensslRoot,
102+
zlibRoot,
103+
zstdRoot,
104+
];
95105

96106
if (os === "darwin") {
97107
deps.push(processDependency(std.env.runtimeDependency(libiconv.build)));
98108
}
99109

100-
let configureArgs = ["--parallel=$(nproc)"];
101-
if (os === "linux") {
102-
deps.push(
103-
processDependency(
104-
std.env.runtimeDependency(curl.build, dependencyArgs.curl),
105-
),
106-
);
107-
configureArgs.push(
108-
`--system-curl`,
109-
"--",
110-
`-DCMAKE_LIBRARY_PATH="$(echo $LIBRARY_PATH | tr ':' ';')"`,
111-
`-DCMAKE_INCLUDE_PATH="$(echo $CPATH | tr ':' ';')"`,
112-
);
113-
}
110+
let configureArgs = [
111+
"--parallel=$(nproc)",
112+
"--system-curl",
113+
"--",
114+
`-DCMAKE_LIBRARY_PATH="$(echo $LIBRARY_PATH | tr ':' ';')"`,
115+
`-DCMAKE_INCLUDE_PATH="$(echo $CPATH | tr ':' ';')"`,
116+
];
114117
const prepare = {
115118
command: tg.Mutation.prefix("mkdir work && cd work", "\n"),
116119
};
@@ -120,17 +123,7 @@ export const self = async (...args: std.Args<Arg>) => {
120123
};
121124
const phases = { prepare, configure };
122125

123-
const envs: Array<tg.Unresolved<std.env.Arg>> = [...deps];
124-
if (os === "darwin") {
125-
// On macOS, the bootstrap script wants to test for `ext/stdio_filebuf.h`, which is not part of the macOS toolchain.
126-
// Using the `gcc` and `g++` named symlinks to the AppleClang compiler instead of `clang`/`clang++` prevents this.
127-
envs.push({
128-
CC: "gcc",
129-
CXX: "g++",
130-
});
131-
}
132-
133-
const env = await std.env.arg(...envs, env_);
126+
const env = await std.env.arg(...deps, env_);
134127

135128
let result = await std.autotools.build({
136129
...(await std.triple.rotate({ build, host })),

0 commit comments

Comments
 (0)