Skip to content
Open
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
83 changes: 83 additions & 0 deletions packages/ffmpeg/tangram.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import * as std from "std" with { local: "../std" };
import nasm from "nasm" with { local: "../nasm" };
import { $ } from "std" with { local: "../std" };

export const metadata = {
homepage: "https://www.ffmpeg.org/",
name: "FFmpeg",
repository: "https://github.com/FFmpeg/FFmpeg",
version: "7.1.2",
tag: "FFmpeg/7.1.2",
provides: {
binaries: ["ffmpeg", "ffprobe"],
libraries: [
"avcodec",
"avdevice",
"avfilter",
"avformat",
"avutil",
"swresample",
"swscale",
],
},
};

export const source = () => {
const { name, version } = metadata;
const checksum =
"sha256:8cb1bb8cfa9aeae13279b4da42ae8307ae6777456d4270f2e603c95aa08ca8ef";
const owner = name;
const repo = name;
const tag = `n${version}`;
return std.download.fromGithub({
owner,
repo,
tag,
checksum,
source: "tag",
});
};

export type Arg = {
autotools?: std.autotools.Arg;
build?: string;
env?: std.env.Arg;
host?: string;
sdk?: std.sdk.Arg;
source?: tg.Directory;
};

export const build = async (...args: std.Args<Arg>) => {
const {
autotools = {},
build,
dependencies: dependencyArgs = {},
env,
host,
sdk,
source: source_,
} = await std.packages.applyArgs<Arg>(...args);

const configure = {
args: ["--disable-stripping"],
};
const phases = { configure };

return std.autotools.build(
{
...(await std.triple.rotate({ build, host })),
env: std.env.arg(env, nasm()),
phases,
sdk,
source: source_ ?? source(),
},
autotools,
);
};

export default build;

export const test = async () => {
const spec = std.assert.defaultSpec(metadata);
return await std.assert.pkg(build, spec);
};
49 changes: 49 additions & 0 deletions packages/flac/tangram.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import * as std from "std" with { local: "../std" };
import { $ } from "std" with { local: "../std" };
import * as cmake from "cmake" with { local: "../cmake" };
import * as ogg from "ogg" with { local: "../ogg" };

export const metadata = {
homepage: "https://xiph.org/flac",
name: "flac",
version: "1.5.0",
tag: "flac/1.5.0"
provides: {},
};

export const source = () => {
std.download;
const { name, version } = metadata;
const checksum =
"sha256:f2c1c76592a82ffff8413ba3c4a1299b6c7ab06c734dee03fd88630485c2b920";
return std
.download({
url: `https://ftp.osuosl.org/pub/xiph/releases/${name}/${name}-${version}.tar.xz`,
checksum,
mode: "extract",
})
.then(tg.Directory.expect)
.then((directory) => directory.get(`${name}-${version}`))
.then(tg.Directory.expect);
};

export type Arg = cmake.Arg;

export const build = async (...args: std.Args<Arg>) => {
return cmake.build(
{ source: source() },
{ env: std.env.arg(ogg.env()) },
...args,
);
};

export const env = () => std.env.arg({
PKG_CONFIG_PATH: tg.Mutation.suffix(tg`${build()}/lib64/pkgconfig`, ":"),
});

export default build;

export const test = async () => {
const spec = std.assert.defaultSpec(metadata);
return await std.assert.pkg(build, spec);
};
60 changes: 60 additions & 0 deletions packages/libsndfile/tangram.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import * as cmake from "cmake" with { local: "../cmake" };
import * as flac from "flac" with { local: "../flac" };
import * as ogg from "ogg" with { local: "../ogg" };
import * as opus from "opus" with { local: "../opus" };
import * as vorbis from "vorbis" with { local: "../vorbis" };
import * as std from "std" with { local: "../std" };

export const metadata = {
license: "LGPL-2.1",
name: "libsndfile",
repository: "https://github.com/libsndfile/libsndfile",
version: "1.2.2",
tag: "libsndfile/1.2.2",
provides: {
libraries: ["sndfile"],
},
};

export const source = async (): Promise<tg.Directory> => {
const { name, version } = metadata;
const checksum =
"sha256:3799ca9924d3125038880367bf1468e53a1b7e3686a934f098b7e1d286cdb80e";
const owner = "libsndfile";
const repo = name;
const tag = version;

return std.download.fromGithub({
checksum,
compression: "xz",
owner,
repo,
source: "release",
tag,
version,
});
};

export type Arg = cmake.Arg;

export const build = async (...args:std.Args<Arg>) => {
return cmake.build(
{ source: source() },
{ env: std.env.arg(flac.env()) },
{ env: std.env.arg(ogg.env()) },
{ env: std.env.arg(opus.env()) },
{ env: std.env.arg(vorbis.env()) },
...args,
);
};

export const env = () => std.env.arg({
PKG_CONFIG_PATH: tg.Mutation.suffix(tg`${build()}/lib64/pkgconfig`, ":"),
});

export default build;

