From 9aa061ba94e3a2b0e0ed98beae75cf31e3e35bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E5=A4=A9=E5=A4=A9?= Date: Sun, 12 Jan 2025 14:24:07 +0800 Subject: [PATCH] fix: build on macOS (maybe any other platform except Linux?) --- README.md | 18 ++++++++++++------ TMessagesProj/jni/build_dav1d_clang.sh | 2 +- TMessagesProj/jni/build_ffmpeg_clang.sh | 2 +- TMessagesProj/jni/build_libvpx_clang.sh | 2 +- TMessagesProj/jni/patch_ffmpeg.sh | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7eec9ab83e..bea31395a3 100644 --- a/README.md +++ b/README.md @@ -104,20 +104,26 @@ MTProto protocol manuals: 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: @@ -147,7 +153,7 @@ Build: 7. Build with Gradle: ```shell - ./gradlew assembleMini + ./gradlew assemble ``` 8. Generate `TMessagesProj/jni/integrity/genuine.h` - https://github.com/brevent/genuine diff --git a/TMessagesProj/jni/build_dav1d_clang.sh b/TMessagesProj/jni/build_dav1d_clang.sh index 1d7d9c0664..f387420c29 100755 --- a/TMessagesProj/jni/build_dav1d_clang.sh +++ b/TMessagesProj/jni/build_dav1d_clang.sh @@ -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" diff --git a/TMessagesProj/jni/build_ffmpeg_clang.sh b/TMessagesProj/jni/build_ffmpeg_clang.sh index a6300c906e..fee59f2828 100755 --- a/TMessagesProj/jni/build_ffmpeg_clang.sh +++ b/TMessagesProj/jni/build_ffmpeg_clang.sh @@ -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" diff --git a/TMessagesProj/jni/build_libvpx_clang.sh b/TMessagesProj/jni/build_libvpx_clang.sh index bc86f5d7af..749e6837c3 100755 --- a/TMessagesProj/jni/build_libvpx_clang.sh +++ b/TMessagesProj/jni/build_libvpx_clang.sh @@ -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 diff --git a/TMessagesProj/jni/patch_ffmpeg.sh b/TMessagesProj/jni/patch_ffmpeg.sh index 9f2f064aeb..5b071d92bc 100755 --- a/TMessagesProj/jni/patch_ffmpeg.sh +++ b/TMessagesProj/jni/patch_ffmpeg.sh @@ -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