-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
178 lines (166 loc) · 7.15 KB
/
Makefile
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
check-depot-tools:
ifndef DEPOT_TOOLS
echo 'Set path to depot_tools'
exit 1
endif
install-pwntools:
# install pwntools and binutils for aarch64
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pwntools
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'export PATH="/opt/homebrew/opt/binutils/bin:$(PATH)"' >> ~/.zshrc
remove-android-debug:
rm -rf ringrtc-debug
sudo rm -rf Signal-Android-debug
remove-android-sdk-tools:
rm -rf sdk
download-android-sdk-tools: remove-android-sdk-tools
curl https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip \
--output commandlinetools-linux-11076708_latest.zip
unzip commandlinetools-linux-11076708_latest.zip
mkdir sdk; mv cmdline-tools sdk
cd sdk/cmdline-tools; mkdir latest; mv bin latest; mv lib latest; \
mv NOTICE.txt latest; mv source.properties latest
echo 'y' | ./sdk/cmdline-tools/latest/bin/sdkmanager \
--install "ndk;25.1.8937393"
find ./sdk -name "libunwind.a" | grep aarch64 -q || \
echo "Error finding aarch64 libunwind.a, please check ndk install" && \
exit 1
build-android-ringrtc-debug: check-depot-tools
ifeq (,$(wildcard $(shell pwd)/sdk))
$(MAKE) download-android-sdk-tools
endif
rm -rf ringrtc-debug
sudo apt install libglib2.0-dev
git clone https://github.com/signalapp/ringrtc.git ringrtc-debug
# update version as of July 2024
cd ringrtc-debug; git checkout v2.44.0; git apply ../ringrtc_android.diff
cd ringrtc-debug; rustup target add \
armv7-linux-androideabi aarch64-linux-android i686-linux-android \
x86_64-linux-android
cd ringrtc-debug && JOBS=32 \
ANDROID_SDK_ROOT=$(PWD)/sdk/ \
ANDROID_NDK_HOME=$(PWD)/sdk/ndk/25.1.8937393/ \
PATH=$(DEPOT_TOOLS):$(PATH) make android
file ./ringrtc-debug/out/android-arm64/debug/lib.unstripped/libringrtc_rffi.so | \
grep "not stripped" -q || ( echo "Error, libringrtc_rffi.so is stripped" && \
exit 1 )
file ./ringrtc-debug/out/android-arm64/debug/lib.unstripped/libringrtc.so | \
grep "not stripped" -q || ( echo "Error, libringrtc.so is stripped" && \
exit 1 )
# Password for black server keychain is `password`
sign-android:
ifeq (,$(wildcard $(shell pwd)/my-release-key.keystore))
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name \
-keyalg RSA -keysize 2048 -validity 10000
endif
ifeq (,$(wildcard $(shell pwd)/sdk))
$(MAKE) download-android-sdk-tools
endif
# update to 7.10.3 as of July 2024
./sdk/build-tools/30.0.3/zipalign -p 4 \
$(PWD)/Signal-Android-play-prod-arm64-v8a-debug-7.10.3.apk \
$(PWD)/Signal-Android-play-prod-arm64-v8a-debug-7.10.3_unsigned_aligned.apk
./sdk/build-tools/30.0.3/apksigner sign --ks-key-alias alias_name --ks \
my-release-key.keystore --in \
$(PWD)/Signal-Android-play-prod-arm64-v8a-debug-7.10.3_unsigned_aligned.apk \
--out \
$(PWD)/Signal-Android-play-prod-arm64-v8a-debug-7.10.3_signed_aligned.apk
build-android-debug:
ifeq (,$(wildcard $(shell pwd)/ringrtc-debug))
$(MAKE) build-android-ringrtc-debug
endif
sudo rm -rf Signal-Android-debug
git clone https://github.com/signalapp/Signal-Android.git \
--recurse-submodules Signal-Android-debug
# update to 7.10.3 as of July 2024
cd Signal-Android-debug; git checkout tags/v7.10.3
cd Signal-Android-debug; git apply ../signal_android.diff
cp $(PWD)/ringrtc-debug/out/android-arm64/debug/lib.unstripped/libringrtc.so \
./Signal-Android-debug/app/src/main/jniLibs/arm64-v8a
cp $(PWD)/ringrtc-debug/out/android-arm64/debug/lib.unstripped/libringrtc_rffi.so \
./Signal-Android-debug/app/src/main/jniLibs/arm64-v8a
cd Signal-Android-debug/reproducible-builds; docker build -t signal-android .
cd Signal-Android-debug; docker run --rm -v $$(pwd):/project \
-w /project signal-android \
sh -c "git config --global --add safe.directory /project; ./gradlew clean assemblePlayProdDebug"
cp Signal-Android-debug/app/build/outputs/apk/playProd/debug/Signal-Android-play-prod-arm64-v8a-debug-7.10.3.apk .
$(MAKE) sign-android
remove-ios:
rm -rf Signal-iOS-debug
rm -rf Signal-iOS
rebuild-ringrtc: check-depot-tools
cd Signal-iOS-debug/Pods/SignalRingRTC; make clean;
cd Signal-iOS-debug/Pods/SignalRingRTC; \
PATH=$(DEPOT_TOOLS):$(PATH) make ios
cd Signal-iOS-debug/Pods/SignalRingRTC; \
mv out/build/aarch64-apple-ios-sim/debug \
out/build/aarch64-apple-ios-sim/release; \
mv out/build/debug out/build/release; \
mv out/debug out/release
cd Signal-iOS-debug/Pods/SignalRingRTC; \
cp out/release/libringrtc/aarch64-apple-ios-sim/libringrtc.a \
out/release/libringrtc/
build-ios-archive: remove-ios check-depot-tools
git clone https://github.com/signalapp/Signal-iOS.git \
--recurse-submodules Signal-iOS
# signal-ios version 7.13.0.131 as of Jun 2024
cd Signal-iOS; git checkout tags/7.13.0.131
cd Signal-iOS; make dependencies
cd Signal-iOS/Pods; rm -rf SignalRingRTC; \
git clone https://github.com/signalapp/ringrtc.git SignalRingRTC
cd Signal-iOS/Pods/SignalRingRTC; \
git checkout tags/v2.42.0
cd Signal-iOS/Pods; git apply ../../pods_archive.diff
cd Signal-iOS/Pods/SignalRingRTC/; \
rustup target add aarch64-apple-ios x86_64-apple-ios \
aarch64-apple-ios-sim && \
rustup component add rustc && \
rustup component add rust-src && \
cargo install cbindgen;
cd Signal-iOS/Pods/SignalRingRTC; make clean;
cd Signal-iOS/Pods/SignalRingRTC; \
PATH=$(DEPOT_TOOLS):$(PATH) make ios
cd Signal-iOS/Pods/SignalRingRTC/src/webrtc/src && \
git apply ../../../../../../webrtc.diff
cd Signal-iOS/Pods/SignalRingRTC; \
PATH=$(DEPOT_TOOLS):$(PATH) make clean
cd Signal-iOS/Pods/SignalRingRTC; \
PATH=$(DEPOT_TOOLS):$(PATH) make ios
build-ios-debug: remove-ios check-depot-tools
git clone https://github.com/signalapp/Signal-iOS.git \
--recurse-submodules Signal-iOS-debug
# signal-ios version 7.13.0.131 as of Jun 2024
cd Signal-iOS-debug; git checkout tags/7.13.0.131
cd Signal-iOS-debug; make dependencies
cd Signal-iOS-debug/Pods; rm -rf SignalRingRTC; \
git clone https://github.com/signalapp/ringrtc.git SignalRingRTC
# ringrtc v2.42.0 as of Jun 2024
cd Signal-iOS-debug/Pods/SignalRingRTC; \
git checkout tags/v2.42.0
cd Signal-iOS-debug/Pods; git apply ../../pods_simulator.diff
cd Signal-iOS-debug/Pods/SignalRingRTC && \
git apply ../../../ringrtc_make.diff
cd Signal-iOS-debug/Pods/SignalRingRTC/; \
rustup target add aarch64-apple-ios x86_64-apple-ios \
aarch64-apple-ios-sim && \
rustup component add rustc && \
rustup component add rust-src && \
cargo install cbindgen;
cd Signal-iOS-debug/Pods/SignalRingRTC; \
PATH=$(DEPOT_TOOLS):$(PATH) make ios
cd Signal-iOS-debug/Pods/SignalRingRTC/src/webrtc/src && \
git apply ../../../../../../webrtc.diff
cd Signal-iOS-debug/Pods/SignalRingRTC; \
PATH=$(DEPOT_TOOLS):$(PATH) make clean
cd Signal-iOS-debug/Pods/SignalRingRTC; \
PATH=$(DEPOT_TOOLS):$(PATH) make ios
cd Signal-iOS-debug/Pods/SignalRingRTC; \
mv out/build/aarch64-apple-ios-sim/debug \
out/build/aarch64-apple-ios-sim/release; \
mv out/build/debug out/build/release; \
mv out/debug out/release
cd Signal-iOS-debug/Pods/SignalRingRTC; \
cp out/release/libringrtc/aarch64-apple-ios-sim/libringrtc.a \
out/release/libringrtc/