Skip to content

Commit

Permalink
fix cc-autotools test
Browse files Browse the repository at this point in the history
  • Loading branch information
deciduously committed Jan 3, 2025
1 parent f123b07 commit 2d56ff6
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 22 deletions.
33 changes: 23 additions & 10 deletions packages/autobuild/autotools/tangram.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as std from "std" with { path: "../../std" };
import { $ } from "std" with { path: "../../std" };

import * as autoconf from "autoconf" with { path: "../../autoconf" };
import * as automake from "automake" with { path: "../../automake" };
import * as gettext from "gettext" with { path: "../../gettext" };
import * as help2man from "help2man" with { path: "../../help2man" };
import * as perl from "perl" with { path: "../../perl" };
import * as texinfo from "texinfo" with { path: "../../texinfo" };
import autoconf from "autoconf" with { path: "../../autoconf" };
import automake from "automake" with { path: "../../automake" };
import gettext from "gettext" with { path: "../../gettext" };
import help2man from "help2man" with { path: "../../help2man" };
import perl from "perl" with { path: "../../perl" };
import texinfo from "texinfo" with { path: "../../texinfo" };

export type Arg = {
build?: string;
Expand All @@ -16,8 +16,11 @@ export type Arg = {
};

export const build = tg.target(async (arg: Arg) => {
// TODO - compbine env with the imported tools.
return std.autotools.build(arg);
const { build, env: envArg, host, source } = arg ?? {};

const env_ = envArg ?? env({ build, host });
const arg_ = { build, env: env_, host, source };
return std.autotools.build(arg_);
});

export default build;
Expand All @@ -27,6 +30,16 @@ export type EnvArg = {
host?: string | undefined;
};

export const env = tg.target((arg: EnvArg) => {
return tg.unimplemented();
export const env = tg.target(async (arg: EnvArg) => {
const { build: build_, host: host_ } = arg ?? {};
const host = host_ ?? (await std.triple.host());
const build = build_ ?? host;
return std.env(
autoconf({ build, host: build }),
automake({ build, host: build }),
gettext({ build, host: build }),
help2man({ build, host: build }),
perl({ build, host: build }),
texinfo({ build, host: build }),
);
});
2 changes: 1 addition & 1 deletion packages/autobuild/rust/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default cargo;
export const plain = tg.target(async (arg: Arg) => {
const { build, env: envArg, host, source } = arg ?? {};

const env_ = envArg ?? std.env.arg(env({ build, host }), envArg);
const env_ = envArg ?? env({ build, host });
const arg_ = { build, env: env_, host, source };

return await rust.build.build(arg_);
Expand Down
12 changes: 5 additions & 7 deletions packages/autobuild/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import * as ruby from "./ruby";
import * as rust from "./rust";
import * as ts from "./ts";

// FIXME - why can't I just do tests and use .get()?
// import tests from "./tests" with { type: "directory" };
import ccAutotoolsTest from "./tests/cc-autotools" with { type: "directory" };
import cPlainTest from "./tests/c-plain" with { type: "directory" };
import cxxPlainTest from "./tests/cxx-plain" with { type: "directory" };
Expand Down Expand Up @@ -328,10 +326,10 @@ const testParamaters = (): Record<Kind, TestFnArg> => {
};
};

// FIXME - this is silly, we should be able to just grab the subdir with the right name.
const testDirs = (): Record<Kind, tg.Directory> => {
const testDirs = async (): Promise<Record<Kind, tg.Directory>> => {
const preparedAutotoolsTest = await prepareAutotoolsTestDistributionBundle();
return {
"cc-autotools": ccAutotoolsTest,
"cc-autotools": preparedAutotoolsTest,
"c-plain": cPlainTest,
"cxx-plain": cxxPlainTest,
"fortran-plain": fortranPlainTest,
Expand All @@ -354,12 +352,12 @@ const testDirs = (): Record<Kind, tg.Directory> => {

export const testKind = tg.target(async (kind: Kind) => {
console.log(`testing ${kind}...`);
const source = await testDirs()[kind];
const dirs = await testDirs();
const source = dirs[kind];

// Test detection
console.log("source", await source.id());
const detectedKind = await detectKind(source);
// FIXME - with === - why aren't they the same type? expected go, got go ??
tg.assert(detectedKind == kind, `expected ${kind}, got ${detectedKind}`);

// Test build
Expand Down
4 changes: 2 additions & 2 deletions packages/autobuild/tests/cc-autotools/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bin_PROGRAMS = hello
hello_SOURCES = main.c
bin_PROGRAMS = test
test_SOURCES = main.c
4 changes: 2 additions & 2 deletions packages/texinfo/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export const metadata = {
license: "GPL-3.0-or-later",
name: "texinfo",
repository: "https://git.savannah.gnu.org/git/texinfo.git",
version: "7.1.1",
version: "7.2",
};

export const source = tg.target(() => {
const { name, version } = metadata;
const checksum =
"sha256:31ae37e46283529432b61bee1ce01ed0090d599e606fc6a29dca1f77c76a6c82";
"sha256:0329d7788fbef113fa82cb80889ca197a344ce0df7646fe000974c5d714363a6";
return std.download.fromGnu({
name,
version,
Expand Down

0 comments on commit 2d56ff6

Please sign in to comment.