|
| 1 | +import * as std from "std"; |
| 2 | +import nasm from "nasm"; |
| 3 | + |
| 4 | +export const project = { |
| 5 | + name: "libvpx", |
| 6 | + version: "1.15.2", |
| 7 | + repository: "https://github.com/webmproject/libvpx", |
| 8 | +}; |
| 9 | + |
| 10 | +const source = Brioche.download( |
| 11 | + `${project.repository}/archive/refs/tags/v${project.version}.tar.gz`, |
| 12 | +) |
| 13 | + .unarchive("tar", "gzip") |
| 14 | + .peel(); |
| 15 | + |
| 16 | +export default function libvpx(): std.Recipe<std.Directory> { |
| 17 | + // Set `prefix` to '//', otherwise we get a configure error |
| 18 | + // Since the script strips the first '/' |
| 19 | + return std.runBash` |
| 20 | + ./configure \ |
| 21 | + --prefix=// \ |
| 22 | + --disable-examples \ |
| 23 | + --disable-unit-tests \ |
| 24 | + --enable-pic \ |
| 25 | + --enable-runtime-cpu-detect \ |
| 26 | + --enable-shared \ |
| 27 | + --enable-vp9-highbitdepth |
| 28 | + make -j "$(nproc)" |
| 29 | + make install DESTDIR="$BRIOCHE_OUTPUT" |
| 30 | + ` |
| 31 | + .workDir(source) |
| 32 | + .dependencies(std.toolchain, nasm) |
| 33 | + .toDirectory() |
| 34 | + .pipe(std.pkgConfigMakePathsRelative, (recipe) => |
| 35 | + std.setEnv(recipe, { |
| 36 | + CPATH: { append: [{ path: "include" }] }, |
| 37 | + LIBRARY_PATH: { append: [{ path: "lib" }] }, |
| 38 | + PKG_CONFIG_PATH: { append: [{ path: "lib/pkgconfig" }] }, |
| 39 | + }), |
| 40 | + ); |
| 41 | +} |
| 42 | + |
| 43 | +export async function test(): Promise<std.Recipe<std.File>> { |
| 44 | + const script = std.runBash` |
| 45 | + pkg-config --modversion vpx | tee "$BRIOCHE_OUTPUT" |
| 46 | + ` |
| 47 | + .dependencies(std.toolchain, libvpx) |
| 48 | + .toFile(); |
| 49 | + |
| 50 | + const result = (await script.read()).trim(); |
| 51 | + |
| 52 | + // Check that the result contains the expected version |
| 53 | + const expected = project.version; |
| 54 | + std.assert(result === expected, `expected '${expected}', got '${result}'`); |
| 55 | + |
| 56 | + return script; |
| 57 | +} |
| 58 | + |
| 59 | +export function liveUpdate(): std.Recipe<std.Directory> { |
| 60 | + return std.liveUpdateFromGithubTags({ |
| 61 | + project, |
| 62 | + matchTag: /^v(?<version>([\d]+)\.([\d]+)\.([\d]+))$/, |
| 63 | + }); |
| 64 | +} |
0 commit comments