-
Notifications
You must be signed in to change notification settings - Fork 0
/
repack.sh
executable file
·56 lines (44 loc) · 1.5 KB
/
repack.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
#!/bin/bash -ex
export TZ=UTC
export LC_ALL=C
STARTTIME=1000000000
STARTDATE='2001-09-09 01:46:00 i0,0'
rm *.aar &> /dev/null || true
rm -r ./release-package/ &> /dev/null || true
pushd upx
make all
popd
unzip -o lib/build/outputs/aar/lib-release.aar -d release-package
cd release-package
unzip -o classes.jar -d classes-repacked
rm classes.jar
pushd classes-repacked
find . -type f | sort | faketime -f "$STARTDATE" fastjar -@c0M > ../classes.jar
popd
rm -r classes-repacked/
unzip -o ../deps/build/libs/deps.jar -d libs-repacked
pushd libs-repacked
find . -type f | sort | faketime -f "$STARTDATE" fastjar -@c0M > ../libs/libs.jar
popd
rm -r libs-repacked/
unzip -o annotations.zip -d annotations-repacked
rm annotations.zip
pushd annotations-repacked
find . -type f | sort | faketime -f "$STARTDATE" fastjar -@c0M > ../annotations.zip
popd
rm -r annotations-repacked/
# no UPX
find . -type f | sort | faketime -f "$STARTDATE" fastjar -@c0M > ../release.aar
sha256sum ../release.aar
# no UPX + advancecomp
advzip -z -4 ../release.aar
sha256sum ../release.aar
# with UPX (should be repeatable, since we build UPX above, but who knows...)
chmod +x jni/*/*.so
../upx/src/upx.out --best --ultra-brute --android-shlib jni/x86/*.so
../upx/src/upx.out --best --ultra-brute --android-shlib jni/armeabi-v7a/*.so
find . -type f | sort | faketime -f "$STARTDATE" fastjar -@c0M > ../release-compressed.aar
sha256sum ../release-compressed.aar
# UPX + advancecomp
advzip -z -4 ../release-compressed.aar
sha256sum ../release-compressed.aar