diff --git a/.github/workflows/linux-kotato.yml b/.github/workflows/linux-kotato.yml index bbcb58202..7157651aa 100644 --- a/.github/workflows/linux-kotato.yml +++ b/.github/workflows/linux-kotato.yml @@ -93,14 +93,13 @@ jobs: p doc - name: Apt install. - shell: bash run: | apt-get update apt-get install software-properties-common -y && \ add-apt-repository ppa:git-core/ppa -y && \ apt-get update && \ apt-get install clang libglibmm-2.4-dev libicu-dev libssl-dev liblzma-dev zlib1g-dev \ - git wget autoconf automake build-essential libtool pkg-config bison nasm yasm unzip \ + git wget autoconf automake build-essential libtool pkg-config bison yasm unzip python3-pip \ libasound2-dev libpulse-dev libfuse2 libgtk-3-dev libgtk2.0-dev libatspi2.0-dev \ libgl1-mesa-dev libegl1-mesa-dev libxkbcommon-dev libxkbcommon-x11-dev libxcb1-dev \ libxcb-glx0-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev \ @@ -124,7 +123,6 @@ jobs: path: ${{ env.REPO_NAME }} - name: First set up. - shell: bash run: | wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" chmod a+x linuxdeployqt-continuous-x86_64.AppImage @@ -182,19 +180,35 @@ jobs: git clone -b v5.88.0 --depth=1 $GIT/KDE/extra-cmake-modules.git cd extra-cmake-modules - cmake . -DCMAKE_BUILD_TYPE=Release - cmake --build . --parallel - cmake --install . + cmake -B build -GNinja . -DCMAKE_BUILD_TYPE=Release + cmake --build build --parallel + cmake --install build cd .. rm -rf extra-cmake-modules + - name: Meson. + run: | + python3 -m pip install meson==0.54.0 + meson --version + + - name: Ninja. + run: | + cd $LibrariesPath + + wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip + unzip ninja-linux.zip + chmod +x ninja + mv ninja /usr/local/bin + + ninja --version + - name: MozJPEG. run: | cd $LibrariesPath git clone -b v4.0.3 --depth=1 $GIT/mozilla/mozjpeg.git cd mozjpeg - cmake -B build . \ + cmake -B build -GNinja . \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr/local \ -DWITH_JPEG8=ON \ @@ -277,16 +291,16 @@ jobs: cd $LibrariesPath git clone -b fix_pulse_default --depth=1 $GIT/telegramdesktop/openal-soft.git - cd openal-soft/build - cmake .. \ + cd openal-soft + cmake -B build -GNinja \ -DCMAKE_BUILD_TYPE=Release \ -DALSOFT_EXAMPLES=OFF \ -DALSOFT_TESTS=OFF \ -DALSOFT_UTILS=OFF \ -DALSOFT_CONFIG=OFF - cmake --build . --parallel - cmake --install . + cmake --build build --parallel + cmake --install build ldconfig cd - @@ -310,7 +324,7 @@ jobs: git clone -b v1.4.0 --depth=1 $GIT/KDE/plasma-wayland-protocols.git cd plasma-wayland-protocols - cmake -B build . -DCMAKE_BUILD_TYPE=Release + cmake -B build -GNinja . -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel cmake --install build cd .. @@ -381,12 +395,12 @@ jobs: git clone -b v5.88.0 --depth=1 $GIT/KDE/kwayland.git cd kwayland - cmake . \ + cmake -B build -GNinja \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=OFF \ -DKDE_INSTALL_LIBDIR=lib - cmake --build . --parallel - cmake --install . + cmake --build build --parallel + cmake --install build ldconfig cd .. rm -rf kwayland @@ -413,9 +427,9 @@ jobs: svn checkout https://svn.code.sf.net/p/qt5ct/code/tags/qt5ct-1.5 qt5ct cd qt5ct - cmake . -DCMAKE_BUILD_TYPE=Release - cmake --build . --parallel - cmake --install . + cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release + cmake --build build --parallel + cmake --install build cd .. rm -rf qt5ct @@ -425,9 +439,9 @@ jobs: git clone -b V0.20.2 --depth=1 $GIT/tsujan/Kvantum.git cd Kvantum/Kvantum - cmake . -DCMAKE_BUILD_TYPE=Release - cmake --build . --parallel - cmake --install . + cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release + cmake --build build --parallel + cmake --install build cd ../.. rm -rf Kvantum @@ -455,7 +469,11 @@ jobs: meson build -Dspa-plugins=disabled cd ../../.. - cmake -B build . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DTG_OWT_DLOPEN_PIPEWIRE=ON + cmake -B build -GNinja . \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=OFF \ + -DTG_OWT_DLOPEN_PIPEWIRE=ON + cmake --build build --parallel - name: Kotatogram Desktop build. diff --git a/.github/workflows/mac-kotato.yml b/.github/workflows/mac-kotato.yml index d22d9e2d6..49d8af29c 100644 --- a/.github/workflows/mac-kotato.yml +++ b/.github/workflows/mac-kotato.yml @@ -58,11 +58,8 @@ jobs: env: GIT: "https://github.com" - PKG_CONFIG_PATH: /usr/local/ffmpeg/lib/pkgconfig - CMAKE_LIBRARY_PATH: /usr/local/ffmpeg/lib OPENALDIR: /usr/local/opt/openal-soft OPENSSL_ROOT_DIR: /usr/local/opt/openssl@1.1 - Qt5_DIR: /usr/local/opt/qt@5/lib/cmake/Qt5 UPLOAD_ARTIFACT: "false" ONLY_CACHE: "false" MANUAL_CACHING: "1" @@ -80,7 +77,7 @@ jobs: - name: First set up. run: | - brew install autoconf automake cmake meson openal-soft openssl opus nasm ninja pkg-config python qt yasm xz + brew install autoconf automake cmake ffmpeg openal-soft openssl@1.1 opus ninja pkg-config python qt yasm xz sudo xcode-select -s /Applications/Xcode.app/Contents/Developer xcodebuild -version > CACHE_KEY.txt @@ -92,8 +89,6 @@ jobs: fi echo "CACHE_KEY=`md5 -q CACHE_KEY.txt`" >> $GITHUB_ENV - echo /usr/local/opt/qt/bin >> $GITHUB_PATH - mkdir -p Libraries/macos cd Libraries/macos echo "LibrariesPath=`pwd`" >> $GITHUB_ENV @@ -111,49 +106,6 @@ jobs: make -j$(sysctl -n hw.logicalcpu) make install - - name: FFmpeg cache. - id: cache-ffmpeg - uses: actions/cache@v2 - with: - path: ${{ env.LibrariesPath }}/ffmpeg-cache - key: ${{ runner.OS }}-ffmpeg-${{ env.CACHE_KEY }} - - name: FFmpeg build. - if: steps.cache-ffmpeg.outputs.cache-hit != 'true' - run: | - cd $LibrariesPath - - git clone --branch release/4.4 $GIT/FFmpeg/FFmpeg ffmpeg - cd ffmpeg - ./configure \ - --prefix=/usr/local/ffmpeg \ - --disable-debug \ - --disable-programs \ - --disable-doc \ - --disable-network \ - --disable-autodetect \ - --disable-encoders \ - --disable-muxers \ - --disable-bsfs \ - --disable-protocols \ - --disable-devices \ - --disable-filters \ - --enable-audiotoolbox \ - --enable-videotoolbox \ - --enable-libopus \ - --enable-protocol=file \ - --enable-encoder=libopus \ - --enable-muxer=ogg \ - --enable-muxer=opus - - make -j$(sysctl -n hw.logicalcpu) - sudo make DESTDIR="$LibrariesPath/ffmpeg-cache" install - cd .. - rm -rf ffmpeg - - name: FFmpeg install. - run: | - cd $LibrariesPath - sudo cp -R ffmpeg-cache/. / - - name: WebRTC cache. id: cache-webrtc uses: actions/cache@v2 @@ -172,8 +124,7 @@ jobs: -GNinja \ -DCMAKE_BUILD_TYPE=Debug \ -DBUILD_SHARED_LIBS=OFF \ - -DTG_OWT_BUILD_AUDIO_BACKENDS=OFF \ - -DTG_OWT_PACKAGED_BUILD_FFMPEG_STATIC=ON + -DTG_OWT_BUILD_AUDIO_BACKENDS=OFF cmake --build build --parallel @@ -200,7 +151,6 @@ jobs: -DCMAKE_CXX_FLAGS="-Werror" \ -DTDESKTOP_API_TEST=ON \ -DDESKTOP_APP_USE_PACKAGED_LAZY=ON \ - -DDESKTOP_APP_USE_PACKAGED_FFMPEG_STATIC=ON \ $DEFINE cmake --build build --parallel @@ -208,6 +158,7 @@ jobs: cd build macdeployqt Kotatogram.app codesign --remove-signature Kotatogram.app + python ../Telegram/build/fix_paths_mac.py Kotatogram.app/Contents/MacOS/Kotatogram mkdir dmgsrc mv Kotatogram.app dmgsrc diff --git a/Telegram/build/fix_paths_mac.py b/Telegram/build/fix_paths_mac.py new file mode 100644 index 000000000..e95977ce8 --- /dev/null +++ b/Telegram/build/fix_paths_mac.py @@ -0,0 +1,66 @@ +import subprocess +import os +import sys +from shutil import copyfile + +executable = sys.argv[1] +app_folder = os.path.join(*executable.split('/')[:-3]) +content_folder = os.path.join(app_folder, "Contents") +framework_path = os.path.join(content_folder, "Frameworks") + +print(executable) +print("Working in {} ".format(app_folder)) + +def file_in_folder(file, folder): + return os.path.exists(os.path.join(folder, file)) + +def otool(s): + o = subprocess.Popen(['/usr/bin/otool', '-L', s], stdout=subprocess.PIPE) + + for l in o.stdout: + l = l.decode() + + if l[0] == '\t': + path = l.split(' ', 1)[0][1:] + + if "@executable_path" in path: + path = path.replace("@executable_path", "") + path = os.path.join(content_folder, path[4:]) + + if "@loader_path" in path: + path = path.replace("@loader_path", framework_path) + + if "@rpath" in path: + path = path.replace("@rpath", framework_path) + + dependency_dylib_name = os.path.split(path)[-1] + + if "usr/local" in path: + if app_folder in s: + + print("Warning: {} depends on {}".format(s, path)) + + if file_in_folder(dependency_dylib_name, framework_path): + print("Dependent library {} is already in framework folder".format(dependency_dylib_name)) + + print("Running install name tool to fix {}.".format(s)) + + if dependency_dylib_name == os.path.split(s)[-1]: + _ = subprocess.Popen(['install_name_tool', '-id', os.path.join("@loader_path", dependency_dylib_name), s], stdout=subprocess.PIPE) + + _ = subprocess.Popen(['install_name_tool', '-change', path, os.path.join("@loader_path", dependency_dylib_name), s], stdout=subprocess.PIPE) + else: + pass + + yield path + +need = set([executable]) +done = set() + +while need: + needed = set(need) + need = set() + for f in needed: + need.update(otool(f)) + done.update(needed) + need.difference_update(done)