Skip to content

Commit

Permalink
fix: rollup (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
deciduously authored Jan 13, 2025
1 parent 6550939 commit 4f84910
Show file tree
Hide file tree
Showing 26 changed files with 456 additions and 172 deletions.
2 changes: 1 addition & 1 deletion packages/binutils/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const test = tg.target(async () => {
"size",
"strings",
"strip",
];
];

await std.assert.pkg({ buildFn: default_, binaries, metadata });
return true;
Expand Down
4 changes: 2 additions & 2 deletions packages/cmake/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export const metadata = {
license: "BSD-3-Clause",
name: "cmake",
repository: "https://gitlab.kitware.com/cmake/cmake",
version: "3.31.3",
version: "3.31.4",
};

export const source = tg.target(() => {
const { version } = metadata;
const checksum =
"sha256:fac45bc6d410b49b3113ab866074888d6c9e9dc81a141874446eb239ac38cb87";
"sha256:a6130bfe75f5ba5c73e672e34359f7c0a1931521957e8393a5c2922c8b0f7f25";
const owner = "Kitware";
const repo = "CMake";
const tag = `v${version}`;
Expand Down
3 changes: 2 additions & 1 deletion packages/curl/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export const test = tg.target(async () => {
curl -o $OUTPUT/tangram.svg https://www.tangram.dev/tangram.svg
`
.env(default_())
.checksum("unsafe");
.checksum("unsafe")
.then(tg.Directory.expect);

const exampleContents = await result
.get("example")
Expand Down
2 changes: 1 addition & 1 deletion packages/git/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const default_ = tg.target(async (...args: std.Args<Arg>) => {
} = await std.args.apply<Arg>(...args);

const os = std.triple.os(host);

const sourceDir = source_ ?? source();

const configure = {
Expand Down
4 changes: 2 additions & 2 deletions packages/mold/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export const metadata = {
license: "MIT",
name: "mold",
repository: "https://github.com/rui314/mold",
version: "2.35.1",
version: "2.36.0",
};

export const source = tg.target(() => {
const { name, version } = metadata;
const checksum =
"sha256:912b90afe7fde03e53db08d85a62c7b03a57417e54afc72c08e2fa07cab421ff";
"sha256:3f57fe75535500ecce7a80fa1ba33675830b7d7deb1e5ee9a737e2bc43cdb1c7";
const owner = "rui314";
const repo = name;
const tag = `v${version}`;
Expand Down
3 changes: 2 additions & 1 deletion packages/patch/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export const source = tg.target(async () => {
const { name, version } = metadata;
const checksum =
"sha256:8cf86e00ad3aaa6d26aca30640e86b0e3e1f395ed99f189b06d4c9f74bc58a4e";
return std.download.fromGnu({ name, version, checksum })
return std.download
.fromGnu({ name, version, checksum })
.then((source) => std.patch(source, patches));
});

Expand Down
18 changes: 18 additions & 0 deletions packages/python/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export type Arg = {
/** The system to build python upon. */
build?: string;

/** Build with --enable-optimizations? Not supported on macOS at the moment, enabled by default on Linux. */
enableOptimizations?: boolean;

/** The system to use python. Currently must be the same as build. */
host?: string;

Expand All @@ -101,6 +104,7 @@ export const toolchain = tg.target(async (...args: std.Args<Arg>) => {
sqlite: sqliteArg = {},
zlib: zlibArg = {},
} = {},
enableOptimizations: enableOptimizations_,
env: env_,
host,
requirements: requirementsArg,
Expand All @@ -110,6 +114,11 @@ export const toolchain = tg.target(async (...args: std.Args<Arg>) => {

const os = std.triple.os(host);

if (os === "darwin" && enableOptimizations_ === true) {
throw new Error("enableOptimizations is not supported on macOS.");
}
const enableOptimizations = enableOptimizations_ ?? false;

// Set up build dependencies.
const buildDependencies = [];
const bisonForBuild = bison.default_({ build, host: build }).then((d) => {
Expand Down Expand Up @@ -208,10 +217,19 @@ export const toolchain = tg.target(async (...args: std.Args<Arg>) => {
env.push({ MACOSX_DEPLOYMENT_TARGET: "15.2" });
}

const configureArgs = [];
if (enableOptimizations) {
configureArgs.push("--enable-optimizations");
}

const configure = { args: configureArgs };
const phases = { configure };

const output = await std.autotools.build(
{
...(await std.triple.rotate({ build, host })),
env: std.env.arg(env),
phases,
opt: "3",
sdk,
setRuntimeLibraryPath: true,
Expand Down
12 changes: 10 additions & 2 deletions packages/rust/build.tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const build = tg.target(async (...args: std.Args<Arg>) => {
const rustTarget = rustTriple(target);

// Determine crate name.
const crateName = crateName_ ?? (await source.id());
const crateName = crateName_ ?? "main";

// Collect environments.
const envs = [];
Expand Down Expand Up @@ -378,6 +378,7 @@ export const testConditionalCompilation = tg.target(async () => {
});

import * as curl from "curl" with { path: "../curl" };
import * as libpsl from "libpsl" with { path: "../libpsl" };
import * as openssl from "openssl" with { path: "../openssl" };
import * as zlib from "zlib" with { path: "../zlib" };
import * as zstd from "zstd" with { path: "../zstd" };
Expand All @@ -386,10 +387,17 @@ export const testLinkLibcurl = tg.target(async () => {

// Obtain dependencies. Libcurl transitively requires libssl, libz, and libzstd.
const libcurl = curl.default_();
const libpslArtifact = libpsl.default_();
const sslArtifact = openssl.default_();
const zlibArtifact = zlib.default_();
const zstdArtifact = zstd.default_();
const deps = [libcurl, sslArtifact, zlibArtifact, zstdArtifact];
const deps = [
libcurl,
libpslArtifact,
sslArtifact,
zlibArtifact,
zstdArtifact,
];

// Build the test.
const exe = await build({
Expand Down
2 changes: 1 addition & 1 deletion packages/rust/cargo.tg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ export const testUnproxiedWorkspace = tg.target(async () => {
},
pre: "set -x",
proxy: false,
verbose: true
verbose: true,
});

const helloOutput = await $`
Expand Down
4 changes: 2 additions & 2 deletions packages/rust/proxy.tg.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as std from "std" with { path: "../std" };
import { $ } from "std" with { path: "../std" };

import { cargo, toolchain } from "./tangram.ts";
import { cargo, toolchain, VERSION } from "./tangram.ts";

import cargoToml from "./proxy/Cargo.toml" with { type: "file" };
import cargoLock from "./proxy/Cargo.lock" with { type: "file" };
Expand Down Expand Up @@ -43,7 +43,7 @@ export const test = tg.target(async () => {
.env(proxy(), toolchain())
.then(tg.File.expect);
const versionText = await version.text();
tg.assert(versionText.trim().includes("nightly"));
tg.assert(versionText.trim().includes(VERSION));

// Build the basic proxy test.
const helloWorld = await cargo.build({
Expand Down
Loading

0 comments on commit 4f84910

Please sign in to comment.