Skip to content

Commit

Permalink
Replace pack tools download with runtime utils
Browse files Browse the repository at this point in the history
  • Loading branch information
kylewlacy committed Jun 20, 2024
1 parent 126cfe7 commit ea357a5
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 28 deletions.
6 changes: 3 additions & 3 deletions packages/std/extra/autowrap.bri
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as std from "/core";
import { toolchain } from "/toolchain";
import { packTools } from "/pack_tools.bri";
import { runtimeUtils } from "/runnable_tools.bri";

export interface AutowrapOptions {
executables: string[];
Expand Down Expand Up @@ -35,11 +35,11 @@ export function autowrap(
for (const executablePath of options.executables) {
const wrappedExecutable = std
.process({
command: std.tpl`${packTools()}/bin/brioche-packer`,
command: std.tpl`${runtimeUtils()}/bin/brioche-packer`,
args: [
"autowrap",
"--packed-exec",
std.tpl`${packTools()}/bin/brioche-packed-exec`,
std.tpl`${runtimeUtils()}/bin/brioche-packed-exec`,
"--sysroot",
sysroot,
"--lib-dir",
Expand Down
12 changes: 0 additions & 12 deletions packages/std/pack_tools.bri

This file was deleted.

4 changes: 2 additions & 2 deletions packages/std/runnable_tools.bri
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as std from "/core";
export function runtimeUtils(): std.Recipe<std.Directory> {
return std
.download({
url: "https://development-content.brioche.dev/github.com/brioche-dev/brioche-runtime-utils/commits/fc48540924428944e30a4901c2fff2135abf5342/x86_64-linux/brioche-runtime-utils.tar.zstd",
url: "https://development-content.brioche.dev/github.com/brioche-dev/brioche-runtime-utils/commits/952ce757c7a42e4545c1eedebfa65eb5c43d1218/x86_64-linux/brioche-runtime-utils.tar.zstd",
hash: std.sha256Hash(
"c1ea132ed08abd7f719a698cdc32e2444e6f5ca0792c7737d42a41771a04cfa7",
"d2911da20e45dcec910359cdb60331b418974c1d98253c5242993ff3aa021492",
),
})
.unarchive("tar", "zstd");
Expand Down
10 changes: 5 additions & 5 deletions packages/std/toolchain/stage0/index.bri
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as std from "/core";
import { packTools } from "/pack_tools.bri";
import { runtimeUtils } from "../utils.bri";

interface BootstrapRunOptions {
script: string;
Expand Down Expand Up @@ -27,8 +27,8 @@ export function bootstrapRun(
})
.unarchive("tar", "xz");

const briocheLd = packTools().get("bin/brioche-ld");
const briochePacked = packTools().get("bin/brioche-packed-exec");
const briocheLd = runtimeUtils().get("bin/brioche-ld");
const briochePacked = runtimeUtils().get("bin/brioche-packed-exec");

const bootstrapScript = std
.file(options.script)
Expand Down Expand Up @@ -124,8 +124,8 @@ export default async (): Promise<std.Recipe> => {
})
.unarchive("tar", "xz");

const briocheLd = packTools().get("bin/brioche-ld");
const briochePacked = packTools().get("bin/brioche-packed-exec");
const briocheLd = runtimeUtils().get("bin/brioche-ld");
const briochePacked = runtimeUtils().get("bin/brioche-packed-exec");

const briochePack = std.directory({
"x86_64-linux-musl": std.directory({
Expand Down
6 changes: 3 additions & 3 deletions packages/std/toolchain/stage1/1_04_glibc.bri
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as std from "/core";
import { packTools } from "/pack_tools.bri";
import { runtimeUtils } from "../utils.bri";
import { bootstrapRun } from "/toolchain/stage0";
import binutils from "./1_01_binutils.bri";
import gcc from "./1_02_gcc.bri";
Expand All @@ -19,8 +19,8 @@ export default std.memo((): std.Recipe<std.Directory> => {
),
});

const briochePacked = packTools().get("bin/brioche-packed-exec");
const briochePacker = packTools().get("bin/brioche-packer");
const briochePacked = runtimeUtils().get("bin/brioche-packed-exec");
const briochePacker = runtimeUtils().get("bin/brioche-packer");

const stage1 = std.merge(binutils(), gcc(), linuxHeaders());

Expand Down
19 changes: 16 additions & 3 deletions packages/std/toolchain/utils.bri
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import * as std from "/core";
import { packTools } from "/pack_tools.bri";

// NOTE: This download is just like the `runtimeUtils()` export, except
// it's pinned to a specific version. It should only be updated if the
// tools used for building the toolchain should be upgraded
export function runtimeUtils(): std.Recipe<std.Directory> {
return std
.download({
url: "https://development-content.brioche.dev/github.com/brioche-dev/brioche-runtime-utils/commits/952ce757c7a42e4545c1eedebfa65eb5c43d1218/x86_64-linux/brioche-runtime-utils.tar.zstd",
hash: std.sha256Hash(
"d2911da20e45dcec910359cdb60331b418974c1d98253c5242993ff3aa021492",
),
})
.unarchive("tar", "zstd");
}

interface UseBriocheLdOptions {
ldPaths: string[];
Expand All @@ -10,8 +23,8 @@ export function useBriocheLd(
dir: std.Recipe<std.Directory>,
options: UseBriocheLdOptions,
): std.Recipe<std.Directory> {
const briocheLd = packTools().get("bin/brioche-ld");
const briochePacked = packTools().get("bin/brioche-packed-exec");
const briocheLd = runtimeUtils().get("bin/brioche-ld");
const briochePacked = runtimeUtils().get("bin/brioche-packed-exec");

for (const ldPath of options.ldPaths) {
const systemLd = dir.get(ldPath);
Expand Down

0 comments on commit ea357a5

Please sign in to comment.