diff --git a/packages/ffmpeg/tangram.ts b/packages/ffmpeg/tangram.ts new file mode 100644 index 00000000..3ed164bb --- /dev/null +++ b/packages/ffmpeg/tangram.ts @@ -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) => { + const { + autotools = {}, + build, + dependencies: dependencyArgs = {}, + env, + host, + sdk, + source: source_, + } = await std.packages.applyArgs(...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); +}; diff --git a/packages/flac/tangram.ts b/packages/flac/tangram.ts new file mode 100644 index 00000000..836df3d1 --- /dev/null +++ b/packages/flac/tangram.ts @@ -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) => { + 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); +}; diff --git a/packages/libsndfile/tangram.ts b/packages/libsndfile/tangram.ts new file mode 100644 index 00000000..e9d43a60 --- /dev/null +++ b/packages/libsndfile/tangram.ts @@ -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 => { + 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) => { + 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); +}; diff --git a/packages/nasm/tangram.ts b/packages/nasm/tangram.ts new file mode 100644 index 00000000..e6e92ad3 --- /dev/null +++ b/packages/nasm/tangram.ts @@ -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) => { + const { + autotools = {}, + build, + dependencies: dependencyArgs = {}, + env, + host, + sdk, + source: source_, + } = await std.packages.applyArgs(...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; diff --git a/packages/ninja/tangram.ts b/packages/ninja/tangram.ts new file mode 100644 index 00000000..e33a7ccb --- /dev/null +++ b/packages/ninja/tangram.ts @@ -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) => { + const { + build: build_, + cmake: cmakeArg = {}, + host: host_, + sdk, + source: source_, + } = await std.packages.applyArgs(...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); +}; diff --git a/packages/ogg/tangram.ts b/packages/ogg/tangram.ts new file mode 100644 index 00000000..7b30d927 --- /dev/null +++ b/packages/ogg/tangram.ts @@ -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) => + 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); +}; diff --git a/packages/opus/tangram.ts b/packages/opus/tangram.ts new file mode 100644 index 00000000..8d8e464f --- /dev/null +++ b/packages/opus/tangram.ts @@ -0,0 +1,43 @@ +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://opus-codec.org/", + name: "opus", + version: "opus/1.5.2", + provides: { + libs: ["opus"] + }, +}; + +export const source = () => { + std.download; + const { name, version } = metadata; + const checksum = + "sha256:65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1"; + return std + .download({ + url: `https://downloads.xiph.org/releases/${name}/${name}-${version}.tar.gz`, + 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) => { + return cmake.build( + { source: source() }, + ...args, + ); +}; + +export const env = () => std.env.arg({ + PKG_CONFIG_PATH: tg.Mutation.suffix(tg`${build()}/lib64/pkgconfig`, ":"), +}); + +export default build; diff --git a/packages/vorbis/tangram.ts b/packages/vorbis/tangram.ts new file mode 100644 index 00000000..a76ccb3d --- /dev/null +++ b/packages/vorbis/tangram.ts @@ -0,0 +1,51 @@ +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/vorbis", + name: "vorbis", + version: "1.3.7", + tag: "vorbis/1.3.7", + provides: { + libs: ["vorbis"] + }, +}; + +export const source = () => { + std.download; + const { name, version } = metadata; + const checksum = + "sha256:b33cc4934322bcbf6efcbacf49e3ca01aadbea4114ec9589d1b1e9d20f72954b"; + return std + .download({ + url: `https://ftp.osuosl.org/pub/xiph/releases/${name}/lib${name}-${version}.tar.xz`, + checksum, + mode: "extract", + }) + .then(tg.Directory.expect) + .then((directory) => directory.get(`lib${name}-${version}`)) + .then(tg.Directory.expect); +}; + +export type Arg = cmake.Arg; + +export const build = async (...args: std.Args) => { + 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); +};