export const test = async () => {
const spec = std.assert.defaultSpec(metadata);
return await std.assert.pkg(build, spec);
};
71 changes: 71 additions & 0 deletions packages/nasm/tangram.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import * as std from "std" with { local: "../std" };
import { $ } from "std" with { local: "../std" };

export const metadata = {
homepage: "https://www.nasm.us/",
name: "nasm",
repository: "https://github.com/netwide-assembler/nasm",
version: "3.01",
tag: "nasm/3.01",
provides: {
binaries: ["nasm", "ndisasm"],
},
};

export const source = () => {
std.download;
const { name, version } = metadata;
const checksum =
"sha256:aea120d4adb0241f08ae24d6add09e4a993bc1c4d9f754dbfc8020d6916c9be1";
const owner = "netwide-assembler";
const repo = name;
return std
.download({
url: `https://www.nasm.us/pub/${name}/releasebuilds/${version}/nasm-${version}.tar.gz`,
checksum,
mode: "extract",
})
.then(tg.Directory.expect)
.then((directory) => directory.get(`${name}-${version}`))
.then(tg.Directory.expect);
};

export type Arg = {
autotools?: std.autotools.Arg;
build?: string;
dependencies?: {};
env?: std.env.Arg;
host?: string;
sdk?: std.sdk.Arg;
source?: tg.Directory;
};

export const build = async (...args: std.Args<Arg>) => {
const {
autotools = {},
build,
dependencies: dependencyArgs = {},
env,
host,
sdk,
source: source_,
} = await std.packages.applyArgs<Arg>(...args);
const phases = {
configure: {
args: [],
},
};
return std.autotools.build(
{
...(await std.triple.rotate({ build, host })),
env: std.env.arg(env),
phases,
sdk,
setRuntimeLibraryPath: true,
source: source_ ?? source(),
},
autotools,
);
};

export default build;
75 changes: 75 additions & 0 deletions packages/ninja/tangram.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import * as std from "std" with { local: "../std" };
import * as cmake from "./tangram.ts";

export const metadata = {
homepage: "https://ninja-build.org/",
license: "Apache-2.0",
name: "ninja",
repository: "https://github.com/ninja-build/ninja",
version: "1.13.1",
tag: "ninja/1.13.1",
provides: {
binaries: ["ninja"],
},
};

export const source = () => {
const { name, version } = metadata;
const checksum =
"sha256:f0055ad0369bf2e372955ba55128d000cfcc21777057806015b45e4accbebf23";
const owner = "ninja-build";
const repo = name;
const tag = `v${version}`;
return std.download.fromGithub({
checksum,
owner,
repo,
source: "tag",
tag,
});
};

export type Arg = {
build?: string;
cmake?: cmake.BuildArg;
env?: std.env.Arg;
host?: string;
sdk?: std.sdk.Arg;
source?: tg.Directory;
};

export const build = async (...args: std.Args<Arg>) => {
const {
build: build_,
cmake: cmakeArg = {},
host: host_,
sdk,
source: source_,
} = await std.packages.applyArgs<Arg>(...args);
const host = host_ ?? (await std.triple.host());
const build = build_ ?? host;

const configure = {
args: ["-DCMAKE_BUILD_TYPE=Release", "-DBUILD_TESTING=OFF"],
};

const result = cmake.build(
{
...(await std.triple.rotate({ build, host })),
generator: "Unix Makefiles",
phases: { configure },
sdk,
source: source_ ?? source(),
},
cmakeArg,
);

return result;
};

export default build;

export const test = async () => {
const spec = std.assert.defaultSpec(metadata);
return await std.assert.pkg(build, spec);
};
45 changes: 45 additions & 0 deletions packages/ogg/tangram.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import * as std from "std" with { local: "../std" };
import { $ } from "std" with { local: "../std" };
import * as cmake from "cmake" with { local: "../cmake" };

export const metadata = {
homepage: "https://xiph.org/ogg",
name: "ogg",
version: "1.3.6",
tag: "ogg/1.3.6",
provides: {
libs: ["ogg"]
},
};

export const source = () => {
std.download;
const { name, version } = metadata;
const checksum =
"sha256:5c8253428e181840cd20d41f3ca16557a9cc04bad4a3d04cce84808677fa1061";
return std
.download({
url: `https://downloads.xiph.org/releases/ogg/libogg-${version}.tar.xz`,
checksum,
mode: "extract",
})
.then(tg.Directory.expect)
.then((d) => d.get(`lib${name}-${version}`))
.then(tg.Directory.expect);
};

export type Arg = cmake.Arg;

export const build = (...args: std.Args<Arg>) =>
cmake.build({ source: source() }, ...args).then(tg.Directory.expect);

export const env = () => std.env.arg({
PKG_CONFIG_PATH: tg.Mutation.suffix(tg`${build()}/lib64/pkgconfig`, ":"),
});

export default build;

export const test = async () => {
const spec = std.assert.defaultSpec(metadata);
return await std.assert.pkg(build, spec);
};
Loading