Skip to content

Commit

Permalink
enhance(main/termux-exec): add support for v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
agnostic-apollo committed Dec 27, 2024
1 parent cf7fe02 commit 06a7f69
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 2 deletions.
49 changes: 47 additions & 2 deletions packages/termux-exec/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,56 @@
TERMUX_PKG_HOMEPAGE=https://github.com/termux/termux-exec
TERMUX_PKG_DESCRIPTION="An execve() wrapper to make /bin and /usr/bin shebangs work"
TERMUX_PKG_DESCRIPTION="A LD_PRELOAD shared library for proper functioning of the Termux execution environment"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1:1.0
TERMUX_PKG_SRCURL=https://github.com/termux/termux-exec/archive/v${TERMUX_PKG_VERSION:2}.tar.gz
TERMUX_PKG_SHA256=b977592f197bf3a87e8a005ea0ccefb3e144edc81d5e3dc8d1ad1a12512f4a68
TERMUX_PKG_ESSENTIAL=true
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_MAKE_ARGS="TERMUX_PREFIX=${TERMUX_PREFIX} TERMUX_BASE_DIR=${TERMUX_BASE_DIR}"
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_EXTRA_MAKE_ARGS="TERMUX_EXEC_PKG__VERSION=${TERMUX_PKG_VERSION} TERMUX_EXEC_PKG__ARCH=${TERMUX_ARCH} \
TERMUX__NAME=${TERMUX__NAME} TERMUX__LNAME=${TERMUX__LNAME} \
TERMUX_APP__PACKAGE_NAME=${TERMUX_APP__PACKAGE_NAME} TERMUX_APP__DATA_DIR=${TERMUX_APP__DATA_DIR} \
TERMUX__ROOTFS=${TERMUX__ROOTFS} TERMUX__PREFIX=${TERMUX__PREFIX} \
TERMUX_ENV__S_ROOT=${TERMUX_ENV__S_ROOT} \
TERMUX_ENV__SS_TERMUX=${TERMUX_ENV__SS_TERMUX} TERMUX_ENV__S_TERMUX=${TERMUX_ENV__S_TERMUX} \
TERMUX_ENV__SS_TERMUX_APP=${TERMUX_ENV__SS_TERMUX_APP} TERMUX_ENV__S_TERMUX_APP=${TERMUX_ENV__S_TERMUX_APP} \
TERMUX_ENV__SS_TERMUX_API_APP=${TERMUX_ENV__SS_TERMUX_API_APP} TERMUX_ENV__S_TERMUX_API_APP=${TERMUX_ENV__S_TERMUX_API_APP} \
TERMUX_ENV__SS_TERMUX_ROOTFS=${TERMUX_ENV__SS_TERMUX_ROOTFS} TERMUX_ENV__S_TERMUX_ROOTFS=${TERMUX_ENV__S_TERMUX_ROOTFS} \
TERMUX_ENV__SS_TERMUX_CORE=${TERMUX_ENV__SS_TERMUX_CORE} TERMUX_ENV__S_TERMUX_CORE=${TERMUX_ENV__S_TERMUX_CORE} \
TERMUX_ENV__SS_TERMUX_CORE__TESTS=${TERMUX_ENV__SS_TERMUX_CORE__TESTS} TERMUX_ENV__S_TERMUX_CORE__TESTS=${TERMUX_ENV__S_TERMUX_CORE__TESTS} \
TERMUX_ENV__SS_TERMUX_EXEC=${TERMUX_ENV__SS_TERMUX_EXEC} TERMUX_ENV__S_TERMUX_EXEC=${TERMUX_ENV__S_TERMUX_EXEC} \
TERMUX_ENV__SS_TERMUX_EXEC__TESTS=${TERMUX_ENV__SS_TERMUX_EXEC__TESTS} TERMUX_ENV__S_TERMUX_EXEC__TESTS=${TERMUX_ENV__S_TERMUX_EXEC__TESTS} \
TERMUX_APP__NAMESPACE=${TERMUX_APP__NAMESPACE} \
TERMUX_APP__SHELL_ACTIVITY__COMPONENT_NAME=${TERMUX_APP__SHELL_ACTIVITY__COMPONENT_NAME} TERMUX_APP__SHELL_SERVICE__COMPONENT_NAME=${TERMUX_APP__SHELL_SERVICE__COMPONENT_NAME}"

termux_step_install_license() {
mkdir -p "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME/licenses"
mv "$TERMUX_PKG_SRCDIR/LICENSE" "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME/copyright"
mv "$TERMUX_PKG_SRCDIR/licenses/"* "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME/licenses/"
}

