Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(std): use zsh on macOS #126

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/cmake/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export const metadata = {
license: "BSD-3-Clause",
name: "cmake",
repository: "https://gitlab.kitware.com/cmake/cmake",
version: "3.31.1",
version: "3.31.2",
};

export const source = tg.target(() => {
const { version } = metadata;
const checksum =
"sha256:c4fc2a9bd0cd5f899ccb2fb81ec422e175090bc0de5d90e906dd453b53065719";
"sha256:42abb3f48f37dbd739cdfeb19d3712db0c5935ed5c2aef6c340f9ae9114238a2";
const owner = "Kitware";
const repo = "CMake";
const tag = `v${version}`;
Expand Down
2 changes: 1 addition & 1 deletion packages/std/bootstrap/sdk.tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export namespace sdk {
if (os === "darwin") {
toolchain = await tg.directory(toolchain, {
["bin/gcc"]: tg.symlink("clang"),
["bin/g++"]: tg.symlink("clang++")
["bin/g++"]: tg.symlink("clang++"),
});
}
const bootstrapHost = await bootstrap.toolchainTriple(host);
Expand Down
20 changes: 16 additions & 4 deletions packages/std/env.tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,22 @@ export namespace env {
(artifact instanceof tg.File || artifact instanceof tg.Symlink)
) {
if (artifact instanceof tg.Symlink) {
artifact = await tg.symlink({
artifact: dir,
subpath: artifact.subpath(),
});
const symlinkArtifact = await artifact.artifact();
if (symlinkArtifact === undefined) {
// If this symlink points above the current directory, we don't have the context to resolve. No match.
const symlinkTarget = await artifact.target();
if (
symlinkTarget === undefined ||
symlinkTarget.startsWith("..")
) {
continue;
}
// Otherwise, construct a new symlink using this directory as the artifact.
artifact = await tg.symlink({
artifact: dir,
subpath: symlinkTarget,
});
}
}
yield [name, artifact];
}
Expand Down
4 changes: 2 additions & 2 deletions packages/std/sdk/cmake.tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ export const metadata = {
license: "BSD-3-Clause",
name: "cmake",
repository: "https://gitlab.kitware.com/cmake/cmake",
version: "3.31.1",
version: "3.31.2",
};

export const source = tg.target(() => {
const { version } = metadata;
const checksum =
"sha256:c4fc2a9bd0cd5f899ccb2fb81ec422e175090bc0de5d90e906dd453b53065719";
"sha256:42abb3f48f37dbd739cdfeb19d3712db0c5935ed5c2aef6c340f9ae9114238a2";
const owner = "Kitware";
const repo = "CMake";
const tag = `v${version}`;
Expand Down
4 changes: 2 additions & 2 deletions packages/std/sdk/kernel_headers.tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ export const metadata = {
license: "GPLv2",
name: "linux",
repository: "https://git.kernel.org",
version: "6.12.1",
version: "6.12.2",
};

export const source = tg.target(async () => {
const { name, version } = metadata;
const checksum =
"sha256:0193b1d86dd372ec891bae799f6da20deef16fc199f30080a4ea9de8cef0c619";
"sha256:bb1e0710c73e877b1f3005be7301734903636be8ef1700d3b12106e8f3403d8b";
const extension = ".tar.xz";
const majorVersion = version.split(".")[0];
const base = `https://cdn.kernel.org/pub/linux/kernel/v${majorVersion}.x`;
Expand Down
4 changes: 2 additions & 2 deletions packages/std/sdk/llvm.tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export const metadata = {
license:
"https://github.com/llvm/llvm-project/blob/991cfd1379f7d5184a3f6306ac10cabec742bbd2/LICENSE.TXT",
repository: "https://github.com/llvm/llvm-project/",
version: "19.1.4",
version: "19.1.5",
};

export const source = tg.target(async () => {
const { name, version } = metadata;
const checksum =
"sha256:3aa2d2d2c7553164ad5c6f3b932b31816e422635e18620c9349a7da95b98d811";
"sha256:bd8445f554aae33d50d3212a15e993a667c0ad1b694ac1977f3463db3338e542";
const owner = name;
const repo = "llvm-project";
const tag = `llvmorg-${version}`;
Expand Down
2 changes: 1 addition & 1 deletion packages/std/sdk/llvm/ncurses.tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Arg = {
build?: string;
env?: std.env.Arg;
host?: string;
sdk?: std.sdk.Arg;
sdk?: std.sdk.Arg | boolean;
source?: tg.Directory;
};

Expand Down
50 changes: 23 additions & 27 deletions packages/std/utils.tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,34 @@ export type Arg = {

/** A basic set of GNU system utilites. */
export const env = tg.target(async (arg?: Arg) => {
const { env: env_, host: host_, ...rest } = arg ?? {};
const { build, env: env_, host: host_, sdk } = arg ?? {};
const host = host_ ?? (await std.triple.host());

// Build bash and use it as the default shell.
const bashArtifact = await bash.build({
...rest,
env: env_,
host,
});

const bashExecutable = tg.File.expect(await bashArtifact.get("bin/bash"));
const bashEnv = {
CONFIG_SHELL: bashExecutable,
SHELL: bashExecutable,
const shellArtifact = await bash.build({ build, env: env_, host, sdk });
const shellExecutable = await shellArtifact
.get(`bin/bash`)
.then(tg.File.expect);
const shellEnv = {
CONFIG_SHELL: shellExecutable,
SHELL: shellExecutable,
};
const env = await std.env.arg(env_, bashEnv);
const env = await std.env.arg(env_, shellEnv);

let utils = [bashArtifact, bashEnv];
let utils = [shellArtifact, shellEnv];
utils = utils.concat(
await Promise.all([
bzip2({ ...rest, env, host }),
coreutils({ ...rest, env, host }),
diffutils({ ...rest, env, host }),
findutils({ ...rest, env, host }),
gawk({ ...rest, env, host }),
grep({ ...rest, env, host }),
gzip({ ...rest, env, host }),
make({ ...rest, env, host }),
patch({ ...rest, env, host }),
sed({ ...rest, env, host }),
tar({ ...rest, env, host }),
xz({ ...rest, env, host }),
bzip2({ build, env, host, sdk }),
coreutils({ build, env, host, sdk }),
diffutils({ build, env, host, sdk }),
findutils({ build, env, host, sdk }),
gawk({ build, env, host, sdk }),
grep({ build, env, host, sdk }),
gzip({ build, env, host, sdk }),
make({ build, env, host, sdk }),
patch({ build, env, host, sdk }),
sed({ build, env, host, sdk }),
tar({ build, env, host, sdk }),
xz({ build, env, host, sdk }),
]),
);
return await std.env.arg(utils);
Expand Down Expand Up @@ -148,7 +144,7 @@ export const changeShebang = async (scriptFile: tg.File) => {

export const assertProvides = async (env: std.env.Arg) => {
const names = [
"bash",
"bash", // bash for linux, zsh for macOS
"bzip2",
"ls", // coreutils
"diff", // diffutils
Expand Down
5 changes: 0 additions & 5 deletions packages/std/utils/patch.tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import libiconv from "./libiconv.tg.ts";
import coreutils from "./coreutils.tg.ts";
import diffutils from "./diffutils.tg.ts";
import rlimitFix from "./patch-rlimit-fix.patch" with { type: "file" };
import macOsPatchCmds from "./patch_cmds.tg.ts";

export const metadata = {
name: "patch",
Expand Down Expand Up @@ -48,10 +47,6 @@ export const build = tg.target(async (arg?: Arg) => {
const host = host_ ?? (await std.triple.host());
const build = build_ ?? host;

if (std.triple.os(host) === "darwin") {
return macOsPatchCmds(arg);
}

const configure = {
args: ["--disable-dependency-tracking"],
};
Expand Down
80 changes: 0 additions & 80 deletions packages/std/utils/patch_cmds.tg.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/zsh/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const metadata = {
version: "5.9",
};

export const source = tg.target(async (arg?: Arg) => {
export const source = tg.target(async () => {
const { name, version } = metadata;
const url = `https://sourceforge.net/projects/zsh/files/zsh/5.9/${name}-${version}.tar.xz/download`;
const checksum =
Expand Down