frida: download through SRCURL, include only binaries in pkg

Download node in a HOST_BUILD step.

Package is ready to be added to repo (after some more testing).
This commit is contained in:
Henrik Grimler 2018-06-13 20:44:37 +00:00 committed by Yaksh Bariya
parent 20d59131e2
commit 41109aec58
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
2 changed files with 59 additions and 30 deletions

View File

@ -1,5 +1,15 @@
--- ../Makefile.linux.mk.orig 2018-06-12 20:38:08.118306747 +0000
+++ ./Makefile.linux.mk 2018-06-12 20:39:14.502269610 +0000
@@ -108,7 +108,7 @@
define make-gum-rules
build/.$1-gum-npm-stamp: build/$1-env-linux-$$(build_arch).rc
@$$(NPM) --version &>/dev/null || (echo -e "\033[31mOops. It appears Node.js is not installed.\nWe need it for processing JavaScript code at build-time.\nCheck PATH or set NODE to the absolute path of your Node.js binary.\033[0m"; exit 1;)
- . build/$1-env-linux-$$(build_arch).rc && cd frida-gum/bindings/gumjs && npm install
+ . build/$1-env-linux-$$(build_arch).rc && cd frida-gum/bindings/gumjs && $(NPM) install
@touch $$@
build/$1-%/lib/pkgconfig/frida-gum-1.0.pc: build/.frida-gum-submodule-stamp build/.$1-gum-npm-stamp build/$1-%/lib/pkgconfig/capstone.pc
@@ -380,7 +380,7 @@
server-armhf: build/frida-linux-armhf/lib/pkgconfig/frida-core-1.0.pc ##@server Build for arm
server-mips: build/frida-linux-mips/lib/pkgconfig/frida-core-1.0.pc ##@server Build for mips

View File