termux_step_post_massage() {
# Hack to compile runtime-binary-tests for api level 28 if default (currently 24) is less than it.
if [[ "$TERMUX_PKG_API_LEVEL" -lt 28 ]]; then
export TERMUX_PKG_API_LEVEL=28
termux_step_setup_toolchain

local QUIET_BUILD=
if [ "$TERMUX_QUIET_BUILD" = true ]; then
QUIET_BUILD="-s"
fi

echo "Building termux-exec runtime-binary-tests for TERMUX_PKG_API_LEVEL '$TERMUX_PKG_API_LEVEL'"
cd "$TERMUX_PKG_BUILDDIR"
make -j $TERMUX_PKG_MAKE_PROCESSES $QUIET_BUILD $TERMUX_PKG_EXTRA_MAKE_ARGS TERMUX_EXEC__TESTS__API_LEVEL=28 build-runtime-binary-tests

local TERMUX_EXEC__TESTS__TESTS_PATH="$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/libexec/installed-tests/termux-exec"

install -m700 build/usr/libexec/installed-tests/termux-exec/runtime-binary-tests-fsanitize28 "$TERMUX_EXEC__TESTS__TESTS_PATH/runtime-binary-tests-fsanitize28"
$TERMUX_ELF_CLEANER --api-level 28 "$TERMUX_EXEC__TESTS__TESTS_PATH/runtime-binary-tests-fsanitize28"

install -m700 build/usr/libexec/installed-tests/termux-exec/runtime-binary-tests-nofsanitize28 "$TERMUX_EXEC__TESTS__TESTS_PATH/runtime-binary-tests-nofsanitize28"
$TERMUX_ELF_CLEANER --api-level 28 "$TERMUX_EXEC__TESTS__TESTS_PATH/runtime-binary-tests-nofsanitize28"
fi
}
1 change: 1 addition & 0 deletions scripts/build/termux_step_patch_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ termux_step_patch_package() {
-e "s%\@TERMUX_ENV__S_TERMUX_APP\@%${TERMUX_ENV__S_TERMUX_APP}%g" \
-e "s%\@TERMUX_ENV__S_TERMUX_API_APP\@%${TERMUX_ENV__S_TERMUX_API_APP}%g" \
-e "s%\@TERMUX_ENV__S_TERMUX_ROOTFS\@%${TERMUX_ENV__S_TERMUX_ROOTFS}%g" \
-e "s%\@TERMUX_ENV__S_TERMUX_EXEC\@%${TERMUX_ENV__S_TERMUX_EXEC}%g" \
"$patch" | patch --silent -p1
done
shopt -u nullglob
Expand Down
48 changes: 48 additions & 0 deletions scripts/properties.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,54 @@ TERMUX_ENV__S_TERMUX_CORE__TESTS="${TERMUX_ENV__S_ROOT}${TERMUX_ENV__SS_TERMUX_C



##
# Termux environment variables `termux-exec` sub scope.
#
# **Do not modify this!** This is considered a constant `termux-exec`
# sub scope for Termux execution environment that's used by external
# programs that do not use the termux packages building infrastructure
# and rely on `$TERMUX_ENV__S_ROOT` environment variable exported by
# Termux app containing the root scope to generate the value for
# `$TERMUX_ENV__S_TERMUX_EXEC` and variable names under it.**
#
# Default value: `EXEC__`
##
TERMUX_ENV__SS_TERMUX_EXEC="EXEC__"

##
# Termux environment variables `termux-exec` scope.
#
# **Do not modify this!**
#
# Default value: `TERMUX_EXEC__`
##
TERMUX_ENV__S_TERMUX_EXEC="${TERMUX_ENV__S_ROOT}${TERMUX_ENV__SS_TERMUX_EXEC}"


##
# Termux environment variables `termux-exec-tests` sub scope.
#
# **Do not modify this!** This is considered a constant
# `termux-exec-tests` sub scope for Termux execution environment
# that's used by `termux-exec` package to generate the value for
# `$TERMUX_ENV__S_TERMUX_EXEC__TESTS` and variable names under it.**
#
# Default value: `TERMUX_EXEC__TESTS__`
##
TERMUX_ENV__SS_TERMUX_EXEC__TESTS="EXEC__TESTS__"

##
# Termux environment variables `termux-exec-tests` scope.
#
# **Do not modify this!**
#
# Default value: `TERMUX_EXEC__TESTS__`
##
TERMUX_ENV__S_TERMUX_EXEC__TESTS="${TERMUX_ENV__S_ROOT}${TERMUX_ENV__SS_TERMUX_EXEC__TESTS}"



##
# Termux environment variables `termux-am-socket` sub scope.
#
# **Do not modify this!** This is considered a constant `termux-am-socket`
Expand Down

0 comments on commit 06a7f69

Please sign in to comment.