One another attempt to fix macOS action
This commit is contained in:
parent
c139447dd8
commit
ac8b7e6051
2 changed files with 69 additions and 52 deletions
55
.github/workflows/mac-kotato.yml
vendored
55
.github/workflows/mac-kotato.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
66
Telegram/build/fix_paths_mac.py
Normal file
66
Telegram/build/fix_paths_mac.py
Normal file
|
|
@ -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)
|
||||
Loading…
Add table
Reference in a new issue