termux-packages/packages/below/build.sh

56 lines
1.8 KiB
Bash
Raw Normal View History

2022-03-24 22:10:33 +01:00
TERMUX_PKG_HOMEPAGE=https://github.com/facebookincubator/below
TERMUX_PKG_DESCRIPTION="An interactive tool to view and record historical system data"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.5.0
TERMUX_PKG_SRCURL=https://github.com/facebookincubator/below/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=9e76d066ce4815b8c51c720375a29d8b0a97a7890fd80602bbe49968573adeb5
TERMUX_PKG_DEPENDS="libelf, zlib"
TERMUX_PKG_BUILD_IN_SRC=true
# ```
# error[E0308]: mismatched types
# --> /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/openat-0.1.21/src/dir.rs:465:34
# |
# 465 | match stat.st_mode & libc::S_IFMT {
# | ^^^^^^^^^^^^ expected `u32`, found `u16`
# ```
TERMUX_PKG_BLACKLISTED_ARCHES="arm, i686"
termux_step_pre_configure() {
termux_setup_rust
: "${CARGO_HOME:=$HOME/.cargo}"
export CARGO_HOME
cargo fetch --target $CARGO_TARGET_NAME
local d p
for d in $CARGO_HOME/registry/src/github.com-*/libbpf-sys-*; do
for p in libbpf-sys-0.6.0-1-libbpf-include-linux-{compiler,types}.h.diff; do
patch --silent -p1 -d ${d} \
< "$TERMUX_PKG_BUILDER_DIR/${p}" || :
done
done
for d in $CARGO_HOME/registry/src/github.com-*/nix-*; do
for p in nix-{0.22.0,0.23.1}-src-sys-statfs.rs.diff; do
patch --silent -p1 -d ${d} \
< "$TERMUX_PKG_BUILDER_DIR/${p}" || :
done
done
local _CARGO_TARGET_LIBDIR=target/$CARGO_TARGET_NAME/release/deps
mkdir -p $_CARGO_TARGET_LIBDIR
local lib
for lib in lib{elf,z}.so; do
ln -sf $TERMUX_PREFIX/lib/${lib} $_CARGO_TARGET_LIBDIR/
done
}
termux_step_make() {
cargo build --jobs $TERMUX_MAKE_PROCESSES --target $CARGO_TARGET_NAME --release
}
termux_step_make_install() {
install -Dm700 -t $TERMUX_PREFIX/bin target/${CARGO_TARGET_NAME}/release/below
}