Skip to content
Merged
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
66 changes: 66 additions & 0 deletions packages/drift/build.ncl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
let { standaloneTest, subsetOf, Attrs, BuildSpec, Local, Needs, OutputBin, Source, .. } = import "minimal.ncl" in
let base = import "../base/build.ncl" in
let rust = import "../rust/build.ncl" in
let toolchain = import "../toolchain/build.ncl" in

let gcc = import "../gcc/build.ncl" in
let git = import "../git/build.ncl" in
let glibc = import "../glibc/build.ncl" in

let version = "0.0.1" in
{
name = "drift",
build_deps = [
{ file = "build.sh" } | Local,
{
url = "https://github.com/aymanbagabas/drift/archive/refs/tags/v%{version}.tar.gz",
sha256 = "3ea14fc2dafc647d75305f5ee126362390f7aa7204c3a1904d9b1572dd0bc682",
extract = true,
strip_prefix = "drift-%{version}",
} | Source,
base,
rust,
toolchain,
],

# drift is a pager for `git diff`: every view it renders comes from shelling
# out to git (src/git.rs), so git is a hard runtime dep, not a convenience.
# The library set is just what the binary actually links -- syntect is built
# with the `default-fancy` feature (pure-Rust fancy-regex), so unlike delta
# there is no oniguruma here, and nothing pulls in zlib.
runtime_deps = [
glibc,
subsetOf gcc ["libgcc"],
git,
],

# Source archive is the plain GitHub tag tarball with no vendored crates, so
# the build resolves its cargo deps over the network.
needs =
{
dns = {},
internet = {},
} | Needs,

cmd = "./build.sh",

outputs = {
drift = { glob = "usr/bin/drift" } | OutputBin,
},

attrs =
{
upstream_version = version,
license_spdx = "MIT",
source_provenance = {
category = 'GithubRepo,
owner = "aymanbagabas",
repo = "drift",
},
build_cost_multiple = 2,
} | Attrs,

tests = {
smoketest = standaloneTest "/bin/drift --version",
},
} | BuildSpec
12 changes: 12 additions & 0 deletions packages/drift/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
set -ex
export CC=gcc
export LD=gcc
export RUSTFLAGS="-C linker=gcc --remap-path-prefix=$(pwd)=/builddir --remap-path-prefix=$HOME/.cargo=/cargo"

# --locked: upstream ships a Cargo.lock, so pin to it rather than re-resolving.
cargo build --release --locked

# The release profile already sets lto/codegen-units=1/strip, so no extra
# determinism flags are needed beyond the path remapping above.
install -D -m 0755 target/release/drift "$OUTPUT_DIR/usr/bin/drift"