Skip to content

Commit

Permalink
fix: local build on macOS or other platform
Browse files Browse the repository at this point in the history
  • Loading branch information
ruattd authored Jan 12, 2025
1 parent 5c356b2 commit 77f0a76
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,26 @@ MTProto protocol manuals: <https://core.telegram.org/mtproto>

Environment:

- A Linux distribution based on Debian (e.g. Ubuntu)
- Linux distribution based on Debian or Arch Linux, or macOS

- Native tools: `gcc` `go` `make` `cmake` `ninja` `yasm`
- Native tools: `gcc` `go` `make` `cmake` `ninja` `yasm` `meson` `pkgconf`

```shell
# for Debian based distribution
sudo apt install gcc golang make cmake ninja-build yasm
# for Arch Linux based distribution
sudo pacman -S base-devel go ninja cmake yasm meson
# for macOS
xcode-select --install # install developer tools (will open confirm dialog)
brew install go cmake ninja yasm meson pkgconf # install other tools by homebrew
```
- Android SDK: `build-tools;33.0.0` `platforms;android-33` `ndk;21.4.7075529` `cmake;3.18.1` (the default location is **$HOME/Android/SDK**, otherwise you need to specify **$ANDROID_HOME** for it)
- Android SDK: `build-tools;33.0.0` `platforms;android-33` `ndk;21.4.7075529` `cmake;3.18.1` `cmake;3.22.1` (the default location is **$HOME/Android/SDK**, otherwise you need to specify **$ANDROID_HOME** for it)

It is recommended to use [Android Studio](https://developer.android.com/studio) to install, but you can also use `sdkmanager`:
It is recommended to use [Android Studio](https://developer.android.com/studio) to install, but you can also use `sdkmanager` command on distributions based on Debian:

```shell
sudo apt install sdkmanager
sdkmanager --sdk_root $HOME/Android/SDK --install "build-tools;33.0.0" "platforms;android-33" "ndk;21.4.7075529" "cmake;3.18.1"
sdkmanager --sdk_root $HOME/Android/SDK --install "build-tools;33.0.0" "platforms;android-33" "ndk;21.4.7075529" "cmake;3.18.1" "cmake;3.22.1"
```

Build:
Expand Down Expand Up @@ -147,7 +153,7 @@ Build:
7. Build with Gradle:

```shell
./gradlew assembleMini<Debug/Release/ReleaseNoGcm>
./gradlew assemble<Release/Debug>
```

8. Generate `TMessagesProj/jni/integrity/genuine.h` - https://github.com/brevent/genuine
Expand Down
2 changes: 1 addition & 1 deletion TMessagesProj/jni/build_dav1d_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ checkPreRequisites
cd dav1d

## common
LLVM_PREFIX="${NDK}/toolchains/llvm/prebuilt/linux-x86_64"
LLVM_PREFIX="${NDK}/toolchains/llvm/prebuilt/${BUILD_PLATFORM}"
LLVM_BIN="${LLVM_PREFIX}/bin"
PREFIX_D=$(realpath .)
VERSION="4.9"
Expand Down
2 changes: 1 addition & 1 deletion TMessagesProj/jni/build_ffmpeg_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ checkPreRequisites
cd ffmpeg

## common
LLVM_PREFIX="${NDK}/toolchains/llvm/prebuilt/linux-x86_64"
LLVM_PREFIX="${NDK}/toolchains/llvm/prebuilt/${BUILD_PLATFORM}"
LLVM_BIN="${LLVM_PREFIX}/bin"
PREFIX_D=$(realpath ..)
VERSION="4.9"
Expand Down
2 changes: 1 addition & 1 deletion TMessagesProj/jni/build_libvpx_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ checkPreRequisites
cd libvpx

## common
LLVM_PREFIX="${NDK}/toolchains/llvm/prebuilt/linux-x86_64"
LLVM_PREFIX="${NDK}/toolchains/llvm/prebuilt/${BUILD_PLATFORM}"
LLVM_BIN="${LLVM_PREFIX}/bin"
VERSION="4.9"
ANDROID_API=21
Expand Down
2 changes: 1 addition & 1 deletion TMessagesProj/jni/patch_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ patch -d ffmpeg -p1 < patches/ffmpeg/0001-compilation-magic.patch
patch -d ffmpeg -p1 < patches/ffmpeg/0002-compilation-magic-2.patch

function cp {
install -D $@
install "$1" "$2"
}

cp ffmpeg/libavformat/dv.h ffmpeg/build/arm64-v8a/include/libavformat/dv.h
Expand Down

0 comments on commit 77f0a76

Please sign in to comment.