2018-12-09 17:39:42 +01:00
|
|
|
TERMUX_PKG_HOMEPAGE=https://www.frida.re/
|
2018-03-05 22:15:17 +01:00
|
|
|
TERMUX_PKG_DESCRIPTION="Dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers"
|
2019-01-24 20:15:44 +01:00
|
|
|
TERMUX_PKG_LICENSE="wxWindows"
|
|
|
|
TERMUX_PKG_MAINTAINER="Henrik Grimler @Grimler91"
|
2021-12-05 14:00:12 +01:00
|
|
|
_MAJOR_VERSION=15
|
|
|
|
_MINOR_VERSION=1
|
|
|
|
_MICRO_VERSION=12
|
2019-05-19 09:06:07 +02:00
|
|
|
TERMUX_PKG_VERSION=${_MAJOR_VERSION}.${_MINOR_VERSION}.${_MICRO_VERSION}
|
2020-08-03 11:30:13 +02:00
|
|
|
TERMUX_PKG_GIT_BRANCH=$TERMUX_PKG_VERSION
|
2019-01-20 16:36:51 +01:00
|
|
|
TERMUX_PKG_SRCURL=https://github.com/frida/frida.git
|
2020-02-23 16:24:49 +01:00
|
|
|
TERMUX_PKG_DEPENDS="libiconv, python"
|
|
|
|
TERMUX_PKG_BUILD_DEPENDS="openssl"
|
2019-08-13 15:25:48 +02:00
|
|
|
TERMUX_PKG_BUILD_IN_SRC=true
|
2020-08-03 11:31:34 +02:00
|
|
|
TERMUX_PKG_HOSTBUILD=true
|
2020-12-31 17:08:37 +01:00
|
|
|
TERMUX_PKG_NO_STATICSPLIT=true
|
2020-08-16 19:29:19 +02:00
|
|
|
TERMUX_PKG_EXTRA_MAKE_ARGS="ANDROID_NDK_ROOT=$NDK"
|
2020-09-11 21:36:10 +02:00
|
|
|
TERMUX_PKG_CONFFILES="var/service/frida-server/run var/service/frida-server/down"
|
2020-08-03 11:31:34 +02:00
|
|
|
|
2020-08-16 19:29:19 +02:00
|
|
|
termux_step_pre_configure () {
|
|
|
|
_PYTHON_VERSION=$(source $TERMUX_SCRIPTDIR/packages/python/build.sh; echo $_MAJOR_VERSION)
|
|
|
|
export TERMUX_PKG_EXTRA_MAKE_ARGS+=" PYTHON=/usr/bin/python${_PYTHON_VERSION}"
|
2020-10-08 21:50:52 +02:00
|
|
|
sed -e "s%@TERMUX_PREFIX@%$TERMUX_PREFIX%g" \
|
|
|
|
-e "s%@PYTHON_VERSION@%$_PYTHON_VERSION%g" \
|
|
|
|
$TERMUX_PKG_BUILDER_DIR/frida-python-version.diff | patch -Np1
|
2020-08-16 19:29:19 +02:00
|
|
|
}
|
2019-01-20 16:36:51 +01:00
|
|
|
|
2018-06-13 22:44:37 +02:00
|
|
|
termux_step_host_build () {
|
2021-12-05 14:00:12 +01:00
|
|
|
local node_version=14.18.1
|
2018-09-29 18:33:27 +02:00
|
|
|
termux_download https://nodejs.org/dist/v${node_version}/node-v${node_version}-linux-x64.tar.xz \
|
2018-12-09 17:39:42 +01:00
|
|
|
${TERMUX_PKG_CACHEDIR}/node-v${node_version}-linux-x64.tar.xz \
|
2021-12-05 14:00:12 +01:00
|
|
|
ad1e3baa1aee8028b43206da3b2be9b8867cb598b4318bc88a0ae4518cc062a2
|
2018-12-09 17:39:42 +01:00
|
|
|
tar -xf ${TERMUX_PKG_CACHEDIR}/node-v${node_version}-linux-x64.tar.xz --strip-components=1
|
2018-06-13 22:44:37 +02:00
|
|
|
}
|
2018-03-05 22:15:17 +01:00
|
|
|
|
2019-05-19 09:06:07 +02:00
|
|
|
termux_step_post_configure () {
|
|
|
|
# frida-version.h is normally generated from git and the commits.
|
|
|
|
sed -i "s/@TERMUX_PKG_VERSION@/$TERMUX_PKG_VERSION/g" ${TERMUX_PKG_SRCDIR}/build/frida-version.h
|
|
|
|
sed -i "s/@_MAJOR_VERSION@/$_MAJOR_VERSION/g" ${TERMUX_PKG_SRCDIR}/build/frida-version.h
|
|
|
|
sed -i "s/@_MINOR_VERSION@/$_MINOR_VERSION/g" ${TERMUX_PKG_SRCDIR}/build/frida-version.h
|
|
|
|
sed -i "s/@_MICRO_VERSION@/$_MICRO_VERSION/g" ${TERMUX_PKG_SRCDIR}/build/frida-version.h
|
|
|
|
}
|
|
|
|
|
2018-03-05 22:15:17 +01:00
|
|
|
termux_step_make () {
|
2018-12-09 17:39:42 +01:00
|
|
|
if [[ ${TERMUX_ARCH} == "aarch64" ]]; then
|
2018-03-05 22:15:17 +01:00
|
|
|
arch=arm64
|
2018-12-09 17:39:42 +01:00
|
|
|
elif [[ ${TERMUX_ARCH} == "i686" ]]; then
|
2018-06-12 23:19:03 +02:00
|
|
|
arch=x86
|
2018-03-05 22:15:17 +01:00
|
|
|
else
|
2018-12-09 17:39:42 +01:00
|
|
|
arch=${TERMUX_ARCH}
|
2018-03-05 22:15:17 +01:00
|
|
|
fi
|
2020-12-31 17:08:37 +01:00
|
|
|
CC=gcc CXX=g++ PATH=${TERMUX_PKG_HOSTBUILD_DIR}/bin:$PATH \
|
2020-08-03 11:31:34 +02:00
|
|
|
make python-android-${arch} ${TERMUX_PKG_EXTRA_MAKE_ARGS}
|
2020-12-31 17:08:37 +01:00
|
|
|
CC=gcc CXX=g++ PATH=${TERMUX_PKG_HOSTBUILD_DIR}/bin:$PATH \
|
2020-08-03 11:31:34 +02:00
|
|
|
make tools-android-${arch} ${TERMUX_PKG_EXTRA_MAKE_ARGS}
|
2018-06-12 23:19:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
termux_step_make_install () {
|
2020-02-23 16:24:49 +01:00
|
|
|
install build/frida-android-${arch}/bin/frida-server \
|
|
|
|
build/frida-android-${arch}/bin/frida-inject \
|
|
|
|
build/frida-android-${arch}/bin/frida-discover \
|
|
|
|
build/frida-android-${arch}/bin/frida \
|
|
|
|
build/frida-android-${arch}/bin/frida-kill \
|
|
|
|
build/frida-android-${arch}/bin/frida-ls-devices \
|
|
|
|
build/frida-android-${arch}/bin/frida-ps \
|
|
|
|
build/frida-android-${arch}/bin/frida-trace \
|
|
|
|
${TERMUX_PREFIX}/bin/
|
2020-12-31 17:08:37 +01:00
|
|
|
install build/frida-android-${arch}/lib/{*.so,*.a} ${TERMUX_PREFIX}/lib/
|
2020-02-23 21:18:04 +01:00
|
|
|
cp -r build/frida-android-${arch}/lib/{pkgconfig,python*} ${TERMUX_PREFIX}/lib/
|
2020-12-31 17:08:37 +01:00
|
|
|
cp -r build/frida-android-${arch}/include/frida-* ${TERMUX_PREFIX}/include/
|
2020-02-23 16:24:49 +01:00
|
|
|
cp -r build/frida-android-${arch}/share/vala ${TERMUX_PREFIX}/share/
|
2018-03-05 22:15:17 +01:00
|
|
|
}
|
2020-09-11 21:36:10 +02:00
|
|
|
|
|
|
|
termux_step_post_make_install () {
|
|
|
|
# Setup termux-services scripts
|
|
|
|
mkdir -p $TERMUX_PREFIX/var/service/frida-server/log
|
|
|
|
{
|
|
|
|
echo "#!$TERMUX_PREFIX/bin/sh"
|
|
|
|
echo "unset LD_PRELOAD"
|
|
|
|
echo "exec su -c $TERMUX_PREFIX/bin/frida-server 2>&1"
|
|
|
|
} > $TERMUX_PREFIX/var/service/frida-server/run
|
|
|
|
|
|
|
|
# Unfortunately, running sv down frida-server just kills the "su" process but leaves frida-server
|
|
|
|
# running (even though it is running in the foreground). This finish script works around that.
|
|
|
|
{
|
|
|
|
echo "#!$TERMUX_PREFIX/bin/sh"
|
|
|
|
echo "su -c pkill -9 frida-server"
|
|
|
|
} > $TERMUX_PREFIX/var/service/frida-server/finish
|
|
|
|
chmod u+x $TERMUX_PREFIX/var/service/frida-server/run $TERMUX_PREFIX/var/service/frida-server/finish
|
|
|
|
|
|
|
|
ln -sf $TERMUX_PREFIX/share/termux-services/svlogger $TERMUX_PREFIX/var/service/frida-server/log/run
|
|
|
|
|
|
|
|
touch $TERMUX_PREFIX/var/service/frida-server/down
|
|
|
|
}
|