-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
build.sh
66 lines (58 loc) · 2.23 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
TERMUX_PKG_HOMEPAGE=https://github.com/chipsenkbeil/distant
TERMUX_PKG_DESCRIPTION="Library and tooling that supports remote filesystem and process"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.20.0-alpha.4
TERMUX_PKG_SRCURL=https://github.com/chipsenkbeil/distant/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=9bace1cc4492285c4932db0d2faea99af5b603c138d23a902ac460c03bc78ef0
TERMUX_PKG_DEPENDS="libssh2, openssl, zlib"
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_pre_configure() {
export OPENSSL_NO_VENDOR=1
export OPENSSL_INCLUDE_DIR=$TERMUX_PREFIX/include/openssl
export OPENSSL_LIB_DIR=$TERMUX_PREFIX/lib
export LIBSSH2_SYS_USE_PKG_CONFIG=1
export PKG_CONFIG_ALLOW_CROSS=1
termux_setup_rust
: "${CARGO_HOME:=$HOME/.cargo}"
export CARGO_HOME
cargo fetch --target $CARGO_TARGET_NAME
local d
local p=termios-0.2.2.diff
for d in $CARGO_HOME/registry/src/*/termios-0.2.2; do
patch --silent -p1 -d ${d} \
< "$TERMUX_PKG_BUILDER_DIR/${p}" || :
done
p=service-manager-0.2.0.diff
for d in $CARGO_HOME/registry/src/*/service-manager-*; do
patch --silent -p1 -d ${d} \
< "$TERMUX_PKG_BUILDER_DIR/${p}" || :
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/distant
}
termux_step_post_massage() {
mkdir -p ./share/bash-completion/completions
mkdir -p ./share/zsh/site-functions
mkdir -p ./share/fish/vendor_completions.d
}
termux_step_create_debscripts() {
cat <<-EOF > ./postinst
#!${TERMUX_PREFIX}/bin/sh
${TERMUX_PREFIX}/bin/distant generate completion bash > ${TERMUX_PREFIX}/share/bash-completion/completions/distant
${TERMUX_PREFIX}/bin/distant generate completion zsh > ${TERMUX_PREFIX}/share/zsh/site-functions/_distant
${TERMUX_PREFIX}/bin/distant generate completion fish > ${TERMUX_PREFIX}/share/fish/vendor_completions.d/distant.fish
exit 0
EOF
cat <<-EOF > ./prerm
#!${TERMUX_PREFIX}/bin/sh
rm -f ${TERMUX_PREFIX}/share/bash-completion/completions/distant
rm -f ${TERMUX_PREFIX}/share/zsh/site-functions/_distant
rm -f ${TERMUX_PREFIX}/share/fish/vendor_completions.d/distant.fish
exit 0
EOF
}