@ -3,40 +3,57 @@ TERMUX_PKG_DESCRIPTION="Dynamic instrumentation toolkit for developers, reverse-
_MAJOR_VERSION=11
_MINOR_VERSION=0
_MICRO_VERSION=12
TERMUX_PKG_VERSION=$_MAJOR_VERSION.$_MINOR_VERSION.$_MICRO_VERSION
TERMUX_PKG_SRCURL="https://github.com/frida/frida/archive/$TERMUX_PKG_VERSION.tar.gz"
TERMUX_PKG_SHA256="4ef25eff488b8283ef50ea28b8f40c4da197b13601f78a1a508b7373a7ef7ca0"
TERMUX_PKG_VERSION=()
TERMUX_PKG_SHA256=()
TERMUX_PKG_VERSION+=($_MAJOR_VERSION.$_MINOR_VERSION.$_MICRO_VERSION) # frida
# Sort of abusive use of $TERMUX_PKG_VERSION:
TERMUX_PKG_VERSION+=(a1a383436ba147767af1887c2015e5a863359669) # capstone
TERMUX_PKG_VERSION+=(29a784e39a4306a42dced23d5f29bfdef78e2af9) # frida-core
TERMUX_PKG_VERSION+=(97b135889d237bde25d124b2dc50e781d02fe3d0) # frida-gum
TERMUX_PKG_VERSION+=(cf4033d9067b7926d1449bc2324deb1d9ea7e43c) # frida-python
TERMUX_PKG_VERSION+=(e3260d8f0c749372c4ab4fbb243cfe2c4e0f1eef) # frida-clr
TERMUX_PKG_VERSION+=(af6fde67449bad7aec1d36071ba7cbc7ef2f2dc7) # frida-qml
TERMUX_PKG_VERSION+=(4fe0b0891430bd28ce9faeb62b6b29644e97f06e) # frida-swift
TERMUX_PKG_VERSION+=(00a48399a1f5f2dab637bb7dca74dd27980becdc) # releng/meson
TERMUX_PKG_SHA256+=(4ef25eff488b8283ef50ea28b8f40c4da197b13601f78a1a508b7373a7ef7ca0) # frida
TERMUX_PKG_SHA256+=(e3267fa036a84c695d371a08830701702b82fa32a961b0f5ecaa65a56eaf5dcc) # capstone
TERMUX_PKG_SHA256+=(999f2cf06778d0844edc30029920b1fd1917f8e71c87e5798ddfccf1fc8ad47f) # frida-core
TERMUX_PKG_SHA256+=(f8d647e73d52a9cce79e6089c2438e36dd518dda01937597fd4da4760089d640) # frida-gum
TERMUX_PKG_SHA256+=(ba8ff5c3c170143734308734ced12fa3ed245ade19e9149912cdaf301ef92bda) # frida-python
TERMUX_PKG_SHA256+=(273975246bdd36cc45f7f2c6ea65f079336902e701aa4cad2e462e81d3437afa) # frida-clr
TERMUX_PKG_SHA256+=(61484407afbb89306f874f2af3275db8f8955376a5acf6cb947cb89b1ff757a9) # frida-qml
TERMUX_PKG_SHA256+=(0ac156bfa8063a53ee42a42d77414a257f283500edc1b94ff335abc4ffc9bfff) # frida-swift
TERMUX_PKG_SHA256+=(1e54e6d56dd7f5d9430849f23ba3653d5a4a137c4bfbaacf8aef8fdefc6df68c) # releng/meson
_modules=(frida capstone frida-core frida-gum frida-python frida-clr frida-qml frida-swift meson)
TERMUX_PKG_SRCURL=(https://github.com/frida/frida/archive/$TERMUX_PKG_VERSION.tar.gz
https://github.com/frida/capstone/archive/${TERMUX_PKG_VERSION[1]}.zip
https://github.com/frida/frida-core/archive/${TERMUX_PKG_VERSION[2]}.zip
https://github.com/frida/frida-gum/archive/${TERMUX_PKG_VERSION[3]}.zip
https://github.com/frida/frida-python/archive/${TERMUX_PKG_VERSION[4]}.zip
https://github.com/frida/frida-clr/archive/${TERMUX_PKG_VERSION[5]}.zip
https://github.com/frida/frida-qml/archive/${TERMUX_PKG_VERSION[6]}.zip
https://github.com/frida/frida-swift/archive/${TERMUX_PKG_VERSION[7]}.zip
https://github.com/frida/meson/archive/${TERMUX_PKG_VERSION[8]}.zip)
TERMUX_PKG_MAINTAINER="Henrik Grimler @Grimler91"
TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_EXTRA_MAKE_ARGS="ANDROID_NDK_ROOT=$HOME/lib/android-ndk"
TERMUX_PKG_HOSTBUILD=yes
###
# NOTE THAT BUILDING FRIDA REQUIRES npm AND rsync
###
termux_step_host_build () {
termux_download https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-x64.tar.xz \
$TERMUX_PKG_CACHEDIR/node-v8.11.3-linux-x64.tar.xz
tar -xf $TERMUX_PKG_CACHEDIR/node-v8.11.3-linux-x64.tar.xz --strip-components=1
}
# submodule name commit sha256
_submodules=("capstone" "a1a383436ba147767af1887c2015e5a863359669" "e3267fa036a84c695d371a08830701702b82fa32a961b0f5ecaa65a56eaf5dcc"
"frida-core" "29a784e39a4306a42dced23d5f29bfdef78e2af9" "999f2cf06778d0844edc30029920b1fd1917f8e71c87e5798ddfccf1fc8ad47f"
"frida-gum" "97b135889d237bde25d124b2dc50e781d02fe3d0" "f8d647e73d52a9cce79e6089c2438e36dd518dda01937597fd4da4760089d640"
"frida-python" "cf4033d9067b7926d1449bc2324deb1d9ea7e43c" "ba8ff5c3c170143734308734ced12fa3ed245ade19e9149912cdaf301ef92bda"
"frida-clr" "e3260d8f0c749372c4ab4fbb243cfe2c4e0f1eef" "273975246bdd36cc45f7f2c6ea65f079336902e701aa4cad2e462e81d3437afa"
"frida-qml" "af6fde67449bad7aec1d36071ba7cbc7ef2f2dc7" "61484407afbb89306f874f2af3275db8f8955376a5acf6cb947cb89b1ff757a9"
"frida-swift" "4fe0b0891430bd28ce9faeb62b6b29644e97f06e" "0ac156bfa8063a53ee42a42d77414a257f283500edc1b94ff335abc4ffc9bfff"
"releng/meson" "00a48399a1f5f2dab637bb7dca74dd27980becdc" "1e54e6d56dd7f5d9430849f23ba3653d5a4a137c4bfbaacf8aef8fdefc6df68c")
termux_step_pre_configure () {
mkdir -p $TERMUX_PKG_SRCDIR/build
cd $TERMUX_PKG_TMPDIR
# github's releases doesn't include git submodules, therefore we have to do this mess:
for idx in $(seq 0 3 $((${#_submodules[@]}-1))); do
termux_download https://github.com/frida/$(basename ${_submodules[$idx]})/archive/${_submodules[$((idx+1))]}.zip \
$TERMUX_PKG_CACHEDIR/$(basename ${_submodules[$idx]}).zip \
${_submodules[$((idx+2))]}
unzip -q $TERMUX_PKG_CACHEDIR/$(basename ${_submodules[$idx]}).zip
mv $(basename ${_submodules[$idx]})-*/* $TERMUX_PKG_SRCDIR/${_submodules[$idx]}/
# releng/common.mk normally echoes commit message to these *submodule-stamp files
echo ${_submodules[$((idx+1))]} > $TERMUX_PKG_SRCDIR/build/.$(basename ${_submodules[$idx]})-submodule-stamp
termux_step_post_extract_package () {
mkdir build
for i in $(seq 1 $(( ${#_modules[@]}-1 ))); do
rm -rf ${_modules[$i]}
mv ${_modules[$i]}-${TERMUX_PKG_VERSION[$i]} ${_modules[$i]}
echo ${TERMUX_PKG_VERSION[$i]} > $TERMUX_PKG_SRCDIR/build/.${_modules[$i]}-submodule-stamp
done
mv meson releng/
}
termux_step_post_configure () {
@ -57,9 +74,11 @@ termux_step_make () {
fi
# Build only for desired architecture:
sed -i "s/@TERMUX_ARCH@/$arch/g" $TERMUX_PKG_SRCDIR/Makefile.linux.mk
make server-android ${TERMUX_PKG_EXTRA_MAKE_ARGS}
NODE=$TERMUX_PKG_HOSTBUILD_DIR/bin/node make server-android ${TERMUX_PKG_EXTRA_MAKE_ARGS}
}
termux_step_make_install () {
rsync -r $TERMUX_PKG_SRCDIR/build/frida-android-$arch/ $TERMUX_PREFIX
# Only include frida-server and frida-inject. Is something else useful?
install $TERMUX_PKG_BUILDDIR/build/frida-android-$arch/bin/frida-server $TERMUX_PREFIX/bin/
install $TERMUX_PKG_BUILDDIR/build/frida-android-$arch/bin/frida-inject $TERMUX_PREFIX/bin/
}